@statewalker/webrun-files-sqlite 0.11.0 → 0.11.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.
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region ../../node_modules/.pnpm/@statewalker+db-sqlite@0.1.0/node_modules/@statewalker/db-sqlite/dist/index.mjs
2
+ // ../../node_modules/.pnpm/@statewalker+db-sqlite@0.1.0/node_modules/@statewalker/db-sqlite/dist/index.mjs
3
3
  /** Key under which a SQLite Db carries its transaction hook. Shared across bundles via Symbol.for. */
4
4
  const SQLITE_TRANSACTION = Symbol.for("@statewalker/db-sqlite:transaction");
5
5
  const NO_HOOK = "inTransaction: this Db has no SQLite transaction hook. It is not a @statewalker/db-sqlite* Db, or it wraps one (a wrapper object loses the hook - pass the driver's Db itself), or it is the handle of a running transaction (nesting is not supported).";
@@ -13,8 +13,7 @@ function inTransaction(db, cb) {
13
13
  if (typeof hook !== "function") return Promise.reject(/* @__PURE__ */ new Error(NO_HOOK));
14
14
  return hook(cb);
15
15
  }
16
- //#endregion
17
- //#region ../webrun-files/dist/esm/index.js
16
+ // ../webrun-files/dist/esm/index.js
18
17
  /**
19
18
  * The order every `FilesApi.list()` yields: paths compared by Unicode code
20
19
  * point, which is the same as comparing their UTF-8 bytes — the order of
@@ -51,16 +50,14 @@ function normalizePath(filePath) {
51
50
  if (segments.length === 0) return "/";
52
51
  return `/${segments.join("/")}`;
53
52
  }
54
- //#endregion
55
- //#region src/bytes.ts
53
+ // src/bytes.ts
56
54
  /** BLOBs arrive as Uint8Array from every @statewalker/db-sqlite driver; SQLAR may hold TEXT. */
57
55
  function toBytes(value) {
58
56
  if (value instanceof Uint8Array) return value;
59
57
  if (typeof value === "string") return new TextEncoder().encode(value);
60
58
  return /* @__PURE__ */ new Uint8Array(0);
61
59
  }
62
- //#endregion
63
- //#region src/run-statements.ts
60
+ // src/run-statements.ts
64
61
  /**
65
62
  * Runs the statements in order on a transaction's Db and returns, per
66
63
  * statement, the rows it changed — zero exactly when it changed nothing. The
@@ -77,8 +74,7 @@ async function runStatements(tx, statements) {
77
74
  }
78
75
  return counts;
79
76
  }
80
- //#endregion
81
- //#region src/blocks/byte-reader.ts
77
+ // src/blocks/byte-reader.ts
82
78
  /**
83
79
  * Pull bytes from a chunk source in bounded pieces.
84
80
  *
@@ -134,8 +130,7 @@ async function collectBlock(chunks) {
134
130
  }
135
131
  return out;
136
132
  }
137
- //#endregion
138
- //#region src/blocks/sha256.ts
133
+ // src/blocks/sha256.ts
139
134
  /**
140
135
  * Incremental SHA-256 (FIPS 180-4). WebCrypto only hashes a whole buffer, and
141
136
  * content here arrives as a stream it must never be collected from.
@@ -294,8 +289,7 @@ var Sha256 = class {
294
289
  h[7] += k;
295
290
  }
296
291
  };
297
- //#endregion
298
- //#region src/blocks/stream-codec.ts
292
+ // src/blocks/stream-codec.ts
299
293
  /**
300
294
  * zlib-wrapped Deflate over Compression Streams — browsers, Node, Deno, Bun,
301
295
  * Workers. The source is wrapped in a pull-only ReadableStream, so the
@@ -381,8 +375,7 @@ async function* iterate(stream) {
381
375
  reader.releaseLock();
382
376
  }
383
377
  }
384
- //#endregion
385
- //#region src/blocks/sqlite-files-api.ts
378
+ // src/blocks/sqlite-files-api.ts
386
379
  const MiB = 1048576;
387
380
  /** Rows on Durable Objects are capped at 2 MB; leave room for deflate's worst case. */
