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.
- package/README.md +2 -1
- package/dist/datastore-api.cjs.development.js +728 -496
- package/dist/datastore-api.cjs.development.js.map +1 -1
- package/dist/datastore-api.cjs.production.min.js +1 -1
- package/dist/datastore-api.cjs.production.min.js.map +1 -1
- package/dist/datastore-api.esm.js +729 -497
- package/dist/datastore-api.esm.js.map +1 -1
- package/dist/lib/assert.d.ts +1 -1
- package/dist/lib/dstore-api.d.ts +49 -2
- package/package.json +100 -102
- package/src/lib/assert.ts +1 -1
- package/src/lib/dstore-api-cloud.spec.ts +123 -123
- package/src/lib/dstore-api.ts +299 -193
|
@@ -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
|
|
151
|
+
return e;
|
|
16
152
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function define(
|
|
28
|
-
return Object.defineProperty(
|
|
29
|
-
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
|
-
}),
|
|
170
|
+
}), t[e];
|
|
34
171
|
}
|
|
35
172
|
try {
|
|
36
173
|
define({}, "");
|
|
37
|
-
} catch (
|
|
38
|
-
define = function (
|
|
39
|
-
return
|
|
174
|
+
} catch (t) {
|
|
175
|
+
define = function (t, e, r) {
|
|
176
|
+
return t[e] = r;
|
|
40
177
|
};
|
|
41
178
|
}
|
|
42
|
-
function wrap(
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
value: makeInvokeMethod(
|
|
48
|
-
}),
|
|
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(
|
|
187
|
+
function tryCatch(t, e, r) {
|
|
51
188
|
try {
|
|
52
189
|
return {
|
|
53
190
|
type: "normal",
|
|
54
|
-
arg:
|
|
191
|
+
arg: t.call(e, r)
|
|
55
192
|
};
|
|
56
|
-
} catch (
|
|
193
|
+
} catch (t) {
|
|
57
194
|
return {
|
|
58
195
|
type: "throw",
|
|
59
|
-
arg:
|
|
196
|
+
arg: t
|
|
60
197
|
};
|
|
61
198
|
}
|
|
62
199
|
}
|
|
63
|
-
|
|
64
|
-
var
|
|
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
|
|
69
|
-
define(
|
|
209
|
+
var p = {};
|
|
210
|
+
define(p, a, function () {
|
|
70
211
|
return this;
|
|
71
212
|
});
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
function defineIteratorMethods(
|
|
77
|
-
["next", "throw", "return"].forEach(function (
|
|
78
|
-
define(
|
|
79
|
-
return this._invoke(
|
|
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(
|
|
84
|
-
function invoke(
|
|
85
|
-
var
|
|
86
|
-
if ("throw" !==
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
return
|
|
90
|
-
invoke("next",
|
|
91
|
-
}, function (
|
|
92
|
-
invoke("throw",
|
|
93
|
-
}) :
|
|
94
|
-
|
|
95
|
-
}, function (
|
|
96
|
-
return invoke("throw",
|
|
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
|
-
|
|
240
|
+
a(c.arg);
|
|
100
241
|
}
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
value: function (
|
|
242
|
+
var r;
|
|
243
|
+
o(this, "_invoke", {
|
|
244
|
+
value: function (t, n) {
|
|
104
245
|
function callInvokeWithMethodAndArg() {
|
|
105
|
-
return new
|
|
106
|
-
invoke(
|
|
246
|
+
return new e(function (e, r) {
|
|
247
|
+
invoke(t, n, e, r);
|
|
107
248
|
});
|
|
108
249
|
}
|
|
109
|
-
return
|
|
250
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
110
251
|
}
|
|
111
252
|
});
|
|
112
253
|
}
|
|
113
|
-
function makeInvokeMethod(
|
|
114
|
-
var
|
|
115
|
-
return function (
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if ("throw" ===
|
|
119
|
-
return
|
|
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 (
|
|
122
|
-
var
|
|
123
|
-
if (
|
|
124
|
-
var
|
|
125
|
-
if (
|
|
126
|
-
if (
|
|
127
|
-
return
|
|
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" ===
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
} else "return" ===
|
|
134
|
-
|
|
135
|
-
var
|
|
136
|
-
if ("normal" ===
|
|
137
|
-
if (
|
|
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:
|
|
140
|
-
done:
|
|
283
|
+
value: p.arg,
|
|
284
|
+
done: n.done
|
|
141
285
|
};
|
|
142
286
|
}
|
|
143
|
-
"throw" ===
|
|
287
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
144
288
|
}
|
|
145
289
|
};
|
|
146
290
|
}
|
|
147
|
-
function maybeInvokeDelegate(
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
if (
|
|
151
|
-
var
|
|
152
|
-
if ("throw" ===
|
|
153
|
-
var
|
|
154
|
-
return
|
|
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(
|
|
157
|
-
var
|
|
158
|
-
tryLoc:
|
|
300
|
+
function pushTryEntry(t) {
|
|
301
|
+
var e = {
|
|
302
|
+
tryLoc: t[0]
|
|
159
303
|
};
|
|
160
|
-
1 in
|
|
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(
|
|
163
|
-
var
|
|
164
|
-
|
|
306
|
+
function resetTryEntry(t) {
|
|
307
|
+
var e = t.completion || {};
|
|
308
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
165
309
|
}
|
|
166
|
-
function Context(
|
|
310
|
+
function Context(t) {
|
|
167
311
|
this.tryEntries = [{
|
|
168
312
|
tryLoc: "root"
|
|
169
|
-
}],
|
|
313
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
170
314
|
}
|
|
171
|
-
function values(
|
|
172
|
-
if (
|
|
173
|
-
var
|
|
174
|
-
if (
|
|
175
|
-
if ("function" == typeof
|
|
176
|
-
if (!isNaN(
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
for (; ++
|
|
180
|
-
return next.value =
|
|
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
|
|
326
|
+
return i.next = i;
|
|
183
327
|
}
|
|
184
328
|
}
|
|
185
|
-
|
|
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,
|
|
331
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
196
332
|
value: GeneratorFunctionPrototype,
|
|
197
333
|
configurable: !0
|
|
198
|
-
}),
|
|
334
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
199
335
|
value: GeneratorFunction,
|
|
200
336
|
configurable: !0
|
|
201
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype,
|
|
202
|
-
var
|
|
203
|
-
return !!
|
|
204
|
-
},
|
|
205
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(
|
|
206
|
-
},
|
|
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:
|
|
344
|
+
__await: t
|
|
209
345
|
};
|
|
210
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype,
|
|
346
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
211
347
|
return this;
|
|
212
|
-
}),
|
|
213
|
-
void 0 ===
|
|
214
|
-
var
|
|
215
|
-
return
|
|
216
|
-
return
|
|
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(
|
|
354
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
219
355
|
return this;
|
|
220
|
-
}), define(
|
|
356
|
+
}), define(g, "toString", function () {
|
|
221
357
|
return "[object Generator]";
|
|
222
|
-
}),
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
for (var
|
|
226
|
-
return
|
|
227
|
-
for (;
|
|
228
|
-
var
|
|
229
|
-
if (
|
|
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
|
-
},
|
|
369
|
+
}, e.values = values, Context.prototype = {
|
|
234
370
|
constructor: Context,
|
|
235
|
-
reset: function (
|
|
236
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
|
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
|
|
241
|
-
if ("throw" ===
|
|
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 (
|
|
245
|
-
if (this.done) throw
|
|
246
|
-
var
|
|
247
|
-
function handle(
|
|
248
|
-
return
|
|
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
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
if ("root" ===
|
|
254
|
-
if (
|
|
255
|
-
var
|
|
256
|
-
|
|
257
|
-
if (
|
|
258
|
-
if (this.prev <
|
|
259
|
-
if (this.prev <
|
|
260
|
-
} else if (
|
|
261
|
-
if (this.prev <
|
|
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 (!
|
|
264
|
-
if (this.prev <
|
|
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 (
|
|
270
|
-
for (var
|
|
271
|
-
var
|
|
272
|
-
if (
|
|
273
|
-
var
|
|
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
|
-
|
|
278
|
-
var
|
|
279
|
-
return
|
|
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 (
|
|
282
|
-
if ("throw" ===
|
|
283
|
-
return "break" ===
|
|
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 (
|
|
286
|
-
for (var
|
|
287
|
-
var
|
|
288
|
-
if (
|
|
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 (
|
|
292
|
-
for (var
|
|
293
|
-
var
|
|
294
|
-
if (
|
|
295
|
-
var
|
|
296
|
-
if ("throw" ===
|
|
297
|
-
var
|
|
298
|
-
resetTryEntry(
|
|
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
|
|
436
|
+
return o;
|
|
301
437
|
}
|
|
302
438
|
}
|
|
303
|
-
throw
|
|
439
|
+
throw Error("illegal catch attempt");
|
|
304
440
|
},
|
|
305
|
-
delegateYield: function (
|
|
441
|
+
delegateYield: function (e, r, n) {
|
|
306
442
|
return this.delegate = {
|
|
307
|
-
iterator: values(
|
|
308
|
-
resultName:
|
|
309
|
-
nextLoc:
|
|
310
|
-
}, "next" === this.method && (this.arg =
|
|
443
|
+
iterator: values(e),
|
|
444
|
+
resultName: r,
|
|
445
|
+
nextLoc: n
|
|
446
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
311
447
|
}
|
|
312
|
-
},
|
|
448
|
+
}, e;
|
|
313
449
|
}
|
|
314
|
-
function
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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
|
|
462
|
+
function _wrapAsyncGenerator(e) {
|
|
329
463
|
return function () {
|
|
330
|
-
|
|
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
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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(
|
|
539
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
418
540
|
}
|
|
419
|
-
Wrapper.prototype = Object.create(
|
|
541
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
420
542
|
constructor: {
|
|
421
543
|
value: Wrapper,
|
|
422
|
-
enumerable:
|
|
423
|
-
writable:
|
|
424
|
-
configurable:
|
|
544
|
+
enumerable: !1,
|
|
545
|
+
writable: !0,
|
|
546
|
+
configurable: !0
|
|
425
547
|
}
|
|
426
|
-
});
|
|
427
|
-
|
|
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
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
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]]
|
|
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
|
|
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 =
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
836
|
-
var ret, metricEnd
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
1056
|
+
this.prepareEntitiesForDatastore(entities);
|
|
1057
|
+
_context5.next = 6;
|
|
933
1058
|
return this.getDoT().insert(entities);
|
|
934
|
-
case
|
|
1059
|
+
case 6:
|
|
935
1060
|
_context5.t0 = _context5.sent;
|
|
936
1061
|
if (_context5.t0) {
|
|
937
|
-
_context5.next =
|
|
1062
|
+
_context5.next = 9;
|
|
938
1063
|
break;
|
|
939
1064
|
}
|
|
940
1065
|
_context5.t0 = undefined;
|
|
941
|
-
case
|
|
1066
|
+
case 9:
|
|
942
1067
|
ret = _context5.t0;
|
|
943
|
-
|
|
1068
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
1069
|
+
_context5.next = 19;
|
|
944
1070
|
break;
|
|
945
|
-
case
|
|
946
|
-
_context5.prev =
|
|
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 =
|
|
1078
|
+
_context5.next = 18;
|
|
953
1079
|
return promises.setImmediate();
|
|
954
|
-
case
|
|
1080
|
+
case 18:
|
|
955
1081
|
throw new DstoreError('datastore.insert error', _context5.t1);
|
|
956
|
-
case
|
|
957
|
-
_context5.prev =
|
|
1082
|
+
case 19:
|
|
1083
|
+
_context5.prev = 19;
|
|
958
1084
|
metricEnd({
|
|
959
1085
|
operation: 'insert'
|
|
960
1086
|
});
|
|
961
|
-
return _context5.finish(
|
|
962
|
-
case
|
|
1087
|
+
return _context5.finish(19);
|
|
1088
|
+
case 22:
|
|
963
1089
|
return _context5.abrupt("return", ret);
|
|
964
|
-
case
|
|
1090
|
+
case 23:
|
|
965
1091
|
case "end":
|
|
966
1092
|
return _context5.stop();
|
|
967
1093
|
}
|
|
968
|
-
}, _callee5, this, [[2,
|
|
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(
|
|
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
|
-
|
|
1136
|
+
this.prepareEntitiesForDatastore(entities);
|
|
1137
|
+
_context6.next = 8;
|
|
1011
1138
|
return this.getDoT().update(entities);
|
|
1012
|
-
case
|
|
1139
|
+
case 8:
|
|
1013
1140
|
_context6.t0 = _context6.sent;
|
|
1014
1141
|
if (_context6.t0) {
|
|
1015
|
-
_context6.next =
|
|
1142
|
+
_context6.next = 11;
|
|
1016
1143
|
break;
|
|
1017
1144
|
}
|
|
1018
1145
|
_context6.t0 = undefined;
|
|
1019
|
-
case
|
|
1146
|
+
case 11:
|
|
1020
1147
|
ret = _context6.t0;
|
|
1021
|
-
|
|
1148
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
1149
|
+
_context6.next = 21;
|
|
1022
1150
|
break;
|
|
1023
|
-
case
|
|
1024
|
-
_context6.prev =
|
|
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 =
|
|
1158
|
+
_context6.next = 20;
|
|
1031
1159
|
return promises.setImmediate();
|
|
1032
|
-
case
|
|
1160
|
+
case 20:
|
|
1033
1161
|
throw new DstoreError('datastore.update error', _context6.t1);
|
|
1034
|
-
case
|
|
1035
|
-
_context6.prev =
|
|
1162
|
+
case 21:
|
|
1163
|
+
_context6.prev = 21;
|
|
1036
1164
|
metricEnd({
|
|
1037
1165
|
operation: 'update'
|
|
1038
1166
|
});
|
|
1039
|
-
return _context6.finish(
|
|
1040
|
-
case
|
|
1167
|
+
return _context6.finish(21);
|
|
1168
|
+
case 24:
|
|
1041
1169
|
return _context6.abrupt("return", ret);
|
|
1042
|
-
case
|
|
1170
|
+
case 25:
|
|
1043
1171
|
case "end":
|
|
1044
1172
|
return _context6.stop();
|
|
1045
1173
|
}
|
|
1046
|
-
}, _callee6, this, [[4,
|
|
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(
|
|
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(
|
|
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(
|
|
1202
|
-
var q,
|
|
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 (
|
|
1224
|
-
filterSpec =
|
|
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 (
|
|
1230
|
-
orderField =
|
|
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
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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 =
|
|
1376
|
+
_context9.next = 23;
|
|
1247
1377
|
return promises.setImmediate();
|
|
1248
|
-
case
|
|
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
|
|
1385
|
+
case 24:
|
|
1256
1386
|
case "end":
|
|
1257
1387
|
return _context9.stop();
|
|
1258
1388
|
}
|
|
1259
|
-
}, _callee9, this, [[7,
|
|
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(
|
|
1542
|
+
var _allocateOneId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(kindName) {
|
|
1282
1543
|
var ret;
|
|
1283
|
-
return _regeneratorRuntime().wrap(function
|
|
1284
|
-
while (1) switch (
|
|
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
|
-
|
|
1551
|
+
_context11.next = 4;
|
|
1291
1552
|
return this.datastore.allocateIds(this.key([kindName]), 1);
|
|
1292
1553
|
case 4:
|
|
1293
|
-
ret =
|
|
1554
|
+
ret = _context11.sent[0][0].id;
|
|
1294
1555
|
assertateDebug.assertIsString(ret);
|
|
1295
|
-
return
|
|
1556
|
+
return _context11.abrupt("return", ret);
|
|
1296
1557
|
case 7:
|
|
1297
1558
|
case "end":
|
|
1298
|
-
return
|
|
1559
|
+
return _context11.stop();
|
|
1299
1560
|
}
|
|
1300
|
-
},
|
|
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(
|
|
1580
|
+
var _runInTransaction = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(func) {
|
|
1320
1581
|
var ret, transaction;
|
|
1321
|
-
return _regeneratorRuntime().wrap(function
|
|
1322
|
-
while (1) switch (
|
|
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
|
-
|
|
1326
|
-
return transactionAsyncLocalStorage.run(transaction, /*#__PURE__*/_asyncToGenerator(
|
|
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
|
|
1329
|
-
while (1) switch (
|
|
1589
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1590
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1330
1591
|
case 0:
|
|
1331
|
-
|
|
1592
|
+
_context12.next = 2;
|
|
1332
1593
|
return transaction.run();
|
|
1333
1594
|
case 2:
|
|
1334
|
-
_yield$transaction$ru =
|
|
1595
|
+
_yield$transaction$ru = _context12.sent;
|
|
1335
1596
|
transactionInfo = _yield$transaction$ru[0];
|
|
1336
1597
|
transactionRunApiResponse = _yield$transaction$ru[1];
|
|
1337
|
-
|
|
1338
|
-
|
|
1598
|
+
_context12.prev = 5;
|
|
1599
|
+
_context12.next = 8;
|
|
1339
1600
|
return func();
|
|
1340
1601
|
case 8:
|
|
1341
|
-
ret =
|
|
1342
|
-
|
|
1602
|
+
ret = _context12.sent;
|
|
1603
|
+
_context12.next = 20;
|
|
1343
1604
|
break;
|
|
1344
1605
|
case 11:
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
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 =
|
|
1351
|
-
debug('Transaction failed, rollback initiated: %O %O %O %O', transactionInfo, transactionRunApiResponse, rollbackInfo,
|
|
1352
|
-
|
|
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',
|
|
1616
|
+
throw new DstoreError('datastore.transaction execution error', _context12.t0);
|
|
1356
1617
|
case 20:
|
|
1357
|
-
|
|
1358
|
-
|
|
1618
|
+
_context12.prev = 20;
|
|
1619
|
+
_context12.next = 23;
|
|
1359
1620
|
return transaction.commit();
|
|
1360
1621
|
case 23:
|
|
1361
|
-
commitApiResponse =
|
|
1362
|
-
|
|
1622
|
+
commitApiResponse = _context12.sent[0];
|
|
1623
|
+
_context12.next = 32;
|
|
1363
1624
|
break;
|
|
1364
1625
|
case 26:
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
debug('Transaction commit failed: %O %O %O %O ret: %O', transactionInfo, transactionRunApiResponse, commitApiResponse,
|
|
1368
|
-
|
|
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',
|
|
1632
|
+
throw new DstoreError('datastore.transaction execution error', _context12.t1);
|
|
1372
1633
|
case 32:
|
|
1373
1634
|
case "end":
|
|
1374
|
-
return
|
|
1635
|
+
return _context12.stop();
|
|
1375
1636
|
}
|
|
1376
|
-
},
|
|
1637
|
+
}, _callee12, null, [[5, 11], [20, 26]]);
|
|
1377
1638
|
})));
|
|
1378
1639
|
case 3:
|
|
1379
|
-
return
|
|
1640
|
+
return _context13.abrupt("return", ret);
|
|
1380
1641
|
case 4:
|
|
1381
1642
|
case "end":
|
|
1382
|
-
return
|
|
1643
|
+
return _context13.stop();
|
|
1383
1644
|
}
|
|
1384
|
-
},
|
|
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
|
|
1397
|
-
var
|
|
1398
|
-
|
|
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
|
-
|
|
1401
|
-
|
|
1402
|
-
if (!
|
|
1403
|
-
Object.defineProperty(
|
|
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
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
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
|
|
1673
|
+
return _this3;
|
|
1414
1674
|
}
|
|
1675
|
+
_inheritsLoose(DstoreError, _Error);
|
|
1415
1676
|
return DstoreError;
|
|
1416
|
-
}(
|
|
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,
|