firebase-functions 6.6.0 → 7.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/lib/_virtual/rolldown_runtime.js +34 -0
  2. package/lib/bin/firebase-functions.js +78 -103
  3. package/lib/common/app.js +35 -55
  4. package/lib/common/change.js +54 -75
  5. package/lib/common/config.js +41 -41
  6. package/lib/common/debug.js +23 -47
  7. package/lib/common/encoding.js +59 -82
  8. package/lib/common/onInit.js +26 -28
  9. package/lib/common/options.js +22 -42
  10. package/lib/common/params.d.ts +6 -6
  11. package/lib/common/params.js +0 -23
  12. package/lib/common/providers/database.js +270 -300
  13. package/lib/common/providers/firestore.js +66 -92
  14. package/lib/common/providers/https.d.ts +0 -1
  15. package/lib/common/providers/https.js +537 -539
  16. package/lib/common/providers/identity.js +393 -444
  17. package/lib/common/providers/tasks.js +64 -98
  18. package/lib/common/timezone.js +544 -542
  19. package/lib/common/trace.d.ts +0 -1
  20. package/lib/common/trace.js +63 -55
  21. package/lib/common/utilities/assertions.d.ts +11 -0
  22. package/lib/common/utilities/assertions.js +18 -0
  23. package/lib/common/utilities/encoder.js +20 -37
  24. package/lib/common/utilities/path-pattern.js +106 -132
  25. package/lib/common/utilities/path.js +28 -27
  26. package/lib/common/utilities/utils.js +23 -45
  27. package/lib/esm/_virtual/rolldown_runtime.mjs +16 -0
  28. package/lib/esm/bin/firebase-functions.mjs +91 -0
  29. package/lib/esm/common/app.mjs +39 -0
  30. package/lib/esm/common/change.mjs +57 -0
  31. package/lib/esm/common/config.mjs +45 -0
  32. package/lib/esm/common/debug.mjs +28 -0
  33. package/lib/esm/common/encoding.mjs +69 -0
  34. package/lib/esm/common/onInit.mjs +33 -0
  35. package/lib/esm/common/options.mjs +22 -0
  36. package/lib/esm/common/params.mjs +1 -0
  37. package/lib/esm/common/providers/database.mjs +269 -0
  38. package/lib/esm/common/providers/firestore.mjs +78 -0
  39. package/lib/esm/common/providers/https.mjs +573 -0
  40. package/lib/esm/common/providers/identity.mjs +428 -0
  41. package/lib/esm/common/providers/tasks.mjs +67 -0
  42. package/lib/esm/common/timezone.mjs +544 -0
  43. package/lib/esm/common/trace.mjs +73 -0
  44. package/lib/esm/common/utilities/assertions.mjs +17 -0
  45. package/lib/esm/common/utilities/encoder.mjs +21 -0
  46. package/lib/esm/common/utilities/path-pattern.mjs +116 -0
  47. package/lib/esm/common/utilities/path.mjs +35 -0
  48. package/lib/esm/common/utilities/utils.mjs +29 -0
  49. package/lib/esm/function-configuration.mjs +1 -0
  50. package/lib/esm/logger/common.mjs +23 -0
  51. package/lib/esm/logger/compat.mjs +25 -0
  52. package/lib/esm/logger/index.mjs +131 -0
  53. package/lib/esm/params/index.mjs +160 -0
  54. package/lib/esm/params/types.mjs +400 -0
  55. package/lib/esm/runtime/loader.mjs +132 -0
  56. package/lib/esm/runtime/manifest.mjs +134 -0
  57. package/lib/esm/types/global.d.mjs +1 -0
  58. package/lib/esm/v1/cloud-functions.mjs +206 -0
  59. package/lib/esm/v1/config.mjs +14 -0
  60. package/lib/esm/v1/function-builder.mjs +252 -0
  61. package/lib/esm/v1/function-configuration.mjs +72 -0
  62. package/lib/esm/v1/index.mjs +27 -0
  63. package/lib/esm/v1/providers/analytics.mjs +212 -0
  64. package/lib/esm/v1/providers/auth.mjs +156 -0
  65. package/lib/esm/v1/providers/database.mjs +243 -0
  66. package/lib/esm/v1/providers/firestore.mjs +131 -0
  67. package/lib/esm/v1/providers/https.mjs +82 -0
  68. package/lib/esm/v1/providers/pubsub.mjs +175 -0
  69. package/lib/esm/v1/providers/remoteConfig.mjs +64 -0
  70. package/lib/esm/v1/providers/storage.mjs +163 -0
  71. package/lib/esm/v1/providers/tasks.mjs +63 -0
  72. package/lib/esm/v1/providers/testLab.mjs +94 -0
  73. package/lib/esm/v2/core.mjs +4 -0
  74. package/lib/esm/v2/index.mjs +28 -0
  75. package/lib/esm/v2/options.mjs +102 -0
  76. package/lib/esm/v2/providers/alerts/alerts.mjs +85 -0
  77. package/lib/esm/v2/providers/alerts/appDistribution.mjs +75 -0
  78. package/lib/esm/v2/providers/alerts/billing.mjs +51 -0
  79. package/lib/esm/v2/providers/alerts/crashlytics.mjs +122 -0
  80. package/lib/esm/v2/providers/alerts/index.mjs +22 -0
  81. package/lib/esm/v2/providers/alerts/performance.mjs +66 -0
  82. package/lib/esm/v2/providers/database.mjs +197 -0
  83. package/lib/esm/v2/providers/dataconnect.mjs +130 -0
  84. package/lib/esm/v2/providers/eventarc.mjs +51 -0
  85. package/lib/esm/v2/providers/firestore.mjs +294 -0
  86. package/lib/esm/v2/providers/https.mjs +210 -0
  87. package/lib/esm/v2/providers/identity.mjs +103 -0
  88. package/lib/esm/v2/providers/pubsub.mjs +148 -0
  89. package/lib/esm/v2/providers/remoteConfig.mjs +52 -0
  90. package/lib/esm/v2/providers/scheduler.mjs +84 -0
  91. package/lib/esm/v2/providers/storage.mjs +155 -0
  92. package/lib/esm/v2/providers/tasks.mjs +65 -0
  93. package/lib/esm/v2/providers/testLab.mjs +53 -0
  94. package/lib/esm/v2/trace.mjs +20 -0
  95. package/lib/function-configuration.d.ts +0 -0
  96. package/lib/function-configuration.js +0 -0
  97. package/lib/logger/common.js +21 -41
  98. package/lib/logger/compat.js +18 -33
  99. package/lib/logger/index.js +119 -130
  100. package/lib/params/index.d.ts +4 -2
  101. package/lib/params/index.js +150 -144
  102. package/lib/params/types.js +389 -423
  103. package/lib/runtime/loader.js +114 -148
  104. package/lib/runtime/manifest.js +106 -126
  105. package/lib/types/global.d.js +0 -0
  106. package/lib/v1/cloud-functions.d.ts +2 -2
  107. package/lib/v1/cloud-functions.js +193 -241
  108. package/lib/v1/config.d.ts +4 -7
  109. package/lib/v1/config.js +13 -75
  110. package/lib/v1/function-builder.js +239 -368
  111. package/lib/v1/function-configuration.js +70 -63
  112. package/lib/v1/index.js +118 -73
  113. package/lib/v1/providers/analytics.js +188 -235
  114. package/lib/v1/providers/auth.d.ts +2 -1
  115. package/lib/v1/providers/auth.js +159 -164
  116. package/lib/v1/providers/database.js +237 -242
  117. package/lib/v1/providers/firestore.js +131 -130
  118. package/lib/v1/providers/https.d.ts +2 -1
  119. package/lib/v1/providers/https.js +79 -86
  120. package/lib/v1/providers/pubsub.js +175 -172
  121. package/lib/v1/providers/remoteConfig.js +64 -68
  122. package/lib/v1/providers/storage.js +161 -163
  123. package/lib/v1/providers/tasks.d.ts +1 -1
  124. package/lib/v1/providers/tasks.js +65 -80
  125. package/lib/v1/providers/testLab.js +94 -94
  126. package/lib/v2/core.d.ts +1 -1
  127. package/lib/v2/core.js +5 -32
  128. package/lib/v2/index.d.ts +6 -3
  129. package/lib/v2/index.js +123 -75
  130. package/lib/v2/options.js +88 -114
  131. package/lib/v2/providers/alerts/alerts.js +76 -95
  132. package/lib/v2/providers/alerts/appDistribution.js +73 -78
  133. package/lib/v2/providers/alerts/billing.js +49 -53
  134. package/lib/v2/providers/alerts/crashlytics.js +110 -102
  135. package/lib/v2/providers/alerts/index.js +56 -53
  136. package/lib/v2/providers/alerts/performance.js +64 -74
  137. package/lib/v2/providers/database.js +177 -180
  138. package/lib/v2/providers/dataconnect.d.ts +95 -0
  139. package/lib/v2/providers/dataconnect.js +137 -0
  140. package/lib/v2/providers/eventarc.js +55 -77
  141. package/lib/v2/providers/firestore.js +262 -260
  142. package/lib/v2/providers/https.d.ts +3 -2
  143. package/lib/v2/providers/https.js +210 -247
  144. package/lib/v2/providers/identity.d.ts +2 -1
  145. package/lib/v2/providers/identity.js +96 -105
  146. package/lib/v2/providers/pubsub.js +149 -167
  147. package/lib/v2/providers/remoteConfig.js +54 -63
  148. package/lib/v2/providers/scheduler.js +84 -96
  149. package/lib/v2/providers/storage.js +147 -162
  150. package/lib/v2/providers/tasks.d.ts +1 -1
  151. package/lib/v2/providers/tasks.js +68 -95
  152. package/lib/v2/providers/testLab.js +55 -64
  153. package/lib/v2/trace.js +18 -19
  154. package/package.json +321 -88
  155. package/protos/compiledFirestore.mjs +3512 -0
  156. package/protos/update.sh +28 -7
