quiverdb 0.13.2 → 0.13.4
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 +6 -3
- 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 +39 -7
package/README.md
CHANGED
|
@@ -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
|
@@ -104,12 +104,13 @@ midnight.
|
|
|
104
104
|
binary chunk is refused). Integer division is the Lua 5.4 \`//\` operator — a language operator,
|
|
105
105
|
unrelated to \`math\`. No \`io\` does **not** mean
|
|
106
106
|
a data file on disk is out of reach: use \`db:read_csv\` / \`db:read_csv_stream\` for CSV or
|
|
107
|
-
\`db:read_xlsx\` / \`db:read_xlsx_stream\` for XLSX
|
|
107
|
+
\`db:read_xlsx\` / \`db:read_xlsx_stream\` for XLSX, and \`db:read_json\` for JSON
|
|
108
|
+
(see the file reading sections below).
|
|
108
109
|
Never copy, paste, or re-type a data file's contents into
|
|
109
110
|
the script as literals — read the file.
|
|
110
111
|
- **Filesystem sandbox.** Every file-touching operation (\`db:export_csv\`, \`db:import_csv\`,
|
|
111
112
|
\`db:open_file\`, \`db:bin_to_csv\`, \`db:csv_to_bin\`, \`db:validate_migrations\`, \`db:read_csv\`,
|
|
112
|
-
\`db:read_csv_stream\`, \`db:write_csv\`, \`db:read_xlsx\`, \`db:read_xlsx_stream\`,
|
|
113
|
+
\`db:read_csv_stream\`, \`db:write_csv\`, \`db:read_xlsx\`, \`db:read_xlsx_stream\`, \`db:read_json\`,
|
|
113
114
|
\`save\` on a file or an expression) resolves
|
|
114
115
|
relative paths against the directory containing the database file and rejects anything outside it
|
|
115
116
|
(subdirectories are fine; \`..\` escapes and outside absolute paths throw \`Cannot <op>: path '...' escapes the
|
|
@@ -180,14 +181,17 @@ db:is_healthy() -- boolean
|
|
|
180
181
|
db:current_version() -- integer (current migration version)
|
|
181
182
|
db:path() -- string (database file path)
|
|
182
183
|
db:number_of_elements(collection) -- integer: how many elements the collection holds right now
|
|
183
|
-
db:describe() -- string:
|
|
184
|
-
db:describe_collection(collection) -- string:
|
|
185
|
-
|
|
186
|
-
-- integer value distributions, per-group sizes
|
|
184
|
+
db:describe() -- string: database/version header + complete reports for every collection
|
|
185
|
+
db:describe_collection(collection) -- string: structure, UI metadata (including tooltips), scalar
|
|
186
|
+
-- null/non-null counts, integer distributions, group coverage
|
|
187
187
|
db:validate_migrations(path) -- validate a migrations dir (up then down) in-memory; no return
|
|
188
188
|
\`\`\`
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
The \`describe*\` methods give agents the schema, attribute meanings and data coverage as text reports.
|
|
191
|
+
Both **return** a string. Declarations and statistics share each line, with UI clauses between them.
|
|
192
|
+
Enum meanings appear once in \`enum {...}\`;
|
|
193
|
+
value histograms contain numeric codes and counts, only for non-primary-key INTEGER scalars with
|
|
194
|
+
at most 64 distinct integer values. \`db:describe()\` queries statistics for every collection.
|
|
191
195
|
|
|
192
196
|
\`db:validate_migrations(path)\` applies every \`up.sql\` in version order, then every \`down.sql\` in
|
|
193
197
|
reverse, against a throwaway in-memory database — nothing in \`db\` itself is touched. The round trip
|
|
@@ -789,6 +793,34 @@ end
|
|
|
789
793
|
|
|
790
794
|
---
|
|
791
795
|
|
|
796
|
+
## JSON file reading
|
|
797
|
+
|
|
798
|
+
Read one complete JSON document through the same filesystem sandbox as CSV/XLSX:
|
|
799
|
+
|
|
800
|
+
\`\`\`lua
|
|
801
|
+
local data = db:read_json("input.json")
|
|
802
|
+
\`\`\`
|
|
803
|
+
|
|
804
|
+
The root may be an object, array, string, number, boolean or null. Objects become tables with
|
|
805
|
+
string keys; arrays use 1-based indices. Strings and booleans retain their native Lua types.
|
|
806
|
+
Integers fitting signed 64-bit stay Lua integers; other finite numbers use Lua doubles, which
|
|
807
|
+
can round large integers. Text must be UTF-8 (an initial UTF-8 BOM is accepted); there is no
|
|
808
|
+
Latin-1 fallback. Standard strict JSON syntax applies: comments, trailing commas, extra roots,
|
|
809
|
+
invalid Unicode and non-finite numbers are rejected. Duplicate object keys keep the last value.
|
|
810
|
+
|
|
811
|
+
JSON null becomes \`nil\`. Null object fields disappear, and null array entries leave holes at
|
|
812
|
+
their original indices; later entries are not shifted. Neither \`#\` nor \`ipairs\` supplies a
|
|
813
|
+
reliable count for such arrays, and trailing null entries are invisible. Empty objects and
|
|
814
|
+
arrays both become empty Lua tables. Returning these values uses the existing encoder: an
|
|
815
|
+
empty table emits \`[]\`, and a sparse array emits an object such as \`{"2":10,"4":30}\`.
|
|
816
|
+
|
|
817
|
+
The reader loads the whole document, with at most 64 MiB of input and nesting depth 32 (root
|
|
818
|
+
depth 0). File, parse and limit failures carry \`Cannot read_json:\` and the requested path;
|
|
819
|
+
parse failures include location information when available. The file is closed on success and
|
|
820
|
+
failure. This reads values only; it does not import database rows or write the file.
|
|
821
|
+
|
|
822
|
+
---
|
|
823
|
+
|
|
792
824
|
## XLSX file reading
|
|
793
825
|
|
|
794
826
|
Read one worksheet of an XLSX workbook through the same filesystem sandbox as CSV. XLSX only:
|