quiverdb 0.13.2 → 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 +31 -2
|
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
|
|
@@ -789,6 +790,34 @@ end
|
|
|
789
790
|
|
|
790
791
|
---
|
|
791
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
|
+
|
|
792
821
|
## XLSX file reading
|
|
793
822
|
|
|
794
823
|
Read one worksheet of an XLSX workbook through the same filesystem sandbox as CSV. XLSX only:
|