@mdbase-dev/sdk 0.2.70 → 0.2.72
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/app-storage/app-binary-index.js +13 -11
- package/dist/app-storage/app-binary-index.js.map +1 -1
- package/dist/app-storage/sqlite-index.d.ts +1 -1
- package/dist/app-storage/sqlite-index.js +68 -38
- package/dist/app-storage/sqlite-index.js.map +1 -1
- package/dist/application/asset-pins.json +4 -4
- package/dist/application/worker.js +75 -49
- package/dist/browser/mdbase-sdk.js +76 -50
- package/dist/browser/mdbase-sdk.min.js +29 -29
- package/dist/native/provenance.json +5 -5
- package/dist/native/runtime.wasm +0 -0
- package/package.json +1 -1
|
@@ -30000,7 +30000,7 @@ ${end.comment}` : end.comment;
|
|
|
30000
30000
|
if (typeof value2 === "number" && Number.isSafeInteger(value2)) return BigInt(value2);
|
|
30001
30001
|
throw new IndexError("Other", "SQLite integer is not losslessly represented");
|
|
30002
30002
|
}
|
|
30003
|
-
var IndexError, SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, SQLITE_NULL, HOST_TABLE, SqliteIndex;
|
|
30003
|
+
var IndexError, textEncoder2, SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, SQLITE_NULL, HOST_TABLE, SqliteIndex;
|
|
30004
30004
|
var init_sqlite_index = __esm({
|
|
30005
30005
|
"src/app-storage/sqlite-index.ts"() {
|
|
30006
30006
|
"use strict";
|
|
@@ -30016,6 +30016,7 @@ ${end.comment}` : end.comment;
|
|
|
30016
30016
|
detail;
|
|
30017
30017
|
stmt;
|
|
30018
30018
|
};
|
|
30019
|
+
textEncoder2 = new TextEncoder();
|
|
30019
30020
|
SQLITE_INTEGER = 1;
|
|
30020
30021
|
SQLITE_FLOAT = 2;
|
|
30021
30022
|
SQLITE_TEXT = 3;
|
|
@@ -30077,46 +30078,68 @@ ${end.comment}` : end.comment;
|
|
|
30077
30078
|
}
|
|
30078
30079
|
return st;
|
|
30079
30080
|
}
|
|
30080
|
-
bind(st, params2) {
|
|
30081
|
-
st.
|
|
30082
|
-
|
|
30081
|
+
bind(st, params2, buffer) {
|
|
30082
|
+
const pointer = st.pointer;
|
|
30083
|
+
const wasm = this.sqlite3.wasm;
|
|
30084
|
+
let offset = buffer;
|
|
30085
|
+
for (let i = 0; i < params2.length; i++) {
|
|
30086
|
+
const p = params2[i];
|
|
30083
30087
|
const idx = i + 1;
|
|
30088
|
+
let rc;
|
|
30084
30089
|
switch (p.kind) {
|
|
30085
30090
|
case "Null":
|
|
30086
|
-
|
|
30091
|
+
rc = wasm.exports.sqlite3_bind_null(pointer, idx);
|
|
30087
30092
|
break;
|
|
30088
30093
|
case "Integer":
|
|
30089
|
-
|
|
30094
|
+
if (BigInt.asIntN(64, p.value) !== p.value) {
|
|
30095
|
+
st.bind(idx, p.value);
|
|
30096
|
+
continue;
|
|
30097
|
+
}
|
|
30098
|
+
rc = wasm.exports.sqlite3_bind_int64(pointer, idx, p.value);
|
|
30090
30099
|
break;
|
|
30091
30100
|
case "Real":
|
|
30092
30101
|
st.bind(idx, p.value);
|
|
30102
|
+
continue;
|
|
30103
|
+
case "Text": {
|
|
30104
|
+
const target2 = wasm.heap8u().subarray(offset, offset + p.value.length * 3);
|
|
30105
|
+
const { written } = textEncoder2.encodeInto(p.value, target2);
|
|
30106
|
+
rc = wasm.exports.sqlite3_bind_text(pointer, idx, offset, written, 0);
|
|
30107
|
+
offset += Math.max(1, written);
|
|
30093
30108
|
break;
|
|
30094
|
-
|
|
30095
|
-
st.bind(idx, p.value);
|
|
30096
|
-
break;
|
|
30109
|
+
}
|
|
30097
30110
|
case "Blob":
|
|
30098
|
-
|
|
30111
|
+
wasm.heap8u().set(p.value, offset);
|
|
30112
|
+
rc = wasm.exports.sqlite3_bind_blob(pointer, idx, offset, p.value.length, 0);
|
|
30113
|
+
offset += Math.max(1, p.value.length);
|
|
30099
30114
|
break;
|
|
30100
30115
|
}
|
|
30101
|
-
|
|
30116
|
+
if (rc) this.db.checkRc(rc);
|
|
30117
|
+
}
|
|
30102
30118
|
}
|
|
30103
|
-
column(
|
|
30119
|
+
column(pointer, i, tag, addBytes) {
|
|
30104
30120
|
const capi = this.sqlite3.capi;
|
|
30105
30121
|
switch (tag) {
|
|
30106
30122
|
case SQLITE_NULL:
|
|
30123
|
+
addBytes(1);
|
|
30107
30124
|
return { kind: "Null" };
|
|
30108
|
-
case SQLITE_INTEGER:
|
|
30109
|
-
|
|
30110
|
-
return { kind: "Integer", value: exactInteger(
|
|
30111
|
-
}
|
|
30125
|
+
case SQLITE_INTEGER:
|
|
30126
|
+
addBytes(9);
|
|
30127
|
+
return { kind: "Integer", value: exactInteger(capi.sqlite3_column_int64(pointer, i)) };
|
|
30112
30128
|
case SQLITE_FLOAT:
|
|
30113
|
-
|
|
30129
|
+
addBytes(9);
|
|
30130
|
+
return { kind: "Real", value: capi.sqlite3_column_double(pointer, i) };
|
|
30114
30131
|
case SQLITE_TEXT:
|
|
30115
|
-
|
|
30116
|
-
|
|
30117
|
-
|
|
30132
|
+
addBytes(5 + capi.sqlite3_column_bytes(pointer, i));
|
|
30133
|
+
return { kind: "Text", value: capi.sqlite3_column_text(pointer, i) };
|
|
30134
|
+
case SQLITE_BLOB: {
|
|
30135
|
+
const length = capi.sqlite3_column_bytes(pointer, i);
|
|
30136
|
+
addBytes(5 + length);
|
|
30137
|
+
const start = capi.sqlite3_column_blob(pointer, i);
|
|
30138
|
+
if (length && !start) throw new IndexError("Other", "SQLite blob unavailable");
|
|
30139
|
+
return { kind: "Blob", value: this.sqlite3.wasm.heap8u().slice(start, start + length) };
|
|
30140
|
+
}
|
|
30118
30141
|
default:
|
|
30119
|
-
|
|
30142
|
+
throw new IndexError("Other", "unknown SQLite value type");
|
|
30120
30143
|
}
|
|
30121
30144
|
}
|
|
30122
30145
|
/** `IndexStorage::run`. */
|
|
@@ -30145,8 +30168,15 @@ ${end.comment}` : end.comment;
|
|
|
30145
30168
|
const s = batch.stmts[i];
|
|
30146
30169
|
try {
|
|
30147
30170
|
const st = this.prepare(s.sql);
|
|
30171
|
+
let bindBytes = 0;
|
|
30172
|
+
for (const p of s.params) {
|
|
30173
|
+
if (p.kind === "Blob") bindBytes += Math.max(1, p.value.byteLength);
|
|
30174
|
+
if (p.kind === "Text") bindBytes += Math.max(1, p.value.length * 3);
|
|
30175
|
+
}
|
|
30176
|
+
const buffer = bindBytes ? this.sqlite3.wasm.alloc(bindBytes) : 0;
|
|
30148
30177
|
try {
|
|
30149
|
-
this.bind(st, s.params);
|
|
30178
|
+
this.bind(st, s.params, buffer);
|
|
30179
|
+
const pointer = st.pointer;
|
|
30150
30180
|
const columns = st.columnCount;
|
|
30151
30181
|
if (limits && (!Number.isSafeInteger(columns) || columns < 0 || columns > limits.maxColumns)) {
|
|
30152
30182
|
throw new IndexError("Full", "index reply column budget exceeded");
|
|
@@ -30157,16 +30187,8 @@ ${end.comment}` : end.comment;
|
|
|
30157
30187
|
if (limits && ++rows2 > limits.maxRows) throw new IndexError("Full", "index reply row budget exceeded");
|
|
30158
30188
|
for (let c = 0; c < columns; c++) {
|
|
30159
30189
|
if (limits && ++valueCount > limits.maxValues) throw new IndexError("Full", "index reply value budget exceeded");
|
|
30160
|
-
const tag = capi.sqlite3_column_type(
|
|
30161
|
-
|
|
30162
|
-
if (tag === SQLITE_TEXT || tag === SQLITE_BLOB) {
|
|
30163
|
-
addBytes(5);
|
|
30164
|
-
addBytes(capi.sqlite3_column_bytes(st.pointer, c));
|
|
30165
|
-
} else if (tag === SQLITE_INTEGER || tag === SQLITE_FLOAT) addBytes(9);
|
|
30166
|
-
else if (tag === SQLITE_NULL) addBytes(1);
|
|
30167
|
-
else throw new IndexError("Other", "unknown SQLite value type");
|
|
30168
|
-
}
|
|
30169
|
-
values.push(this.column(st, c, tag));
|
|
30190
|
+
const tag = capi.sqlite3_column_type(pointer, c);
|
|
30191
|
+
values.push(this.column(pointer, c, tag, addBytes));
|
|
30170
30192
|
}
|
|
30171
30193
|
}
|
|
30172
30194
|
out.push({
|
|
@@ -30176,7 +30198,11 @@ ${end.comment}` : end.comment;
|
|
|
30176
30198
|
lastInsertRowid: exactInteger(capi.sqlite3_last_insert_rowid(this.db.pointer))
|
|
30177
30199
|
});
|
|
30178
30200
|
} finally {
|
|
30179
|
-
|
|
30201
|
+
try {
|
|
30202
|
+
st.reset(true);
|
|
30203
|
+
} finally {
|
|
30204
|
+
if (buffer) this.sqlite3.wasm.dealloc(buffer);
|
|
30205
|
+
}
|
|
30180
30206
|
}
|
|
30181
30207
|
} catch (e) {
|
|
30182
30208
|
if (tx) {
|
|
@@ -30346,19 +30372,21 @@ ${end.comment}` : end.comment;
|
|
|
30346
30372
|
pos = 0;
|
|
30347
30373
|
values = 0;
|
|
30348
30374
|
view;
|
|
30349
|
-
|
|
30375
|
+
advance(n) {
|
|
30350
30376
|
if (!Number.isSafeInteger(n) || n < 0 || n > this.bytes.length - this.pos) throw invalid7();
|
|
30351
|
-
const
|
|
30377
|
+
const at = this.pos;
|
|
30352
30378
|
this.pos += n;
|
|
30353
|
-
return
|
|
30379
|
+
return at;
|
|
30380
|
+
}
|
|
30381
|
+
take(n) {
|
|
30382
|
+
const at = this.advance(n);
|
|
30383
|
+
return this.bytes.subarray(at, this.pos);
|
|
30354
30384
|
}
|
|
30355
30385
|
byte() {
|
|
30356
|
-
return this.
|
|
30386
|
+
return this.bytes[this.advance(1)];
|
|
30357
30387
|
}
|
|
30358
30388
|
u32() {
|
|
30359
|
-
|
|
30360
|
-
this.take(4);
|
|
30361
|
-
return this.view.getUint32(at, true);
|
|
30389
|
+
return this.view.getUint32(this.advance(4), true);
|
|
30362
30390
|
}
|
|
30363
30391
|
count(max, minBytes) {
|
|
30364
30392
|
const n = this.u32();
|
|
@@ -30378,13 +30406,11 @@ ${end.comment}` : end.comment;
|
|
|
30378
30406
|
case 0:
|
|
30379
30407
|
return { kind: "Null" };
|
|
30380
30408
|
case 1: {
|
|
30381
|
-
const at = this.
|
|
30382
|
-
this.take(8);
|
|
30409
|
+
const at = this.advance(8);
|
|
30383
30410
|
return { kind: "Integer", value: this.view.getBigInt64(at, true) };
|
|
30384
30411
|
}
|
|
30385
30412
|
case 2: {
|
|
30386
|
-
const at = this.
|
|
30387
|
-
this.take(8);
|
|
30413
|
+
const at = this.advance(8);
|
|
30388
30414
|
const value2 = this.view.getFloat64(at, true);
|
|
30389
30415
|
if (!Number.isFinite(value2)) throw invalid7();
|
|
30390
30416
|
return { kind: "Real", value: value2 };
|
|
@@ -30392,7 +30418,7 @@ ${end.comment}` : end.comment;
|
|
|
30392
30418
|
case 3:
|
|
30393
30419
|
return { kind: "Text", value: this.text(APP_INDEX_LIMITS.maxBytes) };
|
|
30394
30420
|
case 4:
|
|
30395
|
-
return { kind: "Blob", value: this.data(APP_INDEX_LIMITS.maxBytes)
|
|
30421
|
+
return { kind: "Blob", value: this.data(APP_INDEX_LIMITS.maxBytes) };
|
|
30396
30422
|
default:
|
|
30397
30423
|
throw invalid7();
|
|
30398
30424
|
}
|
|
@@ -30477,7 +30503,7 @@ ${end.comment}` : end.comment;
|
|
|
30477
30503
|
}
|
|
30478
30504
|
}
|
|
30479
30505
|
done() {
|
|
30480
|
-
return this.bytes.
|
|
30506
|
+
return this.bytes.subarray(0, this.length);
|
|
30481
30507
|
}
|
|
30482
30508
|
};
|
|
30483
30509
|
AppBinaryIndexHost = class {
|
|
@@ -51239,12 +51265,12 @@ ${end.comment}` : end.comment;
|
|
|
51239
51265
|
// src/application/asset-pins.json
|
|
51240
51266
|
var asset_pins_default = {
|
|
51241
51267
|
runtime: {
|
|
51242
|
-
sha256: "
|
|
51243
|
-
bytes:
|
|
51244
|
-
maxBytes:
|
|
51268
|
+
sha256: "904be89bf170f41dc56c9da865a9f7cbae3433af4af03fb0601024e596235b5d",
|
|
51269
|
+
bytes: 4187085,
|
|
51270
|
+
maxBytes: 4187085,
|
|
51245
51271
|
source: {
|
|
51246
51272
|
repository: "mdbase-dev/mdbase-connect",
|
|
51247
|
-
commit: "
|
|
51273
|
+
commit: "79c2f4e21f246b7bde787cc9d0533192709804ed"
|
|
51248
51274
|
}
|
|
51249
51275
|
},
|
|
51250
51276
|
sqlite: {
|