datastore-api 6.1.0 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,460 +10,572 @@ 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;
548
+ }), _setPrototypeOf(Wrapper, t);
549
+ }, _wrapNativeSuper(t);
449
550
  }
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.");
551
+
552
+ /*
553
+ * assert.ts
554
+ *
555
+ * Created by Dr. Maximillian Dornseif 2025-04-11 in datastore-api 6.0.1
556
+ */
557
+ /**
558
+ * Generates an type assertion message for the given `value`
559
+ *
560
+ * @param value value being type-checked
561
+ * @param type the expected value as a string; eg 'string', 'boolean', 'number'
562
+ * @param variableName the name of the variable being type-checked
563
+ * @param additionalMessage further information on failure
564
+ */
565
+ var AssertionMessage = function AssertionMessage(value, type, variableName, additionalMessage) {
566
+ var message = variableName ? variableName + " must be of type '" + type + "', '" + assertateDebug.getType(value) + "' provided" : "expected value of type '" + type + "', '" + assertateDebug.getType(value) + "' provided";
567
+ return additionalMessage ? message + ": " + additionalMessage : message;
568
+ };
569
+ /**
570
+ * Type-checks the provided `value` to be a symbol, throws an Error if it is not
571
+ *
572
+ * @param value the value to type-check as a symbol
573
+ * @param variableName the name of the variable to be type-checked
574
+ * @param additionalMessage further information on failure
575
+ * @throws {Error}
576
+ */
577
+ function assertIsKey(value, variableName, additionalMessage) {
578
+ assertateDebug.assert(datastore.Datastore.isKey(value), AssertionMessage(value, "Key", variableName, additionalMessage));
467
579
  }
468
580
 
469
581
  /** @ignore */
@@ -590,24 +702,49 @@ var Dstore = /*#__PURE__*/function () {
590
702
  assertateDebug.assertIsObject(ret, 'entity[Datastore.KEY]/entity._keyStr', "Entity is missing the datastore Key: " + JSON.stringify(ent));
591
703
  return ret;
592
704
  }
593
- /** `fixKeys()` is called for all [[IDstoreEntry]]sa returned from [[Dstore]].
705
+ /** `fixKeys()` is called for all [[IDstoreEntry]] returned from [[Dstore]].
594
706
  *
595
707
  * Is ensures that besides `entity[Datastore.KEY]` there is `_keyStr` to be leveraged by [[readKey]].
596
708
  *
597
709
  * @internal
598
710
  */;
599
711
  _proto.fixKeys = function fixKeys(entities) {
600
- var _this = this;
712
+ var _this2 = this;
601
713
  entities.forEach(function (x) {
602
714
  if (!!(x != null && x[datastore.Datastore.KEY]) && x[datastore.Datastore.KEY]) {
603
715
  assertateDebug.assertIsDefined(x[datastore.Datastore.KEY]);
604
716
  assertateDebug.assertIsObject(x[datastore.Datastore.KEY]);
605
717
  // Old TypesScript has problems with symbols as a property
606
- x._keyStr = _this.keySerialize(x[datastore.Datastore.KEY]);
718
+ x._keyStr = _this2.keySerialize(x[datastore.Datastore.KEY]);
607
719
  }
608
720
  });
609
721
  return entities;
610
722
  }
