vastgrid-js 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +211 -2
- package/dist/aggregate.d.ts +45 -0
- package/dist/aggregate.d.ts.map +1 -0
- package/dist/aggregate.js +305 -0
- package/dist/aggregate.js.map +1 -0
- package/dist/arrow.d.ts +7 -0
- package/dist/arrow.d.ts.map +1 -0
- package/dist/arrow.js +25 -0
- package/dist/arrow.js.map +1 -0
- package/dist/engine.d.ts +40 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +1022 -0
- package/dist/engine.js.map +1 -0
- package/dist/evaluate.d.ts +37 -0
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +774 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/export.d.ts +23 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +48 -0
- package/dist/export.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lazy.d.ts +65 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +177 -0
- package/dist/lazy.js.map +1 -0
- package/dist/numbers.d.ts +20 -0
- package/dist/numbers.d.ts.map +1 -0
- package/dist/numbers.js +129 -0
- package/dist/numbers.js.map +1 -0
- package/dist/order.d.ts +67 -0
- package/dist/order.d.ts.map +1 -0
- package/dist/order.js +561 -0
- package/dist/order.js.map +1 -0
- package/dist/parquet.d.ts +38 -0
- package/dist/parquet.d.ts.map +1 -0
- package/dist/parquet.js +673 -0
- package/dist/parquet.js.map +1 -0
- package/dist/plan.d.ts +37 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +51 -0
- package/dist/plan.js.map +1 -0
- package/dist/summary.d.ts +37 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +175 -0
- package/dist/summary.js.map +1 -0
- package/dist/table.d.ts +172 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +154 -0
- package/dist/table.js.map +1 -0
- package/dist/text.d.ts +18 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +1204 -0
- package/dist/text.js.map +1 -0
- package/dist/workbook.d.ts +6 -0
- package/dist/workbook.d.ts.map +1 -0
- package/dist/workbook.js +35 -0
- package/dist/workbook.js.map +1 -0
- package/package.json +46 -4
- package/src/aggregate.ts +358 -0
- package/src/arrow.ts +24 -0
- package/src/engine.ts +1163 -0
- package/src/evaluate.ts +764 -0
- package/src/export.ts +73 -0
- package/src/index.ts +2 -0
- package/src/lazy.ts +185 -0
- package/src/numbers.ts +128 -0
- package/src/order.ts +594 -0
- package/src/parquet.ts +801 -0
- package/src/plan.ts +99 -0
- package/src/summary.ts +180 -0
- package/src/table.ts +297 -0
- package/src/text.ts +1285 -0
- package/src/workbook.ts +48 -0
package/dist/arrow.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tables given as Arrow (docs/spec.md §2.3), read by a module of their own that the engine loads with the
|
|
3
|
+
* first such table, so that pages whose tables are rows do not load it.
|
|
4
|
+
*/
|
|
5
|
+
import { decodeColumns } from "vastgrid-spec/columns";
|
|
6
|
+
import { checkNames, TableProblem } from "./table.js";
|
|
7
|
+
/**
|
|
8
|
+
* Checks a table given as Arrow and reads its columns: their logical types, and their values kept as Arrow holds
|
|
9
|
+
* them. Throws a `TableProblem` at `/arrow` for bytes that are not an Arrow table of §2.3.
|
|
10
|
+
*/
|
|
11
|
+
export function checkArrow(bytes) {
|
|
12
|
+
if (!(bytes instanceof Uint8Array)) {
|
|
13
|
+
throw new TableProblem("/arrow", "arrow is the bytes of an Arrow IPC stream or file, in a Uint8Array.");
|
|
14
|
+
}
|
|
15
|
+
let decoded;
|
|
16
|
+
try {
|
|
17
|
+
decoded = decodeColumns(bytes);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw new TableProblem("/arrow", `The bytes are not an Arrow table of §2.3: ${error.message}`);
|
|
21
|
+
}
|
|
22
|
+
checkNames(decoded.columns, () => "/arrow");
|
|
23
|
+
return { columns: decoded.columns, rows: null, vectors: decoded.values, rowCount: decoded.length };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=arrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow.js","sourceRoot":"","sources":["../src/arrow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAqB,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEzE;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,YAAY,CAAC,QAAQ,EAAE,qEAAqE,CAAC,CAAC;IAC1G,CAAC;IACD,IAAI,OAAyC,CAAC;IAC9C,IAAI,CAAC;QACH,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,YAAY,CAAC,QAAQ,EAAE,6CAA8C,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5G,CAAC;IACD,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AACrG,CAAC"}
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An engine over tables in memory (docs/spec.md §8): it answers the requests of §8.2 about tables that
|
|
3
|
+
* its host gives it as arrays of typed JSON values (§2.2), as Arrow, as text files or as Parquet files, with views in
|
|
4
|
+
* the order of §3.3.
|
|
5
|
+
*/
|
|
6
|
+
import { type Capabilities } from "vastgrid-spec";
|
|
7
|
+
import { type ArrowTable, type FileTable, type MemoryTable, type ParquetTable } from "./table.js";
|
|
8
|
+
/** A table that a host gives the engine: rows of typed JSON, Arrow, a text file or a Parquet file. */
|
|
9
|
+
type HostTable = MemoryTable | ArrowTable | FileTable | ParquetTable;
|
|
10
|
+
export interface MemoryEngineOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The tables that `open` opens, by the `ref` that names them: rows of typed JSON, Arrow, text files or Parquet
|
|
13
|
+
* files.
|
|
14
|
+
*/
|
|
15
|
+
tables: Record<string, HostTable>;
|
|
16
|
+
}
|
|
17
|
+
export interface MemoryEngine {
|
|
18
|
+
/**
|
|
19
|
+
* Answers a request (§8.1) with its response or error, with blocks in the structured encoding (§8.8);
|
|
20
|
+
* `cancel` has no answer. Never throws: a message that does not follow §8 is answered with
|
|
21
|
+
* `invalid_request`.
|
|
22
|
+
*/
|
|
23
|
+
handle(message: unknown): Promise<Record<string, unknown> | undefined>;
|
|
24
|
+
/** Listens to the events of §8.5, until the function it gives is called. This engine sends none yet. */
|
|
25
|
+
subscribe(listener: (event: Record<string, unknown>) => void): () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What the engine evaluates (§4.10): every plan of §4.1, with every function of §4.4 and every measure of §4.5;
|
|
29
|
+
* `summarize`, `find`, `locate` and `export` of CSV, TSV, JSON and xlsx as data.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MEMORY_CAPABILITIES: Readonly<Capabilities>;
|
|
32
|
+
/**
|
|
33
|
+
* An engine over tables in memory. The host gives the tables by the `ref` that `open` takes; the engine checks
|
|
34
|
+
* the form of a table against §2 when it is first opened, and its values as it reads them (a column whole before
|
|
35
|
+
* it sorts or sums it), answering `load_failed` with the JSON Pointer of a value that does not follow §2.2. It
|
|
36
|
+
* reads the rows as they are, without copying them, so they must not change afterwards.
|
|
37
|
+
*/
|
|
38
|
+
export declare function memoryEngine(options: MemoryEngineOptions): MemoryEngine;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEL,KAAK,YAAY,EAsBlB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,KAAK,UAAU,EAGf,KAAK,SAAS,EAMd,KAAK,WAAW,EAChB,KAAK,YAAY,EAOlB,MAAM,YAAY,CAAC;AAEpB,sGAAsG;AACtG,KAAK,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAErE,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;IACvE,wGAAwG;IACxG,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC3E;AAKD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,YAAY,CAqBrD,CAAC;AA2hCH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAEvE"}
|