@@ -0,0 +1,3512 @@
1
+ /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
2
+ import $protobuf from "protobufjs/minimal.js";
3
+
4
+ // Common aliases
5
+ const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
6
+
7
+ // Exported root namespace
8
+ const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
9
+
10
+ export const google = $root.google = (() => {
11
+
12
+ /**
13
+ * Namespace google.
14
+ * @exports google
15
+ * @namespace
16
+ */
17
+ const google = {};
18
+
19
+ google.protobuf = (function() {
20
+
21
+ /**
22
+ * Namespace protobuf.
23
+ * @memberof google
24
+ * @namespace
25
+ */
26
+ const protobuf = {};
27
+
28
+ protobuf.Struct = (function() {
29
+
30
+ /**
31
+ * Properties of a Struct.
32
+ * @memberof google.protobuf
33
+ * @interface IStruct
34
+ * @property {Object.<string,google.protobuf.IValue>|null} [fields] Struct fields
35
+ */
36
+
37
+ /**
38
+ * Constructs a new Struct.
39
+ * @memberof google.protobuf
40
+ * @classdesc Represents a Struct.
41
+ * @implements IStruct
42
+ * @constructor
43
+ * @param {google.protobuf.IStruct=} [properties] Properties to set
44
+ */
45
+ function Struct(properties) {
46
+ this.fields = {};
47
+ if (properties)
48
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
49
+ if (properties[keys[i]] != null)
50
+ this[keys[i]] = properties[keys[i]];
51
+ }
52
+
53
+ /**
54
+ * Struct fields.
55
+ * @member {Object.<string,google.protobuf.IValue>} fields
56
+ * @memberof google.protobuf.Struct
57
+ * @instance
58
+ */
59
+ Struct.prototype.fields = $util.emptyObject;
60
+
61
+ /**
62
+ * Creates a new Struct instance using the specified properties.
63
+ * @function create
64
+ * @memberof google.protobuf.Struct
65
+ * @static
66
+ * @param {google.protobuf.IStruct=} [properties] Properties to set
67
+ * @returns {google.protobuf.Struct} Struct instance
68
+ */
69
+ Struct.create = function create(properties) {
70
+ return new Struct(properties);
71
+ };
72
+
73
+ /**
74
+ * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages.
75
+ * @function encode
76
+ * @memberof google.protobuf.Struct
77
+ * @static
78
+ * @param {google.protobuf.IStruct} message Struct message or plain object to encode
79
+ * @param {$protobuf.Writer} [writer] Writer to encode to
80
+ * @returns {$protobuf.Writer} Writer
81
+ */
82
+ Struct.encode = function encode(message, writer) {
83
+ if (!writer)
84
+ writer = $Writer.create();
85
+ if (message.fields != null && Object.hasOwnProperty.call(message, "fields"))
86
+ for (let keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) {
87
+ writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
88
+ $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
89
+ }
90
+ return writer;
91
+ };
92
+
93
+ /**
94
+ * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages.
95
+ * @function encodeDelimited
96
+ * @memberof google.protobuf.Struct
97
+ * @static
98
+ * @param {google.protobuf.IStruct} message Struct message or plain object to encode
99
+ * @param {$protobuf.Writer} [writer] Writer to encode to
100
+ * @returns {$protobuf.Writer} Writer
101
+ */
102
+ Struct.encodeDelimited = function encodeDelimited(message, writer) {
103
+ return this.encode(message, writer).ldelim();
104
+ };
105
+
106
+ /**
107
+ * Decodes a Struct message from the specified reader or buffer.
108
+ * @function decode
109
+ * @memberof google.protobuf.Struct
110
+ * @static
111
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
112
+ * @param {number} [length] Message length if known beforehand
113
+ * @returns {google.protobuf.Struct} Struct
114
+ * @throws {Error} If the payload is not a reader or valid buffer
115
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
116
+ */
117
+ Struct.decode = function decode(reader, length) {
118
+ if (!(reader instanceof $Reader))
119
+ reader = $Reader.create(reader);
120
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Struct(), key, value;
121
+ while (reader.pos < end) {
122
+ let tag = reader.uint32();
123
+ switch (tag >>> 3) {
124
+ case 1: {
125
+ if (message.fields === $util.emptyObject)
126
+ message.fields = {};
127
+ let end2 = reader.uint32() + reader.pos;
128
+ key = "";
129
+ value = null;
130
+ while (reader.pos < end2) {
131
+ let tag2 = reader.uint32();
132
+ switch (tag2 >>> 3) {
133
+ case 1:
134
+ key = reader.string();
135
+ break;
136
+ case 2:
137
+ value = $root.google.protobuf.Value.decode(reader, reader.uint32());
138
+ break;
139
+ default:
140
+ reader.skipType(tag2 & 7);
141
+ break;
142
+ }
143
+ }
144
+ message.fields[key] = value;
145
+ break;
146
+ }
147
+ default:
148
+ reader.skipType(tag & 7);
149
+ break;
150
+ }
151
+ }
152
+ return message;
153
+ };
154
+
155
+ /**
156
+ * Decodes a Struct message from the specified reader or buffer, length delimited.
157
+ * @function decodeDelimited
158
+ * @memberof google.protobuf.Struct
159
+ * @static
160
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
161
+ * @returns {google.protobuf.Struct} Struct
162
+ * @throws {Error} If the payload is not a reader or valid buffer
163
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
164
+ */
165
+ Struct.decodeDelimited = function decodeDelimited(reader) {
166
+ if (!(reader instanceof $Reader))
167
+ reader = new $Reader(reader);
168
+ return this.decode(reader, reader.uint32());
169
+ };
170
+
171
+ /**
172
+ * Verifies a Struct message.
173
+ * @function verify
174
+ * @memberof google.protobuf.Struct
175
+ * @static
176
+ * @param {Object.<string,*>} message Plain object to verify
177
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
178
+ */
179
+ Struct.verify = function verify(message) {
180
+ if (typeof message !== "object" || message === null)
181
+ return "object expected";
182
+ if (message.fields != null && message.hasOwnProperty("fields")) {
183
+ if (!$util.isObject(message.fields))
184
+ return "fields: object expected";
185
+ let key = Object.keys(message.fields);
186
+ for (let i = 0; i < key.length; ++i) {
187
+ let error = $root.google.protobuf.Value.verify(message.fields[key[i]]);
188
+ if (error)
189
+ return "fields." + error;
190
+ }
191
+ }
192
+ return null;
193
+ };
194
+
195
+ /**
196
+ * Creates a Struct message from a plain object. Also converts values to their respective internal types.
197
+ * @function fromObject
198
+ * @memberof google.protobuf.Struct
199
+ * @static
200
+ * @param {Object.<string,*>} object Plain object
201
+ * @returns {google.protobuf.Struct} Struct
202
+ */
203
+ Struct.fromObject = function fromObject(object) {
204
+ if (object instanceof $root.google.protobuf.Struct)
205
+ return object;
206
+ let message = new $root.google.protobuf.Struct();
207
+ if (object.fields) {
208
+ if (typeof object.fields !== "object")
209
+ throw TypeError(".google.protobuf.Struct.fields: object expected");
210
+ message.fields = {};
211
+ for (let keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) {
212
+ if (typeof object.fields[keys[i]] !== "object")
213
+ throw TypeError(".google.protobuf.Struct.fields: object expected");
214
+ message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]]);
215
+ }
216
+ }
217
+ return message;
218
+ };
219
+
220
+ /**
221
+ * Creates a plain object from a Struct message. Also converts values to other types if specified.
222
+ * @function toObject
223
+ * @memberof google.protobuf.Struct
224
+ * @static
225
+ * @param {google.protobuf.Struct} message Struct
226
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
227
+ * @returns {Object.<string,*>} Plain object
228
+ */
229
+ Struct.toObject = function toObject(message, options) {
230
+ if (!options)
231
+ options = {};
232
+ let object = {};
233
+ if (options.objects || options.defaults)
234
+ object.fields = {};
235
+ let keys2;
236
+ if (message.fields && (keys2 = Object.keys(message.fields)).length) {
237
+ object.fields = {};
238
+ for (let j = 0; j < keys2.length; ++j)
239
+ object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options);
240
+ }
241
+ return object;
242
+ };
243
+
244
+ /**
245
+ * Converts this Struct to JSON.
246
+ * @function toJSON
247
+ * @memberof google.protobuf.Struct
248
+ * @instance
249
+ * @returns {Object.<string,*>} JSON object
250
+ */
251
+ Struct.prototype.toJSON = function toJSON() {
252
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
253
+ };
254
+
255
+ /**
256
+ * Gets the default type url for Struct
257
+ * @function getTypeUrl
258
+ * @memberof google.protobuf.Struct
259
+ * @static
260
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
261
+ * @returns {string} The default type url
262
+ */
263
+ Struct.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
264
+ if (typeUrlPrefix === undefined) {
265
+ typeUrlPrefix = "type.googleapis.com";
266
+ }
267
+ return typeUrlPrefix + "/google.protobuf.Struct";
268
+ };
269
+
270
+ return Struct;
271
+ })();
272
+
273
+ protobuf.Value = (function() {
274
+
275
+ /**
276
+ * Properties of a Value.
277
+ * @memberof google.protobuf
278
+ * @interface IValue
279
+ * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue
280
+ * @property {number|null} [numberValue] Value numberValue
281
+ * @property {string|null} [stringValue] Value stringValue
282
+ * @property {boolean|null} [boolValue] Value boolValue
283
+ * @property {google.protobuf.IStruct|null} [structValue] Value structValue
284
+ * @property {google.protobuf.IListValue|null} [listValue] Value listValue
285
+ */
286
+
287
+ /**
288
+ * Constructs a new Value.
289
+ * @memberof google.protobuf
290
+ * @classdesc Represents a Value.
291
+ * @implements IValue
292
+ * @constructor
293
+ * @param {google.protobuf.IValue=} [properties] Properties to set
294
+ */
295
+ function Value(properties) {
296
+ if (properties)
297
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
298
+ if (properties[keys[i]] != null)
299
+ this[keys[i]] = properties[keys[i]];
300
+ }
301
+
302
+ /**
303
+ * Value nullValue.
304
+ * @member {google.protobuf.NullValue|null|undefined} nullValue
305
+ * @memberof google.protobuf.Value
306
+ * @instance
307
+ */
308
+ Value.prototype.nullValue = null;
309
+
310
+ /**
311
+ * Value numberValue.
312
+ * @member {number|null|undefined} numberValue
313
+ * @memberof google.protobuf.Value
314
+ * @instance
315
+ */
316
+ Value.prototype.numberValue = null;
317
+
318
+ /**
319
+ * Value stringValue.
320
+ * @member {string|null|undefined} stringValue
321
+ * @memberof google.protobuf.Value
322
+ * @instance
323
+ */
324
+ Value.prototype.stringValue = null;
325
+
326
+ /**
327
+ * Value boolValue.
328
+ * @member {boolean|null|undefined} boolValue
329
+ * @memberof google.protobuf.Value
330
+ * @instance
331
+ */
332
+ Value.prototype.boolValue = null;
333
+
334
+ /**
335
+ * Value structValue.
336
+ * @member {google.protobuf.IStruct|null|undefined} structValue
337
+ * @memberof google.protobuf.Value
338
+ * @instance
339
+ */
340
+ Value.prototype.structValue = null;
341
+
342
+ /**
343
+ * Value listValue.
344
+ * @member {google.protobuf.IListValue|null|undefined} listValue
345
+ * @memberof google.protobuf.Value
346
+ * @instance
347
+ */
348
+ Value.prototype.listValue = null;
349
+
350
+ // OneOf field names bound to virtual getters and setters
351
+ let $oneOfFields;
352
+
353
+ /**
354
+ * Value kind.
355
+ * @member {"nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"|undefined} kind
356
+ * @memberof google.protobuf.Value
357
+ * @instance
358
+ */
359
+ Object.defineProperty(Value.prototype, "kind", {
360
+ get: $util.oneOfGetter($oneOfFields = ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"]),
361
+ set: $util.oneOfSetter($oneOfFields)
362
+ });
363
+
364
+ /**
365
+ * Creates a new Value instance using the specified properties.
366
+ * @function create
367
+ * @memberof google.protobuf.Value
368
+ * @static
369
+ * @param {google.protobuf.IValue=} [properties] Properties to set
370
+ * @returns {google.protobuf.Value} Value instance
371
+ */
372
+ Value.create = function create(properties) {
373
+ return new Value(properties);
374
+ };
375
+
376
+ /**
377
+ * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages.
378
+ * @function encode
379
+ * @memberof google.protobuf.Value
380
+ * @static
381
+ * @param {google.protobuf.IValue} message Value message or plain object to encode
382
+ * @param {$protobuf.Writer} [writer] Writer to encode to
383
+ * @returns {$protobuf.Writer} Writer
384
+ */
385
+ Value.encode = function encode(message, writer) {
386
+ if (!writer)
387
+ writer = $Writer.create();
388
+ if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue"))
389
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue);
390
+ if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue"))
391
+ writer.uint32(/* id 2, wireType 1 =*/17).double(message.numberValue);
392
+ if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue"))
393
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue);
394
+ if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue"))
395
+ writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue);
396
+ if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue"))
397
+ $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
398
+ if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue"))
399
+ $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
400
+ return writer;
401
+ };
402
+
403
+ /**
404
+ * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages.
405
+ * @function encodeDelimited
406
+ * @memberof google.protobuf.Value
407
+ * @static
408
+ * @param {google.protobuf.IValue} message Value message or plain object to encode
409
+ * @param {$protobuf.Writer} [writer] Writer to encode to
410
+ * @returns {$protobuf.Writer} Writer
411
+ */
412
+ Value.encodeDelimited = function encodeDelimited(message, writer) {
413
+ return this.encode(message, writer).ldelim();
414
+ };
415
+
416
+ /**
417
+ * Decodes a Value message from the specified reader or buffer.
418
+ * @function decode
419
+ * @memberof google.protobuf.Value
420
+ * @static
421
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
422
+ * @param {number} [length] Message length if known beforehand
423
+ * @returns {google.protobuf.Value} Value
424
+ * @throws {Error} If the payload is not a reader or valid buffer
425
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
426
+ */
427
+ Value.decode = function decode(reader, length) {
428
+ if (!(reader instanceof $Reader))
429
+ reader = $Reader.create(reader);
430
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Value();
431
+ while (reader.pos < end) {
432
+ let tag = reader.uint32();
433
+ switch (tag >>> 3) {
434
+ case 1: {
435
+ message.nullValue = reader.int32();
436
+ break;
437
+ }
438
+ case 2: {
439
+ message.numberValue = reader.double();
440
+ break;
441
+ }
442
+ case 3: {
443
+ message.stringValue = reader.string();
444
+ break;
445
+ }
446
+ case 4: {
447
+ message.boolValue = reader.bool();
448
+ break;
449
+ }
450
+ case 5: {
451
+ message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32());
452
+ break;
453
+ }
454
+ case 6: {
455
+ message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32());
456
+ break;
457
+ }
458
+ default:
459
+ reader.skipType(tag & 7);
460
+ break;
461
+ }
462
+ }
463
+ return message;
464
+ };
465
+
466
+ /**
467
+ * Decodes a Value message from the specified reader or buffer, length delimited.
468
+ * @function decodeDelimited
469
+ * @memberof google.protobuf.Value
470
+ * @static
471
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
472
+ * @returns {google.protobuf.Value} Value
473
+ * @throws {Error} If the payload is not a reader or valid buffer
474
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
475
+ */
476
+ Value.decodeDelimited = function decodeDelimited(reader) {
477
+ if (!(reader instanceof $Reader))
478
+ reader = new $Reader(reader);
479
+ return this.decode(reader, reader.uint32());
480
+ };
481
+
482
+ /**
483
+ * Verifies a Value message.
484
+ * @function verify
485
+ * @memberof google.protobuf.Value
486
+ * @static
487
+ * @param {Object.<string,*>} message Plain object to verify
488
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
489
+ */
490
+ Value.verify = function verify(message) {
491
+ if (typeof message !== "object" || message === null)
492
+ return "object expected";
493
+ let properties = {};
494
+ if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
495
+ properties.kind = 1;
496
+ switch (message.nullValue) {
497
+ default:
498
+ return "nullValue: enum value expected";
499
+ case 0:
500
+ break;
501
+ }
502
+ }
503
+ if (message.numberValue != null && message.hasOwnProperty("numberValue")) {
504
+ if (properties.kind === 1)
505
+ return "kind: multiple values";
506
+ properties.kind = 1;
507
+ if (typeof message.numberValue !== "number")
508
+ return "numberValue: number expected";
509
+ }
510
+ if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
511
+ if (properties.kind === 1)
512
+ return "kind: multiple values";
513
+ properties.kind = 1;
514
+ if (!$util.isString(message.stringValue))
515
+ return "stringValue: string expected";
516
+ }
517
+ if (message.boolValue != null && message.hasOwnProperty("boolValue")) {
518
+ if (properties.kind === 1)
519
+ return "kind: multiple values";
520
+ properties.kind = 1;
521
+ if (typeof message.boolValue !== "boolean")
522
+ return "boolValue: boolean expected";
523
+ }
524
+ if (message.structValue != null && message.hasOwnProperty("structValue")) {
525
+ if (properties.kind === 1)
526
+ return "kind: multiple values";
527
+ properties.kind = 1;
528
+ {
529
+ let error = $root.google.protobuf.Struct.verify(message.structValue);
530
+ if (error)
531
+ return "structValue." + error;
532
+ }
533
+ }
534
+ if (message.listValue != null && message.hasOwnProperty("listValue")) {
535
+ if (properties.kind === 1)
536
+ return "kind: multiple values";
537
+ properties.kind = 1;
538
+ {
539
+ let error = $root.google.protobuf.ListValue.verify(message.listValue);
540
+ if (error)
541
+ return "listValue." + error;
542
+ }
543
+ }
544
+ return null;
545
+ };
546
+
547
+ /**
548
+ * Creates a Value message from a plain object. Also converts values to their respective internal types.
549
+ * @function fromObject
550
+ * @memberof google.protobuf.Value
551
+ * @static
552
+ * @param {Object.<string,*>} object Plain object
553
+ * @returns {google.protobuf.Value} Value
554
+ */
555
+ Value.fromObject = function fromObject(object) {
556
+ if (object instanceof $root.google.protobuf.Value)
557
+ return object;
558
+ let message = new $root.google.protobuf.Value();
559
+ switch (object.nullValue) {
560
+ default:
561
+ if (typeof object.nullValue === "number") {
562
+ message.nullValue = object.nullValue;
563
+ break;
564
+ }
565
+ break;
566
+ case "NULL_VALUE":
567
+ case 0:
568
+ message.nullValue = 0;
569
+ break;
570
+ }
571
+ if (object.numberValue != null)
572
+ message.numberValue = Number(object.numberValue);
573
+ if (object.stringValue != null)
574
+ message.stringValue = String(object.stringValue);
575
+ if (object.boolValue != null)
576
+ message.boolValue = Boolean(object.boolValue);
577
+ if (object.structValue != null) {
578
+ if (typeof object.structValue !== "object")
579
+ throw TypeError(".google.protobuf.Value.structValue: object expected");
580
+ message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue);
581
+ }
582
+ if (object.listValue != null) {
583
+ if (typeof object.listValue !== "object")
584
+ throw TypeError(".google.protobuf.Value.listValue: object expected");
585
+ message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue);
586
+ }
587
+ return message;
588
+ };
589
+
590
+ /**
591
+ * Creates a plain object from a Value message. Also converts values to other types if specified.
592
+ * @function toObject
593
+ * @memberof google.protobuf.Value
594
+ * @static
595
+ * @param {google.protobuf.Value} message Value
596
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
597
+ * @returns {Object.<string,*>} Plain object
598
+ */
599
+ Value.toObject = function toObject(message, options) {
600
+ if (!options)
601
+ options = {};
602
+ let object = {};
603
+ if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
604
+ object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue;
605
+ if (options.oneofs)
606
+ object.kind = "nullValue";
607
+ }
608
+ if (message.numberValue != null && message.hasOwnProperty("numberValue")) {
609
+ object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue;
610
+ if (options.oneofs)
611
+ object.kind = "numberValue";
612
+ }
613
+ if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
614
+ object.stringValue = message.stringValue;
615
+ if (options.oneofs)
616
+ object.kind = "stringValue";
617
+ }
618
+ if (message.boolValue != null && message.hasOwnProperty("boolValue")) {
619
+ object.boolValue = message.boolValue;
620
+ if (options.oneofs)
621
+ object.kind = "boolValue";
622
+ }
623
+ if (message.structValue != null && message.hasOwnProperty("structValue")) {
624
+ object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options);
625
+ if (options.oneofs)
626
+ object.kind = "structValue";
627
+ }
628
+ if (message.listValue != null && message.hasOwnProperty("listValue")) {
629
+ object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options);
630
+ if (options.oneofs)
631
+ object.kind = "listValue";
632
+ }
633
+ return object;
634
+ };
635
+
636
+ /**
637
+ * Converts this Value to JSON.
638
+ * @function toJSON
639
+ * @memberof google.protobuf.Value
640
+ * @instance
641
+ * @returns {Object.<string,*>} JSON object
642
+ */
643
+ Value.prototype.toJSON = function toJSON() {
644
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
645
+ };
646
+
647
+ /**
648
+ * Gets the default type url for Value
649
+ * @function getTypeUrl
650
+ * @memberof google.protobuf.Value
651
+ * @static
652
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
653
+ * @returns {string} The default type url
654
+ */
655
+ Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
656
+ if (typeUrlPrefix === undefined) {
657
+ typeUrlPrefix = "type.googleapis.com";
658
+ }
659
+ return typeUrlPrefix + "/google.protobuf.Value";
660
+ };
661
+
662
+ return Value;
663
+ })();
664
+
665
+ /**
666
+ * NullValue enum.
667
+ * @name google.protobuf.NullValue
668
+ * @enum {number}
669
+ * @property {number} NULL_VALUE=0 NULL_VALUE value
670
+ */
671
+ protobuf.NullValue = (function() {
672
+ const valuesById = {}, values = Object.create(valuesById);
673
+ values[valuesById[0] = "NULL_VALUE"] = 0;
674
+ return values;
675
+ })();
676
+
677
+ protobuf.ListValue = (function() {
678
+
679
+ /**
680
+ * Properties of a ListValue.
681
+ * @memberof google.protobuf
682
+ * @interface IListValue
683
+ * @property {Array.<google.protobuf.IValue>|null} [values] ListValue values
684
+ */
685
+
686
+ /**
687
+ * Constructs a new ListValue.
688
+ * @memberof google.protobuf
689
+ * @classdesc Represents a ListValue.
690
+ * @implements IListValue
691
+ * @constructor
692
+ * @param {google.protobuf.IListValue=} [properties] Properties to set
693
+ */
694
+ function ListValue(properties) {
695
+ this.values = [];
696
+ if (properties)
697
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
698
+ if (properties[keys[i]] != null)
699
+ this[keys[i]] = properties[keys[i]];
700
+ }
701
+
702
+ /**
703
+ * ListValue values.
704
+ * @member {Array.<google.protobuf.IValue>} values
705
+ * @memberof google.protobuf.ListValue
706
+ * @instance
707
+ */
708
+ ListValue.prototype.values = $util.emptyArray;
709
+
710
+ /**
711
+ * Creates a new ListValue instance using the specified properties.
712
+ * @function create
713
+ * @memberof google.protobuf.ListValue
714
+ * @static
715
+ * @param {google.protobuf.IListValue=} [properties] Properties to set
716
+ * @returns {google.protobuf.ListValue} ListValue instance
717
+ */
718
+ ListValue.create = function create(properties) {
719
+ return new ListValue(properties);
720
+ };
721
+
722
+ /**
723
+ * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages.
724
+ * @function encode
725
+ * @memberof google.protobuf.ListValue
726
+ * @static
727
+ * @param {google.protobuf.IListValue} message ListValue message or plain object to encode
728
+ * @param {$protobuf.Writer} [writer] Writer to encode to
729
+ * @returns {$protobuf.Writer} Writer
730
+ */
731
+ ListValue.encode = function encode(message, writer) {
732
+ if (!writer)
733
+ writer = $Writer.create();
734
+ if (message.values != null && message.values.length)
735
+ for (let i = 0; i < message.values.length; ++i)
736
+ $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
737
+ return writer;
738
+ };
739
+
740
+ /**
741
+ * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages.
742
+ * @function encodeDelimited
743
+ * @memberof google.protobuf.ListValue
744
+ * @static
745
+ * @param {google.protobuf.IListValue} message ListValue message or plain object to encode
746
+ * @param {$protobuf.Writer} [writer] Writer to encode to
747
+ * @returns {$protobuf.Writer} Writer
748
+ */
749
+ ListValue.encodeDelimited = function encodeDelimited(message, writer) {
750
+ return this.encode(message, writer).ldelim();
751
+ };
752
+
753
+ /**
754
+ * Decodes a ListValue message from the specified reader or buffer.
755
+ * @function decode
756
+ * @memberof google.protobuf.ListValue
757
+ * @static
758
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
759
+ * @param {number} [length] Message length if known beforehand
760
+ * @returns {google.protobuf.ListValue} ListValue
761
+ * @throws {Error} If the payload is not a reader or valid buffer
762
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
763
+ */
764
+ ListValue.decode = function decode(reader, length) {
765
+ if (!(reader instanceof $Reader))
766
+ reader = $Reader.create(reader);
767
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ListValue();
768
+ while (reader.pos < end) {
769
+ let tag = reader.uint32();
770
+ switch (tag >>> 3) {
771
+ case 1: {
772
+ if (!(message.values && message.values.length))
773
+ message.values = [];
774
+ message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32()));
775
+ break;
776
+ }
777
+ default:
778
+ reader.skipType(tag & 7);
779
+ break;
780
+ }
781
+ }
782
+ return message;
783
+ };
784
+
785
+ /**
786
+ * Decodes a ListValue message from the specified reader or buffer, length delimited.
787
+ * @function decodeDelimited
788
+ * @memberof google.protobuf.ListValue
789
+ * @static
790
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
791
+ * @returns {google.protobuf.ListValue} ListValue
792
+ * @throws {Error} If the payload is not a reader or valid buffer
793
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
794
+ */
795
+ ListValue.decodeDelimited = function decodeDelimited(reader) {
796
+ if (!(reader instanceof $Reader))
797
+ reader = new $Reader(reader);
798
+ return this.decode(reader, reader.uint32());
799
+ };
800
+
801
+ /**
802
+ * Verifies a ListValue message.
803
+ * @function verify
804
+ * @memberof google.protobuf.ListValue
805
+ * @static
806
+ * @param {Object.<string,*>} message Plain object to verify
807
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
808
+ */
809
+ ListValue.verify = function verify(message) {
810
+ if (typeof message !== "object" || message === null)
811
+ return "object expected";
812
+ if (message.values != null && message.hasOwnProperty("values")) {
813
+ if (!Array.isArray(message.values))
814
+ return "values: array expected";
815
+ for (let i = 0; i < message.values.length; ++i) {
816
+ let error = $root.google.protobuf.Value.verify(message.values[i]);
817
+ if (error)
818
+ return "values." + error;
819
+ }
820
+ }
821
+ return null;
822
+ };
823
+
824
+ /**
825
+ * Creates a ListValue message from a plain object. Also converts values to their respective internal types.
826
+ * @function fromObject
827
+ * @memberof google.protobuf.ListValue
828
+ * @static
829
+ * @param {Object.<string,*>} object Plain object
830
+ * @returns {google.protobuf.ListValue} ListValue
831
+ */
832
+ ListValue.fromObject = function fromObject(object) {
833
+ if (object instanceof $root.google.protobuf.ListValue)
834
+ return object;
835
+ let message = new $root.google.protobuf.ListValue();
836
+ if (object.values) {
837
+ if (!Array.isArray(object.values))
838
+ throw TypeError(".google.protobuf.ListValue.values: array expected");
839
+ message.values = [];
840
+ for (let i = 0; i < object.values.length; ++i) {
841
+ if (typeof object.values[i] !== "object")
842
+ throw TypeError(".google.protobuf.ListValue.values: object expected");
843
+ message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i]);
844
+ }
845
+ }
846
+ return message;
847
+ };
848
+
849
+ /**
850
+ * Creates a plain object from a ListValue message. Also converts values to other types if specified.
851
+ * @function toObject
852
+ * @memberof google.protobuf.ListValue
853
+ * @static
854
+ * @param {google.protobuf.ListValue} message ListValue
855
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
856
+ * @returns {Object.<string,*>} Plain object
857
+ */
858
+ ListValue.toObject = function toObject(message, options) {
859
+ if (!options)
860
+ options = {};
861
+ let object = {};
862
+ if (options.arrays || options.defaults)
863
+ object.values = [];
864
+ if (message.values && message.values.length) {
865
+ object.values = [];
866
+ for (let j = 0; j < message.values.length; ++j)
867
+ object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options);
868
+ }
869
+ return object;
870
+ };
871
+
872
+ /**
873
+ * Converts this ListValue to JSON.
874
+ * @function toJSON
875
+ * @memberof google.protobuf.ListValue
876
+ * @instance
877
+ * @returns {Object.<string,*>} JSON object
878
+ */
879
+ ListValue.prototype.toJSON = function toJSON() {
880
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
881
+ };
882
+
883
+ /**
884
+ * Gets the default type url for ListValue
885
+ * @function getTypeUrl
886
+ * @memberof google.protobuf.ListValue
887
+ * @static
888
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
889
+ * @returns {string} The default type url
890
+ */
891
+ ListValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
892
+ if (typeUrlPrefix === undefined) {
893
+ typeUrlPrefix = "type.googleapis.com";
894
+ }
895
+ return typeUrlPrefix + "/google.protobuf.ListValue";
896
+ };
897
+
898
+ return ListValue;
899
+ })();
900
+
901
+ protobuf.Timestamp = (function() {
902
+
903
+ /**
904
+ * Properties of a Timestamp.
905
+ * @memberof google.protobuf
906
+ * @interface ITimestamp
907
+ * @property {number|Long|null} [seconds] Timestamp seconds
908
+ * @property {number|null} [nanos] Timestamp nanos
909
+ */
910
+
911
+ /**
912
+ * Constructs a new Timestamp.
913
+ * @memberof google.protobuf
914
+ * @classdesc Represents a Timestamp.
915
+ * @implements ITimestamp
916
+ * @constructor
917
+ * @param {google.protobuf.ITimestamp=} [properties] Properties to set
918
+ */
919
+ function Timestamp(properties) {
920
+ if (properties)
921
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
922
+ if (properties[keys[i]] != null)
923
+ this[keys[i]] = properties[keys[i]];
924
+ }
925
+
926
+ /**
927
+ * Timestamp seconds.
928
+ * @member {number|Long} seconds
929
+ * @memberof google.protobuf.Timestamp
930
+ * @instance
931
+ */
932
+ Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
933
+
934
+ /**
935
+ * Timestamp nanos.
936
+ * @member {number} nanos
937
+ * @memberof google.protobuf.Timestamp
938
+ * @instance
939
+ */
940
+ Timestamp.prototype.nanos = 0;
941
+
942
+ /**
943
+ * Creates a new Timestamp instance using the specified properties.
944
+ * @function create
945
+ * @memberof google.protobuf.Timestamp
946
+ * @static
947
+ * @param {google.protobuf.ITimestamp=} [properties] Properties to set
948
+ * @returns {google.protobuf.Timestamp} Timestamp instance
949
+ */
950
+ Timestamp.create = function create(properties) {
951
+ return new Timestamp(properties);
952
+ };
953
+
954
+ /**
955
+ * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages.
956
+ * @function encode
957
+ * @memberof google.protobuf.Timestamp
958
+ * @static
959
+ * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode
960
+ * @param {$protobuf.Writer} [writer] Writer to encode to
961
+ * @returns {$protobuf.Writer} Writer
962
+ */
963
+ Timestamp.encode = function encode(message, writer) {
964
+ if (!writer)
965
+ writer = $Writer.create();
966
+ if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds"))
967
+ writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds);
968
+ if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos"))
969
+ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos);
970
+ return writer;
971
+ };
972
+
973
+ /**
974
+ * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages.
975
+ * @function encodeDelimited
976
+ * @memberof google.protobuf.Timestamp
977
+ * @static
978
+ * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode
979
+ * @param {$protobuf.Writer} [writer] Writer to encode to
980
+ * @returns {$protobuf.Writer} Writer
981
+ */
982
+ Timestamp.encodeDelimited = function encodeDelimited(message, writer) {
983
+ return this.encode(message, writer).ldelim();
984
+ };
985
+
986
+ /**
987
+ * Decodes a Timestamp message from the specified reader or buffer.
988
+ * @function decode
989
+ * @memberof google.protobuf.Timestamp
990
+ * @static
991
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
992
+ * @param {number} [length] Message length if known beforehand
993
+ * @returns {google.protobuf.Timestamp} Timestamp
994
+ * @throws {Error} If the payload is not a reader or valid buffer
995
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
996
+ */
997
+ Timestamp.decode = function decode(reader, length) {
998
+ if (!(reader instanceof $Reader))
999
+ reader = $Reader.create(reader);
1000
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp();
1001
+ while (reader.pos < end) {
1002
+ let tag = reader.uint32();
1003
+ switch (tag >>> 3) {
1004
+ case 1: {
1005
+ message.seconds = reader.int64();
1006
+ break;
1007
+ }
1008
+ case 2: {
1009
+ message.nanos = reader.int32();
1010
+ break;
1011
+ }
1012
+ default:
1013
+ reader.skipType(tag & 7);
1014
+ break;
1015
+ }
1016
+ }
1017
+ return message;
1018
+ };
1019
+
1020
+ /**
1021
+ * Decodes a Timestamp message from the specified reader or buffer, length delimited.
1022
+ * @function decodeDelimited
1023
+ * @memberof google.protobuf.Timestamp
1024
+ * @static
1025
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1026
+ * @returns {google.protobuf.Timestamp} Timestamp
1027
+ * @throws {Error} If the payload is not a reader or valid buffer
1028
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1029
+ */
1030
+ Timestamp.decodeDelimited = function decodeDelimited(reader) {
1031
+ if (!(reader instanceof $Reader))
1032
+ reader = new $Reader(reader);
1033
+ return this.decode(reader, reader.uint32());
1034
+ };
1035
+
1036
+ /**
1037
+ * Verifies a Timestamp message.
1038
+ * @function verify
1039
+ * @memberof google.protobuf.Timestamp
1040
+ * @static
1041
+ * @param {Object.<string,*>} message Plain object to verify
1042
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1043
+ */
1044
+ Timestamp.verify = function verify(message) {
1045
+ if (typeof message !== "object" || message === null)
1046
+ return "object expected";
1047
+ if (message.seconds != null && message.hasOwnProperty("seconds"))
1048
+ if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high)))
1049
+ return "seconds: integer|Long expected";
1050
+ if (message.nanos != null && message.hasOwnProperty("nanos"))
1051
+ if (!$util.isInteger(message.nanos))
1052
+ return "nanos: integer expected";
1053
+ return null;
1054
+ };
1055
+
1056
+ /**
1057
+ * Creates a Timestamp message from a plain object. Also converts values to their respective internal types.
1058
+ * @function fromObject
1059
+ * @memberof google.protobuf.Timestamp
1060
+ * @static
1061
+ * @param {Object.<string,*>} object Plain object
1062
+ * @returns {google.protobuf.Timestamp} Timestamp
1063
+ */
1064
+ Timestamp.fromObject = function fromObject(object) {
1065
+ if (object instanceof $root.google.protobuf.Timestamp)
1066
+ return object;
1067
+ let message = new $root.google.protobuf.Timestamp();
1068
+ if (object.seconds != null)
1069
+ if ($util.Long)
1070
+ (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false;
1071
+ else if (typeof object.seconds === "string")
1072
+ message.seconds = parseInt(object.seconds, 10);
1073
+ else if (typeof object.seconds === "number")
1074
+ message.seconds = object.seconds;
1075
+ else if (typeof object.seconds === "object")
1076
+ message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber();
1077
+ if (object.nanos != null)
1078
+ message.nanos = object.nanos | 0;
1079
+ return message;
1080
+ };
1081
+
1082
+ /**
1083
+ * Creates a plain object from a Timestamp message. Also converts values to other types if specified.
1084
+ * @function toObject
1085
+ * @memberof google.protobuf.Timestamp
1086
+ * @static
1087
+ * @param {google.protobuf.Timestamp} message Timestamp
1088
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1089
+ * @returns {Object.<string,*>} Plain object
1090
+ */
1091
+ Timestamp.toObject = function toObject(message, options) {
1092
+ if (!options)
1093
+ options = {};
1094
+ let object = {};
1095
+ if (options.defaults) {
1096
+ if ($util.Long) {
1097
+ let long = new $util.Long(0, 0, false);
1098
+ object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
1099
+ } else
1100
+ object.seconds = options.longs === String ? "0" : 0;
1101
+ object.nanos = 0;
1102
+ }
1103
+ if (message.seconds != null && message.hasOwnProperty("seconds"))
1104
+ if (typeof message.seconds === "number")
1105
+ object.seconds = options.longs === String ? String(message.seconds) : message.seconds;
1106
+ else
1107
+ object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds;
1108
+ if (message.nanos != null && message.hasOwnProperty("nanos"))
1109
+ object.nanos = message.nanos;
1110
+ return object;
1111
+ };
1112
+
1113
+ /**
1114
+ * Converts this Timestamp to JSON.
1115
+ * @function toJSON
1116
+ * @memberof google.protobuf.Timestamp
1117
+ * @instance
1118
+ * @returns {Object.<string,*>} JSON object
1119
+ */
1120
+ Timestamp.prototype.toJSON = function toJSON() {
1121
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1122
+ };
1123
+
1124
+ /**
1125
+ * Gets the default type url for Timestamp
1126
+ * @function getTypeUrl
1127
+ * @memberof google.protobuf.Timestamp
1128
+ * @static
1129
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1130
+ * @returns {string} The default type url
1131
+ */
1132
+ Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1133
+ if (typeUrlPrefix === undefined) {
1134
+ typeUrlPrefix = "type.googleapis.com";
1135
+ }
1136
+ return typeUrlPrefix + "/google.protobuf.Timestamp";
1137
+ };
1138
+
1139
+ return Timestamp;
1140
+ })();
1141
+
1142
+ protobuf.Any = (function() {
1143
+
1144
+ /**
1145
+ * Properties of an Any.
1146
+ * @memberof google.protobuf
1147
+ * @interface IAny
1148
+ * @property {string|null} [typeUrl] Any typeUrl
1149
+ * @property {Uint8Array|null} [value] Any value
1150
+ */
1151
+
1152
+ /**
1153
+ * Constructs a new Any.
1154
+ * @memberof google.protobuf
1155
+ * @classdesc Represents an Any.
1156
+ * @implements IAny
1157
+ * @constructor
1158
+ * @param {google.protobuf.IAny=} [properties] Properties to set
1159
+ */
1160
+ function Any(properties) {
1161
+ if (properties)
1162
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1163
+ if (properties[keys[i]] != null)
1164
+ this[keys[i]] = properties[keys[i]];
1165
+ }
1166
+
1167
+ /**
1168
+ * Any typeUrl.
1169
+ * @member {string} typeUrl
1170
+ * @memberof google.protobuf.Any
1171
+ * @instance
1172
+ */
1173
+ Any.prototype.typeUrl = "";
1174
+
1175
+ /**
1176
+ * Any value.
1177
+ * @member {Uint8Array} value
1178
+ * @memberof google.protobuf.Any
1179
+ * @instance
1180
+ */
1181
+ Any.prototype.value = $util.newBuffer([]);
1182
+
1183
+ /**
1184
+ * Creates a new Any instance using the specified properties.
1185
+ * @function create
1186
+ * @memberof google.protobuf.Any
1187
+ * @static
1188
+ * @param {google.protobuf.IAny=} [properties] Properties to set
1189
+ * @returns {google.protobuf.Any} Any instance
1190
+ */
1191
+ Any.create = function create(properties) {
1192
+ return new Any(properties);
1193
+ };
1194
+
1195
+ /**
1196
+ * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
1197
+ * @function encode
1198
+ * @memberof google.protobuf.Any
1199
+ * @static
1200
+ * @param {google.protobuf.IAny} message Any message or plain object to encode
1201
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1202
+ * @returns {$protobuf.Writer} Writer
1203
+ */
1204
+ Any.encode = function encode(message, writer) {
1205
+ if (!writer)
1206
+ writer = $Writer.create();
1207
+ if (message.typeUrl != null && Object.hasOwnProperty.call(message, "typeUrl"))
1208
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeUrl);
1209
+ if (message.value != null && Object.hasOwnProperty.call(message, "value"))
1210
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value);
1211
+ return writer;
1212
+ };
1213
+
1214
+ /**
1215
+ * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
1216
+ * @function encodeDelimited
1217
+ * @memberof google.protobuf.Any
1218
+ * @static
1219
+ * @param {google.protobuf.IAny} message Any message or plain object to encode
1220
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1221
+ * @returns {$protobuf.Writer} Writer
1222
+ */
1223
+ Any.encodeDelimited = function encodeDelimited(message, writer) {
1224
+ return this.encode(message, writer).ldelim();
1225
+ };
1226
+
1227
+ /**
1228
+ * Decodes an Any message from the specified reader or buffer.
1229
+ * @function decode
1230
+ * @memberof google.protobuf.Any
1231
+ * @static
1232
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1233
+ * @param {number} [length] Message length if known beforehand
1234
+ * @returns {google.protobuf.Any} Any
1235
+ * @throws {Error} If the payload is not a reader or valid buffer
1236
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1237
+ */
1238
+ Any.decode = function decode(reader, length) {
1239
+ if (!(reader instanceof $Reader))
1240
+ reader = $Reader.create(reader);
1241
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any();
1242
+ while (reader.pos < end) {
1243
+ let tag = reader.uint32();
1244
+ switch (tag >>> 3) {
1245
+ case 1: {
1246
+ message.typeUrl = reader.string();
1247
+ break;
1248
+ }
1249
+ case 2: {
1250
+ message.value = reader.bytes();
1251
+ break;
1252
+ }
1253
+ default:
1254
+ reader.skipType(tag & 7);
1255
+ break;
1256
+ }
1257
+ }
1258
+ return message;
1259
+ };
1260
+
1261
+ /**
1262
+ * Decodes an Any message from the specified reader or buffer, length delimited.
1263
+ * @function decodeDelimited
1264
+ * @memberof google.protobuf.Any
1265
+ * @static
1266
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1267
+ * @returns {google.protobuf.Any} Any
1268
+ * @throws {Error} If the payload is not a reader or valid buffer
1269
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1270
+ */
1271
+ Any.decodeDelimited = function decodeDelimited(reader) {
1272
+ if (!(reader instanceof $Reader))
1273
+ reader = new $Reader(reader);
1274
+ return this.decode(reader, reader.uint32());
1275
+ };
1276
+
1277
+ /**
1278
+ * Verifies an Any message.
1279
+ * @function verify
1280
+ * @memberof google.protobuf.Any
1281
+ * @static
1282
+ * @param {Object.<string,*>} message Plain object to verify
1283
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1284
+ */
1285
+ Any.verify = function verify(message) {
1286
+ if (typeof message !== "object" || message === null)
1287
+ return "object expected";
1288
+ if (message.typeUrl != null && message.hasOwnProperty("typeUrl"))
1289
+ if (!$util.isString(message.typeUrl))
1290
+ return "typeUrl: string expected";
1291
+ if (message.value != null && message.hasOwnProperty("value"))
1292
+ if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value)))
1293
+ return "value: buffer expected";
1294
+ return null;
1295
+ };
1296
+
1297
+ /**
1298
+ * Creates an Any message from a plain object. Also converts values to their respective internal types.
1299
+ * @function fromObject
1300
+ * @memberof google.protobuf.Any
1301
+ * @static
1302
+ * @param {Object.<string,*>} object Plain object
1303
+ * @returns {google.protobuf.Any} Any
1304
+ */
1305
+ Any.fromObject = function fromObject(object) {
1306
+ if (object instanceof $root.google.protobuf.Any)
1307
+ return object;
1308
+ let message = new $root.google.protobuf.Any();
1309
+ if (object.typeUrl != null)
1310
+ message.typeUrl = String(object.typeUrl);
1311
+ if (object.value != null)
1312
+ if (typeof object.value === "string")
1313
+ $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0);
1314
+ else if (object.value.length >= 0)
1315
+ message.value = object.value;
1316
+ return message;
1317
+ };
1318
+
1319
+ /**
1320
+ * Creates a plain object from an Any message. Also converts values to other types if specified.
1321
+ * @function toObject
1322
+ * @memberof google.protobuf.Any
1323
+ * @static
1324
+ * @param {google.protobuf.Any} message Any
1325
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1326
+ * @returns {Object.<string,*>} Plain object
1327
+ */
1328
+ Any.toObject = function toObject(message, options) {
1329
+ if (!options)
1330
+ options = {};
1331
+ let object = {};
1332
+ if (options.defaults) {
1333
+ object.typeUrl = "";
1334
+ if (options.bytes === String)
1335
+ object.value = "";
1336
+ else {
1337
+ object.value = [];
1338
+ if (options.bytes !== Array)
1339
+ object.value = $util.newBuffer(object.value);
1340
+ }
1341
+ }
1342
+ if (message.typeUrl != null && message.hasOwnProperty("typeUrl"))
1343
+ object.typeUrl = message.typeUrl;
1344
+ if (message.value != null && message.hasOwnProperty("value"))
1345
+ object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value;
1346
+ return object;
1347
+ };
1348
+
1349
+ /**
1350
+ * Converts this Any to JSON.
1351
+ * @function toJSON
1352
+ * @memberof google.protobuf.Any
1353
+ * @instance
1354
+ * @returns {Object.<string,*>} JSON object
1355
+ */
1356
+ Any.prototype.toJSON = function toJSON() {
1357
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1358
+ };
1359
+
1360
+ /**
1361
+ * Gets the default type url for Any
1362
+ * @function getTypeUrl
1363
+ * @memberof google.protobuf.Any
1364
+ * @static
1365
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1366
+ * @returns {string} The default type url
1367
+ */
1368
+ Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1369
+ if (typeUrlPrefix === undefined) {
1370
+ typeUrlPrefix = "type.googleapis.com";
1371
+ }
1372
+ return typeUrlPrefix + "/google.protobuf.Any";
1373
+ };
1374
+
1375
+ return Any;
1376
+ })();
1377
+
1378
+ return protobuf;
1379
+ })();
1380
+
1381
+ google.events = (function() {
1382
+
1383
+ /**
1384
+ * Namespace events.
1385
+ * @memberof google
1386
+ * @namespace
1387
+ */
1388
+ const events = {};
1389
+
1390
+ events.cloud = (function() {
1391
+
1392
+ /**
1393
+ * Namespace cloud.
1394
+ * @memberof google.events
1395
+ * @namespace
1396
+ */
1397
+ const cloud = {};
1398
+
1399
+ cloud.firestore = (function() {
1400
+
1401
+ /**
1402
+ * Namespace firestore.
1403
+ * @memberof google.events.cloud
1404
+ * @namespace
1405
+ */
1406
+ const firestore = {};
1407
+
1408
+ firestore.v1 = (function() {
1409
+
1410
+ /**
1411
+ * Namespace v1.
1412
+ * @memberof google.events.cloud.firestore
1413
+ * @namespace
1414
+ */
1415
+ const v1 = {};
1416
+
1417
+ v1.DocumentEventData = (function() {
1418
+
1419
+ /**
1420
+ * Properties of a DocumentEventData.
1421
+ * @memberof google.events.cloud.firestore.v1
1422
+ * @interface IDocumentEventData
1423
+ * @property {google.events.cloud.firestore.v1.IDocument|null} [value] DocumentEventData value
1424
+ * @property {google.events.cloud.firestore.v1.IDocument|null} [oldValue] DocumentEventData oldValue
1425
+ * @property {google.events.cloud.firestore.v1.IDocumentMask|null} [updateMask] DocumentEventData updateMask
1426
+ */
1427
+
1428
+ /**
1429
+ * Constructs a new DocumentEventData.
1430
+ * @memberof google.events.cloud.firestore.v1
1431
+ * @classdesc Represents a DocumentEventData.
1432
+ * @implements IDocumentEventData
1433
+ * @constructor
1434
+ * @param {google.events.cloud.firestore.v1.IDocumentEventData=} [properties] Properties to set
1435
+ */
1436
+ function DocumentEventData(properties) {
1437
+ if (properties)
1438
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1439
+ if (properties[keys[i]] != null)
1440
+ this[keys[i]] = properties[keys[i]];
1441
+ }
1442
+
1443
+ /**
1444
+ * DocumentEventData value.
1445
+ * @member {google.events.cloud.firestore.v1.IDocument|null|undefined} value
1446
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1447
+ * @instance
1448
+ */
1449
+ DocumentEventData.prototype.value = null;
1450
+
1451
+ /**
1452
+ * DocumentEventData oldValue.
1453
+ * @member {google.events.cloud.firestore.v1.IDocument|null|undefined} oldValue
1454
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1455
+ * @instance
1456
+ */
1457
+ DocumentEventData.prototype.oldValue = null;
1458
+
1459
+ /**
1460
+ * DocumentEventData updateMask.
1461
+ * @member {google.events.cloud.firestore.v1.IDocumentMask|null|undefined} updateMask
1462
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1463
+ * @instance
1464
+ */
1465
+ DocumentEventData.prototype.updateMask = null;
1466
+
1467
+ /**
1468
+ * Creates a new DocumentEventData instance using the specified properties.
1469
+ * @function create
1470
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1471
+ * @static
1472
+ * @param {google.events.cloud.firestore.v1.IDocumentEventData=} [properties] Properties to set
1473
+ * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData instance
1474
+ */
1475
+ DocumentEventData.create = function create(properties) {
1476
+ return new DocumentEventData(properties);
1477
+ };
1478
+
1479
+ /**
1480
+ * Encodes the specified DocumentEventData message. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentEventData.verify|verify} messages.
1481
+ * @function encode
1482
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1483
+ * @static
1484
+ * @param {google.events.cloud.firestore.v1.IDocumentEventData} message DocumentEventData message or plain object to encode
1485
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1486
+ * @returns {$protobuf.Writer} Writer
1487
+ */
1488
+ DocumentEventData.encode = function encode(message, writer) {
1489
+ if (!writer)
1490
+ writer = $Writer.create();
1491
+ if (message.value != null && Object.hasOwnProperty.call(message, "value"))
1492
+ $root.google.events.cloud.firestore.v1.Document.encode(message.value, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
1493
+ if (message.oldValue != null && Object.hasOwnProperty.call(message, "oldValue"))
1494
+ $root.google.events.cloud.firestore.v1.Document.encode(message.oldValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
1495
+ if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask"))
1496
+ $root.google.events.cloud.firestore.v1.DocumentMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
1497
+ return writer;
1498
+ };
1499
+
1500
+ /**
1501
+ * Encodes the specified DocumentEventData message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentEventData.verify|verify} messages.
1502
+ * @function encodeDelimited
1503
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1504
+ * @static
1505
+ * @param {google.events.cloud.firestore.v1.IDocumentEventData} message DocumentEventData message or plain object to encode
1506
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1507
+ * @returns {$protobuf.Writer} Writer
1508
+ */
1509
+ DocumentEventData.encodeDelimited = function encodeDelimited(message, writer) {
1510
+ return this.encode(message, writer).ldelim();
1511
+ };
1512
+
1513
+ /**
1514
+ * Decodes a DocumentEventData message from the specified reader or buffer.
1515
+ * @function decode
1516
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1517
+ * @static
1518
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1519
+ * @param {number} [length] Message length if known beforehand
1520
+ * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData
1521
+ * @throws {Error} If the payload is not a reader or valid buffer
1522
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1523
+ */
1524
+ DocumentEventData.decode = function decode(reader, length) {
1525
+ if (!(reader instanceof $Reader))
1526
+ reader = $Reader.create(reader);
1527
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.DocumentEventData();
1528
+ while (reader.pos < end) {
1529
+ let tag = reader.uint32();
1530
+ switch (tag >>> 3) {
1531
+ case 1: {
1532
+ message.value = $root.google.events.cloud.firestore.v1.Document.decode(reader, reader.uint32());
1533
+ break;
1534
+ }
1535
+ case 2: {
1536
+ message.oldValue = $root.google.events.cloud.firestore.v1.Document.decode(reader, reader.uint32());
1537
+ break;
1538
+ }
1539
+ case 3: {
1540
+ message.updateMask = $root.google.events.cloud.firestore.v1.DocumentMask.decode(reader, reader.uint32());
1541
+ break;
1542
+ }
1543
+ default:
1544
+ reader.skipType(tag & 7);
1545
+ break;
1546
+ }
1547
+ }
1548
+ return message;
1549
+ };
1550
+
1551
+ /**
1552
+ * Decodes a DocumentEventData message from the specified reader or buffer, length delimited.
1553
+ * @function decodeDelimited
1554
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1555
+ * @static
1556
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1557
+ * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData
1558
+ * @throws {Error} If the payload is not a reader or valid buffer
1559
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1560
+ */
1561
+ DocumentEventData.decodeDelimited = function decodeDelimited(reader) {
1562
+ if (!(reader instanceof $Reader))
1563
+ reader = new $Reader(reader);
1564
+ return this.decode(reader, reader.uint32());
1565
+ };
1566
+
1567
+ /**
1568
+ * Verifies a DocumentEventData message.
1569
+ * @function verify
1570
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1571
+ * @static
1572
+ * @param {Object.<string,*>} message Plain object to verify
1573
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1574
+ */
1575
+ DocumentEventData.verify = function verify(message) {
1576
+ if (typeof message !== "object" || message === null)
1577
+ return "object expected";
1578
+ if (message.value != null && message.hasOwnProperty("value")) {
1579
+ let error = $root.google.events.cloud.firestore.v1.Document.verify(message.value);
1580
+ if (error)
1581
+ return "value." + error;
1582
+ }
1583
+ if (message.oldValue != null && message.hasOwnProperty("oldValue")) {
1584
+ let error = $root.google.events.cloud.firestore.v1.Document.verify(message.oldValue);
1585
+ if (error)
1586
+ return "oldValue." + error;
1587
+ }
1588
+ if (message.updateMask != null && message.hasOwnProperty("updateMask")) {
1589
+ let error = $root.google.events.cloud.firestore.v1.DocumentMask.verify(message.updateMask);
1590
+ if (error)
1591
+ return "updateMask." + error;
1592
+ }
1593
+ return null;
1594
+ };
1595
+
1596
+ /**
1597
+ * Creates a DocumentEventData message from a plain object. Also converts values to their respective internal types.
1598
+ * @function fromObject
1599
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1600
+ * @static
1601
+ * @param {Object.<string,*>} object Plain object
1602
+ * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData
1603
+ */
1604
+ DocumentEventData.fromObject = function fromObject(object) {
1605
+ if (object instanceof $root.google.events.cloud.firestore.v1.DocumentEventData)
1606
+ return object;
1607
+ let message = new $root.google.events.cloud.firestore.v1.DocumentEventData();
1608
+ if (object.value != null) {
1609
+ if (typeof object.value !== "object")
1610
+ throw TypeError(".google.events.cloud.firestore.v1.DocumentEventData.value: object expected");
1611
+ message.value = $root.google.events.cloud.firestore.v1.Document.fromObject(object.value);
1612
+ }
1613
+ if (object.oldValue != null) {
1614
+ if (typeof object.oldValue !== "object")
1615
+ throw TypeError(".google.events.cloud.firestore.v1.DocumentEventData.oldValue: object expected");
1616
+ message.oldValue = $root.google.events.cloud.firestore.v1.Document.fromObject(object.oldValue);
1617
+ }
1618
+ if (object.updateMask != null) {
1619
+ if (typeof object.updateMask !== "object")
1620
+ throw TypeError(".google.events.cloud.firestore.v1.DocumentEventData.updateMask: object expected");
1621
+ message.updateMask = $root.google.events.cloud.firestore.v1.DocumentMask.fromObject(object.updateMask);
1622
+ }
1623
+ return message;
1624
+ };
1625
+
1626
+ /**
1627
+ * Creates a plain object from a DocumentEventData message. Also converts values to other types if specified.
1628
+ * @function toObject
1629
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1630
+ * @static
1631
+ * @param {google.events.cloud.firestore.v1.DocumentEventData} message DocumentEventData
1632
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1633
+ * @returns {Object.<string,*>} Plain object
1634
+ */
1635
+ DocumentEventData.toObject = function toObject(message, options) {
1636
+ if (!options)
1637
+ options = {};
1638
+ let object = {};
1639
+ if (options.defaults) {
1640
+ object.value = null;
1641
+ object.oldValue = null;
1642
+ object.updateMask = null;
1643
+ }
1644
+ if (message.value != null && message.hasOwnProperty("value"))
1645
+ object.value = $root.google.events.cloud.firestore.v1.Document.toObject(message.value, options);
1646
+ if (message.oldValue != null && message.hasOwnProperty("oldValue"))
1647
+ object.oldValue = $root.google.events.cloud.firestore.v1.Document.toObject(message.oldValue, options);
1648
+ if (message.updateMask != null && message.hasOwnProperty("updateMask"))
1649
+ object.updateMask = $root.google.events.cloud.firestore.v1.DocumentMask.toObject(message.updateMask, options);
1650
+ return object;
1651
+ };
1652
+
1653
+ /**
1654
+ * Converts this DocumentEventData to JSON.
1655
+ * @function toJSON
1656
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1657
+ * @instance
1658
+ * @returns {Object.<string,*>} JSON object
1659
+ */
1660
+ DocumentEventData.prototype.toJSON = function toJSON() {
1661
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1662
+ };
1663
+
1664
+ /**
1665
+ * Gets the default type url for DocumentEventData
1666
+ * @function getTypeUrl
1667
+ * @memberof google.events.cloud.firestore.v1.DocumentEventData
1668
+ * @static
1669
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1670
+ * @returns {string} The default type url
1671
+ */
1672
+ DocumentEventData.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1673
+ if (typeUrlPrefix === undefined) {
1674
+ typeUrlPrefix = "type.googleapis.com";
1675
+ }
1676
+ return typeUrlPrefix + "/google.events.cloud.firestore.v1.DocumentEventData";
1677
+ };
1678
+
1679
+ return DocumentEventData;
1680
+ })();
1681
+
1682
+ v1.DocumentMask = (function() {
1683
+
1684
+ /**
1685
+ * Properties of a DocumentMask.
1686
+ * @memberof google.events.cloud.firestore.v1
1687
+ * @interface IDocumentMask
1688
+ * @property {Array.<string>|null} [fieldPaths] DocumentMask fieldPaths
1689
+ */
1690
+
1691
+ /**
1692
+ * Constructs a new DocumentMask.
1693
+ * @memberof google.events.cloud.firestore.v1
1694
+ * @classdesc Represents a DocumentMask.
1695
+ * @implements IDocumentMask
1696
+ * @constructor
1697
+ * @param {google.events.cloud.firestore.v1.IDocumentMask=} [properties] Properties to set
1698
+ */
1699
+ function DocumentMask(properties) {
1700
+ this.fieldPaths = [];
1701
+ if (properties)
1702
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1703
+ if (properties[keys[i]] != null)
1704
+ this[keys[i]] = properties[keys[i]];
1705
+ }
1706
+
1707
+ /**
1708
+ * DocumentMask fieldPaths.
1709
+ * @member {Array.<string>} fieldPaths
1710
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1711
+ * @instance
1712
+ */
1713
+ DocumentMask.prototype.fieldPaths = $util.emptyArray;
1714
+
1715
+ /**
1716
+ * Creates a new DocumentMask instance using the specified properties.
1717
+ * @function create
1718
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1719
+ * @static
1720
+ * @param {google.events.cloud.firestore.v1.IDocumentMask=} [properties] Properties to set
1721
+ * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask instance
1722
+ */
1723
+ DocumentMask.create = function create(properties) {
1724
+ return new DocumentMask(properties);
1725
+ };
1726
+
1727
+ /**
1728
+ * Encodes the specified DocumentMask message. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentMask.verify|verify} messages.
1729
+ * @function encode
1730
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1731
+ * @static
1732
+ * @param {google.events.cloud.firestore.v1.IDocumentMask} message DocumentMask message or plain object to encode
1733
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1734
+ * @returns {$protobuf.Writer} Writer
1735
+ */
1736
+ DocumentMask.encode = function encode(message, writer) {
1737
+ if (!writer)
1738
+ writer = $Writer.create();
1739
+ if (message.fieldPaths != null && message.fieldPaths.length)
1740
+ for (let i = 0; i < message.fieldPaths.length; ++i)
1741
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPaths[i]);
1742
+ return writer;
1743
+ };
1744
+
1745
+ /**
1746
+ * Encodes the specified DocumentMask message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentMask.verify|verify} messages.
1747
+ * @function encodeDelimited
1748
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1749
+ * @static
1750
+ * @param {google.events.cloud.firestore.v1.IDocumentMask} message DocumentMask message or plain object to encode
1751
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1752
+ * @returns {$protobuf.Writer} Writer
1753
+ */
1754
+ DocumentMask.encodeDelimited = function encodeDelimited(message, writer) {
1755
+ return this.encode(message, writer).ldelim();
1756
+ };
1757
+
1758
+ /**
1759
+ * Decodes a DocumentMask message from the specified reader or buffer.
1760
+ * @function decode
1761
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1762
+ * @static
1763
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1764
+ * @param {number} [length] Message length if known beforehand
1765
+ * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask
1766
+ * @throws {Error} If the payload is not a reader or valid buffer
1767
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1768
+ */
1769
+ DocumentMask.decode = function decode(reader, length) {
1770
+ if (!(reader instanceof $Reader))
1771
+ reader = $Reader.create(reader);
1772
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.DocumentMask();
1773
+ while (reader.pos < end) {
1774
+ let tag = reader.uint32();
1775
+ switch (tag >>> 3) {
1776
+ case 1: {
1777
+ if (!(message.fieldPaths && message.fieldPaths.length))
1778
+ message.fieldPaths = [];
1779
+ message.fieldPaths.push(reader.string());
1780
+ break;
1781
+ }
1782
+ default:
1783
+ reader.skipType(tag & 7);
1784
+ break;
1785
+ }
1786
+ }
1787
+ return message;
1788
+ };
1789
+
1790
+ /**
1791
+ * Decodes a DocumentMask message from the specified reader or buffer, length delimited.
1792
+ * @function decodeDelimited
1793
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1794
+ * @static
1795
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1796
+ * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask
1797
+ * @throws {Error} If the payload is not a reader or valid buffer
1798
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1799
+ */
1800
+ DocumentMask.decodeDelimited = function decodeDelimited(reader) {
1801
+ if (!(reader instanceof $Reader))
1802
+ reader = new $Reader(reader);
1803
+ return this.decode(reader, reader.uint32());
1804
+ };
1805
+
1806
+ /**
1807
+ * Verifies a DocumentMask message.
1808
+ * @function verify
1809
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1810
+ * @static
1811
+ * @param {Object.<string,*>} message Plain object to verify
1812
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1813
+ */
1814
+ DocumentMask.verify = function verify(message) {
1815
+ if (typeof message !== "object" || message === null)
1816
+ return "object expected";
1817
+ if (message.fieldPaths != null && message.hasOwnProperty("fieldPaths")) {
1818
+ if (!Array.isArray(message.fieldPaths))
1819
+ return "fieldPaths: array expected";
1820
+ for (let i = 0; i < message.fieldPaths.length; ++i)
1821
+ if (!$util.isString(message.fieldPaths[i]))
1822
+ return "fieldPaths: string[] expected";
1823
+ }
1824
+ return null;
1825
+ };
1826
+
1827
+ /**
1828
+ * Creates a DocumentMask message from a plain object. Also converts values to their respective internal types.
1829
+ * @function fromObject
1830
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1831
+ * @static
1832
+ * @param {Object.<string,*>} object Plain object
1833
+ * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask
1834
+ */
1835
+ DocumentMask.fromObject = function fromObject(object) {
1836
+ if (object instanceof $root.google.events.cloud.firestore.v1.DocumentMask)
1837
+ return object;
1838
+ let message = new $root.google.events.cloud.firestore.v1.DocumentMask();
1839
+ if (object.fieldPaths) {
1840
+ if (!Array.isArray(object.fieldPaths))
1841
+ throw TypeError(".google.events.cloud.firestore.v1.DocumentMask.fieldPaths: array expected");
1842
+ message.fieldPaths = [];
1843
+ for (let i = 0; i < object.fieldPaths.length; ++i)
1844
+ message.fieldPaths[i] = String(object.fieldPaths[i]);
1845
+ }
1846
+ return message;
1847
+ };
1848
+
1849
+ /**
1850
+ * Creates a plain object from a DocumentMask message. Also converts values to other types if specified.
1851
+ * @function toObject
1852
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1853
+ * @static
1854
+ * @param {google.events.cloud.firestore.v1.DocumentMask} message DocumentMask
1855
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1856
+ * @returns {Object.<string,*>} Plain object
1857
+ */
1858
+ DocumentMask.toObject = function toObject(message, options) {
1859
+ if (!options)
1860
+ options = {};
1861
+ let object = {};
1862
+ if (options.arrays || options.defaults)
1863
+ object.fieldPaths = [];
1864
+ if (message.fieldPaths && message.fieldPaths.length) {
1865
+ object.fieldPaths = [];
1866
+ for (let j = 0; j < message.fieldPaths.length; ++j)
1867
+ object.fieldPaths[j] = message.fieldPaths[j];
1868
+ }
1869
+ return object;
1870
+ };
1871
+
1872
+ /**
1873
+ * Converts this DocumentMask to JSON.
1874
+ * @function toJSON
1875
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1876
+ * @instance
1877
+ * @returns {Object.<string,*>} JSON object
1878
+ */
1879
+ DocumentMask.prototype.toJSON = function toJSON() {
1880
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1881
+ };
1882
+
1883
+ /**
1884
+ * Gets the default type url for DocumentMask
1885
+ * @function getTypeUrl
1886
+ * @memberof google.events.cloud.firestore.v1.DocumentMask
1887
+ * @static
1888
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1889
+ * @returns {string} The default type url
1890
+ */
1891
+ DocumentMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1892
+ if (typeUrlPrefix === undefined) {
1893
+ typeUrlPrefix = "type.googleapis.com";
1894
+ }
1895
+ return typeUrlPrefix + "/google.events.cloud.firestore.v1.DocumentMask";
1896
+ };
1897
+
1898
+ return DocumentMask;
1899
+ })();
1900
+
1901
+ v1.Document = (function() {
1902
+
1903
+ /**
1904
+ * Properties of a Document.
1905
+ * @memberof google.events.cloud.firestore.v1
1906
+ * @interface IDocument
1907
+ * @property {string|null} [name] Document name
1908
+ * @property {Object.<string,google.events.cloud.firestore.v1.IValue>|null} [fields] Document fields
1909
+ * @property {google.protobuf.ITimestamp|null} [createTime] Document createTime
1910
+ * @property {google.protobuf.ITimestamp|null} [updateTime] Document updateTime
1911
+ */
1912
+
1913
+ /**
1914
+ * Constructs a new Document.
1915
+ * @memberof google.events.cloud.firestore.v1
1916
+ * @classdesc Represents a Document.
1917
+ * @implements IDocument
1918
+ * @constructor
1919
+ * @param {google.events.cloud.firestore.v1.IDocument=} [properties] Properties to set
1920
+ */
1921
+ function Document(properties) {
1922
+ this.fields = {};
1923
+ if (properties)
1924
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1925
+ if (properties[keys[i]] != null)
1926
+ this[keys[i]] = properties[keys[i]];
1927
+ }
1928
+
1929
+ /**
1930
+ * Document name.
1931
+ * @member {string} name
1932
+ * @memberof google.events.cloud.firestore.v1.Document
1933
+ * @instance
1934
+ */
1935
+ Document.prototype.name = "";
1936
+
1937
+ /**
1938
+ * Document fields.
1939
+ * @member {Object.<string,google.events.cloud.firestore.v1.IValue>} fields
1940
+ * @memberof google.events.cloud.firestore.v1.Document
1941
+ * @instance
1942
+ */
1943
+ Document.prototype.fields = $util.emptyObject;
1944
+
1945
+ /**
1946
+ * Document createTime.
1947
+ * @member {google.protobuf.ITimestamp|null|undefined} createTime
1948
+ * @memberof google.events.cloud.firestore.v1.Document
1949
+ * @instance
1950
+ */
1951
+ Document.prototype.createTime = null;
1952
+
1953
+ /**
1954
+ * Document updateTime.
1955
+ * @member {google.protobuf.ITimestamp|null|undefined} updateTime
1956
+ * @memberof google.events.cloud.firestore.v1.Document
1957
+ * @instance
1958
+ */
1959
+ Document.prototype.updateTime = null;
1960
+
1961
+ /**
1962
+ * Creates a new Document instance using the specified properties.
1963
+ * @function create
1964
+ * @memberof google.events.cloud.firestore.v1.Document
1965
+ * @static
1966
+ * @param {google.events.cloud.firestore.v1.IDocument=} [properties] Properties to set
1967
+ * @returns {google.events.cloud.firestore.v1.Document} Document instance
1968
+ */
1969
+ Document.create = function create(properties) {
1970
+ return new Document(properties);
1971
+ };
1972
+
1973
+ /**
1974
+ * Encodes the specified Document message. Does not implicitly {@link google.events.cloud.firestore.v1.Document.verify|verify} messages.
1975
+ * @function encode
1976
+ * @memberof google.events.cloud.firestore.v1.Document
1977
+ * @static
1978
+ * @param {google.events.cloud.firestore.v1.IDocument} message Document message or plain object to encode
1979
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1980
+ * @returns {$protobuf.Writer} Writer
1981
+ */
1982
+ Document.encode = function encode(message, writer) {
1983
+ if (!writer)
1984
+ writer = $Writer.create();
1985
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
1986
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
1987
+ if (message.fields != null && Object.hasOwnProperty.call(message, "fields"))
1988
+ for (let keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) {
1989
+ writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
1990
+ $root.google.events.cloud.firestore.v1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
1991
+ }
1992
+ if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime"))
1993
+ $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
1994
+ if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime"))
1995
+ $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
1996
+ return writer;
1997
+ };
1998
+
1999
+ /**
2000
+ * Encodes the specified Document message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.Document.verify|verify} messages.
2001
+ * @function encodeDelimited
2002
+ * @memberof google.events.cloud.firestore.v1.Document
2003
+ * @static
2004
+ * @param {google.events.cloud.firestore.v1.IDocument} message Document message or plain object to encode
2005
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2006
+ * @returns {$protobuf.Writer} Writer
2007
+ */
2008
+ Document.encodeDelimited = function encodeDelimited(message, writer) {
2009
+ return this.encode(message, writer).ldelim();
2010
+ };
2011
+
2012
+ /**
2013
+ * Decodes a Document message from the specified reader or buffer.
2014
+ * @function decode
2015
+ * @memberof google.events.cloud.firestore.v1.Document
2016
+ * @static
2017
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2018
+ * @param {number} [length] Message length if known beforehand
2019
+ * @returns {google.events.cloud.firestore.v1.Document} Document
2020
+ * @throws {Error} If the payload is not a reader or valid buffer
2021
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2022
+ */
2023
+ Document.decode = function decode(reader, length) {
2024
+ if (!(reader instanceof $Reader))
2025
+ reader = $Reader.create(reader);
2026
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.Document(), key, value;
2027
+ while (reader.pos < end) {
2028
+ let tag = reader.uint32();
2029
+ switch (tag >>> 3) {
2030
+ case 1: {
2031
+ message.name = reader.string();
2032
+ break;
2033
+ }
2034
+ case 2: {
2035
+ if (message.fields === $util.emptyObject)
2036
+ message.fields = {};
2037
+ let end2 = reader.uint32() + reader.pos;
2038
+ key = "";
2039
+ value = null;
2040
+ while (reader.pos < end2) {
2041
+ let tag2 = reader.uint32();
2042
+ switch (tag2 >>> 3) {
2043
+ case 1:
2044
+ key = reader.string();
2045
+ break;
2046
+ case 2:
2047
+ value = $root.google.events.cloud.firestore.v1.Value.decode(reader, reader.uint32());
2048
+ break;
2049
+ default:
2050
+ reader.skipType(tag2 & 7);
2051
+ break;
2052
+ }
2053
+ }
2054
+ message.fields[key] = value;
2055
+ break;
2056
+ }
2057
+ case 3: {
2058
+ message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
2059
+ break;
2060
+ }
2061
+ case 4: {
2062
+ message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
2063
+ break;
2064
+ }
2065
+ default:
2066
+ reader.skipType(tag & 7);
2067
+ break;
2068
+ }
2069
+ }
2070
+ return message;
2071
+ };
2072
+
2073
+ /**
2074
+ * Decodes a Document message from the specified reader or buffer, length delimited.
2075
+ * @function decodeDelimited
2076
+ * @memberof google.events.cloud.firestore.v1.Document
2077
+ * @static
2078
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2079
+ * @returns {google.events.cloud.firestore.v1.Document} Document
2080
+ * @throws {Error} If the payload is not a reader or valid buffer
2081
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2082
+ */
2083
+ Document.decodeDelimited = function decodeDelimited(reader) {
2084
+ if (!(reader instanceof $Reader))
2085
+ reader = new $Reader(reader);
2086
+ return this.decode(reader, reader.uint32());
2087
+ };
2088
+
2089
+ /**
2090
+ * Verifies a Document message.
2091
+ * @function verify
2092
+ * @memberof google.events.cloud.firestore.v1.Document
2093
+ * @static
2094
+ * @param {Object.<string,*>} message Plain object to verify
2095
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2096
+ */
2097
+ Document.verify = function verify(message) {
2098
+ if (typeof message !== "object" || message === null)
2099
+ return "object expected";
2100
+ if (message.name != null && message.hasOwnProperty("name"))
2101
+ if (!$util.isString(message.name))
2102
+ return "name: string expected";
2103
+ if (message.fields != null && message.hasOwnProperty("fields")) {
2104
+ if (!$util.isObject(message.fields))
2105
+ return "fields: object expected";
2106
+ let key = Object.keys(message.fields);
2107
+ for (let i = 0; i < key.length; ++i) {
2108
+ let error = $root.google.events.cloud.firestore.v1.Value.verify(message.fields[key[i]]);
2109
+ if (error)
2110
+ return "fields." + error;
2111
+ }
2112
+ }
2113
+ if (message.createTime != null && message.hasOwnProperty("createTime")) {
2114
+ let error = $root.google.protobuf.Timestamp.verify(message.createTime);
2115
+ if (error)
2116
+ return "createTime." + error;
2117
+ }
2118
+ if (message.updateTime != null && message.hasOwnProperty("updateTime")) {
2119
+ let error = $root.google.protobuf.Timestamp.verify(message.updateTime);
2120
+ if (error)
2121
+ return "updateTime." + error;
2122
+ }
2123
+ return null;
2124
+ };
2125
+
2126
+ /**
2127
+ * Creates a Document message from a plain object. Also converts values to their respective internal types.
2128
+ * @function fromObject
2129
+ * @memberof google.events.cloud.firestore.v1.Document
2130
+ * @static
2131
+ * @param {Object.<string,*>} object Plain object
2132
+ * @returns {google.events.cloud.firestore.v1.Document} Document
2133
+ */
2134
+ Document.fromObject = function fromObject(object) {
2135
+ if (object instanceof $root.google.events.cloud.firestore.v1.Document)
2136
+ return object;
2137
+ let message = new $root.google.events.cloud.firestore.v1.Document();
2138
+ if (object.name != null)
2139
+ message.name = String(object.name);
2140
+ if (object.fields) {
2141
+ if (typeof object.fields !== "object")
2142
+ throw TypeError(".google.events.cloud.firestore.v1.Document.fields: object expected");
2143
+ message.fields = {};
2144
+ for (let keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) {
2145
+ if (typeof object.fields[keys[i]] !== "object")
2146
+ throw TypeError(".google.events.cloud.firestore.v1.Document.fields: object expected");
2147
+ message.fields[keys[i]] = $root.google.events.cloud.firestore.v1.Value.fromObject(object.fields[keys[i]]);
2148
+ }
2149
+ }
2150
+ if (object.createTime != null) {
2151
+ if (typeof object.createTime !== "object")
2152
+ throw TypeError(".google.events.cloud.firestore.v1.Document.createTime: object expected");
2153
+ message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime);
2154
+ }
2155
+ if (object.updateTime != null) {
2156
+ if (typeof object.updateTime !== "object")
2157
+ throw TypeError(".google.events.cloud.firestore.v1.Document.updateTime: object expected");
2158
+ message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime);
2159
+ }
2160
+ return message;
2161
+ };
2162
+
2163
+ /**
2164
+ * Creates a plain object from a Document message. Also converts values to other types if specified.
2165
+ * @function toObject
2166
+ * @memberof google.events.cloud.firestore.v1.Document
2167
+ * @static
2168
+ * @param {google.events.cloud.firestore.v1.Document} message Document
2169
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2170
+ * @returns {Object.<string,*>} Plain object
2171
+ */
2172
+ Document.toObject = function toObject(message, options) {
2173
+ if (!options)
2174
+ options = {};
2175
+ let object = {};
2176
+ if (options.objects || options.defaults)
2177
+ object.fields = {};
2178
+ if (options.defaults) {
2179
+ object.name = "";
2180
+ object.createTime = null;
2181
+ object.updateTime = null;
2182
+ }
2183
+ if (message.name != null && message.hasOwnProperty("name"))
2184
+ object.name = message.name;
2185
+ let keys2;
2186
+ if (message.fields && (keys2 = Object.keys(message.fields)).length) {
2187
+ object.fields = {};
2188
+ for (let j = 0; j < keys2.length; ++j)
2189
+ object.fields[keys2[j]] = $root.google.events.cloud.firestore.v1.Value.toObject(message.fields[keys2[j]], options);
2190
+ }
2191
+ if (message.createTime != null && message.hasOwnProperty("createTime"))
2192
+ object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options);
2193
+ if (message.updateTime != null && message.hasOwnProperty("updateTime"))
2194
+ object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options);
2195
+ return object;
2196
+ };
2197
+
2198
+ /**
2199
+ * Converts this Document to JSON.
2200
+ * @function toJSON
2201
+ * @memberof google.events.cloud.firestore.v1.Document
2202
+ * @instance
2203
+ * @returns {Object.<string,*>} JSON object
2204
+ */
2205
+ Document.prototype.toJSON = function toJSON() {
2206
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2207
+ };
2208
+
2209
+ /**
2210
+ * Gets the default type url for Document
2211
+ * @function getTypeUrl
2212
+ * @memberof google.events.cloud.firestore.v1.Document
2213
+ * @static
2214
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2215
+ * @returns {string} The default type url
2216
+ */
2217
+ Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2218
+ if (typeUrlPrefix === undefined) {
2219
+ typeUrlPrefix = "type.googleapis.com";
2220
+ }
2221
+ return typeUrlPrefix + "/google.events.cloud.firestore.v1.Document";
2222
+ };
2223
+
2224
+ return Document;
2225
+ })();
2226
+
2227
+ v1.Value = (function() {
2228
+
2229
+ /**
2230
+ * Properties of a Value.
2231
+ * @memberof google.events.cloud.firestore.v1
2232
+ * @interface IValue
2233
+ * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue
2234
+ * @property {boolean|null} [booleanValue] Value booleanValue
2235
+ * @property {number|Long|null} [integerValue] Value integerValue
2236
+ * @property {number|null} [doubleValue] Value doubleValue
2237
+ * @property {google.protobuf.ITimestamp|null} [timestampValue] Value timestampValue
2238
+ * @property {string|null} [stringValue] Value stringValue
2239
+ * @property {Uint8Array|null} [bytesValue] Value bytesValue
2240
+ * @property {string|null} [referenceValue] Value referenceValue
2241
+ * @property {google.type.ILatLng|null} [geoPointValue] Value geoPointValue
2242
+ * @property {google.events.cloud.firestore.v1.IArrayValue|null} [arrayValue] Value arrayValue
2243
+ * @property {google.events.cloud.firestore.v1.IMapValue|null} [mapValue] Value mapValue
2244
+ */
2245
+
2246
+ /**
2247
+ * Constructs a new Value.
2248
+ * @memberof google.events.cloud.firestore.v1
2249
+ * @classdesc Represents a Value.
2250
+ * @implements IValue
2251
+ * @constructor
2252
+ * @param {google.events.cloud.firestore.v1.IValue=} [properties] Properties to set
2253
+ */
2254
+ function Value(properties) {
2255
+ if (properties)
2256
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2257
+ if (properties[keys[i]] != null)
2258
+ this[keys[i]] = properties[keys[i]];
2259
+ }
2260
+
2261
+ /**
2262
+ * Value nullValue.
2263
+ * @member {google.protobuf.NullValue|null|undefined} nullValue
2264
+ * @memberof google.events.cloud.firestore.v1.Value
2265
+ * @instance
2266
+ */
2267
+ Value.prototype.nullValue = null;
2268
+
2269
+ /**
2270
+ * Value booleanValue.
2271
+ * @member {boolean|null|undefined} booleanValue
2272
+ * @memberof google.events.cloud.firestore.v1.Value
2273
+ * @instance
2274
+ */
2275
+ Value.prototype.booleanValue = null;
2276
+
2277
+ /**
2278
+ * Value integerValue.
2279
+ * @member {number|Long|null|undefined} integerValue
2280
+ * @memberof google.events.cloud.firestore.v1.Value
2281
+ * @instance
2282
+ */
2283
+ Value.prototype.integerValue = null;
2284
+
2285
+ /**
2286
+ * Value doubleValue.
2287
+ * @member {number|null|undefined} doubleValue
2288
+ * @memberof google.events.cloud.firestore.v1.Value
2289
+ * @instance
2290
+ */
2291
+ Value.prototype.doubleValue = null;
2292
+
2293
+ /**
2294
+ * Value timestampValue.
2295
+ * @member {google.protobuf.ITimestamp|null|undefined} timestampValue
2296
+ * @memberof google.events.cloud.firestore.v1.Value
2297
+ * @instance
2298
+ */
2299
+ Value.prototype.timestampValue = null;
2300
+
2301
+ /**
2302
+ * Value stringValue.
2303
+ * @member {string|null|undefined} stringValue
2304
+ * @memberof google.events.cloud.firestore.v1.Value
2305
+ * @instance
2306
+ */
2307
+ Value.prototype.stringValue = null;
2308
+
2309
+ /**
2310
+ * Value bytesValue.
2311
+ * @member {Uint8Array|null|undefined} bytesValue
2312
+ * @memberof google.events.cloud.firestore.v1.Value
2313
+ * @instance
2314
+ */
2315
+ Value.prototype.bytesValue = null;
2316
+
2317
+ /**
2318
+ * Value referenceValue.
2319
+ * @member {string|null|undefined} referenceValue
2320
+ * @memberof google.events.cloud.firestore.v1.Value
2321
+ * @instance
2322
+ */
2323
+ Value.prototype.referenceValue = null;
2324
+
2325
+ /**
2326
+ * Value geoPointValue.
2327
+ * @member {google.type.ILatLng|null|undefined} geoPointValue
2328
+ * @memberof google.events.cloud.firestore.v1.Value
2329
+ * @instance
2330
+ */
2331
+ Value.prototype.geoPointValue = null;
2332
+
2333
+ /**
2334
+ * Value arrayValue.
2335
+ * @member {google.events.cloud.firestore.v1.IArrayValue|null|undefined} arrayValue
2336
+ * @memberof google.events.cloud.firestore.v1.Value
2337
+ * @instance
2338
+ */
2339
+ Value.prototype.arrayValue = null;
2340
+
2341
+ /**
2342
+ * Value mapValue.
2343
+ * @member {google.events.cloud.firestore.v1.IMapValue|null|undefined} mapValue
2344
+ * @memberof google.events.cloud.firestore.v1.Value
2345
+ * @instance
2346
+ */
2347
+ Value.prototype.mapValue = null;
2348
+
2349
+ // OneOf field names bound to virtual getters and setters
2350
+ let $oneOfFields;
2351
+
2352
+ /**
2353
+ * Value valueType.
2354
+ * @member {"nullValue"|"booleanValue"|"integerValue"|"doubleValue"|"timestampValue"|"stringValue"|"bytesValue"|"referenceValue"|"geoPointValue"|"arrayValue"|"mapValue"|undefined} valueType
2355
+ * @memberof google.events.cloud.firestore.v1.Value
2356
+ * @instance
2357
+ */
2358
+ Object.defineProperty(Value.prototype, "valueType", {
2359
+ get: $util.oneOfGetter($oneOfFields = ["nullValue", "booleanValue", "integerValue", "doubleValue", "timestampValue", "stringValue", "bytesValue", "referenceValue", "geoPointValue", "arrayValue", "mapValue"]),
2360
+ set: $util.oneOfSetter($oneOfFields)
2361
+ });
2362
+
2363
+ /**
2364
+ * Creates a new Value instance using the specified properties.
2365
+ * @function create
2366
+ * @memberof google.events.cloud.firestore.v1.Value
2367
+ * @static
2368
+ * @param {google.events.cloud.firestore.v1.IValue=} [properties] Properties to set
2369
+ * @returns {google.events.cloud.firestore.v1.Value} Value instance
2370
+ */
2371
+ Value.create = function create(properties) {
2372
+ return new Value(properties);
2373
+ };
2374
+
2375
+ /**
2376
+ * Encodes the specified Value message. Does not implicitly {@link google.events.cloud.firestore.v1.Value.verify|verify} messages.
2377
+ * @function encode
2378
+ * @memberof google.events.cloud.firestore.v1.Value
2379
+ * @static
2380
+ * @param {google.events.cloud.firestore.v1.IValue} message Value message or plain object to encode
2381
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2382
+ * @returns {$protobuf.Writer} Writer
2383
+ */
2384
+ Value.encode = function encode(message, writer) {
2385
+ if (!writer)
2386
+ writer = $Writer.create();
2387
+ if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue"))
2388
+ writer.uint32(/* id 1, wireType 0 =*/8).bool(message.booleanValue);
2389
+ if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue"))
2390
+ writer.uint32(/* id 2, wireType 0 =*/16).int64(message.integerValue);
2391
+ if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue"))
2392
+ writer.uint32(/* id 3, wireType 1 =*/25).double(message.doubleValue);
2393
+ if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue"))
2394
+ writer.uint32(/* id 5, wireType 2 =*/42).string(message.referenceValue);
2395
+ if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue"))
2396
+ $root.google.events.cloud.firestore.v1.MapValue.encode(message.mapValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
2397
+ if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue"))
2398
+ $root.google.type.LatLng.encode(message.geoPointValue, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
2399
+ if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue"))
2400
+ $root.google.events.cloud.firestore.v1.ArrayValue.encode(message.arrayValue, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
2401
+ if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue"))
2402
+ $root.google.protobuf.Timestamp.encode(message.timestampValue, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
2403
+ if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue"))
2404
+ writer.uint32(/* id 11, wireType 0 =*/88).int32(message.nullValue);
2405
+ if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue"))
2406
+ writer.uint32(/* id 17, wireType 2 =*/138).string(message.stringValue);
2407
+ if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue"))
2408
+ writer.uint32(/* id 18, wireType 2 =*/146).bytes(message.bytesValue);
2409
+ return writer;
2410
+ };
2411
+
2412
+ /**
2413
+ * Encodes the specified Value message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.Value.verify|verify} messages.
2414
+ * @function encodeDelimited
2415
+ * @memberof google.events.cloud.firestore.v1.Value
2416
+ * @static
2417
+ * @param {google.events.cloud.firestore.v1.IValue} message Value message or plain object to encode
2418
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2419
+ * @returns {$protobuf.Writer} Writer
2420
+ */
2421
+ Value.encodeDelimited = function encodeDelimited(message, writer) {
2422
+ return this.encode(message, writer).ldelim();
2423
+ };
2424
+
2425
+ /**
2426
+ * Decodes a Value message from the specified reader or buffer.
2427
+ * @function decode
2428
+ * @memberof google.events.cloud.firestore.v1.Value
2429
+ * @static
2430
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2431
+ * @param {number} [length] Message length if known beforehand
2432
+ * @returns {google.events.cloud.firestore.v1.Value} Value
2433
+ * @throws {Error} If the payload is not a reader or valid buffer
2434
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2435
+ */
2436
+ Value.decode = function decode(reader, length) {
2437
+ if (!(reader instanceof $Reader))
2438
+ reader = $Reader.create(reader);
2439
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.Value();
2440
+ while (reader.pos < end) {
2441
+ let tag = reader.uint32();
2442
+ switch (tag >>> 3) {
2443
+ case 11: {
2444
+ message.nullValue = reader.int32();
2445
+ break;
2446
+ }
2447
+ case 1: {
2448
+ message.booleanValue = reader.bool();
2449
+ break;
2450
+ }
2451
+ case 2: {
2452
+ message.integerValue = reader.int64();
2453
+ break;
2454
+ }
2455
+ case 3: {
2456
+ message.doubleValue = reader.double();
2457
+ break;
2458
+ }
2459
+ case 10: {
2460
+ message.timestampValue = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
2461
+ break;
2462
+ }
2463
+ case 17: {
2464
+ message.stringValue = reader.string();
2465
+ break;
2466
+ }
2467
+ case 18: {
2468
+ message.bytesValue = reader.bytes();
2469
+ break;
2470
+ }
2471
+ case 5: {
2472
+ message.referenceValue = reader.string();
2473
+ break;
2474
+ }
2475
+ case 8: {
2476
+ message.geoPointValue = $root.google.type.LatLng.decode(reader, reader.uint32());
2477
+ break;
2478
+ }
2479
+ case 9: {
2480
+ message.arrayValue = $root.google.events.cloud.firestore.v1.ArrayValue.decode(reader, reader.uint32());
2481
+ break;
2482
+ }
2483
+ case 6: {
2484
+ message.mapValue = $root.google.events.cloud.firestore.v1.MapValue.decode(reader, reader.uint32());
2485
+ break;
2486
+ }
2487
+ default:
2488
+ reader.skipType(tag & 7);
2489
+ break;
2490
+ }
2491
+ }
2492
+ return message;
2493
+ };
2494
+
2495
+ /**
2496
+ * Decodes a Value message from the specified reader or buffer, length delimited.
2497
+ * @function decodeDelimited
2498
+ * @memberof google.events.cloud.firestore.v1.Value
2499
+ * @static
2500
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2501
+ * @returns {google.events.cloud.firestore.v1.Value} Value
2502
+ * @throws {Error} If the payload is not a reader or valid buffer
2503
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2504
+ */
2505
+ Value.decodeDelimited = function decodeDelimited(reader) {
2506
+ if (!(reader instanceof $Reader))
2507
+ reader = new $Reader(reader);
2508
+ return this.decode(reader, reader.uint32());
2509
+ };
2510
+
2511
+ /**
2512
+ * Verifies a Value message.
2513
+ * @function verify
2514
+ * @memberof google.events.cloud.firestore.v1.Value
2515
+ * @static
2516
+ * @param {Object.<string,*>} message Plain object to verify
2517
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2518
+ */
2519
+ Value.verify = function verify(message) {
2520
+ if (typeof message !== "object" || message === null)
2521
+ return "object expected";
2522
+ let properties = {};
2523
+ if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
2524
+ properties.valueType = 1;
2525
+ switch (message.nullValue) {
2526
+ default:
2527
+ return "nullValue: enum value expected";
2528
+ case 0:
2529
+ break;
2530
+ }
2531
+ }
2532
+ if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) {
2533
+ if (properties.valueType === 1)
2534
+ return "valueType: multiple values";
2535
+ properties.valueType = 1;
2536
+ if (typeof message.booleanValue !== "boolean")
2537
+ return "booleanValue: boolean expected";
2538
+ }
2539
+ if (message.integerValue != null && message.hasOwnProperty("integerValue")) {
2540
+ if (properties.valueType === 1)
2541
+ return "valueType: multiple values";
2542
+ properties.valueType = 1;
2543
+ if (!$util.isInteger(message.integerValue) && !(message.integerValue && $util.isInteger(message.integerValue.low) && $util.isInteger(message.integerValue.high)))
2544
+ return "integerValue: integer|Long expected";
2545
+ }
2546
+ if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) {
2547
+ if (properties.valueType === 1)
2548
+ return "valueType: multiple values";
2549
+ properties.valueType = 1;
2550
+ if (typeof message.doubleValue !== "number")
2551
+ return "doubleValue: number expected";
2552
+ }
2553
+ if (message.timestampValue != null && message.hasOwnProperty("timestampValue")) {
2554
+ if (properties.valueType === 1)
2555
+ return "valueType: multiple values";
2556
+ properties.valueType = 1;
2557
+ {
2558
+ let error = $root.google.protobuf.Timestamp.verify(message.timestampValue);
2559
+ if (error)
2560
+ return "timestampValue." + error;
2561
+ }
2562
+ }
2563
+ if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2564
+ if (properties.valueType === 1)
2565
+ return "valueType: multiple values";
2566
+ properties.valueType = 1;
2567
+ if (!$util.isString(message.stringValue))
2568
+ return "stringValue: string expected";
2569
+ }
2570
+ if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) {
2571
+ if (properties.valueType === 1)
2572
+ return "valueType: multiple values";
2573
+ properties.valueType = 1;
2574
+ if (!(message.bytesValue && typeof message.bytesValue.length === "number" || $util.isString(message.bytesValue)))
2575
+ return "bytesValue: buffer expected";
2576
+ }
2577
+ if (message.referenceValue != null && message.hasOwnProperty("referenceValue")) {
2578
+ if (properties.valueType === 1)
2579
+ return "valueType: multiple values";
2580
+ properties.valueType = 1;
2581
+ if (!$util.isString(message.referenceValue))
2582
+ return "referenceValue: string expected";
2583
+ }
2584
+ if (message.geoPointValue != null && message.hasOwnProperty("geoPointValue")) {
2585
+ if (properties.valueType === 1)
2586
+ return "valueType: multiple values";
2587
+ properties.valueType = 1;
2588
+ {
2589
+ let error = $root.google.type.LatLng.verify(message.geoPointValue);
2590
+ if (error)
2591
+ return "geoPointValue." + error;
2592
+ }
2593
+ }
2594
+ if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) {
2595
+ if (properties.valueType === 1)
2596
+ return "valueType: multiple values";
2597
+ properties.valueType = 1;
2598
+ {
2599
+ let error = $root.google.events.cloud.firestore.v1.ArrayValue.verify(message.arrayValue);
2600
+ if (error)
2601
+ return "arrayValue." + error;
2602
+ }
2603
+ }
2604
+ if (message.mapValue != null && message.hasOwnProperty("mapValue")) {
2605
+ if (properties.valueType === 1)
2606
+ return "valueType: multiple values";
2607
+ properties.valueType = 1;
2608
+ {
2609
+ let error = $root.google.events.cloud.firestore.v1.MapValue.verify(message.mapValue);
2610
+ if (error)
2611
+ return "mapValue." + error;
2612
+ }
2613
+ }
2614
+ return null;
2615
+ };
2616
+
2617
+ /**
2618
+ * Creates a Value message from a plain object. Also converts values to their respective internal types.
2619
+ * @function fromObject
2620
+ * @memberof google.events.cloud.firestore.v1.Value
2621
+ * @static
2622
+ * @param {Object.<string,*>} object Plain object
2623
+ * @returns {google.events.cloud.firestore.v1.Value} Value
2624
+ */
2625
+ Value.fromObject = function fromObject(object) {
2626
+ if (object instanceof $root.google.events.cloud.firestore.v1.Value)
2627
+ return object;
2628
+ let message = new $root.google.events.cloud.firestore.v1.Value();
2629
+ switch (object.nullValue) {
2630
+ default:
2631
+ if (typeof object.nullValue === "number") {
2632
+ message.nullValue = object.nullValue;
2633
+ break;
2634
+ }
2635
+ break;
2636
+ case "NULL_VALUE":
2637
+ case 0:
2638
+ message.nullValue = 0;
2639
+ break;
2640
+ }
2641
+ if (object.booleanValue != null)
2642
+ message.booleanValue = Boolean(object.booleanValue);
2643
+ if (object.integerValue != null)
2644
+ if ($util.Long)
2645
+ (message.integerValue = $util.Long.fromValue(object.integerValue)).unsigned = false;
2646
+ else if (typeof object.integerValue === "string")
2647
+ message.integerValue = parseInt(object.integerValue, 10);
2648
+ else if (typeof object.integerValue === "number")
2649
+ message.integerValue = object.integerValue;
2650
+ else if (typeof object.integerValue === "object")
2651
+ message.integerValue = new $util.LongBits(object.integerValue.low >>> 0, object.integerValue.high >>> 0).toNumber();
2652
+ if (object.doubleValue != null)
2653
+ message.doubleValue = Number(object.doubleValue);
2654
+ if (object.timestampValue != null) {
2655
+ if (typeof object.timestampValue !== "object")
2656
+ throw TypeError(".google.events.cloud.firestore.v1.Value.timestampValue: object expected");
2657
+ message.timestampValue = $root.google.protobuf.Timestamp.fromObject(object.timestampValue);
2658
+ }
2659
+ if (object.stringValue != null)
2660
+ message.stringValue = String(object.stringValue);
2661
+ if (object.bytesValue != null)
2662
+ if (typeof object.bytesValue === "string")
2663
+ $util.base64.decode(object.bytesValue, message.bytesValue = $util.newBuffer($util.base64.length(object.bytesValue)), 0);
2664
+ else if (object.bytesValue.length >= 0)
2665
+ message.bytesValue = object.bytesValue;
2666
+ if (object.referenceValue != null)
2667
+ message.referenceValue = String(object.referenceValue);
2668
+ if (object.geoPointValue != null) {
2669
+ if (typeof object.geoPointValue !== "object")
2670
+ throw TypeError(".google.events.cloud.firestore.v1.Value.geoPointValue: object expected");
2671
+ message.geoPointValue = $root.google.type.LatLng.fromObject(object.geoPointValue);
2672
+ }
2673
+ if (object.arrayValue != null) {
2674
+ if (typeof object.arrayValue !== "object")
2675
+ throw TypeError(".google.events.cloud.firestore.v1.Value.arrayValue: object expected");
2676
+ message.arrayValue = $root.google.events.cloud.firestore.v1.ArrayValue.fromObject(object.arrayValue);
2677
+ }
2678
+ if (object.mapValue != null) {
2679
+ if (typeof object.mapValue !== "object")
2680
+ throw TypeError(".google.events.cloud.firestore.v1.Value.mapValue: object expected");
2681
+ message.mapValue = $root.google.events.cloud.firestore.v1.MapValue.fromObject(object.mapValue);
2682
+ }
2683
+ return message;
2684
+ };
2685
+
2686
+ /**
2687
+ * Creates a plain object from a Value message. Also converts values to other types if specified.
2688
+ * @function toObject
2689
+ * @memberof google.events.cloud.firestore.v1.Value
2690
+ * @static
2691
+ * @param {google.events.cloud.firestore.v1.Value} message Value
2692
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2693
+ * @returns {Object.<string,*>} Plain object
2694
+ */
2695
+ Value.toObject = function toObject(message, options) {
2696
+ if (!options)
2697
+ options = {};
2698
+ let object = {};
2699
+ if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) {
2700
+ object.booleanValue = message.booleanValue;
2701
+ if (options.oneofs)
2702
+ object.valueType = "booleanValue";
2703
+ }
2704
+ if (message.integerValue != null && message.hasOwnProperty("integerValue")) {
2705
+ if (typeof message.integerValue === "number")
2706
+ object.integerValue = options.longs === String ? String(message.integerValue) : message.integerValue;
2707
+ else
2708
+ object.integerValue = options.longs === String ? $util.Long.prototype.toString.call(message.integerValue) : options.longs === Number ? new $util.LongBits(message.integerValue.low >>> 0, message.integerValue.high >>> 0).toNumber() : message.integerValue;
2709
+ if (options.oneofs)
2710
+ object.valueType = "integerValue";
2711
+ }
2712
+ if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) {
2713
+ object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue;
2714
+ if (options.oneofs)
2715
+ object.valueType = "doubleValue";
2716
+ }
2717
+ if (message.referenceValue != null && message.hasOwnProperty("referenceValue")) {
2718
+ object.referenceValue = message.referenceValue;
2719
+ if (options.oneofs)
2720
+ object.valueType = "referenceValue";
2721
+ }
2722
+ if (message.mapValue != null && message.hasOwnProperty("mapValue")) {
2723
+ object.mapValue = $root.google.events.cloud.firestore.v1.MapValue.toObject(message.mapValue, options);
2724
+ if (options.oneofs)
2725
+ object.valueType = "mapValue";
2726
+ }
2727
+ if (message.geoPointValue != null && message.hasOwnProperty("geoPointValue")) {
2728
+ object.geoPointValue = $root.google.type.LatLng.toObject(message.geoPointValue, options);
2729
+ if (options.oneofs)
2730
+ object.valueType = "geoPointValue";
2731
+ }
2732
+ if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) {
2733
+ object.arrayValue = $root.google.events.cloud.firestore.v1.ArrayValue.toObject(message.arrayValue, options);
2734
+ if (options.oneofs)
2735
+ object.valueType = "arrayValue";
2736
+ }
2737
+ if (message.timestampValue != null && message.hasOwnProperty("timestampValue")) {
2738
+ object.timestampValue = $root.google.protobuf.Timestamp.toObject(message.timestampValue, options);
2739
+ if (options.oneofs)
2740
+ object.valueType = "timestampValue";
2741
+ }
2742
+ if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
2743
+ object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue;
2744
+ if (options.oneofs)
2745
+ object.valueType = "nullValue";
2746
+ }
2747
+ if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2748
+ object.stringValue = message.stringValue;
2749
+ if (options.oneofs)
2750
+ object.valueType = "stringValue";
2751
+ }
2752
+ if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) {
2753
+ object.bytesValue = options.bytes === String ? $util.base64.encode(message.bytesValue, 0, message.bytesValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesValue) : message.bytesValue;
2754
+ if (options.oneofs)
2755
+ object.valueType = "bytesValue";
2756
+ }
2757
+ return object;
2758
+ };
2759
+
2760
+ /**
2761
+ * Converts this Value to JSON.
2762
+ * @function toJSON
2763
+ * @memberof google.events.cloud.firestore.v1.Value
2764
+ * @instance
2765
+ * @returns {Object.<string,*>} JSON object
2766
+ */
2767
+ Value.prototype.toJSON = function toJSON() {
2768
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2769
+ };
2770
+
2771
+ /**
2772
+ * Gets the default type url for Value
2773
+ * @function getTypeUrl
2774
+ * @memberof google.events.cloud.firestore.v1.Value
2775
+ * @static
2776
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2777
+ * @returns {string} The default type url
2778
+ */
2779
+ Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2780
+ if (typeUrlPrefix === undefined) {
2781
+ typeUrlPrefix = "type.googleapis.com";
2782
+ }
2783
+ return typeUrlPrefix + "/google.events.cloud.firestore.v1.Value";
2784
+ };
2785
+
2786
+ return Value;
2787
+ })();
2788
+
2789
+ v1.ArrayValue = (function() {
2790
+
2791
+ /**
2792
+ * Properties of an ArrayValue.
2793
+ * @memberof google.events.cloud.firestore.v1
2794
+ * @interface IArrayValue
2795
+ * @property {Array.<google.events.cloud.firestore.v1.IValue>|null} [values] ArrayValue values
2796
+ */
2797
+
2798
+ /**
2799
+ * Constructs a new ArrayValue.
2800
+ * @memberof google.events.cloud.firestore.v1
2801
+ * @classdesc Represents an ArrayValue.
2802
+ * @implements IArrayValue
2803
+ * @constructor
2804
+ * @param {google.events.cloud.firestore.v1.IArrayValue=} [properties] Properties to set
2805
+ */
2806
+ function ArrayValue(properties) {
2807
+ this.values = [];
2808
+ if (properties)
2809
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2810
+ if (properties[keys[i]] != null)
2811
+ this[keys[i]] = properties[keys[i]];
2812
+ }
2813
+
2814
+ /**
2815
+ * ArrayValue values.
2816
+ * @member {Array.<google.events.cloud.firestore.v1.IValue>} values
2817
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2818
+ * @instance
2819
+ */
2820
+ ArrayValue.prototype.values = $util.emptyArray;
2821
+
2822
+ /**
2823
+ * Creates a new ArrayValue instance using the specified properties.
2824
+ * @function create
2825
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2826
+ * @static
2827
+ * @param {google.events.cloud.firestore.v1.IArrayValue=} [properties] Properties to set
2828
+ * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue instance
2829
+ */
2830
+ ArrayValue.create = function create(properties) {
2831
+ return new ArrayValue(properties);
2832
+ };
2833
+
2834
+ /**
2835
+ * Encodes the specified ArrayValue message. Does not implicitly {@link google.events.cloud.firestore.v1.ArrayValue.verify|verify} messages.
2836
+ * @function encode
2837
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2838
+ * @static
2839
+ * @param {google.events.cloud.firestore.v1.IArrayValue} message ArrayValue message or plain object to encode
2840
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2841
+ * @returns {$protobuf.Writer} Writer
2842
+ */
2843
+ ArrayValue.encode = function encode(message, writer) {
2844
+ if (!writer)
2845
+ writer = $Writer.create();
2846
+ if (message.values != null && message.values.length)
2847
+ for (let i = 0; i < message.values.length; ++i)
2848
+ $root.google.events.cloud.firestore.v1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
2849
+ return writer;
2850
+ };
2851
+
2852
+ /**
2853
+ * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.ArrayValue.verify|verify} messages.
2854
+ * @function encodeDelimited
2855
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2856
+ * @static
2857
+ * @param {google.events.cloud.firestore.v1.IArrayValue} message ArrayValue message or plain object to encode
2858
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2859
+ * @returns {$protobuf.Writer} Writer
2860
+ */
2861
+ ArrayValue.encodeDelimited = function encodeDelimited(message, writer) {
2862
+ return this.encode(message, writer).ldelim();
2863
+ };
2864
+
2865
+ /**
2866
+ * Decodes an ArrayValue message from the specified reader or buffer.
2867
+ * @function decode
2868
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2869
+ * @static
2870
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2871
+ * @param {number} [length] Message length if known beforehand
2872
+ * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue
2873
+ * @throws {Error} If the payload is not a reader or valid buffer
2874
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2875
+ */
2876
+ ArrayValue.decode = function decode(reader, length) {
2877
+ if (!(reader instanceof $Reader))
2878
+ reader = $Reader.create(reader);
2879
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.ArrayValue();
2880
+ while (reader.pos < end) {
2881
+ let tag = reader.uint32();
2882
+ switch (tag >>> 3) {
2883
+ case 1: {
2884
+ if (!(message.values && message.values.length))
2885
+ message.values = [];
2886
+ message.values.push($root.google.events.cloud.firestore.v1.Value.decode(reader, reader.uint32()));
2887
+ break;
2888
+ }
2889
+ default:
2890
+ reader.skipType(tag & 7);
2891
+ break;
2892
+ }
2893
+ }
2894
+ return message;
2895
+ };
2896
+
2897
+ /**
2898
+ * Decodes an ArrayValue message from the specified reader or buffer, length delimited.
2899
+ * @function decodeDelimited
2900
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2901
+ * @static
2902
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2903
+ * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue
2904
+ * @throws {Error} If the payload is not a reader or valid buffer
2905
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2906
+ */
2907
+ ArrayValue.decodeDelimited = function decodeDelimited(reader) {
2908
+ if (!(reader instanceof $Reader))
2909
+ reader = new $Reader(reader);
2910
+ return this.decode(reader, reader.uint32());
2911
+ };
2912
+
2913
+ /**
2914
+ * Verifies an ArrayValue message.
2915
+ * @function verify
2916
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2917
+ * @static
2918
+ * @param {Object.<string,*>} message Plain object to verify
2919
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2920
+ */
2921
+ ArrayValue.verify = function verify(message) {
2922
+ if (typeof message !== "object" || message === null)
2923
+ return "object expected";
2924
+ if (message.values != null && message.hasOwnProperty("values")) {
2925
+ if (!Array.isArray(message.values))
2926
+ return "values: array expected";
2927
+ for (let i = 0; i < message.values.length; ++i) {
2928
+ let error = $root.google.events.cloud.firestore.v1.Value.verify(message.values[i]);
2929
+ if (error)
2930
+ return "values." + error;
2931
+ }
2932
+ }
2933
+ return null;
2934
+ };
2935
+
2936
+ /**
2937
+ * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types.
2938
+ * @function fromObject
2939
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2940
+ * @static
2941
+ * @param {Object.<string,*>} object Plain object
2942
+ * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue
2943
+ */
2944
+ ArrayValue.fromObject = function fromObject(object) {
2945
+ if (object instanceof $root.google.events.cloud.firestore.v1.ArrayValue)
2946
+ return object;
2947
+ let message = new $root.google.events.cloud.firestore.v1.ArrayValue();
2948
+ if (object.values) {
2949
+ if (!Array.isArray(object.values))
2950
+ throw TypeError(".google.events.cloud.firestore.v1.ArrayValue.values: array expected");
2951
+ message.values = [];
2952
+ for (let i = 0; i < object.values.length; ++i) {
2953
+ if (typeof object.values[i] !== "object")
2954
+ throw TypeError(".google.events.cloud.firestore.v1.ArrayValue.values: object expected");
2955
+ message.values[i] = $root.google.events.cloud.firestore.v1.Value.fromObject(object.values[i]);
2956
+ }
2957
+ }
2958
+ return message;
2959
+ };
2960
+
2961
+ /**
2962
+ * Creates a plain object from an ArrayValue message. Also converts values to other types if specified.
2963
+ * @function toObject
2964
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2965
+ * @static
2966
+ * @param {google.events.cloud.firestore.v1.ArrayValue} message ArrayValue
2967
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2968
+ * @returns {Object.<string,*>} Plain object
2969
+ */
2970
+ ArrayValue.toObject = function toObject(message, options) {
2971
+ if (!options)
2972
+ options = {};
2973
+ let object = {};
2974
+ if (options.arrays || options.defaults)
2975
+ object.values = [];
2976
+ if (message.values && message.values.length) {
2977
+ object.values = [];
2978
+ for (let j = 0; j < message.values.length; ++j)
2979
+ object.values[j] = $root.google.events.cloud.firestore.v1.Value.toObject(message.values[j], options);
2980
+ }
2981
+ return object;
2982
+ };
2983
+
2984
+ /**
2985
+ * Converts this ArrayValue to JSON.
2986
+ * @function toJSON
2987
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2988
+ * @instance
2989
+ * @returns {Object.<string,*>} JSON object
2990
+ */
2991
+ ArrayValue.prototype.toJSON = function toJSON() {
2992
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2993
+ };
2994
+
2995
+ /**
2996
+ * Gets the default type url for ArrayValue
2997
+ * @function getTypeUrl
2998
+ * @memberof google.events.cloud.firestore.v1.ArrayValue
2999
+ * @static
3000
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3001
+ * @returns {string} The default type url
3002
+ */
3003
+ ArrayValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3004
+ if (typeUrlPrefix === undefined) {
3005
+ typeUrlPrefix = "type.googleapis.com";
3006
+ }
3007
+ return typeUrlPrefix + "/google.events.cloud.firestore.v1.ArrayValue";
3008
+ };
3009
+
3010
+ return ArrayValue;
3011
+ })();
3012
+
3013
+ v1.MapValue = (function() {
3014
+
3015
+ /**
3016
+ * Properties of a MapValue.
3017
+ * @memberof google.events.cloud.firestore.v1
3018
+ * @interface IMapValue
3019
+ * @property {Object.<string,google.events.cloud.firestore.v1.IValue>|null} [fields] MapValue fields
3020
+ */
3021
+
3022
+ /**
3023
+ * Constructs a new MapValue.
3024
+ * @memberof google.events.cloud.firestore.v1
3025
+ * @classdesc Represents a MapValue.
3026
+ * @implements IMapValue
3027
+ * @constructor
3028
+ * @param {google.events.cloud.firestore.v1.IMapValue=} [properties] Properties to set
3029
+ */
3030
+ function MapValue(properties) {
3031
+ this.fields = {};
3032
+ if (properties)
3033
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3034
+ if (properties[keys[i]] != null)
3035
+ this[keys[i]] = properties[keys[i]];
3036
+ }
3037
+
3038
+ /**
3039
+ * MapValue fields.
3040
+ * @member {Object.<string,google.events.cloud.firestore.v1.IValue>} fields
3041
+ * @memberof google.events.cloud.firestore.v1.MapValue
3042
+ * @instance
3043
+ */
3044
+ MapValue.prototype.fields = $util.emptyObject;
3045
+
3046
+ /**
3047
+ * Creates a new MapValue instance using the specified properties.
3048
+ * @function create
3049
+ * @memberof google.events.cloud.firestore.v1.MapValue
3050
+ * @static
3051
+ * @param {google.events.cloud.firestore.v1.IMapValue=} [properties] Properties to set
3052
+ * @returns {google.events.cloud.firestore.v1.MapValue} MapValue instance
3053
+ */
3054
+ MapValue.create = function create(properties) {
3055
+ return new MapValue(properties);
3056
+ };
3057
+
3058
+ /**
3059
+ * Encodes the specified MapValue message. Does not implicitly {@link google.events.cloud.firestore.v1.MapValue.verify|verify} messages.
3060
+ * @function encode
3061
+ * @memberof google.events.cloud.firestore.v1.MapValue
3062
+ * @static
3063
+ * @param {google.events.cloud.firestore.v1.IMapValue} message MapValue message or plain object to encode
3064
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3065
+ * @returns {$protobuf.Writer} Writer
3066
+ */
3067
+ MapValue.encode = function encode(message, writer) {
3068
+ if (!writer)
3069
+ writer = $Writer.create();
3070
+ if (message.fields != null && Object.hasOwnProperty.call(message, "fields"))
3071
+ for (let keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) {
3072
+ writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
3073
+ $root.google.events.cloud.firestore.v1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
3074
+ }
3075
+ return writer;
3076
+ };
3077
+
3078
+ /**
3079
+ * Encodes the specified MapValue message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.MapValue.verify|verify} messages.
3080
+ * @function encodeDelimited
3081
+ * @memberof google.events.cloud.firestore.v1.MapValue
3082
+ * @static
3083
+ * @param {google.events.cloud.firestore.v1.IMapValue} message MapValue message or plain object to encode
3084
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3085
+ * @returns {$protobuf.Writer} Writer
3086
+ */
3087
+ MapValue.encodeDelimited = function encodeDelimited(message, writer) {
3088
+ return this.encode(message, writer).ldelim();
3089
+ };
3090
+
3091
+ /**
3092
+ * Decodes a MapValue message from the specified reader or buffer.
3093
+ * @function decode
3094
+ * @memberof google.events.cloud.firestore.v1.MapValue
3095
+ * @static
3096
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3097
+ * @param {number} [length] Message length if known beforehand
3098
+ * @returns {google.events.cloud.firestore.v1.MapValue} MapValue
3099
+ * @throws {Error} If the payload is not a reader or valid buffer
3100
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3101
+ */
3102
+ MapValue.decode = function decode(reader, length) {
3103
+ if (!(reader instanceof $Reader))
3104
+ reader = $Reader.create(reader);
3105
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.MapValue(), key, value;
3106
+ while (reader.pos < end) {
3107
+ let tag = reader.uint32();
3108
+ switch (tag >>> 3) {
3109
+ case 1: {
3110
+ if (message.fields === $util.emptyObject)
3111
+ message.fields = {};
3112
+ let end2 = reader.uint32() + reader.pos;
3113
+ key = "";
3114
+ value = null;
3115
+ while (reader.pos < end2) {
3116
+ let tag2 = reader.uint32();
3117
+ switch (tag2 >>> 3) {
3118
+ case 1:
3119
+ key = reader.string();
3120
+ break;
3121
+ case 2:
3122
+ value = $root.google.events.cloud.firestore.v1.Value.decode(reader, reader.uint32());
3123
+ break;
3124
+ default:
3125
+ reader.skipType(tag2 & 7);
3126
+ break;
3127
+ }
3128
+ }
3129
+ message.fields[key] = value;
3130
+ break;
3131
+ }
3132
+ default:
3133
+ reader.skipType(tag & 7);
3134
+ break;
3135
+ }
3136
+ }
3137
+ return message;
3138
+ };
3139
+
3140
+ /**
3141
+ * Decodes a MapValue message from the specified reader or buffer, length delimited.
3142
+ * @function decodeDelimited
3143
+ * @memberof google.events.cloud.firestore.v1.MapValue
3144
+ * @static
3145
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3146
+ * @returns {google.events.cloud.firestore.v1.MapValue} MapValue
3147
+ * @throws {Error} If the payload is not a reader or valid buffer
3148
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3149
+ */
3150
+ MapValue.decodeDelimited = function decodeDelimited(reader) {
3151
+ if (!(reader instanceof $Reader))
3152
+ reader = new $Reader(reader);
3153
+ return this.decode(reader, reader.uint32());
3154
+ };
3155
+
3156
+ /**
3157
+ * Verifies a MapValue message.
3158
+ * @function verify
3159
+ * @memberof google.events.cloud.firestore.v1.MapValue
3160
+ * @static
3161
+ * @param {Object.<string,*>} message Plain object to verify
3162
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3163
+ */
3164
+ MapValue.verify = function verify(message) {
3165
+ if (typeof message !== "object" || message === null)
3166
+ return "object expected";
3167
+ if (message.fields != null && message.hasOwnProperty("fields")) {
3168
+ if (!$util.isObject(message.fields))
3169
+ return "fields: object expected";
3170
+ let key = Object.keys(message.fields);
3171
+ for (let i = 0; i < key.length; ++i) {
3172
+ let error = $root.google.events.cloud.firestore.v1.Value.verify(message.fields[key[i]]);
3173
+ if (error)
3174
+ return "fields." + error;
3175
+ }
3176
+ }
3177
+ return null;
3178
+ };
3179
+
3180
+ /**
3181
+ * Creates a MapValue message from a plain object. Also converts values to their respective internal types.
3182
+ * @function fromObject
3183
+ * @memberof google.events.cloud.firestore.v1.MapValue
3184
+ * @static
3185
+ * @param {Object.<string,*>} object Plain object
3186
+ * @returns {google.events.cloud.firestore.v1.MapValue} MapValue
3187
+ */
3188
+ MapValue.fromObject = function fromObject(object) {
3189
+ if (object instanceof $root.google.events.cloud.firestore.v1.MapValue)
3190
+ return object;
3191
+ let message = new $root.google.events.cloud.firestore.v1.MapValue();
3192
+ if (object.fields) {
3193
+ if (typeof object.fields !== "object")
3194
+ throw TypeError(".google.events.cloud.firestore.v1.MapValue.fields: object expected");
3195
+ message.fields = {};
3196
+ for (let keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) {
3197
+ if (typeof object.fields[keys[i]] !== "object")
3198
+ throw TypeError(".google.events.cloud.firestore.v1.MapValue.fields: object expected");
3199
+ message.fields[keys[i]] = $root.google.events.cloud.firestore.v1.Value.fromObject(object.fields[keys[i]]);
3200
+ }
3201
+ }
3202
+ return message;
3203
+ };
3204
+
3205
+ /**
3206
+ * Creates a plain object from a MapValue message. Also converts values to other types if specified.
3207
+ * @function toObject
3208
+ * @memberof google.events.cloud.firestore.v1.MapValue
3209
+ * @static
3210
+ * @param {google.events.cloud.firestore.v1.MapValue} message MapValue
3211
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3212
+ * @returns {Object.<string,*>} Plain object
3213
+ */
3214
+ MapValue.toObject = function toObject(message, options) {
3215
+ if (!options)
3216
+ options = {};
3217
+ let object = {};
3218
+ if (options.objects || options.defaults)
3219
+ object.fields = {};
3220
+ let keys2;
3221
+ if (message.fields && (keys2 = Object.keys(message.fields)).length) {
3222
+ object.fields = {};
3223
+ for (let j = 0; j < keys2.length; ++j)
3224
+ object.fields[keys2[j]] = $root.google.events.cloud.firestore.v1.Value.toObject(message.fields[keys2[j]], options);
3225
+ }
3226
+ return object;
3227
+ };
3228
+
3229
+ /**
3230
+ * Converts this MapValue to JSON.
3231
+ * @function toJSON
3232
+ * @memberof google.events.cloud.firestore.v1.MapValue
3233
+ * @instance
3234
+ * @returns {Object.<string,*>} JSON object
3235
+ */
3236
+ MapValue.prototype.toJSON = function toJSON() {
3237
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3238
+ };
3239
+
3240
+ /**
3241
+ * Gets the default type url for MapValue
3242
+ * @function getTypeUrl
3243
+ * @memberof google.events.cloud.firestore.v1.MapValue
3244
+ * @static
3245
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3246
+ * @returns {string} The default type url
3247
+ */
3248
+ MapValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3249
+ if (typeUrlPrefix === undefined) {
3250
+ typeUrlPrefix = "type.googleapis.com";
3251
+ }
3252
+ return typeUrlPrefix + "/google.events.cloud.firestore.v1.MapValue";
3253
+ };
3254
+
3255
+ return MapValue;
3256
+ })();
3257
+
3258
+ return v1;
3259
+ })();
3260
+
3261
+ return firestore;
3262
+ })();
3263
+
3264
+ return cloud;
3265
+ })();
3266
+
3267
+ return events;
3268
+ })();
3269
+
3270
+ google.type = (function() {
3271
+
3272
+ /**
3273
+ * Namespace type.
3274
+ * @memberof google
3275
+ * @namespace
3276
+ */
3277
+ const type = {};
3278
+
3279
+ type.LatLng = (function() {
3280
+
3281
+ /**
3282
+ * Properties of a LatLng.
3283
+ * @memberof google.type
3284
+ * @interface ILatLng
3285
+ * @property {number|null} [latitude] LatLng latitude
3286
+ * @property {number|null} [longitude] LatLng longitude
3287
+ */
3288
+
3289
+ /**
3290
+ * Constructs a new LatLng.
3291
+ * @memberof google.type
3292
+ * @classdesc Represents a LatLng.
3293
+ * @implements ILatLng
3294
+ * @constructor
3295
+ * @param {google.type.ILatLng=} [properties] Properties to set
3296
+ */
3297
+ function LatLng(properties) {
3298
+ if (properties)
3299
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3300
+ if (properties[keys[i]] != null)
3301
+ this[keys[i]] = properties[keys[i]];
3302
+ }
3303
+
3304
+ /**
3305
+ * LatLng latitude.
3306
+ * @member {number} latitude
3307
+ * @memberof google.type.LatLng
3308
+ * @instance
3309
+ */
3310
+ LatLng.prototype.latitude = 0;
3311
+
3312
+ /**
3313
+ * LatLng longitude.
3314
+ * @member {number} longitude
3315
+ * @memberof google.type.LatLng
3316
+ * @instance
3317
+ */
3318
+ LatLng.prototype.longitude = 0;
3319
+
3320
+ /**
3321
+ * Creates a new LatLng instance using the specified properties.
3322
+ * @function create
3323
+ * @memberof google.type.LatLng
3324
+ * @static
3325
+ * @param {google.type.ILatLng=} [properties] Properties to set
3326
+ * @returns {google.type.LatLng} LatLng instance
3327
+ */
3328
+ LatLng.create = function create(properties) {
3329
+ return new LatLng(properties);
3330
+ };
3331
+
3332
+ /**
3333
+ * Encodes the specified LatLng message. Does not implicitly {@link google.type.LatLng.verify|verify} messages.
3334
+ * @function encode
3335
+ * @memberof google.type.LatLng
3336
+ * @static
3337
+ * @param {google.type.ILatLng} message LatLng message or plain object to encode
3338
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3339
+ * @returns {$protobuf.Writer} Writer
3340
+ */
3341
+ LatLng.encode = function encode(message, writer) {
3342
+ if (!writer)
3343
+ writer = $Writer.create();
3344
+ if (message.latitude != null && Object.hasOwnProperty.call(message, "latitude"))
3345
+ writer.uint32(/* id 1, wireType 1 =*/9).double(message.latitude);
3346
+ if (message.longitude != null && Object.hasOwnProperty.call(message, "longitude"))
3347
+ writer.uint32(/* id 2, wireType 1 =*/17).double(message.longitude);
3348
+ return writer;
3349
+ };
3350
+
3351
+ /**
3352
+ * Encodes the specified LatLng message, length delimited. Does not implicitly {@link google.type.LatLng.verify|verify} messages.
3353
+ * @function encodeDelimited
3354
+ * @memberof google.type.LatLng
3355
+ * @static
3356
+ * @param {google.type.ILatLng} message LatLng message or plain object to encode
3357
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3358
+ * @returns {$protobuf.Writer} Writer
3359
+ */
3360
+ LatLng.encodeDelimited = function encodeDelimited(message, writer) {
3361
+ return this.encode(message, writer).ldelim();
3362
+ };
3363
+
3364
+ /**
3365
+ * Decodes a LatLng message from the specified reader or buffer.
3366
+ * @function decode
3367
+ * @memberof google.type.LatLng
3368
+ * @static
3369
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3370
+ * @param {number} [length] Message length if known beforehand
3371
+ * @returns {google.type.LatLng} LatLng
3372
+ * @throws {Error} If the payload is not a reader or valid buffer
3373
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3374
+ */
3375
+ LatLng.decode = function decode(reader, length) {
3376
+ if (!(reader instanceof $Reader))
3377
+ reader = $Reader.create(reader);
3378
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.LatLng();
3379
+ while (reader.pos < end) {
3380
+ let tag = reader.uint32();
3381
+ switch (tag >>> 3) {
3382
+ case 1: {
3383
+ message.latitude = reader.double();
3384
+ break;
3385
+ }
3386
+ case 2: {
3387
+ message.longitude = reader.double();
3388
+ break;
3389
+ }
3390
+ default:
3391
+ reader.skipType(tag & 7);
3392
+ break;
3393
+ }
3394
+ }
3395
+ return message;
3396
+ };
3397
+
3398
+ /**
3399
+ * Decodes a LatLng message from the specified reader or buffer, length delimited.
3400
+ * @function decodeDelimited
3401
+ * @memberof google.type.LatLng
3402
+ * @static
3403
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3404
+ * @returns {google.type.LatLng} LatLng
3405
+ * @throws {Error} If the payload is not a reader or valid buffer
3406
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3407
+ */
3408
+ LatLng.decodeDelimited = function decodeDelimited(reader) {
3409
+ if (!(reader instanceof $Reader))
3410
+ reader = new $Reader(reader);
3411
+ return this.decode(reader, reader.uint32());
3412
+ };
3413
+
3414
+ /**
3415
+ * Verifies a LatLng message.
3416
+ * @function verify
3417
+ * @memberof google.type.LatLng
3418
+ * @static
3419
+ * @param {Object.<string,*>} message Plain object to verify
3420
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3421
+ */
3422
+ LatLng.verify = function verify(message) {
3423
+ if (typeof message !== "object" || message === null)
3424
+ return "object expected";
3425
+ if (message.latitude != null && message.hasOwnProperty("latitude"))
3426
+ if (typeof message.latitude !== "number")
3427
+ return "latitude: number expected";
3428
+ if (message.longitude != null && message.hasOwnProperty("longitude"))
3429
+ if (typeof message.longitude !== "number")
3430
+ return "longitude: number expected";
3431
+ return null;
3432
+ };
3433
+
3434
+ /**
3435
+ * Creates a LatLng message from a plain object. Also converts values to their respective internal types.
3436
+ * @function fromObject
3437
+ * @memberof google.type.LatLng
3438
+ * @static
3439
+ * @param {Object.<string,*>} object Plain object
3440
+ * @returns {google.type.LatLng} LatLng
3441
+ */
3442
+ LatLng.fromObject = function fromObject(object) {
3443
+ if (object instanceof $root.google.type.LatLng)
3444
+ return object;
3445
+ let message = new $root.google.type.LatLng();
3446
+ if (object.latitude != null)
3447
+ message.latitude = Number(object.latitude);
3448
+ if (object.longitude != null)
3449
+ message.longitude = Number(object.longitude);
3450
+ return message;
3451
+ };
3452
+
3453
+ /**
3454
+ * Creates a plain object from a LatLng message. Also converts values to other types if specified.
3455
+ * @function toObject
3456
+ * @memberof google.type.LatLng
3457
+ * @static
3458
+ * @param {google.type.LatLng} message LatLng
3459
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3460
+ * @returns {Object.<string,*>} Plain object
3461
+ */
3462
+ LatLng.toObject = function toObject(message, options) {
3463
+ if (!options)
3464
+ options = {};
3465
+ let object = {};
3466
+ if (options.defaults) {
3467
+ object.latitude = 0;
3468
+ object.longitude = 0;
3469
+ }
3470
+ if (message.latitude != null && message.hasOwnProperty("latitude"))
3471
+ object.latitude = options.json && !isFinite(message.latitude) ? String(message.latitude) : message.latitude;
3472
+ if (message.longitude != null && message.hasOwnProperty("longitude"))
3473
+ object.longitude = options.json && !isFinite(message.longitude) ? String(message.longitude) : message.longitude;
3474
+ return object;
3475
+ };
3476
+
3477
+ /**
3478
+ * Converts this LatLng to JSON.
3479
+ * @function toJSON
3480
+ * @memberof google.type.LatLng
3481
+ * @instance
3482
+ * @returns {Object.<string,*>} JSON object
3483
+ */
3484
+ LatLng.prototype.toJSON = function toJSON() {
3485
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3486
+ };
3487
+
3488
+ /**
3489
+ * Gets the default type url for LatLng
3490
+ * @function getTypeUrl
3491
+ * @memberof google.type.LatLng
3492
+ * @static
3493
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3494
+ * @returns {string} The default type url
3495
+ */
3496
+ LatLng.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3497
+ if (typeUrlPrefix === undefined) {
3498
+ typeUrlPrefix = "type.googleapis.com";
3499
+ }
3500
+ return typeUrlPrefix + "/google.type.LatLng";
3501
+ };
3502
+
3503
+ return LatLng;
3504
+ })();
3505
+
3506
+ return type;
3507
+ })();
3508
+
3509
+ return google;
3510
+ })();
3511
+
3512
+ export { $root as default };