datastore-api 6.1.0 → 6.2.0

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.
@@ -3,464 +3,547 @@ import { setImmediate } from 'timers/promises';
3
3
  import { Datastore, PropertyFilter } from '@google-cloud/datastore';
4
4
  export { Datastore, Key, Query, Transaction } from '@google-cloud/datastore';
5
5
  import { entity } from '@google-cloud/datastore/build/src/entity';
6
- import { assertIsObject, assertIsDefined, assert, assertIsArray, assertIsString, assertIsNumber, getType } from 'assertate-debug';
6
+ import { assertIsObject, assertIsDefined, assertIsString, assertIsArray, assertIsNumber, assert, getType } from 'assertate-debug';
7
7
  import Debug from 'debug';
8
8
  import promClient from 'prom-client';
9
9
 
10
+ function _OverloadYield(e, d) {
11
+ this.v = e, this.k = d;
12
+ }
13
+ function _arrayLikeToArray(r, a) {
14
+ (null == a || a > r.length) && (a = r.length);
15
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
16
+ return n;
17
+ }
18
+ function _asyncIterator(r) {
19
+ var n,
20
+ t,
21
+ o,
22
+ e = 2;
23
+ for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
24
+ if (t && null != (n = r[t])) return n.call(r);
25
+ if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
26
+ t = "@@asyncIterator", o = "@@iterator";
27
+ }
28
+ throw new TypeError("Object is not async iterable");
29
+ }
30
+ function AsyncFromSyncIterator(r) {
31
+ function AsyncFromSyncIteratorContinuation(r) {
32
+ if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
33
+ var n = r.done;
34
+ return Promise.resolve(r.value).then(function (r) {
35
+ return {
36
+ value: r,
37
+ done: n
38
+ };
39
+ });
40
+ }
41
+ return AsyncFromSyncIterator = function (r) {
42
+ this.s = r, this.n = r.next;
43
+ }, AsyncFromSyncIterator.prototype = {
44
+ s: null,
45
+ n: null,
46
+ next: function () {
47
+ return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
48
+ },
49
+ return: function (r) {
50
+ var n = this.s.return;
51
+ return void 0 === n ? Promise.resolve({
52
+ value: r,
53
+ done: !0
54
+ }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
55
+ },
56
+ throw: function (r) {
57
+ var n = this.s.return;
58
+ return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
59
+ }
60
+ }, new AsyncFromSyncIterator(r);
61
+ }
62
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
63
+ try {
64
+ var i = n[a](c),
65
+ u = i.value;
66
+ } catch (n) {
67
+ return void e(n);
68
+ }
69
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
70
+ }
71
+ function _asyncToGenerator(n) {
72
+ return function () {
73
+ var t = this,
74
+ e = arguments;
75
+ return new Promise(function (r, o) {
76
+ var a = n.apply(t, e);
77
+ function _next(n) {
78
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
79
+ }
80
+ function _throw(n) {
81
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
82
+ }
83
+ _next(void 0);
84
+ });
85
+ };
86
+ }
87
+ function _awaitAsyncGenerator(e) {
88
+ return new _OverloadYield(e, 0);
89
+ }
90
+ function _construct(t, e, r) {
91
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
92
+ var o = [null];
93
+ o.push.apply(o, e);
94
+ var p = new (t.bind.apply(t, o))();
95
+ return r && _setPrototypeOf(p, r.prototype), p;
96
+ }
97
+ function _createForOfIteratorHelperLoose(r, e) {
98
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
99
+ if (t) return (t = t.call(r)).next.bind(t);
100
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
101
+ t && (r = t);
102
+ var o = 0;
103
+ return function () {
104
+ return o >= r.length ? {
105
+ done: !0
106
+ } : {
107
+ done: !1,
108
+ value: r[o++]
109
+ };
110
+ };
111
+ }
112
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
113
+ }
114
+ function _extends() {
115
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
116
+ for (var e = 1; e < arguments.length; e++) {
117
+ var t = arguments[e];
118
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
119
+ }
120
+ return n;
121
+ }, _extends.apply(null, arguments);
122
+ }
123
+ function _getPrototypeOf(t) {
124
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
125
+ return t.__proto__ || Object.getPrototypeOf(t);
126
+ }, _getPrototypeOf(t);
127
+ }
128
+ function _inheritsLoose(t, o) {
129
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
130
+ }
131
+ function _isNativeFunction(t) {
132
+ try {
133
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
134
+ } catch (n) {
135
+ return "function" == typeof t;
136
+ }
137
+ }
138
+ function _isNativeReflectConstruct() {
139
+ try {
140
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
141
+ } catch (t) {}
142
+ return (_isNativeReflectConstruct = function () {
143
+ return !!t;
144
+ })();
145
+ }
10
146
  function _regeneratorRuntime() {
11
147
  _regeneratorRuntime = function () {
12
- return exports;
148
+ return e;
13
149
  };
14
- var exports = {},
15
- Op = Object.prototype,
16
- hasOwn = Op.hasOwnProperty,
17
- defineProperty = Object.defineProperty || function (obj, key, desc) {
18
- obj[key] = desc.value;
150
+ var t,
151
+ e = {},
152
+ r = Object.prototype,
153
+ n = r.hasOwnProperty,
154
+ o = Object.defineProperty || function (t, e, r) {
155
+ t[e] = r.value;
19
156
  },
20
- $Symbol = "function" == typeof Symbol ? Symbol : {},
21
- iteratorSymbol = $Symbol.iterator || "@@iterator",
22
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
23
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
24
- function define(obj, key, value) {
25
- return Object.defineProperty(obj, key, {
26
- value: value,
157
+ i = "function" == typeof Symbol ? Symbol : {},
158
+ a = i.iterator || "@@iterator",
159
+ c = i.asyncIterator || "@@asyncIterator",
160
+ u = i.toStringTag || "@@toStringTag";
161
+ function define(t, e, r) {
162
+ return Object.defineProperty(t, e, {
163
+ value: r,
27
164
  enumerable: !0,
28
165
  configurable: !0,
29
166
  writable: !0
30
- }), obj[key];
167
+ }), t[e];
31
168
  }
32
169
  try {
33
170
  define({}, "");
34
- } catch (err) {
35
- define = function (obj, key, value) {
36
- return obj[key] = value;
171
+ } catch (t) {
172
+ define = function (t, e, r) {
173
+ return t[e] = r;
37
174
  };
38
175
  }
39
- function wrap(innerFn, outerFn, self, tryLocsList) {
40
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
41
- generator = Object.create(protoGenerator.prototype),
42
- context = new Context(tryLocsList || []);
43
- return defineProperty(generator, "_invoke", {
44
- value: makeInvokeMethod(innerFn, self, context)
45
- }), generator;
176
+ function wrap(t, e, r, n) {
177
+ var i = e && e.prototype instanceof Generator ? e : Generator,
178
+ a = Object.create(i.prototype),
179
+ c = new Context(n || []);
180
+ return o(a, "_invoke", {
181
+ value: makeInvokeMethod(t, r, c)
182
+ }), a;
46
183
  }
47
- function tryCatch(fn, obj, arg) {
184
+ function tryCatch(t, e, r) {
48
185
  try {
49
186
  return {
50
187
  type: "normal",
51
- arg: fn.call(obj, arg)
188
+ arg: t.call(e, r)
52
189
  };
53
- } catch (err) {
190
+ } catch (t) {
54
191
  return {
55
192
  type: "throw",
56
- arg: err
193
+ arg: t
57
194
  };
58
195
  }
59
196
  }
60
- exports.wrap = wrap;
61
- var ContinueSentinel = {};
197
+ e.wrap = wrap;
198
+ var h = "suspendedStart",
199
+ l = "suspendedYield",
200
+ f = "executing",
201
+ s = "completed",
202
+ y = {};
62
203
  function Generator() {}
63
204
  function GeneratorFunction() {}
64
205
  function GeneratorFunctionPrototype() {}
65
- var IteratorPrototype = {};
66
- define(IteratorPrototype, iteratorSymbol, function () {
206
+ var p = {};
207
+ define(p, a, function () {
67
208
  return this;
68
209
  });
69
- var getProto = Object.getPrototypeOf,
70
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
71
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
72
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
73
- function defineIteratorMethods(prototype) {
74
- ["next", "throw", "return"].forEach(function (method) {
75
- define(prototype, method, function (arg) {
76
- return this._invoke(method, arg);
210
+ var d = Object.getPrototypeOf,
211
+ v = d && d(d(values([])));
212
+ v && v !== r && n.call(v, a) && (p = v);
213
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
214
+ function defineIteratorMethods(t) {
215
+ ["next", "throw", "return"].forEach(function (e) {
216
+ define(t, e, function (t) {
217
+ return this._invoke(e, t);
77
218
  });
78
219
  });
79
220
  }
80
- function AsyncIterator(generator, PromiseImpl) {
81
- function invoke(method, arg, resolve, reject) {
82
- var record = tryCatch(generator[method], generator, arg);
83
- if ("throw" !== record.type) {
84
- var result = record.arg,
85
- value = result.value;
86
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
87
- invoke("next", value, resolve, reject);
88
- }, function (err) {
89
- invoke("throw", err, resolve, reject);
90
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
91
- result.value = unwrapped, resolve(result);
92
- }, function (error) {
93
- return invoke("throw", error, resolve, reject);
221
+ function AsyncIterator(t, e) {
222
+ function invoke(r, o, i, a) {
223
+ var c = tryCatch(t[r], t, o);
224
+ if ("throw" !== c.type) {
225
+ var u = c.arg,
226
+ h = u.value;
227
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
228
+ invoke("next", t, i, a);
229
+ }, function (t) {
230
+ invoke("throw", t, i, a);
231
+ }) : e.resolve(h).then(function (t) {
232
+ u.value = t, i(u);
233
+ }, function (t) {
234
+ return invoke("throw", t, i, a);
94
235
  });
95
236
  }
96
- reject(record.arg);
237
+ a(c.arg);
97
238
  }
98
- var previousPromise;
99
- defineProperty(this, "_invoke", {
100
- value: function (method, arg) {
239
+ var r;
240
+ o(this, "_invoke", {
241
+ value: function (t, n) {
101
242
  function callInvokeWithMethodAndArg() {
102
- return new PromiseImpl(function (resolve, reject) {
103
- invoke(method, arg, resolve, reject);
243
+ return new e(function (e, r) {
244
+ invoke(t, n, e, r);
104
245
  });
105
246
  }
106
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
247
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
107
248
  }
108
249
  });
109
250
  }
110
- function makeInvokeMethod(innerFn, self, context) {
111
- var state = "suspendedStart";
112
- return function (method, arg) {
113
- if ("executing" === state) throw new Error("Generator is already running");
114
- if ("completed" === state) {
115
- if ("throw" === method) throw arg;
116
- return doneResult();
251
+ function makeInvokeMethod(e, r, n) {
252
+ var o = h;
253
+ return function (i, a) {
254
+ if (o === f) throw Error("Generator is already running");
255
+ if (o === s) {
256
+ if ("throw" === i) throw a;
257
+ return {
258
+ value: t,
259
+ done: !0
260
+ };
117
261
  }
118
- for (context.method = method, context.arg = arg;;) {
119
- var delegate = context.delegate;
120
- if (delegate) {
121
- var delegateResult = maybeInvokeDelegate(delegate, context);
122
- if (delegateResult) {
123
- if (delegateResult === ContinueSentinel) continue;
124
- return delegateResult;
262
+ for (n.method = i, n.arg = a;;) {
263
+ var c = n.delegate;
264
+ if (c) {
265
+ var u = maybeInvokeDelegate(c, n);
266
+ if (u) {
267
+ if (u === y) continue;
268
+ return u;
125
269
  }
126
270
  }
127
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
128
- if ("suspendedStart" === state) throw state = "completed", context.arg;
129
- context.dispatchException(context.arg);
130
- } else "return" === context.method && context.abrupt("return", context.arg);
131
- state = "executing";
132
- var record = tryCatch(innerFn, self, context);
133
- if ("normal" === record.type) {
134
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
271
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
272
+ if (o === h) throw o = s, n.arg;
273
+ n.dispatchException(n.arg);
274
+ } else "return" === n.method && n.abrupt("return", n.arg);
275
+ o = f;
276
+ var p = tryCatch(e, r, n);
277
+ if ("normal" === p.type) {
278
+ if (o = n.done ? s : l, p.arg === y) continue;
135
279
  return {
136
- value: record.arg,
137
- done: context.done
280
+ value: p.arg,
281
+ done: n.done
138
282
  };
139
283
  }
140
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
284
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
141
285
  }
142
286
  };
143
287
  }
144
- function maybeInvokeDelegate(delegate, context) {
145
- var methodName = context.method,
146
- method = delegate.iterator[methodName];
147
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
148
- var record = tryCatch(method, delegate.iterator, context.arg);
149
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
150
- var info = record.arg;
151
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
288
+ function maybeInvokeDelegate(e, r) {
289
+ var n = r.method,
290
+ o = e.iterator[n];
291
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
292
+ var i = tryCatch(o, e.iterator, r.arg);
293
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
294
+ var a = i.arg;
295
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
152
296
  }
153
- function pushTryEntry(locs) {
154
- var entry = {
155
- tryLoc: locs[0]
297
+ function pushTryEntry(t) {
298
+ var e = {
299
+ tryLoc: t[0]
156
300
  };
157
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
301
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
158
302
  }
159
- function resetTryEntry(entry) {
160
- var record = entry.completion || {};
161
- record.type = "normal", delete record.arg, entry.completion = record;
303
+ function resetTryEntry(t) {
304
+ var e = t.completion || {};
305
+ e.type = "normal", delete e.arg, t.completion = e;
162
306
  }
163
- function Context(tryLocsList) {
307
+ function Context(t) {
164
308
  this.tryEntries = [{
165
309
  tryLoc: "root"
166
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
310
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
167
311
  }
168
- function values(iterable) {
169
- if (iterable) {
170
- var iteratorMethod = iterable[iteratorSymbol];
171
- if (iteratorMethod) return iteratorMethod.call(iterable);
172
- if ("function" == typeof iterable.next) return iterable;
173
- if (!isNaN(iterable.length)) {
174
- var i = -1,
175
- next = function next() {
176
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
177
- return next.value = undefined, next.done = !0, next;
312
+ function values(e) {
313
+ if (e || "" === e) {
314
+ var r = e[a];
315
+ if (r) return r.call(e);
316
+ if ("function" == typeof e.next) return e;
317
+ if (!isNaN(e.length)) {
318
+ var o = -1,
319
+ i = function next() {
320
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
321
+ return next.value = t, next.done = !0, next;
178
322
  };
179
- return next.next = next;
323
+ return i.next = i;
180
324
  }
181
325
  }
182
- return {
183
- next: doneResult
184
- };
185
- }
186
- function doneResult() {
187
- return {
188
- value: undefined,
189
- done: !0
190
- };
326
+ throw new TypeError(typeof e + " is not iterable");
191
327
  }
192
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
328
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
193
329
  value: GeneratorFunctionPrototype,
194
330
  configurable: !0
195
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
331
+ }), o(GeneratorFunctionPrototype, "constructor", {
196
332
  value: GeneratorFunction,
197
333
  configurable: !0
198
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
199
- var ctor = "function" == typeof genFun && genFun.constructor;
200
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
201
- }, exports.mark = function (genFun) {
202
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
203
- }, exports.awrap = function (arg) {
334
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
335
+ var e = "function" == typeof t && t.constructor;
336
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
337
+ }, e.mark = function (t) {
338
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
339
+ }, e.awrap = function (t) {
204
340
  return {
205
- __await: arg
341
+ __await: t
206
342
  };
207
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
343
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
208
344
  return this;
209
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
210
- void 0 === PromiseImpl && (PromiseImpl = Promise);
211
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
212
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
213
- return result.done ? result.value : iter.next();
345
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
346
+ void 0 === i && (i = Promise);
347
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
348
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
349
+ return t.done ? t.value : a.next();
214
350
  });
215
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
351
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
216
352
  return this;
217
- }), define(Gp, "toString", function () {
353
+ }), define(g, "toString", function () {
218
354
  return "[object Generator]";
219
- }), exports.keys = function (val) {
220
- var object = Object(val),
221
- keys = [];
222
- for (var key in object) keys.push(key);
223
- return keys.reverse(), function next() {
224
- for (; keys.length;) {
225
- var key = keys.pop();
226
- if (key in object) return next.value = key, next.done = !1, next;
355
+ }), e.keys = function (t) {
356
+ var e = Object(t),
357
+ r = [];
358
+ for (var n in e) r.push(n);
359
+ return r.reverse(), function next() {
360
+ for (; r.length;) {
361
+ var t = r.pop();
362
+ if (t in e) return next.value = t, next.done = !1, next;
227
363
  }
228
364
  return next.done = !0, next;
229
365
  };
230
- }, exports.values = values, Context.prototype = {
366
+ }, e.values = values, Context.prototype = {
231
367
  constructor: Context,
232
- reset: function (skipTempReset) {
233
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
368
+ reset: function (e) {
369
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
234
370
  },
235
371
  stop: function () {
236
372
  this.done = !0;
237
- var rootRecord = this.tryEntries[0].completion;
238
- if ("throw" === rootRecord.type) throw rootRecord.arg;
373
+ var t = this.tryEntries[0].completion;
374
+ if ("throw" === t.type) throw t.arg;
239
375
  return this.rval;
240
376
  },
241
- dispatchException: function (exception) {
242
- if (this.done) throw exception;
243
- var context = this;
244
- function handle(loc, caught) {
245
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
377
+ dispatchException: function (e) {
378
+ if (this.done) throw e;
379
+ var r = this;
380
+ function handle(n, o) {
381
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
246
382
  }
247
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
248
- var entry = this.tryEntries[i],
249
- record = entry.completion;
250
- if ("root" === entry.tryLoc) return handle("end");
251
- if (entry.tryLoc <= this.prev) {
252
- var hasCatch = hasOwn.call(entry, "catchLoc"),
253
- hasFinally = hasOwn.call(entry, "finallyLoc");
254
- if (hasCatch && hasFinally) {
255
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
256
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
257
- } else if (hasCatch) {
258
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
383
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
384
+ var i = this.tryEntries[o],
385
+ a = i.completion;
386
+ if ("root" === i.tryLoc) return handle("end");
387
+ if (i.tryLoc <= this.prev) {
388
+ var c = n.call(i, "catchLoc"),
389
+ u = n.call(i, "finallyLoc");
390
+ if (c && u) {
391
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
392
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
393
+ } else if (c) {
394
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
259
395
  } else {
260
- if (!hasFinally) throw new Error("try statement without catch or finally");
261
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
396
+ if (!u) throw Error("try statement without catch or finally");
397
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
262
398
  }
263
399
  }
264
400
  }
265
401
  },
266
- abrupt: function (type, arg) {
267
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
268
- var entry = this.tryEntries[i];
269
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
270
- var finallyEntry = entry;
402
+ abrupt: function (t, e) {
403
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
404
+ var o = this.tryEntries[r];
405
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
406
+ var i = o;
271
407
  break;
272
408
  }
273
409
  }
274
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
275
- var record = finallyEntry ? finallyEntry.completion : {};
276
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
410
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
411
+ var a = i ? i.completion : {};
412
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
277
413
  },
278
- complete: function (record, afterLoc) {
279
- if ("throw" === record.type) throw record.arg;
280
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
414
+ complete: function (t, e) {
415
+ if ("throw" === t.type) throw t.arg;
416
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
281
417
  },
282
- finish: function (finallyLoc) {
283
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
284
- var entry = this.tryEntries[i];
285
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
418
+ finish: function (t) {
419
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
420
+ var r = this.tryEntries[e];
421
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
286
422
  }
287
423
  },
288
- catch: function (tryLoc) {
289
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
290
- var entry = this.tryEntries[i];
291
- if (entry.tryLoc === tryLoc) {
292
- var record = entry.completion;
293
- if ("throw" === record.type) {
294
- var thrown = record.arg;
295
- resetTryEntry(entry);
424
+ catch: function (t) {
425
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
426
+ var r = this.tryEntries[e];
427
+ if (r.tryLoc === t) {
428
+ var n = r.completion;
429
+ if ("throw" === n.type) {
430
+ var o = n.arg;
431
+ resetTryEntry(r);
296
432
  }
297
- return thrown;
433
+ return o;
298
434
  }
299
435
  }
300
- throw new Error("illegal catch attempt");
436
+ throw Error("illegal catch attempt");
301
437
  },
302
- delegateYield: function (iterable, resultName, nextLoc) {
438
+ delegateYield: function (e, r, n) {
303
439
  return this.delegate = {
304
- iterator: values(iterable),
305
- resultName: resultName,
306
- nextLoc: nextLoc
307
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
440
+ iterator: values(e),
441
+ resultName: r,
442
+ nextLoc: n
443
+ }, "next" === this.method && (this.arg = t), y;
308
444
  }
309
- }, exports;
445
+ }, e;
310
446
  }
311
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
312
- try {
313
- var info = gen[key](arg);
314
- var value = info.value;
315
- } catch (error) {
316
- reject(error);
317
- return;
318
- }
319
- if (info.done) {
320
- resolve(value);
321
- } else {
322
- Promise.resolve(value).then(_next, _throw);
447
+ function _setPrototypeOf(t, e) {
448
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
449
+ return t.__proto__ = e, t;
450
+ }, _setPrototypeOf(t, e);
451
+ }
452
+ function _unsupportedIterableToArray(r, a) {
453
+ if (r) {
454
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
455
+ var t = {}.toString.call(r).slice(8, -1);
456
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
323
457
  }
324
458
  }
325
- function _asyncToGenerator(fn) {
459
+ function _wrapAsyncGenerator(e) {
326
460
  return function () {
327
- var self = this,
328
- args = arguments;
329
- return new Promise(function (resolve, reject) {
330
- var gen = fn.apply(self, args);
331
- function _next(value) {
332
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
333
- }
334
- function _throw(err) {
335
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
336
- }
337
- _next(undefined);
338
- });
461
+ return new AsyncGenerator(e.apply(this, arguments));
339
462
  };
340
463
  }
341
- function _extends() {
342
- _extends = Object.assign ? Object.assign.bind() : function (target) {
343
- for (var i = 1; i < arguments.length; i++) {
344
- var source = arguments[i];
345
- for (var key in source) {
346
- if (Object.prototype.hasOwnProperty.call(source, key)) {
347
- target[key] = source[key];
464
+ function AsyncGenerator(e) {
465
+ var r, t;
466
+ function resume(r, t) {
467
+ try {
468
+ var n = e[r](t),
469
+ o = n.value,
470
+ u = o instanceof _OverloadYield;
471
+ Promise.resolve(u ? o.v : o).then(function (t) {
472
+ if (u) {
473
+ var i = "return" === r ? "return" : "next";
474
+ if (!o.k || t.done) return resume(i, t);
475
+ t = e[i](t).value;
348
476
  }
349
- }
477
+ settle(n.done ? "return" : "normal", t);
478
+ }, function (e) {
479
+ resume("throw", e);
480
+ });
481
+ } catch (e) {
482
+ settle("throw", e);
350
483
  }
351
- return target;
352
- };
353
- return _extends.apply(this, arguments);
354
- }
355
- function _inheritsLoose(subClass, superClass) {
356
- subClass.prototype = Object.create(superClass.prototype);
357
- subClass.prototype.constructor = subClass;
358
- _setPrototypeOf(subClass, superClass);
359
- }
360
- function _getPrototypeOf(o) {
361
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
362
- return o.__proto__ || Object.getPrototypeOf(o);
363
- };
364
- return _getPrototypeOf(o);
365
- }
366
- function _setPrototypeOf(o, p) {
367
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
368
- o.__proto__ = p;
369
- return o;
370
- };
371
- return _setPrototypeOf(o, p);
372
- }
373
- function _isNativeReflectConstruct() {
374
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
375
- if (Reflect.construct.sham) return false;
376
- if (typeof Proxy === "function") return true;
377
- try {
378
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
379
- return true;
380
- } catch (e) {
381
- return false;
382
484
  }
383
- }
384
- function _construct(Parent, args, Class) {
385
- if (_isNativeReflectConstruct()) {
386
- _construct = Reflect.construct.bind();
387
- } else {
388
- _construct = function _construct(Parent, args, Class) {
389
- var a = [null];
390
- a.push.apply(a, args);
391
- var Constructor = Function.bind.apply(Parent, a);
392
- var instance = new Constructor();
393
- if (Class) _setPrototypeOf(instance, Class.prototype);
394
- return instance;
395
- };
485
+ function settle(e, n) {
486
+ switch (e) {
487
+ case "return":
488
+ r.resolve({
489
+ value: n,
490
+ done: !0
491
+ });
492
+ break;
493
+ case "throw":
494
+ r.reject(n);
495
+ break;
496
+ default:
497
+ r.resolve({
498
+ value: n,
499
+ done: !1
500
+ });
501
+ }
502
+ (r = r.next) ? resume(r.key, r.arg) : t = null;
396
503
  }
397
- return _construct.apply(null, arguments);
398
- }
399
- function _isNativeFunction(fn) {
400
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
504
+ this._invoke = function (e, n) {
505
+ return new Promise(function (o, u) {
506
+ var i = {
507
+ key: e,
508
+ arg: n,
509
+ resolve: o,
510
+ reject: u,
511
+ next: null
512
+ };
513
+ t ? t = t.next = i : (r = t = i, resume(e, n));
514
+ });
515
+ }, "function" != typeof e.return && (this.return = void 0);
401
516
  }
402
- function _wrapNativeSuper(Class) {
403
- var _cache = typeof Map === "function" ? new Map() : undefined;
404
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
405
- if (Class === null || !_isNativeFunction(Class)) return Class;
406
- if (typeof Class !== "function") {
407
- throw new TypeError("Super expression must either be null or a function");
408
- }
409
- if (typeof _cache !== "undefined") {
410
- if (_cache.has(Class)) return _cache.get(Class);
411
- _cache.set(Class, Wrapper);
517
+ AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
518
+ return this;
519
+ }, AsyncGenerator.prototype.next = function (e) {
520
+ return this._invoke("next", e);
521
+ }, AsyncGenerator.prototype.throw = function (e) {
522
+ return this._invoke("throw", e);
523
+ }, AsyncGenerator.prototype.return = function (e) {
524
+ return this._invoke("return", e);
525
+ };
526
+ function _wrapNativeSuper(t) {
527
+ var r = "function" == typeof Map ? new Map() : void 0;
528
+ return _wrapNativeSuper = function (t) {
529
+ if (null === t || !_isNativeFunction(t)) return t;
530
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
531
+ if (void 0 !== r) {
532
+ if (r.has(t)) return r.get(t);
533
+ r.set(t, Wrapper);
412
534
  }
413
535
  function Wrapper() {
414
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
536
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
415
537
  }
416
- Wrapper.prototype = Object.create(Class.prototype, {
538
+ return Wrapper.prototype = Object.create(t.prototype, {
417
539
  constructor: {
418
540
  value: Wrapper,
419
- enumerable: false,
420
- writable: true,
421
- configurable: true
541
+ enumerable: !1,
542
+ writable: !0,
543
+ configurable: !0
422
544
  }
423
- });
424
- return _setPrototypeOf(Wrapper, Class);
425
- };
426
- return _wrapNativeSuper(Class);
427
- }
428
- function _assertThisInitialized(self) {
429
- if (self === void 0) {
430
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
431
- }
432
- return self;
433
- }
434
- function _unsupportedIterableToArray(o, minLen) {
435
- if (!o) return;
436
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
437
- var n = Object.prototype.toString.call(o).slice(8, -1);
438
- if (n === "Object" && o.constructor) n = o.constructor.name;
439
- if (n === "Map" || n === "Set") return Array.from(o);
440
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
441
- }
442
- function _arrayLikeToArray(arr, len) {
443
- if (len == null || len > arr.length) len = arr.length;
444
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
445
- return arr2;
446
- }
447
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
448
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
449
- if (it) return (it = it.call(o)).next.bind(it);
450
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
451
- if (it) o = it;
452
- var i = 0;
453
- return function () {
454
- if (i >= o.length) return {
455
- done: true
456
- };
457
- return {
458
- done: false,
459
- value: o[i++]
460
- };
461
- };
462
- }
463
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
545
+ }), _setPrototypeOf(Wrapper, t);
546
+ }, _wrapNativeSuper(t);
464
547
  }
465
548
 
466
549
  /** @ignore */
@@ -587,20 +670,20 @@ var Dstore = /*#__PURE__*/function () {
587
670
  assertIsObject(ret, 'entity[Datastore.KEY]/entity._keyStr', "Entity is missing the datastore Key: " + JSON.stringify(ent));
588
671
  return ret;
589
672
  }
590
- /** `fixKeys()` is called for all [[IDstoreEntry]]sa returned from [[Dstore]].
673
+ /** `fixKeys()` is called for all [[IDstoreEntry]] returned from [[Dstore]].
591
674
  *
592
675
  * Is ensures that besides `entity[Datastore.KEY]` there is `_keyStr` to be leveraged by [[readKey]].
593
676
  *
594
677
  * @internal
595
678
  */;
596
679
  _proto.fixKeys = function fixKeys(entities) {
597
- var _this = this;
680
+ var _this2 = this;
598
681
  entities.forEach(function (x) {
599
682
  if (!!(x != null && x[Datastore.KEY]) && x[Datastore.KEY]) {
600
683
  assertIsDefined(x[Datastore.KEY]);
601
684
  assertIsObject(x[Datastore.KEY]);
602
685
  // Old TypesScript has problems with symbols as a property
603
- x._keyStr = _this.keySerialize(x[Datastore.KEY]);
686
+ x._keyStr = _this2.keySerialize(x[Datastore.KEY]);
604
687
  }
605
688
  });
606
689
  return entities;
@@ -622,7 +705,7 @@ var Dstore = /*#__PURE__*/function () {
622
705
  _proto.get =
623
706
  /*#__PURE__*/
624
707
  function () {
625
- var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key) {
708
+ var _get = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(key) {
626
709
  var result;
627
710
  return _regeneratorRuntime().wrap(function _callee$(_context) {
628
711
  while (1) switch (_context.prev = _context.next) {
@@ -667,7 +750,7 @@ var Dstore = /*#__PURE__*/function () {
667
750
  _proto.getMulti =
668
751
  /*#__PURE__*/
669
752
  function () {
670
- var _getMulti = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(keys) {
753
+ var _getMulti = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(keys) {
671
754
  var results, metricEnd, _yield$this$getDoT$ge, entities, entitiesByKey;
672
755
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
673
756
  while (1) switch (_context2.prev = _context2.next) {
@@ -764,7 +847,7 @@ var Dstore = /*#__PURE__*/function () {
764
847
  _proto.set =
765
848
  /*#__PURE__*/
766
849
  function () {
767
- var _set = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, data) {
850
+ var _set = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, data) {
768
851
  var saveEntity;
769
852
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
770
853
  while (1) switch (_context3.prev = _context3.next) {
@@ -829,8 +912,8 @@ var Dstore = /*#__PURE__*/function () {
829
912
  _proto.save =
830
913
  /*#__PURE__*/
831
914
  function () {
832
- var _save = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(entities) {
833
- var ret, metricEnd, _iterator, _step, e, _iterator2, _step2, _e;
915
+ var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(entities) {
916
+ var ret, metricEnd, _iterator2, _step2, e, _iterator3, _step3, _e;
834
917
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
835
918
  while (1) switch (_context4.prev = _context4.next) {
836
919
  case 0:
@@ -839,8 +922,8 @@ var Dstore = /*#__PURE__*/function () {
839
922
  _context4.prev = 2;
840
923
  // Within Transaction we don't get any answer here!
841
924
  // [ { mutationResults: [ [Object], [Object] ], indexUpdates: 51 } ]
842
- for (_iterator = _createForOfIteratorHelperLoose(entities); !(_step = _iterator()).done;) {
843
- e = _step.value;
925
+ for (_iterator2 = _createForOfIteratorHelperLoose(entities); !(_step2 = _iterator2()).done;) {
926
+ e = _step2.value;
844
927
  assertIsObject(e.key);
845
928
  assertIsObject(e.data);
846
929
  this.fixKeys([e.data]);
@@ -860,8 +943,8 @@ var Dstore = /*#__PURE__*/function () {
860
943
  _context4.t0 = undefined;
861
944
  case 9:
862
945
  ret = _context4.t0;
863
- for (_iterator2 = _createForOfIteratorHelperLoose(entities); !(_step2 = _iterator2()).done;) {
864
- _e = _step2.value;
946
+ for (_iterator3 = _createForOfIteratorHelperLoose(entities); !(_step3 = _iterator3()).done;) {
947
+ _e = _step3.value;
865
948
  _e.data[Datastore.KEY] = _e.key;
866
949
  this.fixKeys([_e.data]);
867
950
  }
@@ -918,7 +1001,7 @@ var Dstore = /*#__PURE__*/function () {
918
1001
  _proto.insert =
919
1002
  /*#__PURE__*/
920
1003
  function () {
921
- var _insert = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(entities) {
1004
+ var _insert = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(entities) {
922
1005
  var ret, metricEnd;
923
1006
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
924
1007
  while (1) switch (_context5.prev = _context5.next) {
@@ -990,7 +1073,7 @@ var Dstore = /*#__PURE__*/function () {
990
1073
  _proto.update =
991
1074
  /*#__PURE__*/
992
1075
  function () {
993
- var _update = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(entities) {
1076
+ var _update = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(entities) {
994
1077
  var ret, metricEnd;
995
1078
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
996
1079
  while (1) switch (_context6.prev = _context6.next) {
@@ -1064,7 +1147,7 @@ var Dstore = /*#__PURE__*/function () {
1064
1147
  _proto["delete"] =
1065
1148
  /*#__PURE__*/
1066
1149
  function () {
1067
- var _delete2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(keys) {
1150
+ var _delete2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(keys) {
1068
1151
  var ret, metricEnd;
1069
1152
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1070
1153
  while (1) switch (_context7.prev = _context7.next) {
@@ -1137,7 +1220,7 @@ var Dstore = /*#__PURE__*/function () {
1137
1220
  }
1138
1221
  };
1139
1222
  _proto.runQuery = /*#__PURE__*/function () {
1140
- var _runQuery = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(query) {
1223
+ var _runQuery = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(query) {
1141
1224
  var ret, metricEnd, _yield$this$getDoT$ru, entities, info;
1142
1225
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1143
1226
  while (1) switch (_context8.prev = _context8.next) {
@@ -1189,14 +1272,15 @@ var Dstore = /*#__PURE__*/function () {
1189
1272
  * @param selection selectionList of [[Query]] select() calls.
1190
1273
  * @param cursor unsupported so far.
1191
1274
  *
1275
+ * @throws [[DstoreError]]
1192
1276
  * @category Datastore Drop-In
1193
1277
  */
1194
1278
  ;
1195
1279
  _proto.query =
1196
1280
  /*#__PURE__*/
1197
1281
  function () {
1198
- var _query = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(kindName, filters, limit, ordering, selection, cursor) {
1199
- var q, _iterator3, _step3, filterSpec, _iterator4, _step4, orderField;
1282
+ var _query = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(kindName, filters, limit, ordering, selection, cursor) {
1283
+ var q, _iterator4, _step4, filterSpec, _iterator5, _step5, orderField;
1200
1284
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1201
1285
  while (1) switch (_context9.prev = _context9.next) {
1202
1286
  case 0:
@@ -1217,14 +1301,14 @@ var Dstore = /*#__PURE__*/function () {
1217
1301
  assertIsNumber(limit);
1218
1302
  _context9.prev = 7;
1219
1303
  q = this.createQuery(kindName);
1220
- for (_iterator3 = _createForOfIteratorHelperLoose(filters); !(_step3 = _iterator3()).done;) {
1221
- filterSpec = _step3.value;
1304
+ for (_iterator4 = _createForOfIteratorHelperLoose(filters); !(_step4 = _iterator4()).done;) {
1305
+ filterSpec = _step4.value;
1222
1306
  assertIsObject(filterSpec);
1223
1307
  // @ts-ignore
1224
1308
  q.filter(_construct(PropertyFilter, filterSpec));
1225
1309
  }
1226
- for (_iterator4 = _createForOfIteratorHelperLoose(ordering); !(_step4 = _iterator4()).done;) {
1227
- orderField = _step4.value;
1310
+ for (_iterator5 = _createForOfIteratorHelperLoose(ordering); !(_step5 = _iterator5()).done;) {
1311
+ orderField = _step5.value;
1228
1312
  q.order(orderField);
1229
1313
  }
1230
1314
  if (limit > 0) {
@@ -1260,6 +1344,128 @@ var Dstore = /*#__PURE__*/function () {
1260
1344
  }
1261
1345
  return query;
1262
1346
  }()
1347
+ /** `iterate()` is a modernized version of `query()`.
1348
+ *
1349
+ * It takes a Parameter object and returns an AsyncIterable.
1350
+ * Entities returned have been processed by `fixKeys()`.
1351
+ *
1352
+ * @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) ("Table") which should be searched.
1353
+ * @param filters List of [[Query]] filter() calls.
1354
+ * @param limit Maximum Number of Results to return.
1355
+ * @param ordering List of [[Query]] order() calls.
1356
+ * @param selection selectionList of [[Query]] select() calls.
1357
+ *
1358
+ * @category Additional
1359
+ */
1360
+ ;
1361
+ _proto.iterate = function iterate(_ref) {
1362
+ var _this = this;
1363
+ var kindName = _ref.kindName,
1364
+ _ref$filters = _ref.filters,
1365
+ filters = _ref$filters === void 0 ? [] : _ref$filters,
1366
+ _ref$limit = _ref.limit,
1367
+ limit = _ref$limit === void 0 ? 2500 : _ref$limit,
1368
+ _ref$ordering = _ref.ordering,
1369
+ ordering = _ref$ordering === void 0 ? [] : _ref$ordering,
1370
+ _ref$selection = _ref.selection,
1371
+ selection = _ref$selection === void 0 ? [] : _ref$selection;
1372
+ return _wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1373
+ var q, _iterator6, _step6, filterSpec, _iterator7, _step7, orderField, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _entity, ret;
1374
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1375
+ while (1) switch (_context10.prev = _context10.next) {
1376
+ case 0:
1377
+ assertIsString(kindName);
1378
+ assertIsArray(filters);
1379
+ assertIsNumber(limit);
1380
+ _context10.prev = 3;
1381
+ q = _this.getDoT().createQuery(kindName);
1382
+ for (_iterator6 = _createForOfIteratorHelperLoose(filters); !(_step6 = _iterator6()).done;) {
1383
+ filterSpec = _step6.value;
1384
+ assertIsObject(filterSpec);
1385
+ // @ts-ignore
1386
+ q.filter(_construct(PropertyFilter, filterSpec));
1387
+ }
1388
+ for (_iterator7 = _createForOfIteratorHelperLoose(ordering); !(_step7 = _iterator7()).done;) {
1389
+ orderField = _step7.value;
1390
+ q.order(orderField);
1391
+ }
1392
+ if (limit > 0) {
1393
+ q.limit(limit);
1394
+ }
1395
+ if (selection.length > 0) {
1396
+ q.select(selection);
1397
+ }
1398
+ _iteratorAbruptCompletion = false;
1399
+ _didIteratorError = false;
1400
+ _context10.prev = 11;
1401
+ _iterator = _asyncIterator(_this.getDoT().runStream(q));
1402
+ case 13:
1403
+ _context10.next = 15;
1404
+ return _awaitAsyncGenerator(_iterator.next());
1405
+ case 15:
1406
+ if (!(_iteratorAbruptCompletion = !(_step = _context10.sent).done)) {
1407
+ _context10.next = 24;
1408
+ break;
1409
+ }
1410
+ _entity = _step.value;
1411
+ ret = _this.fixKeys([_entity])[0];
1412
+ assertIsDefined(ret, 'datastore.iterate: entity is undefined');
1413
+ _context10.next = 21;
1414
+ return ret;
1415
+ case 21:
1416
+ _iteratorAbruptCompletion = false;
1417
+ _context10.next = 13;
1418
+ break;
1419
+ case 24:
1420
+ _context10.next = 30;
1421
+ break;
1422
+ case 26:
1423
+ _context10.prev = 26;
1424
+ _context10.t0 = _context10["catch"](11);
1425
+ _didIteratorError = true;
1426
+ _iteratorError = _context10.t0;
1427
+ case 30:
1428
+ _context10.prev = 30;
1429
+ _context10.prev = 31;
1430
+ if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
1431
+ _context10.next = 35;
1432
+ break;
1433
+ }
1434
+ _context10.next = 35;
1435
+ return _awaitAsyncGenerator(_iterator["return"]());
1436
+ case 35:
1437
+ _context10.prev = 35;
1438
+ if (!_didIteratorError) {
1439
+ _context10.next = 38;
1440
+ break;
1441
+ }
1442
+ throw _iteratorError;
1443
+ case 38:
1444
+ return _context10.finish(35);
1445
+ case 39:
1446
+ return _context10.finish(30);
1447
+ case 40:
1448
+ _context10.next = 47;
1449
+ break;
1450
+ case 42:
1451
+ _context10.prev = 42;
1452
+ _context10.t1 = _context10["catch"](3);
1453
+ _context10.next = 46;
1454
+ return _awaitAsyncGenerator(setImmediate());
1455
+ case 46:
1456
+ throw new DstoreError('datastore.query error', _context10.t1, {
1457
+ kindName: kindName,
1458
+ filters: filters,
1459
+ limit: limit,
1460
+ ordering: ordering
1461
+ });
1462
+ case 47:
1463
+ case "end":
1464
+ return _context10.stop();
1465
+ }
1466
+ }, _callee10, null, [[3, 42], [11, 26, 30, 40], [31,, 35, 39]]);
1467
+ }))();
1468
+ }
1263
1469
  /** Allocate one ID in the Datastore.
1264
1470
  *
1265
1471
  * Currently (late 2021) there is no documentation provided by Google for the underlying node function.
@@ -1270,31 +1476,30 @@ var Dstore = /*#__PURE__*/function () {
1270
1476
  * The ID is a string encoded large number. This function will never return the same ID twice for any given Datastore.
1271
1477
  * If you provide a kindName the ID will be namespaced to this kind.
1272
1478
  * In fact the generated ID is namespaced via an incomplete [[Key]] of the given Kind.
1273
- */
1274
- ;
1479
+ */;
1275
1480
  _proto.allocateOneId =
1276
1481
  /*#__PURE__*/
1277
1482
  function () {
1278
- var _allocateOneId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(kindName) {
1483
+ var _allocateOneId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(kindName) {
1279
1484
  var ret;
1280
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1281
- while (1) switch (_context10.prev = _context10.next) {
1485
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1486
+ while (1) switch (_context11.prev = _context11.next) {
1282
1487
  case 0:
1283
1488
  if (kindName === void 0) {
1284
1489
  kindName = 'Numbering';
1285
1490
  }
1286
1491
  assertIsString(kindName);
1287
- _context10.next = 4;
1492
+ _context11.next = 4;
1288
1493
  return this.datastore.allocateIds(this.key([kindName]), 1);
1289
1494
  case 4:
1290
- ret = _context10.sent[0][0].id;
1495
+ ret = _context11.sent[0][0].id;
1291
1496
  assertIsString(ret);
1292
- return _context10.abrupt("return", ret);
1497
+ return _context11.abrupt("return", ret);
1293
1498
  case 7:
1294
1499
  case "end":
1295
- return _context10.stop();
1500
+ return _context11.stop();
1296
1501
  }
1297
- }, _callee10, this);
1502
+ }, _callee11, this);
1298
1503
  }));
1299
1504
  function allocateOneId(_x16) {
1300
1505
  return _allocateOneId.apply(this, arguments);
@@ -1313,72 +1518,72 @@ var Dstore = /*#__PURE__*/function () {
1313
1518
  _proto.runInTransaction =
1314
1519
  /*#__PURE__*/
1315
1520
  function () {
1316
- var _runInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(func) {
1521
+ var _runInTransaction = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(func) {
1317
1522
  var ret, transaction;
1318
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1319
- while (1) switch (_context12.prev = _context12.next) {
1523
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1524
+ while (1) switch (_context13.prev = _context13.next) {
1320
1525
  case 0:
1321
1526
  transaction = this.datastore.transaction();
1322
- _context12.next = 3;
1323
- return transactionAsyncLocalStorage.run(transaction, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
1527
+ _context13.next = 3;
1528
+ return transactionAsyncLocalStorage.run(transaction, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1324
1529
  var _yield$transaction$ru, transactionInfo, transactionRunApiResponse, commitApiResponse, rollbackInfo;
1325
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1326
- while (1) switch (_context11.prev = _context11.next) {
1530
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1531
+ while (1) switch (_context12.prev = _context12.next) {
1327
1532
  case 0:
1328
- _context11.next = 2;
1533
+ _context12.next = 2;
1329
1534
  return transaction.run();
1330
1535
  case 2:
1331
- _yield$transaction$ru = _context11.sent;
1536
+ _yield$transaction$ru = _context12.sent;
1332
1537
  transactionInfo = _yield$transaction$ru[0];
1333
1538
  transactionRunApiResponse = _yield$transaction$ru[1];
1334
- _context11.prev = 5;
1335
- _context11.next = 8;
1539
+ _context12.prev = 5;
1540
+ _context12.next = 8;
1336
1541
  return func();
1337
1542
  case 8:
1338
- ret = _context11.sent;
1339
- _context11.next = 20;
1543
+ ret = _context12.sent;
1544
+ _context12.next = 20;
1340
1545
  break;
1341
1546
  case 11:
1342
- _context11.prev = 11;
1343
- _context11.t0 = _context11["catch"](5);
1344
- _context11.next = 15;
1547
+ _context12.prev = 11;
1548
+ _context12.t0 = _context12["catch"](5);
1549
+ _context12.next = 15;
1345
1550
  return transaction.rollback();
1346
1551
  case 15:
1347
- rollbackInfo = _context11.sent;
1348
- debug('Transaction failed, rollback initiated: %O %O %O %O', transactionInfo, transactionRunApiResponse, rollbackInfo, _context11.t0);
1349
- _context11.next = 19;
1552
+ rollbackInfo = _context12.sent;
1553
+ debug('Transaction failed, rollback initiated: %O %O %O %O', transactionInfo, transactionRunApiResponse, rollbackInfo, _context12.t0);
1554
+ _context12.next = 19;
1350
1555
  return setImmediate();
1351
1556
  case 19:
1352
- throw new DstoreError('datastore.transaction execution error', _context11.t0);
1557
+ throw new DstoreError('datastore.transaction execution error', _context12.t0);
1353
1558
  case 20:
1354
- _context11.prev = 20;
1355
- _context11.next = 23;
1559
+ _context12.prev = 20;
1560
+ _context12.next = 23;
1356
1561
  return transaction.commit();
1357
1562
  case 23:
1358
- commitApiResponse = _context11.sent[0];
1359
- _context11.next = 32;
1563
+ commitApiResponse = _context12.sent[0];
1564
+ _context12.next = 32;
1360
1565
  break;
1361
1566
  case 26:
1362
- _context11.prev = 26;
1363
- _context11.t1 = _context11["catch"](20);
1364
- debug('Transaction commit failed: %O %O %O %O ret: %O', transactionInfo, transactionRunApiResponse, commitApiResponse, _context11.t1, ret);
1365
- _context11.next = 31;
1567
+ _context12.prev = 26;
1568
+ _context12.t1 = _context12["catch"](20);
1569
+ debug('Transaction commit failed: %O %O %O %O ret: %O', transactionInfo, transactionRunApiResponse, commitApiResponse, _context12.t1, ret);
1570
+ _context12.next = 31;
1366
1571
  return setImmediate();
1367
1572
  case 31:
1368
- throw new DstoreError('datastore.transaction execution error', _context11.t1);
1573
+ throw new DstoreError('datastore.transaction execution error', _context12.t1);
1369
1574
  case 32:
1370
1575
  case "end":
1371
- return _context11.stop();
1576
+ return _context12.stop();
1372
1577
  }
1373
- }, _callee11, null, [[5, 11], [20, 26]]);
1578
+ }, _callee12, null, [[5, 11], [20, 26]]);
1374
1579
  })));
1375
1580
  case 3:
1376
- return _context12.abrupt("return", ret);
1581
+ return _context13.abrupt("return", ret);
1377
1582
  case 4:
1378
1583
  case "end":
1379
- return _context12.stop();
1584
+ return _context13.stop();
1380
1585
  }
1381
- }, _callee12, this);
1586
+ }, _callee13, this);
1382
1587
  }));
1383
1588
  function runInTransaction(_x17) {
1384
1589
  return _runInTransaction.apply(this, arguments);
@@ -1388,29 +1593,29 @@ var Dstore = /*#__PURE__*/function () {
1388
1593
  return Dstore;
1389
1594
  }();
1390
1595
  var DstoreError = /*#__PURE__*/function (_Error) {
1391
- _inheritsLoose(DstoreError, _Error);
1392
1596
  function DstoreError(message, originalError, extensions) {
1393
- var _this2$stack, _originalError$stack, _originalError$stack$, _originalError$stack$2, _this2$stack2, _this2$stack2$split, _this2$stack2$split$s;
1394
- var _this2;
1395
- _this2 = _Error.call(this, message + ": " + (originalError == null ? void 0 : originalError.message)) || this;
1597
+ var _this3$stack, _originalError$stack, _this3$stack2;
1598
+ var _this3;
1599
+ _this3 = _Error.call(this, message + ": " + (originalError == null ? void 0 : originalError.message)) || this;
1396
1600
  // if no name provided, use the default. defineProperty ensures that it stays non-enumerable
1397
- _this2.extensions = void 0;
1398
- _this2.originalError = void 0;
1399
- if (!_this2.name) {
1400
- Object.defineProperty(_assertThisInitialized(_this2), 'name', {
1601
+ _this3.extensions = void 0;
1602
+ _this3.originalError = void 0;
1603
+ if (!_this3.name) {
1604
+ Object.defineProperty(_this3, 'name', {
1401
1605
  value: 'DstoreError'
1402
1606
  });
1403
1607
  }
1404
1608
  // metadata: Metadata { internalRepr: Map(0) {}, options: {} },
1405
- _this2.originalError = originalError;
1406
- _this2.extensions = _extends({}, extensions);
1407
- _this2.stack = (((_this2$stack = _this2.stack) == null ? void 0 : _this2$stack.split('\n')[0]) || '') + '\n' + ((originalError == null ? void 0 : (_originalError$stack = originalError.stack) == null ? void 0 : (_originalError$stack$ = _originalError$stack.split('\n')) == null ? void 0 : (_originalError$stack$2 = _originalError$stack$.slice(1)) == null ? void 0 : _originalError$stack$2.join('\n')) || '') + '\n' + (((_this2$stack2 = _this2.stack) == null ? void 0 : (_this2$stack2$split = _this2$stack2.split('\n')) == null ? void 0 : (_this2$stack2$split$s = _this2$stack2$split.slice(1)) == null ? void 0 : _this2$stack2$split$s.join('\n')) || '');
1609
+ _this3.originalError = originalError;
1610
+ _this3.extensions = _extends({}, extensions);
1611
+ _this3.stack = (((_this3$stack = _this3.stack) == null ? void 0 : _this3$stack.split('\n')[0]) || '') + '\n' + ((originalError == null || (_originalError$stack = originalError.stack) == null || (_originalError$stack = _originalError$stack.split('\n')) == null || (_originalError$stack = _originalError$stack.slice(1)) == null ? void 0 : _originalError$stack.join('\n')) || '') + '\n' + (((_this3$stack2 = _this3.stack) == null || (_this3$stack2 = _this3$stack2.split('\n')) == null || (_this3$stack2 = _this3$stack2.slice(1)) == null ? void 0 : _this3$stack2.join('\n')) || '');
1408
1612
  // These are usually present on Datastore Errors
1409
1613
  // logger.error({ err: originalError, extensions }, message);
1410
- return _this2;
1614
+ return _this3;
1411
1615
  }
1616
+ _inheritsLoose(DstoreError, _Error);
1412
1617
  return DstoreError;
1413
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1618
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
1414
1619
 
1415
1620
  /*
1416
1621
  * assert.ts