rastack 0.0.63 → 0.0.69

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +19 -24
  3. package/admin/AdminApp.tsx +56 -3
  4. package/admin/httpEngine.ts +5 -6
  5. package/admin/index.tsx +11 -85
  6. package/admin/ui/icons.tsx +9 -0
  7. package/admin/ui/styles.ts +3 -0
  8. package/admin/useAdmin.ts +41 -4
  9. package/dist/admin.js +17 -22
  10. package/dist/compile/analyze.js +11 -1
  11. package/dist/compile/model.d.ts +1 -1
  12. package/dist/compile/run.d.ts +2 -2
  13. package/dist/compile/run.js +2 -2
  14. package/dist/define/index.d.ts +10 -4
  15. package/dist/define/index.js +2 -2
  16. package/dist/define/manifest.js +7 -1
  17. package/dist/deploy/io.d.ts +50 -0
  18. package/dist/deploy/io.js +124 -0
  19. package/dist/deploy/workflows.js +1 -1
  20. package/dist/dev/harness.d.ts +19 -27
  21. package/dist/dev/harness.js +31 -40
  22. package/dist/dev/native-server.d.ts +29 -0
  23. package/dist/dev/native-server.js +174 -0
  24. package/dist/external/envelope.d.ts +1 -1
  25. package/dist/external/envelope.js +1 -1
  26. package/dist/external/service.d.ts +2 -2
  27. package/dist/external/service.js +2 -2
  28. package/dist/external/types.d.ts +1 -1
  29. package/dist/external/types.js +1 -1
  30. package/dist/rastack-admin.d.ts +6 -14
  31. package/dist/rastack-admin.js +60 -88
  32. package/dist/rastack-bootstrap.js +18 -47
  33. package/dist/rastack-design.d.ts +1 -2
  34. package/dist/rastack-design.js +1 -2
  35. package/dist/rastack-dev.d.ts +7 -10
  36. package/dist/rastack-dev.js +68 -80
  37. package/dist/rastack-init.d.ts +6 -3
  38. package/dist/rastack-init.js +43 -30
  39. package/dist/rastack.d.ts +1 -1
  40. package/dist/rastack.js +5 -6
  41. package/dist/validate/transitions.d.ts +1 -1
  42. package/dist/validate/transitions.js +1 -1
  43. package/hooks/query/api.ts +4 -6
  44. package/package.json +2 -2
  45. package/provider/index.ts +0 -1
  46. package/provider/provider.tsx +31 -134
  47. package/provider/types.ts +30 -69
  48. package/src/compile/analyze.ts +11 -1
  49. package/src/compile/model.ts +1 -1
  50. package/src/compile/run.ts +2 -2
  51. package/src/define/index.ts +7 -4
  52. package/src/define/manifest.ts +7 -1
  53. package/src/deploy/io.ts +162 -1
  54. package/src/deploy/workflows.ts +1 -1
  55. package/src/dev/harness.ts +30 -43
  56. package/src/dev/native-server.ts +164 -0
  57. package/src/external/envelope.ts +1 -1
  58. package/src/external/service.ts +2 -2
  59. package/src/external/types.ts +1 -1
  60. package/src/rastack-admin.ts +66 -107
  61. package/src/rastack-bootstrap.ts +24 -69
  62. package/src/rastack-design.ts +1 -2
  63. package/src/rastack-dev.ts +79 -91
  64. package/src/rastack-init.ts +50 -41
  65. package/src/rastack.ts +5 -6
  66. package/src/validate/transitions.ts +1 -1
  67. package/dist/rastack-wasm-build.d.ts +0 -19
  68. package/dist/rastack-wasm-build.js +0 -94
  69. package/dist/wasm/package.json +0 -4
  70. package/dist/wasm/rastack_wasm.d.ts +0 -100
  71. package/dist/wasm/rastack_wasm.js +0 -745
  72. package/dist/wasm/rastack_wasm_bg.wasm +0 -0
  73. package/dist/wasm/rastack_wasm_bg.wasm.d.ts +0 -28
  74. package/provider/wasm.ts +0 -126
  75. package/scripts/copy-wasm.js +0 -35
  76. package/src/rastack-wasm-build.ts +0 -113
@@ -12,14 +12,17 @@
12
12
  * 1. writes `.rastack/deploy.json` + `.github/workflows/{ci,deploy-backend}.yml`
13
13
  * (GitHub coordinates default from the `origin` remote; missing fields are
14
14
  * prompted for on a TTY);