723
+ /** this is for save, insert, update and upsert and ensures _kkeyStr() handling.
724
+ *
725
+ */;
726
+ _proto.prepareEntitiesForDatastore = function prepareEntitiesForDatastore(entities) {
727
+ for (var _iterator2 = _createForOfIteratorHelperLoose(entities), _step2; !(_step2 = _iterator2()).done;) {
728
+ var e = _step2.value;
729
+ assertateDebug.assertIsObject(e.key);
730
+ assertateDebug.assertIsObject(e.data);
731
+ this.fixKeys([e.data]);
732
+ e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;
733
+ e.data = _extends({}, e.data, {
734
+ _keyStr: undefined
735
+ });
736
+ }
737
+ }
738
+ /** this is for save, insert, update and upsert and ensures _kkeyStr() handling.
739
+ *
740
+ */;
741
+ _proto.prepareEntitiesFromDatastore = function prepareEntitiesFromDatastore(entities) {
742
+ for (var _iterator3 = _createForOfIteratorHelperLoose(entities), _step3; !(_step3 = _iterator3()).done;) {
743
+ var e = _step3.value;
744
+ e.data[datastore.Datastore.KEY] = e.key;
745
+ this.fixKeys([e.data]);
746
+ }
747
+ }
611
748
  /** `get()` reads a [[IDstoreEntry]] from the Datastore.
612
749
  *
613
750
  * It returns [[IDstoreEntry]] or `null` if not found.
@@ -625,7 +762,7 @@ var Dstore = /*#__PURE__*/function () {
625
762
  _proto.get =
626
763
  /*#__PURE__*/
627
764
  function () {
628
- var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key) {
765
+ var _get = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(key) {
629
766
  var result;
630
767
  return _regeneratorRuntime().wrap(function _callee$(_context) {
631
768
  while (1) switch (_context.prev = _context.next) {
@@ -670,7 +807,7 @@ var Dstore = /*#__PURE__*/function () {
670
807
  _proto.getMulti =
671
808
  /*#__PURE__*/
672
809
  function () {
673
- var _getMulti = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(keys) {
810
+ var _getMulti = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(keys) {
674
811
  var results, metricEnd, _yield$this$getDoT$ge, entities, entitiesByKey;
675
812
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
676
813
  while (1) switch (_context2.prev = _context2.next) {
@@ -767,7 +904,7 @@ var Dstore = /*#__PURE__*/function () {
767
904
  _proto.set =
768
905
  /*#__PURE__*/
769
906
  function () {
770
- var _set = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, data) {
907
+ var _set = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, data) {
771
908
  var saveEntity;
772
909
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
773
910
  while (1) switch (_context3.prev = _context3.next) {
@@ -832,26 +969,17 @@ var Dstore = /*#__PURE__*/function () {
832
969
  _proto.save =
833
970
  /*#__PURE__*/
834
971
  function () {
835
- var _save = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(entities) {
836
- var ret, metricEnd, _iterator, _step, e, _iterator2, _step2, _e;
972
+ var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(entities) {
973
+ var ret, metricEnd;
837
974
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
838
975
  while (1) switch (_context4.prev = _context4.next) {
839
976
  case 0:
840
977
  assertateDebug.assertIsArray(entities);
841
978
  metricEnd = metricHistogram.startTimer();
842
979
  _context4.prev = 2;
980
+ this.prepareEntitiesForDatastore(entities);
843
981
  // Within Transaction we don't get any answer here!
844
982
  // [ { mutationResults: [ [Object], [Object] ], indexUpdates: 51 } ]
845
- for (_iterator = _createForOfIteratorHelperLoose(entities); !(_step = _iterator()).done;) {
846
- e = _step.value;
847
- assertateDebug.assertIsObject(e.key);
848
- assertateDebug.assertIsObject(e.data);
849
- this.fixKeys([e.data]);
850
- e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;
851
- e.data = _extends({}, e.data, {
852
- _keyStr: undefined
853
- });
854
- }
855
983
  _context4.next = 6;
856
984
  return this.getDoT().save(entities);
857
985
  case 6:
@@ -863,11 +991,7 @@ var Dstore = /*#__PURE__*/function () {
863
991
  _context4.t0 = undefined;
864
992
  case 9:
865
993
  ret = _context4.t0;
866
- for (_iterator2 = _createForOfIteratorHelperLoose(entities); !(_step2 = _iterator2()).done;) {
867
- _e = _step2.value;
868
- _e.data[datastore.Datastore.KEY] = _e.key;
869
- this.fixKeys([_e.data]);
870
- }
994
+ this.prepareEntitiesFromDatastore(entities);
871
995
  _context4.next = 19;
872
996
  break;
873
997
  case 13:
@@ -921,7 +1045,7 @@ var Dstore = /*#__PURE__*/function () {
921
1045
  _proto.insert =
922
1046
  /*#__PURE__*/
923
1047
  function () {
924
- var _insert = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(entities) {
1048
+ var _insert = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(entities) {
925
1049
  var ret, metricEnd;
926
1050
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
927
1051
  while (1) switch (_context5.prev = _context5.next) {
@@ -929,43 +1053,45 @@ var Dstore = /*#__PURE__*/function () {
929
1053
  assertateDebug.assertIsArray(entities);
930
1054
  metricEnd = metricHistogram.startTimer();
931
1055
  _context5.prev = 2;
932
- _context5.next = 5;
1056
+ this.prepareEntitiesForDatastore(entities);
1057
+ _context5.next = 6;
933
1058
  return this.getDoT().insert(entities);
934
- case 5:
1059
+ case 6:
935
1060
  _context5.t0 = _context5.sent;
936
1061
  if (_context5.t0) {
937
- _context5.next = 8;
1062
+ _context5.next = 9;
938
1063
  break;
939
1064
  }
940
1065
  _context5.t0 = undefined;
941
- case 8:
1066
+ case 9:
942
1067
  ret = _context5.t0;
943
- _context5.next = 17;
1068
+ this.prepareEntitiesFromDatastore(entities);
1069
+ _context5.next = 19;
944
1070
  break;
945
- case 11:
946
- _context5.prev = 11;
1071
+ case 13:
1072
+ _context5.prev = 13;
947
1073
  _context5.t1 = _context5["catch"](2);
948
1074
  // console.error(error)
949
1075
  metricFailureCounter.inc({
950
1076
  operation: 'insert'
951
1077
  });
952
- _context5.next = 16;
1078
+ _context5.next = 18;
953
1079
  return promises.setImmediate();
954
- case 16:
1080
+ case 18:
955
1081
  throw new DstoreError('datastore.insert error', _context5.t1);
956
- case 17:
957
- _context5.prev = 17;
1082
+ case 19:
1083
+ _context5.prev = 19;
958
1084
  metricEnd({
959
1085
  operation: 'insert'
960
1086
  });
961
- return _context5.finish(17);
962
- case 20:
1087
+ return _context5.finish(19);
1088
+ case 22:
963
1089
  return _context5.abrupt("return", ret);
964
- case 21:
1090
+ case 23:
965
1091
  case "end":
966
1092
  return _context5.stop();
967
1093
  }
968
- }, _callee5, this, [[2, 11, 17, 20]]);
1094
+ }, _callee5, this, [[2, 13, 19, 22]]);
969
1095
  }));
970
1096
  function insert(_x6) {
971
1097
  return _insert.apply(this, arguments);
@@ -993,7 +1119,7 @@ var Dstore = /*#__PURE__*/function () {
993
1119
  _proto.update =
994
1120
  /*#__PURE__*/
995
1121
  function () {
996
- var _update = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(entities) {
1122
+ var _update = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(entities) {
997
1123
  var ret, metricEnd;
998
1124
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
999
1125
  while (1) switch (_context6.prev = _context6.next) {
@@ -1007,43 +1133,45 @@ var Dstore = /*#__PURE__*/function () {
1007
1133
  });
1008
1134
  metricEnd = metricHistogram.startTimer();
1009
1135
  _context6.prev = 4;
1010
- _context6.next = 7;
1136
+ this.prepareEntitiesForDatastore(entities);
1137
+ _context6.next = 8;
1011
1138
  return this.getDoT().update(entities);
1012
- case 7:
1139
+ case 8:
1013
1140
  _context6.t0 = _context6.sent;
1014
1141
  if (_context6.t0) {
1015
- _context6.next = 10;
1142
+ _context6.next = 11;
1016
1143
  break;
1017
1144
  }
1018
1145
  _context6.t0 = undefined;
1019
- case 10:
1146
+ case 11:
1020
1147
  ret = _context6.t0;
1021
- _context6.next = 19;
1148
+ this.prepareEntitiesFromDatastore(entities);
1149
+ _context6.next = 21;
1022
1150
  break;
1023
- case 13:
1024
- _context6.prev = 13;
1151
+ case 15:
1152
+ _context6.prev = 15;
1025
1153
  _context6.t1 = _context6["catch"](4);
1026
1154
  // console.error(error)
1027
1155
  metricFailureCounter.inc({
1028
1156
  operation: 'update'
1029
1157
  });
1030
- _context6.next = 18;
1158
+ _context6.next = 20;
1031
1159
  return promises.setImmediate();
1032
- case 18:
1160
+ case 20:
1033
1161
  throw new DstoreError('datastore.update error', _context6.t1);
1034
- case 19:
1035
- _context6.prev = 19;
1162
+ case 21:
1163
+ _context6.prev = 21;
1036
1164
  metricEnd({
1037
1165
  operation: 'update'
1038
1166
  });
1039
- return _context6.finish(19);
1040
- case 22:
1167
+ return _context6.finish(21);
1168
+ case 24:
1041
1169
  return _context6.abrupt("return", ret);
1042
- case 23:
1170
+ case 25:
1043
1171
  case "end":
1044
1172
  return _context6.stop();
1045
1173
  }
1046
- }, _callee6, this, [[4, 13, 19, 22]]);
1174
+ }, _callee6, this, [[4, 15, 21, 24]]);
1047
1175
  }));
1048
1176
  function update(_x7) {
1049
1177
  return _update.apply(this, arguments);
@@ -1067,7 +1195,7 @@ var Dstore = /*#__PURE__*/function () {
1067
1195
  _proto["delete"] =
1068
1196
  /*#__PURE__*/
1069
1197
  function () {
1070
- var _delete2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(keys) {
1198
+ var _delete2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(keys) {
1071
1199
  var ret, metricEnd;
1072
1200
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1073
1201
  while (1) switch (_context7.prev = _context7.next) {
@@ -1140,7 +1268,7 @@ var Dstore = /*#__PURE__*/function () {
1140
1268
  }
1141
1269
  };
1142
1270
  _proto.runQuery = /*#__PURE__*/function () {
1143
- var _runQuery = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(query) {
1271
+ var _runQuery = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(query) {
1144
1272
  var ret, metricEnd, _yield$this$getDoT$ru, entities, info;
1145
1273
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1146
1274
  while (1) switch (_context8.prev = _context8.next) {
@@ -1192,14 +1320,15 @@ var Dstore = /*#__PURE__*/function () {
1192
1320
  * @param selection selectionList of [[Query]] select() calls.
1193
1321
  * @param cursor unsupported so far.
1194
1322
  *
1323
+ * @throws [[DstoreError]]
1195
1324
  * @category Datastore Drop-In
1196
1325
  */
1197
1326
  ;
1198
1327
  _proto.query =
1199
1328
  /*#__PURE__*/
1200
1329
  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;
1330
+ var _query = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(kindName, filters, limit, ordering, selection, cursor) {
1331
+ var q, _iterator4, _step4, filterSpec, _iterator5, _step5, orderField, ret;
1203
1332
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1204
1333
  while (1) switch (_context9.prev = _context9.next) {
1205
1334
  case 0:
@@ -1220,14 +1349,14 @@ var Dstore = /*#__PURE__*/function () {
1220
1349
  assertateDebug.assertIsNumber(limit);
1221
1350
  _context9.prev = 7;
1222
1351
  q = this.createQuery(kindName);
1223
- for (_iterator3 = _createForOfIteratorHelperLoose(filters); !(_step3 = _iterator3()).done;) {
1224
- filterSpec = _step3.value;
1352
+ for (_iterator4 = _createForOfIteratorHelperLoose(filters); !(_step4 = _iterator4()).done;) {
1353
+ filterSpec = _step4.value;
1225
1354
  assertateDebug.assertIsObject(filterSpec);
1226
1355
  // @ts-ignore
1227
1356
  q.filter(_construct(datastore.PropertyFilter, filterSpec));
1228
1357
  }
1229
- for (_iterator4 = _createForOfIteratorHelperLoose(ordering); !(_step4 = _iterator4()).done;) {
1230
- orderField = _step4.value;
1358
+ for (_iterator5 = _createForOfIteratorHelperLoose(ordering); !(_step5 = _iterator5()).done;) {
1359
+ orderField = _step5.value;
1231
1360
  q.order(orderField);
1232
1361
  }
1233
1362
  if (limit > 0) {
@@ -1237,32 +1366,165 @@ var Dstore = /*#__PURE__*/function () {
1237
1366
  q.select(selection);
1238
1367
  }
1239
1368
  _context9.next = 15;
1240
- return this.runQuery(q);
1369
+ return this.getDoT().runQuery(q);
1241
1370
  case 15:
1242
- return _context9.abrupt("return", _context9.sent);
1243
- case 18:
1244
- _context9.prev = 18;
1371
+ ret = _context9.sent;
1372
+ return _context9.abrupt("return", [this.fixKeys(ret[0]), ret[1]]);
1373
+ case 19:
1374
+ _context9.prev = 19;
1245
1375
  _context9.t0 = _context9["catch"](7);
1246
- _context9.next = 22;
1376
+ _context9.next = 23;
1247
1377
  return promises.setImmediate();
1248
- case 22:
1378
+ case 23:
1249
1379
  throw new DstoreError('datastore.query error', _context9.t0, {
1250
1380
  kindName: kindName,
1251
1381
  filters: filters,
1252
1382
  limit: limit,
1253
1383
  ordering: ordering
1254
1384
  });
1255
- case 23:
1385
+ case 24:
1256
1386
  case "end":
1257
1387
  return _context9.stop();
1258
1388
  }
1259
- }, _callee9, this, [[7, 18]]);
1389
+ }, _callee9, this, [[7, 19]]);
1260
1390
  }));
1261
1391
  function query(_x10, _x11, _x12, _x13, _x14, _x15) {
1262
1392
  return _query.apply(this, arguments);
1263
1393
  }
1264
1394
  return query;
1265
1395
  }()
1396
+ /** `iterate()` is a modernized version of `query()`.
1397
+ *
1398
+ * It takes a Parameter object and returns an AsyncIterable.
1399
+ * Entities returned have been processed by `fixKeys()`.
1400
+ *
1401
+ * Can be used with `for await` loops like this:
1402
+ *
1403
+ * ```typescript
1404
+ * for await (const entity of dstore.iterate({ kindName: 'p_ReservierungsAbruf', filters: [['verbucht', '=', true]]})) {
1405
+ * console.log(entity)
1406
+ * }
1407
+ * ```
1408
+ *
1409
+ * @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) ("Table") which should be searched.
1410
+ * @param filters List of [[Query]] filter() calls.
1411
+ * @param limit Maximum Number of Results to return.
1412
+ * @param ordering List of [[Query]] order() calls.
1413
+ * @param selection selectionList of [[Query]] select() calls.
1414
+ *
1415
+ * @throws [[DstoreError]]
1416
+ * @category Additional
1417
+ */
1418
+ ;
1419
+ _proto.iterate = function iterate(_ref) {
1420
+ var _this = this;
1421
+ var kindName = _ref.kindName,
1422
+ _ref$filters = _ref.filters,
1423
+ filters = _ref$filters === void 0 ? [] : _ref$filters,
1424
+ _ref$limit = _ref.limit,
1425
+ limit = _ref$limit === void 0 ? 2500 : _ref$limit,
1426
+ _ref$ordering = _ref.ordering,
1427
+ ordering = _ref$ordering === void 0 ? [] : _ref$ordering,
1428
+ _ref$selection = _ref.selection,
1429
+ selection = _ref$selection === void 0 ? [] : _ref$selection;
1430
+ return _wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1431
+ var q, _iterator6, _step6, filterSpec, _iterator7, _step7, orderField, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _entity, ret;
1432
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1433
+ while (1) switch (_context10.prev = _context10.next) {
1434
+ case 0:
1435
+ assertateDebug.assertIsString(kindName);
1436
+ assertateDebug.assertIsArray(filters);
1437
+ assertateDebug.assertIsNumber(limit);
1438
+ _context10.prev = 3;
1439
+ q = _this.getDoT().createQuery(kindName);
1440
+ for (_iterator6 = _createForOfIteratorHelperLoose(filters); !(_step6 = _iterator6()).done;) {
1441
+ filterSpec = _step6.value;
1442
+ assertateDebug.assertIsObject(filterSpec);
1443
+ // @ts-ignore
1444
+ q.filter(_construct(datastore.PropertyFilter, filterSpec));
1445
+ }
1446
+ for (_iterator7 = _createForOfIteratorHelperLoose(ordering); !(_step7 = _iterator7()).done;) {
1447
+ orderField = _step7.value;
1448
+ q.order(orderField);
1449
+ }
1450
+ if (limit > 0) {
1451
+ q.limit(limit);
1452
+ }
1453
+ if (selection.length > 0) {
1454
+ q.select(selection);
1455
+ }
1456
+ _iteratorAbruptCompletion = false;
1457
+ _didIteratorError = false;
1458
+ _context10.prev = 11;
1459
+ _iterator = _asyncIterator(q.runStream());
1460
+ case 13:
1461
+ _context10.next = 15;
1462
+ return _awaitAsyncGenerator(_iterator.next());
1463
+ case 15:
1464
+ if (!(_iteratorAbruptCompletion = !(_step = _context10.sent).done)) {
1465
+ _context10.next = 25;
1466
+ break;
1467
+ }
1468
+ _entity = _step.value;
1469
+ ret = _this.fixKeys([_entity])[0];
1470
+ assertateDebug.assertIsDefined(ret, 'datastore.iterate: entity is undefined');
1471
+ assertIsKey(ret[datastore.Datastore.KEY]);
1472
+ _context10.next = 22;
1473
+ return ret;
1474
+ case 22:
1475
+ _iteratorAbruptCompletion = false;
1476
+ _context10.next = 13;
1477
+ break;
1478
+ case 25:
1479
+ _context10.next = 31;
1480
+ break;
1481
+ case 27:
1482
+ _context10.prev = 27;
1483
+ _context10.t0 = _context10["catch"](11);
1484
+ _didIteratorError = true;
1485
+ _iteratorError = _context10.t0;
1486
+ case 31:
1487
+ _context10.prev = 31;
1488
+ _context10.prev = 32;
1489
+ if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
1490
+ _context10.next = 36;
1491
+ break;
1492
+ }
1493
+ _context10.next = 36;
1494
+ return _awaitAsyncGenerator(_iterator["return"]());
1495
+ case 36:
1496
+ _context10.prev = 36;
1497
+ if (!_didIteratorError) {
1498
+ _context10.next = 39;
1499
+ break;
1500
+ }
1501
+ throw _iteratorError;
1502
+ case 39:
1503
+ return _context10.finish(36);
1504
+ case 40:
1505
+ return _context10.finish(31);
1506
+ case 41:
1507
+ _context10.next = 48;
1508
+ break;
1509
+ case 43:
1510
+ _context10.prev = 43;
1511
+ _context10.t1 = _context10["catch"](3);
1512
+ _context10.next = 47;
1513
+ return _awaitAsyncGenerator(promises.setImmediate());
1514
+ case 47:
1515
+ throw new DstoreError('datastore.query error', _context10.t1, {
1516
+ kindName: kindName,
1517
+ filters: filters,
1518
+ limit: limit,
1519
+ ordering: ordering
1520
+ });
1521
+ case 48:
1522
+ case "end":
1523
+ return _context10.stop();
1524
+ }
1525
+ }, _callee10, null, [[3, 43], [11, 27, 31, 41], [32,, 36, 40]]);
1526
+ }))();
1527
+ }
1266
1528
  /** Allocate one ID in the Datastore.
1267
1529
  *
1268
1530
  * Currently (late 2021) there is no documentation provided by Google for the underlying node function.
@@ -1273,31 +1535,30 @@ var Dstore = /*#__PURE__*/function () {
1273
1535
  * The ID is a string encoded large number. This function will never return the same ID twice for any given Datastore.
1274
1536
  * If you provide a kindName the ID will be namespaced to this kind.
1275
1537
  * In fact the generated ID is namespaced via an incomplete [[Key]] of the given Kind.
1276
- */
1277
- ;
1538
+ */;
1278
1539
  _proto.allocateOneId =
1279
1540
  /*#__PURE__*/
1280
1541
  function () {
1281
- var _allocateOneId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(kindName) {
1542
+ var _allocateOneId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(kindName) {
1282
1543
  var ret;
1283
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1284
- while (1) switch (_context10.prev = _context10.next) {
1544
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1545
+ while (1) switch (_context11.prev = _context11.next) {
1285
1546
  case 0:
1286
1547
  if (kindName === void 0) {
1287
1548
  kindName = 'Numbering';
1288
1549
  }
1289
1550
  assertateDebug.assertIsString(kindName);
1290
- _context10.next = 4;
1551
+ _context11.next = 4;
1291
1552
  return this.datastore.allocateIds(this.key([kindName]), 1);
1292
1553
  case 4:
1293
- ret = _context10.sent[0][0].id;
1554
+ ret = _context11.sent[0][0].id;
1294
1555
  assertateDebug.assertIsString(ret);
1295
- return _context10.abrupt("return", ret);
1556
+ return _context11.abrupt("return", ret);
1296
1557
  case 7:
1297
1558
  case "end":
1298
- return _context10.stop();
1559
+ return _context11.stop();
1299
1560
  }
1300
- }, _callee10, this);
1561
+ }, _callee11, this);
1301
1562
  }));
1302
1563
  function allocateOneId(_x16) {
1303
1564
  return _allocateOneId.apply(this, arguments);
@@ -1316,72 +1577,72 @@ var Dstore = /*#__PURE__*/function () {
1316
1577
  _proto.runInTransaction =
1317
1578
  /*#__PURE__*/
1318
1579
  function () {
1319
- var _runInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(func) {
1580
+ var _runInTransaction = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(func) {
1320
1581
  var ret, transaction;
1321
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1322
- while (1) switch (_context12.prev = _context12.next) {
1582
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1583
+ while (1) switch (_context13.prev = _context13.next) {
1323
1584
  case 0:
1324
1585
  transaction = this.datastore.transaction();
1325
- _context12.next = 3;
1326
- return transactionAsyncLocalStorage.run(transaction, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
1586
+ _context13.next = 3;
1587
+ return transactionAsyncLocalStorage.run(transaction, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1327
1588
  var _yield$transaction$ru, transactionInfo, transactionRunApiResponse, commitApiResponse, rollbackInfo;
1328
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1329
- while (1) switch (_context11.prev = _context11.next) {
1589
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1590
+ while (1) switch (_context12.prev = _context12.next) {
1330
1591
  case 0:
1331
- _context11.next = 2;
1592
+ _context12.next = 2;
1332
1593
  return transaction.run();
1333
1594
  case 2:
1334
- _yield$transaction$ru = _context11.sent;
1595
+ _yield$transaction$ru = _context12.sent;
1335
1596
  transactionInfo = _yield$transaction$ru[0];
1336
1597
  transactionRunApiResponse = _yield$transaction$ru[1];
1337
- _context11.prev = 5;
1338
- _context11.next = 8;
1598
+ _context12.prev = 5;
1599
+ _context12.next = 8;
1339
1600
  return func();
1340
1601
  case 8:
1341
- ret = _context11.sent;
1342
- _context11.next = 20;
1602
+ ret = _context12.sent;
1603
+ _context12.next = 20;
1343
1604
  break;
1344
1605
  case 11:
1345
- _context11.prev = 11;
1346
- _context11.t0 = _context11["catch"](5);
1347
- _context11.next = 15;
1606
+ _context12.prev = 11;
1607
+ _context12.t0 = _context12["catch"](5);
1608
+ _context12.next = 15;
1348
1609
  return transaction.rollback();
1349
1610
  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;
1611
+ rollbackInfo = _context12.sent;
1612
+ debug('Transaction failed, rollback initiated: %O %O %O %O', transactionInfo, transactionRunApiResponse, rollbackInfo, _context12.t0);
1613
+ _context12.next = 19;
1353
1614
  return promises.setImmediate();
1354
1615
  case 19:
1355
- throw new DstoreError('datastore.transaction execution error', _context11.t0);
1616
+ throw new DstoreError('datastore.transaction execution error', _context12.t0);
1356
1617
  case 20:
1357
- _context11.prev = 20;
1358
- _context11.next = 23;
1618
+ _context12.prev = 20;
1619
+ _context12.next = 23;
1359
1620
  return transaction.commit();
1360
1621
  case 23:
1361
- commitApiResponse = _context11.sent[0];
1362
- _context11.next = 32;
1622
+ commitApiResponse = _context12.sent[0];
1623
+ _context12.next = 32;
1363
1624
  break;
1364
1625
  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;
1626
+ _context12.prev = 26;
1627
+ _context12.t1 = _context12["catch"](20);
1628
+ debug('Transaction commit failed: %O %O %O %O ret: %O', transactionInfo, transactionRunApiResponse, commitApiResponse, _context12.t1, ret);
1629
+ _context12.next = 31;
1369
1630
  return promises.setImmediate();
1370
1631
  case 31:
1371
- throw new DstoreError('datastore.transaction execution error', _context11.t1);
1632
+ throw new DstoreError('datastore.transaction execution error', _context12.t1);
1372
1633
  case 32:
1373
1634
  case "end":
1374
- return _context11.stop();
1635
+ return _context12.stop();
1375
1636
  }
1376
- }, _callee11, null, [[5, 11], [20, 26]]);
1637
+ }, _callee12, null, [[5, 11], [20, 26]]);
1377
1638
  })));
1378
1639
  case 3:
1379
- return _context12.abrupt("return", ret);
1640
+ return _context13.abrupt("return", ret);
1380
1641
  case 4:
1381
1642
  case "end":
1382
- return _context12.stop();
1643
+ return _context13.stop();
1383
1644
  }
1384
- }, _callee12, this);
1645
+ }, _callee13, this);
1385
1646
  }));
1386
1647
  function runInTransaction(_x17) {
1387
1648
  return _runInTransaction.apply(this, arguments);
@@ -1391,58 +1652,29 @@ var Dstore = /*#__PURE__*/function () {
1391
1652
  return Dstore;
1392
1653
  }();
1393
1654
  var DstoreError = /*#__PURE__*/function (_Error) {
1394
- _inheritsLoose(DstoreError, _Error);
1395
1655
  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;
1656
+ var _this3$stack, _originalError$stack, _this3$stack2;
1657
+ var _this3;
1658
+ _this3 = _Error.call(this, message + ": " + (originalError == null ? void 0 : originalError.message)) || this;
1399
1659
  // 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', {
1660
+ _this3.extensions = void 0;
1661
+ _this3.originalError = void 0;
1662
+ if (!_this3.name) {
1663
+ Object.defineProperty(_this3, 'name', {
1404
1664
  value: 'DstoreError'
1405
1665
  });
1406
1666
  }
1407
1667
  // 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')) || '');
1668
+ _this3.originalError = originalError;
1669
+ _this3.extensions = _extends({}, extensions);
1670
+ _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
1671
  // These are usually present on Datastore Errors
1412
1672
  // logger.error({ err: originalError, extensions }, message);
1413
- return _this2;
1673
+ return _this3;
1414
1674
  }
1675
+ _inheritsLoose(DstoreError, _Error);
1415
1676
  return DstoreError;
1416
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1417
-
1418
- /*
1419
- * assert.ts
1420
- *
1421
- * Created by Dr. Maximillian Dornseif 2025-04-11 in datastore-api 6.0.1
1422
- */
1423
- /**
1424
- * Generates an type assertion message for the given `value`
1425
- *
1426
- * @param value value being type-checked
1427
- * @param type the expected value as a string; eg 'string', 'boolean', 'number'
1428
- * @param variableName the name of the variable being type-checked
1429
- * @param additionalMessage further information on failure
1430
- */
1431
- var AssertionMessage = function AssertionMessage(value, type, variableName, additionalMessage) {
1432
- var message = variableName ? variableName + " must be of type '" + type + "', '" + assertateDebug.getType(value) + "' provided" : "expected value of type '" + type + "', '" + assertateDebug.getType(value) + "' provided";
1433
- return additionalMessage ? message + ": " + additionalMessage : message;
1434
- };
1435
- /**
1436
- * Type-checks the provided `value` to be a symbol, throws an Error if it is not
1437
- *
1438
- * @param value the value to type-check as a symbol
1439
- * @param variableName the name of the variable to be type-checked
1440
- * @param additionalMessage further information on failure
1441
- * @throws {Error}
1442
- */
1443
- function assertIsKey(value, variableName, additionalMessage) {
1444
- assertateDebug.assert(datastore.Datastore.isKey(value), AssertionMessage(value, "Key", variableName, additionalMessage));
1445
- }
1677
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
1446
1678
 
1447
1679
  Object.defineProperty(exports, 'Datastore', {
1448
1680
  enumerable: true,