@casoon/opengrid 0.3.0 → 0.4.0
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/CHANGELOG.md +97 -0
- package/README.md +45 -3
- package/engine/opengrid_wasm.d.ts +15 -1
- package/engine/opengrid_wasm.js +45 -1
- package/engine/opengrid_wasm_bg.wasm +0 -0
- package/engine/opengrid_wasm_bg.wasm.d.ts +2 -0
- package/loader.d.ts +16 -4
- package/loader.js +66 -18
- package/package.json +1 -1
- package/pkg/opengrid_web_components.d.ts +4 -4
- package/pkg/opengrid_web_components.js +70 -38
- package/pkg/opengrid_web_components_bg.wasm +0 -0
- package/pkg/opengrid_web_components_bg.wasm.d.ts +2 -2
- package/worker.js +5 -4
- /package/pkg/snippets/{opengrid-web-core-51c93662af7982d2 → opengrid-web-core-cf7d8c1a6d317e41}/inline0.js +0 -0
- /package/pkg/snippets/{opengrid-web-core-51c93662af7982d2 → opengrid-web-core-cf7d8c1a6d317e41}/inline1.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,103 @@ Two things belong in every release entry and are easy to leave out:
|
|
|
18
18
|
|
|
19
19
|
## [Unreleased]
|
|
20
20
|
|
|
21
|
+
## [0.4.0] — 2026-09-28
|
|
22
|
+
|
|
23
|
+
**Screen-reader pairings tested: none yet** — unchanged since 0.1.0
|
|
24
|
+
([issue #5](https://github.com/casoon/opengrid/issues/5)). **Browsers:** as in 0.1.0.
|
|
25
|
+
|
|
26
|
+
**Module sizes** (brotli, `just measure-modules`): the engine 335.1 → **122.6 KiB** (no
|
|
27
|
+
Arrow, #37); the elements 201.9 → 211.2 KiB (the binary result codec, #38). A page with grid
|
|
28
|
+
and engine loads about 334 KiB instead of 537 KiB.
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **The server as a library, sources as connectors** ([#45](https://github.com/casoon/opengrid/issues/45)).
|
|
33
|
+
A new crate `opengrid-connector` holds the one contract a source implements: `schema`,
|
|
34
|
+
`capabilities` and `execute`, with optional `pivot` and `export` that default to plain
|
|
35
|
+
queries. `opengrid-server` holds its sources as `Arc<dyn Connector>` and has a builder —
|
|
36
|
+
`Server::builder().source(name, connector, policy).token(..).build().await` — so an
|
|
37
|
+
application hands in its own source without changing the server. The server still checks
|
|
38
|
+
the token, the allowed fields and the row filter before a connector sees a query.
|
|
39
|
+
PostgreSQL and the local engine are reference connectors. See
|
|
40
|
+
[Connectors](docs/guides/connectors.md).
|
|
41
|
+
- **Sources that only hand out rows** ([#46](https://github.com/casoon/opengrid/issues/46)).
|
|
42
|
+
`RowSource` (`schema`, `scan` in pieces) wrapped in `Rows` is a full connector: the engine
|
|
43
|
+
answers every query on the server. `max_scan_rows` (default 1 000 000) bounds the rows one
|
|
44
|
+
answer reads; over it the server answers `413 limit_exceeded`. `DataSourceError` has a new
|
|
45
|
+
variant `LimitExceeded`.
|
|
46
|
+
- **Conformance for connector authors** ([#47](https://github.com/casoon/opengrid/issues/47)).
|
|
47
|
+
`opengrid_conformance::check_source(&source)` runs every case against any source and returns
|
|
48
|
+
a `Report` (`assert_ok()` for tests); `suite_dir`, `fixture_schema`, `fixture_csv` say where
|
|
49
|
+
the fixture is. A `Connector` runs through `opengrid_connector::AsSource`.
|
|
50
|
+
- **The server protocol, and a runner that proves a server** ([#48](https://github.com/casoon/opengrid/issues/48)).
|
|
51
|
+
[`docs/protocol.md`](docs/protocol.md) describes what an opengrid server speaks — endpoints,
|
|
52
|
+
the query object, both result forms, errors, export — and the four duties of a server:
|
|
53
|
+
token, row filter, field allowlist, bounds. `opengrid-conformance --endpoint <url> --token <t>`
|
|
54
|
+
runs the whole suite over HTTP in both result forms against any server, in any language
|
|
55
|
+
(`check_endpoint` in the library).
|
|
56
|
+
- **The rows tier streams** ([#50](https://github.com/casoon/opengrid/issues/50)). A rows-only
|
|
57
|
+
source is read piece by piece and the server keeps only what the answer needs: top
|
|
58
|
+
`offset + limit` for a page, partial aggregates per group. 100 million generated rows answer
|
|
59
|
+
a page in 13 s with 75 MiB, a grouping in 16 s with 41 MiB (reading them into one table
|
|
60
|
+
first would take about 4.5 GiB). `max_scan_rows` now bounds the rows or groups an answer
|
|
61
|
+
holds, not the rows read; `Rows::compact_at` tunes how often held rows are cut back.
|
|
62
|
+
`Table::concat` in `opengrid-columns`.
|
|
63
|
+
- **SQLite as a reference connector** ([#51](https://github.com/casoon/opengrid/issues/51)).
|
|
64
|
+
`opengrid-connector-sqlite`: filter, sort, group, aggregate and paging answered by SQLite
|
|
65
|
+
itself; a file, no installation (`rusqlite`, SQLite compiled in). All conformance cases
|
|
66
|
+
pass, plus a differential test against the engine where SQLite's habits differ most (NaN in
|
|
67
|
+
sums and extremes, NaN and -0.0 as groups, decimal averages). `examples/server` has a
|
|
68
|
+
`demo-sqlite` preset.
|
|
69
|
+
- **Results travel in a binary form** ([#38](https://github.com/casoon/opengrid/issues/38)),
|
|
70
|
+
`application/vnd.opengrid.columns`: the engine's columns written out, decimals exact, no
|
|
71
|
+
text per cell. `Engine.execute_columns` and `Planner.finish_columns` answer it next to
|
|
72
|
+
the JSON methods; the worker hands it over without a copy; `opengrid-server` answers it
|
|
73
|
+
for `POST /query` and `POST /pivot` when `Accept` asks, JSON otherwise (with
|
|
74
|
+
`Vary: Accept`). The elements and `exportRows` read both forms. For 100 000 rows × 10
|
|
75
|
+
columns the engine answers in 18 ms instead of 124 ms and an element reads the answer in
|
|
76
|
+
13 ms instead of 76 ms; compressed, both forms are about the same size.
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- **No configuration file and no binary in `opengrid-server`** ([#49](https://github.com/casoon/opengrid/issues/49)).
|
|
81
|
+
Configuration is code: the builder (#45). `opengrid-server` no longer depends on a database
|
|
82
|
+
driver, the local engine or `toml`. `LocalConnector` (with `from_csv`) moved to
|
|
83
|
+
`opengrid-connector`; PostgreSQL stays a reference connector in
|
|
84
|
+
`opengrid-datasource-postgres`. `examples/server` is a program around the library with the
|
|
85
|
+
demo's sources (`demo`, `demo-postgres`) and the end-to-end suite's (`e2e`).
|
|
86
|
+
|
|
87
|
+
**What breaks:** `opengrid-server <config.toml>` is gone, and with it `Config`,
|
|
88
|
+
`Registry::build` and `opengrid_server::build`. Write the sources as code —
|
|
89
|
+
[Connectors](docs/guides/connectors.md) shows how; `examples/server/src/main.rs` has the
|
|
90
|
+
former demo configurations as functions.
|
|
91
|
+
|
|
92
|
+
- **The built-in providers answer bytes.** `createLocalProvider` and `createWorkerProvider`
|
|
93
|
+
answer the binary form; `createRestProvider` and `createPivotProvider` ask the server
|
|
94
|
+
for it and still take JSON from a server that answers JSON. A provider of your own may
|
|
95
|
+
keep answering JSON.
|
|
96
|
+
|
|
97
|
+
**What breaks:** a page that calls a built-in provider's `execute` itself and parses the
|
|
98
|
+
answer as JSON now gets a `Uint8Array`. Call `Engine.execute` for JSON, or hand the
|
|
99
|
+
answer to the element or `exportRows`, which read both.
|
|
100
|
+
|
|
101
|
+
- **The engine no longer uses Apache Arrow** ([#37](https://github.com/casoon/opengrid/issues/37)).
|
|
102
|
+
It keeps its data in `opengrid-columns` — typed columns of exactly the seven types of
|
|
103
|
+
the query model — and `opengrid-engine` replaces `opengrid-arrow-engine`, in the browser
|
|
104
|
+
and on the server. The engine module (`engine/opengrid_wasm_bg.wasm`) shrinks from
|
|
105
|
+
335 KiB to 118 KiB brotli (1.94 MB → 0.34 MB raw). Every conformance case answers as
|
|
106
|
+
before; an old-against-new differential test over random queries found no difference
|
|
107
|
+
before the old engine was removed. In the browser, grouping and aggregating got about
|
|
108
|
+
twice as fast and a sort window over sorted data too; a single-key sort is about 1.2×
|
|
109
|
+
slower, everything else within ±12 %.
|
|
110
|
+
|
|
111
|
+
**What breaks** (Rust crates only; the npm package and its JavaScript API are
|
|
112
|
+
unchanged): the crate `opengrid-arrow-engine` is now `opengrid-engine`. `load_csv` and
|
|
113
|
+
`load_json` return one `Table` instead of `Vec<RecordBatch>`, `JsonOptions` and
|
|
114
|
+
`CsvOptions::batch_size` are gone, `LocalDataSource::new` takes the table and cannot
|
|
115
|
+
fail, and `execute::QueryResult` carries a `table`. `opengrid-types` has no `arrow`
|
|
116
|
+
feature any more.
|
|
117
|
+
|
|
21
118
|
## [0.3.0] — 2026-09-27
|
|
22
119
|
|
|
23
120
|
**Screen-reader pairings tested: none yet** — unchanged since 0.1.0
|
package/README.md
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
# opengrid
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@casoon/opengrid)
|
|
4
|
+
[](#licence)
|
|
5
|
+
|
|
3
6
|
Accessible data grid, table and pivot as Web Components — driven by one query engine that
|
|
4
7
|
runs in the browser (WebAssembly), on a server (PostgreSQL), or split between the two, with
|
|
5
8
|
the same results everywhere.
|
|
6
9
|
|
|
10
|
+
<p>
|
|
11
|
+
<img src="https://raw.githubusercontent.com/casoon/opengrid/main/docs/assets/grid-base.png" alt="opengrid-grid in the Base look: search, + Filter, + Group, filter row and 5,000 orders" width="49%">
|
|
12
|
+
<img src="https://raw.githubusercontent.com/casoon/opengrid/main/docs/assets/grid-dark.png" alt="opengrid-grid in the Dark look, grouped by country with sums per group" width="49%">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
7
15
|
- **`<opengrid-grid>`** — sorting, filtering, search, facets, grouping with totals,
|
|
8
16
|
selection, editing, virtualized or paged; fully operable from the keyboard.
|
|
9
17
|
- **`<opengrid-table>`** — a plain semantic `<table>` for displaying data.
|
|
10
18
|
- **`<opengrid-pivot>`** — a pivot with subtotals and a grand total.
|
|
11
19
|
- **Export** — what the reader sees, every match of it, as CSV or JSON.
|
|
20
|
+
- **Five built-in looks** — `theme="paper"`, and your own `--og-*` properties on top.
|
|
21
|
+
|
|
22
|
+
## Live demos
|
|
23
|
+
|
|
24
|
+
The same 17 demos in every framework, each with its source, its data and options to change
|
|
25
|
+
live:
|
|
26
|
+
|
|
27
|
+
| [JavaScript](https://og-vanilla.casoon.dev) | [React](https://og-react.casoon.dev) | [Vue](https://og-vue.casoon.dev) | [Svelte](https://og-svelte.casoon.dev) | [Angular](https://og-angular.casoon.dev) |
|
|
28
|
+
| :-: | :-: | :-: | :-: | :-: |
|
|
29
|
+
|
|
30
|
+
Start with the [overview](https://og-vanilla.casoon.dev/overview), the
|
|
31
|
+
[grouping](https://og-vanilla.casoon.dev/grouping), the
|
|
32
|
+
[100,000 rows in a worker](https://og-vanilla.casoon.dev/large-data) or the
|
|
33
|
+
[looks](https://og-vanilla.casoon.dev/theming).
|
|
12
34
|
|
|
13
35
|
## Install
|
|
14
36
|
|
|
@@ -57,9 +79,11 @@ The engine reads a CSV against a schema — it never guesses types.
|
|
|
57
79
|
|
|
58
80
|
## Data from a server
|
|
59
81
|
|
|
60
|
-
`opengrid-server` answers the same queries
|
|
61
|
-
|
|
62
|
-
|
|
82
|
+
`opengrid-server` answers the same queries on a server — the browser sends a query object,
|
|
83
|
+
never SQL, and the server enforces tokens, a per-tenant row filter and a field allowlist. It
|
|
84
|
+
knows no database: your program hands it its sources as
|
|
85
|
+
[connectors](https://github.com/casoon/opengrid/blob/main/docs/guides/connectors.md), and
|
|
86
|
+
PostgreSQL is one reference among them.
|
|
63
87
|
|
|
64
88
|
```js
|
|
65
89
|
import { connect, createRestProvider } from "@casoon/opengrid";
|
|
@@ -89,6 +113,24 @@ import { OpengridGrid } from "@casoon/opengrid/react"; // or /vue, /svelte
|
|
|
89
113
|
Angular, Astro and server-rendered pages use `connect` directly —
|
|
90
114
|
[Frameworks](https://github.com/casoon/opengrid/blob/main/docs/guides/frameworks.md).
|
|
91
115
|
|
|
116
|
+
## Looks
|
|
117
|
+
|
|
118
|
+
A grid without any page CSS wears **Base**. `theme` picks another of the five built-in looks —
|
|
119
|
+
`base`, `paper`, `violet`, `orange`, `dark` — on all three elements:
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<opengrid-grid theme="dark" label="Orders" datasource="orders"></opengrid-grid>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
/* The page's own properties win over the look. */
|
|
127
|
+
opengrid-grid { --og-accent: #0f766e; --og-row-height: 36px; }
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The focus ring, the selection bar and the forced-colours palette stay what they are in every
|
|
131
|
+
look. The fonts are named, not loaded: a page that wants Geist or IBM Plex Sans hosts them.
|
|
132
|
+
See [Styling](https://github.com/casoon/opengrid/blob/main/docs/api.md#styling).
|
|
133
|
+
|
|
92
134
|
## Export
|
|
93
135
|
|
|
94
136
|
```js
|
|
@@ -19,6 +19,13 @@ export class Engine {
|
|
|
19
19
|
* `{ "name", "values" }` object per output column, in schema order.
|
|
20
20
|
*/
|
|
21
21
|
execute(query_json: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Runs a query JSON and answers with the result in the binary form
|
|
24
|
+
* (decision E35, `opengrid_columns::wire`): the same answer as
|
|
25
|
+
* [`execute`](Engine::execute_js), but as bytes a worker can hand over
|
|
26
|
+
* without copying and an element can read without parsing.
|
|
27
|
+
*/
|
|
28
|
+
execute_columns(query_json: string): Uint8Array;
|
|
22
29
|
/**
|
|
23
30
|
* Reads CSV bytes against an explicit schema and registers the source.
|
|
24
31
|
*
|
|
@@ -59,10 +66,15 @@ export class Planner {
|
|
|
59
66
|
* Runs `client_query_json` over `result_json` — the source's answer.
|
|
60
67
|
*
|
|
61
68
|
* This is the hybrid return path E14 names: the partial result becomes
|
|
62
|
-
*
|
|
69
|
+
* a table again and the engine finishes the query over them, which
|
|
63
70
|
* includes recounting `total_count` — filtering or grouping changed it.
|
|
64
71
|
*/
|
|
65
72
|
finish(client_query_json: string, result_json: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* [`finish`](Planner::finish) for a source that answered in the binary
|
|
75
|
+
* form: the bytes in, the finished result as bytes out.
|
|
76
|
+
*/
|
|
77
|
+
finish_columns(client_query_json: string, result: Uint8Array): Uint8Array;
|
|
66
78
|
/**
|
|
67
79
|
* A planner for a source with `schema_json` and `capabilities_json`, in
|
|
68
80
|
* `mode` (`local`, `remote`, `hybrid` or `auto`).
|
|
@@ -92,10 +104,12 @@ export interface InitOutput {
|
|
|
92
104
|
readonly __wbg_engine_free: (a: number, b: number) => void;
|
|
93
105
|
readonly __wbg_planner_free: (a: number, b: number) => void;
|
|
94
106
|
readonly engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
|
|
107
|
+
readonly engine_execute_columns: (a: number, b: number, c: number) => [number, number, number, number];
|
|
95
108
|
readonly engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
96
109
|
readonly engine_new: () => number;
|
|
97
110
|
readonly engine_source_names: (a: number) => [number, number];
|
|
98
111
|
readonly planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
112
|
+
readonly planner_finish_columns: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
99
113
|
readonly planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
100
114
|
readonly planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
101
115
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
package/engine/opengrid_wasm.js
CHANGED
|
@@ -47,6 +47,25 @@ export class Engine {
|
|
|
47
47
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Runs a query JSON and answers with the result in the binary form
|
|
52
|
+
* (decision E35, `opengrid_columns::wire`): the same answer as
|
|
53
|
+
* [`execute`](Engine::execute_js), but as bytes a worker can hand over
|
|
54
|
+
* without copying and an element can read without parsing.
|
|
55
|
+
* @param {string} query_json
|
|
56
|
+
* @returns {Uint8Array}
|
|
57
|
+
*/
|
|
58
|
+
execute_columns(query_json) {
|
|
59
|
+
const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
60
|
+
const len0 = WASM_VECTOR_LEN;
|
|
61
|
+
const ret = wasm.engine_execute_columns(this.__wbg_ptr, ptr0, len0);
|
|
62
|
+
if (ret[3]) {
|
|
63
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
64
|
+
}
|
|
65
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
66
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
67
|
+
return v2;
|
|
68
|
+
}
|
|
50
69
|
/**
|
|
51
70
|
* Reads CSV bytes against an explicit schema and registers the source.
|
|
52
71
|
*
|
|
@@ -121,7 +140,7 @@ export class Planner {
|
|
|
121
140
|
* Runs `client_query_json` over `result_json` — the source's answer.
|
|
122
141
|
*
|
|
123
142
|
* This is the hybrid return path E14 names: the partial result becomes
|
|
124
|
-
*
|
|
143
|
+
* a table again and the engine finishes the query over them, which
|
|
125
144
|
* includes recounting `total_count` — filtering or grouping changed it.
|
|
126
145
|
* @param {string} client_query_json
|
|
127
146
|
* @param {string} result_json
|
|
@@ -149,6 +168,26 @@ export class Planner {
|
|
|
149
168
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
150
169
|
}
|
|
151
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* [`finish`](Planner::finish) for a source that answered in the binary
|
|
173
|
+
* form: the bytes in, the finished result as bytes out.
|
|
174
|
+
* @param {string} client_query_json
|
|
175
|
+
* @param {Uint8Array} result
|
|
176
|
+
* @returns {Uint8Array}
|
|
177
|
+
*/
|
|
178
|
+
finish_columns(client_query_json, result) {
|
|
179
|
+
const ptr0 = passStringToWasm0(client_query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
180
|
+
const len0 = WASM_VECTOR_LEN;
|
|
181
|
+
const ptr1 = passArray8ToWasm0(result, wasm.__wbindgen_malloc);
|
|
182
|
+
const len1 = WASM_VECTOR_LEN;
|
|
183
|
+
const ret = wasm.planner_finish_columns(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
184
|
+
if (ret[3]) {
|
|
185
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
186
|
+
}
|
|
187
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
188
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
189
|
+
return v3;
|
|
190
|
+
}
|
|
152
191
|
/**
|
|
153
192
|
* A planner for a source with `schema_json` and `capabilities_json`, in
|
|
154
193
|
* `mode` (`local`, `remote`, `hybrid` or `auto`).
|
|
@@ -261,6 +300,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
261
300
|
return result;
|
|
262
301
|
}
|
|
263
302
|
|
|
303
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
304
|
+
ptr = ptr >>> 0;
|
|
305
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
306
|
+
}
|
|
307
|
+
|
|
264
308
|
let cachedDataViewMemory0 = null;
|
|
265
309
|
function getDataViewMemory0() {
|
|
266
310
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
Binary file
|
|
@@ -4,10 +4,12 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const __wbg_engine_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_planner_free: (a: number, b: number) => void;
|
|
6
6
|
export const engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
|
|
7
|
+
export const engine_execute_columns: (a: number, b: number, c: number) => [number, number, number, number];
|
|
7
8
|
export const engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
8
9
|
export const engine_new: () => number;
|
|
9
10
|
export const engine_source_names: (a: number) => [number, number];
|
|
10
11
|
export const planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
12
|
+
export const planner_finish_columns: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
11
13
|
export const planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
12
14
|
export const planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
13
15
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
package/loader.d.ts
CHANGED
|
@@ -126,15 +126,22 @@ export function connect(host: HTMLElement, options?: ConnectOptions): Connection
|
|
|
126
126
|
// Providers
|
|
127
127
|
// ---------------------------------------------------------------------------
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* What a provider's `execute` answers: the result as JSON, or the binary result
|
|
131
|
+
* form (`application/vnd.opengrid.columns`) as bytes. The elements and
|
|
132
|
+
* `exportRows` read both.
|
|
133
|
+
*/
|
|
134
|
+
export type Answer = string | Uint8Array | ArrayBuffer;
|
|
135
|
+
|
|
129
136
|
/**
|
|
130
137
|
* Where the data comes from. A seam, not a class: anything with an `execute`
|
|
131
138
|
* method fits. `queryJson` is the query as JSON; the answer is the result as
|
|
132
|
-
* JSON, or a Promise of it. `mode` is the element's
|
|
133
|
-
* without one. `options` is optional and new: a
|
|
134
|
-
* arguments still fits.
|
|
139
|
+
* JSON or in the binary form, or a Promise of it. `mode` is the element's
|
|
140
|
+
* `mode` attribute, `""` without one. `options` is optional and new: a
|
|
141
|
+
* provider written for two arguments still fits.
|
|
135
142
|
*/
|
|
136
143
|
export interface Provider {
|
|
137
|
-
execute(queryJson: string, mode: string, options?: ExecuteOptions):
|
|
144
|
+
execute(queryJson: string, mode: string, options?: ExecuteOptions): Answer | Promise<Answer>;
|
|
138
145
|
/**
|
|
139
146
|
* Optional: where the queries run. The grid names it in its footer, beside
|
|
140
147
|
* the number of queries asked for what is shown; the built-in providers set
|
|
@@ -169,7 +176,10 @@ export interface EngineProvider extends Provider {
|
|
|
169
176
|
/** The engine of the engine module, as `createLocalProvider` uses it. */
|
|
170
177
|
export interface Engine {
|
|
171
178
|
load_csv(name: string, bytes: Uint8Array, schema: string): void;
|
|
179
|
+
/** The result as JSON. */
|
|
172
180
|
execute(queryJson: string): string;
|
|
181
|
+
/** The result in the binary form — what the tab and worker providers answer. */
|
|
182
|
+
execute_columns(queryJson: string): Uint8Array;
|
|
173
183
|
}
|
|
174
184
|
|
|
175
185
|
/** What a server says a source is. */
|
|
@@ -198,6 +208,8 @@ export interface PlannerLike {
|
|
|
198
208
|
plan(queryJson: string, mode: string): string;
|
|
199
209
|
/** Finishes the client half over the source's answer; the result as JSON. */
|
|
200
210
|
finish(clientQueryJson: string, resultJson: string): string;
|
|
211
|
+
/** The same over an answer in the binary form; the result as bytes. */
|
|
212
|
+
finish_columns(clientQueryJson: string, result: Uint8Array): Uint8Array;
|
|
201
213
|
}
|
|
202
214
|
|
|
203
215
|
/** The plan `createHybridProvider` hands to `onPlan` before anything is sent. */
|
package/loader.js
CHANGED
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
* createLocalProvider(engine) engine on the main thread
|
|
22
22
|
* createRestProvider({ url, source, token }) opengrid-server über HTTP (point 27)
|
|
23
23
|
*
|
|
24
|
+
* A provider's `execute` answers the result JSON **or** the binary result form
|
|
25
|
+
* (decision E35, a `Uint8Array`): the elements and `exportRows` read both. The
|
|
26
|
+
* tab and worker providers answer bytes — the worker hands them over without a
|
|
27
|
+
* copy — and the REST providers ask the server for them and fall back to JSON
|
|
28
|
+
* when it answers JSON.
|
|
29
|
+
*
|
|
24
30
|
* Every provider's `execute(queryJson, mode, { signal })` may take an
|
|
25
31
|
* `AbortSignal` as its third argument (point 84). The providers that talk HTTP
|
|
26
32
|
* hand it to `fetch`, so an aborted export leaves no request running; the tab
|
|
@@ -198,7 +204,7 @@ export function createWorkerProvider({
|
|
|
198
204
|
await request({ type: "load", name, bytes: buffer, schema }, [buffer]);
|
|
199
205
|
},
|
|
200
206
|
|
|
201
|
-
/** Runs a query JSON and resolves with the result
|
|
207
|
+
/** Runs a query JSON and resolves with the result in the binary form. */
|
|
202
208
|
async execute(queryJson) {
|
|
203
209
|
await start();
|
|
204
210
|
return request({ type: "query", query: queryJson });
|
|
@@ -242,7 +248,7 @@ export function createLocalProvider(engine) {
|
|
|
242
248
|
);
|
|
243
249
|
},
|
|
244
250
|
execute(queryJson) {
|
|
245
|
-
return engine.
|
|
251
|
+
return engine.execute_columns(queryJson);
|
|
246
252
|
},
|
|
247
253
|
terminate() {},
|
|
248
254
|
};
|
|
@@ -275,10 +281,12 @@ export function createLocalProvider(engine) {
|
|
|
275
281
|
export function createRestProvider({ url, source, token } = {}) {
|
|
276
282
|
const base = String(url).replace(/\/$/, "");
|
|
277
283
|
const endpoint = `${base}/query/${encodeURIComponent(source)}`;
|
|
278
|
-
const headers = { "Content-Type": "application/json" };
|
|
284
|
+
const headers = { "Content-Type": "application/json", Accept: ACCEPT_ANSWER };
|
|
279
285
|
if (token) {
|
|
280
286
|
headers.Authorization = `Bearer ${token}`;
|
|
281
287
|
}
|
|
288
|
+
// The export answers a file, CSV or JSON, whatever a query would.
|
|
289
|
+
const { Accept: _answer, ...exportHeaders } = headers;
|
|
282
290
|
|
|
283
291
|
return {
|
|
284
292
|
/** Where the queries run; the grid names it in its footer (issue #33). */
|
|
@@ -310,11 +318,7 @@ export function createRestProvider({ url, source, token } = {}) {
|
|
|
310
318
|
signal,
|
|
311
319
|
redirect: "error",
|
|
312
320
|
});
|
|
313
|
-
|
|
314
|
-
if (response.ok) {
|
|
315
|
-
return text;
|
|
316
|
-
}
|
|
317
|
-
throw refusal(text, response.status);
|
|
321
|
+
return answerOf(response);
|
|
318
322
|
},
|
|
319
323
|
|
|
320
324
|
/**
|
|
@@ -353,7 +357,7 @@ export function createRestProvider({ url, source, token } = {}) {
|
|
|
353
357
|
}
|
|
354
358
|
const response = await fetch(`${base}/export/${encodeURIComponent(source)}?${parameters}`, {
|
|
355
359
|
method: "POST",
|
|
356
|
-
headers,
|
|
360
|
+
headers: exportHeaders,
|
|
357
361
|
body: JSON.stringify(query),
|
|
358
362
|
signal,
|
|
359
363
|
redirect: "error",
|
|
@@ -388,6 +392,29 @@ export function createRestProvider({ url, source, token } = {}) {
|
|
|
388
392
|
};
|
|
389
393
|
}
|
|
390
394
|
|
|
395
|
+
/**
|
|
396
|
+
* What a provider asks the server for: the binary result form (E35), JSON as
|
|
397
|
+
* the fallback — a server that does not know the form answers JSON, and
|
|
398
|
+
* `answerOf` takes that too.
|
|
399
|
+
*/
|
|
400
|
+
const COLUMNS_TYPE = "application/vnd.opengrid.columns";
|
|
401
|
+
const ACCEPT_ANSWER = `${COLUMNS_TYPE}, application/json;q=0.9`;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* A response as a provider's answer: the bytes of the binary form, the result
|
|
405
|
+
* JSON otherwise, the server's refusal as an `Error`.
|
|
406
|
+
*/
|
|
407
|
+
async function answerOf(response) {
|
|
408
|
+
if (!response.ok) {
|
|
409
|
+
throw refusal(await response.text(), response.status);
|
|
410
|
+
}
|
|
411
|
+
const type = response.headers.get("Content-Type") ?? "";
|
|
412
|
+
if (type.split(";")[0].trim().toLowerCase() === COLUMNS_TYPE) {
|
|
413
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
414
|
+
}
|
|
415
|
+
return response.text();
|
|
416
|
+
}
|
|
417
|
+
|
|
391
418
|
/**
|
|
392
419
|
* A failed request as the `Error` it rejects with (issue #16). The message is
|
|
393
420
|
* the server's own sentence, or the status when the body is not the error
|
|
@@ -446,7 +473,7 @@ function coded(code, message) {
|
|
|
446
473
|
*/
|
|
447
474
|
export function createPivotProvider({ url, source, token } = {}) {
|
|
448
475
|
const endpoint = `${String(url).replace(/\/$/, "")}/pivot/${encodeURIComponent(source)}`;
|
|
449
|
-
const headers = { "Content-Type": "application/json" };
|
|
476
|
+
const headers = { "Content-Type": "application/json", Accept: ACCEPT_ANSWER };
|
|
450
477
|
if (token) {
|
|
451
478
|
headers.Authorization = `Bearer ${token}`;
|
|
452
479
|
}
|
|
@@ -462,11 +489,7 @@ export function createPivotProvider({ url, source, token } = {}) {
|
|
|
462
489
|
signal,
|
|
463
490
|
redirect: "error",
|
|
464
491
|
});
|
|
465
|
-
|
|
466
|
-
if (response.ok) {
|
|
467
|
-
return text;
|
|
468
|
-
}
|
|
469
|
-
throw refusal(text, response.status);
|
|
492
|
+
return answerOf(response);
|
|
470
493
|
},
|
|
471
494
|
};
|
|
472
495
|
}
|
|
@@ -517,7 +540,10 @@ export function createHybridProvider({ remote, planner, mode = "auto", onPlan }
|
|
|
517
540
|
if (!plan.client) {
|
|
518
541
|
return partial;
|
|
519
542
|
}
|
|
520
|
-
|
|
543
|
+
// The engine finishes in the form the source answered in.
|
|
544
|
+
return typeof partial === "string"
|
|
545
|
+
? planner.finish(JSON.stringify(plan.client), partial)
|
|
546
|
+
: planner.finish_columns(JSON.stringify(plan.client), partial);
|
|
521
547
|
},
|
|
522
548
|
};
|
|
523
549
|
}
|
|
@@ -688,8 +714,8 @@ export async function exportRows(provider, query, options = {}) {
|
|
|
688
714
|
const limit = total === undefined ? chunkSize : Math.min(chunkSize, total - rows);
|
|
689
715
|
const piece = JSON.stringify({ ...query, sort, offset: rows, limit });
|
|
690
716
|
const answer = await unlessAborted(ask(provider, piece, signal), signal);
|
|
691
|
-
const result =
|
|
692
|
-
const count = result.
|
|
717
|
+
const result = countsOf(answer);
|
|
718
|
+
const count = result.rows;
|
|
693
719
|
const first = total === undefined;
|
|
694
720
|
if (first) {
|
|
695
721
|
total = result.total_count;
|
|
@@ -732,6 +758,28 @@ export async function exportRows(provider, query, options = {}) {
|
|
|
732
758
|
});
|
|
733
759
|
}
|
|
734
760
|
|
|
761
|
+
/**
|
|
762
|
+
* `total_count` and the rows of an answer, whichever form it came in: from the
|
|
763
|
+
* JSON, or from the header of the binary form (E35) — `total_count` at byte 8,
|
|
764
|
+
* the row count at byte 16, both little-endian `u64`.
|
|
765
|
+
*/
|
|
766
|
+
function countsOf(answer) {
|
|
767
|
+
if (typeof answer === "string") {
|
|
768
|
+
const result = JSON.parse(answer);
|
|
769
|
+
return { total_count: result.total_count, rows: result.columns[0]?.values.length ?? 0 };
|
|
770
|
+
}
|
|
771
|
+
const bytes = answer instanceof ArrayBuffer ? new Uint8Array(answer) : answer;
|
|
772
|
+
if (bytes.byteLength < 24) {
|
|
773
|
+
throw new TypeError("exportRows: the provider answered neither JSON nor the binary form");
|
|
774
|
+
}
|
|
775
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
776
|
+
const columns = view.getUint32(24, true);
|
|
777
|
+
return {
|
|
778
|
+
total_count: Number(view.getBigUint64(8, true)),
|
|
779
|
+
rows: columns === 0 ? 0 : Number(view.getBigUint64(16, true)),
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
|
|
735
783
|
/** One piece from the provider; a synchronous throw becomes a rejection. */
|
|
736
784
|
async function ask(provider, queryJson, signal) {
|
|
737
785
|
return provider.execute(queryJson, "", { signal });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casoon/opengrid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Accessible data grid, table and pivot as web components, driven by a portable Rust/WASM query engine — with React, Vue and Svelte components.",
|
|
6
6
|
"keywords": [
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* mark) first. `options`: `{ delimiter, bom, protectFormulas, null }`, each
|
|
7
7
|
* optional (docs/guides/export.md, point 87).
|
|
8
8
|
*/
|
|
9
|
-
export function export_csv(
|
|
9
|
+
export function export_csv(answer: any, options: any, header: boolean): string;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* One piece of a JSON array: the rows as objects, joined by commas. `first`:
|
|
13
13
|
* no row has been written yet (not "the first piece" — after an empty first
|
|
14
14
|
* piece it is still true), so no comma leads. `loader.js` writes the brackets.
|
|
15
15
|
*/
|
|
16
|
-
export function export_json(
|
|
16
|
+
export function export_json(answer: any, first: boolean): string;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The pivot as it is shown, as CSV (issue #3).
|
|
@@ -169,8 +169,8 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
169
169
|
|
|
170
170
|
export interface InitOutput {
|
|
171
171
|
readonly memory: WebAssembly.Memory;
|
|
172
|
-
readonly export_csv: (a:
|
|
173
|
-
readonly export_json: (a:
|
|
172
|
+
readonly export_csv: (a: any, b: any, c: number) => [number, number, number, number];
|
|
173
|
+
readonly export_json: (a: any, b: number) => [number, number, number, number];
|
|
174
174
|
readonly get_pivot: (a: any, b: any) => [number, number, number];
|
|
175
175
|
readonly get_query: (a: any) => any;
|
|
176
176
|
readonly get_view: (a: any) => any;
|
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
/* @ts-self-types="./opengrid_web_components.d.ts" */
|
|
2
|
-
import { __opengrid_define_element } from './snippets/opengrid-web-core-
|
|
3
|
-
import * as import1 from "./snippets/opengrid-web-core-
|
|
4
|
-
import * as import2 from "./snippets/opengrid-web-core-
|
|
5
|
-
import * as import3 from "./snippets/opengrid-web-core-
|
|
2
|
+
import { __opengrid_define_element } from './snippets/opengrid-web-core-cf7d8c1a6d317e41/inline1.js';
|
|
3
|
+
import * as import1 from "./snippets/opengrid-web-core-cf7d8c1a6d317e41/inline0.js"
|
|
4
|
+
import * as import2 from "./snippets/opengrid-web-core-cf7d8c1a6d317e41/inline0.js"
|
|
5
|
+
import * as import3 from "./snippets/opengrid-web-core-cf7d8c1a6d317e41/inline0.js"
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* One piece of a CSV: with `header`, the header line (and the byte order
|
|
10
10
|
* mark) first. `options`: `{ delimiter, bom, protectFormulas, null }`, each
|
|
11
11
|
* optional (docs/guides/export.md, point 87).
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {any} answer
|
|
13
13
|
* @param {any} options
|
|
14
14
|
* @param {boolean} header
|
|
15
15
|
* @returns {string}
|
|
16
16
|
*/
|
|
17
|
-
export function export_csv(
|
|
18
|
-
let
|
|
19
|
-
let
|
|
17
|
+
export function export_csv(answer, options, header) {
|
|
18
|
+
let deferred2_0;
|
|
19
|
+
let deferred2_1;
|
|
20
20
|
try {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var ptr2 = ret[0];
|
|
25
|
-
var len2 = ret[1];
|
|
21
|
+
const ret = wasm.export_csv(answer, options, header);
|
|
22
|
+
var ptr1 = ret[0];
|
|
23
|
+
var len1 = ret[1];
|
|
26
24
|
if (ret[3]) {
|
|
27
|
-
|
|
25
|
+
ptr1 = 0; len1 = 0;
|
|
28
26
|
throw takeFromExternrefTable0(ret[2]);
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return getStringFromWasm0(
|
|
28
|
+
deferred2_0 = ptr1;
|
|
29
|
+
deferred2_1 = len1;
|
|
30
|
+
return getStringFromWasm0(ptr1, len1);
|
|
33
31
|
} finally {
|
|
34
|
-
wasm.__wbindgen_free(
|
|
32
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
|
|
@@ -39,28 +37,26 @@ export function export_csv(result_json, options, header) {
|
|
|
39
37
|
* One piece of a JSON array: the rows as objects, joined by commas. `first`:
|
|
40
38
|
* no row has been written yet (not "the first piece" — after an empty first
|
|
41
39
|
* piece it is still true), so no comma leads. `loader.js` writes the brackets.
|
|
42
|
-
* @param {
|
|
40
|
+
* @param {any} answer
|
|
43
41
|
* @param {boolean} first
|
|
44
42
|
* @returns {string}
|
|
45
43
|
*/
|
|
46
|
-
export function export_json(
|
|
47
|
-
let
|
|
48
|
-
let
|
|
44
|
+
export function export_json(answer, first) {
|
|
45
|
+
let deferred2_0;
|
|
46
|
+
let deferred2_1;
|
|
49
47
|
try {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var ptr2 = ret[0];
|
|
54
|
-
var len2 = ret[1];
|
|
48
|
+
const ret = wasm.export_json(answer, first);
|
|
49
|
+
var ptr1 = ret[0];
|
|
50
|
+
var len1 = ret[1];
|
|
55
51
|
if (ret[3]) {
|
|
56
|
-
|
|
52
|
+
ptr1 = 0; len1 = 0;
|
|
57
53
|
throw takeFromExternrefTable0(ret[2]);
|
|
58
54
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return getStringFromWasm0(
|
|
55
|
+
deferred2_0 = ptr1;
|
|
56
|
+
deferred2_1 = len1;
|
|
57
|
+
return getStringFromWasm0(ptr1, len1);
|
|
62
58
|
} finally {
|
|
63
|
-
wasm.__wbindgen_free(
|
|
59
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
|
|
@@ -270,7 +266,7 @@ function __wbg_get_imports() {
|
|
|
270
266
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
271
267
|
return ret;
|
|
272
268
|
},
|
|
273
|
-
|
|
269
|
+
__wbg___opengrid_define_element_9fe4767b320e082c: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
274
270
|
__opengrid_define_element(getStringFromWasm0(arg0, arg1), arg2, arg3, arg4, arg5);
|
|
275
271
|
},
|
|
276
272
|
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
@@ -471,6 +467,16 @@ function __wbg_get_imports() {
|
|
|
471
467
|
const ret = arg0.innerWidth;
|
|
472
468
|
return ret;
|
|
473
469
|
}, arguments); },
|
|
470
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
471
|
+
let result;
|
|
472
|
+
try {
|
|
473
|
+
result = arg0 instanceof ArrayBuffer;
|
|
474
|
+
} catch (_) {
|
|
475
|
+
result = false;
|
|
476
|
+
}
|
|
477
|
+
const ret = result;
|
|
478
|
+
return ret;
|
|
479
|
+
},
|
|
474
480
|
__wbg_instanceof_Element_beebfaab75d12d9d: function(arg0) {
|
|
475
481
|
let result;
|
|
476
482
|
try {
|
|
@@ -541,6 +547,16 @@ function __wbg_get_imports() {
|
|
|
541
547
|
const ret = result;
|
|
542
548
|
return ret;
|
|
543
549
|
},
|
|
550
|
+
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
|
|
551
|
+
let result;
|
|
552
|
+
try {
|
|
553
|
+
result = arg0 instanceof Uint8Array;
|
|
554
|
+
} catch (_) {
|
|
555
|
+
result = false;
|
|
556
|
+
}
|
|
557
|
+
const ret = result;
|
|
558
|
+
return ret;
|
|
559
|
+
},
|
|
544
560
|
__wbg_instanceof_Window_05ba1ee4f6781663: function(arg0) {
|
|
545
561
|
let result;
|
|
546
562
|
try {
|
|
@@ -586,6 +602,10 @@ function __wbg_get_imports() {
|
|
|
586
602
|
const ret = arg0.left;
|
|
587
603
|
return ret;
|
|
588
604
|
},
|
|
605
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
606
|
+
const ret = arg0.length;
|
|
607
|
+
return ret;
|
|
608
|
+
},
|
|
589
609
|
__wbg_length_370319915dc99107: function(arg0) {
|
|
590
610
|
const ret = arg0.length;
|
|
591
611
|
return ret;
|
|
@@ -606,6 +626,10 @@ function __wbg_get_imports() {
|
|
|
606
626
|
const ret = new Array();
|
|
607
627
|
return ret;
|
|
608
628
|
},
|
|
629
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
630
|
+
const ret = new Uint8Array(arg0);
|
|
631
|
+
return ret;
|
|
632
|
+
},
|
|
609
633
|
__wbg_new_da52cf8fe3429cb2: function() {
|
|
610
634
|
const ret = new Object();
|
|
611
635
|
return ret;
|
|
@@ -637,6 +661,9 @@ function __wbg_get_imports() {
|
|
|
637
661
|
__wbg_preventDefault_b64888c857500682: function(arg0) {
|
|
638
662
|
arg0.preventDefault();
|
|
639
663
|
},
|
|
664
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
665
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
666
|
+
},
|
|
640
667
|
__wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
|
|
641
668
|
const ret = arg0.push(arg1);
|
|
642
669
|
return ret;
|
|
@@ -856,7 +883,7 @@ function __wbg_get_imports() {
|
|
|
856
883
|
return ret;
|
|
857
884
|
},
|
|
858
885
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
859
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
886
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 201, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
860
887
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bindgen_66404d18cc2edcc2___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_66404d18cc2edcc2___JsError___true_);
|
|
861
888
|
return ret;
|
|
862
889
|
},
|
|
@@ -881,7 +908,7 @@ function __wbg_get_imports() {
|
|
|
881
908
|
return ret;
|
|
882
909
|
},
|
|
883
910
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
884
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx:
|
|
911
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 188, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
885
912
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_);
|
|
886
913
|
return ret;
|
|
887
914
|
},
|
|
@@ -913,9 +940,9 @@ function __wbg_get_imports() {
|
|
|
913
940
|
return {
|
|
914
941
|
__proto__: null,
|
|
915
942
|
"./opengrid_web_components_bg.js": import0,
|
|
916
|
-
"./snippets/opengrid-web-core-
|
|
917
|
-
"./snippets/opengrid-web-core-
|
|
918
|
-
"./snippets/opengrid-web-core-
|
|
943
|
+
"./snippets/opengrid-web-core-cf7d8c1a6d317e41/inline0.js": import1,
|
|
944
|
+
"./snippets/opengrid-web-core-cf7d8c1a6d317e41/inline0.js": import2,
|
|
945
|
+
"./snippets/opengrid-web-core-cf7d8c1a6d317e41/inline0.js": import3,
|
|
919
946
|
};
|
|
920
947
|
}
|
|
921
948
|
|
|
@@ -1037,6 +1064,11 @@ function debugString(val) {
|
|
|
1037
1064
|
return className;
|
|
1038
1065
|
}
|
|
1039
1066
|
|
|
1067
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1068
|
+
ptr = ptr >>> 0;
|
|
1069
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1040
1072
|
let cachedDataViewMemory0 = null;
|
|
1041
1073
|
function getDataViewMemory0() {
|
|
1042
1074
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const export_csv: (a:
|
|
5
|
-
export const export_json: (a:
|
|
4
|
+
export const export_csv: (a: any, b: any, c: number) => [number, number, number, number];
|
|
5
|
+
export const export_json: (a: any, b: number) => [number, number, number, number];
|
|
6
6
|
export const get_pivot: (a: any, b: any) => [number, number, number];
|
|
7
7
|
export const get_query: (a: any) => any;
|
|
8
8
|
export const get_view: (a: any) => any;
|
package/worker.js
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* query { type:"query", id, query } -> { id, result }
|
|
16
16
|
*
|
|
17
17
|
* Any request that throws answers `{ id, type:"error", message }`. The `bytes`
|
|
18
|
-
* of `load` arrive as a transferable `ArrayBuffer`;
|
|
19
|
-
*
|
|
20
|
-
* here.
|
|
18
|
+
* of `load` arrive as a transferable `ArrayBuffer`; a `result` is the engine's
|
|
19
|
+
* binary result form (E35, `execute_columns`) and travels back the same way —
|
|
20
|
+
* transferred, not copied. Nothing engine-specific is serialised here.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/** The single engine instance, created on `init` and reused for every query. */
|
|
@@ -41,7 +41,8 @@ self.onmessage = async ({ data }) => {
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
case "query": {
|
|
44
|
-
|
|
44
|
+
const result = engine.execute_columns(data.query);
|
|
45
|
+
self.postMessage({ id: data.id, result }, [result.buffer]);
|
|
45
46
|
break;
|
|
46
47
|
}
|
|
47
48
|
default:
|
|
File without changes
|
|
File without changes
|