rastack 0.0.43 → 0.0.45
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 +14 -0
- package/admin/AdminApp.tsx +461 -0
- package/admin/adapters.ts +346 -0
- package/admin/httpEngine.ts +56 -0
- package/admin/index.tsx +140 -0
- package/admin/ui/FilterBar.tsx +231 -0
- package/admin/ui/Popover.tsx +54 -0
- package/admin/ui/Sidebar.tsx +86 -0
- package/admin/ui/icons.tsx +146 -0
- package/admin/ui/styles.ts +398 -0
- package/admin/useAdmin.ts +434 -0
- package/dist/admin.js +459 -0
- package/dist/dev/harness.d.ts +70 -0
- package/dist/dev/harness.js +189 -0
- package/dist/rastack-admin.d.ts +14 -0
- package/dist/rastack-admin.js +128 -0
- package/dist/rastack-dev.d.ts +18 -0
- package/dist/rastack-dev.js +197 -0
- package/dist/rastack-wasm-build.d.ts +9 -4
- package/dist/rastack-wasm-build.js +44 -33
- package/dist/rastack.d.ts +2 -3
- package/dist/rastack.js +13 -32
- package/dist/wasm/package.json +4 -0
- package/dist/wasm/rastack_wasm.d.ts +100 -0
- package/dist/wasm/rastack_wasm.js +745 -0
- package/dist/wasm/rastack_wasm_bg.wasm +0 -0
- package/dist/wasm/rastack_wasm_bg.wasm.d.ts +28 -0
- package/package.json +6 -2
- package/scripts/build-admin.js +48 -0
- package/scripts/copy-wasm.js +35 -0
- package/src/dev/harness.ts +174 -0
- package/src/rastack-admin.ts +112 -0
- package/src/rastack-dev.ts +197 -0
- package/src/rastack-wasm-build.ts +52 -41
- package/src/rastack.ts +14 -37
- package/test/dev.spec.ts +373 -0
- package/wasm/package.json +4 -0
- package/wasm/rastack_wasm.d.ts +100 -0
- package/wasm/rastack_wasm.js +745 -0
- package/wasm/rastack_wasm_bg.wasm +0 -0
- package/wasm/rastack_wasm_bg.wasm.d.ts +28 -0
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Compile the Rust API to WebAssembly for in-browser local dev — the engine
|
|
5
|
+
* `rastack dev` serves and `<RAStackProvider mode="local">` loads.
|
|
5
6
|
*
|
|
6
7
|
* Pipeline:
|
|
7
8
|
* 1. cargo build -p rastack-wasm --release --target wasm32-unknown-unknown
|
|
8
|
-
* 2. wasm-bindgen --target web →
|
|
9
|
+
* 2. wasm-bindgen --target web → tools/wasm/rastack_wasm.js + rastack_wasm_bg.wasm
|
|
9
10
|
* 3. wasm-opt -Oz (if available) to shrink the binary
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
+
* This is invoked by the release CI (to bundle a prebuilt engine into the npm
|
|
13
|
+
* package) and by `rastack dev` as a from-source fallback when no prebuilt
|
|
14
|
+
* bundle is present but the toolchain is. Prereqs:
|
|
12
15
|
* rustup target add wasm32-unknown-unknown
|
|
13
16
|
* cargo install wasm-bindgen-cli (version must match the wasm-bindgen crate)
|
|
14
17
|
*/
|
|
@@ -16,6 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
19
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
20
|
};
|
|
18
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.buildWasm = buildWasm;
|
|
19
23
|
const child_process_1 = require("child_process");
|
|
20
24
|
const fs_1 = __importDefault(require("fs"));
|
|
21
25
|
const path_1 = __importDefault(require("path"));
|
|
@@ -49,35 +53,42 @@ function has(cmd) {
|
|
|
49
53
|
// nosemgrep: javascript.lang.security.detect-child-process.detect-child-process
|
|
50
54
|
return (0, child_process_1.spawnSync)(cmd, ["--version"], { stdio: "ignore" }).status === 0;
|
|
51
55
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"-p"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
/** Run the full compile → wasm-bindgen → optimise pipeline. Throws via `run`'s
|
|
57
|
+
* `process.exit` on a missing tool or a non-zero step. */
|
|
58
|
+
function buildWasm() {
|
|
59
|
+
console.log("→ cargo build -p rastack-wasm --release (wasm32-unknown-unknown)");
|
|
60
|
+
run("cargo", [
|
|
61
|
+
"build",
|
|
62
|
+
"-p",
|
|
63
|
+
"rastack-wasm",
|
|
64
|
+
"--release",
|
|
65
|
+
"--target",
|
|
66
|
+
"wasm32-unknown-unknown",
|
|
67
|
+
], rustDir);
|
|
68
|
+
console.log("→ wasm-bindgen → tools/wasm/");
|
|
69
|
+
run("wasm-bindgen", [
|
|
70
|
+
"--target",
|
|
71
|
+
"web",
|
|
72
|
+
"--out-dir",
|
|
73
|
+
outDir,
|
|
74
|
+
"--out-name",
|
|
75
|
+
"rastack_wasm",
|
|
76
|
+
wasmPath,
|
|
77
|
+
]);
|
|
78
|
+
// Mark the emitted bundle as ESM so Node and bundlers treat it correctly
|
|
79
|
+
// without forcing the parent rastack package to be a module.
|
|
80
|
+
fs_1.default.writeFileSync(path_1.default.join(outDir, "package.json"), JSON.stringify({ type: "module", sideEffects: false }, null, 2) + "\n");
|
|
81
|
+
if (has("wasm-opt")) {
|
|
82
|
+
console.log("→ wasm-opt -Oz");
|
|
83
|
+
const bg = path_1.default.join(outDir, "rastack_wasm_bg.wasm");
|
|
84
|
+
run("wasm-opt", ["-Oz", "-o", bg, bg]);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
console.log("· wasm-opt not found — skipping size optimisation (optional)");
|
|
88
|
+
}
|
|
89
|
+
const size = fs_1.default.statSync(path_1.default.join(outDir, "rastack_wasm_bg.wasm")).size;
|
|
90
|
+
console.log(`✓ wasm engine built: tools/wasm/ (${(size / 1024).toFixed(0)} KB)`);
|
|
78
91
|
}
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
if (require.main === module) {
|
|
93
|
+
buildWasm();
|
|
81
94
|
}
|
|
82
|
-
const size = fs_1.default.statSync(path_1.default.join(outDir, "rastack_wasm_bg.wasm")).size;
|
|
83
|
-
console.log(`✓ wasm engine built: stack/wasm/ (${(size / 1024).toFixed(0)} KB)`);
|
package/dist/rastack.d.ts
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* rastack generate [--schema-only] Generate typed hooks from OpenAPI
|
|
11
11
|
* rastack tokens [input] [outDir] Compile design tokens → CSS vars + typed theme
|
|
12
12
|
* rastack design [input] [--port n] Live design-system studio (showcase + edit)
|
|
13
|
-
* rastack
|
|
14
|
-
* rastack admin [--warehouse dir]
|
|
15
|
-
* rastack wasm Compile the API to WebAssembly (in-browser local dev)
|
|
13
|
+
* rastack dev [--port n] [--warehouse d] Local dev: run the app + admin in-browser over WASM
|
|
14
|
+
* rastack admin [--warehouse dir] [--port n] Full admin console — React UI (rastack/components) over the native server
|
|
16
15
|
* rastack scan [files...] [--fail-on-pii] Scan CSVs for PII and schema info
|
|
17
16
|
* rastack seed [--env dev] [--source gs://] Load CSVs into Iceberg namespace
|
|
18
17
|
* rastack bootstrap [--owner o] [--repo r] Stand the tier-0 AWS account stack up (once per account+region)
|
package/dist/rastack.js
CHANGED
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
* rastack generate [--schema-only] Generate typed hooks from OpenAPI
|
|
12
12
|
* rastack tokens [input] [outDir] Compile design tokens → CSS vars + typed theme
|
|
13
13
|
* rastack design [input] [--port n] Live design-system studio (showcase + edit)
|
|
14
|
-
* rastack
|
|
15
|
-
* rastack admin [--warehouse dir]
|
|
16
|
-
* rastack wasm Compile the API to WebAssembly (in-browser local dev)
|
|
14
|
+
* rastack dev [--port n] [--warehouse d] Local dev: run the app + admin in-browser over WASM
|
|
15
|
+
* rastack admin [--warehouse dir] [--port n] Full admin console — React UI (rastack/components) over the native server
|
|
17
16
|
* rastack scan [files...] [--fail-on-pii] Scan CSVs for PII and schema info
|
|
18
17
|
* rastack seed [--env dev] [--source gs://] Load CSVs into Iceberg namespace
|
|
19
18
|
* rastack bootstrap [--owner o] [--repo r] Stand the tier-0 AWS account stack up (once per account+region)
|
|
@@ -57,26 +56,6 @@ function run(script, args = rest) {
|
|
|
57
56
|
process.exit(err.status ?? 1);
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
|
-
/** Invoke the compiled Rust server binary (built by `cargo build` in rust/). */
|
|
61
|
-
function runRust(subcommand) {
|
|
62
|
-
const repoRoot = path_1.default.resolve(__dirname, "..", "..");
|
|
63
|
-
const binary = process.env.RASTACK_SERVER_BIN ||
|
|
64
|
-
path_1.default.join(repoRoot, "rust", "target", "release", "rastack-server");
|
|
65
|
-
// Runs the locally-built Rust server binary with a fixed internal subcommand
|
|
66
|
-
// ("serve"/"admin"); `rest` is the developer's own CLI args, not untrusted
|
|
67
|
-
// input — no command-injection surface.
|
|
68
|
-
// nosemgrep: javascript.lang.security.detect-child-process.detect-child-process
|
|
69
|
-
const result = (0, child_process_1.spawnSync)(binary, [subcommand, ...rest], {
|
|
70
|
-
stdio: "inherit",
|
|
71
|
-
env: process.env,
|
|
72
|
-
});
|
|
73
|
-
if (result.error) {
|
|
74
|
-
console.error(`Could not run the Rust server (${binary}). Build it first:\n` +
|
|
75
|
-
` cd rust && cargo build --release\n`);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
process.exit(result.status ?? 0);
|
|
79
|
-
}
|
|
80
59
|
switch (command) {
|
|
81
60
|
case "--version":
|
|
82
61
|
case "-v":
|
|
@@ -90,15 +69,17 @@ switch (command) {
|
|
|
90
69
|
// rastack-compile dispatches on its own first argument, so pass the command.
|
|
91
70
|
run("rastack-compile.js", [command, ...rest]);
|
|
92
71
|
break;
|
|
93
|
-
case "
|
|
94
|
-
|
|
72
|
+
case "dev":
|
|
73
|
+
// Local development: serve the app + admin in the browser over the WASM
|
|
74
|
+
// engine (no native server, no cargo). Replaces `serve` + `wasm`.
|
|
75
|
+
run("rastack-dev.js", rest);
|
|
95
76
|
break;
|
|
96
77
|
case "admin":
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
run("rastack-
|
|
78
|
+
// Full Django-admin-style console: the native Rust server serves React API
|
|
79
|
+
// Stack's own React admin (built from `rastack/components` + `rastack/theme`)
|
|
80
|
+
// over the real Iceberg warehouse. `rastack-admin.js` compiles, wires the
|
|
81
|
+
// bundle in, and boots the server.
|
|
82
|
+
run("rastack-admin.js", rest);
|
|
102
83
|
break;
|
|
103
84
|
case "tokens":
|
|
104
85
|
// Design tokens → CSS custom properties + typed theme.
|
|
@@ -150,8 +131,8 @@ switch (command) {
|
|
|
150
131
|
` rastack generate [--schema-only]\n` +
|
|
151
132
|
` rastack tokens [input] [outDir] [--prefix p] Compile design tokens → CSS vars + typed theme\n` +
|
|
152
133
|
` rastack design [input] [--port n] Live design-system studio (showcase + edit)\n` +
|
|
153
|
-
` rastack
|
|
154
|
-
` rastack
|
|
134
|
+
` rastack dev [--port n] [--warehouse dir] [--no-open] Run the app + admin in-browser over WASM (local dev)\n` +
|
|
135
|
+
` rastack admin [--warehouse dir] [--port n] [--no-open] Full admin console (React UI over the native server; needs a built rastack-server)\n` +
|
|
155
136
|
` rastack scan [files...] [--fail-on-pii]\n` +
|
|
156
137
|
` rastack seed [--env dev|staging] [--source gs://bucket/ | ./myapp-dev/]\n` +
|
|
157
138
|
` rastack bootstrap [--owner o] [--repo r] [--region r] [--prefix p] [--reuse-oidc] [--print] Stand the AWS account stack up\n` +
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The in-browser API engine. Cheap to clone (everything behind `Arc`), which
|
|
6
|
+
* is what lets each async call own its state without borrowing across `await`.
|
|
7
|
+
*/
|
|
8
|
+
export class RastackApi {
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Snapshot the entire warehouse to a blob for persistence (`data/` folder,
|
|
13
|
+
* IndexedDB, or an upload to S3).
|
|
14
|
+
*/
|
|
15
|
+
exportWarehouse(): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Handle one request. `query` is a `{ [k]: string }` object, `body` any
|
|
18
|
+
* JSON value (or `undefined`). Resolves to `{ status, body }`.
|
|
19
|
+
*/
|
|
20
|
+
handle(method: string, path: string, query: any, body: any): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Seed the warehouse from a blob previously produced by
|
|
23
|
+
* [`export_warehouse`](Self::export_warehouse) (the `data/` folder or an
|
|
24
|
+
* IndexedDB/OPFS snapshot).
|
|
25
|
+
*/
|
|
26
|
+
importWarehouse(blob: Uint8Array): Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* Build an engine from the compiled manifest (`schema.rastack.json`) and an
|
|
29
|
+
* optional OpenAPI document (`openapi.json`, served at `/api/schema/`).
|
|
30
|
+
*/
|
|
31
|
+
constructor(manifest_json: string, openapi_json?: string | null);
|
|
32
|
+
/**
|
|
33
|
+
* Seed one Iceberg file (metadata or data file) at its warehouse key. The
|
|
34
|
+
* provider walks the committed `data/warehouse` Iceberg tree over HTTP and
|
|
35
|
+
* calls this for each file, so the browser reads the *actual* Iceberg files
|
|
36
|
+
* — no bundled blob.
|
|
37
|
+
*/
|
|
38
|
+
seedFile(key: string, bytes: Uint8Array): Promise<any>;
|
|
39
|
+
/**
|
|
40
|
+
* Run subsequent requests as a signed-in identity (the Cognito `sub` and
|
|
41
|
+
* `cognito:groups` claims). Owner fields are stamped from — and row
|
|
42
|
+
* filters and tenant scoping keyed by — this subject, matching the server
|
|
43
|
+
* byte-for-byte. Pass no subject to fall back to the trusted local
|
|
44
|
+
* context.
|
|
45
|
+
*/
|
|
46
|
+
setAuth(subject: string | null | undefined, groups: any): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
50
|
+
|
|
51
|
+
export interface InitOutput {
|
|
52
|
+
readonly memory: WebAssembly.Memory;
|
|
53
|
+
readonly __wbg_rastackapi_free: (a: number, b: number) => void;
|
|
54
|
+
readonly rastackapi_exportWarehouse: (a: number) => any;
|
|
55
|
+
readonly rastackapi_handle: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => any;
|
|
56
|
+
readonly rastackapi_importWarehouse: (a: number, b: number, c: number) => any;
|
|
57
|
+
readonly rastackapi_new: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
58
|
+
readonly rastackapi_seedFile: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
59
|
+
readonly rastackapi_setAuth: (a: number, b: number, c: number, d: any) => [number, number];
|
|
60
|
+
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
61
|
+
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
62
|
+
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
63
|
+
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
|
|
64
|
+
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
|
|
65
|
+
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
66
|
+
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
67
|
+
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
68
|
+
readonly wasm_bindgen_1a7aa9db5392c486___convert__closures_____invoke___wasm_bindgen_1a7aa9db5392c486___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_1a7aa9db5392c486___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
69
|
+
readonly wasm_bindgen_1a7aa9db5392c486___convert__closures_____invoke___js_sys_191ff9fb2bd47800___Function_fn_wasm_bindgen_1a7aa9db5392c486___JsValue_____wasm_bindgen_1a7aa9db5392c486___sys__Undefined___js_sys_191ff9fb2bd47800___Function_fn_wasm_bindgen_1a7aa9db5392c486___JsValue_____wasm_bindgen_1a7aa9db5392c486___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
70
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
71
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
72
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
73
|
+
readonly __externref_table_alloc: () => number;
|
|
74
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
75
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
76
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
77
|
+
readonly __wbindgen_start: () => void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
84
|
+
* a precompiled `WebAssembly.Module`.
|
|
85
|
+
*
|
|
86
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
87
|
+
*
|
|
88
|
+
* @returns {InitOutput}
|
|
89
|
+
*/
|
|
90
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
94
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
95
|
+
*
|
|
96
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
97
|
+
*
|
|
98
|
+
* @returns {Promise<InitOutput>}
|
|
99
|
+
*/
|
|
100
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|