inillucent 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/index.mjs +28 -1
  2. package/package.json +6 -6
package/index.mjs CHANGED
@@ -193,5 +193,32 @@ export async function query(sql, options = {}) {
193
193
  throw error;
194
194
  }
195
195
  const names = result.columns.map((column) => column.name);
196
- return result.rows.map((row) => Object.fromEntries(names.map((name, at) => [name, row[at]])));
196
+ return result.rows.map((row) =>
197
+ Object.fromEntries(names.map((name, at) => [name, decodeValue(row[at])])),
198
+ );
199
+ }
200
+
201
+ /**
202
+ * Turns one cell of a result into the JavaScript value it stands for.
203
+ *
204
+ * **Bytes went in and could not come back** (task-2066 section 4.1.15). A blob
205
+ * left as the string `"x'00ff'"`, typed `text` in the column list, so nothing
206
+ * told it apart from a TEXT column holding that text - while `encodeParam`
207
+ * above has always sent bytes as `{blob: "<hex>"}`. The two halves of the same
208
+ * grammar now agree, and a `Uint8Array` read out of one query can be bound
209
+ * straight into the next.
210
+ *
211
+ * Anything that is not an envelope is passed through, so a caller's own object
212
+ * column - which arrives as text - is untouched.
213
+ *
214
+ * @param value - one cell, as `--output json` rendered it
215
+ */
216
+ function decodeValue(value) {
217
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
218
+ return value;
219
+ }
220
+ if (typeof value.blob === 'string') {
221
+ return Uint8Array.from(Buffer.from(value.blob, 'hex'));
222
+ }
223
+ return value;
197
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inillucent",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Embedded SQL database with full-text and vector search, an MCP server, and a sqlite3-shaped shell. No native build step: the binaries ship as platform packages.",
5
5
  "keywords": [
6
6
  "database",
@@ -43,10 +43,10 @@
43
43
  "README.md"
44
44
  ],
45
45
  "optionalDependencies": {
46
- "@blackrainbowlabs/cli-win32-x64": "0.1.7",
47
- "@blackrainbowlabs/cli-darwin-arm64": "0.1.7",
48
- "@blackrainbowlabs/cli-darwin-x64": "0.1.7",
49
- "@blackrainbowlabs/cli-linux-x64": "0.1.7",
50
- "@blackrainbowlabs/cli-linux-arm64": "0.1.7"
46
+ "@blackrainbowlabs/cli-win32-x64": "0.1.8",
47
+ "@blackrainbowlabs/cli-darwin-arm64": "0.1.8",
48
+ "@blackrainbowlabs/cli-darwin-x64": "0.1.8",
49
+ "@blackrainbowlabs/cli-linux-x64": "0.1.8",
50
+ "@blackrainbowlabs/cli-linux-arm64": "0.1.8"
51
51
  }
52
52
  }