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
|
@@ -3,464 +3,576 @@ import { setImmediate } from 'timers/promises';
|
|
|
3
3
|
import { Datastore, PropertyFilter } from '@google-cloud/datastore';
|
|
4
4
|
export { Datastore, Key, Query, Transaction } from '@google-cloud/datastore';
|
|
5
5
|
import { entity } from '@google-cloud/datastore/build/src/entity';
|
|
6
|
-
import {
|
|
6
|
+
import { assert, getType, assertIsObject, assertIsDefined, assertIsString, assertIsArray, assertIsNumber } from 'assertate-debug';
|
|
7
7
|
import Debug from 'debug';
|
|
8
8
|
import promClient from 'prom-client';
|
|
9
9
|
|
|
10
|
+
function _OverloadYield(e, d) {
|
|
11
|
+
this.v = e, this.k = d;
|
|
12
|
+
}
|
|
13
|
+
function _arrayLikeToArray(r, a) {
|
|
14
|
+
(null == a || a > r.length) && (a = r.length);
|
|
15
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
16
|
+
return n;
|
|
17
|
+
}
|
|
18
|
+
function _asyncIterator(r) {
|
|
19
|
+
var n,
|
|
20
|
+
t,
|
|
21
|
+
o,
|
|
22
|
+
e = 2;
|
|
23
|
+
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
|
|
24
|
+
if (t && null != (n = r[t])) return n.call(r);
|
|
25
|
+
if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
|
|
26
|
+
t = "@@asyncIterator", o = "@@iterator";
|
|
27
|
+
}
|
|
28
|
+
throw new TypeError("Object is not async iterable");
|
|
29
|
+
}
|
|
30
|
+
function AsyncFromSyncIterator(r) {
|
|
31
|
+
function AsyncFromSyncIteratorContinuation(r) {
|
|
32
|
+
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
|
|
33
|
+
var n = r.done;
|
|
34
|
+
return Promise.resolve(r.value).then(function (r) {
|
|
35
|
+
return {
|
|
36
|
+
value: r,
|
|
37
|
+
done: n
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return AsyncFromSyncIterator = function (r) {
|
|
42
|
+
this.s = r, this.n = r.next;
|
|
43
|
+
}, AsyncFromSyncIterator.prototype = {
|
|
44
|
+
s: null,
|
|
45
|
+
n: null,
|
|
46
|
+
next: function () {
|
|
47
|
+
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
|
48
|
+
},
|
|
49
|
+
return: function (r) {
|
|
50
|
+
var n = this.s.return;
|
|
51
|
+
return void 0 === n ? Promise.resolve({
|
|
52
|
+
value: r,
|
|
53
|
+
done: !0
|
|
54
|
+
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
55
|
+
},
|
|
56
|
+
throw: function (r) {
|
|
57
|
+
var n = this.s.return;
|
|
58
|
+
return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
59
|
+
}
|
|
60
|
+
}, new AsyncFromSyncIterator(r);
|
|
61
|
+
}
|
|
62
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
63
|
+
try {
|
|
64
|
+
var i = n[a](c),
|
|
65
|
+
u = i.value;
|
|
66
|
+
} catch (n) {
|
|
67
|
+
return void e(n);
|
|
68
|
+
}
|
|
69
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
70
|
+
}
|
|
71
|
+
function _asyncToGenerator(n) {
|
|
72
|
+
return function () {
|
|
73
|
+
var t = this,
|
|
74
|
+
e = arguments;
|
|
75
|
+
return new Promise(function (r, o) {
|
|
76
|
+
var a = n.apply(t, e);
|
|
77
|
+
function _next(n) {
|
|
78
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
79
|
+
}
|
|
80
|
+
function _throw(n) {
|
|
81
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
82
|
+
}
|
|
83
|
+
_next(void 0);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function _awaitAsyncGenerator(e) {
|
|
88
|
+
return new _OverloadYield(e, 0);
|
|
89
|
+
}
|
|
90
|
+
function _construct(t, e, r) {
|
|
91
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
92
|
+
var o = [null];
|
|
93
|
+
o.push.apply(o, e);
|
|
94
|
+
var p = new (t.bind.apply(t, o))();
|
|
95
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
96
|
+
}
|
|
97
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
98
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
99
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
100
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
101
|
+
t && (r = t);
|
|
102
|
+
var o = 0;
|
|
103
|
+
return function () {
|
|
104
|
+
return o >= r.length ? {
|
|
105
|
+
done: !0
|
|
106
|
+
} : {
|
|
107
|
+
done: !1,
|
|
108
|
+
value: r[o++]
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
113
|
+
}
|
|
114
|
+
function _extends() {
|
|
115
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
116
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
117
|
+
var t = arguments[e];
|
|
118
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
119
|
+
}
|
|
120
|
+
return n;
|
|
121
|
+
}, _extends.apply(null, arguments);
|
|
122
|
+
}
|
|
123
|
+
function _getPrototypeOf(t) {
|
|
124
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
125
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
126
|
+
}, _getPrototypeOf(t);
|
|
127
|
+
}
|
|
128
|
+
function _inheritsLoose(t, o) {
|
|
129
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
130
|
+
}
|
|
131
|
+
function _isNativeFunction(t) {
|
|
132
|
+
try {
|
|
133
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
134
|
+
} catch (n) {
|
|
135
|
+
return "function" == typeof t;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function _isNativeReflectConstruct() {
|
|
139
|
+
try {
|
|
140
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
141
|
+
} catch (t) {}
|
|
142
|
+
return (_isNativeReflectConstruct = function () {
|
|
143
|
+
return !!t;
|
|
144
|
+
})();
|
|
145
|
+
}
|
|
10
146
|
function _regeneratorRuntime() {
|
|
11
147
|
_regeneratorRuntime = function () {
|
|
12
|
-
return
|
|
148
|
+
return e;
|
|
13
149
|
};
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
150
|
+
var t,
|
|
151
|
+
e = {},
|
|
152
|
+
r = Object.prototype,
|
|
153
|
+
n = r.hasOwnProperty,
|
|
154
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
155
|
+
t[e] = r.value;
|
|
19
156
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function define(
|
|
25
|
-
return Object.defineProperty(
|
|
26
|
-
value:
|
|
157
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
158
|
+
a = i.iterator || "@@iterator",
|
|
159
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
160
|
+
u = i.toStringTag || "@@toStringTag";
|
|
161
|
+
function define(t, e, r) {
|
|
162
|
+
return Object.defineProperty(t, e, {
|
|
163
|
+
value: r,
|
|
27
164
|
enumerable: !0,
|
|
28
165
|
configurable: !0,
|
|
29
166
|
writable: !0
|
|
30
|
-
}),
|
|
167
|
+
}), t[e];
|
|
31
168
|
}
|
|
32
169
|
try {
|
|
33
170
|
define({}, "");
|
|
34
|
-
} catch (
|
|
35
|
-
define = function (
|
|
36
|
-
return
|
|
171
|
+
} catch (t) {
|
|
172
|
+
define = function (t, e, r) {
|
|
173
|
+
return t[e] = r;
|
|
37
174
|
};
|
|
38
175
|
}
|
|
39
|
-
function wrap(
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
value: makeInvokeMethod(
|
|
45
|
-
}),
|
|
176
|
+
function wrap(t, e, r, n) {
|
|
177
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
178
|
+
a = Object.create(i.prototype),
|
|
179
|
+
c = new Context(n || []);
|
|
180
|
+
return o(a, "_invoke", {
|
|
181
|
+
value: makeInvokeMethod(t, r, c)
|
|
182
|
+
}), a;
|
|
46
183
|
}
|
|
47
|
-
function tryCatch(
|
|
184
|
+
function tryCatch(t, e, r) {
|
|
48
185
|
try {
|
|
49
186
|
return {
|
|
50
187
|
type: "normal",
|
|
51
|
-
arg:
|
|
188
|
+
arg: t.call(e, r)
|
|
52
189
|
};
|
|
53
|
-
} catch (
|
|
190
|
+
} catch (t) {
|
|
54
191
|
return {
|
|
55
192
|
type: "throw",
|
|
56
|
-
arg:
|
|
193
|
+
arg: t
|
|
57
194
|
};
|
|
58
195
|
}
|
|
59
196
|
}
|
|
60
|
-
|
|
61
|
-
var
|
|
197
|
+
e.wrap = wrap;
|
|
198
|
+
var h = "suspendedStart",
|
|
199
|
+
l = "suspendedYield",
|
|
200
|
+
f = "executing",
|
|
201
|
+
s = "completed",
|
|
202
|
+
y = {};
|
|
62
203
|
function Generator() {}
|
|
63
204
|
function GeneratorFunction() {}
|
|
64
205
|
function GeneratorFunctionPrototype() {}
|
|
65
|
-
var
|
|
66
|
-
define(
|
|
206
|
+
var p = {};
|
|
207
|
+
define(p, a, function () {
|
|
67
208
|
return this;
|
|
68
209
|
});
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
function defineIteratorMethods(
|
|
74
|
-
["next", "throw", "return"].forEach(function (
|
|
75
|
-
define(
|
|
76
|
-
return this._invoke(
|
|
210
|
+
var d = Object.getPrototypeOf,
|
|
211
|
+
v = d && d(d(values([])));
|
|
212
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
213
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
214
|
+
function defineIteratorMethods(t) {
|
|
215
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
216
|
+
define(t, e, function (t) {
|
|
217
|
+
return this._invoke(e, t);
|
|
77
218
|
});
|
|
78
219
|
});
|
|
79
220
|
}
|
|
80
|
-
function AsyncIterator(
|
|
81
|
-
function invoke(
|
|
82
|
-
var
|
|
83
|
-
if ("throw" !==
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
return
|
|
87
|
-
invoke("next",
|
|
88
|
-
}, function (
|
|
89
|
-
invoke("throw",
|
|
90
|
-
}) :
|
|
91
|
-
|
|
92
|
-
}, function (
|
|
93
|
-
return invoke("throw",
|
|
221
|
+
function AsyncIterator(t, e) {
|
|
222
|
+
function invoke(r, o, i, a) {
|
|
223
|
+
var c = tryCatch(t[r], t, o);
|
|
224
|
+
if ("throw" !== c.type) {
|
|
225
|
+
var u = c.arg,
|
|
226
|
+
h = u.value;
|
|
227
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
228
|
+
invoke("next", t, i, a);
|
|
229
|
+
}, function (t) {
|
|
230
|
+
invoke("throw", t, i, a);
|
|
231
|
+
}) : e.resolve(h).then(function (t) {
|
|
232
|
+
u.value = t, i(u);
|
|
233
|
+
}, function (t) {
|
|
234
|
+
return invoke("throw", t, i, a);
|
|
94
235
|
});
|
|
95
236
|
}
|
|
96
|
-
|
|
237
|
+
a(c.arg);
|
|
97
238
|
}
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
value: function (
|
|
239
|
+
var r;
|
|
240
|
+
o(this, "_invoke", {
|
|
241
|
+
value: function (t, n) {
|
|
101
242
|
function callInvokeWithMethodAndArg() {
|
|
102
|
-
return new
|
|
103
|
-
invoke(
|
|
243
|
+
return new e(function (e, r) {
|
|
244
|
+
invoke(t, n, e, r);
|
|
104
245
|
});
|
|
105
246
|
}
|
|
106
|
-
return
|
|
247
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
107
248
|
}
|
|
108
249
|
});
|
|
109
250
|
}
|
|
110
|
-
function makeInvokeMethod(
|
|
111
|
-
var
|
|
112
|
-
return function (
|
|
113
|
-
if (
|
|
114
|
-
if (
|
|
115
|
-
if ("throw" ===
|
|
116
|
-
return
|
|
251
|
+
function makeInvokeMethod(e, r, n) {
|
|
252
|
+
var o = h;
|
|
253
|
+
return function (i, a) {
|
|
254
|
+
if (o === f) throw Error("Generator is already running");
|
|
255
|
+
if (o === s) {
|
|
256
|
+
if ("throw" === i) throw a;
|
|
257
|
+
return {
|
|
258
|
+
value: t,
|
|
259
|
+
done: !0
|
|
260
|
+
};
|
|
117
261
|
}
|
|
118
|
-
for (
|
|
119
|
-
var
|
|
120
|
-
if (
|
|
121
|
-
var
|
|
122
|
-
if (
|
|
123
|
-
if (
|
|
124
|
-
return
|
|
262
|
+
for (n.method = i, n.arg = a;;) {
|
|
263
|
+
var c = n.delegate;
|
|
264
|
+
if (c) {
|
|
265
|
+
var u = maybeInvokeDelegate(c, n);
|
|
266
|
+
if (u) {
|
|
267
|
+
if (u === y) continue;
|
|
268
|
+
return u;
|
|
125
269
|
}
|
|
126
270
|
}
|
|
127
|
-
if ("next" ===
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
} else "return" ===
|
|
131
|
-
|
|
132
|
-
var
|
|
133
|
-
if ("normal" ===
|
|
134
|
-
if (
|
|
271
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
272
|
+
if (o === h) throw o = s, n.arg;
|
|
273
|
+
n.dispatchException(n.arg);
|
|
274
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
275
|
+
o = f;
|
|
276
|
+
var p = tryCatch(e, r, n);
|
|
277
|
+
if ("normal" === p.type) {
|
|
278
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
135
279
|
return {
|
|
136
|
-
value:
|
|
137
|
-
done:
|
|
280
|
+
value: p.arg,
|
|
281
|
+
done: n.done
|
|
138
282
|
};
|
|
139
283
|
}
|
|
140
|
-
"throw" ===
|
|
284
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
141
285
|
}
|
|
142
286
|
};
|
|
143
287
|
}
|
|
144
|
-
function maybeInvokeDelegate(
|
|
145
|
-
var
|
|
146
|
-
|
|
147
|
-
if (
|
|
148
|
-
var
|
|
149
|
-
if ("throw" ===
|
|
150
|
-
var
|
|
151
|
-
return
|
|
288
|
+
function maybeInvokeDelegate(e, r) {
|
|
289
|
+
var n = r.method,
|
|
290
|
+
o = e.iterator[n];
|
|
291
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
292
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
293
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
294
|
+
var a = i.arg;
|
|
295
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
152
296
|
}
|
|
153
|
-
function pushTryEntry(
|
|
154
|
-
var
|
|
155
|
-
tryLoc:
|
|
297
|
+
function pushTryEntry(t) {
|
|
298
|
+
var e = {
|
|
299
|
+
tryLoc: t[0]
|
|
156
300
|
};
|
|
157
|
-
1 in
|
|
301
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
158
302
|
}
|
|
159
|
-
function resetTryEntry(
|
|
160
|
-
var
|
|
161
|
-
|
|
303
|
+
function resetTryEntry(t) {
|
|
304
|
+
var e = t.completion || {};
|
|
305
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
162
306
|
}
|
|
163
|
-
function Context(
|
|
307
|
+
function Context(t) {
|
|
164
308
|
this.tryEntries = [{
|
|
165
309
|
tryLoc: "root"
|
|
166
|
-
}],
|
|
310
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
167
311
|
}
|
|
168
|
-
function values(
|
|
169
|
-
if (
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
if ("function" == typeof
|
|
173
|
-
if (!isNaN(
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
for (; ++
|
|
177
|
-
return next.value =
|
|
312
|
+
function values(e) {
|
|
313
|
+
if (e || "" === e) {
|
|
314
|
+
var r = e[a];
|
|
315
|
+
if (r) return r.call(e);
|
|
316
|
+
if ("function" == typeof e.next) return e;
|
|
317
|
+
if (!isNaN(e.length)) {
|
|
318
|
+
var o = -1,
|
|
319
|
+
i = function next() {
|
|
320
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
321
|
+
return next.value = t, next.done = !0, next;
|
|
178
322
|
};
|
|
179
|
-
return
|
|
323
|
+
return i.next = i;
|
|
180
324
|
}
|
|
181
325
|
}
|
|
182
|
-
|
|
183
|
-
next: doneResult
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function doneResult() {
|
|
187
|
-
return {
|
|
188
|
-
value: undefined,
|
|
189
|
-
done: !0
|
|
190
|
-
};
|
|
326
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
191
327
|
}
|
|
192
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
328
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
193
329
|
value: GeneratorFunctionPrototype,
|
|
194
330
|
configurable: !0
|
|
195
|
-
}),
|
|
331
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
196
332
|
value: GeneratorFunction,
|
|
197
333
|
configurable: !0
|
|
198
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype,
|
|
199
|
-
var
|
|
200
|
-
return !!
|
|
201
|
-
},
|
|
202
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(
|
|
203
|
-
},
|
|
334
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
335
|
+
var e = "function" == typeof t && t.constructor;
|
|
336
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
337
|
+
}, e.mark = function (t) {
|
|
338
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
339
|
+
}, e.awrap = function (t) {
|
|
204
340
|
return {
|
|
205
|
-
__await:
|
|
341
|
+
__await: t
|
|
206
342
|
};
|
|
207
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype,
|
|
343
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
208
344
|
return this;
|
|
209
|
-
}),
|
|
210
|
-
void 0 ===
|
|
211
|
-
var
|
|
212
|
-
return
|
|
213
|
-
return
|
|
345
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
346
|
+
void 0 === i && (i = Promise);
|
|
347
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
348
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
349
|
+
return t.done ? t.value : a.next();
|
|
214
350
|
});
|
|
215
|
-
}, defineIteratorMethods(
|
|
351
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
216
352
|
return this;
|
|
217
|
-
}), define(
|
|
353
|
+
}), define(g, "toString", function () {
|
|
218
354
|
return "[object Generator]";
|
|
219
|
-
}),
|
|
220
|
-
var
|
|
221
|
-
|
|
222
|
-
for (var
|
|
223
|
-
return
|
|
224
|
-
for (;
|
|
225
|
-
var
|
|
226
|
-
if (
|
|
355
|
+
}), e.keys = function (t) {
|
|
356
|
+
var e = Object(t),
|
|
357
|
+
r = [];
|
|
358
|
+
for (var n in e) r.push(n);
|
|
359
|
+
return r.reverse(), function next() {
|
|
360
|
+
for (; r.length;) {
|
|
361
|
+
var t = r.pop();
|
|
362
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
227
363
|
}
|
|
228
364
|
return next.done = !0, next;
|
|
229
365
|
};
|
|
230
|
-
},
|
|
366
|
+
}, e.values = values, Context.prototype = {
|
|
231
367
|
constructor: Context,
|
|
232
|
-
reset: function (
|
|
233
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
|
368
|
+
reset: function (e) {
|
|
369
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
234
370
|
},
|
|
235
371
|
stop: function () {
|
|
236
372
|
this.done = !0;
|
|
237
|
-
var
|
|
238
|
-
if ("throw" ===
|
|
373
|
+
var t = this.tryEntries[0].completion;
|
|
374
|
+
if ("throw" === t.type) throw t.arg;
|
|
239
375
|
return this.rval;
|
|
240
376
|
},
|
|
241
|
-
dispatchException: function (
|
|
242
|
-
if (this.done) throw
|
|
243
|
-
var
|
|
244
|
-
function handle(
|
|
245
|
-
return
|
|
377
|
+
dispatchException: function (e) {
|
|
378
|
+
if (this.done) throw e;
|
|
379
|
+
var r = this;
|
|
380
|
+
function handle(n, o) {
|
|
381
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
246
382
|
}
|
|
247
|
-
for (var
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
if ("root" ===
|
|
251
|
-
if (
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
if (
|
|
255
|
-
if (this.prev <
|
|
256
|
-
if (this.prev <
|
|
257
|
-
} else if (
|
|
258
|
-
if (this.prev <
|
|
383
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
384
|
+
var i = this.tryEntries[o],
|
|
385
|
+
a = i.completion;
|
|
386
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
387
|
+
if (i.tryLoc <= this.prev) {
|
|
388
|
+
var c = n.call(i, "catchLoc"),
|
|
389
|
+
u = n.call(i, "finallyLoc");
|
|
390
|
+
if (c && u) {
|
|
391
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
392
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
393
|
+
} else if (c) {
|
|
394
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
259
395
|
} else {
|
|
260
|
-
if (!
|
|
261
|
-
if (this.prev <
|
|
396
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
397
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
262
398
|
}
|
|
263
399
|
}
|
|
264
400
|
}
|
|
265
401
|
},
|
|
266
|
-
abrupt: function (
|
|
267
|
-
for (var
|
|
268
|
-
var
|
|
269
|
-
if (
|
|
270
|
-
var
|
|
402
|
+
abrupt: function (t, e) {
|
|
403
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
404
|
+
var o = this.tryEntries[r];
|
|
405
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
406
|
+
var i = o;
|
|
271
407
|
break;
|
|
272
408
|
}
|
|
273
409
|
}
|
|
274
|
-
|
|
275
|
-
var
|
|
276
|
-
return
|
|
410
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
411
|
+
var a = i ? i.completion : {};
|
|
412
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
277
413
|
},
|
|
278
|
-
complete: function (
|
|
279
|
-
if ("throw" ===
|
|
280
|
-
return "break" ===
|
|
414
|
+
complete: function (t, e) {
|
|
415
|
+
if ("throw" === t.type) throw t.arg;
|
|
416
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
281
417
|
},
|
|
282
|
-
finish: function (
|
|
283
|
-
for (var
|
|
284
|
-
var
|
|
285
|
-
if (
|
|
418
|
+
finish: function (t) {
|
|
419
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
420
|
+
var r = this.tryEntries[e];
|
|
421
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
286
422
|
}
|
|
287
423
|
},
|
|
288
|
-
catch: function (
|
|
289
|
-
for (var
|
|
290
|
-
var
|
|
291
|
-
if (
|
|
292
|
-
var
|
|
293
|
-
if ("throw" ===
|
|
294
|
-
var
|
|
295
|
-
resetTryEntry(
|
|
424
|
+
catch: function (t) {
|
|
425
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
426
|
+
var r = this.tryEntries[e];
|
|
427
|
+
if (r.tryLoc === t) {
|
|
428
|
+
var n = r.completion;
|
|
429
|
+
if ("throw" === n.type) {
|
|
430
|
+
var o = n.arg;
|
|
431
|
+
resetTryEntry(r);
|
|
296
432
|
}
|
|
297
|
-
return
|
|
433
|
+
return o;
|
|
298
434
|
}
|
|
299
435
|
}
|
|
300
|
-
throw
|
|
436
|
+
throw Error("illegal catch attempt");
|
|
301
437
|
},
|
|
302
|
-
delegateYield: function (
|
|
438
|
+
delegateYield: function (e, r, n) {
|
|
303
439
|
return this.delegate = {
|
|
304
|
-
iterator: values(
|
|
305
|
-
resultName:
|
|
306
|
-
nextLoc:
|
|
307
|
-
}, "next" === this.method && (this.arg =
|
|
440
|
+
iterator: values(e),
|
|
441
|
+
resultName: r,
|
|
442
|
+
nextLoc: n
|
|
443
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
308
444
|
}
|
|
309
|
-
},
|
|
445
|
+
}, e;
|
|
310
446
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
} else {
|
|
322
|
-
Promise.resolve(value).then(_next, _throw);
|
|
447
|
+
function _setPrototypeOf(t, e) {
|
|
448
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
449
|
+
return t.__proto__ = e, t;
|
|
450
|
+
}, _setPrototypeOf(t, e);
|
|
451
|
+
}
|
|
452
|
+
function _unsupportedIterableToArray(r, a) {
|
|
453
|
+
if (r) {
|
|
454
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
455
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
456
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
323
457
|
}
|
|
324
458
|
}
|
|
325
|
-
function
|
|
459
|
+
function _wrapAsyncGenerator(e) {
|
|
326
460
|
return function () {
|
|
327
|
-
|
|
328
|
-
args = arguments;
|
|
329
|
-
return new Promise(function (resolve, reject) {
|
|
330
|
-
var gen = fn.apply(self, args);
|
|
331
|
-
function _next(value) {
|
|
332
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
333
|
-
}
|
|
334
|
-
function _throw(err) {
|
|
335
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
336
|
-
}
|
|
337
|
-
_next(undefined);
|
|
338
|
-
});
|
|
461
|
+
return new AsyncGenerator(e.apply(this, arguments));
|
|
339
462
|
};
|
|
340
463
|
}
|
|
341
|
-
function
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
464
|
+
function AsyncGenerator(e) {
|
|
465
|
+
var r, t;
|
|
466
|
+
function resume(r, t) {
|
|
467
|
+
try {
|
|
468
|
+
var n = e[r](t),
|
|
469
|
+
o = n.value,
|
|
470
|
+
u = o instanceof _OverloadYield;
|
|
471
|
+
Promise.resolve(u ? o.v : o).then(function (t) {
|
|
472
|
+
if (u) {
|
|
473
|
+
var i = "return" === r ? "return" : "next";
|
|
474
|
+
if (!o.k || t.done) return resume(i, t);
|
|
475
|
+
t = e[i](t).value;
|
|
348
476
|
}
|
|
349
|
-
|
|
477
|
+
settle(n.done ? "return" : "normal", t);
|
|
478
|
+
}, function (e) {
|
|
479
|
+
resume("throw", e);
|
|
480
|
+
});
|
|
481
|
+
} catch (e) {
|
|
482
|
+
settle("throw", e);
|
|
350
483
|
}
|
|
351
|
-
return target;
|
|
352
|
-
};
|
|
353
|
-
return _extends.apply(this, arguments);
|
|
354
|
-
}
|
|
355
|
-
function _inheritsLoose(subClass, superClass) {
|
|
356
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
357
|
-
subClass.prototype.constructor = subClass;
|
|
358
|
-
_setPrototypeOf(subClass, superClass);
|
|
359
|
-
}
|
|
360
|
-
function _getPrototypeOf(o) {
|
|
361
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
362
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
363
|
-
};
|
|
364
|
-
return _getPrototypeOf(o);
|
|
365
|
-
}
|
|
366
|
-
function _setPrototypeOf(o, p) {
|
|
367
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
368
|
-
o.__proto__ = p;
|
|
369
|
-
return o;
|
|
370
|
-
};
|
|
371
|
-
return _setPrototypeOf(o, p);
|
|
372
|
-
}
|
|
373
|
-
function _isNativeReflectConstruct() {
|
|
374
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
375
|
-
if (Reflect.construct.sham) return false;
|
|
376
|
-
if (typeof Proxy === "function") return true;
|
|
377
|
-
try {
|
|
378
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
379
|
-
return true;
|
|
380
|
-
} catch (e) {
|
|
381
|
-
return false;
|
|
382
484
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
485
|
+
function settle(e, n) {
|
|
486
|
+
switch (e) {
|
|
487
|
+
case "return":
|
|
488
|
+
r.resolve({
|
|
489
|
+
value: n,
|
|
490
|
+
done: !0
|
|
491
|
+
});
|
|
492
|
+
break;
|
|
493
|
+
case "throw":
|
|
494
|
+
r.reject(n);
|
|
495
|
+
break;
|
|
496
|
+
default:
|
|
497
|
+
r.resolve({
|
|
498
|
+
value: n,
|
|
499
|
+
done: !1
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
396
503
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
504
|
+
this._invoke = function (e, n) {
|
|
505
|
+
return new Promise(function (o, u) {
|
|
506
|
+
var i = {
|
|
507
|
+
key: e,
|
|
508
|
+
arg: n,
|
|
509
|
+
resolve: o,
|
|
510
|
+
reject: u,
|
|
511
|
+
next: null
|
|
512
|
+
};
|
|
513
|
+
t ? t = t.next = i : (r = t = i, resume(e, n));
|
|
514
|
+
});
|
|
515
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
401
516
|
}
|
|
402
|
-
function
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
517
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
|
|
518
|
+
return this;
|
|
519
|
+
}, AsyncGenerator.prototype.next = function (e) {
|
|
520
|
+
return this._invoke("next", e);
|
|
521
|
+
}, AsyncGenerator.prototype.throw = function (e) {
|
|
522
|
+
return this._invoke("throw", e);
|
|
523
|
+
}, AsyncGenerator.prototype.return = function (e) {
|
|
524
|
+
return this._invoke("return", e);
|
|
525
|
+
};
|
|
526
|
+
function _wrapNativeSuper(t) {
|
|
527
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
528
|
+
return _wrapNativeSuper = function (t) {
|
|
529
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
530
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
531
|
+
if (void 0 !== r) {
|
|
532
|
+
if (r.has(t)) return r.get(t);
|
|
533
|
+
r.set(t, Wrapper);
|
|
412
534
|
}
|
|
413
535
|
function Wrapper() {
|
|
414
|
-
return _construct(
|
|
536
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
415
537
|
}
|
|
416
|
-
Wrapper.prototype = Object.create(
|
|
538
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
417
539
|
constructor: {
|
|
418
540
|
value: Wrapper,
|
|
419
|
-
enumerable:
|
|
420
|
-
writable:
|
|
421
|
-
configurable:
|
|
541
|
+
enumerable: !1,
|
|
542
|
+
writable: !0,
|
|
543
|
+
configurable: !0
|
|
422
544
|
}
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
};
|
|
426
|
-
return _wrapNativeSuper(Class);
|
|
427
|
-
}
|
|
428
|
-
function _assertThisInitialized(self) {
|
|
429
|
-
if (self === void 0) {
|
|
430
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
431
|
-
}
|
|
432
|
-
return self;
|
|
433
|
-
}
|
|
434
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
435
|
-
if (!o) return;
|
|
436
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
437
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
438
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
439
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
440
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
441
|
-
}
|
|
442
|
-
function _arrayLikeToArray(arr, len) {
|
|
443
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
444
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
445
|
-
return arr2;
|
|
545
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
546
|
+
}, _wrapNativeSuper(t);
|
|
446
547
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
548
|
+
|
|
549
|
+
/*
|
|
550
|
+
* assert.ts
|
|
551
|
+
*
|
|
552
|
+
* Created by Dr. Maximillian Dornseif 2025-04-11 in datastore-api 6.0.1
|
|
553
|
+
*/
|
|
554
|
+
/**
|
|
555
|
+
* Generates an type assertion message for the given `value`
|
|
556
|
+
*
|
|
557
|
+
* @param value value being type-checked
|
|
558
|
+
* @param type the expected value as a string; eg 'string', 'boolean', 'number'
|
|
559
|
+
* @param variableName the name of the variable being type-checked
|
|
560
|
+
* @param additionalMessage further information on failure
|
|
561
|
+
*/
|
|
562
|
+
var AssertionMessage = function AssertionMessage(value, type, variableName, additionalMessage) {
|
|
563
|
+
var message = variableName ? variableName + " must be of type '" + type + "', '" + getType(value) + "' provided" : "expected value of type '" + type + "', '" + getType(value) + "' provided";
|
|
564
|
+
return additionalMessage ? message + ": " + additionalMessage : message;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Type-checks the provided `value` to be a symbol, throws an Error if it is not
|
|
568
|
+
*
|
|
569
|
+
* @param value the value to type-check as a symbol
|
|
570
|
+
* @param variableName the name of the variable to be type-checked
|
|
571
|
+
* @param additionalMessage further information on failure
|
|
572
|
+
* @throws {Error}
|
|
573
|
+
*/
|
|
574
|
+
function assertIsKey(value, variableName, additionalMessage) {
|
|
575
|
+
assert(Datastore.isKey(value), AssertionMessage(value, "Key", variableName, additionalMessage));
|
|
464
576
|
}
|
|
465
577
|
|
|
466
578
|
/** @ignore */
|
|
@@ -587,24 +699,49 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
587
699
|
assertIsObject(ret, 'entity[Datastore.KEY]/entity._keyStr', "Entity is missing the datastore Key: " + JSON.stringify(ent));
|
|
588
700
|
return ret;
|
|
589
701
|
}
|
|
590
|
-
/** `fixKeys()` is called for all [[IDstoreEntry]]
|
|
702
|
+
/** `fixKeys()` is called for all [[IDstoreEntry]] returned from [[Dstore]].
|
|
591
703
|
*
|
|
592
704
|
* Is ensures that besides `entity[Datastore.KEY]` there is `_keyStr` to be leveraged by [[readKey]].
|
|
593
705
|
*
|
|
594
706
|
* @internal
|
|
595
707
|
*/;
|
|
596
708
|
_proto.fixKeys = function fixKeys(entities) {
|
|
597
|
-
var
|
|
709
|
+
var _this2 = this;
|
|
598
710
|
entities.forEach(function (x) {
|
|
599
711
|
if (!!(x != null && x[Datastore.KEY]) && x[Datastore.KEY]) {
|
|
600
712
|
assertIsDefined(x[Datastore.KEY]);
|
|
601
713
|
assertIsObject(x[Datastore.KEY]);
|
|
602
714
|
// Old TypesScript has problems with symbols as a property
|
|
603
|
-
x._keyStr =
|
|
715
|
+
x._keyStr = _this2.keySerialize(x[Datastore.KEY]);
|
|
604
716
|
}
|
|
605
717
|
});
|
|
606
718
|
return entities;
|
|
607
719
|
}
|
|
720
|
+
/** this is for save, insert, update and upsert and ensures _kkeyStr() handling.
|
|
721
|
+
*
|
|
722
|
+
*/;
|
|
723
|
+
_proto.prepareEntitiesForDatastore = function prepareEntitiesForDatastore(entities) {
|
|
724
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(entities), _step2; !(_step2 = _iterator2()).done;) {
|
|
725
|
+
var e = _step2.value;
|
|
726
|
+
assertIsObject(e.key);
|
|
727
|
+
assertIsObject(e.data);
|
|
728
|
+
this.fixKeys([e.data]);
|
|
729
|
+
e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;
|
|
730
|
+
e.data = _extends({}, e.data, {
|
|
731
|
+
_keyStr: undefined
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
/** this is for save, insert, update and upsert and ensures _kkeyStr() handling.
|
|
736
|
+
*
|
|
737
|
+
*/;
|
|
738
|
+
_proto.prepareEntitiesFromDatastore = function prepareEntitiesFromDatastore(entities) {
|
|
739
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(entities), _step3; !(_step3 = _iterator3()).done;) {
|
|
740
|
+
var e = _step3.value;
|
|
741
|
+
e.data[Datastore.KEY] = e.key;
|
|
742
|
+
this.fixKeys([e.data]);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
608
745
|
/** `get()` reads a [[IDstoreEntry]] from the Datastore.
|
|
609
746
|
*
|
|
610
747
|
* It returns [[IDstoreEntry]] or `null` if not found.
|
|
@@ -622,7 +759,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
622
759
|
_proto.get =
|
|
623
760
|
/*#__PURE__*/
|
|
624
761
|
function () {
|
|
625
|
-
var _get = /*#__PURE__*/_asyncToGenerator(
|
|
762
|
+
var _get = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(key) {
|
|
626
763
|
var result;
|
|
627
764
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
628
765
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -667,7 +804,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
667
804
|
_proto.getMulti =
|
|
668
805
|
/*#__PURE__*/
|
|
669
806
|
function () {
|
|
670
|
-
var _getMulti = /*#__PURE__*/_asyncToGenerator(
|
|
807
|
+
var _getMulti = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(keys) {
|
|
671
808
|
var results, metricEnd, _yield$this$getDoT$ge, entities, entitiesByKey;
|
|
672
809
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
673
810
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -764,7 +901,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
764
901
|
_proto.set =
|
|
765
902
|
/*#__PURE__*/
|
|
766
903
|
function () {
|
|
767
|
-
var _set = /*#__PURE__*/_asyncToGenerator(
|
|
904
|
+
var _set = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, data) {
|
|
768
905
|
var saveEntity;
|
|
769
906
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
770
907
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -829,26 +966,17 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
829
966
|
_proto.save =
|
|
830
967
|
/*#__PURE__*/
|
|
831
968
|
function () {
|
|
832
|
-
var _save = /*#__PURE__*/_asyncToGenerator(
|
|
833
|
-
var ret, metricEnd
|
|
969
|
+
var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(entities) {
|
|
970
|
+
var ret, metricEnd;
|
|
834
971
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
835
972
|
while (1) switch (_context4.prev = _context4.next) {
|
|
836
973
|
case 0:
|
|
837
974
|
assertIsArray(entities);
|
|
838
975
|
metricEnd = metricHistogram.startTimer();
|
|
839
976
|
_context4.prev = 2;
|
|
977
|
+
this.prepareEntitiesForDatastore(entities);
|
|
840
978
|
// Within Transaction we don't get any answer here!
|
|
841
979
|
// [ { mutationResults: [ [Object], [Object] ], indexUpdates: 51 } ]
|
|
842
|
-
for (_iterator = _createForOfIteratorHelperLoose(entities); !(_step = _iterator()).done;) {
|
|
843
|
-
e = _step.value;
|
|
844
|
-
assertIsObject(e.key);
|
|
845
|
-
assertIsObject(e.data);
|
|
846
|
-
this.fixKeys([e.data]);
|
|
847
|
-
e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;
|
|
848
|
-
e.data = _extends({}, e.data, {
|
|
849
|
-
_keyStr: undefined
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
980
|
_context4.next = 6;
|
|
853
981
|
return this.getDoT().save(entities);
|
|
854
982
|
case 6:
|
|
@@ -860,11 +988,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
860
988
|
_context4.t0 = undefined;
|
|
861
989
|
case 9:
|
|
862
990
|
ret = _context4.t0;
|
|
863
|
-
|
|
864
|
-
_e = _step2.value;
|
|
865
|
-
_e.data[Datastore.KEY] = _e.key;
|
|
866
|
-
this.fixKeys([_e.data]);
|
|
867
|
-
}
|
|
991
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
868
992
|
_context4.next = 19;
|
|
869
993
|
break;
|
|
870
994
|
case 13:
|
|
@@ -918,7 +1042,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
918
1042
|
_proto.insert =
|
|
919
1043
|
/*#__PURE__*/
|
|
920
1044
|
function () {
|
|
921
|
-
var _insert = /*#__PURE__*/_asyncToGenerator(
|
|
1045
|
+
var _insert = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(entities) {
|
|
922
1046
|
var ret, metricEnd;
|
|
923
1047
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
924
1048
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -926,43 +1050,45 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
926
1050
|
assertIsArray(entities);
|
|
927
1051
|
metricEnd = metricHistogram.startTimer();
|
|
928
1052
|
_context5.prev = 2;
|
|
929
|
-
|
|
1053
|
+
this.prepareEntitiesForDatastore(entities);
|
|
1054
|
+
_context5.next = 6;
|
|
930
1055
|
return this.getDoT().insert(entities);
|
|
931
|
-
case
|
|
1056
|
+
case 6:
|
|
932
1057
|
_context5.t0 = _context5.sent;
|
|
933
1058
|
if (_context5.t0) {
|
|
934
|
-
_context5.next =
|
|
1059
|
+
_context5.next = 9;
|
|
935
1060
|
break;
|
|
936
1061
|
}
|
|
937
1062
|
_context5.t0 = undefined;
|
|
938
|
-
case
|
|
1063
|
+
case 9:
|
|
939
1064
|
ret = _context5.t0;
|
|
940
|
-
|
|
1065
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
1066
|
+
_context5.next = 19;
|
|
941
1067
|
break;
|
|
942
|
-
case
|
|
943
|
-
_context5.prev =
|
|
1068
|
+
case 13:
|
|
1069
|
+
_context5.prev = 13;
|
|
944
1070
|
_context5.t1 = _context5["catch"](2);
|
|
945
1071
|
// console.error(error)
|
|
946
1072
|
metricFailureCounter.inc({
|
|
947
1073
|
operation: 'insert'
|
|
948
1074
|
});
|
|
949
|
-
_context5.next =
|
|
1075
|
+
_context5.next = 18;
|
|
950
1076
|
return setImmediate();
|
|
951
|
-
case
|
|
1077
|
+
case 18:
|
|
952
1078
|
throw new DstoreError('datastore.insert error', _context5.t1);
|
|
953
|
-
case
|
|
954
|
-
_context5.prev =
|
|
1079
|
+
case 19:
|
|
1080
|
+
_context5.prev = 19;
|
|
955
1081
|
metricEnd({
|
|
956
1082
|
operation: 'insert'
|
|
957
1083
|
});
|
|
958
|
-
return _context5.finish(
|
|
959
|
-
case
|
|
1084
|
+
return _context5.finish(19);
|
|
1085
|
+
case 22:
|
|
960
1086
|
return _context5.abrupt("return", ret);
|
|
961
|
-
case
|
|
1087
|
+
case 23:
|
|
962
1088
|
case "end":
|
|
963
1089
|
return _context5.stop();
|
|
964
1090
|
}
|
|
965
|
-
}, _callee5, this, [[2,
|
|
1091
|
+
}, _callee5, this, [[2, 13, 19, 22]]);
|
|
966
1092
|
}));
|
|
967
1093
|
function insert(_x6) {
|
|
968
1094
|
return _insert.apply(this, arguments);
|
|
@@ -990,7 +1116,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
990
1116
|
_proto.update =
|
|
991
1117
|
/*#__PURE__*/
|
|
992
1118
|
function () {
|
|
993
|
-
var _update = /*#__PURE__*/_asyncToGenerator(
|
|
1119
|
+
var _update = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(entities) {
|
|
994
1120
|
var ret, metricEnd;
|
|
995
1121
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
996
1122
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -1004,43 +1130,45 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1004
1130
|
});
|
|
1005
1131
|
metricEnd = metricHistogram.startTimer();
|
|
1006
1132
|
_context6.prev = 4;
|
|
1007
|
-
|
|
1133
|
+
this.prepareEntitiesForDatastore(entities);
|
|
1134
|
+
_context6.next = 8;
|
|
1008
1135
|
return this.getDoT().update(entities);
|
|
1009
|
-
case
|
|
1136
|
+
case 8:
|
|
1010
1137
|
_context6.t0 = _context6.sent;
|
|
1011
1138
|
if (_context6.t0) {
|
|
1012
|
-
_context6.next =
|
|
1139
|
+
_context6.next = 11;
|
|
1013
1140
|
break;
|
|
1014
1141
|
}
|
|
1015
1142
|
_context6.t0 = undefined;
|
|
1016
|
-
case
|
|
1143
|
+
case 11:
|
|
1017
1144
|
ret = _context6.t0;
|
|
1018
|
-
|
|
1145
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
1146
|
+
_context6.next = 21;
|
|
1019
1147
|
break;
|
|
1020
|
-
case
|
|
1021
|
-
_context6.prev =
|
|
1148
|
+
case 15:
|
|
1149
|
+
_context6.prev = 15;
|
|
1022
1150
|
_context6.t1 = _context6["catch"](4);
|
|
1023
1151
|
// console.error(error)
|
|
1024
1152
|
metricFailureCounter.inc({
|
|
1025
1153
|
operation: 'update'
|
|
1026
1154
|
});
|
|
1027
|
-
_context6.next =
|
|
1155
|
+
_context6.next = 20;
|
|
1028
1156
|
return setImmediate();
|
|
1029
|
-
case
|
|
1157
|
+
case 20:
|
|
1030
1158
|
throw new DstoreError('datastore.update error', _context6.t1);
|
|
1031
|
-
case
|
|
1032
|
-
_context6.prev =
|
|
1159
|
+
case 21:
|
|
1160
|
+
_context6.prev = 21;
|
|
1033
1161
|
metricEnd({
|
|
1034
1162
|
operation: 'update'
|
|
1035
1163
|
});
|
|
1036
|
-
return _context6.finish(
|
|
1037
|
-
case
|
|
1164
|
+
return _context6.finish(21);
|
|
1165
|
+
case 24:
|
|
1038
1166
|
return _context6.abrupt("return", ret);
|
|
1039
|
-
case
|
|
1167
|
+
case 25:
|
|
1040
1168
|
case "end":
|
|
1041
1169
|
return _context6.stop();
|
|
1042
1170
|
}
|
|
1043
|
-
}, _callee6, this, [[4,
|
|
1171
|
+
}, _callee6, this, [[4, 15, 21, 24]]);
|
|
1044
1172
|
}));
|
|
1045
1173
|
function update(_x7) {
|
|
1046
1174
|
return _update.apply(this, arguments);
|
|
@@ -1064,7 +1192,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1064
1192
|
_proto["delete"] =
|
|
1065
1193
|
/*#__PURE__*/
|
|
1066
1194
|
function () {
|
|
1067
|
-
var _delete2 = /*#__PURE__*/_asyncToGenerator(
|
|
1195
|
+
var _delete2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(keys) {
|
|
1068
1196
|
var ret, metricEnd;
|
|
1069
1197
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1070
1198
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -1137,7 +1265,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1137
1265
|
}
|
|
1138
1266
|
};
|
|
1139
1267
|
_proto.runQuery = /*#__PURE__*/function () {
|
|
1140
|
-
var _runQuery = /*#__PURE__*/_asyncToGenerator(
|
|
1268
|
+
var _runQuery = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(query) {
|
|
1141
1269
|
var ret, metricEnd, _yield$this$getDoT$ru, entities, info;
|
|
1142
1270
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1143
1271
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -1189,14 +1317,15 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1189
1317
|
* @param selection selectionList of [[Query]] select() calls.
|
|
1190
1318
|
* @param cursor unsupported so far.
|
|
1191
1319
|
*
|
|
1320
|
+
* @throws [[DstoreError]]
|
|
1192
1321
|
* @category Datastore Drop-In
|
|
1193
1322
|
*/
|
|
1194
1323
|
;
|
|
1195
1324
|
_proto.query =
|
|
1196
1325
|
/*#__PURE__*/
|
|
1197
1326
|
function () {
|
|
1198
|
-
var _query = /*#__PURE__*/_asyncToGenerator(
|
|
1199
|
-
var q,
|
|
1327
|
+
var _query = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(kindName, filters, limit, ordering, selection, cursor) {
|
|
1328
|
+
var q, _iterator4, _step4, filterSpec, _iterator5, _step5, orderField, ret;
|
|
1200
1329
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1201
1330
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1202
1331
|
case 0:
|
|
@@ -1217,14 +1346,14 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1217
1346
|
assertIsNumber(limit);
|
|
1218
1347
|
_context9.prev = 7;
|
|
1219
1348
|
q = this.createQuery(kindName);
|
|
1220
|
-
for (
|
|
1221
|
-
filterSpec =
|
|
1349
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(filters); !(_step4 = _iterator4()).done;) {
|
|
1350
|
+
filterSpec = _step4.value;
|
|
1222
1351
|
assertIsObject(filterSpec);
|
|
1223
1352
|
// @ts-ignore
|
|
1224
1353
|
q.filter(_construct(PropertyFilter, filterSpec));
|
|
1225
1354
|
}
|
|
1226
|
-
for (
|
|
1227
|
-
orderField =
|
|
1355
|
+
for (_iterator5 = _createForOfIteratorHelperLoose(ordering); !(_step5 = _iterator5()).done;) {
|
|
1356
|
+
orderField = _step5.value;
|
|
1228
1357
|
q.order(orderField);
|
|
1229
1358
|
}
|
|
1230
1359
|
if (limit > 0) {
|
|
@@ -1234,32 +1363,165 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1234
1363
|
q.select(selection);
|
|
1235
1364
|
}
|
|
1236
1365
|
_context9.next = 15;
|
|
1237
|
-
return this.runQuery(q);
|
|
1366
|
+
return this.getDoT().runQuery(q);
|
|
1238
1367
|
case 15:
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1368
|
+
ret = _context9.sent;
|
|
1369
|
+
return _context9.abrupt("return", [this.fixKeys(ret[0]), ret[1]]);
|
|
1370
|
+
case 19:
|
|
1371
|
+
_context9.prev = 19;
|
|
1242
1372
|
_context9.t0 = _context9["catch"](7);
|
|
1243
|
-
_context9.next =
|
|
1373
|
+
_context9.next = 23;
|
|
1244
1374
|
return setImmediate();
|
|
1245
|
-
case
|
|
1375
|
+
case 23:
|
|
1246
1376
|
throw new DstoreError('datastore.query error', _context9.t0, {
|
|
1247
1377
|
kindName: kindName,
|
|
1248
1378
|
filters: filters,
|
|
1249
1379
|
limit: limit,
|
|
1250
1380
|
ordering: ordering
|
|
1251
1381
|
});
|
|
1252
|
-
case
|
|
1382
|
+
case 24:
|
|
1253
1383
|
case "end":
|
|
1254
1384
|
return _context9.stop();
|
|
1255
1385
|
}
|
|
1256
|
-
}, _callee9, this, [[7,
|
|
1386
|
+
}, _callee9, this, [[7, 19]]);
|
|
1257
1387
|
}));
|
|
1258
1388
|
function query(_x10, _x11, _x12, _x13, _x14, _x15) {
|
|
1259
1389
|
return _query.apply(this, arguments);
|
|
1260
1390
|
}
|
|
1261
1391
|
return query;
|
|
1262
1392
|
}()
|
|
1393
|
+
/** `iterate()` is a modernized version of `query()`.
|
|
1394
|
+
*
|
|
1395
|
+
* It takes a Parameter object and returns an AsyncIterable.
|
|
1396
|
+
* Entities returned have been processed by `fixKeys()`.
|
|
1397
|
+
*
|
|
1398
|
+
* Can be used with `for await` loops like this:
|
|
1399
|
+
*
|
|
1400
|
+
* ```typescript
|
|
1401
|
+
* for await (const entity of dstore.iterate({ kindName: 'p_ReservierungsAbruf', filters: [['verbucht', '=', true]]})) {
|
|
1402
|
+
* console.log(entity)
|
|
1403
|
+
* }
|
|
1404
|
+
* ```
|
|
1405
|
+
*
|
|
1406
|
+
* @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) ("Table") which should be searched.
|
|
1407
|
+
* @param filters List of [[Query]] filter() calls.
|
|
1408
|
+
* @param limit Maximum Number of Results to return.
|
|
1409
|
+
* @param ordering List of [[Query]] order() calls.
|
|
1410
|
+
* @param selection selectionList of [[Query]] select() calls.
|
|
1411
|
+
*
|
|
1412
|
+
* @throws [[DstoreError]]
|
|
1413
|
+
* @category Additional
|
|
1414
|
+
*/
|
|
1415
|
+
;
|
|
1416
|
+
_proto.iterate = function iterate(_ref) {
|
|
1417
|
+
var _this = this;
|
|
1418
|
+
var kindName = _ref.kindName,
|
|
1419
|
+
_ref$filters = _ref.filters,
|
|
1420
|
+
filters = _ref$filters === void 0 ? [] : _ref$filters,
|
|
1421
|
+
_ref$limit = _ref.limit,
|
|
1422
|
+
limit = _ref$limit === void 0 ? 2500 : _ref$limit,
|
|
1423
|
+
_ref$ordering = _ref.ordering,
|
|
1424
|
+
ordering = _ref$ordering === void 0 ? [] : _ref$ordering,
|
|
1425
|
+
_ref$selection = _ref.selection,
|
|
1426
|
+
selection = _ref$selection === void 0 ? [] : _ref$selection;
|
|
1427
|
+
return _wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
1428
|
+
var q, _iterator6, _step6, filterSpec, _iterator7, _step7, orderField, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _entity, ret;
|
|
1429
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1430
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1431
|
+
case 0:
|
|
1432
|
+
assertIsString(kindName);
|
|
1433
|
+
assertIsArray(filters);
|
|
1434
|
+
assertIsNumber(limit);
|
|
1435
|
+
_context10.prev = 3;
|
|
1436
|
+
q = _this.getDoT().createQuery(kindName);
|
|
1437
|
+
for (_iterator6 = _createForOfIteratorHelperLoose(filters); !(_step6 = _iterator6()).done;) {
|
|
1438
|
+
filterSpec = _step6.value;
|
|
1439
|
+
assertIsObject(filterSpec);
|
|
1440
|
+
// @ts-ignore
|
|
1441
|
+
q.filter(_construct(PropertyFilter, filterSpec));
|
|
1442
|
+
}
|
|
1443
|
+
for (_iterator7 = _createForOfIteratorHelperLoose(ordering); !(_step7 = _iterator7()).done;) {
|
|
1444
|
+
orderField = _step7.value;
|
|
1445
|
+
q.order(orderField);
|
|
1446
|
+
}
|
|
1447
|
+
if (limit > 0) {
|
|
1448
|
+
q.limit(limit);
|
|
1449
|
+
}
|
|
1450
|
+
if (selection.length > 0) {
|
|
1451
|
+
q.select(selection);
|
|
1452
|
+
}
|
|
1453
|
+
_iteratorAbruptCompletion = false;
|
|
1454
|
+
_didIteratorError = false;
|
|
1455
|
+
_context10.prev = 11;
|
|
1456
|
+
_iterator = _asyncIterator(q.runStream());
|
|
1457
|
+
case 13:
|
|
1458
|
+
_context10.next = 15;
|
|
1459
|
+
return _awaitAsyncGenerator(_iterator.next());
|
|
1460
|
+
case 15:
|
|
1461
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context10.sent).done)) {
|
|
1462
|
+
_context10.next = 25;
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1465
|
+
_entity = _step.value;
|
|
1466
|
+
ret = _this.fixKeys([_entity])[0];
|
|
1467
|
+
assertIsDefined(ret, 'datastore.iterate: entity is undefined');
|
|
1468
|
+
assertIsKey(ret[Datastore.KEY]);
|
|
1469
|
+
_context10.next = 22;
|
|
1470
|
+
return ret;
|
|
1471
|
+
case 22:
|
|
1472
|
+
_iteratorAbruptCompletion = false;
|
|
1473
|
+
_context10.next = 13;
|
|
1474
|
+
break;
|
|
1475
|
+
case 25:
|
|
1476
|
+
_context10.next = 31;
|
|
1477
|
+
break;
|
|
1478
|
+
case 27:
|
|
1479
|
+
_context10.prev = 27;
|
|
1480
|
+
_context10.t0 = _context10["catch"](11);
|
|
1481
|
+
_didIteratorError = true;
|
|
1482
|
+
_iteratorError = _context10.t0;
|
|
1483
|
+
case 31:
|
|
1484
|
+
_context10.prev = 31;
|
|
1485
|
+
_context10.prev = 32;
|
|
1486
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
1487
|
+
_context10.next = 36;
|
|
1488
|
+
break;
|
|
1489
|
+
}
|
|
1490
|
+
_context10.next = 36;
|
|
1491
|
+
return _awaitAsyncGenerator(_iterator["return"]());
|
|
1492
|
+
case 36:
|
|
1493
|
+
_context10.prev = 36;
|
|
1494
|
+
if (!_didIteratorError) {
|
|
1495
|
+
_context10.next = 39;
|
|
1496
|
+
break;
|
|
1497
|
+
}
|
|
1498
|
+
throw _iteratorError;
|
|
1499
|
+
case 39:
|
|
1500
|
+
return _context10.finish(36);
|
|
1501
|
+
case 40:
|
|
1502
|
+
return _context10.finish(31);
|
|
1503
|
+
case 41:
|
|
1504
|
+
_context10.next = 48;
|
|
1505
|
+
break;
|
|
1506
|
+
case 43:
|
|
1507
|
+
_context10.prev = 43;
|
|
1508
|
+
_context10.t1 = _context10["catch"](3);
|
|
1509
|
+
_context10.next = 47;
|
|
1510
|
+
return _awaitAsyncGenerator(setImmediate());
|
|
1511
|
+
case 47:
|
|
1512
|
+
throw new DstoreError('datastore.query error', _context10.t1, {
|
|
1513
|
+
kindName: kindName,
|
|
1514
|
+
filters: filters,
|
|
1515
|
+
limit: limit,
|
|
1516
|
+
ordering: ordering
|
|
1517
|
+
});
|
|
1518
|
+
case 48:
|
|
1519
|
+
case "end":
|
|
1520
|
+
return _context10.stop();
|
|
1521
|
+
}
|
|
1522
|
+
}, _callee10, null, [[3, 43], [11, 27, 31, 41], [32,, 36, 40]]);
|
|
1523
|
+
}))();
|
|
1524
|
+
}
|
|
1263
1525
|
/** Allocate one ID in the Datastore.
|
|
1264
1526
|
*
|
|
1265
1527
|
* Currently (late 2021) there is no documentation provided by Google for the underlying node function.
|
|
@@ -1270,31 +1532,30 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1270
1532
|
* The ID is a string encoded large number. This function will never return the same ID twice for any given Datastore.
|
|
1271
1533
|
* If you provide a kindName the ID will be namespaced to this kind.
|
|
1272
1534
|
* In fact the generated ID is namespaced via an incomplete [[Key]] of the given Kind.
|
|
1273
|
-
|
|
1274
|
-
;
|
|
1535
|
+
*/;
|
|
1275
1536
|
_proto.allocateOneId =
|
|
1276
1537
|
/*#__PURE__*/
|
|
1277
1538
|
function () {
|
|
1278
|
-
var _allocateOneId = /*#__PURE__*/_asyncToGenerator(
|
|
1539
|
+
var _allocateOneId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(kindName) {
|
|
1279
1540
|
var ret;
|
|
1280
|
-
return _regeneratorRuntime().wrap(function
|
|
1281
|
-
while (1) switch (
|
|
1541
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1542
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1282
1543
|
case 0:
|
|
1283
1544
|
if (kindName === void 0) {
|
|
1284
1545
|
kindName = 'Numbering';
|
|
1285
1546
|
}
|
|
1286
1547
|
assertIsString(kindName);
|
|
1287
|
-
|
|
1548
|
+
_context11.next = 4;
|
|
1288
1549
|
return this.datastore.allocateIds(this.key([kindName]), 1);
|
|
1289
1550
|
case 4:
|
|
1290
|
-
ret =
|
|
1551
|
+
ret = _context11.sent[0][0].id;
|
|
1291
1552
|
assertIsString(ret);
|
|
1292
|
-
return
|
|
1553
|
+
return _context11.abrupt("return", ret);
|
|
1293
1554
|
case 7:
|
|
1294
1555
|
case "end":
|
|
1295
|
-
return
|
|
1556
|
+
return _context11.stop();
|
|
1296
1557
|
}
|
|
1297
|
-
},
|
|
1558
|
+
}, _callee11, this);
|
|
1298
1559
|
}));
|
|
1299
1560
|
function allocateOneId(_x16) {
|
|
1300
1561
|
return _allocateOneId.apply(this, arguments);
|
|
@@ -1313,72 +1574,72 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1313
1574
|
_proto.runInTransaction =
|
|
1314
1575
|
/*#__PURE__*/
|
|
1315
1576
|
function () {
|
|
1316
|
-
var _runInTransaction = /*#__PURE__*/_asyncToGenerator(
|
|
1577
|
+
var _runInTransaction = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(func) {
|
|
1317
1578
|
var ret, transaction;
|
|
1318
|
-
return _regeneratorRuntime().wrap(function
|
|
1319
|
-
while (1) switch (
|
|
1579
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1580
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1320
1581
|
case 0:
|
|
1321
1582
|
transaction = this.datastore.transaction();
|
|
1322
|
-
|
|
1323
|
-
return transactionAsyncLocalStorage.run(transaction, /*#__PURE__*/_asyncToGenerator(
|
|
1583
|
+
_context13.next = 3;
|
|
1584
|
+
return transactionAsyncLocalStorage.run(transaction, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1324
1585
|
var _yield$transaction$ru, transactionInfo, transactionRunApiResponse, commitApiResponse, rollbackInfo;
|
|
1325
|
-
return _regeneratorRuntime().wrap(function
|
|
1326
|
-
while (1) switch (
|
|
1586
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1587
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1327
1588
|
case 0:
|
|
1328
|
-
|
|
1589
|
+
_context12.next = 2;
|
|
1329
1590
|
return transaction.run();
|
|
1330
1591
|
case 2:
|
|
1331
|
-
_yield$transaction$ru =
|
|
1592
|
+
_yield$transaction$ru = _context12.sent;
|
|
1332
1593
|
transactionInfo = _yield$transaction$ru[0];
|
|
1333
1594
|
transactionRunApiResponse = _yield$transaction$ru[1];
|
|
1334
|
-
|
|
1335
|
-
|
|
1595
|
+
_context12.prev = 5;
|
|
1596
|
+
_context12.next = 8;
|
|
1336
1597
|
return func();
|
|
1337
1598
|
case 8:
|
|
1338
|
-
ret =
|
|
1339
|
-
|
|
1599
|
+
ret = _context12.sent;
|
|
1600
|
+
_context12.next = 20;
|
|
1340
1601
|
break;
|
|
1341
1602
|
case 11:
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1603
|
+
_context12.prev = 11;
|
|
1604
|
+
_context12.t0 = _context12["catch"](5);
|
|
1605
|
+
_context12.next = 15;
|
|
1345
1606
|
return transaction.rollback();
|
|
1346
1607
|
case 15:
|
|
1347
|
-
rollbackInfo =
|
|
1348
|
-
debug('Transaction failed, rollback initiated: %O %O %O %O', transactionInfo, transactionRunApiResponse, rollbackInfo,
|
|
1349
|
-
|
|
1608
|
+
rollbackInfo = _context12.sent;
|
|
1609
|
+
debug('Transaction failed, rollback initiated: %O %O %O %O', transactionInfo, transactionRunApiResponse, rollbackInfo, _context12.t0);
|
|
1610
|
+
_context12.next = 19;
|
|
1350
1611
|
return setImmediate();
|
|
1351
1612
|
case 19:
|
|
1352
|
-
throw new DstoreError('datastore.transaction execution error',
|
|
1613
|
+
throw new DstoreError('datastore.transaction execution error', _context12.t0);
|
|
1353
1614
|
case 20:
|
|
1354
|
-
|
|
1355
|
-
|
|
1615
|
+
_context12.prev = 20;
|
|
1616
|
+
_context12.next = 23;
|
|
1356
1617
|
return transaction.commit();
|
|
1357
1618
|
case 23:
|
|
1358
|
-
commitApiResponse =
|
|
1359
|
-
|
|
1619
|
+
commitApiResponse = _context12.sent[0];
|
|
1620
|
+
_context12.next = 32;
|
|
1360
1621
|
break;
|
|
1361
1622
|
case 26:
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
debug('Transaction commit failed: %O %O %O %O ret: %O', transactionInfo, transactionRunApiResponse, commitApiResponse,
|
|
1365
|
-
|
|
1623
|
+
_context12.prev = 26;
|
|
1624
|
+
_context12.t1 = _context12["catch"](20);
|
|
1625
|
+
debug('Transaction commit failed: %O %O %O %O ret: %O', transactionInfo, transactionRunApiResponse, commitApiResponse, _context12.t1, ret);
|
|
1626
|
+
_context12.next = 31;
|
|
1366
1627
|
return setImmediate();
|
|
1367
1628
|
case 31:
|
|
1368
|
-
throw new DstoreError('datastore.transaction execution error',
|
|
1629
|
+
throw new DstoreError('datastore.transaction execution error', _context12.t1);
|
|
1369
1630
|
case 32:
|
|
1370
1631
|
case "end":
|
|
1371
|
-
return
|
|
1632
|
+
return _context12.stop();
|
|
1372
1633
|
}
|
|
1373
|
-
},
|
|
1634
|
+
}, _callee12, null, [[5, 11], [20, 26]]);
|
|
1374
1635
|
})));
|
|
1375
1636
|
case 3:
|
|
1376
|
-
return
|
|
1637
|
+
return _context13.abrupt("return", ret);
|
|
1377
1638
|
case 4:
|
|
1378
1639
|
case "end":
|
|
1379
|
-
return
|
|
1640
|
+
return _context13.stop();
|
|
1380
1641
|
}
|
|
1381
|
-
},
|
|
1642
|
+
}, _callee13, this);
|
|
1382
1643
|
}));
|
|
1383
1644
|
function runInTransaction(_x17) {
|
|
1384
1645
|
return _runInTransaction.apply(this, arguments);
|
|
@@ -1388,58 +1649,29 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1388
1649
|
return Dstore;
|
|
1389
1650
|
}();
|
|
1390
1651
|
var DstoreError = /*#__PURE__*/function (_Error) {
|
|
1391
|
-
_inheritsLoose(DstoreError, _Error);
|
|
1392
1652
|
function DstoreError(message, originalError, extensions) {
|
|
1393
|
-
var
|
|
1394
|
-
var
|
|
1395
|
-
|
|
1653
|
+
var _this3$stack, _originalError$stack, _this3$stack2;
|
|
1654
|
+
var _this3;
|
|
1655
|
+
_this3 = _Error.call(this, message + ": " + (originalError == null ? void 0 : originalError.message)) || this;
|
|
1396
1656
|
// if no name provided, use the default. defineProperty ensures that it stays non-enumerable
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
if (!
|
|
1400
|
-
Object.defineProperty(
|
|
1657
|
+
_this3.extensions = void 0;
|
|
1658
|
+
_this3.originalError = void 0;
|
|
1659
|
+
if (!_this3.name) {
|
|
1660
|
+
Object.defineProperty(_this3, 'name', {
|
|
1401
1661
|
value: 'DstoreError'
|
|
1402
1662
|
});
|
|
1403
1663
|
}
|
|
1404
1664
|
// metadata: Metadata { internalRepr: Map(0) {}, options: {} },
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1665
|
+
_this3.originalError = originalError;
|
|
1666
|
+
_this3.extensions = _extends({}, extensions);
|
|
1667
|
+
_this3.stack = (((_this3$stack = _this3.stack) == null ? void 0 : _this3$stack.split('\n')[0]) || '') + '\n' + ((originalError == null || (_originalError$stack = originalError.stack) == null || (_originalError$stack = _originalError$stack.split('\n')) == null || (_originalError$stack = _originalError$stack.slice(1)) == null ? void 0 : _originalError$stack.join('\n')) || '') + '\n' + (((_this3$stack2 = _this3.stack) == null || (_this3$stack2 = _this3$stack2.split('\n')) == null || (_this3$stack2 = _this3$stack2.slice(1)) == null ? void 0 : _this3$stack2.join('\n')) || '');
|
|
1408
1668
|
// These are usually present on Datastore Errors
|
|
1409
1669
|
// logger.error({ err: originalError, extensions }, message);
|
|
1410
|
-
return
|
|
1670
|
+
return _this3;
|
|
1411
1671
|
}
|
|
1672
|
+
_inheritsLoose(DstoreError, _Error);
|
|
1412
1673
|
return DstoreError;
|
|
1413
|
-
}(
|
|
1414
|
-
|
|
1415
|
-
/*
|
|
1416
|
-
* assert.ts
|
|
1417
|
-
*
|
|
1418
|
-
* Created by Dr. Maximillian Dornseif 2025-04-11 in datastore-api 6.0.1
|
|
1419
|
-
*/
|
|
1420
|
-
/**
|
|
1421
|
-
* Generates an type assertion message for the given `value`
|
|
1422
|
-
*
|
|
1423
|
-
* @param value value being type-checked
|
|
1424
|
-
* @param type the expected value as a string; eg 'string', 'boolean', 'number'
|
|
1425
|
-
* @param variableName the name of the variable being type-checked
|
|
1426
|
-
* @param additionalMessage further information on failure
|
|
1427
|
-
*/
|
|
1428
|
-
var AssertionMessage = function AssertionMessage(value, type, variableName, additionalMessage) {
|
|
1429
|
-
var message = variableName ? variableName + " must be of type '" + type + "', '" + getType(value) + "' provided" : "expected value of type '" + type + "', '" + getType(value) + "' provided";
|
|
1430
|
-
return additionalMessage ? message + ": " + additionalMessage : message;
|
|
1431
|
-
};
|
|
1432
|
-
/**
|
|
1433
|
-
* Type-checks the provided `value` to be a symbol, throws an Error if it is not
|
|
1434
|
-
*
|
|
1435
|
-
* @param value the value to type-check as a symbol
|
|
1436
|
-
* @param variableName the name of the variable to be type-checked
|
|
1437
|
-
* @param additionalMessage further information on failure
|
|
1438
|
-
* @throws {Error}
|
|
1439
|
-
*/
|
|
1440
|
-
function assertIsKey(value, variableName, additionalMessage) {
|
|
1441
|
-
assert(Datastore.isKey(value), AssertionMessage(value, "Key", variableName, additionalMessage));
|
|
1442
|
-
}
|
|
1674
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
1443
1675
|
|
|
1444
1676
|
export { Dstore, DstoreError, KEYSYM, assertIsKey };
|
|
1445
1677
|
//# sourceMappingURL=datastore-api.esm.js.map
|