laterite 0.1.0 → 0.5.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/README.md +8 -8
- package/dist/index.cjs +23527 -6676
- package/dist/index.d.mts +2623 -216
- package/dist/index.d.ts +2623 -216
- package/dist/index.mjs +23438 -6669
- package/index.d.ts +59 -10
- package/index.js +3 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ One clean-room Rust AGS4 engine, surfaced for every stack:
|
|
|
18
18
|
|---|---|---|
|
|
19
19
|
| **Python** | [`laterite`](https://pypi.org/project/laterite/) — PyPI | `pip install laterite` |
|
|
20
20
|
| **Node.js** | [`laterite`](https://www.npmjs.com/package/laterite) — npm | `npm install laterite` |
|
|
21
|
-
| **Rust / CLI** | [`
|
|
21
|
+
| **Rust / CLI** | [`lat-db` + `lat-check`](https://github.com/niko86/laterite/releases) | GitHub Releases |
|
|
22
22
|
| **Browser** | [validator + data explorer](https://niko86.github.io/laterite/) — WASM | open in a browser |
|
|
23
23
|
|
|
24
24
|
## Read & validate
|
|
@@ -26,7 +26,7 @@ One clean-room Rust AGS4 engine, surfaced for every stack:
|
|
|
26
26
|
```ts
|
|
27
27
|
import { read, validate } from "laterite";
|
|
28
28
|
|
|
29
|
-
const ags = read("delivery.ags"); // or read(undefined, { text })
|
|
29
|
+
const ags = read("delivery.ags"); // path, or read(bytes) / read(undefined, { text })
|
|
30
30
|
ags.groups; // ["PROJ", "LOCA", "SAMP", …]
|
|
31
31
|
const loca = ags.table("LOCA"); // a born-typed apache-arrow Table
|
|
32
32
|
loca.getChild("LOCA_GL")?.get(0); // → 12.3 (a number)
|
|
@@ -34,7 +34,7 @@ loca.getChild("LOCA_GL")?.get(0); // → 12.3 (a number)
|
|
|
34
34
|
const report = validate("delivery.ags");
|
|
35
35
|
report.isValid; // boolean
|
|
36
36
|
report.findings; // [{ rule, line?, group, desc, severity? }]
|
|
37
|
-
report.toJson(); // byte-identical to `
|
|
37
|
+
report.toJson(); // byte-identical to `lat-check --json`
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Produce AGS4
|
|
@@ -42,28 +42,28 @@ report.toJson(); // byte-identical to `ags4-check --jso
|
|
|
42
42
|
From per-group data (arrow-js Tables or plain row objects):
|
|
43
43
|
|
|
44
44
|
```ts
|
|
45
|
-
import {
|
|
45
|
+
import { buildAgs4 } from "laterite";
|
|
46
46
|
|
|
47
|
-
const res =
|
|
47
|
+
const res = buildAgs4(new Map([
|
|
48
48
|
["PROJ", [{ PROJ_ID: "P1", PROJ_NAME: "Demo" }]],
|
|
49
49
|
["LOCA", [{ LOCA_ID: "BH01", LOCA_GL: 12.3 }]],
|
|
50
50
|
]), { edition: "4.1.1", mode: "autofix" });
|
|
51
51
|
|
|
52
52
|
res.text; // the AGS4 document
|
|
53
|
-
res.
|
|
53
|
+
res.save("out.ags");
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
…or from a **typed builder graph** (`import { PROJ, LOCA } from "laterite"`):
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
|
-
import { PROJ, LOCA,
|
|
59
|
+
import { PROJ, LOCA, buildAgs4 } from "laterite";
|
|
60
60
|
|
|
61
61
|
const proj = new PROJ({
|
|
62
62
|
PROJ_ID: "P1",
|
|
63
63
|
PROJ_NAME: "Demo",
|
|
64
64
|
locas: [new LOCA({ LOCA_ID: "BH01", LOCA_GL: 12.3 })],
|
|
65
65
|
});
|
|
66
|
-
|
|
66
|
+
buildAgs4(proj); // walks the tree → valid AGS4
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
## SQL across groups (optional)
|