15
- * 2. resolves the tier-0 bootstrap stack's artifacts bucket — erroring with a
16
- * pointer to `rastack bootstrap` when that account+region stack is missing
17
- * (init is per-app and never creates account-level infrastructure);
15
+ * 2. verifies the AWS CLI is logged in, then ensures the tier-0 bootstrap stack
16
+ * exists — creating it (the S3 template/placeholder buckets + GitHub OIDC
17
+ * provider) when missing, reconciling it when it already does;
18
18
  * 3. uploads the Lambda placeholder bundle to that bucket;
19
19
  * 4. deploys the per-app backend (app.yaml) with the resolved ArtifactsBucket;
20
20
  * 5. reads the stack Outputs back into the config and prints the two GitHub repo
21
21
  * Variables CI needs.
22
22
  *
23
+ * The CloudFormation templates ship inside the `rastack` package; a partial
24
+ * install falls back to downloading them from reactapistack.com.
25
+ *
23
26
  * Thereafter the recurring code deploy is CI's job — `rastack ci deploy`, which
24
27
  * `rastack deploy` also runs. `--no-deploy` scaffolds only; `--print` shows the
25
28
  * exact single-line `aws cloudformation deploy` commands without running them.
@@ -30,12 +33,12 @@ import * as path from "path";
30
33
  import {
31
34
  APP_STACK_OUTPUTS,
32
35
  BOOTSTRAP_ARTIFACTS_OUTPUT,
33
- BOOTSTRAP_TEMPLATES_OUTPUT,
34
36
  DeployConfig,
35
37
  DeployOutputs,
36
38
  EnvName,
37
39
  ENV_NAMES,
38
40
  PartialDeployConfig,
41
+ bootstrapStackCommand,
39
42
  bootstrapStackName,
40
43
  deployStackCommandForEnv,
41
44
  deployStackArgsForEnv,
@@ -58,8 +61,10 @@ import {
58
61
  import {
59
62
  ask,
60
63
  awsAvailable,
64
+ awsIdentity,
61
65
  awsRun,
62
66
  canPrompt,
67
+ ensureBootstrapStack,
63
68
  ghAuthLogin,
64
69
  ghAuthenticated,
65
70
  ghAvailable,
@@ -67,6 +72,7 @@ import {
67
72
  gitRemoteUrl,
68
73
  loadConfig,
69
74
  resolveDeployAsset,
75
+ resolveTemplateFile,
70
76
  saveConfig,
71
77
  setRepoVariable,
72
78
  stackOutput,
@@ -281,8 +287,10 @@ function envLabel(cfg: DeployConfig, env: EnvName): string {
281
287
 
282
288
  /**
283
289
  * Print the exact commands `init` would run, without touching the cloud
284
- * (`--print`). The artifacts bucket is read from the bootstrap stack when the
285
- * AWS CLI is available, else shown as a placeholder.
290
+ * (`--print`). init stands up *both* stacks, so both `aws cloudformation deploy`
291
+ * commands are shown: the tier-0 bootstrap stack (created only when missing) and
292
+ * the per-app backend. The artifacts bucket is read from an existing bootstrap
293
+ * stack when the AWS CLI is available, else shown as a placeholder.
286
294
  */
287
295
  function printPlan(cfg: DeployConfig, envs: EnvName[]): void {
288
296
  const bucket = awsAvailable()
@@ -295,16 +303,15 @@ function printPlan(cfg: DeployConfig, envs: EnvName[]): void {
295
303
  const withBucket = mergeConfig(cfg, {
296
304
  artifactsBucket: bucket ?? "<ArtifactsBucketName from bootstrap stack>",
297
305
  });
306
+ const bootstrapTemplate = resolveDeployAsset("bootstrap.yaml") ?? undefined;
298
307
  const appTemplate = resolveDeployAsset("app.yaml") ?? undefined;
299
308
  console.log(`\n Deployment plan (${envs.join(" + ")} @ ${cfg.region})\n`);
300
309
  console.log(
301
- ` ── Prerequisite: the tier-0 bootstrap stack (${bootstrapStackName(cfg)}) must exist ──`,
302
- );
303
- console.log(
304
- ` Create it once per account+region (init does not): rastack bootstrap --region ${cfg.region}\n`,
310
+ ` ── 1. Tier-0 bootstrap stack (${bootstrapStackName(cfg)}) — created only when missing ──`,
305
311
  );
312
+ console.log("\n " + bootstrapStackCommand(cfg, false, bootstrapTemplate) + "\n");
306
313
  console.log(
307
- " ── 1. Per-app backend (app.yaml) — one stack per environment ──",
314
+ " ── 2. Per-app backend (app.yaml) — one stack per environment ──",
308
315
  );
309
316
  for (const env of envs) {
310
317
  const e = resolveEnvironment(withBucket, env);
@@ -330,9 +337,12 @@ function printPlan(cfg: DeployConfig, envs: EnvName[]): void {
330
337
  }
331
338
 
332
339
  /**
333
- * Stand the infrastructure up: ensure the bootstrap stack + artifacts bucket,
334
- * upload the Lambda placeholder, deploy app.yaml, and read the Outputs back into
335
- * the config. Returns the config enriched with the resolved buckets + outputs.
340
+ * Stand the infrastructure up: verify the AWS CLI is logged in, ensure the
341
+ * tier-0 bootstrap stack (creating it when missing), upload the Lambda
342
+ * placeholder, deploy app.yaml, and read the Outputs back into the config.
343
+ * `init` is the single command that stands up *everything* — there is no
344
+ * separate manual bootstrap step. Returns the config enriched with the resolved
345
+ * buckets + outputs.
336
346
  */
337
347
  async function standUp(
338
348
  cfg: DeployConfig,
@@ -347,33 +357,32 @@ async function standUp(
347
357
  process.exit(1);
348
358
  }
349
359
 
350
- // 1. Resolve the artifacts bucket from the tier-0 bootstrap stack. That stack
351
- // is an account+region once-off — the S3 buckets that host the templates +
352
- // Lambda placeholder, and the GitHub OIDC provider. `init` is a per-app
353
- // command and deliberately does NOT create it: standing up account-level
354
- // infrastructure is `rastack bootstrap`'s job (run once by an account admin),
355
- // so a missing bootstrap stack is a clear, actionable error, not an implicit
356
- // account mutation buried inside an app deploy.
357
- const artifactsBucket = stackOutput(
358
- bootstrapStackName(cfg),
359
- BOOTSTRAP_ARTIFACTS_OUTPUT,
360
- cfg.region,
361
- );
362
- const templatesBucket = stackOutput(
363
- bootstrapStackName(cfg),
364
- BOOTSTRAP_TEMPLATES_OUTPUT,
365
- cfg.region,
366
- );
367
- if (!artifactsBucket) {
360
+ // Verify the AWS CLI is actually logged in before creating any stacks, so a
361
+ // missing/expired credential fails fast with an actionable message rather than
362
+ // a cryptic `cloudformation deploy` error partway through.
363
+ const account = awsIdentity(cfg.region);
364
+ if (!account) {
368
365
  console.error(
369
- `\n ✗ Bootstrap stack ${bootstrapStackName(cfg)} not found in ${cfg.region}.\n` +
370
- " It is the once-per-account+region step that hosts the CloudFormation\n" +
371
- " templates and the Lambda placeholder every app deploy reads. Create it\n" +
372
- " first (an account admin does this once), then re-run `rastack init`:\n\n" +
373
- ` rastack bootstrap --region ${cfg.region}\n`,
366
+ " ✗ the AWS CLI has no usable credentials — it is not logged in.\n" +
367
+ " Configure credentials, then re-run `rastack init`:\n" +
368
+ " aws configure # static access key / secret\n" +
369
+ " aws sso login # or an existing SSO session\n" +
370
+ " Or re-run with --print to see the commands, or --no-deploy to skip.",
374
371
  );
375
372
  process.exit(1);
376
373
  }
374
+ console.log(` ✓ AWS account ${account} (${cfg.region})`);
375
+
376
+ // 1. Ensure the tier-0 bootstrap stack exists — the S3 buckets that host the
377
+ // templates + Lambda placeholder and the GitHub OIDC provider. init creates
378
+ // it when missing (idempotent for an existing one), so a single command
379
+ // takes an account+repo from nothing to a deployed backend.
380
+ const { artifactsBucket, templatesBucket } = await ensureBootstrapStack(
381
+ cfg,
382
+ ).catch((err: Error) => {
383
+ console.error(`\n ✗ ${err.message}`);
384
+ process.exit(1);
385
+ });
377
386
  console.log(` ✓ artifacts bucket: ${artifactsBucket}`);
378
387
 
379
388
  // 2. Upload the placeholder the function is created from (shared by all envs).
@@ -389,11 +398,11 @@ async function standUp(
389
398
  artifactsBucket,
390
399
  templatesBucket: templatesBucket ?? undefined,
391
400
  });
392
- const appTemplate = resolveDeployAsset("app.yaml");
401
+ const appTemplate = await resolveTemplateFile("app.yaml");
393
402
  if (!appTemplate) {
394
403
  console.error(
395
- " ✗ app.yaml template not found in the rastack package. Reinstall rastack\n" +
396
- " (`npm i -g rastack`) or run from the framework repo.",
404
+ " ✗ app.yaml template not found in the rastack package and could not be\n" +
405
+ " downloaded from reactapistack.com. Reinstall rastack (`npm i -g rastack`).",
397
406
  );
398
407
  process.exit(1);
399
408
  }
@@ -623,7 +632,7 @@ async function main(argv: string[]): Promise<void> {
623
632
  .map((env) => resolveEnvironment(cfg, env).stackName)
624
633
  .join(" + ");
625
634
  const ok = await confirm(
626
- `Deploy ${stacks} to AWS ${cfg.region} now? (requires the bootstrap stack to exist) [y/N]`,
635
+ `Deploy ${stacks} to AWS ${cfg.region} now? (creates the bootstrap stack if missing) [y/N]`,
627
636
  );
628
637
  if (!ok) {
629
638
  console.log(
package/src/rastack.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * rastack generate [--schema-only] Generate typed hooks from OpenAPI
14
14
  * rastack tokens [input] [outDir] Compile design tokens → CSS vars + typed theme
15
15
  * rastack design [input] [--port n] Live design-system studio (showcase + edit)
16
- * rastack dev [--port n] [--warehouse d] Local dev: run your app in-browser over WASM
16
+ * rastack dev [--port n] [--warehouse d] Local dev: your app in the browser, the API in native Rust
17
17
  * rastack admin [--warehouse dir] [--port n] Full admin console — React UI (rastack/components) over the native server
18
18
  * rastack import <file> --resource app.model Load CSV/XLSX/PDF data and validate it (state machine)
19
19
  * rastack scan [files...] [--fail-on-pii] (LEGACY, pre-Rust) Scan CSVs for PII and schema info
@@ -72,7 +72,7 @@ switch (command) {
72
72
  console.error(
73
73
  "`rastack compile` has been removed — compilation now runs automatically\n" +
74
74
  "inside the two modalities of use:\n" +
75
- " • rastack dev local development (compiles, then serves over WASM)\n" +
75
+ " • rastack dev local development (compiles, then proxies /api to native rastack-server)\n" +
76
76
  " • rastack ci the deploy pipeline (compiles the manifest + OpenAPI)\n\n" +
77
77
  "Introspect the resource graph with: rastack check | list | urls\n",
78
78
  );
@@ -85,9 +85,8 @@ switch (command) {
85
85
  run("rastack-compile.js", [command, ...rest]);
86
86
  break;
87
87
  case "dev":
88
- // Local development: serve your app in the browser over the WASM engine
89
- // (no native server, no cargo). The admin console is a separate command,
90
- // `rastack admin`. Replaces `serve` + `wasm`.
88
+ // Local development: serve your app and proxy /api to native rastack-server.
89
+ // The admin console is a separate command, `rastack admin`.
91
90
  run("rastack-dev.js", rest);
92
91
  break;
93
92
  case "admin":
@@ -162,7 +161,7 @@ switch (command) {
162
161
  ` rastack generate [--schema-only]\n` +
163
162
  ` rastack tokens [input] [outDir] [--prefix p] Compile design tokens → CSS vars + typed theme\n` +
164
163
  ` rastack design [input] [--port n] Live design-system studio (showcase + edit)\n` +
165
- ` rastack dev [--port n] [--warehouse dir] [--app dir] [--no-open] Run your app in-browser over WASM (local dev)\n` +
164
+ ` rastack dev [--port n] [--warehouse dir] [--app dir] [--no-open] App in the browser, API in native rastack-server\n` +
166
165
  ` rastack admin [--warehouse dir] [--port n] [--no-open] Full admin console (React UI over the native server; needs a built rastack-server)\n` +
167
166
  ` rastack import <file.csv|.xlsx|.pdf> --resource app.model [--related app.model=<file>] [--out cleaned.json]\n` +
168
167
  ` rastack scan [files...] [--fail-on-pii] (legacy, pre-Rust)\n` +
@@ -23,7 +23,7 @@
23
23
  * list), and this module is the *shared executable form* of it: the same pure
24
24
  * functions guard a form submit (`useForm(...).transition("board")`), the
25
25
  * record machine (`runRecordMachine` with a `previous` row in context), and —
26
- * re-implemented 1:1 in `rastack-api-core` — every server/WASM write. A write
26
+ * re-implemented 1:1 in `rastack-api-core` — every native-server write. A write
27
27
  * that jumps between states without a declared edge is rejected on every
28
28
  * surface, which is what makes a transition "a backend function that is
29
29
  * state-machine safe": the only way to move a record between states is a
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Compile the Rust API to WebAssembly for in-browser local dev — the engine
4
- * `rastack dev` serves and `<RAStackProvider mode="local">` loads.
5
- *
6
- * Pipeline:
7
- * 1. cargo build -p rastack-wasm --release --target wasm32-unknown-unknown
8
- * 2. wasm-bindgen --target web → wasm/rastack_wasm.js + rastack_wasm_bg.wasm
9
- * 3. wasm-opt -Oz (if available) to shrink the binary
10
- *
11
- * This is invoked by the release CI (to bundle a prebuilt engine into the npm
12
- * package) and by `rastack dev` as a from-source fallback when no prebuilt
13
- * bundle is present but the toolchain is. Prereqs:
14
- * rustup target add wasm32-unknown-unknown
15
- * cargo install wasm-bindgen-cli (version must match the wasm-bindgen crate)
16
- */
17
- /** Run the full compile → wasm-bindgen → optimise pipeline. Throws via `run`'s
18
- * `process.exit` on a missing tool or a non-zero step. */
19
- export declare function buildWasm(): void;
@@ -1,94 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * Compile the Rust API to WebAssembly for in-browser local dev — the engine
5
- * `rastack dev` serves and `<RAStackProvider mode="local">` loads.
6
- *
7
- * Pipeline:
8
- * 1. cargo build -p rastack-wasm --release --target wasm32-unknown-unknown
9
- * 2. wasm-bindgen --target web → wasm/rastack_wasm.js + rastack_wasm_bg.wasm
10
- * 3. wasm-opt -Oz (if available) to shrink the binary
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:
15
- * rustup target add wasm32-unknown-unknown
16
- * cargo install wasm-bindgen-cli (version must match the wasm-bindgen crate)
17
- */
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.buildWasm = buildWasm;
23
- const child_process_1 = require("child_process");
24
- const fs_1 = __importDefault(require("fs"));
25
- const path_1 = __importDefault(require("path"));
26
- const repoRoot = path_1.default.resolve(__dirname, "..");
27
- const rustDir = path_1.default.join(repoRoot, "engine");
28
- const outDir = path_1.default.join(repoRoot, "wasm");
29
- const wasmPath = path_1.default.join(rustDir, "target", "wasm32-unknown-unknown", "release", "rastack_wasm.wasm");
30
- function run(cmd, args, cwd = repoRoot) {
31
- // Local build tool: `cmd`/`args` are the fixed toolchain invocations below
32
- // (cargo, wasm-bindgen, wasm-opt), not untrusted input — no injection surface.
33
- // nosemgrep: javascript.lang.security.detect-child-process.detect-child-process
34
- const result = (0, child_process_1.spawnSync)(cmd, args, {
35
- stdio: "inherit",
36
- cwd,
37
- env: process.env,
38
- });
39
- if (result.error) {
40
- console.error(`\nCould not run \`${cmd}\`. Is it installed and on PATH?`);
41
- if (cmd === "wasm-bindgen") {
42
- console.error(" cargo install wasm-bindgen-cli");
43
- }
44
- process.exit(1);
45
- }
46
- if (result.status !== 0) {
47
- process.exit(result.status ?? 1);
48
- }
49
- }
50
- function has(cmd) {
51
- // Probes a fixed toolchain name (e.g. "wasm-opt") for availability; not
52
- // untrusted input.
53
- // nosemgrep: javascript.lang.security.detect-child-process.detect-child-process
54
- return (0, child_process_1.spawnSync)(cmd, ["--version"], { stdio: "ignore" }).status === 0;
55
- }
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 → 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: wasm/ (${(size / 1024).toFixed(0)} KB)`);
91
- }
92
- if (require.main === module) {
93
- buildWasm();
94
- }
@@ -1,4 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": false
4
- }
@@ -1,100 +0,0 @@
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_ac0f9960a408a037___convert__closures_____invoke___wasm_bindgen_ac0f9960a408a037___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_ac0f9960a408a037___JsError___true_: (a: number, b: number, c: any) => [number, number];
69
- readonly wasm_bindgen_ac0f9960a408a037___convert__closures_____invoke___js_sys_10c47e7ecd0a94ab___Function_fn_wasm_bindgen_ac0f9960a408a037___JsValue_____wasm_bindgen_ac0f9960a408a037___sys__Undefined___js_sys_10c47e7ecd0a94ab___Function_fn_wasm_bindgen_ac0f9960a408a037___JsValue_____wasm_bindgen_ac0f9960a408a037___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>;