sqlite-wasm-viewer 1.0.1 → 1.0.2
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/dist/DbViewerWorker.js +137 -0
- package/dist/DbWorker.js +7 -0
- package/dist/ListVirtualizer.js +90 -0
- package/dist/QueryRunner.js +52 -0
- package/dist/dbScanner.js +137 -0
- package/dist/index.js +129 -466
- package/dist/styles.css +65 -0
- package/dist/types.js +5 -0
- package/dist/viewerState.js +60 -0
- package/dist/views/EditCellView/EditCellView.js +74 -0
- package/dist/views/EditCellView/styles.css +23 -0
- package/dist/views/ExecuteSQLView/ExecuteSQLView.js +57 -0
- package/dist/views/ExecuteSQLView/styles.css +47 -0
- package/dist/views/ExplorerView/ExplorerView.js +91 -0
- package/dist/views/ExplorerView/styles.css +30 -0
- package/dist/views/SqlLogView/SqlLogView.js +40 -0
- package/dist/views/SqlLogView/styles.css +10 -0
- package/dist/views/TableView/TableView.js +239 -0
- package/dist/views/TableView/styles.css +79 -0
- package/package.json +6 -3
- package/dist/838.index.js +0 -2
- package/dist/838.index.js.LICENSE.txt +0 -1
- package/dist/index.js.LICENSE.txt +0 -1
- package/dist/src_DbWorker_ts.index.js +0 -118
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TableView = void 0;
|
|
7
|
+
var _viewerState = require("../../viewerState");
|
|
8
|
+
var _ListVirtualizer = require("../../ListVirtualizer");
|
|
9
|
+
require("./styles.css");
|
|
10
|
+
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); }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
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); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
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); }
|
|
17
|
+
var TableView = /*#__PURE__*/function () {
|
|
18
|
+
function TableView(viewerElem, rootElement, queryRunner) {
|
|
19
|
+
var _this = this;
|
|
20
|
+
_classCallCheck(this, TableView);
|
|
21
|
+
_defineProperty(this, "columnNames", []);
|
|
22
|
+
_defineProperty(this, "fitlers", {});
|
|
23
|
+
_defineProperty(this, "updateTimer", null);
|
|
24
|
+
_defineProperty(this, "selectedCell", null);
|
|
25
|
+
this.viewerElem = viewerElem;
|
|
26
|
+
this.rootElement = rootElement;
|
|
27
|
+
this.queryRunner = queryRunner;
|
|
28
|
+
this.buildDomTemplate();
|
|
29
|
+
this.viewerElem.addEventListener('tableSelected', function (event) {
|
|
30
|
+
var selectedTable = event.detail;
|
|
31
|
+
_this.setTable(selectedTable.tableName);
|
|
32
|
+
});
|
|
33
|
+
this.virtualizer = new _ListVirtualizer.ListVirtualizer({
|
|
34
|
+
width: 500,
|
|
35
|
+
height: 930,
|
|
36
|
+
totalRows: 0,
|
|
37
|
+
itemHeight: 40,
|
|
38
|
+
contentRoot: this.bodyRoot,
|
|
39
|
+
container: this.container,
|
|
40
|
+
generatorFn: function generatorFn(i) {
|
|
41
|
+
var _row$rowid;
|
|
42
|
+
var row = _this.rows[i];
|
|
43
|
+
if (!row) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
var tr = document.createElement('tr');
|
|
47
|
+
var rowId = (_row$rowid = row.rowid) !== null && _row$rowid !== void 0 ? _row$rowid : (i + 1).toString();
|
|
48
|
+
Object.keys(row).forEach(function (columnKey) {
|
|
49
|
+
if (columnKey === 'rowid') {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
var value = row[columnKey];
|
|
53
|
+
var td = document.createElement('td');
|
|
54
|
+
var contentEl = document.createElement('div');
|
|
55
|
+
if (value !== null) {
|
|
56
|
+
contentEl.innerHTML = value;
|
|
57
|
+
} else {
|
|
58
|
+
contentEl.innerHTML = 'NULL';
|
|
59
|
+
contentEl.className = 'nullValue';
|
|
60
|
+
}
|
|
61
|
+
td.onclick = function () {
|
|
62
|
+
var _ViewerState$instance;
|
|
63
|
+
_viewerState.ViewerState.instance.setSelectedCell({
|
|
64
|
+
value: value,
|
|
65
|
+
cellRowId: rowId,
|
|
66
|
+
columnName: columnKey,
|
|
67
|
+
tableName: ((_ViewerState$instance = _viewerState.ViewerState.instance.selectedTable) === null || _ViewerState$instance === void 0 ? void 0 : _ViewerState$instance.tableName) || ''
|
|
68
|
+
});
|
|
69
|
+
if (_this.selectedCell) {
|
|
70
|
+
_this.selectedCell.classList.remove('selected');
|
|
71
|
+
}
|
|
72
|
+
td.classList.add('selected');
|
|
73
|
+
_this.selectedCell = td;
|
|
74
|
+
};
|
|
75
|
+
td.appendChild(contentEl);
|
|
76
|
+
tr.appendChild(td);
|
|
77
|
+
});
|
|
78
|
+
_this.bodyRoot.appendChild(tr);
|
|
79
|
+
return tr;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
_createClass(TableView, [{
|
|
84
|
+
key: "setTableResults",
|
|
85
|
+
value: function setTableResults(rows) {
|
|
86
|
+
this.rows = rows;
|
|
87
|
+
this.viewHeaderTitle.innerHTML = this.tableName;
|
|
88
|
+
this.buildHeader(rows);
|
|
89
|
+
this.virtualizer.setRowCount(rows.length);
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "buildDomTemplate",
|
|
93
|
+
value: function buildDomTemplate() {
|
|
94
|
+
var _this2 = this;
|
|
95
|
+
this.viewHeader = document.createElement('div');
|
|
96
|
+
this.viewHeader.className = 'viewHeader';
|
|
97
|
+
this.viewHeaderTitle = document.createElement('span');
|
|
98
|
+
this.viewHeaderTitle.id = 'table_view_header_title';
|
|
99
|
+
this.viewHeader.appendChild(this.viewHeaderTitle);
|
|
100
|
+
var updateBtn = document.createElement('button');
|
|
101
|
+
updateBtn.innerText = 'Update';
|
|
102
|
+
updateBtn.onclick = function () {
|
|
103
|
+
_this2.requestRows();
|
|
104
|
+
};
|
|
105
|
+
this.viewHeader.appendChild(updateBtn);
|
|
106
|
+
var saveBtn = document.createElement('button');
|
|
107
|
+
saveBtn.innerText = 'Save changes';
|
|
108
|
+
saveBtn.onclick = function () {
|
|
109
|
+
_this2.saveChanges();
|
|
110
|
+
};
|
|
111
|
+
saveBtn.setAttribute('disabled', '');
|
|
112
|
+
this.viewHeader.appendChild(saveBtn);
|
|
113
|
+
var revertBtn = document.createElement('button');
|
|
114
|
+
revertBtn.innerText = 'Revert changes';
|
|
115
|
+
revertBtn.onclick = function () {
|
|
116
|
+
_this2.revertChanges();
|
|
117
|
+
};
|
|
118
|
+
revertBtn.setAttribute('disabled', '');
|
|
119
|
+
this.viewHeader.appendChild(revertBtn);
|
|
120
|
+
this.rootElement.appendChild(this.viewHeader);
|
|
121
|
+
this.container = document.createElement('div');
|
|
122
|
+
this.container.id = 'table_container';
|
|
123
|
+
var table = document.createElement('table');
|
|
124
|
+
var tableHeader = table.createTHead();
|
|
125
|
+
this.headerRow = document.createElement('tr');
|
|
126
|
+
tableHeader.appendChild(this.headerRow);
|
|
127
|
+
this.bodyRoot = table.createTBody();
|
|
128
|
+
this.container.appendChild(table);
|
|
129
|
+
this.rootElement.appendChild(this.container);
|
|
130
|
+
this.viewerElem.addEventListener('dbHasChanges', function (event) {
|
|
131
|
+
var hasChanges = event.detail;
|
|
132
|
+
if (hasChanges) {
|
|
133
|
+
saveBtn.removeAttribute('disabled');
|
|
134
|
+
revertBtn.removeAttribute('disabled');
|
|
135
|
+
} else {
|
|
136
|
+
saveBtn.setAttribute('disabled', '');
|
|
137
|
+
revertBtn.setAttribute('disabled', '');
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
key: "buildHeader",
|
|
143
|
+
value: function buildHeader(rows) {
|
|
144
|
+
var _this3 = this;
|
|
145
|
+
if (this.columnNames.length !== 0) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
var schema = rows.length > 0 ? Object.keys(rows[0]).filter(function (column) {
|
|
149
|
+
return column !== 'rowid';
|
|
150
|
+
}) : [];
|
|
151
|
+
if (schema.length > 0) {
|
|
152
|
+
this.columnNames = schema;
|
|
153
|
+
}
|
|
154
|
+
this.headerRow.innerHTML = '';
|
|
155
|
+
this.columnNames.forEach(function (column) {
|
|
156
|
+
var columnHeader = document.createElement('th');
|
|
157
|
+
columnHeader.className = 'columnHeaderCell';
|
|
158
|
+
columnHeader.innerHTML = column;
|
|
159
|
+
var filterFieldCell = document.createElement('th');
|
|
160
|
+
filterFieldCell.className = 'columnFilterCell';
|
|
161
|
+
var filterField = document.createElement('input');
|
|
162
|
+
filterField.oninput = function () {
|
|
163
|
+
_this3.fitlers[column] = filterField.value;
|
|
164
|
+
_this3.scheduleUpdate();
|
|
165
|
+
};
|
|
166
|
+
filterField.placeholder = 'Filter';
|
|
167
|
+
filterFieldCell.appendChild(filterField);
|
|
168
|
+
_this3.headerRow.appendChild(columnHeader);
|
|
169
|
+
columnHeader.appendChild(filterFieldCell);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
key: "setTable",
|
|
174
|
+
value: function setTable(name) {
|
|
175
|
+
if (this.tableName === name) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
this.tableName = name;
|
|
179
|
+
this.columnNames = [];
|
|
180
|
+
this.fitlers = {};
|
|
181
|
+
this.requestRows();
|
|
182
|
+
}
|
|
183
|
+
}, {
|
|
184
|
+
key: "requestRows",
|
|
185
|
+
value: function requestRows() {
|
|
186
|
+
var sql = "SELECT \"_rowid_\",* FROM ".concat(this.tableName);
|
|
187
|
+
var filterSql = [];
|
|
188
|
+
Object.entries(this.fitlers).forEach(function (filterEntry) {
|
|
189
|
+
var column = filterEntry[0];
|
|
190
|
+
var filter = filterEntry[1];
|
|
191
|
+
if (filter) {
|
|
192
|
+
filterSql.push("\"".concat(column, "\" LIKE '%").concat(filter, "%'"));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
if (filterSql.length > 0) {
|
|
196
|
+
sql += " WHERE ".concat(filterSql.join(' AND '), " ESCAPE '\\'");
|
|
197
|
+
}
|
|
198
|
+
this.queryRunner.runQuery({
|
|
199
|
+
sql: sql,
|
|
200
|
+
parameters: []
|
|
201
|
+
}, 'tableView');
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "saveChanges",
|
|
205
|
+
value: function saveChanges() {
|
|
206
|
+
var sql = 'RELEASE "RESTOREPOINT";';
|
|
207
|
+
this.queryRunner.runQuery({
|
|
208
|
+
sql: sql,
|
|
209
|
+
parameters: []
|
|
210
|
+
});
|
|
211
|
+
_viewerState.ViewerState.instance.setHasChanges(false);
|
|
212
|
+
}
|
|
213
|
+
}, {
|
|
214
|
+
key: "revertChanges",
|
|
215
|
+
value: function revertChanges() {
|
|
216
|
+
var sql = 'ROLLBACK TO SAVEPOINT "RESTOREPOINT";';
|
|
217
|
+
this.queryRunner.runQuery({
|
|
218
|
+
sql: sql,
|
|
219
|
+
parameters: []
|
|
220
|
+
});
|
|
221
|
+
this.requestRows();
|
|
222
|
+
_viewerState.ViewerState.instance.setHasChanges(false);
|
|
223
|
+
}
|
|
224
|
+
}, {
|
|
225
|
+
key: "scheduleUpdate",
|
|
226
|
+
value: function scheduleUpdate() {
|
|
227
|
+
var _this4 = this;
|
|
228
|
+
if (this.updateTimer !== null) {
|
|
229
|
+
window.clearTimeout(this.updateTimer);
|
|
230
|
+
}
|
|
231
|
+
this.updateTimer = window.setTimeout(function () {
|
|
232
|
+
_this4.requestRows();
|
|
233
|
+
_this4.updateTimer = null;
|
|
234
|
+
}, 300);
|
|
235
|
+
}
|
|
236
|
+
}]);
|
|
237
|
+
return TableView;
|
|
238
|
+
}();
|
|
239
|
+
exports.TableView = TableView;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#table_view {
|
|
2
|
+
padding: 5px;
|
|
3
|
+
flex: 1;
|
|
4
|
+
position: relative;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
#table_view_header {
|
|
11
|
+
max-height: 20px;
|
|
12
|
+
flex-basis: 20px;
|
|
13
|
+
left: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
position: sticky;
|
|
16
|
+
line-height: 1.1rem;
|
|
17
|
+
padding: 8px;
|
|
18
|
+
background-color: lightgray;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#table_view_header_title {
|
|
22
|
+
padding: 8px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#table_container {
|
|
26
|
+
overflow-y: scroll;
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#table_container table {
|
|
31
|
+
background-color: whitesmoke;
|
|
32
|
+
border-collapse: collapse;
|
|
33
|
+
border-spacing: 0;
|
|
34
|
+
flex: 1;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#table_container tbody {
|
|
39
|
+
flex: 1;
|
|
40
|
+
overflow-y: scroll;
|
|
41
|
+
position: relative;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#table_container .columnHeaderCell {
|
|
45
|
+
height: 60px;
|
|
46
|
+
position: sticky;
|
|
47
|
+
top: 0;
|
|
48
|
+
background-color: darkgray;
|
|
49
|
+
z-index: 2;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#table_container .columnFilterCell {
|
|
53
|
+
padding-top: 5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#table_container td, #table_container .columnHeaderCell {
|
|
57
|
+
border: 1px solid lightgray;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#table_container td.selected {
|
|
61
|
+
background-color: lightslategray;
|
|
62
|
+
color: white;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#table_container td div {
|
|
66
|
+
height: 40px;
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
display: -webkit-box;
|
|
69
|
+
padding: 4px;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
-webkit-line-clamp: 2;
|
|
73
|
+
-webkit-box-orient: vertical;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#table_container .nullValue {
|
|
77
|
+
font-style: italic;
|
|
78
|
+
color: gray;
|
|
79
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sqlite-wasm-viewer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "An SQLite OPFS database viewer that enables database inspection and SQL command execution.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"build": "yarn build-transpile && yarn build-copy-css",
|
|
8
|
+
"build-transpile": "babel src --extensions .ts --out-dir=dist --presets=@babel/env,@babel/typescript",
|
|
9
|
+
"build-copy-css": "copyfiles -u 1 src/**/*.css dist",
|
|
10
|
+
"publish": "yarn build && yarn npm publish"
|
|
8
11
|
},
|
|
9
12
|
"keywords": [
|
|
10
13
|
"sqlite",
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
"eslint-plugin-import": "^2.28.0",
|
|
42
45
|
"eslint-plugin-json": "^3.1.0",
|
|
43
46
|
"eslint-plugin-prettier": "^5.0.0",
|
|
44
|
-
"
|
|
47
|
+
"glob": "^10.3.4",
|
|
45
48
|
"prettier": "^3.0.1",
|
|
46
49
|
"typescript": "^5.1.6"
|
|
47
50
|
},
|
package/dist/838.index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 838.index.js.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e=t.n(void 0);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(){n=function(){return t};var t={},e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),u=new j(n||[]);return i(a,"_invoke",{value:L(t,r,u)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var p={};function y(){}function v(){}function d(){}var m={};l(m,u,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(S([])));w&&w!==e&&o.call(w,u)&&(m=w);var b=d.prototype=y.prototype=Object.create(m);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(i,a,u,c){var s=h(t[i],t,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==r(f)&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):e.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return n("throw",t,u,c)}))}c(s.arg)}var a;i(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return a=a?a.then(o,o):o()}})}function L(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(a,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=h(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function S(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:P}}function P(){return{value:void 0,done:!0}}return v.prototype=d,i(b,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:v,configurable:!0}),v.displayName=l(d,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,l(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},E(x.prototype),l(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(b),l(b,s,"Generator"),l(b,u,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(q),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;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),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;q(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function o(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}function a(t){var e=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(e)}var u=new(function(){function t(){var e,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=this,(r=a(r="initialized"))in e?Object.defineProperty(e,r,{value:false,enumerable:!0,configurable:!0,writable:!0}):e[r]=false,this.initialized=!1,this.sqliteDb=null}var r,u;return r=t,u=[{key:"post",value:function(t){var r=this;if("init"!==t.data.type&&!this.initialized)throw new Error("DbWorker not initialized with 'init' message");if("init"===t.data.type){if(this.initialized)throw new Error("DbWorker already initialized");e()().then(function(){var t,e=(t=n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.sqlite=e,r.sqliteCApi=e.capi,r.initialized=!0,r.sendMessage({type:"onReady"});case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function u(t){o(a,n,i,u,c,"next",t)}function c(t){o(a,n,i,u,c,"throw",t)}u(void 0)}))});return function(t){return e.apply(this,arguments)}}())}switch(t.data.type){case"readSchema":var i=t.data.path;this.sqliteDb=new this.sqlite.oo1.OpfsDb(i,"c");var a=this.sqliteDb.exec({sql:"SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name",returnValue:"resultRows"});this.sendMessage({type:"onSchema",schema:a,dbName:i});break;case"query":var u=t.data.query,c=u.sql,s=u.parameters,l=this.sqliteDb.prepare(c),f=this.sqliteCApi.sqlite3_column_count(l)>1,h=[];try{for((null==s?void 0:s.length)>0&&l.bind(s);l.step();){var p=l.get({});h.push(p)}}finally{l.finalize()}if(f)this.sendMessage({type:"onQuery",result:{resultRows:h,tableName:""},label:t.data.label});else{var y={changes:this.sqliteCApi.sqlite3_changes(this.sqliteDb.pointer),lastInsertRowid:this.sqliteCApi.sqlite3_last_insert_rowid(this.sqliteDb.pointer)};this.sendMessage({type:"onQuery",result:{resultRows:h,updates:y,tableName:""}})}}}},{key:"sendMessage",value:function(t){postMessage(t)}}],u&&i(r.prototype,u),Object.defineProperty(r,"prototype",{writable:!1}),t}());onmessage=function(t){u.post(t)}})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
3
|
-
* This devtool is neither made for production nor for readable output files.
|
|
4
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
5
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
6
|
-
* or disable the default devtool with "devtool: false".
|
|
7
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
8
|
-
*/
|
|
9
|
-
/******/ (() => { // webpackBootstrap
|
|
10
|
-
/******/ "use strict";
|
|
11
|
-
/******/ var __webpack_modules__ = ({
|
|
12
|
-
|
|
13
|
-
/***/ "./src/DbViewerWorker.ts":
|
|
14
|
-
/*!*******************************!*\
|
|
15
|
-
!*** ./src/DbViewerWorker.ts ***!
|
|
16
|
-
\*******************************/
|
|
17
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
18
|
-
|
|
19
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DbViewerWorker: () => (/* binding */ DbViewerWorker)\n/* harmony export */ });\n/* harmony import */ var _sqlite_org_sqlite_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @sqlite.org/sqlite-wasm */ \"@sqlite.org/sqlite-wasm\");\n/* harmony import */ var _sqlite_org_sqlite_wasm__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_sqlite_org_sqlite_wasm__WEBPACK_IMPORTED_MODULE_0__);\nfunction _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); }\nfunction _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; }\nfunction 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); } }\nfunction _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); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _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; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n// @ts-expect-error Missing types\n\nvar DbViewerWorker = /*#__PURE__*/function () {\n function DbViewerWorker() {\n _classCallCheck(this, DbViewerWorker);\n _defineProperty(this, \"initialized\", false);\n this.initialized = false;\n this.dbsByPath = {};\n }\n _createClass(DbViewerWorker, [{\n key: \"post\",\n value: function post(message) {\n var _this = this;\n if (message.data.type !== 'init' && !this.initialized) {\n throw new Error(\"DbWorker not initialized with 'init' message\");\n }\n if (message.data.type === 'init') {\n if (this.initialized) {\n throw new Error('DbWorker already initialized');\n }\n _sqlite_org_sqlite_wasm__WEBPACK_IMPORTED_MODULE_0___default()().then( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sqlite3) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _this.sqlite = sqlite3;\n _this.sqliteCApi = sqlite3.capi;\n _this.initialized = true;\n _this.sendMessage({\n type: 'onReady'\n });\n case 4:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n switch (message.data.type) {\n case 'readSchema':\n {\n var _path = message.data.path;\n this.dbsByPath[_path] = new this.sqlite.oo1.OpfsDb(_path, 'c');\n var sql = \"SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name\";\n var result = this.dbsByPath[_path].exec({\n sql: sql,\n returnValue: 'resultRows'\n });\n this.sendMessage({\n type: 'onSchema',\n schema: result,\n dbName: _path\n });\n }\n break;\n case 'query':\n {\n var _message$data$query = message.data.query,\n _sql = _message$data$query.sql,\n parameters = _message$data$query.parameters;\n var databasePath = message.data.databasePath;\n var db = this.dbsByPath[databasePath];\n var rawStatement = db.prepare(_sql);\n var isReader = this.sqliteCApi.sqlite3_column_count(rawStatement) > 1;\n var resultRows = [];\n try {\n if ((parameters === null || parameters === void 0 ? void 0 : parameters.length) > 0) {\n rawStatement.bind(parameters);\n }\n while (rawStatement.step()) {\n // Kysely expects the results to be in the object mode\n var row = rawStatement.get({});\n resultRows.push(row);\n }\n } finally {\n rawStatement.finalize();\n }\n if (isReader) {\n this.sendMessage({\n type: 'onQuery',\n result: {\n resultRows: resultRows,\n tableName: ''\n },\n label: message.data.label\n });\n } else {\n var changes = this.sqliteCApi.sqlite3_changes(db.pointer);\n var lastInsertRowid = this.sqliteCApi.sqlite3_last_insert_rowid(db.pointer);\n var updates = {\n changes: changes,\n lastInsertRowid: lastInsertRowid\n };\n this.sendMessage({\n type: 'onQuery',\n result: {\n resultRows: resultRows,\n updates: updates,\n tableName: ''\n }\n });\n }\n }\n break;\n default:\n break;\n }\n }\n }, {\n key: \"sendMessage\",\n value: function sendMessage(message) {\n postMessage(message);\n }\n }]);\n return DbViewerWorker;\n}();\n\n//# sourceURL=webpack://sqlite-wasm-viewer/./src/DbViewerWorker.ts?");
|
|
20
|
-
|
|
21
|
-
/***/ }),
|
|
22
|
-
|
|
23
|
-
/***/ "./src/DbWorker.ts":
|
|
24
|
-
/*!*************************!*\
|
|
25
|
-
!*** ./src/DbWorker.ts ***!
|
|
26
|
-
\*************************/
|
|
27
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
28
|
-
|
|
29
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _DbViewerWorker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DbViewerWorker */ \"./src/DbViewerWorker.ts\");\n\nvar dbWorker = new _DbViewerWorker__WEBPACK_IMPORTED_MODULE_0__.DbViewerWorker();\nonmessage = function onmessage(message) {\n dbWorker.post(message);\n};\n\n//# sourceURL=webpack://sqlite-wasm-viewer/./src/DbWorker.ts?");
|
|
30
|
-
|
|
31
|
-
/***/ }),
|
|
32
|
-
|
|
33
|
-
/***/ "@sqlite.org/sqlite-wasm":
|
|
34
|
-
/*!***************************************************!*\
|
|
35
|
-
!*** external {"root":"@sqlite.org/sqlite-wasm"} ***!
|
|
36
|
-
\***************************************************/
|
|
37
|
-
/***/ ((module) => {
|
|
38
|
-
|
|
39
|
-
module.exports = undefined;
|
|
40
|
-
|
|
41
|
-
/***/ })
|
|
42
|
-
|
|
43
|
-
/******/ });
|
|
44
|
-
/************************************************************************/
|
|
45
|
-
/******/ // The module cache
|
|
46
|
-
/******/ var __webpack_module_cache__ = {};
|
|
47
|
-
/******/
|
|
48
|
-
/******/ // The require function
|
|
49
|
-
/******/ function __webpack_require__(moduleId) {
|
|
50
|
-
/******/ // Check if module is in cache
|
|
51
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
52
|
-
/******/ if (cachedModule !== undefined) {
|
|
53
|
-
/******/ return cachedModule.exports;
|
|
54
|
-
/******/ }
|
|
55
|
-
/******/ // Create a new module (and put it into the cache)
|
|
56
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
57
|
-
/******/ // no module.id needed
|
|
58
|
-
/******/ // no module.loaded needed
|
|
59
|
-
/******/ exports: {}
|
|
60
|
-
/******/ };
|
|
61
|
-
/******/
|
|
62
|
-
/******/ // Execute the module function
|
|
63
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
64
|
-
/******/
|
|
65
|
-
/******/ // Return the exports of the module
|
|
66
|
-
/******/ return module.exports;
|
|
67
|
-
/******/ }
|
|
68
|
-
/******/
|
|
69
|
-
/************************************************************************/
|
|
70
|
-
/******/ /* webpack/runtime/compat get default export */
|
|
71
|
-
/******/ (() => {
|
|
72
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
73
|
-
/******/ __webpack_require__.n = (module) => {
|
|
74
|
-
/******/ var getter = module && module.__esModule ?
|
|
75
|
-
/******/ () => (module['default']) :
|
|
76
|
-
/******/ () => (module);
|
|
77
|
-
/******/ __webpack_require__.d(getter, { a: getter });
|
|
78
|
-
/******/ return getter;
|
|
79
|
-
/******/ };
|
|
80
|
-
/******/ })();
|
|
81
|
-
/******/
|
|
82
|
-
/******/ /* webpack/runtime/define property getters */
|
|
83
|
-
/******/ (() => {
|
|
84
|
-
/******/ // define getter functions for harmony exports
|
|
85
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
86
|
-
/******/ for(var key in definition) {
|
|
87
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
88
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
89
|
-
/******/ }
|
|
90
|
-
/******/ }
|
|
91
|
-
/******/ };
|
|
92
|
-
/******/ })();
|
|
93
|
-
/******/
|
|
94
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
95
|
-
/******/ (() => {
|
|
96
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
97
|
-
/******/ })();
|
|
98
|
-
/******/
|
|
99
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
100
|
-
/******/ (() => {
|
|
101
|
-
/******/ // define __esModule on exports
|
|
102
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
103
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
104
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
105
|
-
/******/ }
|
|
106
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
107
|
-
/******/ };
|
|
108
|
-
/******/ })();
|
|
109
|
-
/******/
|
|
110
|
-
/************************************************************************/
|
|
111
|
-
/******/
|
|
112
|
-
/******/ // startup
|
|
113
|
-
/******/ // Load entry module and return exports
|
|
114
|
-
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
115
|
-
/******/ var __webpack_exports__ = __webpack_require__("./src/DbWorker.ts");
|
|
116
|
-
/******/
|
|
117
|
-
/******/ })()
|
|
118
|
-
;
|