sqlite-wasm-viewer 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # SQLite Wasm Viewer
2
+
3
+ A simple web-based SQLite browser that lets you inspect SQLite databases created by the [SQLite Wasm module](https://github.com/sqlite/sqlite-wasm) and stored in OPFS storage. It also supports running queries and filtering tables.
4
+
5
+ ![Viewer](screenshot.png)
6
+
7
+ # Installation
8
+ ```
9
+ npm install --save sqlite-wasm-viewer
10
+ ```
11
+
12
+ or
13
+
14
+ ```
15
+ yarn add sqlite-wasm-viewer
16
+ ```
17
+
18
+ # Usage
19
+ To open the viewer:
20
+ ```js
21
+ import { showViewer } from 'sqlite-wasm-viewer';
22
+
23
+ showViewer();
24
+ ```
25
+
26
+ By default, only files ending with '.db' or '.sqlite' are recognized as SQLite databases, but you can modify this behavior as follows:
27
+ ```js
28
+ import { showViewer, setConfig } from 'sqlite-wasm-viewer';
29
+
30
+ setConfig({
31
+ isSqliteDatabase: databaseName => {
32
+ // return true if databaseName is an SQLite db
33
+ },
34
+ });
35
+
36
+ showViewer();
37
+ ```
38
+
39
+ # Development
40
+ A testing app will be available on `http://localhost:9000` after running:
41
+ ```
42
+ yarn start
43
+ ```
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DbViewerWorker = void 0;
7
+ var _sqliteWasm = _interopRequireDefault(require("@sqlite.org/sqlite-wasm"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
11
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // @ts-expect-error Missing types
19
+ var DbViewerWorker = /*#__PURE__*/function () {
20
+ function DbViewerWorker() {
21
+ _classCallCheck(this, DbViewerWorker);
22
+ _defineProperty(this, "initialized", false);
23
+ this.initialized = false;
24
+ this.dbsByPath = {};
25
+ }
26
+ _createClass(DbViewerWorker, [{
27
+ key: "post",
28
+ value: function post(message) {
29
+ var _this = this;
30
+ if (message.data.type !== 'init' && !this.initialized) {
31
+ throw new Error("DbWorker not initialized with 'init' message");
32
+ }
33
+ if (message.data.type === 'init') {
34
+ if (this.initialized) {
35
+ throw new Error('DbWorker already initialized');
36
+ }
37
+ (0, _sqliteWasm["default"])().then( /*#__PURE__*/function () {
38
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sqlite3) {
39
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
40
+ while (1) switch (_context.prev = _context.next) {
41
+ case 0:
42
+ _this.sqlite = sqlite3;
43
+ _this.sqliteCApi = sqlite3.capi;
44
+ _this.initialized = true;
45
+ _this.sendMessage({
46
+ type: 'onReady'
47
+ });
48
+ case 4:
49
+ case "end":
50
+ return _context.stop();
51
+ }
52
+ }, _callee);
53
+ }));
54
+ return function (_x) {
55
+ return _ref.apply(this, arguments);
56
+ };
57
+ }());
58
+ }
59
+ switch (message.data.type) {
60
+ case 'readSchema':
61
+ {
62
+ var _path = message.data.path;
63
+ this.dbsByPath[_path] = new this.sqlite.oo1.OpfsDb(_path, 'c');
64
+ var sql = "SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name";
65
+ var result = this.dbsByPath[_path].exec({
66
+ sql: sql,
67
+ returnValue: 'resultRows'
68
+ });
69
+ this.sendMessage({
70
+ type: 'onSchema',
71
+ schema: result,
72
+ dbName: _path
73
+ });
74
+ }
75
+ break;
76
+ case 'query':
77
+ {
78
+ var _message$data$query = message.data.query,
79
+ _sql = _message$data$query.sql,
80
+ parameters = _message$data$query.parameters;
81
+ var databasePath = message.data.databasePath;
82
+ var db = this.dbsByPath[databasePath];
83
+ var rawStatement = db.prepare(_sql);
84
+ var isReader = this.sqliteCApi.sqlite3_column_count(rawStatement) > 1;
85
+ var resultRows = [];
86
+ try {
87
+ if ((parameters === null || parameters === void 0 ? void 0 : parameters.length) > 0) {
88
+ rawStatement.bind(parameters);
89
+ }
90
+ while (rawStatement.step()) {
91
+ // Kysely expects the results to be in the object mode
92
+ var row = rawStatement.get({});
93
+ resultRows.push(row);
94
+ }
95
+ } finally {
96
+ rawStatement.finalize();
97
+ }
98
+ if (isReader) {
99
+ this.sendMessage({
100
+ type: 'onQuery',
101
+ result: {
102
+ resultRows: resultRows,
103
+ tableName: ''
104
+ },
105
+ label: message.data.label
106
+ });
107
+ } else {
108
+ var changes = this.sqliteCApi.sqlite3_changes(db.pointer);
109
+ var lastInsertRowid = this.sqliteCApi.sqlite3_last_insert_rowid(db.pointer);
110
+ var updates = {
111
+ changes: changes,
112
+ lastInsertRowid: lastInsertRowid
113
+ };
114
+ this.sendMessage({
115
+ type: 'onQuery',
116
+ result: {
117
+ resultRows: resultRows,
118
+ updates: updates,
119
+ tableName: ''
120
+ }
121
+ });
122
+ }
123
+ }
124
+ break;
125
+ default:
126
+ break;
127
+ }
128
+ }
129
+ }, {
130
+ key: "sendMessage",
131
+ value: function sendMessage(message) {
132
+ postMessage(message);
133
+ }
134
+ }]);
135
+ return DbViewerWorker;
136
+ }();
137
+ exports.DbViewerWorker = DbViewerWorker;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var _DbViewerWorker = require("./DbViewerWorker");
4
+ var dbWorker = new _DbViewerWorker.DbViewerWorker();
5
+ onmessage = function onmessage(message) {
6
+ dbWorker.post(message);
7
+ };
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ListVirtualizer = void 0;
7
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ var ListVirtualizer = /*#__PURE__*/function () {
14
+ function ListVirtualizer(config) {
15
+ _classCallCheck(this, ListVirtualizer);
16
+ this.height = config.height;
17
+ this.itemHeight = config.itemHeight;
18
+ this.lastRepaintY = 0;
19
+ this.scrollTop = 0;
20
+ this.generatorFn = config.generatorFn;
21
+ this.totalRows = config.totalRows;
22
+ this.container = config.container;
23
+ this.contentRoot = config.contentRoot;
24
+ this.renderChunk(0);
25
+ this.container.addEventListener('scroll', this.handleScroll.bind(this));
26
+ }
27
+ _createClass(ListVirtualizer, [{
28
+ key: "handleScroll",
29
+ value: function handleScroll(e) {
30
+ var _ref = e.target,
31
+ scrollTop = _ref.scrollTop;
32
+ this.scrollTop = scrollTop;
33
+ var screenItemsLen = Math.ceil(this.height / this.itemHeight);
34
+ var maxBuffer = this.screenItemsLen * this.itemHeight;
35
+ var first = Math.ceil(scrollTop / this.itemHeight - screenItemsLen);
36
+ first = first < 0 ? 0 : first;
37
+ if (!this.lastRepaintY || Math.abs(scrollTop - this.lastRepaintY) > maxBuffer) {
38
+ this.renderChunk(first);
39
+ this.lastRepaintY = scrollTop;
40
+ }
41
+ e.preventDefault();
42
+ }
43
+ }, {
44
+ key: "renderChunk",
45
+ value: function renderChunk(fromPos) {
46
+ this.screenItemsLen = Math.ceil(this.height / this.itemHeight);
47
+
48
+ // Cache 4 times the number of items that fit in the container viewport
49
+ var cachedItemsLen = this.screenItemsLen * 3;
50
+ var fragment = document.createDocumentFragment();
51
+ var itemCount = fromPos + cachedItemsLen;
52
+ if (itemCount > this.totalRows) {
53
+ itemCount = this.totalRows;
54
+ }
55
+ if (fromPos > 0) {
56
+ var offsetterRowEl = document.createElement('tr');
57
+ var offsetterEl = document.createElement('td');
58
+ offsetterEl.style.height = "".concat(fromPos * this.itemHeight, "px");
59
+ offsetterRowEl.appendChild(offsetterEl);
60
+ fragment.appendChild(offsetterRowEl);
61
+ }
62
+ for (var i = fromPos; i < itemCount; i++) {
63
+ var item = this.generatorFn(i);
64
+ if (!item) {
65
+ break;
66
+ }
67
+ fragment.appendChild(item);
68
+ }
69
+ if (itemCount < this.totalRows) {
70
+ var bottomOffsetterRow = document.createElement('tr');
71
+ var _offsetterEl = document.createElement('td');
72
+ _offsetterEl.style.height = "".concat((this.totalRows - itemCount) * this.itemHeight, "px");
73
+ bottomOffsetterRow.appendChild(_offsetterEl);
74
+ fragment.appendChild(bottomOffsetterRow);
75
+ }
76
+ this.contentRoot.innerHTML = '';
77
+ this.contentRoot.appendChild(fragment);
78
+ }
79
+ }, {
80
+ key: "setRowCount",
81
+ value: function setRowCount(rowCount) {
82
+ this.totalRows = rowCount;
83
+ var first = Math.ceil(this.scrollTop / this.itemHeight - this.screenItemsLen);
84
+ first = first < 0 ? 0 : first;
85
+ this.renderChunk(first);
86
+ }
87
+ }]);
88
+ return ListVirtualizer;
89
+ }();
90
+ exports.ListVirtualizer = ListVirtualizer;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.QueryRunner = void 0;
7
+ var _viewerState = require("./viewerState");
8
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
+ var QueryRunner = /*#__PURE__*/function () {
15
+ function QueryRunner(db) {
16
+ _classCallCheck(this, QueryRunner);
17
+ this.db = db;
18
+ this.listeners = [];
19
+ }
20
+ _createClass(QueryRunner, [{
21
+ key: "runQuery",
22
+ value: function runQuery(query, label) {
23
+ var currentDatabase = _viewerState.ViewerState.instance.selectedTable;
24
+ if (!currentDatabase) {
25
+ return;
26
+ }
27
+ this.db.post({
28
+ type: 'query',
29
+ query: query,
30
+ databasePath: currentDatabase.databasePath,
31
+ label: label
32
+ });
33
+ this.listeners.forEach(function (listener) {
34
+ listener(query);
35
+ });
36
+ }
37
+ }, {
38
+ key: "addListener",
39
+ value: function addListener(listener) {
40
+ var _this = this;
41
+ if (this.listeners.indexOf(listener) !== -1) {
42
+ throw new Error('Listener is already added');
43
+ }
44
+ this.listeners.push(listener);
45
+ return function () {
46
+ _this.listeners.splice(_this.listeners.indexOf(listener), 1);
47
+ };
48
+ }
49
+ }]);
50
+ return QueryRunner;
51
+ }();
52
+ exports.QueryRunner = QueryRunner;
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.collectDbFiles = collectDbFiles;
7
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
15
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
16
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
17
+ function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
18
+ function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
19
+ function collectDbFiles(_x) {
20
+ return _collectDbFiles.apply(this, arguments);
21
+ }
22
+ function _collectDbFiles() {
23
+ _collectDbFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(isSqliteDatabase) {
24
+ var root, dbFileHandlers;
25
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
26
+ while (1) switch (_context.prev = _context.next) {
27
+ case 0:
28
+ if (navigator.storage) {
29
+ _context.next = 3;
30
+ break;
31
+ }
32
+ // eslint-disable-next-line no-console
33
+ console.error('navigator.storage is not available in this context');
34
+ return _context.abrupt("return", []);
35
+ case 3:
36
+ _context.next = 5;
37
+ return navigator.storage.getDirectory();
38
+ case 5:
39
+ root = _context.sent;
40
+ _context.next = 8;
41
+ return getDbFiles(root, isSqliteDatabase);
42
+ case 8:
43
+ dbFileHandlers = _context.sent;
44
+ return _context.abrupt("return", Promise.all(dbFileHandlers.map(function (dbFile) {
45
+ return root.resolve(dbFile).then(function (parts) {
46
+ return (parts === null || parts === void 0 ? void 0 : parts.join('/')) || '';
47
+ });
48
+ })));
49
+ case 10:
50
+ case "end":
51
+ return _context.stop();
52
+ }
53
+ }, _callee);
54
+ }));
55
+ return _collectDbFiles.apply(this, arguments);
56
+ }
57
+ function getDbFiles(_x2, _x3) {
58
+ return _getDbFiles.apply(this, arguments);
59
+ }
60
+ function _getDbFiles() {
61
+ _getDbFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(root, isSqliteDatabase) {
62
+ var dbs, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, handle, child, _dbs, childDbs;
63
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
64
+ while (1) switch (_context2.prev = _context2.next) {
65
+ case 0:
66
+ dbs = [];
67
+ _iteratorAbruptCompletion = false;
68
+ _didIteratorError = false;
69
+ _context2.prev = 3;
70
+ _iterator = _asyncIterator(root.values());
71
+ case 5:
72
+ _context2.next = 7;
73
+ return _iterator.next();
74
+ case 7:
75
+ if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
76
+ _context2.next = 21;
77
+ break;
78
+ }
79
+ handle = _step.value;
80
+ child = handle;
81
+ if (!(child.kind === 'directory')) {
82
+ _context2.next = 17;
83
+ break;
84
+ }
85
+ _context2.next = 13;
86
+ return getDbFiles(child, isSqliteDatabase);
87
+ case 13:
88
+ childDbs = _context2.sent;
89
+ dbs = (_dbs = dbs).concat.apply(_dbs, [dbs].concat(_toConsumableArray(childDbs)));
90
+ _context2.next = 18;
91
+ break;
92
+ case 17:
93
+ if (isSqliteDatabase(child.name)) {
94
+ dbs.push(child);
95
+ }
96
+ case 18:
97
+ _iteratorAbruptCompletion = false;
98
+ _context2.next = 5;
99
+ break;
100
+ case 21:
101
+ _context2.next = 27;
102
+ break;
103
+ case 23:
104
+ _context2.prev = 23;
105
+ _context2.t0 = _context2["catch"](3);
106
+ _didIteratorError = true;
107
+ _iteratorError = _context2.t0;
108
+ case 27:
109
+ _context2.prev = 27;
110
+ _context2.prev = 28;
111
+ if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
112
+ _context2.next = 32;
113
+ break;
114
+ }
115
+ _context2.next = 32;
116
+ return _iterator["return"]();
117
+ case 32:
118
+ _context2.prev = 32;
119
+ if (!_didIteratorError) {
120
+ _context2.next = 35;
121
+ break;
122
+ }
123
+ throw _iteratorError;
124
+ case 35:
125
+ return _context2.finish(32);
126
+ case 36:
127
+ return _context2.finish(27);
128
+ case 37:
129
+ return _context2.abrupt("return", dbs);
130
+ case 38:
131
+ case "end":
132
+ return _context2.stop();
133
+ }
134
+ }, _callee2, null, [[3, 23, 27, 37], [28,, 32, 36]]);
135
+ }));
136
+ return _getDbFiles.apply(this, arguments);
137
+ }