388
381
  const MAX_BLOCK_SIZE_LIMIT = 1.5 * MiB;
@@ -859,8 +852,7 @@ function ancestorsAndSelf$1(path) {
859
852
  const parts = path.split("/").filter(Boolean);
860
853
  return parts.map((_, i) => `/${parts.slice(0, i + 1).join("/")}`);
861
854
  }
862
- //#endregion
863
- //#region src/codec.ts
855
+ // src/codec.ts
864
856
  const MIN_SIZE = 64;
865
857
  /** Compression Streams — browsers, Node, Workers. No dependency. */
866
858
  function webCodec(opts = {}) {
@@ -910,8 +902,7 @@ async function pipe(bytes, transform) {
910
902
  const stream = new Blob([bytes]).stream().pipeThrough(transform);
911
903
  return new Uint8Array(await new Response(stream).arrayBuffer());
912
904
  }
913
- //#endregion
914
- //#region src/sqlar-files-api.ts
905
+ // src/sqlar-files-api.ts
915
906
  /**
916
907
  * The table, verbatim from the SQLite Archive specification. Five columns,
917
908
  * `name` as the primary key and nothing more: any extra column, index or table
@@ -1222,7 +1213,6 @@ async function concat(content) {
1222
1213
  }
1223
1214
  return out;
1224
1215
  }
1225
- //#endregion
1226
1216
  exports.SqlarFilesApi = SqlarFilesApi;
1227
1217
  exports.SqliteFilesApi = SqliteFilesApi;
1228
1218
  exports.defaultCodec = defaultCodec;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@statewalker+db-sqlite@0.1.0/node_modules/@statewalker/db-sqlite/dist/index.mjs
1
+ // ../../node_modules/.pnpm/@statewalker+db-sqlite@0.1.0/node_modules/@statewalker/db-sqlite/dist/index.mjs
2
2
  /** Key under which a SQLite Db carries its transaction hook. Shared across bundles via Symbol.for. */
3
3
  const SQLITE_TRANSACTION = Symbol.for("@statewalker/db-sqlite:transaction");
4
4
  const NO_HOOK = "inTransaction: this Db has no SQLite transaction hook. It is not a @statewalker/db-sqlite* Db, or it wraps one (a wrapper object loses the hook - pass the driver's Db itself), or it is the handle of a running transaction (nesting is not supported).";
@@ -12,8 +12,7 @@ function inTransaction(db, cb) {
12
12
  if (typeof hook !== "function") return Promise.reject(/* @__PURE__ */ new Error(NO_HOOK));
13
13
  return hook(cb);
14
14
  }
15
- //#endregion
16
- //#region ../webrun-files/dist/esm/index.js
15
+ // ../webrun-files/dist/esm/index.js
17
16
  /**
18
17
  * The order every `FilesApi.list()` yields: paths compared by Unicode code
19
18
  * point, which is the same as comparing their UTF-8 bytes — the order of
@@ -50,16 +49,14 @@ function normalizePath(filePath) {
50
49
  if (segments.length === 0) return "/";
51
50
  return `/${segments.join("/")}`;
52
51
  }
53
- //#endregion
54
- //#region src/bytes.ts
52
+ // src/bytes.ts
55
53
  /** BLOBs arrive as Uint8Array from every @statewalker/db-sqlite driver; SQLAR may hold TEXT. */
56
54
  function toBytes(value) {
57
55
  if (value instanceof Uint8Array) return value;
58
56
  if (typeof value === "string") return new TextEncoder().encode(value);
59
57
  return /* @__PURE__ */ new Uint8Array(0);
60
58
  }
61
- //#endregion
62
- //#region src/run-statements.ts
59
+ // src/run-statements.ts
63
60
  /**
64
61
  * Runs the statements in order on a transaction's Db and returns, per
65
62
  * statement, the rows it changed — zero exactly when it changed nothing. The
@@ -76,8 +73,7 @@ async function runStatements(tx, statements) {
76
73
  }
77
74
  return counts;
78
75
  }
79
- //#endregion
80
- //#region src/blocks/byte-reader.ts
76
+ // src/blocks/byte-reader.ts
81
77
  /**
82
78
  * Pull bytes from a chunk source in bounded pieces.
83
79
  *
@@ -133,8 +129,7 @@ async function collectBlock(chunks) {
133
129
  }
134
130
  return out;
135
131
  }
136
- //#endregion
137
- //#region src/blocks/sha256.ts
132
+ // src/blocks/sha256.ts
138
133
  /**
139
134
  * Incremental SHA-256 (FIPS 180-4). WebCrypto only hashes a whole buffer, and
140
135
  * content here arrives as a stream it must never be collected from.
@@ -293,8 +288,7 @@ var Sha256 = class {
293
288
  h[7] += k;
294
289
  }
295
290
  };
296
- //#endregion
297
- //#region src/blocks/stream-codec.ts
291
+ // src/blocks/stream-codec.ts
298
292
  /**
299
293
  * zlib-wrapped Deflate over Compression Streams — browsers, Node, Deno, Bun,
300
294
  * Workers. The source is wrapped in a pull-only ReadableStream, so the
@@ -380,8 +374,7 @@ async function* iterate(stream) {
380
374
  reader.releaseLock();
381
375
  }
382
376
  }
383
- //#endregion
384
- //#region src/blocks/sqlite-files-api.ts
377
+ // src/blocks/sqlite-files-api.ts
385
378
  const MiB = 1048576;
386
379
  /** Rows on Durable Objects are capped at 2 MB; leave room for deflate's worst case. */
387
380
  const MAX_BLOCK_SIZE_LIMIT = 1.5 * MiB;
@@ -858,8 +851,7 @@ function ancestorsAndSelf$1(path) {
858
851
  const parts = path.split("/").filter(Boolean);
859
852
  return parts.map((_, i) => `/${parts.slice(0, i + 1).join("/")}`);
860
853
  }
861
- //#endregion
862
- //#region src/codec.ts
854
+ // src/codec.ts
863
855
  const MIN_SIZE = 64;
864
856
  /** Compression Streams — browsers, Node, Workers. No dependency. */
865
857
  function webCodec(opts = {}) {
@@ -909,8 +901,7 @@ async function pipe(bytes, transform) {
909
901
  const stream = new Blob([bytes]).stream().pipeThrough(transform);
910
902
  return new Uint8Array(await new Response(stream).arrayBuffer());
911
903
  }
912
- //#endregion
913
- //#region src/sqlar-files-api.ts
904
+ // src/sqlar-files-api.ts
914
905
  /**
915
906
  * The table, verbatim from the SQLite Archive specification. Five columns,
916
907
  * `name` as the primary key and nothing more: any extra column, index or table
@@ -1221,5 +1212,4 @@ async function concat(content) {
1221
1212
  }
1222
1213
  return out;
1223
1214
  }
1224
- //#endregion
1225
1215
  export { SqlarFilesApi, SqliteFilesApi, defaultCodec, pakoCodec, pakoDeflateCodec, rawCodec, webCodec, webDeflateCodec };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statewalker/webrun-files-sqlite",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "SQLite-backed FilesApi implementations",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@statewalker/db-api": "^0.1.3",
38
38
  "@statewalker/db-sqlite": "^0.1.0",
39
- "@statewalker/webrun-files": "^0.10.3"
39
+ "@statewalker/webrun-files": "^0.10.5"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@statewalker/db-sqlite-do": "^0.1.0",
@@ -46,7 +46,7 @@
46
46
  "rimraf": "^6.1.3",
47
47
  "rolldown": "^1.2.12",
48
48
  "typescript": "^7.0.2",
49
- "vitest": "^5.0.3",
49
+ "vitest": "^4.1.4 || ^5.0.3",
50
50
  "@statewalker/webrun-files-tests": "^3.0.0"
51
51
  },
52
52
  "sideEffects": false,