@aws-amplify/datastore-storage-adapter 2.0.49-api-v6-models.b3abc9b.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -4
- package/dist/aws-amplify-datastore-sqlite-adapter-expo.js +2087 -1243
- package/dist/aws-amplify-datastore-sqlite-adapter-expo.js.map +1 -1
- package/dist/aws-amplify-datastore-sqlite-adapter-expo.min.js +2 -1
- package/dist/aws-amplify-datastore-sqlite-adapter-expo.min.js.LICENSE.txt +1 -0
- package/dist/aws-amplify-datastore-sqlite-adapter-expo.min.js.map +1 -1
- package/dist/aws-amplify-datastore-storage-adapter.js +2105 -1205
- package/dist/aws-amplify-datastore-storage-adapter.js.map +1 -1
- package/dist/aws-amplify-datastore-storage-adapter.min.js +2 -1
- package/dist/aws-amplify-datastore-storage-adapter.min.js.LICENSE.txt +1 -0
- package/dist/aws-amplify-datastore-storage-adapter.min.js.map +1 -1
- package/jest.setup.js +7 -0
- package/lib/ExpoSQLiteAdapter/ExpoSQLiteAdapter.js +4 -4
- package/lib/ExpoSQLiteAdapter/ExpoSQLiteAdapter.js.map +1 -1
- package/lib/ExpoSQLiteAdapter/ExpoSQLiteDatabase.js +159 -272
- package/lib/ExpoSQLiteAdapter/ExpoSQLiteDatabase.js.map +1 -1
- package/lib/SQLiteAdapter/SQLiteAdapter.js +4 -4
- package/lib/SQLiteAdapter/SQLiteAdapter.js.map +1 -1
- package/lib/SQLiteAdapter/SQLiteDatabase.js +86 -239
- package/lib/SQLiteAdapter/SQLiteDatabase.js.map +1 -1
- package/lib/common/CommonSQLiteAdapter.js +222 -399
- package/lib/common/CommonSQLiteAdapter.js.map +1 -1
- package/lib/common/SQLiteUtils.d.ts +1 -1
- package/lib/common/SQLiteUtils.js +120 -148
- package/lib/common/SQLiteUtils.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib-esm/ExpoSQLiteAdapter/ExpoSQLiteAdapter.js +1 -1
- package/lib-esm/ExpoSQLiteAdapter/ExpoSQLiteAdapter.js.map +1 -1
- package/lib-esm/ExpoSQLiteAdapter/ExpoSQLiteDatabase.js +156 -269
- package/lib-esm/ExpoSQLiteAdapter/ExpoSQLiteDatabase.js.map +1 -1
- package/lib-esm/SQLiteAdapter/SQLiteAdapter.js +1 -1
- package/lib-esm/SQLiteAdapter/SQLiteAdapter.js.map +1 -1
- package/lib-esm/SQLiteAdapter/SQLiteDatabase.js +84 -238
- package/lib-esm/SQLiteAdapter/SQLiteDatabase.js.map +1 -1
- package/lib-esm/common/CommonSQLiteAdapter.js +220 -398
- package/lib-esm/common/CommonSQLiteAdapter.js.map +1 -1
- package/lib-esm/common/SQLiteUtils.d.ts +1 -1
- package/lib-esm/common/SQLiteUtils.js +119 -147
- package/lib-esm/common/SQLiteUtils.js.map +1 -1
- package/lib-esm/common/constants.js +1 -1
- package/lib-esm/common/constants.js.map +1 -1
- package/package.json +10 -4
- package/src/ExpoSQLiteAdapter/ExpoSQLiteDatabase.ts +2 -2
- package/src/SQLiteAdapter/SQLiteDatabase.ts +3 -3
- package/src/common/CommonSQLiteAdapter.ts +2 -2
|
@@ -43,13 +43,490 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43
43
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
44
44
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
45
45
|
/* harmony export */ });
|
|
46
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.mjs");
|
|
47
46
|
/* harmony import */ var react_native_sqlite_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-native-sqlite-storage */ "react-native-sqlite-storage");
|
|
48
47
|
/* harmony import */ var react_native_sqlite_storage__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_native_sqlite_storage__WEBPACK_IMPORTED_MODULE_0__);
|
|
49
48
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
50
49
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
51
50
|
/* harmony import */ var _common_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/constants */ "./lib-esm/common/constants.js");
|
|
51
|
+
function _typeof(o) {
|
|
52
|
+
"@babel/helpers - typeof";
|
|
52
53
|
|
|
54
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
55
|
+
return typeof o;
|
|
56
|
+
} : function (o) {
|
|
57
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
58
|
+
}, _typeof(o);
|
|
59
|
+
}
|
|
60
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
61
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
62
|
+
if (!it) {
|
|
63
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
64
|
+
if (it) o = it;
|
|
65
|
+
var i = 0;
|
|
66
|
+
var F = function F() {};
|
|
67
|
+
return {
|
|
68
|
+
s: F,
|
|
69
|
+
n: function n() {
|
|
70
|
+
if (i >= o.length) return {
|
|
71
|
+
done: true
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
done: false,
|
|
75
|
+
value: o[i++]
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
e: function e(_e) {
|
|
79
|
+
throw _e;
|
|
80
|
+
},
|
|
81
|
+
f: F
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
85
|
+
}
|
|
86
|
+
var normalCompletion = true,
|
|
87
|
+
didErr = false,
|
|
88
|
+
err;
|
|
89
|
+
return {
|
|
90
|
+
s: function s() {
|
|
91
|
+
it = it.call(o);
|
|
92
|
+
},
|
|
93
|
+
n: function n() {
|
|
94
|
+
var step = it.next();
|
|
95
|
+
normalCompletion = step.done;
|
|
96
|
+
return step;
|
|
97
|
+
},
|
|
98
|
+
e: function e(_e2) {
|
|
99
|
+
didErr = true;
|
|
100
|
+
err = _e2;
|
|
101
|
+
},
|
|
102
|
+
f: function f() {
|
|
103
|
+
try {
|
|
104
|
+
if (!normalCompletion && it["return"] != null) it["return"]();
|
|
105
|
+
} finally {
|
|
106
|
+
if (didErr) throw err;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function _slicedToArray(arr, i) {
|
|
112
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
113
|
+
}
|
|
114
|
+
function _nonIterableRest() {
|
|
115
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
116
|
+
}
|
|
117
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
118
|
+
if (!o) return;
|
|
119
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
120
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
121
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
122
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
123
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
124
|
+
}
|
|
125
|
+
function _arrayLikeToArray(arr, len) {
|
|
126
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
127
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
128
|
+
return arr2;
|
|
129
|
+
}
|
|
130
|
+
function _iterableToArrayLimit(r, l) {
|
|
131
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
132
|
+
if (null != t) {
|
|
133
|
+
var e,
|
|
134
|
+
n,
|
|
135
|
+
i,
|
|
136
|
+
u,
|
|
137
|
+
a = [],
|
|
138
|
+
f = !0,
|
|
139
|
+
o = !1;
|
|
140
|
+
try {
|
|
141
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
142
|
+
if (Object(t) !== t) return;
|
|
143
|
+
f = !1;
|
|
144
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
145
|
+
} catch (r) {
|
|
146
|
+
o = !0, n = r;
|
|
147
|
+
} finally {
|
|
148
|
+
try {
|
|
149
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
150
|
+
} finally {
|
|
151
|
+
if (o) throw n;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return a;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function _arrayWithHoles(arr) {
|
|
158
|
+
if (Array.isArray(arr)) return arr;
|
|
159
|
+
}
|
|
160
|
+
function _regeneratorRuntime() {
|
|
161
|
+
"use strict";
|
|
162
|
+
|
|
163
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
164
|
+
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
165
|
+
return e;
|
|
166
|
+
};
|
|
167
|
+
var t,
|
|
168
|
+
e = {},
|
|
169
|
+
r = Object.prototype,
|
|
170
|
+
n = r.hasOwnProperty,
|
|
171
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
172
|
+
t[e] = r.value;
|
|
173
|
+
},
|
|
174
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
175
|
+
a = i.iterator || "@@iterator",
|
|
176
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
177
|
+
u = i.toStringTag || "@@toStringTag";
|
|
178
|
+
function define(t, e, r) {
|
|
179
|
+
return Object.defineProperty(t, e, {
|
|
180
|
+
value: r,
|
|
181
|
+
enumerable: !0,
|
|
182
|
+
configurable: !0,
|
|
183
|
+
writable: !0
|
|
184
|
+
}), t[e];
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
define({}, "");
|
|
188
|
+
} catch (t) {
|
|
189
|
+
define = function define(t, e, r) {
|
|
190
|
+
return t[e] = r;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function wrap(t, e, r, n) {
|
|
194
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
195
|
+
a = Object.create(i.prototype),
|
|
196
|
+
c = new Context(n || []);
|
|
197
|
+
return o(a, "_invoke", {
|
|
198
|
+
value: makeInvokeMethod(t, r, c)
|
|
199
|
+
}), a;
|
|
200
|
+
}
|
|
201
|
+
function tryCatch(t, e, r) {
|
|
202
|
+
try {
|
|
203
|
+
return {
|
|
204
|
+
type: "normal",
|
|
205
|
+
arg: t.call(e, r)
|
|
206
|
+
};
|
|
207
|
+
} catch (t) {
|
|
208
|
+
return {
|
|
209
|
+
type: "throw",
|
|
210
|
+
arg: t
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
e.wrap = wrap;
|
|
215
|
+
var h = "suspendedStart",
|
|
216
|
+
l = "suspendedYield",
|
|
217
|
+
f = "executing",
|
|
218
|
+
s = "completed",
|
|
219
|
+
y = {};
|
|
220
|
+
function Generator() {}
|
|
221
|
+
function GeneratorFunction() {}
|
|
222
|
+
function GeneratorFunctionPrototype() {}
|
|
223
|
+
var p = {};
|
|
224
|
+
define(p, a, function () {
|
|
225
|
+
return this;
|
|
226
|
+
});
|
|
227
|
+
var d = Object.getPrototypeOf,
|
|
228
|
+
v = d && d(d(values([])));
|
|
229
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
230
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
231
|
+
function defineIteratorMethods(t) {
|
|
232
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
233
|
+
define(t, e, function (t) {
|
|
234
|
+
return this._invoke(e, t);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function AsyncIterator(t, e) {
|
|
239
|
+
function invoke(r, o, i, a) {
|
|
240
|
+
var c = tryCatch(t[r], t, o);
|
|
241
|
+
if ("throw" !== c.type) {
|
|
242
|
+
var u = c.arg,
|
|
243
|
+
h = u.value;
|
|
244
|
+
return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
245
|
+
invoke("next", t, i, a);
|
|
246
|
+
}, function (t) {
|
|
247
|
+
invoke("throw", t, i, a);
|
|
248
|
+
}) : e.resolve(h).then(function (t) {
|
|
249
|
+
u.value = t, i(u);
|
|
250
|
+
}, function (t) {
|
|
251
|
+
return invoke("throw", t, i, a);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
a(c.arg);
|
|
255
|
+
}
|
|
256
|
+
var r;
|
|
257
|
+
o(this, "_invoke", {
|
|
258
|
+
value: function value(t, n) {
|
|
259
|
+
function callInvokeWithMethodAndArg() {
|
|
260
|
+
return new e(function (e, r) {
|
|
261
|
+
invoke(t, n, e, r);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function makeInvokeMethod(e, r, n) {
|
|
269
|
+
var o = h;
|
|
270
|
+
return function (i, a) {
|
|
271
|
+
if (o === f) throw new Error("Generator is already running");
|
|
272
|
+
if (o === s) {
|
|
273
|
+
if ("throw" === i) throw a;
|
|
274
|
+
return {
|
|
275
|
+
value: t,
|
|
276
|
+
done: !0
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
for (n.method = i, n.arg = a;;) {
|
|
280
|
+
var c = n.delegate;
|
|
281
|
+
if (c) {
|
|
282
|
+
var u = maybeInvokeDelegate(c, n);
|
|
283
|
+
if (u) {
|
|
284
|
+
if (u === y) continue;
|
|
285
|
+
return u;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
289
|
+
if (o === h) throw o = s, n.arg;
|
|
290
|
+
n.dispatchException(n.arg);
|
|
291
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
292
|
+
o = f;
|
|
293
|
+
var p = tryCatch(e, r, n);
|
|
294
|
+
if ("normal" === p.type) {
|
|
295
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
296
|
+
return {
|
|
297
|
+
value: p.arg,
|
|
298
|
+
done: n.done
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function maybeInvokeDelegate(e, r) {
|
|
306
|
+
var n = r.method,
|
|
307
|
+
o = e.iterator[n];
|
|
308
|
+
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;
|
|
309
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
310
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
311
|
+
var a = i.arg;
|
|
312
|
+
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);
|
|
313
|
+
}
|
|
314
|
+
function pushTryEntry(t) {
|
|
315
|
+
var e = {
|
|
316
|
+
tryLoc: t[0]
|
|
317
|
+
};
|
|
318
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
319
|
+
}
|
|
320
|
+
function resetTryEntry(t) {
|
|
321
|
+
var e = t.completion || {};
|
|
322
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
323
|
+
}
|
|
324
|
+
function Context(t) {
|
|
325
|
+
this.tryEntries = [{
|
|
326
|
+
tryLoc: "root"
|
|
327
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
328
|
+
}
|
|
329
|
+
function values(e) {
|
|
330
|
+
if (e || "" === e) {
|
|
331
|
+
var r = e[a];
|
|
332
|
+
if (r) return r.call(e);
|
|
333
|
+
if ("function" == typeof e.next) return e;
|
|
334
|
+
if (!isNaN(e.length)) {
|
|
335
|
+
var o = -1,
|
|
336
|
+
i = function next() {
|
|
337
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
338
|
+
return next.value = t, next.done = !0, next;
|
|
339
|
+
};
|
|
340
|
+
return i.next = i;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
throw new TypeError(_typeof(e) + " is not iterable");
|
|
344
|
+
}
|
|
345
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
346
|
+
value: GeneratorFunctionPrototype,
|
|
347
|
+
configurable: !0
|
|
348
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
349
|
+
value: GeneratorFunction,
|
|
350
|
+
configurable: !0
|
|
351
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
352
|
+
var e = "function" == typeof t && t.constructor;
|
|
353
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
354
|
+
}, e.mark = function (t) {
|
|
355
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
356
|
+
}, e.awrap = function (t) {
|
|
357
|
+
return {
|
|
358
|
+
__await: t
|
|
359
|
+
};
|
|
360
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
361
|
+
return this;
|
|
362
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
363
|
+
void 0 === i && (i = Promise);
|
|
364
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
365
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
366
|
+
return t.done ? t.value : a.next();
|
|
367
|
+
});
|
|
368
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
369
|
+
return this;
|
|
370
|
+
}), define(g, "toString", function () {
|
|
371
|
+
return "[object Generator]";
|
|
372
|
+
}), e.keys = function (t) {
|
|
373
|
+
var e = Object(t),
|
|
374
|
+
r = [];
|
|
375
|
+
for (var n in e) r.push(n);
|
|
376
|
+
return r.reverse(), function next() {
|
|
377
|
+
for (; r.length;) {
|
|
378
|
+
var t = r.pop();
|
|
379
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
380
|
+
}
|
|
381
|
+
return next.done = !0, next;
|
|
382
|
+
};
|
|
383
|
+
}, e.values = values, Context.prototype = {
|
|
384
|
+
constructor: Context,
|
|
385
|
+
reset: function reset(e) {
|
|
386
|
+
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);
|
|
387
|
+
},
|
|
388
|
+
stop: function stop() {
|
|
389
|
+
this.done = !0;
|
|
390
|
+
var t = this.tryEntries[0].completion;
|
|
391
|
+
if ("throw" === t.type) throw t.arg;
|
|
392
|
+
return this.rval;
|
|
393
|
+
},
|
|
394
|
+
dispatchException: function dispatchException(e) {
|
|
395
|
+
if (this.done) throw e;
|
|
396
|
+
var r = this;
|
|
397
|
+
function handle(n, o) {
|
|
398
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
399
|
+
}
|
|
400
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
401
|
+
var i = this.tryEntries[o],
|
|
402
|
+
a = i.completion;
|
|
403
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
404
|
+
if (i.tryLoc <= this.prev) {
|
|
405
|
+
var c = n.call(i, "catchLoc"),
|
|
406
|
+
u = n.call(i, "finallyLoc");
|
|
407
|
+
if (c && u) {
|
|
408
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
409
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
410
|
+
} else if (c) {
|
|
411
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
412
|
+
} else {
|
|
413
|
+
if (!u) throw new Error("try statement without catch or finally");
|
|
414
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
abrupt: function abrupt(t, e) {
|
|
420
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
421
|
+
var o = this.tryEntries[r];
|
|
422
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
423
|
+
var i = o;
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
428
|
+
var a = i ? i.completion : {};
|
|
429
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
430
|
+
},
|
|
431
|
+
complete: function complete(t, e) {
|
|
432
|
+
if ("throw" === t.type) throw t.arg;
|
|
433
|
+
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;
|
|
434
|
+
},
|
|
435
|
+
finish: function finish(t) {
|
|
436
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
437
|
+
var r = this.tryEntries[e];
|
|
438
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
"catch": function _catch(t) {
|
|
442
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
443
|
+
var r = this.tryEntries[e];
|
|
444
|
+
if (r.tryLoc === t) {
|
|
445
|
+
var n = r.completion;
|
|
446
|
+
if ("throw" === n.type) {
|
|
447
|
+
var o = n.arg;
|
|
448
|
+
resetTryEntry(r);
|
|
449
|
+
}
|
|
450
|
+
return o;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
throw new Error("illegal catch attempt");
|
|
454
|
+
},
|
|
455
|
+
delegateYield: function delegateYield(e, r, n) {
|
|
456
|
+
return this.delegate = {
|
|
457
|
+
iterator: values(e),
|
|
458
|
+
resultName: r,
|
|
459
|
+
nextLoc: n
|
|
460
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
461
|
+
}
|
|
462
|
+
}, e;
|
|
463
|
+
}
|
|
464
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
465
|
+
try {
|
|
466
|
+
var info = gen[key](arg);
|
|
467
|
+
var value = info.value;
|
|
468
|
+
} catch (error) {
|
|
469
|
+
reject(error);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
if (info.done) {
|
|
473
|
+
resolve(value);
|
|
474
|
+
} else {
|
|
475
|
+
Promise.resolve(value).then(_next, _throw);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
function _asyncToGenerator(fn) {
|
|
479
|
+
return function () {
|
|
480
|
+
var self = this,
|
|
481
|
+
args = arguments;
|
|
482
|
+
return new Promise(function (resolve, reject) {
|
|
483
|
+
var gen = fn.apply(self, args);
|
|
484
|
+
function _next(value) {
|
|
485
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
486
|
+
}
|
|
487
|
+
function _throw(err) {
|
|
488
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
489
|
+
}
|
|
490
|
+
_next(undefined);
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
function _classCallCheck(instance, Constructor) {
|
|
495
|
+
if (!(instance instanceof Constructor)) {
|
|
496
|
+
throw new TypeError("Cannot call a class as a function");
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function _defineProperties(target, props) {
|
|
500
|
+
for (var i = 0; i < props.length; i++) {
|
|
501
|
+
var descriptor = props[i];
|
|
502
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
503
|
+
descriptor.configurable = true;
|
|
504
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
505
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
509
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
510
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
511
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
512
|
+
writable: false
|
|
513
|
+
});
|
|
514
|
+
return Constructor;
|
|
515
|
+
}
|
|
516
|
+
function _toPropertyKey(arg) {
|
|
517
|
+
var key = _toPrimitive(arg, "string");
|
|
518
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
519
|
+
}
|
|
520
|
+
function _toPrimitive(input, hint) {
|
|
521
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
522
|
+
var prim = input[Symbol.toPrimitive];
|
|
523
|
+
if (prim !== undefined) {
|
|
524
|
+
var res = prim.call(input, hint || "default");
|
|
525
|
+
if (_typeof(res) !== "object") return res;
|
|
526
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
527
|
+
}
|
|
528
|
+
return (hint === "string" ? String : Number)(input);
|
|
529
|
+
}
|
|
53
530
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
54
531
|
// SPDX-License-Identifier: Apache-2.0
|
|
55
532
|
|
|
@@ -72,278 +549,352 @@ get the result of an `executeSql` command inside of a transaction
|
|
|
72
549
|
(see the batchQuery method below)
|
|
73
550
|
|
|
74
551
|
*/
|
|
75
|
-
var SQLiteDatabase =
|
|
76
|
-
function SQLiteDatabase() {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
552
|
+
var SQLiteDatabase = /*#__PURE__*/function () {
|
|
553
|
+
function SQLiteDatabase() {
|
|
554
|
+
_classCallCheck(this, SQLiteDatabase);
|
|
555
|
+
}
|
|
556
|
+
_createClass(SQLiteDatabase, [{
|
|
557
|
+
key: "init",
|
|
558
|
+
value: function () {
|
|
559
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
560
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
561
|
+
while (1) switch (_context.prev = _context.next) {
|
|
562
|
+
case 0:
|
|
563
|
+
if (this.db) {
|
|
564
|
+
_context.next = 4;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
_context.next = 3;
|
|
568
|
+
return react_native_sqlite_storage__WEBPACK_IMPORTED_MODULE_0___default().openDatabase({
|
|
569
|
+
name: _common_constants__WEBPACK_IMPORTED_MODULE_2__.DB_NAME,
|
|
570
|
+
location: 'default'
|
|
571
|
+
});
|
|
572
|
+
case 3:
|
|
573
|
+
this.db = _context.sent;
|
|
574
|
+
case 4:
|
|
575
|
+
case "end":
|
|
576
|
+
return _context.stop();
|
|
577
|
+
}
|
|
578
|
+
}, _callee, this);
|
|
579
|
+
}));
|
|
580
|
+
function init() {
|
|
581
|
+
return _init.apply(this, arguments);
|
|
582
|
+
}
|
|
583
|
+
return init;
|
|
584
|
+
}()
|
|
585
|
+
}, {
|
|
586
|
+
key: "createSchema",
|
|
587
|
+
value: function () {
|
|
588
|
+
var _createSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(statements) {
|
|
589
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
590
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
591
|
+
case 0:
|
|
592
|
+
_context2.next = 2;
|
|
593
|
+
return this.executeStatements(statements);
|
|
594
|
+
case 2:
|
|
595
|
+
return _context2.abrupt("return", _context2.sent);
|
|
596
|
+
case 3:
|
|
597
|
+
case "end":
|
|
598
|
+
return _context2.stop();
|
|
599
|
+
}
|
|
600
|
+
}, _callee2, this);
|
|
601
|
+
}));
|
|
602
|
+
function createSchema(_x) {
|
|
603
|
+
return _createSchema.apply(this, arguments);
|
|
604
|
+
}
|
|
605
|
+
return createSchema;
|
|
606
|
+
}()
|
|
607
|
+
}, {
|
|
608
|
+
key: "clear",
|
|
609
|
+
value: function () {
|
|
610
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
611
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
612
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
613
|
+
case 0:
|
|
614
|
+
_context3.next = 2;
|
|
615
|
+
return this.closeDB();
|
|
616
|
+
case 2:
|
|
617
|
+
logger.debug('Deleting database');
|
|
618
|
+
_context3.next = 5;
|
|
619
|
+
return react_native_sqlite_storage__WEBPACK_IMPORTED_MODULE_0___default().deleteDatabase({
|
|
620
|
+
name: _common_constants__WEBPACK_IMPORTED_MODULE_2__.DB_NAME,
|
|
621
|
+
location: 'default'
|
|
622
|
+
});
|
|
623
|
+
case 5:
|
|
624
|
+
logger.debug('Database deleted');
|
|
625
|
+
case 6:
|
|
626
|
+
case "end":
|
|
627
|
+
return _context3.stop();
|
|
628
|
+
}
|
|
629
|
+
}, _callee3, this);
|
|
630
|
+
}));
|
|
631
|
+
function clear() {
|
|
632
|
+
return _clear.apply(this, arguments);
|
|
633
|
+
}
|
|
634
|
+
return clear;
|
|
635
|
+
}()
|
|
636
|
+
}, {
|
|
637
|
+
key: "get",
|
|
638
|
+
value: function () {
|
|
639
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(statement, params) {
|
|
640
|
+
var results;
|
|
641
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
642
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
643
|
+
case 0:
|
|
644
|
+
_context4.next = 2;
|
|
645
|
+
return this.getAll(statement, params);
|
|
646
|
+
case 2:
|
|
647
|
+
results = _context4.sent;
|
|
648
|
+
return _context4.abrupt("return", results[0]);
|
|
649
|
+
case 4:
|
|
650
|
+
case "end":
|
|
651
|
+
return _context4.stop();
|
|
652
|
+
}
|
|
653
|
+
}, _callee4, this);
|
|
654
|
+
}));
|
|
655
|
+
function get(_x2, _x3) {
|
|
656
|
+
return _get.apply(this, arguments);
|
|
657
|
+
}
|
|
658
|
+
return get;
|
|
659
|
+
}()
|
|
660
|
+
}, {
|
|
661
|
+
key: "getAll",
|
|
662
|
+
value: function () {
|
|
663
|
+
var _getAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(statement, params) {
|
|
664
|
+
var _yield$this$db$execut, _yield$this$db$execut2, resultSet, result;
|
|
665
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
666
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
667
|
+
case 0:
|
|
668
|
+
_context5.next = 2;
|
|
669
|
+
return this.db.executeSql(statement, params);
|
|
670
|
+
case 2:
|
|
671
|
+
_yield$this$db$execut = _context5.sent;
|
|
672
|
+
_yield$this$db$execut2 = _slicedToArray(_yield$this$db$execut, 1);
|
|
673
|
+
resultSet = _yield$this$db$execut2[0];
|
|
674
|
+
result = resultSet && resultSet.rows && resultSet.rows.length && resultSet.rows.raw && resultSet.rows.raw();
|
|
675
|
+
return _context5.abrupt("return", result || []);
|
|
676
|
+
case 7:
|
|
677
|
+
case "end":
|
|
678
|
+
return _context5.stop();
|
|
679
|
+
}
|
|
680
|
+
}, _callee5, this);
|
|
681
|
+
}));
|
|
682
|
+
function getAll(_x4, _x5) {
|
|
683
|
+
return _getAll.apply(this, arguments);
|
|
684
|
+
}
|
|
685
|
+
return getAll;
|
|
686
|
+
}()
|
|
687
|
+
}, {
|
|
688
|
+
key: "save",
|
|
689
|
+
value: function () {
|
|
690
|
+
var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(statement, params) {
|
|
691
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
692
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
693
|
+
case 0:
|
|
694
|
+
_context6.next = 2;
|
|
695
|
+
return this.db.executeSql(statement, params);
|
|
696
|
+
case 2:
|
|
697
|
+
case "end":
|
|
698
|
+
return _context6.stop();
|
|
699
|
+
}
|
|
700
|
+
}, _callee6, this);
|
|
701
|
+
}));
|
|
702
|
+
function save(_x6, _x7) {
|
|
703
|
+
return _save.apply(this, arguments);
|
|
704
|
+
}
|
|
705
|
+
return save;
|
|
706
|
+
}()
|
|
707
|
+
}, {
|
|
708
|
+
key: "batchQuery",
|
|
709
|
+
value: function () {
|
|
710
|
+
var _batchQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(queryParameterizedStatements) {
|
|
711
|
+
var results;
|
|
712
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
713
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
714
|
+
case 0:
|
|
715
|
+
results = [];
|
|
716
|
+
_context7.next = 3;
|
|
717
|
+
return this.db.readTransaction(function (tx) {
|
|
718
|
+
var _iterator = _createForOfIteratorHelper(queryParameterizedStatements),
|
|
719
|
+
_step;
|
|
199
720
|
try {
|
|
200
|
-
|
|
721
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
722
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
723
|
+
statement = _step$value[0],
|
|
724
|
+
params = _step$value[1];
|
|
725
|
+
tx.executeSql(statement, params, function (_, res) {
|
|
726
|
+
results.push(res.rows.raw()[0]);
|
|
727
|
+
}, logger.warn);
|
|
728
|
+
}
|
|
729
|
+
} catch (err) {
|
|
730
|
+
_iterator.e(err);
|
|
201
731
|
} finally {
|
|
202
|
-
|
|
732
|
+
_iterator.f();
|
|
203
733
|
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
error: e_2_1
|
|
230
|
-
};
|
|
231
|
-
} finally {
|
|
734
|
+
});
|
|
735
|
+
case 3:
|
|
736
|
+
return _context7.abrupt("return", results);
|
|
737
|
+
case 4:
|
|
738
|
+
case "end":
|
|
739
|
+
return _context7.stop();
|
|
740
|
+
}
|
|
741
|
+
}, _callee7, this);
|
|
742
|
+
}));
|
|
743
|
+
function batchQuery(_x8) {
|
|
744
|
+
return _batchQuery.apply(this, arguments);
|
|
745
|
+
}
|
|
746
|
+
return batchQuery;
|
|
747
|
+
}()
|
|
748
|
+
}, {
|
|
749
|
+
key: "batchSave",
|
|
750
|
+
value: function () {
|
|
751
|
+
var _batchSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(saveParameterizedStatements, deleteParameterizedStatements) {
|
|
752
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
753
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
754
|
+
case 0:
|
|
755
|
+
_context8.next = 2;
|
|
756
|
+
return this.db.transaction(function (tx) {
|
|
757
|
+
var _iterator2 = _createForOfIteratorHelper(saveParameterizedStatements),
|
|
758
|
+
_step2;
|
|
232
759
|
try {
|
|
233
|
-
|
|
760
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
761
|
+
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
762
|
+
statement = _step2$value[0],
|
|
763
|
+
params = _step2$value[1];
|
|
764
|
+
tx.executeSql(statement, params);
|
|
765
|
+
}
|
|
766
|
+
} catch (err) {
|
|
767
|
+
_iterator2.e(err);
|
|
234
768
|
} finally {
|
|
235
|
-
|
|
769
|
+
_iterator2.f();
|
|
236
770
|
}
|
|
771
|
+
});
|
|
772
|
+
case 2:
|
|
773
|
+
if (!deleteParameterizedStatements) {
|
|
774
|
+
_context8.next = 5;
|
|
775
|
+
break;
|
|
237
776
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return [4 /*yield*/, this.db.transaction(function (tx) {
|
|
243
|
-
var e_3, _a;
|
|
244
|
-
try {
|
|
245
|
-
for (var deleteParameterizedStatements_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__values)(deleteParameterizedStatements), deleteParameterizedStatements_1_1 = deleteParameterizedStatements_1.next(); !deleteParameterizedStatements_1_1.done; deleteParameterizedStatements_1_1 = deleteParameterizedStatements_1.next()) {
|
|
246
|
-
var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__read)(deleteParameterizedStatements_1_1.value, 2),
|
|
247
|
-
statement = _b[0],
|
|
248
|
-
params = _b[1];
|
|
249
|
-
tx.executeSql(statement, params);
|
|
250
|
-
}
|
|
251
|
-
} catch (e_3_1) {
|
|
252
|
-
e_3 = {
|
|
253
|
-
error: e_3_1
|
|
254
|
-
};
|
|
255
|
-
} finally {
|
|
777
|
+
_context8.next = 5;
|
|
778
|
+
return this.db.transaction(function (tx) {
|
|
779
|
+
var _iterator3 = _createForOfIteratorHelper(deleteParameterizedStatements),
|
|
780
|
+
_step3;
|
|
256
781
|
try {
|
|
257
|
-
|
|
782
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
783
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
784
|
+
statement = _step3$value[0],
|
|
785
|
+
params = _step3$value[1];
|
|
786
|
+
tx.executeSql(statement, params);
|
|
787
|
+
}
|
|
788
|
+
} catch (err) {
|
|
789
|
+
_iterator3.e(err);
|
|
258
790
|
} finally {
|
|
259
|
-
|
|
791
|
+
_iterator3.f();
|
|
260
792
|
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
793
|
+
});
|
|
794
|
+
case 5:
|
|
795
|
+
case "end":
|
|
796
|
+
return _context8.stop();
|
|
797
|
+
}
|
|
798
|
+
}, _callee8, this);
|
|
799
|
+
}));
|
|
800
|
+
function batchSave(_x9, _x10) {
|
|
801
|
+
return _batchSave.apply(this, arguments);
|
|
802
|
+
}
|
|
803
|
+
return batchSave;
|
|
804
|
+
}()
|
|
805
|
+
}, {
|
|
806
|
+
key: "selectAndDelete",
|
|
807
|
+
value: function () {
|
|
808
|
+
var _selectAndDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(queryParameterizedStatement, deleteParameterizedStatement) {
|
|
809
|
+
var results, _queryParameterizedSt, queryStatement, queryParams, _deleteParameterizedS, deleteStatement, deleteParams;
|
|
810
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
811
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
812
|
+
case 0:
|
|
813
|
+
results = [];
|
|
814
|
+
_queryParameterizedSt = _slicedToArray(queryParameterizedStatement, 2), queryStatement = _queryParameterizedSt[0], queryParams = _queryParameterizedSt[1];
|
|
815
|
+
_deleteParameterizedS = _slicedToArray(deleteParameterizedStatement, 2), deleteStatement = _deleteParameterizedS[0], deleteParams = _deleteParameterizedS[1];
|
|
816
|
+
_context9.next = 5;
|
|
817
|
+
return this.db.transaction(function (tx) {
|
|
818
|
+
tx.executeSql(queryStatement, queryParams, function (_, res) {
|
|
819
|
+
results = res.rows.raw();
|
|
820
|
+
}, logger.warn);
|
|
821
|
+
tx.executeSql(deleteStatement, deleteParams, function () {}, logger.warn);
|
|
822
|
+
});
|
|
823
|
+
case 5:
|
|
824
|
+
return _context9.abrupt("return", results);
|
|
825
|
+
case 6:
|
|
826
|
+
case "end":
|
|
827
|
+
return _context9.stop();
|
|
828
|
+
}
|
|
829
|
+
}, _callee9, this);
|
|
830
|
+
}));
|
|
831
|
+
function selectAndDelete(_x11, _x12) {
|
|
832
|
+
return _selectAndDelete.apply(this, arguments);
|
|
833
|
+
}
|
|
834
|
+
return selectAndDelete;
|
|
835
|
+
}()
|
|
836
|
+
}, {
|
|
837
|
+
key: "executeStatements",
|
|
838
|
+
value: function () {
|
|
839
|
+
var _executeStatements = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(statements) {
|
|
840
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
841
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
842
|
+
case 0:
|
|
843
|
+
_context10.next = 2;
|
|
844
|
+
return this.db.transaction(function (tx) {
|
|
845
|
+
var _iterator4 = _createForOfIteratorHelper(statements),
|
|
846
|
+
_step4;
|
|
312
847
|
try {
|
|
313
|
-
|
|
848
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
849
|
+
var statement = _step4.value;
|
|
850
|
+
tx.executeSql(statement);
|
|
851
|
+
}
|
|
852
|
+
} catch (err) {
|
|
853
|
+
_iterator4.e(err);
|
|
314
854
|
} finally {
|
|
315
|
-
|
|
855
|
+
_iterator4.f();
|
|
316
856
|
}
|
|
857
|
+
});
|
|
858
|
+
case 2:
|
|
859
|
+
case "end":
|
|
860
|
+
return _context10.stop();
|
|
861
|
+
}
|
|
862
|
+
}, _callee10, this);
|
|
863
|
+
}));
|
|
864
|
+
function executeStatements(_x13) {
|
|
865
|
+
return _executeStatements.apply(this, arguments);
|
|
866
|
+
}
|
|
867
|
+
return executeStatements;
|
|
868
|
+
}()
|
|
869
|
+
}, {
|
|
870
|
+
key: "closeDB",
|
|
871
|
+
value: function () {
|
|
872
|
+
var _closeDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
873
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
874
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
875
|
+
case 0:
|
|
876
|
+
if (!this.db) {
|
|
877
|
+
_context11.next = 6;
|
|
878
|
+
break;
|
|
317
879
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
_a.sent();
|
|
337
|
-
logger.debug('Database closed');
|
|
338
|
-
this.db = undefined;
|
|
339
|
-
_a.label = 2;
|
|
340
|
-
case 2:
|
|
341
|
-
return [2 /*return*/];
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
};
|
|
346
|
-
|
|
880
|
+
logger.debug('Closing Database');
|
|
881
|
+
_context11.next = 4;
|
|
882
|
+
return this.db.close();
|
|
883
|
+
case 4:
|
|
884
|
+
logger.debug('Database closed');
|
|
885
|
+
this.db = undefined;
|
|
886
|
+
case 6:
|
|
887
|
+
case "end":
|
|
888
|
+
return _context11.stop();
|
|
889
|
+
}
|
|
890
|
+
}, _callee11, this);
|
|
891
|
+
}));
|
|
892
|
+
function closeDB() {
|
|
893
|
+
return _closeDB.apply(this, arguments);
|
|
894
|
+
}
|
|
895
|
+
return closeDB;
|
|
896
|
+
}()
|
|
897
|
+
}]);
|
|
347
898
|
return SQLiteDatabase;
|
|
348
899
|
}();
|
|
349
900
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SQLiteDatabase);
|
|
@@ -360,13 +911,534 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
360
911
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
361
912
|
/* harmony export */ CommonSQLiteAdapter: () => (/* binding */ CommonSQLiteAdapter)
|
|
362
913
|
/* harmony export */ });
|
|
363
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.mjs");
|
|
364
914
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
365
915
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
366
916
|
/* harmony import */ var _common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/SQLiteUtils */ "./lib-esm/common/SQLiteUtils.js");
|
|
367
917
|
/* harmony import */ var _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/datastore */ "@aws-amplify/datastore");
|
|
368
918
|
/* harmony import */ var _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__);
|
|
919
|
+
function _typeof(o) {
|
|
920
|
+
"@babel/helpers - typeof";
|
|
921
|
+
|
|
922
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
923
|
+
return typeof o;
|
|
924
|
+
} : function (o) {
|
|
925
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
926
|
+
}, _typeof(o);
|
|
927
|
+
}
|
|
928
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
929
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
930
|
+
if (!it) {
|
|
931
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
932
|
+
if (it) o = it;
|
|
933
|
+
var i = 0;
|
|
934
|
+
var F = function F() {};
|
|
935
|
+
return {
|
|
936
|
+
s: F,
|
|
937
|
+
n: function n() {
|
|
938
|
+
if (i >= o.length) return {
|
|
939
|
+
done: true
|
|
940
|
+
};
|
|
941
|
+
return {
|
|
942
|
+
done: false,
|
|
943
|
+
value: o[i++]
|
|
944
|
+
};
|
|
945
|
+
},
|
|
946
|
+
e: function e(_e) {
|
|
947
|
+
throw _e;
|
|
948
|
+
},
|
|
949
|
+
f: F
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
953
|
+
}
|
|
954
|
+
var normalCompletion = true,
|
|
955
|
+
didErr = false,
|
|
956
|
+
err;
|
|
957
|
+
return {
|
|
958
|
+
s: function s() {
|
|
959
|
+
it = it.call(o);
|
|
960
|
+
},
|
|
961
|
+
n: function n() {
|
|
962
|
+
var step = it.next();
|
|
963
|
+
normalCompletion = step.done;
|
|
964
|
+
return step;
|
|
965
|
+
},
|
|
966
|
+
e: function e(_e2) {
|
|
967
|
+
didErr = true;
|
|
968
|
+
err = _e2;
|
|
969
|
+
},
|
|
970
|
+
f: function f() {
|
|
971
|
+
try {
|
|
972
|
+
if (!normalCompletion && it["return"] != null) it["return"]();
|
|
973
|
+
} finally {
|
|
974
|
+
if (didErr) throw err;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
function _slicedToArray(arr, i) {
|
|
980
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
981
|
+
}
|
|
982
|
+
function _nonIterableRest() {
|
|
983
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
984
|
+
}
|
|
985
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
986
|
+
if (!o) return;
|
|
987
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
988
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
989
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
990
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
991
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
992
|
+
}
|
|
993
|
+
function _arrayLikeToArray(arr, len) {
|
|
994
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
995
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
996
|
+
return arr2;
|
|
997
|
+
}
|
|
998
|
+
function _iterableToArrayLimit(r, l) {
|
|
999
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1000
|
+
if (null != t) {
|
|
1001
|
+
var e,
|
|
1002
|
+
n,
|
|
1003
|
+
i,
|
|
1004
|
+
u,
|
|
1005
|
+
a = [],
|
|
1006
|
+
f = !0,
|
|
1007
|
+
o = !1;
|
|
1008
|
+
try {
|
|
1009
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1010
|
+
if (Object(t) !== t) return;
|
|
1011
|
+
f = !1;
|
|
1012
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1013
|
+
} catch (r) {
|
|
1014
|
+
o = !0, n = r;
|
|
1015
|
+
} finally {
|
|
1016
|
+
try {
|
|
1017
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
1018
|
+
} finally {
|
|
1019
|
+
if (o) throw n;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return a;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
function _arrayWithHoles(arr) {
|
|
1026
|
+
if (Array.isArray(arr)) return arr;
|
|
1027
|
+
}
|
|
1028
|
+
function _regeneratorRuntime() {
|
|
1029
|
+
"use strict";
|
|
369
1030
|
|
|
1031
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1032
|
+
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
1033
|
+
return e;
|
|
1034
|
+
};
|
|
1035
|
+
var t,
|
|
1036
|
+
e = {},
|
|
1037
|
+
r = Object.prototype,
|
|
1038
|
+
n = r.hasOwnProperty,
|
|
1039
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
1040
|
+
t[e] = r.value;
|
|
1041
|
+
},
|
|
1042
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
1043
|
+
a = i.iterator || "@@iterator",
|
|
1044
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
1045
|
+
u = i.toStringTag || "@@toStringTag";
|
|
1046
|
+
function define(t, e, r) {
|
|
1047
|
+
return Object.defineProperty(t, e, {
|
|
1048
|
+
value: r,
|
|
1049
|
+
enumerable: !0,
|
|
1050
|
+
configurable: !0,
|
|
1051
|
+
writable: !0
|
|
1052
|
+
}), t[e];
|
|
1053
|
+
}
|
|
1054
|
+
try {
|
|
1055
|
+
define({}, "");
|
|
1056
|
+
} catch (t) {
|
|
1057
|
+
define = function define(t, e, r) {
|
|
1058
|
+
return t[e] = r;
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
function wrap(t, e, r, n) {
|
|
1062
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
1063
|
+
a = Object.create(i.prototype),
|
|
1064
|
+
c = new Context(n || []);
|
|
1065
|
+
return o(a, "_invoke", {
|
|
1066
|
+
value: makeInvokeMethod(t, r, c)
|
|
1067
|
+
}), a;
|
|
1068
|
+
}
|
|
1069
|
+
function tryCatch(t, e, r) {
|
|
1070
|
+
try {
|
|
1071
|
+
return {
|
|
1072
|
+
type: "normal",
|
|
1073
|
+
arg: t.call(e, r)
|
|
1074
|
+
};
|
|
1075
|
+
} catch (t) {
|
|
1076
|
+
return {
|
|
1077
|
+
type: "throw",
|
|
1078
|
+
arg: t
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
e.wrap = wrap;
|
|
1083
|
+
var h = "suspendedStart",
|
|
1084
|
+
l = "suspendedYield",
|
|
1085
|
+
f = "executing",
|
|
1086
|
+
s = "completed",
|
|
1087
|
+
y = {};
|
|
1088
|
+
function Generator() {}
|
|
1089
|
+
function GeneratorFunction() {}
|
|
1090
|
+
function GeneratorFunctionPrototype() {}
|
|
1091
|
+
var p = {};
|
|
1092
|
+
define(p, a, function () {
|
|
1093
|
+
return this;
|
|
1094
|
+
});
|
|
1095
|
+
var d = Object.getPrototypeOf,
|
|
1096
|
+
v = d && d(d(values([])));
|
|
1097
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
1098
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
1099
|
+
function defineIteratorMethods(t) {
|
|
1100
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
1101
|
+
define(t, e, function (t) {
|
|
1102
|
+
return this._invoke(e, t);
|
|
1103
|
+
});
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
function AsyncIterator(t, e) {
|
|
1107
|
+
function invoke(r, o, i, a) {
|
|
1108
|
+
var c = tryCatch(t[r], t, o);
|
|
1109
|
+
if ("throw" !== c.type) {
|
|
1110
|
+
var u = c.arg,
|
|
1111
|
+
h = u.value;
|
|
1112
|
+
return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
1113
|
+
invoke("next", t, i, a);
|
|
1114
|
+
}, function (t) {
|
|
1115
|
+
invoke("throw", t, i, a);
|
|
1116
|
+
}) : e.resolve(h).then(function (t) {
|
|
1117
|
+
u.value = t, i(u);
|
|
1118
|
+
}, function (t) {
|
|
1119
|
+
return invoke("throw", t, i, a);
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
a(c.arg);
|
|
1123
|
+
}
|
|
1124
|
+
var r;
|
|
1125
|
+
o(this, "_invoke", {
|
|
1126
|
+
value: function value(t, n) {
|
|
1127
|
+
function callInvokeWithMethodAndArg() {
|
|
1128
|
+
return new e(function (e, r) {
|
|
1129
|
+
invoke(t, n, e, r);
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
function makeInvokeMethod(e, r, n) {
|
|
1137
|
+
var o = h;
|
|
1138
|
+
return function (i, a) {
|
|
1139
|
+
if (o === f) throw new Error("Generator is already running");
|
|
1140
|
+
if (o === s) {
|
|
1141
|
+
if ("throw" === i) throw a;
|
|
1142
|
+
return {
|
|
1143
|
+
value: t,
|
|
1144
|
+
done: !0
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
for (n.method = i, n.arg = a;;) {
|
|
1148
|
+
var c = n.delegate;
|
|
1149
|
+
if (c) {
|
|
1150
|
+
var u = maybeInvokeDelegate(c, n);
|
|
1151
|
+
if (u) {
|
|
1152
|
+
if (u === y) continue;
|
|
1153
|
+
return u;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
1157
|
+
if (o === h) throw o = s, n.arg;
|
|
1158
|
+
n.dispatchException(n.arg);
|
|
1159
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
1160
|
+
o = f;
|
|
1161
|
+
var p = tryCatch(e, r, n);
|
|
1162
|
+
if ("normal" === p.type) {
|
|
1163
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
1164
|
+
return {
|
|
1165
|
+
value: p.arg,
|
|
1166
|
+
done: n.done
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
function maybeInvokeDelegate(e, r) {
|
|
1174
|
+
var n = r.method,
|
|
1175
|
+
o = e.iterator[n];
|
|
1176
|
+
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;
|
|
1177
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
1178
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
1179
|
+
var a = i.arg;
|
|
1180
|
+
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);
|
|
1181
|
+
}
|
|
1182
|
+
function pushTryEntry(t) {
|
|
1183
|
+
var e = {
|
|
1184
|
+
tryLoc: t[0]
|
|
1185
|
+
};
|
|
1186
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
1187
|
+
}
|
|
1188
|
+
function resetTryEntry(t) {
|
|
1189
|
+
var e = t.completion || {};
|
|
1190
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
1191
|
+
}
|
|
1192
|
+
function Context(t) {
|
|
1193
|
+
this.tryEntries = [{
|
|
1194
|
+
tryLoc: "root"
|
|
1195
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
1196
|
+
}
|
|
1197
|
+
function values(e) {
|
|
1198
|
+
if (e || "" === e) {
|
|
1199
|
+
var r = e[a];
|
|
1200
|
+
if (r) return r.call(e);
|
|
1201
|
+
if ("function" == typeof e.next) return e;
|
|
1202
|
+
if (!isNaN(e.length)) {
|
|
1203
|
+
var o = -1,
|
|
1204
|
+
i = function next() {
|
|
1205
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
1206
|
+
return next.value = t, next.done = !0, next;
|
|
1207
|
+
};
|
|
1208
|
+
return i.next = i;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
throw new TypeError(_typeof(e) + " is not iterable");
|
|
1212
|
+
}
|
|
1213
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
1214
|
+
value: GeneratorFunctionPrototype,
|
|
1215
|
+
configurable: !0
|
|
1216
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
1217
|
+
value: GeneratorFunction,
|
|
1218
|
+
configurable: !0
|
|
1219
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
1220
|
+
var e = "function" == typeof t && t.constructor;
|
|
1221
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
1222
|
+
}, e.mark = function (t) {
|
|
1223
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
1224
|
+
}, e.awrap = function (t) {
|
|
1225
|
+
return {
|
|
1226
|
+
__await: t
|
|
1227
|
+
};
|
|
1228
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
1229
|
+
return this;
|
|
1230
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
1231
|
+
void 0 === i && (i = Promise);
|
|
1232
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
1233
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
1234
|
+
return t.done ? t.value : a.next();
|
|
1235
|
+
});
|
|
1236
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
1237
|
+
return this;
|
|
1238
|
+
}), define(g, "toString", function () {
|
|
1239
|
+
return "[object Generator]";
|
|
1240
|
+
}), e.keys = function (t) {
|
|
1241
|
+
var e = Object(t),
|
|
1242
|
+
r = [];
|
|
1243
|
+
for (var n in e) r.push(n);
|
|
1244
|
+
return r.reverse(), function next() {
|
|
1245
|
+
for (; r.length;) {
|
|
1246
|
+
var t = r.pop();
|
|
1247
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
1248
|
+
}
|
|
1249
|
+
return next.done = !0, next;
|
|
1250
|
+
};
|
|
1251
|
+
}, e.values = values, Context.prototype = {
|
|
1252
|
+
constructor: Context,
|
|
1253
|
+
reset: function reset(e) {
|
|
1254
|
+
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);
|
|
1255
|
+
},
|
|
1256
|
+
stop: function stop() {
|
|
1257
|
+
this.done = !0;
|
|
1258
|
+
var t = this.tryEntries[0].completion;
|
|
1259
|
+
if ("throw" === t.type) throw t.arg;
|
|
1260
|
+
return this.rval;
|
|
1261
|
+
},
|
|
1262
|
+
dispatchException: function dispatchException(e) {
|
|
1263
|
+
if (this.done) throw e;
|
|
1264
|
+
var r = this;
|
|
1265
|
+
function handle(n, o) {
|
|
1266
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
1267
|
+
}
|
|
1268
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
1269
|
+
var i = this.tryEntries[o],
|
|
1270
|
+
a = i.completion;
|
|
1271
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
1272
|
+
if (i.tryLoc <= this.prev) {
|
|
1273
|
+
var c = n.call(i, "catchLoc"),
|
|
1274
|
+
u = n.call(i, "finallyLoc");
|
|
1275
|
+
if (c && u) {
|
|
1276
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
1277
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
1278
|
+
} else if (c) {
|
|
1279
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
1280
|
+
} else {
|
|
1281
|
+
if (!u) throw new Error("try statement without catch or finally");
|
|
1282
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
abrupt: function abrupt(t, e) {
|
|
1288
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
1289
|
+
var o = this.tryEntries[r];
|
|
1290
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
1291
|
+
var i = o;
|
|
1292
|
+
break;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
1296
|
+
var a = i ? i.completion : {};
|
|
1297
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
1298
|
+
},
|
|
1299
|
+
complete: function complete(t, e) {
|
|
1300
|
+
if ("throw" === t.type) throw t.arg;
|
|
1301
|
+
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;
|
|
1302
|
+
},
|
|
1303
|
+
finish: function finish(t) {
|
|
1304
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
1305
|
+
var r = this.tryEntries[e];
|
|
1306
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
1307
|
+
}
|
|
1308
|
+
},
|
|
1309
|
+
"catch": function _catch(t) {
|
|
1310
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
1311
|
+
var r = this.tryEntries[e];
|
|
1312
|
+
if (r.tryLoc === t) {
|
|
1313
|
+
var n = r.completion;
|
|
1314
|
+
if ("throw" === n.type) {
|
|
1315
|
+
var o = n.arg;
|
|
1316
|
+
resetTryEntry(r);
|
|
1317
|
+
}
|
|
1318
|
+
return o;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
throw new Error("illegal catch attempt");
|
|
1322
|
+
},
|
|
1323
|
+
delegateYield: function delegateYield(e, r, n) {
|
|
1324
|
+
return this.delegate = {
|
|
1325
|
+
iterator: values(e),
|
|
1326
|
+
resultName: r,
|
|
1327
|
+
nextLoc: n
|
|
1328
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
1329
|
+
}
|
|
1330
|
+
}, e;
|
|
1331
|
+
}
|
|
1332
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1333
|
+
try {
|
|
1334
|
+
var info = gen[key](arg);
|
|
1335
|
+
var value = info.value;
|
|
1336
|
+
} catch (error) {
|
|
1337
|
+
reject(error);
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
if (info.done) {
|
|
1341
|
+
resolve(value);
|
|
1342
|
+
} else {
|
|
1343
|
+
Promise.resolve(value).then(_next, _throw);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
function _asyncToGenerator(fn) {
|
|
1347
|
+
return function () {
|
|
1348
|
+
var self = this,
|
|
1349
|
+
args = arguments;
|
|
1350
|
+
return new Promise(function (resolve, reject) {
|
|
1351
|
+
var gen = fn.apply(self, args);
|
|
1352
|
+
function _next(value) {
|
|
1353
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1354
|
+
}
|
|
1355
|
+
function _throw(err) {
|
|
1356
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1357
|
+
}
|
|
1358
|
+
_next(undefined);
|
|
1359
|
+
});
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
function _classCallCheck(instance, Constructor) {
|
|
1363
|
+
if (!(instance instanceof Constructor)) {
|
|
1364
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
function _defineProperties(target, props) {
|
|
1368
|
+
for (var i = 0; i < props.length; i++) {
|
|
1369
|
+
var descriptor = props[i];
|
|
1370
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1371
|
+
descriptor.configurable = true;
|
|
1372
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1373
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
1377
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1378
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1379
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
1380
|
+
writable: false
|
|
1381
|
+
});
|
|
1382
|
+
return Constructor;
|
|
1383
|
+
}
|
|
1384
|
+
function _toPropertyKey(arg) {
|
|
1385
|
+
var key = _toPrimitive(arg, "string");
|
|
1386
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
1387
|
+
}
|
|
1388
|
+
function _toPrimitive(input, hint) {
|
|
1389
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
1390
|
+
var prim = input[Symbol.toPrimitive];
|
|
1391
|
+
if (prim !== undefined) {
|
|
1392
|
+
var res = prim.call(input, hint || "default");
|
|
1393
|
+
if (_typeof(res) !== "object") return res;
|
|
1394
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1395
|
+
}
|
|
1396
|
+
return (hint === "string" ? String : Number)(input);
|
|
1397
|
+
}
|
|
1398
|
+
function _asyncIterator(r) {
|
|
1399
|
+
var n,
|
|
1400
|
+
t,
|
|
1401
|
+
o,
|
|
1402
|
+
e = 2;
|
|
1403
|
+
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
|
|
1404
|
+
if (t && null != (n = r[t])) return n.call(r);
|
|
1405
|
+
if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
|
|
1406
|
+
t = "@@asyncIterator", o = "@@iterator";
|
|
1407
|
+
}
|
|
1408
|
+
throw new TypeError("Object is not async iterable");
|
|
1409
|
+
}
|
|
1410
|
+
function AsyncFromSyncIterator(r) {
|
|
1411
|
+
function AsyncFromSyncIteratorContinuation(r) {
|
|
1412
|
+
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
|
|
1413
|
+
var n = r.done;
|
|
1414
|
+
return Promise.resolve(r.value).then(function (r) {
|
|
1415
|
+
return {
|
|
1416
|
+
value: r,
|
|
1417
|
+
done: n
|
|
1418
|
+
};
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) {
|
|
1422
|
+
this.s = r, this.n = r.next;
|
|
1423
|
+
}, AsyncFromSyncIterator.prototype = {
|
|
1424
|
+
s: null,
|
|
1425
|
+
n: null,
|
|
1426
|
+
next: function next() {
|
|
1427
|
+
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
|
1428
|
+
},
|
|
1429
|
+
"return": function _return(r) {
|
|
1430
|
+
var n = this.s["return"];
|
|
1431
|
+
return void 0 === n ? Promise.resolve({
|
|
1432
|
+
value: r,
|
|
1433
|
+
done: !0
|
|
1434
|
+
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
1435
|
+
},
|
|
1436
|
+
"throw": function _throw(r) {
|
|
1437
|
+
var n = this.s["return"];
|
|
1438
|
+
return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
1439
|
+
}
|
|
1440
|
+
}, new AsyncFromSyncIterator(r);
|
|
1441
|
+
}
|
|
370
1442
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
371
1443
|
// SPDX-License-Identifier: Apache-2.0
|
|
372
1444
|
|
|
@@ -376,449 +1448,591 @@ var traverseModel = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.utils.tr
|
|
|
376
1448
|
validatePredicate = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.utils.validatePredicate,
|
|
377
1449
|
isModelConstructor = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.utils.isModelConstructor;
|
|
378
1450
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__.ConsoleLogger('DataStore');
|
|
379
|
-
var CommonSQLiteAdapter =
|
|
1451
|
+
var CommonSQLiteAdapter = /*#__PURE__*/function () {
|
|
380
1452
|
function CommonSQLiteAdapter(db) {
|
|
1453
|
+
_classCallCheck(this, CommonSQLiteAdapter);
|
|
381
1454
|
this.db = db;
|
|
382
1455
|
}
|
|
383
|
-
CommonSQLiteAdapter
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
_a.sent();
|
|
400
|
-
return [2 /*return*/];
|
|
401
|
-
case 3:
|
|
402
|
-
this.schema = theSchema;
|
|
403
|
-
this.namespaceResolver = namespaceResolver;
|
|
404
|
-
this.modelInstanceCreator = modelInstanceCreator;
|
|
405
|
-
this.getModelConstructorByModelName = getModelConstructorByModelName;
|
|
406
|
-
_a.label = 4;
|
|
407
|
-
case 4:
|
|
408
|
-
_a.trys.push([4, 7,, 8]);
|
|
409
|
-
usesCPKCodegen = Object.values(this.schema.namespaces.user.models).some(function (model) {
|
|
410
|
-
return Object.values(model.fields).some(function (field) {
|
|
411
|
-
var _a;
|
|
412
|
-
return (_a = field.association) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('targetNames');
|
|
1456
|
+
_createClass(CommonSQLiteAdapter, [{
|
|
1457
|
+
key: "setUp",
|
|
1458
|
+
value: function () {
|
|
1459
|
+
var _setUp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(theSchema, namespaceResolver, modelInstanceCreator, getModelConstructorByModelName) {
|
|
1460
|
+
var _this = this;
|
|
1461
|
+
var usesCPKCodegen, statements;
|
|
1462
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1463
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1464
|
+
case 0:
|
|
1465
|
+
if (this.initPromise) {
|
|
1466
|
+
_context.next = 4;
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
this.initPromise = new Promise(function (res, rej) {
|
|
1470
|
+
_this.resolve = res;
|
|
1471
|
+
_this.reject = rej;
|
|
413
1472
|
});
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
1473
|
+
_context.next = 7;
|
|
1474
|
+
break;
|
|
1475
|
+
case 4:
|
|
1476
|
+
_context.next = 6;
|
|
1477
|
+
return this.initPromise;
|
|
1478
|
+
case 6:
|
|
1479
|
+
return _context.abrupt("return");
|
|
1480
|
+
case 7:
|
|
1481
|
+
this.schema = theSchema;
|
|
1482
|
+
this.namespaceResolver = namespaceResolver;
|
|
1483
|
+
this.modelInstanceCreator = modelInstanceCreator;
|
|
1484
|
+
this.getModelConstructorByModelName = getModelConstructorByModelName;
|
|
1485
|
+
_context.prev = 11;
|
|
1486
|
+
usesCPKCodegen = Object.values(this.schema.namespaces.user.models).some(function (model) {
|
|
1487
|
+
return Object.values(model.fields).some(function (field) {
|
|
1488
|
+
var _field$association;
|
|
1489
|
+
return (_field$association = field.association) === null || _field$association === void 0 ? void 0 : _field$association.hasOwnProperty('targetNames');
|
|
1490
|
+
});
|
|
1491
|
+
});
|
|
1492
|
+
if (usesCPKCodegen) {
|
|
1493
|
+
logger.error('The SQLite adapter does not support schemas using custom primary key. Set `graphQLTransformer.respectPrimaryKeyAttributesOnConnectionField in `amplify/cli.json` to false to disable custom primary key. To regenerate your API, add or remove an empty newline to your GraphQL schema (to change the computed hash) then run `amplify push`.');
|
|
1494
|
+
}
|
|
1495
|
+
_context.next = 16;
|
|
1496
|
+
return this.db.init();
|
|
1497
|
+
case 16:
|
|
1498
|
+
statements = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.generateSchemaStatements)(this.schema);
|
|
1499
|
+
_context.next = 19;
|
|
1500
|
+
return this.db.createSchema(statements);
|
|
1501
|
+
case 19:
|
|
1502
|
+
this.resolve();
|
|
1503
|
+
_context.next = 25;
|
|
1504
|
+
break;
|
|
1505
|
+
case 22:
|
|
1506
|
+
_context.prev = 22;
|
|
1507
|
+
_context.t0 = _context["catch"](11);
|
|
1508
|
+
this.reject(_context.t0);
|
|
1509
|
+
case 25:
|
|
1510
|
+
case "end":
|
|
1511
|
+
return _context.stop();
|
|
1512
|
+
}
|
|
1513
|
+
}, _callee, this, [[11, 22]]);
|
|
1514
|
+
}));
|
|
1515
|
+
function setUp(_x, _x2, _x3, _x4) {
|
|
1516
|
+
return _setUp.apply(this, arguments);
|
|
1517
|
+
}
|
|
1518
|
+
return setUp;
|
|
1519
|
+
}()
|
|
1520
|
+
}, {
|
|
1521
|
+
key: "clear",
|
|
1522
|
+
value: function () {
|
|
1523
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1524
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1525
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1526
|
+
case 0:
|
|
1527
|
+
_context2.next = 2;
|
|
1528
|
+
return this.db.clear();
|
|
1529
|
+
case 2:
|
|
1530
|
+
this.initPromise = undefined;
|
|
1531
|
+
case 3:
|
|
1532
|
+
case "end":
|
|
1533
|
+
return _context2.stop();
|
|
1534
|
+
}
|
|
1535
|
+
}, _callee2, this);
|
|
1536
|
+
}));
|
|
1537
|
+
function clear() {
|
|
1538
|
+
return _clear.apply(this, arguments);
|
|
1539
|
+
}
|
|
1540
|
+
return clear;
|
|
1541
|
+
}()
|
|
1542
|
+
}, {
|
|
1543
|
+
key: "save",
|
|
1544
|
+
value: function () {
|
|
1545
|
+
var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(model, condition) {
|
|
1546
|
+
var modelConstructor, tableName, connectedModels, connectionStoreNames, _queryByIdStatement, _queryByIdStatement2, queryStatement, params, fromDB, predicates, predicateObjs, type, isValid, msg, result, saveStatements, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, resItem, modelName, item, instance, id, _queryByIdStatement3, _queryByIdStatement4, _queryStatement, _params, _fromDB, opType, saveStatement;
|
|
1547
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1548
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1549
|
+
case 0:
|
|
1550
|
+
modelConstructor = Object.getPrototypeOf(model).constructor;
|
|
1551
|
+
tableName = modelConstructor.name;
|
|
1552
|
+
connectedModels = traverseModel(modelConstructor.name, model, this.schema.namespaces[this.namespaceResolver(modelConstructor)], this.modelInstanceCreator, this.getModelConstructorByModelName);
|
|
1553
|
+
connectionStoreNames = Object.values(connectedModels).map(function (_ref) {
|
|
1554
|
+
var modelName = _ref.modelName,
|
|
1555
|
+
item = _ref.item,
|
|
1556
|
+
instance = _ref.instance;
|
|
1557
|
+
return {
|
|
1558
|
+
modelName: modelName,
|
|
1559
|
+
item: item,
|
|
1560
|
+
instance: instance
|
|
1561
|
+
};
|
|
1562
|
+
});
|
|
1563
|
+
_queryByIdStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryByIdStatement)(model.id, tableName), _queryByIdStatement2 = _slicedToArray(_queryByIdStatement, 2), queryStatement = _queryByIdStatement2[0], params = _queryByIdStatement2[1];
|
|
1564
|
+
_context3.next = 7;
|
|
1565
|
+
return this.db.get(queryStatement, params);
|
|
1566
|
+
case 7:
|
|
1567
|
+
fromDB = _context3.sent;
|
|
1568
|
+
if (!(condition && fromDB)) {
|
|
1569
|
+
_context3.next = 16;
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
478
1572
|
predicates = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.ModelPredicateCreator.getPredicates(condition);
|
|
479
1573
|
predicateObjs = predicates.predicates, type = predicates.type;
|
|
480
1574
|
isValid = validatePredicate(fromDB, type, predicateObjs);
|
|
481
|
-
if (
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
model: fromDB,
|
|
485
|
-
condition: predicateObjs
|
|
486
|
-
});
|
|
487
|
-
throw new Error(msg);
|
|
1575
|
+
if (isValid) {
|
|
1576
|
+
_context3.next = 16;
|
|
1577
|
+
break;
|
|
488
1578
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
// Remove related-model fields. They're all `null` in the database,
|
|
566
|
-
// and any that happen to be required will result in a false validation
|
|
567
|
-
// error when DataStore attempts to initialize with `null`.
|
|
568
|
-
// These fields aren't actually needed here. DataStore will use the FK's
|
|
569
|
-
// from the schema model.
|
|
570
|
-
return [2 /*return*/, records.map(function (record) {
|
|
571
|
-
var e_2, _a;
|
|
572
|
-
try {
|
|
573
|
-
for (var relations_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__values)(relations), relations_1_1 = relations_1.next(); !relations_1_1.done; relations_1_1 = relations_1.next()) {
|
|
574
|
-
var r = relations_1_1.value;
|
|
575
|
-
delete record[r.fieldName];
|
|
576
|
-
}
|
|
577
|
-
} catch (e_2_1) {
|
|
578
|
-
e_2 = {
|
|
579
|
-
error: e_2_1
|
|
580
|
-
};
|
|
581
|
-
} finally {
|
|
582
|
-
try {
|
|
583
|
-
if (relations_1_1 && !relations_1_1.done && (_a = relations_1["return"])) _a.call(relations_1);
|
|
584
|
-
} finally {
|
|
585
|
-
if (e_2) throw e_2.error;
|
|
586
|
-
}
|
|
1579
|
+
msg = 'Conditional update failed';
|
|
1580
|
+
logger.error(msg, {
|
|
1581
|
+
model: fromDB,
|
|
1582
|
+
condition: predicateObjs
|
|
1583
|
+
});
|
|
1584
|
+
throw new Error(msg);
|
|
1585
|
+
case 16:
|
|
1586
|
+
result = [];
|
|
1587
|
+
saveStatements = new Set();
|
|
1588
|
+
_iteratorAbruptCompletion = false;
|
|
1589
|
+
_didIteratorError = false;
|
|
1590
|
+
_context3.prev = 20;
|
|
1591
|
+
_iterator = _asyncIterator(connectionStoreNames);
|
|
1592
|
+
case 22:
|
|
1593
|
+
_context3.next = 24;
|
|
1594
|
+
return _iterator.next();
|
|
1595
|
+
case 24:
|
|
1596
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context3.sent).done)) {
|
|
1597
|
+
_context3.next = 38;
|
|
1598
|
+
break;
|
|
1599
|
+
}
|
|
1600
|
+
resItem = _step.value;
|
|
1601
|
+
modelName = resItem.modelName, item = resItem.item, instance = resItem.instance;
|
|
1602
|
+
id = item.id;
|
|
1603
|
+
_queryByIdStatement3 = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryByIdStatement)(id, modelName), _queryByIdStatement4 = _slicedToArray(_queryByIdStatement3, 2), _queryStatement = _queryByIdStatement4[0], _params = _queryByIdStatement4[1];
|
|
1604
|
+
_context3.next = 31;
|
|
1605
|
+
return this.db.get(_queryStatement, _params);
|
|
1606
|
+
case 31:
|
|
1607
|
+
_fromDB = _context3.sent;
|
|
1608
|
+
opType = _fromDB === undefined ? _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.OpType.INSERT : _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.OpType.UPDATE;
|
|
1609
|
+
saveStatement = _fromDB ? (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.modelUpdateStatement)(instance, modelName) : (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.modelInsertStatement)(instance, modelName);
|
|
1610
|
+
if (id === model.id || opType === _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.OpType.INSERT) {
|
|
1611
|
+
saveStatements.add(saveStatement);
|
|
1612
|
+
result.push([instance, opType]);
|
|
1613
|
+
}
|
|
1614
|
+
case 35:
|
|
1615
|
+
_iteratorAbruptCompletion = false;
|
|
1616
|
+
_context3.next = 22;
|
|
1617
|
+
break;
|
|
1618
|
+
case 38:
|
|
1619
|
+
_context3.next = 44;
|
|
1620
|
+
break;
|
|
1621
|
+
case 40:
|
|
1622
|
+
_context3.prev = 40;
|
|
1623
|
+
_context3.t0 = _context3["catch"](20);
|
|
1624
|
+
_didIteratorError = true;
|
|
1625
|
+
_iteratorError = _context3.t0;
|
|
1626
|
+
case 44:
|
|
1627
|
+
_context3.prev = 44;
|
|
1628
|
+
_context3.prev = 45;
|
|
1629
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
1630
|
+
_context3.next = 49;
|
|
1631
|
+
break;
|
|
1632
|
+
}
|
|
1633
|
+
_context3.next = 49;
|
|
1634
|
+
return _iterator["return"]();
|
|
1635
|
+
case 49:
|
|
1636
|
+
_context3.prev = 49;
|
|
1637
|
+
if (!_didIteratorError) {
|
|
1638
|
+
_context3.next = 52;
|
|
1639
|
+
break;
|
|
1640
|
+
}
|
|
1641
|
+
throw _iteratorError;
|
|
1642
|
+
case 52:
|
|
1643
|
+
return _context3.finish(49);
|
|
1644
|
+
case 53:
|
|
1645
|
+
return _context3.finish(44);
|
|
1646
|
+
case 54:
|
|
1647
|
+
_context3.next = 56;
|
|
1648
|
+
return this.db.batchSave(saveStatements);
|
|
1649
|
+
case 56:
|
|
1650
|
+
return _context3.abrupt("return", result);
|
|
1651
|
+
case 57:
|
|
1652
|
+
case "end":
|
|
1653
|
+
return _context3.stop();
|
|
587
1654
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
1655
|
+
}, _callee3, this, [[20, 40, 44, 54], [45,, 49, 53]]);
|
|
1656
|
+
}));
|
|
1657
|
+
function save(_x5, _x6) {
|
|
1658
|
+
return _save.apply(this, arguments);
|
|
1659
|
+
}
|
|
1660
|
+
return save;
|
|
1661
|
+
}()
|
|
1662
|
+
}, {
|
|
1663
|
+
key: "load",
|
|
1664
|
+
value: function () {
|
|
1665
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(namespaceName, srcModelName, records) {
|
|
1666
|
+
var _this2 = this;
|
|
1667
|
+
var namespace, relations, connectionTableNames, modelConstructor;
|
|
1668
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1669
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1670
|
+
case 0:
|
|
1671
|
+
namespace = this.schema.namespaces[namespaceName];
|
|
1672
|
+
relations = namespace.relationships[srcModelName].relationTypes;
|
|
1673
|
+
connectionTableNames = relations.map(function (_ref2) {
|
|
1674
|
+
var modelName = _ref2.modelName;
|
|
1675
|
+
return modelName;
|
|
1676
|
+
});
|
|
1677
|
+
modelConstructor = this.getModelConstructorByModelName(namespaceName, srcModelName);
|
|
1678
|
+
if (!(connectionTableNames.length === 0)) {
|
|
1679
|
+
_context4.next = 6;
|
|
1680
|
+
break;
|
|
1681
|
+
}
|
|
1682
|
+
return _context4.abrupt("return", records.map(function (record) {
|
|
1683
|
+
return _this2.modelInstanceCreator(modelConstructor, record);
|
|
1684
|
+
}));
|
|
1685
|
+
case 6:
|
|
1686
|
+
return _context4.abrupt("return", records.map(function (record) {
|
|
1687
|
+
var _iterator2 = _createForOfIteratorHelper(relations),
|
|
1688
|
+
_step2;
|
|
1689
|
+
try {
|
|
1690
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1691
|
+
var r = _step2.value;
|
|
1692
|
+
delete record[r.fieldName];
|
|
1693
|
+
}
|
|
1694
|
+
} catch (err) {
|
|
1695
|
+
_iterator2.e(err);
|
|
1696
|
+
} finally {
|
|
1697
|
+
_iterator2.f();
|
|
1698
|
+
}
|
|
1699
|
+
return _this2.modelInstanceCreator(modelConstructor, record);
|
|
1700
|
+
}));
|
|
1701
|
+
case 7:
|
|
1702
|
+
case "end":
|
|
1703
|
+
return _context4.stop();
|
|
1704
|
+
}
|
|
1705
|
+
}, _callee4, this);
|
|
1706
|
+
}));
|
|
1707
|
+
function load(_x7, _x8, _x9) {
|
|
1708
|
+
return _load.apply(this, arguments);
|
|
1709
|
+
}
|
|
1710
|
+
return load;
|
|
1711
|
+
}()
|
|
1712
|
+
}, {
|
|
1713
|
+
key: "query",
|
|
1714
|
+
value: function () {
|
|
1715
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(modelConstructor, predicate, pagination) {
|
|
1716
|
+
var _this3 = this;
|
|
1717
|
+
var tableName, namespaceName, predicates, sortPredicates, limit, page, queryById, records;
|
|
1718
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1719
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1720
|
+
case 0:
|
|
1721
|
+
tableName = modelConstructor.name;
|
|
1722
|
+
namespaceName = this.namespaceResolver(modelConstructor);
|
|
1723
|
+
predicates = predicate && _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.ModelPredicateCreator.getPredicates(predicate);
|
|
1724
|
+
sortPredicates = pagination && pagination.sort && _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.ModelSortPredicateCreator.getPredicates(pagination.sort);
|
|
1725
|
+
limit = pagination && pagination.limit;
|
|
1726
|
+
page = limit && pagination.page;
|
|
1727
|
+
queryById = predicates && this.idFromPredicate(predicates);
|
|
1728
|
+
_context6.next = 9;
|
|
1729
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
1730
|
+
var record, _queryAllStatement, _queryAllStatement2, queryStatement, params;
|
|
1731
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1732
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
612
1733
|
case 0:
|
|
613
|
-
if (!queryById)
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
_a = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__read)((0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryAllStatement)(tableName, predicates, sortPredicates, limit, page), 2), queryStatement = _a[0], params = _a[1];
|
|
620
|
-
return [4 /*yield*/, this.db.getAll(queryStatement, params)];
|
|
1734
|
+
if (!queryById) {
|
|
1735
|
+
_context5.next = 5;
|
|
1736
|
+
break;
|
|
1737
|
+
}
|
|
1738
|
+
_context5.next = 3;
|
|
1739
|
+
return _this3.getById(tableName, queryById);
|
|
621
1740
|
case 3:
|
|
622
|
-
|
|
1741
|
+
record = _context5.sent;
|
|
1742
|
+
return _context5.abrupt("return", record ? [record] : []);
|
|
1743
|
+
case 5:
|
|
1744
|
+
_queryAllStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryAllStatement)(tableName, predicates, sortPredicates, limit, page), _queryAllStatement2 = _slicedToArray(_queryAllStatement, 2), queryStatement = _queryAllStatement2[0], params = _queryAllStatement2[1];
|
|
1745
|
+
_context5.next = 8;
|
|
1746
|
+
return _this3.db.getAll(queryStatement, params);
|
|
1747
|
+
case 8:
|
|
1748
|
+
return _context5.abrupt("return", _context5.sent);
|
|
1749
|
+
case 9:
|
|
1750
|
+
case "end":
|
|
1751
|
+
return _context5.stop();
|
|
623
1752
|
}
|
|
624
|
-
});
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
1753
|
+
}, _callee5);
|
|
1754
|
+
}))();
|
|
1755
|
+
case 9:
|
|
1756
|
+
records = _context6.sent;
|
|
1757
|
+
_context6.next = 12;
|
|
1758
|
+
return this.load(namespaceName, modelConstructor.name, records);
|
|
1759
|
+
case 12:
|
|
1760
|
+
return _context6.abrupt("return", _context6.sent);
|
|
1761
|
+
case 13:
|
|
1762
|
+
case "end":
|
|
1763
|
+
return _context6.stop();
|
|
1764
|
+
}
|
|
1765
|
+
}, _callee6, this);
|
|
1766
|
+
}));
|
|
1767
|
+
function query(_x10, _x11, _x12) {
|
|
1768
|
+
return _query.apply(this, arguments);
|
|
1769
|
+
}
|
|
1770
|
+
return query;
|
|
1771
|
+
}()
|
|
1772
|
+
}, {
|
|
1773
|
+
key: "getById",
|
|
1774
|
+
value: function () {
|
|
1775
|
+
var _getById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(tableName, id) {
|
|
1776
|
+
var _queryByIdStatement5, _queryByIdStatement6, queryStatement, params, record;
|
|
1777
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1778
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1779
|
+
case 0:
|
|
1780
|
+
_queryByIdStatement5 = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryByIdStatement)(id, tableName), _queryByIdStatement6 = _slicedToArray(_queryByIdStatement5, 2), queryStatement = _queryByIdStatement6[0], params = _queryByIdStatement6[1];
|
|
1781
|
+
_context7.next = 3;
|
|
1782
|
+
return this.db.get(queryStatement, params);
|
|
1783
|
+
case 3:
|
|
1784
|
+
record = _context7.sent;
|
|
1785
|
+
return _context7.abrupt("return", record);
|
|
1786
|
+
case 5:
|
|
1787
|
+
case "end":
|
|
1788
|
+
return _context7.stop();
|
|
1789
|
+
}
|
|
1790
|
+
}, _callee7, this);
|
|
1791
|
+
}));
|
|
1792
|
+
function getById(_x13, _x14) {
|
|
1793
|
+
return _getById.apply(this, arguments);
|
|
1794
|
+
}
|
|
1795
|
+
return getById;
|
|
1796
|
+
}()
|
|
1797
|
+
}, {
|
|
1798
|
+
key: "idFromPredicate",
|
|
1799
|
+
value: function idFromPredicate(predicates) {
|
|
1800
|
+
var predicateObjs = predicates.predicates;
|
|
1801
|
+
var idPredicate = predicateObjs.length === 1 && predicateObjs.find(function (p) {
|
|
1802
|
+
return (0,_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.isPredicateObj)(p) && p.field === 'id' && p.operator === 'eq';
|
|
648
1803
|
});
|
|
649
|
-
|
|
650
|
-
};
|
|
651
|
-
CommonSQLiteAdapter.prototype.idFromPredicate = function (predicates) {
|
|
652
|
-
var predicateObjs = predicates.predicates;
|
|
653
|
-
var idPredicate = predicateObjs.length === 1 && predicateObjs.find(function (p) {
|
|
654
|
-
return (0,_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.isPredicateObj)(p) && p.field === 'id' && p.operator === 'eq';
|
|
655
|
-
});
|
|
656
|
-
return idPredicate && idPredicate.operand;
|
|
657
|
-
};
|
|
658
|
-
CommonSQLiteAdapter.prototype.queryOne = function (modelConstructor, firstOrLast) {
|
|
659
|
-
if (firstOrLast === void 0) {
|
|
660
|
-
firstOrLast = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.QueryOne.FIRST;
|
|
1804
|
+
return idPredicate && idPredicate.operand;
|
|
661
1805
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
1806
|
+
}, {
|
|
1807
|
+
key: "queryOne",
|
|
1808
|
+
value: function () {
|
|
1809
|
+
var _queryOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(modelConstructor) {
|
|
1810
|
+
var firstOrLast,
|
|
1811
|
+
tableName,
|
|
1812
|
+
_queryOneStatement,
|
|
1813
|
+
_queryOneStatement2,
|
|
1814
|
+
queryStatement,
|
|
1815
|
+
params,
|
|
1816
|
+
result,
|
|
1817
|
+
modelInstance,
|
|
1818
|
+
_args8 = arguments;
|
|
1819
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1820
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1821
|
+
case 0:
|
|
1822
|
+
firstOrLast = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.QueryOne.FIRST;
|
|
1823
|
+
tableName = modelConstructor.name;
|
|
1824
|
+
_queryOneStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryOneStatement)(firstOrLast, tableName), _queryOneStatement2 = _slicedToArray(_queryOneStatement, 2), queryStatement = _queryOneStatement2[0], params = _queryOneStatement2[1];
|
|
1825
|
+
_context8.next = 5;
|
|
1826
|
+
return this.db.get(queryStatement, params);
|
|
1827
|
+
case 5:
|
|
1828
|
+
result = _context8.sent;
|
|
1829
|
+
modelInstance = result && this.modelInstanceCreator(modelConstructor, result);
|
|
1830
|
+
return _context8.abrupt("return", modelInstance);
|
|
1831
|
+
case 8:
|
|
1832
|
+
case "end":
|
|
1833
|
+
return _context8.stop();
|
|
1834
|
+
}
|
|
1835
|
+
}, _callee8, this);
|
|
1836
|
+
}));
|
|
1837
|
+
function queryOne(_x15) {
|
|
1838
|
+
return _queryOne.apply(this, arguments);
|
|
1839
|
+
}
|
|
1840
|
+
return queryOne;
|
|
1841
|
+
}() // Currently does not cascade
|
|
1842
|
+
// TODO: use FKs in relations and have `ON DELETE CASCADE` set
|
|
1843
|
+
// For Has Many and Has One relations to have SQL handle cascades automatically
|
|
1844
|
+
}, {
|
|
1845
|
+
key: "delete",
|
|
1846
|
+
value: function () {
|
|
1847
|
+
var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(modelOrModelConstructor, condition) {
|
|
1848
|
+
var modelConstructor, namespaceName, tableName, predicates, queryStatement, deleteStatement, models, modelInstances, model, _modelConstructor, _tableName, _queryByIdStatement7, _queryByIdStatement8, _queryStatement2, params, fromDB, msg, _predicates, predicateObjs, type, isValid, _msg, _deleteByIdStatement, _deleteByIdStatement2, _deleteStatement, deleteParams, _deleteByIdStatement3, _deleteByIdStatement4, _deleteStatement2, _params2;
|
|
1849
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1850
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1851
|
+
case 0:
|
|
1852
|
+
if (!isModelConstructor(modelOrModelConstructor)) {
|
|
1853
|
+
_context9.next = 16;
|
|
1854
|
+
break;
|
|
1855
|
+
}
|
|
1856
|
+
modelConstructor = modelOrModelConstructor;
|
|
1857
|
+
namespaceName = this.namespaceResolver(modelConstructor);
|
|
1858
|
+
tableName = modelConstructor.name;
|
|
1859
|
+
predicates = condition && _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.ModelPredicateCreator.getPredicates(condition);
|
|
1860
|
+
queryStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryAllStatement)(tableName, predicates);
|
|
1861
|
+
deleteStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.deleteByPredicateStatement)(tableName, predicates);
|
|
1862
|
+
_context9.next = 9;
|
|
1863
|
+
return this.db.selectAndDelete(queryStatement, deleteStatement);
|
|
1864
|
+
case 9:
|
|
1865
|
+
models = _context9.sent;
|
|
1866
|
+
_context9.next = 12;
|
|
1867
|
+
return this.load(namespaceName, modelConstructor.name, models);
|
|
1868
|
+
case 12:
|
|
1869
|
+
modelInstances = _context9.sent;
|
|
1870
|
+
return _context9.abrupt("return", [modelInstances, modelInstances]);
|
|
1871
|
+
case 16:
|
|
1872
|
+
model = modelOrModelConstructor;
|
|
1873
|
+
_modelConstructor = Object.getPrototypeOf(model).constructor;
|
|
1874
|
+
_tableName = _modelConstructor.name;
|
|
1875
|
+
if (!condition) {
|
|
1876
|
+
_context9.next = 41;
|
|
1877
|
+
break;
|
|
1878
|
+
}
|
|
1879
|
+
_queryByIdStatement7 = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryByIdStatement)(model.id, _tableName), _queryByIdStatement8 = _slicedToArray(_queryByIdStatement7, 2), _queryStatement2 = _queryByIdStatement8[0], params = _queryByIdStatement8[1];
|
|
1880
|
+
_context9.next = 23;
|
|
1881
|
+
return this.db.get(_queryStatement2, params);
|
|
1882
|
+
case 23:
|
|
1883
|
+
fromDB = _context9.sent;
|
|
1884
|
+
if (!(fromDB === undefined)) {
|
|
1885
|
+
_context9.next = 28;
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
711
1888
|
msg = 'Model instance not found in storage';
|
|
712
1889
|
logger.warn(msg, {
|
|
713
1890
|
model: model
|
|
714
1891
|
});
|
|
715
|
-
return
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
1892
|
+
return _context9.abrupt("return", [[model], []]);
|
|
1893
|
+
case 28:
|
|
1894
|
+
_predicates = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.ModelPredicateCreator.getPredicates(condition);
|
|
1895
|
+
predicateObjs = _predicates.predicates, type = _predicates.type;
|
|
1896
|
+
isValid = validatePredicate(fromDB, type, predicateObjs);
|
|
1897
|
+
if (isValid) {
|
|
1898
|
+
_context9.next = 35;
|
|
1899
|
+
break;
|
|
1900
|
+
}
|
|
1901
|
+
_msg = 'Conditional update failed';
|
|
1902
|
+
logger.error(_msg, {
|
|
723
1903
|
model: fromDB,
|
|
724
1904
|
condition: predicateObjs
|
|
725
1905
|
});
|
|
726
|
-
throw new Error(
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
saveStatements.add(updateStatement);
|
|
805
|
-
result.push([itemsToSave[idx], _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.OpType.UPDATE]);
|
|
1906
|
+
throw new Error(_msg);
|
|
1907
|
+
case 35:
|
|
1908
|
+
_deleteByIdStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.deleteByIdStatement)(model.id, _tableName), _deleteByIdStatement2 = _slicedToArray(_deleteByIdStatement, 2), _deleteStatement = _deleteByIdStatement2[0], deleteParams = _deleteByIdStatement2[1];
|
|
1909
|
+
_context9.next = 38;
|
|
1910
|
+
return this.db.save(_deleteStatement, deleteParams);
|
|
1911
|
+
case 38:
|
|
1912
|
+
return _context9.abrupt("return", [[model], [model]]);
|
|
1913
|
+
case 41:
|
|
1914
|
+
_deleteByIdStatement3 = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.deleteByIdStatement)(model.id, _tableName), _deleteByIdStatement4 = _slicedToArray(_deleteByIdStatement3, 2), _deleteStatement2 = _deleteByIdStatement4[0], _params2 = _deleteByIdStatement4[1];
|
|
1915
|
+
_context9.next = 44;
|
|
1916
|
+
return this.db.save(_deleteStatement2, _params2);
|
|
1917
|
+
case 44:
|
|
1918
|
+
return _context9.abrupt("return", [[model], [model]]);
|
|
1919
|
+
case 45:
|
|
1920
|
+
case "end":
|
|
1921
|
+
return _context9.stop();
|
|
1922
|
+
}
|
|
1923
|
+
}, _callee9, this);
|
|
1924
|
+
}));
|
|
1925
|
+
function _delete(_x16, _x17) {
|
|
1926
|
+
return _delete2.apply(this, arguments);
|
|
1927
|
+
}
|
|
1928
|
+
return _delete;
|
|
1929
|
+
}()
|
|
1930
|
+
}, {
|
|
1931
|
+
key: "batchSave",
|
|
1932
|
+
value: function () {
|
|
1933
|
+
var _batchSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(modelConstructor, items) {
|
|
1934
|
+
var _this4 = this;
|
|
1935
|
+
var tableName, result, itemsToSave, queryStatements, deleteStatements, saveStatements, _iterator3, _step3, _loop, queryResponses;
|
|
1936
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
1937
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1938
|
+
case 0:
|
|
1939
|
+
tableName = modelConstructor.name;
|
|
1940
|
+
result = [];
|
|
1941
|
+
itemsToSave = []; // To determine whether an item should result in an insert or update operation
|
|
1942
|
+
// We first need to query the local DB on the item id
|
|
1943
|
+
queryStatements = new Set(); // Deletes don't need to be queried first, because if the item doesn't exist,
|
|
1944
|
+
// the delete operation will be a no-op
|
|
1945
|
+
deleteStatements = new Set();
|
|
1946
|
+
saveStatements = new Set();
|
|
1947
|
+
_iterator3 = _createForOfIteratorHelper(items);
|
|
1948
|
+
_context11.prev = 7;
|
|
1949
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
1950
|
+
var item, connectedModels, id, _deleted, _connectedModels$find, instance, deleteStatement, queryStatement;
|
|
1951
|
+
return _regeneratorRuntime().wrap(function _loop$(_context10) {
|
|
1952
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1953
|
+
case 0:
|
|
1954
|
+
item = _step3.value;
|
|
1955
|
+
connectedModels = traverseModel(modelConstructor.name, _this4.modelInstanceCreator(modelConstructor, item), _this4.schema.namespaces[_this4.namespaceResolver(modelConstructor)], _this4.modelInstanceCreator, _this4.getModelConstructorByModelName);
|
|
1956
|
+
id = item.id, _deleted = item._deleted;
|
|
1957
|
+
_connectedModels$find = connectedModels.find(function (_ref4) {
|
|
1958
|
+
var instance = _ref4.instance;
|
|
1959
|
+
return instance.id === id;
|
|
1960
|
+
}), instance = _connectedModels$find.instance;
|
|
1961
|
+
if (_deleted) {
|
|
1962
|
+
// create the delete statements right away
|
|
1963
|
+
deleteStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.deleteByIdStatement)(instance.id, tableName);
|
|
1964
|
+
deleteStatements.add(deleteStatement);
|
|
1965
|
+
result.push([item, _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.OpType.DELETE]);
|
|
1966
|
+
} else {
|
|
1967
|
+
// query statements for the saves at first
|
|
1968
|
+
queryStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.queryByIdStatement)(id, tableName);
|
|
1969
|
+
queryStatements.add(queryStatement);
|
|
1970
|
+
// combination of insert and update items
|
|
1971
|
+
itemsToSave.push(instance);
|
|
1972
|
+
}
|
|
1973
|
+
case 5:
|
|
1974
|
+
case "end":
|
|
1975
|
+
return _context10.stop();
|
|
1976
|
+
}
|
|
1977
|
+
}, _loop);
|
|
1978
|
+
});
|
|
1979
|
+
_iterator3.s();
|
|
1980
|
+
case 10:
|
|
1981
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
1982
|
+
_context11.next = 14;
|
|
1983
|
+
break;
|
|
806
1984
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1985
|
+
return _context11.delegateYield(_loop(), "t0", 12);
|
|
1986
|
+
case 12:
|
|
1987
|
+
_context11.next = 10;
|
|
1988
|
+
break;
|
|
1989
|
+
case 14:
|
|
1990
|
+
_context11.next = 19;
|
|
1991
|
+
break;
|
|
1992
|
+
case 16:
|
|
1993
|
+
_context11.prev = 16;
|
|
1994
|
+
_context11.t1 = _context11["catch"](7);
|
|
1995
|
+
_iterator3.e(_context11.t1);
|
|
1996
|
+
case 19:
|
|
1997
|
+
_context11.prev = 19;
|
|
1998
|
+
_iterator3.f();
|
|
1999
|
+
return _context11.finish(19);
|
|
2000
|
+
case 22:
|
|
2001
|
+
_context11.next = 24;
|
|
2002
|
+
return this.db.batchQuery(queryStatements);
|
|
2003
|
+
case 24:
|
|
2004
|
+
queryResponses = _context11.sent;
|
|
2005
|
+
queryResponses.forEach(function (response, idx) {
|
|
2006
|
+
if (response === undefined) {
|
|
2007
|
+
var insertStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.modelInsertStatement)(itemsToSave[idx], tableName);
|
|
2008
|
+
saveStatements.add(insertStatement);
|
|
2009
|
+
result.push([itemsToSave[idx], _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.OpType.INSERT]);
|
|
2010
|
+
} else {
|
|
2011
|
+
var updateStatement = (0,_common_SQLiteUtils__WEBPACK_IMPORTED_MODULE_1__.modelUpdateStatement)(itemsToSave[idx], tableName);
|
|
2012
|
+
saveStatements.add(updateStatement);
|
|
2013
|
+
result.push([itemsToSave[idx], _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_2__.OpType.UPDATE]);
|
|
2014
|
+
}
|
|
2015
|
+
});
|
|
2016
|
+
// perform all of the insert/update/delete operations in a single transaction
|
|
2017
|
+
_context11.next = 28;
|
|
2018
|
+
return this.db.batchSave(saveStatements, deleteStatements);
|
|
2019
|
+
case 28:
|
|
2020
|
+
return _context11.abrupt("return", result);
|
|
2021
|
+
case 29:
|
|
2022
|
+
case "end":
|
|
2023
|
+
return _context11.stop();
|
|
2024
|
+
}
|
|
2025
|
+
}, _callee10, this, [[7, 16, 19, 22]]);
|
|
2026
|
+
}));
|
|
2027
|
+
function batchSave(_x18, _x19) {
|
|
2028
|
+
return _batchSave.apply(this, arguments);
|
|
2029
|
+
}
|
|
2030
|
+
return batchSave;
|
|
2031
|
+
}()
|
|
2032
|
+
}]);
|
|
818
2033
|
return CommonSQLiteAdapter;
|
|
819
2034
|
}();
|
|
820
2035
|
|
|
821
|
-
|
|
822
2036
|
/***/ }),
|
|
823
2037
|
|
|
824
2038
|
/***/ "./lib-esm/common/SQLiteUtils.js":
|
|
@@ -845,9 +2059,71 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
845
2059
|
/* harmony export */ whereClauseFromPredicate: () => (/* binding */ whereClauseFromPredicate),
|
|
846
2060
|
/* harmony export */ whereConditionFromPredicateObject: () => (/* binding */ whereConditionFromPredicateObject)
|
|
847
2061
|
/* harmony export */ });
|
|
848
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.mjs");
|
|
849
2062
|
/* harmony import */ var _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/datastore */ "@aws-amplify/datastore");
|
|
850
2063
|
/* harmony import */ var _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__);
|
|
2064
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
2065
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
2066
|
+
if (!it) {
|
|
2067
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
2068
|
+
if (it) o = it;
|
|
2069
|
+
var i = 0;
|
|
2070
|
+
var F = function F() {};
|
|
2071
|
+
return {
|
|
2072
|
+
s: F,
|
|
2073
|
+
n: function n() {
|
|
2074
|
+
if (i >= o.length) return {
|
|
2075
|
+
done: true
|
|
2076
|
+
};
|
|
2077
|
+
return {
|
|
2078
|
+
done: false,
|
|
2079
|
+
value: o[i++]
|
|
2080
|
+
};
|
|
2081
|
+
},
|
|
2082
|
+
e: function e(_e) {
|
|
2083
|
+
throw _e;
|
|
2084
|
+
},
|
|
2085
|
+
f: F
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2089
|
+
}
|
|
2090
|
+
var normalCompletion = true,
|
|
2091
|
+
didErr = false,
|
|
2092
|
+
err;
|
|
2093
|
+
return {
|
|
2094
|
+
s: function s() {
|
|
2095
|
+
it = it.call(o);
|
|
2096
|
+
},
|
|
2097
|
+
n: function n() {
|
|
2098
|
+
var step = it.next();
|
|
2099
|
+
normalCompletion = step.done;
|
|
2100
|
+
return step;
|
|
2101
|
+
},
|
|
2102
|
+
e: function e(_e2) {
|
|
2103
|
+
didErr = true;
|
|
2104
|
+
err = _e2;
|
|
2105
|
+
},
|
|
2106
|
+
f: function f() {
|
|
2107
|
+
try {
|
|
2108
|
+
if (!normalCompletion && it["return"] != null) it["return"]();
|
|
2109
|
+
} finally {
|
|
2110
|
+
if (didErr) throw err;
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2114
|
+
}
|
|
2115
|
+
function _toConsumableArray(arr) {
|
|
2116
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
2117
|
+
}
|
|
2118
|
+
function _nonIterableSpread() {
|
|
2119
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2120
|
+
}
|
|
2121
|
+
function _iterableToArray(iter) {
|
|
2122
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2123
|
+
}
|
|
2124
|
+
function _arrayWithoutHoles(arr) {
|
|
2125
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
2126
|
+
}
|
|
851
2127
|
function _typeof(o) {
|
|
852
2128
|
"@babel/helpers - typeof";
|
|
853
2129
|
|
|
@@ -857,7 +2133,55 @@ function _typeof(o) {
|
|
|
857
2133
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
858
2134
|
}, _typeof(o);
|
|
859
2135
|
}
|
|
860
|
-
|
|
2136
|
+
function _slicedToArray(arr, i) {
|
|
2137
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
2138
|
+
}
|
|
2139
|
+
function _nonIterableRest() {
|
|
2140
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2141
|
+
}
|
|
2142
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
2143
|
+
if (!o) return;
|
|
2144
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
2145
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2146
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2147
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
2148
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
2149
|
+
}
|
|
2150
|
+
function _arrayLikeToArray(arr, len) {
|
|
2151
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2152
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
2153
|
+
return arr2;
|
|
2154
|
+
}
|
|
2155
|
+
function _iterableToArrayLimit(r, l) {
|
|
2156
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
2157
|
+
if (null != t) {
|
|
2158
|
+
var e,
|
|
2159
|
+
n,
|
|
2160
|
+
i,
|
|
2161
|
+
u,
|
|
2162
|
+
a = [],
|
|
2163
|
+
f = !0,
|
|
2164
|
+
o = !1;
|
|
2165
|
+
try {
|
|
2166
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
2167
|
+
if (Object(t) !== t) return;
|
|
2168
|
+
f = !1;
|
|
2169
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
2170
|
+
} catch (r) {
|
|
2171
|
+
o = !0, n = r;
|
|
2172
|
+
} finally {
|
|
2173
|
+
try {
|
|
2174
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
2175
|
+
} finally {
|
|
2176
|
+
if (o) throw n;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
return a;
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
function _arrayWithHoles(arr) {
|
|
2183
|
+
if (Array.isArray(arr)) return arr;
|
|
2184
|
+
}
|
|
861
2185
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
862
2186
|
// SPDX-License-Identifier: Apache-2.0
|
|
863
2187
|
|
|
@@ -866,7 +2190,7 @@ var USER = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__.utils.USER,
|
|
|
866
2190
|
isModelConstructor = _aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__.utils.isModelConstructor;
|
|
867
2191
|
var keysFromModel = function keysFromModel(model) {
|
|
868
2192
|
return Object.keys(model).map(function (k) {
|
|
869
|
-
return "\""
|
|
2193
|
+
return "\"".concat(k, "\"");
|
|
870
2194
|
}).join(', ');
|
|
871
2195
|
};
|
|
872
2196
|
var valuesFromModel = function valuesFromModel(model) {
|
|
@@ -878,16 +2202,16 @@ var valuesFromModel = function valuesFromModel(model) {
|
|
|
878
2202
|
};
|
|
879
2203
|
var updateSet = function updateSet(model) {
|
|
880
2204
|
var values = [];
|
|
881
|
-
var paramaterized = Object.entries(model).filter(function (
|
|
882
|
-
var
|
|
883
|
-
k =
|
|
2205
|
+
var paramaterized = Object.entries(model).filter(function (_ref) {
|
|
2206
|
+
var _ref2 = _slicedToArray(_ref, 1),
|
|
2207
|
+
k = _ref2[0];
|
|
884
2208
|
return k !== 'id';
|
|
885
|
-
}).map(function (
|
|
886
|
-
var
|
|
887
|
-
k =
|
|
888
|
-
v =
|
|
2209
|
+
}).map(function (_ref3) {
|
|
2210
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
2211
|
+
k = _ref4[0],
|
|
2212
|
+
v = _ref4[1];
|
|
889
2213
|
values.push(prepareValueForDML(v));
|
|
890
|
-
return "\""
|
|
2214
|
+
return "\"".concat(k, "\"=?");
|
|
891
2215
|
}).join(', ');
|
|
892
2216
|
return [paramaterized, values];
|
|
893
2217
|
};
|
|
@@ -901,7 +2225,7 @@ function prepareValueForDML(value) {
|
|
|
901
2225
|
if (Array.isArray(value) || isObjectType) {
|
|
902
2226
|
return JSON.stringify(value);
|
|
903
2227
|
}
|
|
904
|
-
return ""
|
|
2228
|
+
return "".concat(value);
|
|
905
2229
|
}
|
|
906
2230
|
function getSQLiteType(scalar) {
|
|
907
2231
|
switch (scalar) {
|
|
@@ -924,7 +2248,7 @@ function getSQLiteType(scalar) {
|
|
|
924
2248
|
return 'REAL';
|
|
925
2249
|
default:
|
|
926
2250
|
var _ = scalar;
|
|
927
|
-
throw new Error("unknown type "
|
|
2251
|
+
throw new Error("unknown type ".concat(scalar));
|
|
928
2252
|
}
|
|
929
2253
|
}
|
|
930
2254
|
function generateSchemaStatements(schema) {
|
|
@@ -956,75 +2280,75 @@ var implicitAuthFieldsForModel = function implicitAuthFieldsForModel(model) {
|
|
|
956
2280
|
return !authFieldExplicitlyDefined;
|
|
957
2281
|
});
|
|
958
2282
|
};
|
|
959
|
-
function modelCreateTableStatement(model
|
|
960
|
-
|
|
961
|
-
userModel = false;
|
|
962
|
-
}
|
|
2283
|
+
function modelCreateTableStatement(model) {
|
|
2284
|
+
var userModel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
963
2285
|
// implicitly defined auth fields, e.g., `owner`, `groupsField`, etc.
|
|
964
2286
|
var implicitAuthFields = implicitAuthFieldsForModel(model);
|
|
965
2287
|
var fields = Object.values(model.fields).reduce(function (acc, field) {
|
|
966
2288
|
if ((0,_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__.isGraphQLScalarType)(field.type)) {
|
|
967
2289
|
if (field.name === 'id') {
|
|
968
|
-
return
|
|
2290
|
+
return [].concat(_toConsumableArray(acc), ['"id" PRIMARY KEY NOT NULL']);
|
|
969
2291
|
}
|
|
970
|
-
var
|
|
2292
|
+
var _columnParam = "\"".concat(field.name, "\" ").concat(getSQLiteType(field.type));
|
|
971
2293
|
if (field.isRequired) {
|
|
972
|
-
|
|
2294
|
+
_columnParam += ' NOT NULL';
|
|
973
2295
|
}
|
|
974
|
-
return
|
|
2296
|
+
return [].concat(_toConsumableArray(acc), ["".concat(_columnParam)]);
|
|
975
2297
|
}
|
|
976
2298
|
if ((0,_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__.isModelFieldType)(field.type)) {
|
|
977
|
-
var
|
|
2299
|
+
var _columnParam2 = "\"".concat(field.name, "\" TEXT");
|
|
978
2300
|
// add targetName as well as field name for BELONGS_TO relations
|
|
979
2301
|
if ((0,_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__.isTargetNameAssociation)(field.association)) {
|
|
980
2302
|
// check if this field has been explicitly defined in the model
|
|
981
2303
|
var fkDefinedInModel = Object.values(model.fields).find(function (f) {
|
|
982
|
-
var
|
|
983
|
-
return f.name === (
|
|
2304
|
+
var _field$association;
|
|
2305
|
+
return f.name === (field === null || field === void 0 || (_field$association = field.association) === null || _field$association === void 0 ? void 0 : _field$association.targetName);
|
|
984
2306
|
});
|
|
985
2307
|
// if the FK is not explicitly defined in the model, we have to add it here
|
|
986
2308
|
if (!fkDefinedInModel) {
|
|
987
2309
|
var required = field.isRequired ? ' NOT NULL' : '';
|
|
988
|
-
|
|
2310
|
+
_columnParam2 += ", \"".concat(field.association.targetName, "\" TEXT").concat(required);
|
|
989
2311
|
}
|
|
990
2312
|
}
|
|
991
2313
|
// ignore isRequired param for model fields, since they will not contain
|
|
992
2314
|
// the related data locally
|
|
993
|
-
return
|
|
2315
|
+
return [].concat(_toConsumableArray(acc), ["".concat(_columnParam2)]);
|
|
994
2316
|
}
|
|
995
2317
|
// default to TEXT
|
|
996
|
-
var columnParam = "\""
|
|
2318
|
+
var columnParam = "\"".concat(field.name, "\" TEXT");
|
|
997
2319
|
if (field.isRequired) {
|
|
998
2320
|
columnParam += ' NOT NULL';
|
|
999
2321
|
}
|
|
1000
|
-
return
|
|
2322
|
+
return [].concat(_toConsumableArray(acc), ["".concat(columnParam)]);
|
|
1001
2323
|
}, []);
|
|
1002
2324
|
implicitAuthFields.forEach(function (authField) {
|
|
1003
|
-
fields.push(authField
|
|
2325
|
+
fields.push("".concat(authField, " TEXT"));
|
|
1004
2326
|
});
|
|
1005
2327
|
if (userModel) {
|
|
1006
|
-
fields =
|
|
2328
|
+
fields = [].concat(_toConsumableArray(fields), ["\"_version\" INTEGER", "\"_lastChangedAt\" INTEGER", "\"_deleted\" INTEGER"]);
|
|
1007
2329
|
}
|
|
1008
|
-
var createTableStatement = "CREATE TABLE IF NOT EXISTS \""
|
|
2330
|
+
var createTableStatement = "CREATE TABLE IF NOT EXISTS \"".concat(model.name, "\" (").concat(fields.join(', '), ");");
|
|
1009
2331
|
return createTableStatement;
|
|
1010
2332
|
}
|
|
1011
2333
|
function modelInsertStatement(model, tableName) {
|
|
1012
2334
|
var keys = keysFromModel(model);
|
|
1013
|
-
var
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
2335
|
+
var _valuesFromModel = valuesFromModel(model),
|
|
2336
|
+
_valuesFromModel2 = _slicedToArray(_valuesFromModel, 2),
|
|
2337
|
+
paramaterized = _valuesFromModel2[0],
|
|
2338
|
+
values = _valuesFromModel2[1];
|
|
2339
|
+
var insertStatement = "INSERT INTO \"".concat(tableName, "\" (").concat(keys, ") VALUES (").concat(paramaterized, ")");
|
|
1017
2340
|
return [insertStatement, values];
|
|
1018
2341
|
}
|
|
1019
2342
|
function modelUpdateStatement(model, tableName) {
|
|
1020
|
-
var
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
2343
|
+
var _updateSet = updateSet(model),
|
|
2344
|
+
_updateSet2 = _slicedToArray(_updateSet, 2),
|
|
2345
|
+
paramaterized = _updateSet2[0],
|
|
2346
|
+
values = _updateSet2[1];
|
|
2347
|
+
var updateStatement = "UPDATE \"".concat(tableName, "\" SET ").concat(paramaterized, " WHERE id=?");
|
|
2348
|
+
return [updateStatement, [].concat(_toConsumableArray(values), [model.id])];
|
|
1025
2349
|
}
|
|
1026
2350
|
function queryByIdStatement(id, tableName) {
|
|
1027
|
-
return ["SELECT * FROM \""
|
|
2351
|
+
return ["SELECT * FROM \"".concat(tableName, "\" WHERE \"id\" = ?"), [id]];
|
|
1028
2352
|
}
|
|
1029
2353
|
/*
|
|
1030
2354
|
Predicates supported by DataStore:
|
|
@@ -1061,25 +2385,25 @@ var logicalOperatorMap = {
|
|
|
1061
2385
|
function buildSpecialNullComparison(field, operator, operand) {
|
|
1062
2386
|
if (operand === null || operand === undefined) {
|
|
1063
2387
|
if (operator === 'eq') {
|
|
1064
|
-
return "\""
|
|
2388
|
+
return "\"".concat(field, "\" IS NULL");
|
|
1065
2389
|
} else if (operator === 'ne') {
|
|
1066
|
-
return "\""
|
|
2390
|
+
return "\"".concat(field, "\" IS NOT NULL");
|
|
1067
2391
|
}
|
|
1068
2392
|
}
|
|
1069
2393
|
// no special null handling required
|
|
1070
2394
|
return null;
|
|
1071
2395
|
}
|
|
1072
|
-
var whereConditionFromPredicateObject = function whereConditionFromPredicateObject(
|
|
1073
|
-
var field =
|
|
1074
|
-
operator =
|
|
1075
|
-
operand =
|
|
2396
|
+
var whereConditionFromPredicateObject = function whereConditionFromPredicateObject(_ref5) {
|
|
2397
|
+
var field = _ref5.field,
|
|
2398
|
+
operator = _ref5.operator,
|
|
2399
|
+
operand = _ref5.operand;
|
|
1076
2400
|
var specialNullClause = buildSpecialNullComparison(field, operator, operand);
|
|
1077
2401
|
if (specialNullClause) {
|
|
1078
2402
|
return [specialNullClause, []];
|
|
1079
2403
|
}
|
|
1080
2404
|
var comparisonOperator = comparisonOperatorMap[operator];
|
|
1081
2405
|
if (comparisonOperator) {
|
|
1082
|
-
return ["\""
|
|
2406
|
+
return ["\"".concat(field, "\" ").concat(comparisonOperator, " ?"), [operand]];
|
|
1083
2407
|
}
|
|
1084
2408
|
var logicalOperatorKey = operator;
|
|
1085
2409
|
var logicalOperator = logicalOperatorMap[logicalOperatorKey];
|
|
@@ -1089,14 +2413,14 @@ var whereConditionFromPredicateObject = function whereConditionFromPredicateObje
|
|
|
1089
2413
|
switch (logicalOperatorKey) {
|
|
1090
2414
|
case 'between':
|
|
1091
2415
|
rightExp = operand; // operand is a 2-tuple
|
|
1092
|
-
statement = ["\""
|
|
2416
|
+
statement = ["\"".concat(field, "\" ").concat(logicalOperator, " ").concat(rightExp.map(function (_) {
|
|
1093
2417
|
return '?';
|
|
1094
|
-
}).join(' AND '), rightExp];
|
|
2418
|
+
}).join(' AND ')), rightExp];
|
|
1095
2419
|
break;
|
|
1096
2420
|
case 'beginsWith':
|
|
1097
2421
|
case 'contains':
|
|
1098
2422
|
case 'notContains':
|
|
1099
|
-
statement = ["instr(\""
|
|
2423
|
+
statement = ["instr(\"".concat(field, "\", ?) ").concat(logicalOperator), [operand]];
|
|
1100
2424
|
break;
|
|
1101
2425
|
default:
|
|
1102
2426
|
var _ = logicalOperatorKey;
|
|
@@ -1110,16 +2434,11 @@ function whereClauseFromPredicate(predicate) {
|
|
|
1110
2434
|
var result = [];
|
|
1111
2435
|
var params = [];
|
|
1112
2436
|
recurse(predicate, result, params);
|
|
1113
|
-
var whereClause = "WHERE "
|
|
2437
|
+
var whereClause = "WHERE ".concat(result.join(' '));
|
|
1114
2438
|
return [whereClause, params];
|
|
1115
|
-
function recurse(predicate
|
|
1116
|
-
var
|
|
1117
|
-
|
|
1118
|
-
result = [];
|
|
1119
|
-
}
|
|
1120
|
-
if (params === void 0) {
|
|
1121
|
-
params = [];
|
|
1122
|
-
}
|
|
2439
|
+
function recurse(predicate) {
|
|
2440
|
+
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
2441
|
+
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1123
2442
|
if ((0,_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__.isPredicateGroup)(predicate)) {
|
|
1124
2443
|
var groupType = predicate.type,
|
|
1125
2444
|
groupPredicates = predicate.predicates;
|
|
@@ -1137,32 +2456,29 @@ function whereClauseFromPredicate(predicate) {
|
|
|
1137
2456
|
break;
|
|
1138
2457
|
default:
|
|
1139
2458
|
var _ = groupType;
|
|
1140
|
-
throw new Error("Invalid "
|
|
2459
|
+
throw new Error("Invalid ".concat(groupType));
|
|
1141
2460
|
}
|
|
1142
2461
|
var groupResult = [];
|
|
2462
|
+
var _iterator = _createForOfIteratorHelper(groupPredicates),
|
|
2463
|
+
_step;
|
|
1143
2464
|
try {
|
|
1144
|
-
for (
|
|
1145
|
-
var p =
|
|
2465
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2466
|
+
var p = _step.value;
|
|
1146
2467
|
recurse(p, groupResult, params);
|
|
1147
2468
|
}
|
|
1148
|
-
} catch (
|
|
1149
|
-
|
|
1150
|
-
error: e_1_1
|
|
1151
|
-
};
|
|
2469
|
+
} catch (err) {
|
|
2470
|
+
_iterator.e(err);
|
|
1152
2471
|
} finally {
|
|
1153
|
-
|
|
1154
|
-
if (groupPredicates_1_1 && !groupPredicates_1_1.done && (_a = groupPredicates_1["return"])) _a.call(groupPredicates_1);
|
|
1155
|
-
} finally {
|
|
1156
|
-
if (e_1) throw e_1.error;
|
|
1157
|
-
}
|
|
2472
|
+
_iterator.f();
|
|
1158
2473
|
}
|
|
1159
|
-
result.push((isNegation ? 'NOT' : ''
|
|
2474
|
+
result.push("".concat(isNegation ? 'NOT' : '', "(").concat(groupResult.join(" ".concat(filterType, " ")), ")"));
|
|
1160
2475
|
} else if ((0,_aws_amplify_datastore__WEBPACK_IMPORTED_MODULE_0__.isPredicateObj)(predicate)) {
|
|
1161
|
-
var
|
|
1162
|
-
|
|
1163
|
-
|
|
2476
|
+
var _whereConditionFromPr = whereConditionFromPredicateObject(predicate),
|
|
2477
|
+
_whereConditionFromPr2 = _slicedToArray(_whereConditionFromPr, 2),
|
|
2478
|
+
condition = _whereConditionFromPr2[0],
|
|
2479
|
+
conditionParams = _whereConditionFromPr2[1];
|
|
1164
2480
|
result.push(condition);
|
|
1165
|
-
params.push.apply(params, (
|
|
2481
|
+
params.push.apply(params, _toConsumableArray(conditionParams));
|
|
1166
2482
|
}
|
|
1167
2483
|
}
|
|
1168
2484
|
}
|
|
@@ -1170,23 +2486,19 @@ var sortDirectionMap = {
|
|
|
1170
2486
|
ASCENDING: 'ASC',
|
|
1171
2487
|
DESCENDING: 'DESC'
|
|
1172
2488
|
};
|
|
1173
|
-
function orderByClauseFromSort(
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
sortDirection = _a.sortDirection;
|
|
1180
|
-
return "\"" + field + "\" " + sortDirectionMap[sortDirection];
|
|
2489
|
+
function orderByClauseFromSort() {
|
|
2490
|
+
var sortPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2491
|
+
var orderByParts = sortPredicate.map(function (_ref6) {
|
|
2492
|
+
var field = _ref6.field,
|
|
2493
|
+
sortDirection = _ref6.sortDirection;
|
|
2494
|
+
return "\"".concat(field, "\" ").concat(sortDirectionMap[sortDirection]);
|
|
1181
2495
|
});
|
|
1182
2496
|
// We always sort by _rowid_ last
|
|
1183
|
-
orderByParts.push("_rowid_ "
|
|
1184
|
-
return "ORDER BY "
|
|
2497
|
+
orderByParts.push("_rowid_ ".concat(sortDirectionMap.ASCENDING));
|
|
2498
|
+
return "ORDER BY ".concat(orderByParts.join(', '));
|
|
1185
2499
|
}
|
|
1186
|
-
function limitClauseFromPagination(limit
|
|
1187
|
-
|
|
1188
|
-
page = 0;
|
|
1189
|
-
}
|
|
2500
|
+
function limitClauseFromPagination(limit) {
|
|
2501
|
+
var page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1190
2502
|
var params = [limit];
|
|
1191
2503
|
var clause = 'LIMIT ?';
|
|
1192
2504
|
if (page) {
|
|
@@ -1197,23 +2509,25 @@ function limitClauseFromPagination(limit, page) {
|
|
|
1197
2509
|
return [clause, params];
|
|
1198
2510
|
}
|
|
1199
2511
|
function queryAllStatement(tableName, predicate, sort, limit, page) {
|
|
1200
|
-
var statement = "SELECT * FROM \""
|
|
2512
|
+
var statement = "SELECT * FROM \"".concat(tableName, "\"");
|
|
1201
2513
|
var params = [];
|
|
1202
2514
|
if (predicate && predicate.predicates.length) {
|
|
1203
|
-
var
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
2515
|
+
var _whereClauseFromPredi = whereClauseFromPredicate(predicate),
|
|
2516
|
+
_whereClauseFromPredi2 = _slicedToArray(_whereClauseFromPredi, 2),
|
|
2517
|
+
whereClause = _whereClauseFromPredi2[0],
|
|
2518
|
+
whereParams = _whereClauseFromPredi2[1];
|
|
2519
|
+
statement += " ".concat(whereClause);
|
|
2520
|
+
params.push.apply(params, _toConsumableArray(whereParams));
|
|
1208
2521
|
}
|
|
1209
2522
|
var orderByClause = orderByClauseFromSort(sort);
|
|
1210
|
-
statement += " "
|
|
2523
|
+
statement += " ".concat(orderByClause);
|
|
1211
2524
|
if (limit) {
|
|
1212
|
-
var
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
2525
|
+
var _limitClauseFromPagin = limitClauseFromPagination(limit, page),
|
|
2526
|
+
_limitClauseFromPagin2 = _slicedToArray(_limitClauseFromPagin, 2),
|
|
2527
|
+
limitClause = _limitClauseFromPagin2[0],
|
|
2528
|
+
limitParams = _limitClauseFromPagin2[1];
|
|
2529
|
+
statement += " ".concat(limitClause);
|
|
2530
|
+
params.push.apply(params, _toConsumableArray(limitParams));
|
|
1217
2531
|
}
|
|
1218
2532
|
return [statement, params];
|
|
1219
2533
|
}
|
|
@@ -1222,24 +2536,25 @@ function queryOneStatement(firstOrLast, tableName) {
|
|
|
1222
2536
|
// ORDER BY rowid will no longer work as expected if a customer has
|
|
1223
2537
|
// a field by that name in their schema. We may want to enforce it
|
|
1224
2538
|
// as a reserved keyword in Codegen
|
|
1225
|
-
return ["SELECT * FROM "
|
|
2539
|
+
return ["SELECT * FROM ".concat(tableName, " ORDER BY _rowid_ LIMIT 1"), []];
|
|
1226
2540
|
} else {
|
|
1227
|
-
return ["SELECT * FROM "
|
|
2541
|
+
return ["SELECT * FROM ".concat(tableName, " ORDER BY _rowid_ DESC LIMIT 1"), []];
|
|
1228
2542
|
}
|
|
1229
2543
|
}
|
|
1230
2544
|
function deleteByIdStatement(id, tableName) {
|
|
1231
|
-
var deleteStatement = "DELETE FROM \""
|
|
2545
|
+
var deleteStatement = "DELETE FROM \"".concat(tableName, "\" WHERE \"id\"=?");
|
|
1232
2546
|
return [deleteStatement, [id]];
|
|
1233
2547
|
}
|
|
1234
2548
|
function deleteByPredicateStatement(tableName, predicate) {
|
|
1235
|
-
var statement = "DELETE FROM \""
|
|
2549
|
+
var statement = "DELETE FROM \"".concat(tableName, "\"");
|
|
1236
2550
|
var params = [];
|
|
1237
2551
|
if (predicate && predicate.predicates.length) {
|
|
1238
|
-
var
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
2552
|
+
var _whereClauseFromPredi3 = whereClauseFromPredicate(predicate),
|
|
2553
|
+
_whereClauseFromPredi4 = _slicedToArray(_whereClauseFromPredi3, 2),
|
|
2554
|
+
whereClause = _whereClauseFromPredi4[0],
|
|
2555
|
+
whereParams = _whereClauseFromPredi4[1];
|
|
2556
|
+
statement += " ".concat(whereClause);
|
|
2557
|
+
params.push.apply(params, _toConsumableArray(whereParams));
|
|
1243
2558
|
}
|
|
1244
2559
|
return [statement, params];
|
|
1245
2560
|
}
|
|
@@ -1290,421 +2605,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__aws_amplify_datastore__;
|
|
|
1290
2605
|
|
|
1291
2606
|
module.exports = __WEBPACK_EXTERNAL_MODULE_react_native_sqlite_storage__;
|
|
1292
2607
|
|
|
1293
|
-
/***/ }),
|
|
1294
|
-
|
|
1295
|
-
/***/ "../../node_modules/tslib/tslib.es6.mjs":
|
|
1296
|
-
/*!**********************************************!*\
|
|
1297
|
-
!*** ../../node_modules/tslib/tslib.es6.mjs ***!
|
|
1298
|
-
\**********************************************/
|
|
1299
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
1300
|
-
|
|
1301
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1302
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1303
|
-
/* harmony export */ __addDisposableResource: () => (/* binding */ __addDisposableResource),
|
|
1304
|
-
/* harmony export */ __assign: () => (/* binding */ __assign),
|
|
1305
|
-
/* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator),
|
|
1306
|
-
/* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator),
|
|
1307
|
-
/* harmony export */ __asyncValues: () => (/* binding */ __asyncValues),
|
|
1308
|
-
/* harmony export */ __await: () => (/* binding */ __await),
|
|
1309
|
-
/* harmony export */ __awaiter: () => (/* binding */ __awaiter),
|
|
1310
|
-
/* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet),
|
|
1311
|
-
/* harmony export */ __classPrivateFieldIn: () => (/* binding */ __classPrivateFieldIn),
|
|
1312
|
-
/* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet),
|
|
1313
|
-
/* harmony export */ __createBinding: () => (/* binding */ __createBinding),
|
|
1314
|
-
/* harmony export */ __decorate: () => (/* binding */ __decorate),
|
|
1315
|
-
/* harmony export */ __disposeResources: () => (/* binding */ __disposeResources),
|
|
1316
|
-
/* harmony export */ __esDecorate: () => (/* binding */ __esDecorate),
|
|
1317
|
-
/* harmony export */ __exportStar: () => (/* binding */ __exportStar),
|
|
1318
|
-
/* harmony export */ __extends: () => (/* binding */ __extends),
|
|
1319
|
-
/* harmony export */ __generator: () => (/* binding */ __generator),
|
|
1320
|
-
/* harmony export */ __importDefault: () => (/* binding */ __importDefault),
|
|
1321
|
-
/* harmony export */ __importStar: () => (/* binding */ __importStar),
|
|
1322
|
-
/* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject),
|
|
1323
|
-
/* harmony export */ __metadata: () => (/* binding */ __metadata),
|
|
1324
|
-
/* harmony export */ __param: () => (/* binding */ __param),
|
|
1325
|
-
/* harmony export */ __propKey: () => (/* binding */ __propKey),
|
|
1326
|
-
/* harmony export */ __read: () => (/* binding */ __read),
|
|
1327
|
-
/* harmony export */ __rest: () => (/* binding */ __rest),
|
|
1328
|
-
/* harmony export */ __runInitializers: () => (/* binding */ __runInitializers),
|
|
1329
|
-
/* harmony export */ __setFunctionName: () => (/* binding */ __setFunctionName),
|
|
1330
|
-
/* harmony export */ __spread: () => (/* binding */ __spread),
|
|
1331
|
-
/* harmony export */ __spreadArray: () => (/* binding */ __spreadArray),
|
|
1332
|
-
/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays),
|
|
1333
|
-
/* harmony export */ __values: () => (/* binding */ __values),
|
|
1334
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1335
|
-
/* harmony export */ });
|
|
1336
|
-
/******************************************************************************
|
|
1337
|
-
Copyright (c) Microsoft Corporation.
|
|
1338
|
-
|
|
1339
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1340
|
-
purpose with or without fee is hereby granted.
|
|
1341
|
-
|
|
1342
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1343
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1344
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1345
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1346
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1347
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1348
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1349
|
-
***************************************************************************** */
|
|
1350
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
1351
|
-
|
|
1352
|
-
var extendStatics = function(d, b) {
|
|
1353
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1354
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1355
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1356
|
-
return extendStatics(d, b);
|
|
1357
|
-
};
|
|
1358
|
-
|
|
1359
|
-
function __extends(d, b) {
|
|
1360
|
-
if (typeof b !== "function" && b !== null)
|
|
1361
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1362
|
-
extendStatics(d, b);
|
|
1363
|
-
function __() { this.constructor = d; }
|
|
1364
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
var __assign = function() {
|
|
1368
|
-
__assign = Object.assign || function __assign(t) {
|
|
1369
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1370
|
-
s = arguments[i];
|
|
1371
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1372
|
-
}
|
|
1373
|
-
return t;
|
|
1374
|
-
}
|
|
1375
|
-
return __assign.apply(this, arguments);
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
function __rest(s, e) {
|
|
1379
|
-
var t = {};
|
|
1380
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1381
|
-
t[p] = s[p];
|
|
1382
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1383
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1384
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1385
|
-
t[p[i]] = s[p[i]];
|
|
1386
|
-
}
|
|
1387
|
-
return t;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
function __decorate(decorators, target, key, desc) {
|
|
1391
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1392
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1393
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1394
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
function __param(paramIndex, decorator) {
|
|
1398
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
1402
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
1403
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
1404
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
1405
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
1406
|
-
var _, done = false;
|
|
1407
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1408
|
-
var context = {};
|
|
1409
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
1410
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
1411
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
1412
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
1413
|
-
if (kind === "accessor") {
|
|
1414
|
-
if (result === void 0) continue;
|
|
1415
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
1416
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
1417
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
1418
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
1419
|
-
}
|
|
1420
|
-
else if (_ = accept(result)) {
|
|
1421
|
-
if (kind === "field") initializers.unshift(_);
|
|
1422
|
-
else descriptor[key] = _;
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
1426
|
-
done = true;
|
|
1427
|
-
};
|
|
1428
|
-
|
|
1429
|
-
function __runInitializers(thisArg, initializers, value) {
|
|
1430
|
-
var useValue = arguments.length > 2;
|
|
1431
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
1432
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
1433
|
-
}
|
|
1434
|
-
return useValue ? value : void 0;
|
|
1435
|
-
};
|
|
1436
|
-
|
|
1437
|
-
function __propKey(x) {
|
|
1438
|
-
return typeof x === "symbol" ? x : "".concat(x);
|
|
1439
|
-
};
|
|
1440
|
-
|
|
1441
|
-
function __setFunctionName(f, name, prefix) {
|
|
1442
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
1443
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
1444
|
-
};
|
|
1445
|
-
|
|
1446
|
-
function __metadata(metadataKey, metadataValue) {
|
|
1447
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1451
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1452
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1453
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1454
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1455
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1456
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
function __generator(thisArg, body) {
|
|
1461
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1462
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1463
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1464
|
-
function step(op) {
|
|
1465
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1466
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
1467
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1468
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1469
|
-
switch (op[0]) {
|
|
1470
|
-
case 0: case 1: t = op; break;
|
|
1471
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
1472
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1473
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1474
|
-
default:
|
|
1475
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1476
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1477
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1478
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1479
|
-
if (t[2]) _.ops.pop();
|
|
1480
|
-
_.trys.pop(); continue;
|
|
1481
|
-
}
|
|
1482
|
-
op = body.call(thisArg, _);
|
|
1483
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1484
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
1489
|
-
if (k2 === undefined) k2 = k;
|
|
1490
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1491
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1492
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1493
|
-
}
|
|
1494
|
-
Object.defineProperty(o, k2, desc);
|
|
1495
|
-
}) : (function(o, m, k, k2) {
|
|
1496
|
-
if (k2 === undefined) k2 = k;
|
|
1497
|
-
o[k2] = m[k];
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
function __exportStar(m, o) {
|
|
1501
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
function __values(o) {
|
|
1505
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
1506
|
-
if (m) return m.call(o);
|
|
1507
|
-
if (o && typeof o.length === "number") return {
|
|
1508
|
-
next: function () {
|
|
1509
|
-
if (o && i >= o.length) o = void 0;
|
|
1510
|
-
return { value: o && o[i++], done: !o };
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
function __read(o, n) {
|
|
1517
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1518
|
-
if (!m) return o;
|
|
1519
|
-
var i = m.call(o), r, ar = [], e;
|
|
1520
|
-
try {
|
|
1521
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
1522
|
-
}
|
|
1523
|
-
catch (error) { e = { error: error }; }
|
|
1524
|
-
finally {
|
|
1525
|
-
try {
|
|
1526
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
1527
|
-
}
|
|
1528
|
-
finally { if (e) throw e.error; }
|
|
1529
|
-
}
|
|
1530
|
-
return ar;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
/** @deprecated */
|
|
1534
|
-
function __spread() {
|
|
1535
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
1536
|
-
ar = ar.concat(__read(arguments[i]));
|
|
1537
|
-
return ar;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
/** @deprecated */
|
|
1541
|
-
function __spreadArrays() {
|
|
1542
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
1543
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
1544
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
1545
|
-
r[k] = a[j];
|
|
1546
|
-
return r;
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
function __spreadArray(to, from, pack) {
|
|
1550
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1551
|
-
if (ar || !(i in from)) {
|
|
1552
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1553
|
-
ar[i] = from[i];
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
function __await(v) {
|
|
1560
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
1564
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1565
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
1566
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
1567
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
1568
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
1569
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
1570
|
-
function fulfill(value) { resume("next", value); }
|
|
1571
|
-
function reject(value) { resume("throw", value); }
|
|
1572
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
function __asyncDelegator(o) {
|
|
1576
|
-
var i, p;
|
|
1577
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
1578
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
function __asyncValues(o) {
|
|
1582
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1583
|
-
var m = o[Symbol.asyncIterator], i;
|
|
1584
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
1585
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
1586
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
function __makeTemplateObject(cooked, raw) {
|
|
1590
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
1591
|
-
return cooked;
|
|
1592
|
-
};
|
|
1593
|
-
|
|
1594
|
-
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
1595
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1596
|
-
}) : function(o, v) {
|
|
1597
|
-
o["default"] = v;
|
|
1598
|
-
};
|
|
1599
|
-
|
|
1600
|
-
function __importStar(mod) {
|
|
1601
|
-
if (mod && mod.__esModule) return mod;
|
|
1602
|
-
var result = {};
|
|
1603
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1604
|
-
__setModuleDefault(result, mod);
|
|
1605
|
-
return result;
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
function __importDefault(mod) {
|
|
1609
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
1613
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1614
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1615
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
1619
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1620
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1621
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1622
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
function __classPrivateFieldIn(state, receiver) {
|
|
1626
|
-
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1627
|
-
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
function __addDisposableResource(env, value, async) {
|
|
1631
|
-
if (value !== null && value !== void 0) {
|
|
1632
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
1633
|
-
var dispose;
|
|
1634
|
-
if (async) {
|
|
1635
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
1636
|
-
dispose = value[Symbol.asyncDispose];
|
|
1637
|
-
}
|
|
1638
|
-
if (dispose === void 0) {
|
|
1639
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
1640
|
-
dispose = value[Symbol.dispose];
|
|
1641
|
-
}
|
|
1642
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
1643
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
1644
|
-
}
|
|
1645
|
-
else if (async) {
|
|
1646
|
-
env.stack.push({ async: true });
|
|
1647
|
-
}
|
|
1648
|
-
return value;
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1652
|
-
var e = new Error(message);
|
|
1653
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1654
|
-
};
|
|
1655
|
-
|
|
1656
|
-
function __disposeResources(env) {
|
|
1657
|
-
function fail(e) {
|
|
1658
|
-
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
1659
|
-
env.hasError = true;
|
|
1660
|
-
}
|
|
1661
|
-
function next() {
|
|
1662
|
-
while (env.stack.length) {
|
|
1663
|
-
var rec = env.stack.pop();
|
|
1664
|
-
try {
|
|
1665
|
-
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
1666
|
-
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
1667
|
-
}
|
|
1668
|
-
catch (e) {
|
|
1669
|
-
fail(e);
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
if (env.hasError) throw env.error;
|
|
1673
|
-
}
|
|
1674
|
-
return next();
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
1678
|
-
__extends,
|
|
1679
|
-
__assign,
|
|
1680
|
-
__rest,
|
|
1681
|
-
__decorate,
|
|
1682
|
-
__param,
|
|
1683
|
-
__metadata,
|
|
1684
|
-
__awaiter,
|
|
1685
|
-
__generator,
|
|
1686
|
-
__createBinding,
|
|
1687
|
-
__exportStar,
|
|
1688
|
-
__values,
|
|
1689
|
-
__read,
|
|
1690
|
-
__spread,
|
|
1691
|
-
__spreadArrays,
|
|
1692
|
-
__spreadArray,
|
|
1693
|
-
__await,
|
|
1694
|
-
__asyncGenerator,
|
|
1695
|
-
__asyncDelegator,
|
|
1696
|
-
__asyncValues,
|
|
1697
|
-
__makeTemplateObject,
|
|
1698
|
-
__importStar,
|
|
1699
|
-
__importDefault,
|
|
1700
|
-
__classPrivateFieldGet,
|
|
1701
|
-
__classPrivateFieldSet,
|
|
1702
|
-
__classPrivateFieldIn,
|
|
1703
|
-
__addDisposableResource,
|
|
1704
|
-
__disposeResources,
|
|
1705
|
-
});
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
2608
|
/***/ })
|
|
1709
2609
|
|
|
1710
2610
|
/******/ });
|