quiverdb 0.13.3 → 0.13.5
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/README.md +7 -4
- package/libs/linux-aarch64/libquiver.so +0 -0
- package/libs/linux-aarch64/libquiver.so.0 +0 -0
- package/libs/linux-aarch64/libquiver_c.so +0 -0
- package/libs/linux-x86_64/libquiver.so +0 -0
- package/libs/linux-x86_64/libquiver.so.0 +0 -0
- package/libs/linux-x86_64/libquiver_c.so +0 -0
- package/libs/macos-aarch64/libquiver.0.dylib +0 -0
- package/libs/macos-aarch64/libquiver_c.dylib +0 -0
- package/libs/windows-x86_64/libquiver.dll +0 -0
- package/libs/windows-x86_64/libquiver_c.dll +0 -0
- package/package.json +1 -1
- package/src/database.ts +0 -1
- package/src/introspection.ts +0 -10
- package/src/loader.ts +0 -1
- package/src/sandbox-api.ts +22 -10
package/README.md
CHANGED
|
@@ -151,7 +151,7 @@ bun run example.ts
|
|
|
151
151
|
- `readTimeSeriesFiles(collection)` -- Read the file paths (`null` for an unset column)
|
|
152
152
|
- `updateTimeSeriesFiles(collection, data)` -- Write the file paths
|
|
153
153
|
|
|
154
|
-
### Query
|
|
154
|
+
### Query (read-only SQL)
|
|
155
155
|
|
|
156
156
|
- `queryString(sql, parameters?)` -- Query returning string or null
|
|
157
157
|
- `queryInteger(sql, parameters?)` -- Query returning integer or null
|
|
@@ -185,9 +185,12 @@ as an exact INTEGER, a `boolean` as the INTEGER 1 or 0).
|
|
|
185
185
|
|
|
186
186
|
### Introspection
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
- `
|
|
188
|
+
The describe methods give agents the schema, attribute meanings and data coverage as text reports.
|
|
189
|
+
|
|
190
|
+
- `describe()` -- Database/version header followed by complete reports for every collection
|
|
191
|
+
- `describeCollection(collection)` -- One collection's structure, UI metadata (including tooltips),
|
|
192
|
+
scalar null/value statistics and group coverage, returned as a string. Enum meanings appear
|
|
193
|
+
once in `enum {...}`; value histograms contain numeric codes and counts.
|
|
191
194
|
- `isHealthy()` -- Check database health
|
|
192
195
|
- `path()` -- Get database file path
|
|
193
196
|
- `currentVersion()` -- Get current schema version
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/src/database.ts
CHANGED
|
@@ -302,7 +302,6 @@ export class Database {
|
|
|
302
302
|
declare path: () => string;
|
|
303
303
|
declare describe: () => string;
|
|
304
304
|
declare describeCollection: (collection: string) => string;
|
|
305
|
-
declare summarizeCollection: (collection: string) => string;
|
|
306
305
|
|
|
307
306
|
// --- Composite helpers (implemented in composites.ts) ---
|
|
308
307
|
declare readScalarsById: (
|
package/src/introspection.ts
CHANGED
|
@@ -42,13 +42,3 @@ Database.prototype.describeCollection = function (this: Database, collection: st
|
|
|
42
42
|
lib.quiver_database_free_string(readPtrOut(out));
|
|
43
43
|
return result;
|
|
44
44
|
};
|
|
45
|
-
|
|
46
|
-
Database.prototype.summarizeCollection = function (this: Database, collection: string): string {
|
|
47
|
-
const lib = getSymbols();
|
|
48
|
-
const collBuf = toCString(collection);
|
|
49
|
-
const out = allocPtrOut();
|
|
50
|
-
check(lib.quiver_database_summarize_collection(this._handle, collBuf.buf, out.buf));
|
|
51
|
-
const result = decodeStringFromBuf(out);
|
|
52
|
-
lib.quiver_database_free_string(readPtrOut(out));
|
|
53
|
-
return result;
|
|
54
|
-
};
|
package/src/loader.ts
CHANGED
|
@@ -128,7 +128,6 @@ const metadataSymbols = {
|
|
|
128
128
|
|
|
129
129
|
const describeSymbols = {
|
|
130
130
|
quiver_database_describe_collection: { args: [P, BUF, P], returns: I32 },
|
|
131
|
-
quiver_database_summarize_collection: { args: [P, BUF, P], returns: I32 },
|
|
132
131
|
} as const;
|
|
133
132
|
|
|
134
133
|
const timeSeriesSymbols = {
|
package/src/sandbox-api.ts
CHANGED
|
@@ -116,6 +116,13 @@ midnight.
|
|
|
116
116
|
(subdirectories are fine; \`..\` escapes and outside absolute paths throw \`Cannot <op>: path '...' escapes the
|
|
117
117
|
database directory ...\`). On an in-memory database these operations throw
|
|
118
118
|
\`Cannot <op>: database is in-memory, file operations are unavailable\`.
|
|
119
|
+
- **Raw SQL is read-only.** \`db:query_string\` / \`db:query_integer\` / \`db:query_float\` accept only
|
|
120
|
+
statements that read: a write (\`INSERT\`, \`UPDATE\`, \`DELETE\`, DDL), a \`PRAGMA\` statement,
|
|
121
|
+
\`ATTACH\`/\`DETACH\`, \`VACUUM\` or transaction control (\`BEGIN\`, \`COMMIT\`, \`ROLLBACK\`,
|
|
122
|
+
\`SAVEPOINT\`) throws \`Cannot query: SQL must be read-only; writes, PRAGMA, ATTACH, VACUUM and
|
|
123
|
+
transaction control are not allowed\` before anything runs. The table-valued \`pragma_*()\`
|
|
124
|
+
functions (\`SELECT name FROM pragma_table_info('X')\`) are reads and stay available. Write
|
|
125
|
+
through the \`db:\` API, which validates what it writes.
|
|
119
126
|
- **What the sandbox does not limit.** The sandbox controls which files a script can touch and
|
|
120
127
|
which standard libraries exist. It does not bound how much work a script does: there is no
|
|
121
128
|
instruction-count limit, no memory cap and no wall-clock timeout (\`while true do end\` runs
|
|
@@ -181,14 +188,17 @@ db:is_healthy() -- boolean
|
|
|
181
188
|
db:current_version() -- integer (current migration version)
|
|
182
189
|
db:path() -- string (database file path)
|
|
183
190
|
db:number_of_elements(collection) -- integer: how many elements the collection holds right now
|
|
184
|
-
db:describe() -- string:
|
|
185
|
-
db:describe_collection(collection) -- string:
|
|
186
|
-
|
|
187
|
-
-- integer value distributions, per-group sizes
|
|
191
|
+
db:describe() -- string: database/version header + complete reports for every collection
|
|
192
|
+
db:describe_collection(collection) -- string: structure, UI metadata (including tooltips), scalar
|
|
193
|
+
-- null/non-null counts, integer distributions, group coverage
|
|
188
194
|
db:validate_migrations(path) -- validate a migrations dir (up then down) in-memory; no return
|
|
189
195
|
\`\`\`
|
|
190
196
|
|
|
191
|
-
|
|
197
|
+
The \`describe*\` methods give agents the schema, attribute meanings and data coverage as text reports.
|
|
198
|
+
Both **return** a string. Declarations and statistics share each line, with UI clauses between them.
|
|
199
|
+
Enum meanings appear once in \`enum {...}\`;
|
|
200
|
+
value histograms contain numeric codes and counts, only for non-primary-key INTEGER scalars with
|
|
201
|
+
at most 64 distinct integer values. \`db:describe()\` queries statistics for every collection.
|
|
192
202
|
|
|
193
203
|
\`db:validate_migrations(path)\` applies every \`up.sql\` in version order, then every \`down.sql\` in
|
|
194
204
|
reverse, against a throwaway in-memory database — nothing in \`db\` itself is touched. The round trip
|
|
@@ -621,9 +631,10 @@ entirely.
|
|
|
621
631
|
|
|
622
632
|
---
|
|
623
633
|
|
|
624
|
-
## Query (parameterized SQL)
|
|
634
|
+
## Query (parameterized, read-only SQL)
|
|
625
635
|
|
|
626
|
-
|
|
636
|
+
Only statements that read are accepted (see "Raw SQL is read-only" above); anything else throws
|
|
637
|
+
before it runs. Positional \`?\` placeholders; \`params\` is an optional 1-indexed array. Each returns the first
|
|
627
638
|
column of the first row, or \`nil\` when there is no row, the value is NULL, or it is not already
|
|
628
639
|
the requested type. Only \`query_float\` converts (it widens an INTEGER), so
|
|
629
640
|
\`db:query_string("SELECT COUNT(*) ...")\` and \`db:query_integer("SELECT AVG(x) ...")\` return
|
|
@@ -1021,6 +1032,7 @@ value of the wrong type throws.
|
|
|
1021
1032
|
DateTime wrapper helpers (Lua uses ISO 8601 strings), boolean *reader* helpers (a stored flag reads
|
|
1022
1033
|
back as \`0\`/\`1\` — writing a boolean is supported), \`_by_id\` single-scalar variants (use the
|
|
1023
1034
|
composite by-id readers or the bulk readers instead), and the row-aligned whole-group readers the
|
|
1024
|
-
other bindings have (hence the row-count caveat under composite by-id reads).
|
|
1025
|
-
|
|
1026
|
-
|
|
1035
|
+
other bindings have (hence the row-count caveat under composite by-id reads). Raw SQL that writes,
|
|
1036
|
+
sets a \`PRAGMA\`, attaches a database, vacuums or controls a transaction (\`query_*\` is read-only
|
|
1037
|
+
in every binding). Everything else the native binding exposes — CRUD, reads, time series,
|
|
1038
|
+
metadata, query, CSV, and the binary/expression subsystems — is documented above and callable.`;
|