quiverdb 0.13.1 → 0.13.3
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/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/sandbox-api.ts +40 -13
|
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/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
|
|
@@ -327,10 +328,11 @@ Notes:
|
|
|
327
328
|
\`{ x = nil }\` is identical to \`{}\`; an update/create table that ends up with no attributes
|
|
328
329
|
**throws** (\`...must have at least one scalar attribute\` on create, \`...at least one attribute
|
|
329
330
|
to update\` on update). To leave a column unchanged, omit the key — you cannot set a scalar to
|
|
330
|
-
NULL via the element table
|
|
331
|
-
|
|
332
|
-
\`
|
|
333
|
-
the
|
|
331
|
+
NULL via the element table — nor via \`update_time_series_files\`, keyed by column name too,
|
|
332
|
+
where an omitted column keeps its current value. (\`nil\` → NULL is accepted by
|
|
333
|
+
\`update_relation\` and in query params (not a trailing one), and as a cell in the group writers;
|
|
334
|
+
\`upsert_time_series_row\` replaces the whole row, so a column you leave out (or set to \`nil\`,
|
|
335
|
+
the same thing) is cleared — see Time series.)
|
|
334
336
|
- **\`update_relation\` points one scalar foreign-key relation at another element**, named by the
|
|
335
337
|
target's label. The column is derived from the naming convention —
|
|
336
338
|
\`lowercase(collection_to) .. "_" .. relation_type\`, so
|
|
@@ -559,15 +561,12 @@ singleton table):
|
|
|
559
561
|
db:has_time_series_files(collection) -- boolean
|
|
560
562
|
db:list_time_series_files_columns(collection) -- { "data_file", "metadata_file", ... }
|
|
561
563
|
db:read_time_series_files(collection) -- { data_file = "path", metadata_file = nil, ... }
|
|
562
|
-
db:update_time_series_files(collection, { data_file = "path/to/data.bin" })
|
|
564
|
+
db:update_time_series_files(collection, { data_file = "path/to/data.bin" })
|
|
563
565
|
\`\`\`
|
|
564
566
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
changes nothing and clears nothing. A value that is not a string throws. To change one path, read
|
|
569
|
-
the row with \`db:read_time_series_files(collection)\`, change that one entry, and pass the whole
|
|
570
|
-
table back.
|
|
567
|
+
Only the columns you name are written, so the call above leaves \`metadata_file\` alone. A column
|
|
568
|
+
cannot be cleared from Lua here: \`{ metadata_file = nil }\` is \`{}\`, which names nothing — so
|
|
569
|
+
feeding a \`read_time_series_files\` result straight back in is a no-op.
|
|
571
570
|
|
|
572
571
|
---
|
|
573
572
|
|
|
@@ -791,6 +790,34 @@ end
|
|
|
791
790
|
|
|
792
791
|
---
|
|
793
792
|
|
|
793
|
+
## JSON file reading
|
|
794
|
+
|
|
795
|
+
Read one complete JSON document through the same filesystem sandbox as CSV/XLSX:
|
|
796
|
+
|
|
797
|
+
\`\`\`lua
|
|
798
|
+
local data = db:read_json("input.json")
|
|
799
|
+
\`\`\`
|
|
800
|
+
|
|
801
|
+
The root may be an object, array, string, number, boolean or null. Objects become tables with
|
|
802
|
+
string keys; arrays use 1-based indices. Strings and booleans retain their native Lua types.
|
|
803
|
+
Integers fitting signed 64-bit stay Lua integers; other finite numbers use Lua doubles, which
|
|
804
|
+
can round large integers. Text must be UTF-8 (an initial UTF-8 BOM is accepted); there is no
|
|
805
|
+
Latin-1 fallback. Standard strict JSON syntax applies: comments, trailing commas, extra roots,
|
|
806
|
+
invalid Unicode and non-finite numbers are rejected. Duplicate object keys keep the last value.
|
|
807
|
+
|
|
808
|
+
JSON null becomes \`nil\`. Null object fields disappear, and null array entries leave holes at
|
|
809
|
+
their original indices; later entries are not shifted. Neither \`#\` nor \`ipairs\` supplies a
|
|
810
|
+
reliable count for such arrays, and trailing null entries are invisible. Empty objects and
|
|
811
|
+
arrays both become empty Lua tables. Returning these values uses the existing encoder: an
|
|
812
|
+
empty table emits \`[]\`, and a sparse array emits an object such as \`{"2":10,"4":30}\`.
|
|
813
|
+
|
|
814
|
+
The reader loads the whole document, with at most 64 MiB of input and nesting depth 32 (root
|
|
815
|
+
depth 0). File, parse and limit failures carry \`Cannot read_json:\` and the requested path;
|
|
816
|
+
parse failures include location information when available. The file is closed on success and
|
|
817
|
+
failure. This reads values only; it does not import database rows or write the file.
|
|
818
|
+
|
|
819
|
+
---
|
|
820
|
+
|
|
794
821
|
## XLSX file reading
|
|
795
822
|
|
|
796
823
|
Read one worksheet of an XLSX workbook through the same filesystem sandbox as CSV. XLSX only:
|