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