@mdbase-dev/sdk 0.2.73 → 0.2.75

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.
@@ -40664,6 +40664,7 @@ var AppScopedSignInSession = class {
40664
40664
  };
40665
40665
 
40666
40666
  // src/app-storage/sqlite-index.ts
40667
+ var validatedPackets = /* @__PURE__ */ new WeakMap();
40667
40668
  var IndexError = class extends Error {
40668
40669
  constructor(kind, detail, stmt = null) {
40669
40670
  super(`${kind}${stmt === null ? "" : `@${stmt}`}(${detail})`);
@@ -40758,6 +40759,14 @@ var SqliteIndex = class _SqliteIndex {
40758
40759
  }
40759
40760
  return st;
40760
40761
  }
40762
+ statementBuffer(params2) {
40763
+ let bytes10 = 0;
40764
+ for (const p of params2) {
40765
+ if (p.kind === "Blob") bytes10 += Math.max(1, p.value.byteLength);
40766
+ if (p.kind === "Text") bytes10 += Math.max(1, p.value.length * 3);
40767
+ }
40768
+ return bytes10 ? this.sqlite3.wasm.alloc(bytes10) : 0;
40769
+ }
40761
40770
  bind(st, params2, buffer) {
40762
40771
  const pointer = st.pointer;
40763
40772
  const wasm = this.sqlite3.wasm;
@@ -40796,6 +40805,40 @@ var SqliteIndex = class _SqliteIndex {
40796
40805
  if (rc) this.db.checkRc(rc);
40797
40806
  }
40798
40807
  }
40808
+ bindPacket(st, packet, i, base) {
40809
+ const raw = this.sqlite3.wasm.exports;
40810
+ const pointer = st.pointer, view = packet.view;
40811
+ let at = packet.offsets[i];
40812
+ const count = view.getUint32(at - 4, true);
40813
+ for (let idx = 1; idx <= count; idx++) {
40814
+ const tag = view.getUint8(at++);
40815
+ let rc;
40816
+ switch (tag) {
40817
+ case 0:
40818
+ rc = raw.sqlite3_bind_null(pointer, idx);
40819
+ break;
40820
+ case 1:
40821
+ rc = raw.sqlite3_bind_int64(pointer, idx, view.getBigInt64(at, true));
40822
+ at += 8;
40823
+ break;
40824
+ case 2:
40825
+ st.bind(idx, view.getFloat64(at, true));
40826
+ at += 8;
40827
+ continue;
40828
+ case 3:
40829
+ case 4: {
40830
+ const length = view.getUint32(at, true);
40831
+ at += 4;
40832
+ rc = tag === 3 ? raw.sqlite3_bind_text(pointer, idx, base + at, length, 0) : raw.sqlite3_bind_blob(pointer, idx, base + at, length, 0);
40833
+ at += length;
40834
+ break;
40835
+ }
40836
+ default:
40837
+ throw new IndexError("Other", "invalid tag in validated packet");
40838
+ }
40839
+ if (rc) this.db.checkRc(rc);
40840
+ }
40841
+ }
40799
40842
  column(pointer, i, tag, addBytes) {
40800
40843
  const raw = this.sqlite3.wasm.exports;
40801
40844
  switch (tag) {
@@ -40825,6 +40868,19 @@ var SqliteIndex = class _SqliteIndex {
40825
40868
  /** `IndexStorage::run`. */
40826
40869
  run(batch, limits) {
40827
40870
  if (this.closed) throw new IndexError("Other", "index closed");
40871
+ const packet = validatedPackets.get(batch);
40872
+ if (!packet?.hasPayload) return this.runBatch(batch, limits, packet);
40873
+ const wasm = this.sqlite3.wasm;
40874
+ const view = packet.view;
40875
+ const buffer = wasm.alloc(view.byteLength + 1);
40876
+ try {
40877
+ wasm.heap8u().set(new Uint8Array(view.buffer, view.byteOffset, view.byteLength), buffer);
40878
+ return this.runBatch(batch, limits, packet, buffer);
40879
+ } finally {
40880
+ wasm.dealloc(buffer);
40881
+ }
40882
+ }
40883
+ runBatch(batch, limits, packet, packetBase = 0) {
40828
40884
  const raw = this.sqlite3.wasm.exports;
40829
40885
  const tx = batch.mode === "Transaction";
40830
40886
  const out = [];
@@ -40844,18 +40900,19 @@ var SqliteIndex = class _SqliteIndex {
40844
40900
  throw classifyError(e);
40845
40901
  }
40846
40902
  }
40847
- for (let i = 0; i < batch.stmts.length; i++) {
40903
+ for (let i = 0; i < (packet?.offsets.length ?? batch.stmts.length); i++) {
40848
40904
  const s = batch.stmts[i];
40849
40905
  try {
40850
40906
  const st = this.prepare(s.sql);
40851
- let bindBytes = 0;
40852
- for (const p of s.params) {
40853
- if (p.kind === "Blob") bindBytes += Math.max(1, p.value.byteLength);
40854
- if (p.kind === "Text") bindBytes += Math.max(1, p.value.length * 3);
40855
- }
40856
- const buffer = bindBytes ? this.sqlite3.wasm.alloc(bindBytes) : 0;
40907
+ let buffer = 0;
40857
40908
  try {
40858
- this.bind(st, s.params, buffer);
40909
+ if (packet) {
40910
+ this.bindPacket(st, packet, i, packetBase);
40911
+ } else {
40912
+ const params2 = s.params;
40913
+ buffer = this.statementBuffer(params2);
40914
+ this.bind(st, params2, buffer);
40915
+ }
40859
40916
  const pointer = st.pointer;
40860
40917
  const columns = st.columnCount;
40861
40918
  if (limits && (!Number.isSafeInteger(columns) || columns < 0 || columns > limits.maxColumns)) {
@@ -40946,15 +41003,19 @@ var invalid5 = () => new IndexError("Other", "invalid app index ABI");
40946
41003
  var full = () => new IndexError("Full", "app index ABI budget exceeded");
40947
41004
  var utf85 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
40948
41005
  var encoder2 = new TextEncoder();
41006
+ function validateText(bytes10, view, at, end) {
41007
+ while (at + 4 <= end && !(view.getUint32(at) & 2155905152)) at += 4;
41008
+ while (at < end && bytes10[at] < 128) at++;
41009
+ if (at < end) utf85.decode(bytes10.subarray(at, end));
41010
+ }
40949
41011
  var Reader2 = class {
40950
41012
  constructor(bytes10) {
40951
41013
  this.bytes = bytes10;
40952
- if (bytes10.length > APP_INDEX_LIMITS.maxBytes) throw full();
40953
41014
  this.view = new DataView(bytes10.buffer, bytes10.byteOffset, bytes10.byteLength);
40954
41015
  }
40955
41016
  bytes;
40956
41017
  pos = 0;
40957
- values = 0;
41018
+ hasPayload = false;
40958
41019
  view;
40959
41020
  advance(n) {
40960
41021
  if (!Number.isSafeInteger(n) || n < 0 || n > this.bytes.length - this.pos) throw invalid5();
@@ -40984,27 +41045,39 @@ var Reader2 = class {
40984
41045
  text(max) {
40985
41046
  return utf85.decode(this.data(max));
40986
41047
  }
40987
- value() {
40988
- if (++this.values > APP_INDEX_LIMITS.maxValues) throw full();
40989
- switch (this.byte()) {
40990
- case 0:
40991
- return { kind: "Null" };
40992
- case 1: {
40993
- const at = this.advance(8);
40994
- return { kind: "Integer", value: this.view.getBigInt64(at, true) };
40995
- }
40996
- case 2: {
40997
- const at = this.advance(8);
40998
- const value2 = this.view.getFloat64(at, true);
40999
- if (!Number.isFinite(value2)) throw invalid5();
41000
- return { kind: "Real", value: value2 };
41001
- }
41002
- case 3:
41003
- return { kind: "Text", value: this.text(APP_INDEX_LIMITS.maxBytes) };
41004
- case 4:
41005
- return { kind: "Blob", value: this.data(APP_INDEX_LIMITS.maxBytes) };
41006
- default:
41007
- throw invalid5();
41048
+ params(count, out) {
41049
+ for (let i = 0; i < count; i++) {
41050
+ const tag = this.byte();
41051
+ switch (tag) {
41052
+ case 0:
41053
+ out?.push({ kind: "Null" });
41054
+ break;
41055
+ case 1: {
41056
+ const at = this.advance(8);
41057
+ out?.push({ kind: "Integer", value: this.view.getBigInt64(at, true) });
41058
+ break;
41059
+ }
41060
+ case 2: {
41061
+ const value2 = this.view.getFloat64(this.advance(8), true);
41062
+ if (!Number.isFinite(value2)) throw invalid5();
41063
+ out?.push({ kind: "Real", value: value2 });
41064
+ break;
41065
+ }
41066
+ case 3:
41067
+ case 4: {
41068
+ const at = this.advance(this.count(APP_INDEX_LIMITS.maxBytes, 1));
41069
+ this.hasPayload = true;
41070
+ if (out) {
41071
+ const data = this.bytes.subarray(at, this.pos);
41072
+ out.push(tag === 3 ? { kind: "Text", value: utf85.decode(data) } : { kind: "Blob", value: data.slice() });
41073
+ } else if (tag === 3) {
41074
+ validateText(this.bytes, this.view, at, this.pos);
41075
+ }
41076
+ break;
41077
+ }
41078
+ default:
41079
+ throw invalid5();
41080
+ }
41008
41081
  }
41009
41082
  }
41010
41083
  done() {
@@ -41024,15 +41097,31 @@ function request2(bytes10) {
41024
41097
  if (mode > 1) throw invalid5();
41025
41098
  const count = r.count(APP_INDEX_LIMITS.maxStatements, 8);
41026
41099
  const stmts = [];
41100
+ const offsets = new Uint32Array(count);
41101
+ let total = 0;
41027
41102
  for (let i = 0; i < count; i++) {
41028
41103
  const sql = r.text(APP_INDEX_LIMITS.maxSqlBytes);
41029
41104
  const n = r.count(APP_INDEX_LIMITS.maxParameters, 1);
41030
- const params2 = [];
41031
- for (let j = 0; j < n; j++) params2.push(r.value());
41032
- stmts.push({ sql, params: params2 });
41105
+ total += n;
41106
+ if (total > APP_INDEX_LIMITS.maxValues) throw full();
41107
+ offsets[i] = r.pos;
41108
+ r.params(n);
41109
+ let decoded;
41110
+ stmts.push({
41111
+ sql,
41112
+ get params() {
41113
+ if (decoded) return decoded;
41114
+ r.pos = offsets[i];
41115
+ const params2 = [];
41116
+ r.params(n, params2);
41117
+ return decoded = params2;
41118
+ }
41119
+ });
41033
41120
  }
41034
41121
  r.done();
41035
- return { mode: mode === 0 ? "Transaction" : "Autocommit", stmts };
41122
+ const batch = { mode: mode === 0 ? "Transaction" : "Autocommit", stmts };
41123
+ validatedPackets.set(batch, { view: r.view, offsets, hasPayload: r.hasPayload });
41124
+ return batch;
41036
41125
  }
41037
41126
  var Writer2 = class {
41038
41127
  bytes = new Uint8Array(128);
@@ -41161,7 +41250,8 @@ var AppBinaryIndexHost = class {
41161
41250
  let expected = null;
41162
41251
  try {
41163
41252
  if (this.needsRecovery) throw invalid5();
41164
- const batch = request2(bytes10);
41253
+ if (bytes10.byteLength > APP_INDEX_LIMITS.maxBytes) throw full();
41254
+ const batch = request2(new Uint8Array(bytes10));
41165
41255
  expected = batch.stmts.length;
41166
41256
  const limits = APP_INDEX_LIMITS;
41167
41257
  return results(this.index.run(batch, limits), expected);
@@ -41192,7 +41282,7 @@ function appSqlHost(host, exports) {
41192
41282
  host.fence();
41193
41283
  throw full();
41194
41284
  }
41195
- const reply = host.run(new Uint8Array(x.memory.buffer, ptr, len).slice());
41285
+ const reply = host.run(new Uint8Array(x.memory.buffer, ptr, len));
41196
41286
  const out = x.alloc(reply.length);
41197
41287
  range(x.memory, out, reply.length);
41198
41288
  if (reentered || out === 0 || out < ptr + len && ptr < out + reply.length) throw invalid5();
@@ -30000,10 +30000,11 @@ ${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, textEncoder2, SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, SQLITE_NULL, HOST_TABLE, SqliteIndex;
30003
+ var validatedPackets, 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";
30007
+ validatedPackets = /* @__PURE__ */ new WeakMap();
30007
30008
  IndexError = class extends Error {
30008
30009
  constructor(kind, detail, stmt = null) {
30009
30010
  super(`${kind}${stmt === null ? "" : `@${stmt}`}(${detail})`);
@@ -30081,6 +30082,14 @@ ${end.comment}` : end.comment;
30081
30082
  }
30082
30083
  return st;
30083
30084
  }
30085
+ statementBuffer(params2) {
30086
+ let bytes10 = 0;
30087
+ for (const p of params2) {
30088
+ if (p.kind === "Blob") bytes10 += Math.max(1, p.value.byteLength);
30089
+ if (p.kind === "Text") bytes10 += Math.max(1, p.value.length * 3);
30090
+ }
30091
+ return bytes10 ? this.sqlite3.wasm.alloc(bytes10) : 0;
30092
+ }
30084
30093
  bind(st, params2, buffer) {
30085
30094
  const pointer = st.pointer;
30086
30095
  const wasm = this.sqlite3.wasm;
@@ -30119,6 +30128,40 @@ ${end.comment}` : end.comment;
30119
30128
  if (rc) this.db.checkRc(rc);
30120
30129
  }
30121
30130
  }
30131
+ bindPacket(st, packet, i, base) {
30132
+ const raw = this.sqlite3.wasm.exports;
30133
+ const pointer = st.pointer, view2 = packet.view;
30134
+ let at = packet.offsets[i];
30135
+ const count = view2.getUint32(at - 4, true);
30136
+ for (let idx = 1; idx <= count; idx++) {
30137
+ const tag = view2.getUint8(at++);
30138
+ let rc;
30139
+ switch (tag) {
30140
+ case 0:
30141
+ rc = raw.sqlite3_bind_null(pointer, idx);
30142
+ break;
30143
+ case 1:
30144
+ rc = raw.sqlite3_bind_int64(pointer, idx, view2.getBigInt64(at, true));
30145
+ at += 8;
30146
+ break;
30147
+ case 2:
30148
+ st.bind(idx, view2.getFloat64(at, true));
30149
+ at += 8;
30150
+ continue;
30151
+ case 3:
30152
+ case 4: {
30153
+ const length = view2.getUint32(at, true);
30154
+ at += 4;
30155
+ rc = tag === 3 ? raw.sqlite3_bind_text(pointer, idx, base + at, length, 0) : raw.sqlite3_bind_blob(pointer, idx, base + at, length, 0);
30156
+ at += length;
30157
+ break;
30158
+ }
30159
+ default:
30160
+ throw new IndexError("Other", "invalid tag in validated packet");
30161
+ }
30162
+ if (rc) this.db.checkRc(rc);
30163
+ }
30164
+ }
30122
30165
  column(pointer, i, tag, addBytes) {
30123
30166
  const raw = this.sqlite3.wasm.exports;
30124
30167
  switch (tag) {
@@ -30148,6 +30191,19 @@ ${end.comment}` : end.comment;
30148
30191
  /** `IndexStorage::run`. */
30149
30192
  run(batch, limits) {
30150
30193
  if (this.closed) throw new IndexError("Other", "index closed");
30194
+ const packet = validatedPackets.get(batch);
30195
+ if (!packet?.hasPayload) return this.runBatch(batch, limits, packet);
30196
+ const wasm = this.sqlite3.wasm;
30197
+ const view2 = packet.view;
30198
+ const buffer = wasm.alloc(view2.byteLength + 1);
30199
+ try {
30200
+ wasm.heap8u().set(new Uint8Array(view2.buffer, view2.byteOffset, view2.byteLength), buffer);
30201
+ return this.runBatch(batch, limits, packet, buffer);
30202
+ } finally {
30203
+ wasm.dealloc(buffer);
30204
+ }
30205
+ }
30206
+ runBatch(batch, limits, packet, packetBase = 0) {
30151
30207
  const raw = this.sqlite3.wasm.exports;
30152
30208
  const tx = batch.mode === "Transaction";
30153
30209
  const out = [];
@@ -30167,18 +30223,19 @@ ${end.comment}` : end.comment;
30167
30223
  throw classifyError(e);
30168
30224
  }
30169
30225
  }
30170
- for (let i = 0; i < batch.stmts.length; i++) {
30226
+ for (let i = 0; i < (packet?.offsets.length ?? batch.stmts.length); i++) {
30171
30227
  const s = batch.stmts[i];
30172
30228
  try {
30173
30229
  const st = this.prepare(s.sql);
30174
- let bindBytes = 0;
30175
- for (const p of s.params) {
30176
- if (p.kind === "Blob") bindBytes += Math.max(1, p.value.byteLength);
30177
- if (p.kind === "Text") bindBytes += Math.max(1, p.value.length * 3);
30178
- }
30179
- const buffer = bindBytes ? this.sqlite3.wasm.alloc(bindBytes) : 0;
30230
+ let buffer = 0;
30180
30231
  try {
30181
- this.bind(st, s.params, buffer);
30232
+ if (packet) {
30233
+ this.bindPacket(st, packet, i, packetBase);
30234
+ } else {
30235
+ const params2 = s.params;
30236
+ buffer = this.statementBuffer(params2);
30237
+ this.bind(st, params2, buffer);
30238
+ }
30182
30239
  const pointer = st.pointer;
30183
30240
  const columns = st.columnCount;
30184
30241
  if (limits && (!Number.isSafeInteger(columns) || columns < 0 || columns > limits.maxColumns)) {
@@ -30254,6 +30311,11 @@ ${end.comment}` : end.comment;
30254
30311
  });
30255
30312
 
30256
30313
  // src/app-storage/app-binary-index.ts
30314
+ function validateText(bytes10, view2, at, end) {
30315
+ while (at + 4 <= end && !(view2.getUint32(at) & 2155905152)) at += 4;
30316
+ while (at < end && bytes10[at] < 128) at++;
30317
+ if (at < end) utf83.decode(bytes10.subarray(at, end));
30318
+ }
30257
30319
  function request(bytes10) {
30258
30320
  const r = new Reader2(bytes10);
30259
30321
  if (!r.take(8).every((b, i) => b === MAGIC[i])) throw invalid7();
@@ -30267,15 +30329,31 @@ ${end.comment}` : end.comment;
30267
30329
  if (mode > 1) throw invalid7();
30268
30330
  const count = r.count(APP_INDEX_LIMITS.maxStatements, 8);
30269
30331
  const stmts = [];
30332
+ const offsets = new Uint32Array(count);
30333
+ let total = 0;
30270
30334
  for (let i = 0; i < count; i++) {
30271
30335
  const sql = r.text(APP_INDEX_LIMITS.maxSqlBytes);
30272
30336
  const n = r.count(APP_INDEX_LIMITS.maxParameters, 1);
30273
- const params2 = [];
30274
- for (let j = 0; j < n; j++) params2.push(r.value());
30275
- stmts.push({ sql, params: params2 });
30337
+ total += n;
30338
+ if (total > APP_INDEX_LIMITS.maxValues) throw full();
30339
+ offsets[i] = r.pos;
30340
+ r.params(n);
30341
+ let decoded;
30342
+ stmts.push({
30343
+ sql,
30344
+ get params() {
30345
+ if (decoded) return decoded;
30346
+ r.pos = offsets[i];
30347
+ const params2 = [];
30348
+ r.params(n, params2);
30349
+ return decoded = params2;
30350
+ }
30351
+ });
30276
30352
  }
30277
30353
  r.done();
30278
- return { mode: mode === 0 ? "Transaction" : "Autocommit", stmts };
30354
+ const batch = { mode: mode === 0 ? "Transaction" : "Autocommit", stmts };
30355
+ validatedPackets.set(batch, { view: r.view, offsets, hasPayload: r.hasPayload });
30356
+ return batch;
30279
30357
  }
30280
30358
  function results(out, expected) {
30281
30359
  if (!Array.isArray(out) || out.length !== expected) throw invalid7();
@@ -30329,7 +30407,7 @@ ${end.comment}` : end.comment;
30329
30407
  host.fence();
30330
30408
  throw full();
30331
30409
  }
30332
- const reply = host.run(new Uint8Array(x.memory.buffer, ptr, len).slice());
30410
+ const reply = host.run(new Uint8Array(x.memory.buffer, ptr, len));
30333
30411
  const out = x.alloc(reply.length);
30334
30412
  range(x.memory, out, reply.length);
30335
30413
  if (reentered || out === 0 || out < ptr + len && ptr < out + reply.length) throw invalid7();
@@ -30368,12 +30446,11 @@ ${end.comment}` : end.comment;
30368
30446
  Reader2 = class {
30369
30447
  constructor(bytes10) {
30370
30448
  this.bytes = bytes10;
30371
- if (bytes10.length > APP_INDEX_LIMITS.maxBytes) throw full();
30372
30449
  this.view = new DataView(bytes10.buffer, bytes10.byteOffset, bytes10.byteLength);
30373
30450
  }
30374
30451
  bytes;
30375
30452
  pos = 0;
30376
- values = 0;
30453
+ hasPayload = false;
30377
30454
  view;
30378
30455
  advance(n) {
30379
30456
  if (!Number.isSafeInteger(n) || n < 0 || n > this.bytes.length - this.pos) throw invalid7();
@@ -30403,27 +30480,39 @@ ${end.comment}` : end.comment;
30403
30480
  text(max) {
30404
30481
  return utf83.decode(this.data(max));
30405
30482
  }
30406
- value() {
30407
- if (++this.values > APP_INDEX_LIMITS.maxValues) throw full();
30408
- switch (this.byte()) {
30409
- case 0:
30410
- return { kind: "Null" };
30411
- case 1: {
30412
- const at = this.advance(8);
30413
- return { kind: "Integer", value: this.view.getBigInt64(at, true) };
30414
- }
30415
- case 2: {
30416
- const at = this.advance(8);
30417
- const value2 = this.view.getFloat64(at, true);
30418
- if (!Number.isFinite(value2)) throw invalid7();
30419
- return { kind: "Real", value: value2 };
30420
- }
30421
- case 3:
30422
- return { kind: "Text", value: this.text(APP_INDEX_LIMITS.maxBytes) };
30423
- case 4:
30424
- return { kind: "Blob", value: this.data(APP_INDEX_LIMITS.maxBytes) };
30425
- default:
30426
- throw invalid7();
30483
+ params(count, out) {
30484
+ for (let i = 0; i < count; i++) {
30485
+ const tag = this.byte();
30486
+ switch (tag) {
30487
+ case 0:
30488
+ out?.push({ kind: "Null" });
30489
+ break;
30490
+ case 1: {
30491
+ const at = this.advance(8);
30492
+ out?.push({ kind: "Integer", value: this.view.getBigInt64(at, true) });
30493
+ break;
30494
+ }
30495
+ case 2: {
30496
+ const value2 = this.view.getFloat64(this.advance(8), true);
30497
+ if (!Number.isFinite(value2)) throw invalid7();
30498
+ out?.push({ kind: "Real", value: value2 });
30499
+ break;
30500
+ }
30501
+ case 3:
30502
+ case 4: {
30503
+ const at = this.advance(this.count(APP_INDEX_LIMITS.maxBytes, 1));
30504
+ this.hasPayload = true;
30505
+ if (out) {
30506
+ const data = this.bytes.subarray(at, this.pos);
30507
+ out.push(tag === 3 ? { kind: "Text", value: utf83.decode(data) } : { kind: "Blob", value: data.slice() });
30508
+ } else if (tag === 3) {
30509
+ validateText(this.bytes, this.view, at, this.pos);
30510
+ }
30511
+ break;
30512
+ }
30513
+ default:
30514
+ throw invalid7();
30515
+ }
30427
30516
  }
30428
30517
  }
30429
30518
  done() {
@@ -30526,7 +30615,8 @@ ${end.comment}` : end.comment;
30526
30615
  let expected = null;
30527
30616
  try {
30528
30617
  if (this.needsRecovery) throw invalid7();
30529
- const batch = request(bytes10);
30618
+ if (bytes10.byteLength > APP_INDEX_LIMITS.maxBytes) throw full();
30619
+ const batch = request(new Uint8Array(bytes10));
30530
30620
  expected = batch.stmts.length;
30531
30621
  const limits = APP_INDEX_LIMITS;
30532
30622
  return results(this.index.run(batch, limits), expected);