diff --git a/.coderabbit.yaml b/.coderabbit.yaml index ea6ab690e..dde155839 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -32,7 +32,6 @@ reviews: # Skip generated and lock files entirely. path_filters: - "!**/routeTree.gen.ts" - - "!examples/simulator/server/ts-bindings/**" - "!Cargo.lock" - "!pixi.lock" - "!ui/pnpm-lock.yaml" diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml index ef5e02ec1..74ded0911 100644 --- a/.github/workflows/license-check.yml +++ b/.github/workflows/license-check.yml @@ -18,14 +18,12 @@ jobs: persist-credentials: false - name: Check SPDX license headers run: | - # ts-bindings are auto-generated by ts-rs from Rust structs missing=() while IFS= read -r file; do if ! grep -q "SPDX-License-Identifier" "$file"; then missing+=("$file") fi - done < <(git ls-files -- '*.ts' '*.tsx' '*.rs' '*.proto' '*.css' \ - ':!examples/simulator/server/ts-bindings/') + done < <(git ls-files -- '*.ts' '*.tsx' '*.rs' '*.proto' '*.css') if [[ ${#missing[@]} -gt 0 ]]; then echo "The following files are missing an SPDX license header:" @@ -37,5 +35,4 @@ jobs: exit 1 fi - echo "All $(git ls-files -- '*.ts' '*.tsx' '*.rs' '*.proto' '*.css' \ - ':!examples/simulator/server/ts-bindings/' | wc -l | tr -d ' ') files have SPDX license headers." + echo "All $(git ls-files -- '*.ts' '*.tsx' '*.rs' '*.proto' '*.css' | wc -l | tr -d ' ') files have SPDX license headers." diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index dc76ad3df..91f763813 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -5,10 +5,22 @@ on: branches: [main] paths: - "ui/**" + - "**/*.rs" + - "**/Cargo.toml" + - "**/Cargo.lock" + - "**/*.proto" + - "pixi.toml" + - "pixi.lock" - ".github/workflows/ui.yml" pull_request: paths: - "ui/**" + - "**/*.rs" + - "**/Cargo.toml" + - "**/Cargo.lock" + - "**/*.proto" + - "pixi.toml" + - "pixi.lock" - ".github/workflows/ui.yml" permissions: @@ -66,6 +78,7 @@ jobs: with: cache: true - run: pixi run pnpm --dir ui install --frozen-lockfile + - run: pixi run pnpm --dir ui bindings - run: pixi run pnpm --dir ui routes:generate - run: pixi run pnpm --dir ui test:coverage - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 @@ -114,6 +127,90 @@ jobs: - run: pixi run pnpm --dir ui install --frozen-lockfile - run: pixi run pnpm --dir ui audit --audit-level=high + detect-binding-changes: + name: Detect TS Binding Changes + if: github.event_name == 'pull_request' + outputs: + changed: ${{ steps.compare.outputs.changed }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + ref: ${{ github.event.pull_request.base.sha }} + path: base + persist-credentials: false + - uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 + with: + cache: true + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - run: pixi run cargo run -p quent-simulator-ui-bindings --locked + - name: Generate base bindings + run: | + if [ -d base/examples/simulator/ui-bindings ]; then + pixi run cargo run \ + --manifest-path base/Cargo.toml \ + -p quent-simulator-ui-bindings \ + --locked + else + pixi run cargo build \ + --manifest-path base/Cargo.toml \ + -p quent-simulator-server \ + --locked + fi + - name: Compare generated bindings + id: compare + run: | + diff_status=0 + if [ -d base/ui/generated/ts-bindings ]; then + base_bindings=base/ui/generated/ts-bindings + else + base_bindings=base/examples/simulator/server/ts-bindings + fi + diff --recursive --unified=3 "$base_bindings" \ + ui/generated/ts-bindings > ts-bindings.diff || diff_status=$? + if [ "$diff_status" -gt 1 ]; then + exit "$diff_status" + elif [ "$diff_status" -eq 1 ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + fi + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + if: steps.compare.outputs.changed == 'true' + with: + name: ts-bindings-diff + path: | + ts-bindings.diff + ui/generated/ts-bindings/ + retention-days: 7 + + diff-bindings: + name: TS Binding Diff + if: needs.detect-binding-changes.outputs.changed == 'true' + needs: [detect-binding-changes] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ts-bindings-diff + path: . + - name: Post binding diff to step summary + run: | + echo "## TS Binding Changes" >> "$GITHUB_STEP_SUMMARY" + echo '```diff' >> "$GITHUB_STEP_SUMMARY" + cat ts-bindings.diff >> "$GITHUB_STEP_SUMMARY" + echo '```' >> "$GITHUB_STEP_SUMMARY" + build: name: Build needs: [fmt, lint, typecheck, test, e2e] diff --git a/.gitignore b/.gitignore index 216f7e109..6e3c0d10f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ docs/agents/ __pycache__/ .env +ui/generated/ts-bindings/ diff --git a/Cargo.lock b/Cargo.lock index 5a7670517..2350dddf5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2969,6 +2969,7 @@ dependencies = [ "quent-query-engine-analyzer", "quent-query-engine-model", "quent-query-engine-ui", + "quent-simulator-ui-bindings", "quent-time", "quent-ui", "rust-embed", @@ -3124,14 +3125,10 @@ dependencies = [ "clap", "quent-io", "quent-query-engine-server", - "quent-query-engine-ui", "quent-simulator-analyzer", "quent-simulator-instrumentation", - "quent-simulator-ui", - "quent-ui", "tokio", "tracing", - "ts-rs", "uuid", ] @@ -3145,6 +3142,16 @@ dependencies = [ "uuid", ] +[[package]] +name = "quent-simulator-ui-bindings" +version = "0.1.0" +dependencies = [ + "quent-query-engine-ui", + "quent-simulator-ui", + "quent-ui", + "ts-rs", +] + [[package]] name = "quent-stdlib" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 290d46df1..d447dd3c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ members = [ "examples/simulator/instrumentation", "examples/simulator/server", "examples/simulator/ui", + "examples/simulator/ui-bindings", # Deterministic query-engine event emitter (opt-in via `-p`). # Activates `quent-time/__test-clock-override`; excluded from default-members # so default builds keep `quent-time` zero-cost. @@ -112,6 +113,7 @@ default-members = [ "examples/simulator/instrumentation", "examples/simulator/server", "examples/simulator/ui", + "examples/simulator/ui-bindings", ] [workspace.package] diff --git a/README.md b/README.md index 276eb1f00..a4dbfee35 100644 --- a/README.md +++ b/README.md @@ -108,19 +108,14 @@ opinionated but replaceable implementation based on the modeling approach. ### Prerequisites -- Rust (stable, >= 1.93) -- Node.js (>= 24.11) -- pnpm (>= 10) -- protoc (protobuf compiler) - -Or use [pixi](https://pixi.sh) to manage all dependencies: +Install [Pixi](https://pixi.sh), then enter the repository environment: ```bash pixi shell ``` -This installs the required toolchains and drops you into a shell with -everything on `PATH`. +Pixi provides the required Rust, Node.js, pnpm, and protoc versions. Run +development and build commands from this environment. ### UI development @@ -143,6 +138,10 @@ pnpm install pnpm dev ``` +`pnpm dev` generates the TypeScript bindings consumed by the UI before starting +Vite. Run `pnpm bindings` after changing Rust types while the dev server remains +open. The `start`, `typecheck`, and `build` scripts also ensure bindings exist. + The dev server starts on by default. #### Running the server without Docker @@ -171,8 +170,8 @@ stress testing on the UI. cargo build -p quent-simulator-server --features ui --release ``` -This runs `pnpm install && pnpm build` in `ui/` as part of the Cargo build and -bundles the output into the binary. +The Cargo build generates the TypeScript bindings, builds the UI, and bundles +the output into the binary. ### Swagger UI diff --git a/domains/query_engine/server/Cargo.toml b/domains/query_engine/server/Cargo.toml index 5b309aae4..43af4f057 100644 --- a/domains/query_engine/server/Cargo.toml +++ b/domains/query_engine/server/Cargo.toml @@ -5,7 +5,7 @@ edition.workspace = true publish.workspace = true [features] swagger = ["dep:utoipa", "dep:utoipa-swagger-ui"] -ui = ["dep:mime_guess", "dep:rust-embed"] +ui = ["dep:mime_guess", "dep:quent-simulator-ui-bindings", "dep:rust-embed"] [dependencies] axum = { version = "0.8.7" } @@ -32,3 +32,6 @@ utoipa-swagger-ui = { version = "9", features = ["axum"], optional = true } uuid.workspace = true mime_guess = { version = "2", optional = true } rust-embed = { version = "8", optional = true } + +[build-dependencies] +quent-simulator-ui-bindings = { path = "../../../examples/simulator/ui-bindings", optional = true } diff --git a/domains/query_engine/server/build.rs b/domains/query_engine/server/build.rs index 550477e60..f89f61469 100644 --- a/domains/query_engine/server/build.rs +++ b/domains/query_engine/server/build.rs @@ -2,44 +2,68 @@ // SPDX-License-Identifier: Apache-2.0 fn main() -> Result<(), Box> { - // Build the UI with pnpm when the ui feature is enabled. - if std::env::var("CARGO_FEATURE_UI").is_ok() { - let ui_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../ui"); - println!("cargo:rerun-if-changed={}", ui_dir.join("src").display()); - println!( - "cargo:rerun-if-changed={}", - ui_dir.join("index.html").display() - ); - println!( - "cargo:rerun-if-changed={}", - ui_dir.join("package.json").display() - ); + #[cfg(feature = "ui")] + build_ui()?; - let run_pnpm = |args: &[&str]| -> Result<(), Box> { - let output = std::process::Command::new("pnpm") - .args(args) - .current_dir(&ui_dir) - .output()?; - let stderr = String::from_utf8_lossy(&output.stderr); - // Vite prefixes warnings with "(!)". - let has_warnings = stderr.lines().any(|l| l.trim_start().starts_with("(!)")); - if !output.status.success() || has_warnings { - for line in String::from_utf8_lossy(&output.stdout).lines() { - println!("cargo:warning=pnpm: {line}"); - } - for line in stderr.lines() { - println!("cargo:warning=pnpm: {line}"); - } + Ok(()) +} + +#[cfg(feature = "ui")] +fn build_ui() -> Result<(), Box> { + let ui_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../ui"); + let bindings_dir = ui_dir.join("generated/ts-bindings"); + let rerun_if_changed = |path: &std::path::Path| { + println!("cargo:rerun-if-changed={}", path.display()); + }; + for path in [ + "src", + "public", + "index.html", + "package.json", + "pnpm-lock.yaml", + "pnpm-workspace.yaml", + "tsconfig.base.json", + "tsconfig.json", + "tsconfig.node.json", + "tsr.config.json", + "vite.config.ts", + ] { + rerun_if_changed(&ui_dir.join(path)); + } + for package in ["client", "components", "hooks", "utils"] { + let package_dir = ui_dir.join("packages/@quent").join(package); + for path in ["src", "package.json", "tsconfig.json", "tsdown.config.ts"] { + rerun_if_changed(&package_dir.join(path)); + } + } + + let run_pnpm = |args: &[&str]| -> Result<(), Box> { + let output = std::process::Command::new("pnpm") + .args(args) + .current_dir(&ui_dir) + .output()?; + let stderr = String::from_utf8_lossy(&output.stderr); + // Vite prefixes warnings with "(!)". + let has_warnings = stderr + .lines() + .any(|line| line.trim_start().starts_with("(!)")); + if !output.status.success() || has_warnings { + for line in String::from_utf8_lossy(&output.stdout).lines() { + println!("cargo:warning=pnpm: {line}"); } - if !output.status.success() { - return Err(format!("pnpm {} failed", args.join(" ")).into()); + for line in stderr.lines() { + println!("cargo:warning=pnpm: {line}"); } - Ok(()) - }; + } + if !output.status.success() { + return Err(format!("pnpm {} failed", args.join(" ")).into()); + } + Ok(()) + }; - run_pnpm(&["install", "--frozen-lockfile"])?; - run_pnpm(&["build"])?; - } + quent_simulator_ui_bindings::generate(&bindings_dir)?; + run_pnpm(&["install", "--frozen-lockfile"])?; + run_pnpm(&["ci:build"])?; Ok(()) } diff --git a/examples/simulator/server/Cargo.toml b/examples/simulator/server/Cargo.toml index 4f9f2d4cf..fa3692f18 100644 --- a/examples/simulator/server/Cargo.toml +++ b/examples/simulator/server/Cargo.toml @@ -17,9 +17,3 @@ quent-simulator-instrumentation = { path = "../instrumentation", features = ["co tokio = { workspace = true, features = ["rt-multi-thread", "sync"]} tracing.workspace = true uuid.workspace = true - -[build-dependencies] -ts-rs = { workspace = true, features = ["uuid-impl", "serde-json-impl", "format"] } -quent-ui = { path = "../../../crates/ui" } -quent-query-engine-ui = { path = "../../../domains/query_engine/ui" } -quent-simulator-ui = { path = "../ui" } diff --git a/examples/simulator/server/ts-bindings/BinnedSpanSec.ts b/examples/simulator/server/ts-bindings/BinnedSpanSec.ts deleted file mode 100644 index c1ea94404..000000000 --- a/examples/simulator/server/ts-bindings/BinnedSpanSec.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SpanSec } from "./SpanSec"; - -/** - * A UI-friendly representation of [`BinnedSpan`]. - */ -export type BinnedSpanSec = { - /** - * The entire span of time this binned span represents. - */ - span: SpanSec; - /** - * The duration of one bin. - */ - bin_duration: number; - /** - * The number of bins. - */ - num_bins: bigint; -}; diff --git a/examples/simulator/server/ts-bindings/BulkTimelineRequest.ts b/examples/simulator/server/ts-bindings/BulkTimelineRequest.ts deleted file mode 100644 index 028f6f57b..000000000 --- a/examples/simulator/server/ts-bindings/BulkTimelineRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TimelineRequest } from "./TimelineRequest"; - -/** - * Request for a bulk of timelines. - */ -export type BulkTimelineRequest = { - /** - * The list of timelines requested. - */ - entries: { [key in string]: TimelineRequest }; - /** - * Global application-specific parameters, e.g. filters. - */ - app_params: GlobalParams; -}; diff --git a/examples/simulator/server/ts-bindings/BulkTimelinesResponse.ts b/examples/simulator/server/ts-bindings/BulkTimelinesResponse.ts deleted file mode 100644 index 4687c5cdb..000000000 --- a/examples/simulator/server/ts-bindings/BulkTimelinesResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BulkTimelinesResponseEntry } from "./BulkTimelinesResponseEntry"; - -/** - * Response for a bulk timeline request. - */ -export type BulkTimelinesResponse = { - /** - * The timeline responses, keyed by the same keys as the request entries. - */ - entries: { [key in string]: BulkTimelinesResponseEntry }; -}; diff --git a/examples/simulator/server/ts-bindings/BulkTimelinesResponseEntry.ts b/examples/simulator/server/ts-bindings/BulkTimelinesResponseEntry.ts deleted file mode 100644 index 1a764c8f1..000000000 --- a/examples/simulator/server/ts-bindings/BulkTimelinesResponseEntry.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BinnedSpanSec } from "./BinnedSpanSec"; -import type { ResourceTimeline } from "./ResourceTimeline"; - -/** - * A single entry in a bulk timeline response. - */ -export type BulkTimelinesResponseEntry = { - "status": "ok"; - /** - * An informational message about the entry. - */ - message: string; - /** - * The configuration of the binned timeline for this entry. - */ - config: BinnedSpanSec; - /** - * The timeline data for this entry. - */ - data: ResourceTimeline; -} | { - "status": "error"; - /** - * A message describing the error. - */ - message: string; -}; diff --git a/examples/simulator/server/ts-bindings/CapacityDecl.ts b/examples/simulator/server/ts-bindings/CapacityDecl.ts deleted file mode 100644 index 78f347681..000000000 --- a/examples/simulator/server/ts-bindings/CapacityDecl.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CapacityKind } from "./CapacityKind"; - -/** - * A capacity declaration for a resource type, as exposed to the UI. - */ -export type CapacityDecl = { - /** - * The name of this capacity. - */ - name: string; - /** - * The kind of capacity. - */ - kind: CapacityKind; - /** - * The name of the quantity spec (key into the quantity_specs map). - */ - quantity: string; -}; diff --git a/examples/simulator/server/ts-bindings/CapacityKind.ts b/examples/simulator/server/ts-bindings/CapacityKind.ts deleted file mode 100644 index e31d80180..000000000 --- a/examples/simulator/server/ts-bindings/CapacityKind.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The kind of capacity of a resource. - */ -export type CapacityKind = "Occupancy" | "Rate"; diff --git a/examples/simulator/server/ts-bindings/CategoricalDecl.ts b/examples/simulator/server/ts-bindings/CategoricalDecl.ts deleted file mode 100644 index 70b070cec..000000000 --- a/examples/simulator/server/ts-bindings/CategoricalDecl.ts +++ /dev/null @@ -1,37 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DimensionKeyDecl } from "./DimensionKeyDecl"; -import type { MeasureDecl } from "./MeasureDecl"; - -/** - * Presentation metadata for a categorical timeline, declared by the - * downstream analyzer. - * - * Dimension keys are expected to be a small enumerable set; unbounded key - * cardinality is a downstream misuse. - */ -export type CategoricalDecl = { - /** - * The FSM type whose states are broken down. References an entry in the - * application's FSM type declarations (e.g. `QueryBundle` fsm_types) for - * the state graph, names, and ordering. - */ - entity_type_name: string; - /** - * Display name of the dimension, e.g. an application may use a dimension - * describing where an entity's data resides. - */ - dimension_name: string; - /** - * The dimension keys in stable stacking/legend order. - */ - dimension_keys: Array; - /** - * The measures present in this response. - */ - measures: Array; - /** - * The measure the UI should select by default; must name an entry in - * `measures`. `None` means the first declared measure. - */ - default_measure: string | null; -}; diff --git a/examples/simulator/server/ts-bindings/CategoricalSeries.ts b/examples/simulator/server/ts-bindings/CategoricalSeries.ts deleted file mode 100644 index eb84d3850..000000000 --- a/examples/simulator/server/ts-bindings/CategoricalSeries.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Binned values of one categorical timeline series: - * measure name -> state name -> dimension key -> one value per time bin. - * - * Absent inner entries mean all-zero bins. - */ -export type CategoricalSeries = { - values: { - [key in string]: { [key in string]: { [key in string]: Array } }; - }; -}; diff --git a/examples/simulator/server/ts-bindings/CategoricalTimelineRequest.ts b/examples/simulator/server/ts-bindings/CategoricalTimelineRequest.ts deleted file mode 100644 index b7c430e6f..000000000 --- a/examples/simulator/server/ts-bindings/CategoricalTimelineRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TimelineConfig } from "./TimelineConfig"; - -/** - * Request for a categorical timeline. - */ -export type CategoricalTimelineRequest = { - /** - * Names of the measures to compute. Empty means all declared measures. - */ - measures: Array; - /** - * The configuration of the window and number of bins. - */ - config: TimelineConfig; - /** - * Global application-specific parameters, e.g. filters. - */ - app_params: GlobalParams; -}; diff --git a/examples/simulator/server/ts-bindings/DataFlowTimelineBinned.ts b/examples/simulator/server/ts-bindings/DataFlowTimelineBinned.ts deleted file mode 100644 index 4d8d34cd0..000000000 --- a/examples/simulator/server/ts-bindings/DataFlowTimelineBinned.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BinnedSpanSec } from "./BinnedSpanSec"; -import type { CategoricalDecl } from "./CategoricalDecl"; -import type { CategoricalSeries } from "./CategoricalSeries"; - -/** - * A binned data-flow categorical timeline covering every operator of a - * query. Analyzers without data-flow telemetry return - * `AnalyzerError::Unsupported` instead (HTTP 501), which the UI treats as - * "hide the view". - */ -export type DataFlowTimelineBinned = { - /** - * The configuration of the binned timeline. - * - * This may slightly differ from the requested configuration to ensure - * bounds are not exceeded and bin sizes are equal. - */ - config: BinnedSpanSec; - /** - * Presentation metadata declared by the analyzer. - */ - decl: CategoricalDecl; - /** - * Categorical series keyed by operator id. - */ - operators: { [key in string]: CategoricalSeries }; -}; diff --git a/examples/simulator/server/ts-bindings/DimensionKeyDecl.ts b/examples/simulator/server/ts-bindings/DimensionKeyDecl.ts deleted file mode 100644 index 5f0549e1f..000000000 --- a/examples/simulator/server/ts-bindings/DimensionKeyDecl.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * One key of the application-defined dimension of a categorical timeline. - */ -export type DimensionKeyDecl = { - /** - * The key used in [`CategoricalSeries::values`]. - */ - key: string; - /** - * Human-friendly display name. - */ - display_name: string; -}; diff --git a/examples/simulator/server/ts-bindings/DynamicAttribute.ts b/examples/simulator/server/ts-bindings/DynamicAttribute.ts deleted file mode 100644 index 4487ebb5d..000000000 --- a/examples/simulator/server/ts-bindings/DynamicAttribute.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicValue } from "./DynamicValue"; - -/** - * A key-value pair. - */ -export type DynamicAttribute = { key: string; value: DynamicValue | null }; diff --git a/examples/simulator/server/ts-bindings/DynamicList.ts b/examples/simulator/server/ts-bindings/DynamicList.ts deleted file mode 100644 index 9630e617d..000000000 --- a/examples/simulator/server/ts-bindings/DynamicList.ts +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicStruct } from "./DynamicStruct"; - -/** - * A sequence of [`DynamicValue`]s. - */ -export type DynamicList = - | Array - | Array - | Array - | Array - | Array - | Array - | Array - | Array - | Array - | Array - | Array - | Array; diff --git a/examples/simulator/server/ts-bindings/DynamicStruct.ts b/examples/simulator/server/ts-bindings/DynamicStruct.ts deleted file mode 100644 index 5568b3f8f..000000000 --- a/examples/simulator/server/ts-bindings/DynamicStruct.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicAttribute } from "./DynamicAttribute"; - -/** - * A group of [`DynamicAttribute`]s. - */ -export type DynamicStruct = Array; diff --git a/examples/simulator/server/ts-bindings/DynamicValue.ts b/examples/simulator/server/ts-bindings/DynamicValue.ts deleted file mode 100644 index dce0c4971..000000000 --- a/examples/simulator/server/ts-bindings/DynamicValue.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicList } from "./DynamicList"; -import type { DynamicStruct } from "./DynamicStruct"; - -/** - * A [`DynamicAttribute`] value. - */ -export type DynamicValue = - | number - | number - | number - | bigint - | number - | number - | number - | bigint - | number - | number - | string - | DynamicStruct - | DynamicList; diff --git a/examples/simulator/server/ts-bindings/Edge.ts b/examples/simulator/server/ts-bindings/Edge.ts deleted file mode 100644 index 10805a3fc..000000000 --- a/examples/simulator/server/ts-bindings/Edge.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * An edge between two [`Operator`] [`Port`]s. - */ -export type Edge = { - /** - * The [`Port`] that produced the data flowing over this edge. - */ - source: string; - /** - * The [`Port`] that consumed the data flowing over this edge. - */ - target: string; -}; diff --git a/examples/simulator/server/ts-bindings/Engine.ts b/examples/simulator/server/ts-bindings/Engine.ts deleted file mode 100644 index 8ca74f9aa..000000000 --- a/examples/simulator/server/ts-bindings/Engine.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EngineImplementationAttributes } from "./EngineImplementationAttributes"; - -/** - * The engine that executed a [`Query`]. - */ -export type Engine = { - /** - * The ID of this [`Engine`]. - */ - id: string; - /** - * The timestamp at which this [`Engine`] started. - */ - start_time_unix_ns: bigint | null; - /** - * The duration for which this [`Engine`] was alive. - */ - duration_s: number | null; - /** - * The name of this [`Engine`] instance. - */ - instance_name: string | null; - /** - * Details about the Engine implementation. - */ - implementation: EngineImplementationAttributes | null; -}; diff --git a/examples/simulator/server/ts-bindings/EngineImplementationAttributes.ts b/examples/simulator/server/ts-bindings/EngineImplementationAttributes.ts deleted file mode 100644 index c97e7356c..000000000 --- a/examples/simulator/server/ts-bindings/EngineImplementationAttributes.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicAttribute } from "./DynamicAttribute"; - -/** - * Attributes describing details about the implementation of this Engine - */ -export type EngineImplementationAttributes = { - /** - * The name of this Engine implementation, e.g. "SiriusDB", "Velox", "DataFusion", etc. - */ - name: string | null; - /** - * The version of this Engine implementation, e.g. "13.3.7" - */ - version: string | null; - /** - * Arbitrary attributes defined at run time. - */ - custom_attributes: Array; -}; diff --git a/examples/simulator/server/ts-bindings/EntityFilter.ts b/examples/simulator/server/ts-bindings/EntityFilter.ts deleted file mode 100644 index 131ca6ac6..000000000 --- a/examples/simulator/server/ts-bindings/EntityFilter.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type EntityFilter = { - /** - * If set, only include utilizations from entities with this type name. - * - * If this entity is an FSM, then the timeline will aggregate usages into - * bins for each state separately. - */ - entity_type_name: string | null; -}; diff --git a/examples/simulator/server/ts-bindings/EntityListEntry.ts b/examples/simulator/server/ts-bindings/EntityListEntry.ts deleted file mode 100644 index 639b7cb73..000000000 --- a/examples/simulator/server/ts-bindings/EntityListEntry.ts +++ /dev/null @@ -1,35 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EntityListFilter } from "./EntityListFilter"; -import type { PageParams } from "./PageParams"; -import type { Sort } from "./Sort"; -import type { TimeWindow } from "./TimeWindow"; - -/** - * A single entity-list query. - */ -export type EntityListEntry = { - /** - * The window of time entities must fall in. - */ - window: TimeWindow; - /** - * Filter parameters. - */ - filter: EntityListFilter; - /** - * Sort parameters. - */ - sort: Sort; - /** - * Pagination parameters. - * - * When this is not set, return the full list. Depending on the dataset - * size and other parameters, this may result in a large volume of data and - * should be used with care. - */ - page: PageParams | null; - /** - * Per-query application-specific parameters. - */ - application: EntryParams; -}; diff --git a/examples/simulator/server/ts-bindings/EntityListFilter.ts b/examples/simulator/server/ts-bindings/EntityListFilter.ts deleted file mode 100644 index d875351a1..000000000 --- a/examples/simulator/server/ts-bindings/EntityListFilter.ts +++ /dev/null @@ -1,24 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EntityScope } from "./EntityScope"; - -/** - * Entity filters. - * - * Every field that is set must match, `None` fields do not filter. - */ -export type EntityListFilter = { - /** - * Restrict resulting entities to be in this scope. - */ - scope: EntityScope | null; - /** - * Restrict resulting entities to be of this type. - */ - entity_type_name: string | null; - /** - * Keep only entities with resource usages longer than this threshold. - * - * N.B. only Fsm-type entities can have usages. - */ - min_usage_s: number | null; -}; diff --git a/examples/simulator/server/ts-bindings/EntityListRequest.ts b/examples/simulator/server/ts-bindings/EntityListRequest.ts deleted file mode 100644 index c0d2a8571..000000000 --- a/examples/simulator/server/ts-bindings/EntityListRequest.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EntityListEntry } from "./EntityListEntry"; - -/** - * Parameters for listing entities. - */ -export type EntityListRequest = { - entry: EntityListEntry; - /** - * Global application parameters shared by the query. - */ - app_params: GlobalParams; -}; diff --git a/examples/simulator/server/ts-bindings/EntityListResponse.ts b/examples/simulator/server/ts-bindings/EntityListResponse.ts deleted file mode 100644 index 102757611..000000000 --- a/examples/simulator/server/ts-bindings/EntityListResponse.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FiniteStateMachine } from "./FiniteStateMachine"; - -/** - * A ranked, paged list of entities. - */ -export type EntityListResponse = { - items: Array; - /** - * The count of entities matching the filter before paging. - */ - total: number; -}; diff --git a/examples/simulator/server/ts-bindings/EntityRef.ts b/examples/simulator/server/ts-bindings/EntityRef.ts deleted file mode 100644 index c70de4302..000000000 --- a/examples/simulator/server/ts-bindings/EntityRef.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A reference to an entity - */ -export type EntityRef = - | { "Engine": string } - | { "Worker": string } - | { "QueryGroup": string } - | { "Query": string } - | { "Plan": string } - | { "Operator": string } - | { "Port": string } - | { "Resource": string } - | { "ResourceGroup": string } - | { "Task": string }; diff --git a/examples/simulator/server/ts-bindings/EntityScope.ts b/examples/simulator/server/ts-bindings/EntityScope.ts deleted file mode 100644 index 26d96998b..000000000 --- a/examples/simulator/server/ts-bindings/EntityScope.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Restricts returned entities to appear in a certain scope. - */ -export type EntityScope = { "Resource": { resource_id: string } } | { - "ResourceGroup": { resource_group_id: string; resource_type_name: string }; -}; diff --git a/examples/simulator/server/ts-bindings/EntitySortKey.ts b/examples/simulator/server/ts-bindings/EntitySortKey.ts deleted file mode 100644 index 73113cd19..000000000 --- a/examples/simulator/server/ts-bindings/EntitySortKey.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The key entities are sorted by. - */ -export type EntitySortKey = "UsageDuration"; diff --git a/examples/simulator/server/ts-bindings/FiniteStateMachine.ts b/examples/simulator/server/ts-bindings/FiniteStateMachine.ts deleted file mode 100644 index 773051609..000000000 --- a/examples/simulator/server/ts-bindings/FiniteStateMachine.ts +++ /dev/null @@ -1,24 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FsmTransition } from "./FsmTransition"; - -/** - * A run-time defined Finite-State-Machine. - */ -export type FiniteStateMachine = { - /** - * The ID of this FSM. - */ - id: string; - /** - * The type name of this FSM. - */ - type_name: string; - /** - * The instance name of this FSM. - */ - instance_name: string; - /** - * The transitions of this FSM. - */ - transitions: Array; -}; diff --git a/examples/simulator/server/ts-bindings/FsmStateTypeDecl.ts b/examples/simulator/server/ts-bindings/FsmStateTypeDecl.ts deleted file mode 100644 index 28d4a10ca..000000000 --- a/examples/simulator/server/ts-bindings/FsmStateTypeDecl.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A declaration of an FSM state. - */ -export type FsmStateTypeDecl = { - /** - * The name of this FSM state. - */ - name: string; - /** - * The names of the resource types this FSM state can use. - */ - usages: Array; -}; diff --git a/examples/simulator/server/ts-bindings/FsmTransition.ts b/examples/simulator/server/ts-bindings/FsmTransition.ts deleted file mode 100644 index 4b61901ae..000000000 --- a/examples/simulator/server/ts-bindings/FsmTransition.ts +++ /dev/null @@ -1,30 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicAttribute } from "./DynamicAttribute"; -import type { FsmUsage } from "./FsmUsage"; - -/** - * A transition in an FSM. - */ -export type FsmTransition = { - /** - * The name of the state this transition enters. - */ - name: string; - /** - * The usages of this state. - */ - usages: Array; - /** - * The timestamp in seconds relative to an epoch. - */ - timestamp: number; - /** - * Attributes recorded by the application's instrumentation. - */ - attributes: Array; - /** - * Attributes computed by the application's analyzer (e.g. a per-span - * rate), rendered separately from the recorded ones. - */ - derived_attributes: Array; -}; diff --git a/examples/simulator/server/ts-bindings/FsmTransitionDecl.ts b/examples/simulator/server/ts-bindings/FsmTransitionDecl.ts deleted file mode 100644 index caa3336c2..000000000 --- a/examples/simulator/server/ts-bindings/FsmTransitionDecl.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A declaration of an FSM state transition. - */ -export type FsmTransitionDecl = { "Entry": string } | { - "Transition": [string, string]; -} | { "Exit": string }; diff --git a/examples/simulator/server/ts-bindings/FsmTypeDecl.ts b/examples/simulator/server/ts-bindings/FsmTypeDecl.ts deleted file mode 100644 index 4397d52d7..000000000 --- a/examples/simulator/server/ts-bindings/FsmTypeDecl.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FsmStateTypeDecl } from "./FsmStateTypeDecl"; -import type { FsmTransitionDecl } from "./FsmTransitionDecl"; - -/** - * A declaration of an FSM type. - */ -export type FsmTypeDecl = { - /** - * The name of this FSM type. - */ - name: string; - /** - * The states of this FSM type. - */ - states: Array; - /** - * The possible transitions of this FSM type. - */ - transitions: Array; -}; diff --git a/examples/simulator/server/ts-bindings/FsmUsage.ts b/examples/simulator/server/ts-bindings/FsmUsage.ts deleted file mode 100644 index afba8fbfe..000000000 --- a/examples/simulator/server/ts-bindings/FsmUsage.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A capacity value used by an FSM state. - */ -export type FsmUsage = { - /** - * The resource ID being used. - */ - resource: string; - /** - * The capacities being used (name, optional value). - */ - capacities: Array<[string, bigint | null]>; -}; diff --git a/examples/simulator/server/ts-bindings/MeasureDecl.ts b/examples/simulator/server/ts-bindings/MeasureDecl.ts deleted file mode 100644 index 5fb8393c3..000000000 --- a/examples/simulator/server/ts-bindings/MeasureDecl.ts +++ /dev/null @@ -1,25 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CapacityKind } from "./CapacityKind"; - -/** - * A measure declared by the downstream analyzer for a categorical timeline, - * e.g. an entity count or a number of bytes. - */ -export type MeasureDecl = { - /** - * Unique name; key into [`CategoricalSeries::values`]. - */ - name: string; - /** - * Human-friendly display name. - */ - display_name: string; - /** - * Key into the application's quantity specs map for unit formatting. - */ - quantity: string; - /** - * Display semantics of a bin value (Occupancy = time-weighted level). - */ - kind: CapacityKind; -}; diff --git a/examples/simulator/server/ts-bindings/Operator.ts b/examples/simulator/server/ts-bindings/Operator.ts deleted file mode 100644 index 73fa5f1f8..000000000 --- a/examples/simulator/server/ts-bindings/Operator.ts +++ /dev/null @@ -1,49 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicValue } from "./DynamicValue"; -import type { OperatorStatistics } from "./OperatorStatistics"; -import type { SpanSec } from "./SpanSec"; - -export type Operator = { - /** - * The ID of this [`Operator`]. - */ - id: string; - /** - * The ID of the [`Plan`] this [`Operator`] belongs to. - */ - plan_id: string | null; - /** - * A list of [`Operator`] IDs in a parent plan (if any) from which this - * [`Operator`] was derived. - */ - parent_operator_ids: Array; - /** - * The name of this [`Operator`]. - */ - instance_name: string | null; - /** - * The name of this type of [`Operator`]. - */ - operator_type_name: string | null; - /** - * The dynamic attributes of this [`Operator`]. - */ - custom_attributes: { [key in string]: DynamicValue | null }; - /** - * The statistics of this [`Operator`]. - * - * These are attributes that are typically gathered after the work - * described by an [`Operator`] has completed. - */ - statistics: OperatorStatistics | null; - /** - * The span of time between the first moment an operator started processing - * an input, and the latest moment at which an operator finished producing - * an output (excluding any potential back-pressure). - * - * There may have been gaps in this span in which this operator was not - * actively using any resources. Thus, this span of time does NOT represent - * e.g. "CPU time" spent. - */ - active_span: SpanSec | null; -}; diff --git a/examples/simulator/server/ts-bindings/OperatorFilter.ts b/examples/simulator/server/ts-bindings/OperatorFilter.ts deleted file mode 100644 index ea80be9c8..000000000 --- a/examples/simulator/server/ts-bindings/OperatorFilter.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Per-entry timeline-request parameter; restricts a resource timeline to a - * single operator when set. - */ -export type OperatorFilter = { operator_id: string | null }; diff --git a/examples/simulator/server/ts-bindings/OperatorStatistics.ts b/examples/simulator/server/ts-bindings/OperatorStatistics.ts deleted file mode 100644 index b0381a357..000000000 --- a/examples/simulator/server/ts-bindings/OperatorStatistics.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicValue } from "./DynamicValue"; - -export type OperatorStatistics = { - /** - * Custom statistics - */ - custom_statistics: { [key in string]: DynamicValue | null }; -}; diff --git a/examples/simulator/server/ts-bindings/PageParams.ts b/examples/simulator/server/ts-bindings/PageParams.ts deleted file mode 100644 index a3caeb5e0..000000000 --- a/examples/simulator/server/ts-bindings/PageParams.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Parameters for paginated lists. - */ -export type PageParams = { - /** - * The maximum size of a page. - */ - max: number; - /** - * The zero-based index of the requested page. - */ - page: number; -}; diff --git a/examples/simulator/server/ts-bindings/Plan.ts b/examples/simulator/server/ts-bindings/Plan.ts deleted file mode 100644 index ae5f2af62..000000000 --- a/examples/simulator/server/ts-bindings/Plan.ts +++ /dev/null @@ -1,33 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Edge } from "./Edge"; - -/** - * A plan for executing a [`Query`]. - * - * The topology of the plan is a Directed Acyclic Graph (DAG). - */ -export type Plan = { - /** - * The ID of this [`Plan`]. - */ - id: string; - /** - * The name of this [`Plan`]. - */ - instance_name: string | null; - /** - * The ID of the parent [`Plan`], if any. - */ - parent: string | null; - /** - * The ID of the `Worker` that executed this [`Plan`]. - * - * If this level of [`Plan`] was not directly executed by a [`Worker`], - * then this is set to None. - */ - worker_id: string | null; - /** - * The [`Edge`]s between [`Operator`] [`Port`]s of this [`Plan`]. - */ - edges: Array; -}; diff --git a/examples/simulator/server/ts-bindings/PlanTree.ts b/examples/simulator/server/ts-bindings/PlanTree.ts deleted file mode 100644 index cae4ec59c..000000000 --- a/examples/simulator/server/ts-bindings/PlanTree.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type PlanTree = { - /** - * The ID of the plan at this node in the tree. - */ - id: string; - /** - * The ID of the worker that this Plan was local to, if any. - */ - worker: string | null; - /** - * The children of the plan at the node in this tree. - */ - children: Array; -}; diff --git a/examples/simulator/server/ts-bindings/Port.ts b/examples/simulator/server/ts-bindings/Port.ts deleted file mode 100644 index a7e28e405..000000000 --- a/examples/simulator/server/ts-bindings/Port.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PortStatistics } from "./PortStatistics"; - -export type Port = { - /** - * The ID of this [`Port`] - */ - id: string; - /** - * The [`Operator`] to which this [`Port`] belongs. - */ - operator_id: string | null; - /** - * The name of this [`Port`]. - */ - instance_name: string | null; - /** - * Statistics associated with this port: - */ - statistics: PortStatistics | null; -}; diff --git a/examples/simulator/server/ts-bindings/PortStatistics.ts b/examples/simulator/server/ts-bindings/PortStatistics.ts deleted file mode 100644 index aaae3c535..000000000 --- a/examples/simulator/server/ts-bindings/PortStatistics.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicValue } from "./DynamicValue"; - -export type PortStatistics = { - /** - * Custom statistics - */ - custom_statistics: { [key in string]: DynamicValue | null }; -}; diff --git a/examples/simulator/server/ts-bindings/PrefixSystem.ts b/examples/simulator/server/ts-bindings/PrefixSystem.ts deleted file mode 100644 index 57f819da9..000000000 --- a/examples/simulator/server/ts-bindings/PrefixSystem.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The prefix system used for scaling and abbreviating a quantity. - */ -export type PrefixSystem = "Si" | "Iec" | "None"; diff --git a/examples/simulator/server/ts-bindings/QuantitySpec.ts b/examples/simulator/server/ts-bindings/QuantitySpec.ts deleted file mode 100644 index cc732ae5b..000000000 --- a/examples/simulator/server/ts-bindings/QuantitySpec.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PrefixSystem } from "./PrefixSystem"; - -/** - * Specification of how to display a quantity with units. - */ -export type QuantitySpec = { - /** - * Base unit symbol, e.g. "B" for bytes. - */ - symbol: string; - /** - * Singular form, e.g. "byte". - */ - singular: string; - /** - * Plural form, e.g. "bytes". - */ - plural: string; - /** - * Prefix system for occupancy display. - */ - occupancy_prefix: PrefixSystem; - /** - * Prefix system for rate display. - */ - rate_prefix: PrefixSystem; -}; diff --git a/examples/simulator/server/ts-bindings/Query.ts b/examples/simulator/server/ts-bindings/Query.ts deleted file mode 100644 index 595170b91..000000000 --- a/examples/simulator/server/ts-bindings/Query.ts +++ /dev/null @@ -1,38 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A [`Query`] executed by an [`Engine`]. - */ -export type Query = { - /** - * The ID of this [`Query`]. - */ - id: string; - /** - * The ID of the `QueryGroup` this query is part of. - */ - query_group_id: string; - /** - * A name for this [`Query`]. - */ - instance_name: string | null; - /** - * The start time of this query, relative to the Unix epoch. - */ - start_unix_ns: bigint | null; - /** - * The time relative to the start time at which the engine started planning - * this query. - */ - planning_s: number | null; - /** - * The time relative to the start time at which the engine started - * executing this query, after planning. - */ - executing_s: number | null; - /** - * The time relative to the start time at which the engine started - * completed executing this query. - */ - completed_s: number | null; -}; diff --git a/examples/simulator/server/ts-bindings/QueryBundle.ts b/examples/simulator/server/ts-bindings/QueryBundle.ts deleted file mode 100644 index b0b9ce274..000000000 --- a/examples/simulator/server/ts-bindings/QueryBundle.ts +++ /dev/null @@ -1,41 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PlanTree } from "./PlanTree"; -import type { QuantitySpec } from "./QuantitySpec"; -import type { QueryEntities } from "./QueryEntities"; -import type { ResourceTree } from "./ResourceTree"; - -export type QueryBundle = { - /** - * The ID of the query. - */ - query_id: string; - /** - * Maps with entities that are involved in this query. - */ - entities: QueryEntities; - /** - * A tree of plans involved in the execution of this query. - */ - plan_tree: PlanTree; - /** - * A tree of resources involved in the execution of this query. - */ - resource_tree: ResourceTree; - /** - * A list of unique operator type names. - */ - unique_operator_names: Array; - /** - * Quantity specifications for capacity display, keyed by capacity name. - */ - quantity_specs: { [key in string]: QuantitySpec }; - /** - * The number of nanoseconds passed since the Unix epoch at which the - * engine started executing this query. - */ - start_time_unix_ns: bigint; - /** - * The duration of this query, in seconds. - */ - duration_s: number; -}; diff --git a/examples/simulator/server/ts-bindings/QueryEntities.ts b/examples/simulator/server/ts-bindings/QueryEntities.ts deleted file mode 100644 index b5ef9d6af..000000000 --- a/examples/simulator/server/ts-bindings/QueryEntities.ts +++ /dev/null @@ -1,87 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Engine } from "./Engine"; -import type { FsmTypeDecl } from "./FsmTypeDecl"; -import type { Operator } from "./Operator"; -import type { Plan } from "./Plan"; -import type { Port } from "./Port"; -import type { Query } from "./Query"; -import type { QueryGroup } from "./QueryGroup"; -import type { Resource } from "./Resource"; -import type { ResourceGroup } from "./ResourceGroup"; -import type { ResourceGroupTypeDecl } from "./ResourceGroupTypeDecl"; -import type { ResourceTypeDecl } from "./ResourceTypeDecl"; -import type { Worker } from "./Worker"; - -export type QueryEntities = { - /** - * The engine that ran this query. - * - * Is a Resource Group. - */ - engine: Engine; - /** - * The group of this query. - * - * Is a Resource Group. - */ - query_group: QueryGroup; - /** - * The query. - * - * Is a Resource Group. - */ - query: Query; - /** - * The workers of this query. - * - * Is a Resource Group. - */ - workers: { [key in string]: Worker }; - /** - * The plans of this query. - * - * Is a Resource Group. - */ - plans: { [key in string]: Plan }; - /** - * The operators of the plans. - * - * Is a Resource Group. - */ - operators: { [key in string]: Operator }; - /** - * The ports of the operators. - * - * Is a Resource Group. - */ - ports: { [key in string]: Port }; - /** - * Application-specific resource types - */ - resource_types: { [key in string]: ResourceTypeDecl }; - /** - * Resource group types. - * - * This includes declarations for: - * - [`Engine`] - * - [`QueryGroup`] - * - [`Query`] - * - [`Worker`] - * - [`Plan`] - * - [`Operator`] - * - [`Port`] - */ - resource_group_types: { [key in string]: ResourceGroupTypeDecl }; - /** - * Application-specific resources - */ - resources: { [key in string]: Resource }; - /** - * Application-specific resource groups - */ - resource_groups: { [key in string]: ResourceGroup }; - /** - * Application-specific FSMs - */ - fsm_types: { [key in string]: FsmTypeDecl }; -}; diff --git a/examples/simulator/server/ts-bindings/QueryFilter.ts b/examples/simulator/server/ts-bindings/QueryFilter.ts deleted file mode 100644 index f2699e338..000000000 --- a/examples/simulator/server/ts-bindings/QueryFilter.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Global timeline-request parameter identifying the query to report on. - */ -export type QueryFilter = { query_id: string }; diff --git a/examples/simulator/server/ts-bindings/QueryGroup.ts b/examples/simulator/server/ts-bindings/QueryGroup.ts deleted file mode 100644 index 3eb39abd0..000000000 --- a/examples/simulator/server/ts-bindings/QueryGroup.ts +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A group of [`Query`]s. - */ -export type QueryGroup = { - /** - * The ID of this query group. - */ - id: string; - /** - * The name of this query group. - */ - instance_name: string | null; - /** - * The id of the engine this query group was executed on. - */ - engine_id: string | null; -}; diff --git a/examples/simulator/server/ts-bindings/Resource.ts b/examples/simulator/server/ts-bindings/Resource.ts deleted file mode 100644 index 1763c9605..000000000 --- a/examples/simulator/server/ts-bindings/Resource.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A Resource. - */ -export type Resource = { - /** - * The ID of this Resource. - */ - id: string; - /** - * The name of this Resource. - */ - instance_name: string; - /** - * The unique type name of this Resource. - */ - type_name: string; - /** - * The id of the parent resource group. - */ - parent_group_id: string; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceGroup.ts b/examples/simulator/server/ts-bindings/ResourceGroup.ts deleted file mode 100644 index 96c3bd505..000000000 --- a/examples/simulator/server/ts-bindings/ResourceGroup.ts +++ /dev/null @@ -1,26 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A Group of [`Resource`]s. - */ -export type ResourceGroup = { - /** - * The ID of this Resource Group. - */ - id: string; - /** - * The name of the type of Resource Group - */ - type_name: string; - /** - * The name of the instance of this Resource Group. - */ - instance_name: string; - /** - * The parent of this Resource Group. - * - * If this is None, it is considered the root of the global application's - * resource tree. - */ - parent_group_id: string | null; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceGroupNode.ts b/examples/simulator/server/ts-bindings/ResourceGroupNode.ts deleted file mode 100644 index c63bd6f9c..000000000 --- a/examples/simulator/server/ts-bindings/ResourceGroupNode.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ResourceTree } from "./ResourceTree"; - -/** - * A resource group node in a resource tree. - */ -export type ResourceGroupNode = { id: T; children: Array> }; diff --git a/examples/simulator/server/ts-bindings/ResourceGroupTimelineRequest.ts b/examples/simulator/server/ts-bindings/ResourceGroupTimelineRequest.ts deleted file mode 100644 index e36f7819f..000000000 --- a/examples/simulator/server/ts-bindings/ResourceGroupTimelineRequest.ts +++ /dev/null @@ -1,35 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EntityFilter } from "./EntityFilter"; -import type { TimelineConfig } from "./TimelineConfig"; - -/** - * Parameters for requesting a resource group timeline. - */ -export type ResourceGroupTimelineRequest = { - /** - * The ID of the resource group - */ - resource_group_id: string; - /** - * The type name of the leaf resources for which to produce the timeline - * for this group. - */ - resource_type_name: string; - /** - * If set, fully include entities that have usages exceeding this amount of - * time in seconds. - */ - long_entities_threshold_s: number | null; - /** - * Entity filters. - */ - entity_filter: EntityFilter; - /** - * Application-specific request parameters, e.g. for filtering. - */ - app_params: TimelineParams; - /** - * The configuration of the window and number of bins. - */ - config: TimelineConfig; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceGroupTypeDecl.ts b/examples/simulator/server/ts-bindings/ResourceGroupTypeDecl.ts deleted file mode 100644 index 9ccdeb024..000000000 --- a/examples/simulator/server/ts-bindings/ResourceGroupTypeDecl.ts +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A type of [`ResourceGroup`]. - */ -export type ResourceGroupTypeDecl = { - /** - * The name of the type of Resource Group - */ - name: string; - /** - * The type names of the entities that used Resource of this group. - */ - used_by_entity_types: Array; - /** - * The type names of the leaf Resources in this group or its children. - */ - contains_resource_types: Array; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceTimeline.ts b/examples/simulator/server/ts-bindings/ResourceTimeline.ts deleted file mode 100644 index ea32ee2c9..000000000 --- a/examples/simulator/server/ts-bindings/ResourceTimeline.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ResourceTimelineBinned } from "./ResourceTimelineBinned"; -import type { ResourceTimelineBinnedByState } from "./ResourceTimelineBinnedByState"; - -export type ResourceTimeline = { "Binned": ResourceTimelineBinned } | { - "BinnedByState": ResourceTimelineBinnedByState; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceTimelineBinned.ts b/examples/simulator/server/ts-bindings/ResourceTimelineBinned.ts deleted file mode 100644 index 8111328a6..000000000 --- a/examples/simulator/server/ts-bindings/ResourceTimelineBinned.ts +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BinnedSpanSec } from "./BinnedSpanSec"; -import type { FiniteStateMachine } from "./FiniteStateMachine"; - -export type ResourceTimelineBinned = { - /** - * The configuration of the binned timeline. - */ - config: BinnedSpanSec; - /** - * Maps a resource capacity name to a vector where each element holds an - * aggregated value of a time bin. - */ - capacities_values: { [key in string]: Array }; - /** - * FSMs that have usage spans exceeding the long_entities_threshold. - */ - long_fsms: Array; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceTimelineBinnedByState.ts b/examples/simulator/server/ts-bindings/ResourceTimelineBinnedByState.ts deleted file mode 100644 index 4ccf258d5..000000000 --- a/examples/simulator/server/ts-bindings/ResourceTimelineBinnedByState.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BinnedSpanSec } from "./BinnedSpanSec"; -import type { FiniteStateMachine } from "./FiniteStateMachine"; - -export type ResourceTimelineBinnedByState = { - /** - * The configuration of the binned timeline. - */ - config: BinnedSpanSec; - /** - * Maps a resource capacity name to a map of a state name to a vector where - * each element holds an aggregated value of a time bin. - */ - capacities_states_values: { - [key in string]: { [key in string]: Array }; - }; - /** - * FSMs that have usage spans exceeding the long_entities_threshold. - */ - long_fsms: Array; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceTimelineRequest.ts b/examples/simulator/server/ts-bindings/ResourceTimelineRequest.ts deleted file mode 100644 index 408f29e54..000000000 --- a/examples/simulator/server/ts-bindings/ResourceTimelineRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EntityFilter } from "./EntityFilter"; -import type { TimelineConfig } from "./TimelineConfig"; - -/** - * Parameters for requesting a resource timeline. - */ -export type ResourceTimelineRequest = { - /** - * The ID of the resource - */ - resource_id: string; - /** - * If set, fully include entities that have usages exceeding this amount of time. - */ - long_entities_threshold_s: number | null; - /** - * Entity filters. - */ - entity_filter: EntityFilter; - /** - * Application-specific request parameters, e.g. for filtering. - */ - application: TimelineParams; - /** - * The configuration of the window and number of bins. - */ - config: TimelineConfig; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceTree.ts b/examples/simulator/server/ts-bindings/ResourceTree.ts deleted file mode 100644 index 804b9a95b..000000000 --- a/examples/simulator/server/ts-bindings/ResourceTree.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ResourceGroupNode } from "./ResourceGroupNode"; - -/** - * A tree of resources. - */ -export type ResourceTree = { "ResourceGroup": ResourceGroupNode } | { - "Resource": T; -}; diff --git a/examples/simulator/server/ts-bindings/ResourceTypeDecl.ts b/examples/simulator/server/ts-bindings/ResourceTypeDecl.ts deleted file mode 100644 index d47ab9c7c..000000000 --- a/examples/simulator/server/ts-bindings/ResourceTypeDecl.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CapacityDecl } from "./CapacityDecl"; - -/** - * A type of [`Resource`]. - */ -export type ResourceTypeDecl = { - /** - * The unique type name for this type of Resource. - */ - name: string; - /** - * The capacities of this type of Resource. - */ - capacities: Array; - /** - * The type names of the entities that used this Resource. - */ - used_by: Array; -}; diff --git a/examples/simulator/server/ts-bindings/SingleTimelineRequest.ts b/examples/simulator/server/ts-bindings/SingleTimelineRequest.ts deleted file mode 100644 index c927a84e0..000000000 --- a/examples/simulator/server/ts-bindings/SingleTimelineRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TimelineRequest } from "./TimelineRequest"; - -/** - * Request for a single timeline. - */ -export type SingleTimelineRequest = { - /** - * The timeline requested. - */ - entry: TimelineRequest; - /** - * Global application-specific parameters, e.g. filters. - */ - app_params: GlobalParams; -}; diff --git a/examples/simulator/server/ts-bindings/SingleTimelineResponse.ts b/examples/simulator/server/ts-bindings/SingleTimelineResponse.ts deleted file mode 100644 index eed25060b..000000000 --- a/examples/simulator/server/ts-bindings/SingleTimelineResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BinnedSpanSec } from "./BinnedSpanSec"; -import type { ResourceTimeline } from "./ResourceTimeline"; - -export type SingleTimelineResponse = { - /** - * The configuration of the binned timeline. - * - * This may slightly differ from the requested configuration to ensure - * bounds are not exceeded and bin sizes are equal. - */ - config: BinnedSpanSec; - /** - * The data of the response. - */ - data: ResourceTimeline; -}; diff --git a/examples/simulator/server/ts-bindings/Sort.ts b/examples/simulator/server/ts-bindings/Sort.ts deleted file mode 100644 index 328ff3453..000000000 --- a/examples/simulator/server/ts-bindings/Sort.ts +++ /dev/null @@ -1,17 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EntitySortKey } from "./EntitySortKey"; -import type { SortDir } from "./SortDir"; - -/** - * Sorting parameters. - */ -export type Sort = { - /** - * The key to sort on. - */ - key: EntitySortKey; - /** - * The direction to sort in. - */ - dir: SortDir; -}; diff --git a/examples/simulator/server/ts-bindings/SortDir.ts b/examples/simulator/server/ts-bindings/SortDir.ts deleted file mode 100644 index feccd3b5b..000000000 --- a/examples/simulator/server/ts-bindings/SortDir.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The direction to sort in. - */ -export type SortDir = "Asc" | "Desc"; diff --git a/examples/simulator/server/ts-bindings/SpanSec.ts b/examples/simulator/server/ts-bindings/SpanSec.ts deleted file mode 100644 index 395e4b740..000000000 --- a/examples/simulator/server/ts-bindings/SpanSec.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A span of time in seconds. - */ -export type SpanSec = { - /** - * The start time, inclusive. - */ - start: number; - /** - * The end time, exclusive. - */ - end: number; -}; diff --git a/examples/simulator/server/ts-bindings/TimeWindow.ts b/examples/simulator/server/ts-bindings/TimeWindow.ts deleted file mode 100644 index 37ab36ad4..000000000 --- a/examples/simulator/server/ts-bindings/TimeWindow.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A time window, resolved against an epoch supplied at conversion. - */ -export type TimeWindow = { - /** - * The start time of the window in seconds. - */ - start: number; - /** - * The end time of the window in seconds. - */ - end: number; -}; diff --git a/examples/simulator/server/ts-bindings/TimelineConfig.ts b/examples/simulator/server/ts-bindings/TimelineConfig.ts deleted file mode 100644 index 583e3928b..000000000 --- a/examples/simulator/server/ts-bindings/TimelineConfig.ts +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Configuration of the window and number of bins of a timeline. - */ -export type TimelineConfig = { - /** - * The number of bins for binned timelines. - */ - num_bins: number; - /** - * The start time of the time window applied to all timelines in seconds. - */ - start: number; - /** - * The end time of the time window applied to all timelines in seconds. - */ - end: number; -}; diff --git a/examples/simulator/server/ts-bindings/TimelineRequest.ts b/examples/simulator/server/ts-bindings/TimelineRequest.ts deleted file mode 100644 index 3ddd6867b..000000000 --- a/examples/simulator/server/ts-bindings/TimelineRequest.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ResourceGroupTimelineRequest } from "./ResourceGroupTimelineRequest"; -import type { ResourceTimelineRequest } from "./ResourceTimelineRequest"; - -/** - * Timeline request parameters unrelated to timing or binning. - */ -export type TimelineRequest = { - "Resource": ResourceTimelineRequest; -} | { "ResourceGroup": ResourceGroupTimelineRequest }; diff --git a/examples/simulator/server/ts-bindings/Worker.ts b/examples/simulator/server/ts-bindings/Worker.ts deleted file mode 100644 index dcece8607..000000000 --- a/examples/simulator/server/ts-bindings/Worker.ts +++ /dev/null @@ -1,27 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A worker that executed a leaf [`Plan`]. - */ -export type Worker = { - /** - * The ID of this [`Worker`]. - */ - id: string; - /** - * The ID of the [`Engine`] to which this [`Worker`] belongs. - */ - parent_engine_id: string | null; - /** - * The name of this [`Worker`]. - */ - instance_name: string | null; - /** - * The time at which this [`Worker`] started, relative to the engine. - */ - start_unix_ns: bigint | null; - /** - * The time at which this [`Worker`] exited. - */ - end_unix_ns: bigint | null; -}; diff --git a/examples/simulator/ui-bindings/Cargo.toml b/examples/simulator/ui-bindings/Cargo.toml new file mode 100644 index 000000000..36b3c30bd --- /dev/null +++ b/examples/simulator/ui-bindings/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "quent-simulator-ui-bindings" +version.workspace = true +edition.workspace = true +publish.workspace = true + +[dependencies] +quent-query-engine-ui = { path = "../../../domains/query_engine/ui" } +quent-simulator-ui = { path = "../ui" } +quent-ui = { path = "../../../crates/ui" } +ts-rs = { workspace = true, features = ["uuid-impl", "serde-json-impl", "format"] } diff --git a/examples/simulator/server/build.rs b/examples/simulator/ui-bindings/src/lib.rs similarity index 71% rename from examples/simulator/server/build.rs rename to examples/simulator/ui-bindings/src/lib.rs index 5f643a091..0161f3b56 100644 --- a/examples/simulator/server/build.rs +++ b/examples/simulator/ui-bindings/src/lib.rs @@ -1,6 +1,10 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +//! TypeScript binding generation for the simulator UI. + +use std::path::Path; + use quent_query_engine_ui::DataFlowTimelineBinned; use quent_query_engine_ui::{OperatorFilter, QueryBundle, QueryFilter}; use quent_simulator_ui::EntityRef; @@ -12,11 +16,15 @@ use quent_ui::timeline::{ }; use ts_rs::{Config, TS}; -const TS_OUT_DIR: &str = "./ts-bindings/"; - -fn main() -> Result<(), Box> { - // Export TypeScript bindings to ts-bindings directory - let cfg = Config::new().with_out_dir(TS_OUT_DIR); +/// Generates simulator UI TypeScript bindings in `output_dir`. +/// +/// Existing contents of `output_dir` are removed before generation. +pub fn generate(output_dir: &Path) -> Result<(), Box> { + if output_dir.exists() { + std::fs::remove_dir_all(output_dir)?; + } + std::fs::create_dir_all(output_dir)?; + let cfg = Config::new().with_out_dir(output_dir); as TS>::export_all(&cfg)?; diff --git a/examples/simulator/ui-bindings/src/main.rs b/examples/simulator/ui-bindings/src/main.rs new file mode 100644 index 000000000..d8b5785ec --- /dev/null +++ b/examples/simulator/ui-bindings/src/main.rs @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +use std::path::Path; + +fn main() -> Result<(), Box> { + let output_dir = + Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../ui/generated/ts-bindings"); + quent_simulator_ui_bindings::generate(&output_dir) +} diff --git a/ui/README.md b/ui/README.md index d41791b64..1d66c21a8 100644 --- a/ui/README.md +++ b/ui/README.md @@ -22,25 +22,27 @@ A front end for query profiling instrumentation ### Prerequisites -- **Node.js 24.11.0** (enforced via `.nvmrc`, `.node-version`, and Volta) - - Using nvm: `nvm use` or `nvm install` - - Using volta: Automatically switches to correct version - - Using asdf/nodenv: Uses `.node-version` file -- **pnpm 11.5.3** (pinned via `packageManager` and Volta; `>=11.5.3` required) - - Install with `npm install -g pnpm@11.5.3` or see - [pnpm installation](https://pnpm.io/installation) +Install [Pixi](https://pixi.sh), then enter the repository environment: + +```bash +pixi shell +``` + +Pixi provides the required Rust, Node.js, pnpm, and protoc versions. Run UI +development and build commands from this environment. ### Installation 1. Clone the repository (or navigate to the project directory) -2. Install dependencies: +2. Install the UI dependencies: ```bash +cd ui pnpm install ``` -1. (Optional) Configure environment variables: +3. (Optional) Configure environment variables: Create a `.env` file in the root directory and add your API endpoint: @@ -56,6 +58,9 @@ Start the development server: pnpm dev ``` +This generates the TypeScript bindings before starting Vite. Run +`pnpm bindings` after changing Rust types while the dev server remains open. + The app will be available at `http://localhost:5173` The `pnpm start` script is also available as an alias for the Vite development @@ -158,7 +163,8 @@ pnpm dlx shadcn@latest add dropdown-menu - `pnpm dev` - Start development server - `pnpm start` - Start development server -- `pnpm build` - Build for production +- `pnpm bindings` - Generate TypeScript bindings from Rust types +- `pnpm build` - Build the `@quent` packages and application for production - `pnpm preview` - Preview production build - `pnpm lint` - Run ESLint - `pnpm lint:fix` - Fix ESLint errors and format code diff --git a/ui/eslint.config.js b/ui/eslint.config.js index eccd14476..4da4f9e9b 100644 --- a/ui/eslint.config.js +++ b/ui/eslint.config.js @@ -22,6 +22,7 @@ export default tseslint.config( 'examples/**', '**/dist/**', '**/node_modules/**', + 'generated/ts-bindings/**', '.e2e-data/**', 'playwright-report/**', 'test-results/**', diff --git a/ui/package.json b/ui/package.json index 3c6242fa5..2e3cd2409 100644 --- a/ui/package.json +++ b/ui/package.json @@ -14,14 +14,25 @@ }, "scripts": { "preinstall": "npx only-allow pnpm", + "bindings": "cargo run --manifest-path ../Cargo.toml --package quent-simulator-ui-bindings", + "predev": "pnpm bindings", "dev": "vite", + "prestart": "pnpm bindings", "start": "vite", - "build": "tsr generate && tsc && vite build", + "prebuild": "pnpm bindings", + "build": "pnpm ci:build", + "prebuild:app": "pnpm bindings", + "build:app": "pnpm ci:build:app", + "prebuild:packages": "pnpm bindings", + "build:packages": "pnpm --filter '@quent/*' --recursive build:ci", + "ci:build": "pnpm --filter '@quent/*' --recursive build:ci && pnpm ci:build:app", + "ci:build:app": "tsr generate && tsc && vite build", "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"", "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"", "routes:generate": "tsr generate", + "pretypecheck": "pnpm bindings", "typecheck": "tsr generate && tsc --noEmit", "ci:check": "pnpm format:check && pnpm routes:generate && pnpm lint && pnpm typecheck && pnpm test:coverage && pnpm audit --audit-level=high && pnpm test:e2e && pnpm build", "test": "vitest", diff --git a/ui/packages/@quent/client/package.json b/ui/packages/@quent/client/package.json index 2769361a1..03f81e72a 100644 --- a/ui/packages/@quent/client/package.json +++ b/ui/packages/@quent/client/package.json @@ -9,7 +9,10 @@ }, "sideEffects": false, "scripts": { + "prebuild": "pnpm --workspace-root bindings", "build": "tsdown", + "build:ci": "tsdown", + "pretypecheck": "pnpm --workspace-root bindings", "typecheck": "tsc --noEmit" }, "dependencies": { diff --git a/ui/packages/@quent/components/package.json b/ui/packages/@quent/components/package.json index e44e7b39c..d64c7247a 100644 --- a/ui/packages/@quent/components/package.json +++ b/ui/packages/@quent/components/package.json @@ -12,7 +12,10 @@ "**/*.css" ], "scripts": { + "prebuild": "pnpm --workspace-root bindings", "build": "tsdown", + "build:ci": "tsdown", + "pretypecheck": "pnpm --workspace-root bindings", "typecheck": "tsc --noEmit" }, "dependencies": { diff --git a/ui/packages/@quent/hooks/package.json b/ui/packages/@quent/hooks/package.json index a51ea18b8..80067b774 100644 --- a/ui/packages/@quent/hooks/package.json +++ b/ui/packages/@quent/hooks/package.json @@ -10,7 +10,10 @@ }, "sideEffects": false, "scripts": { + "prebuild": "pnpm --workspace-root bindings", "build": "tsdown", + "build:ci": "tsdown", + "pretypecheck": "pnpm --workspace-root bindings", "typecheck": "tsc --noEmit" }, "dependencies": { diff --git a/ui/packages/@quent/utils/package.json b/ui/packages/@quent/utils/package.json index ef26f35d8..e4e9784a8 100644 --- a/ui/packages/@quent/utils/package.json +++ b/ui/packages/@quent/utils/package.json @@ -9,7 +9,10 @@ }, "sideEffects": false, "scripts": { + "prebuild": "pnpm --workspace-root bindings", "build": "tsdown", + "build:ci": "tsdown", + "pretypecheck": "pnpm --workspace-root bindings", "typecheck": "tsc --noEmit" }, "devDependencies": { diff --git a/ui/packages/@quent/utils/src/types/index.ts b/ui/packages/@quent/utils/src/types/index.ts index 609f07da3..a5464e728 100644 --- a/ui/packages/@quent/utils/src/types/index.ts +++ b/ui/packages/@quent/utils/src/types/index.ts @@ -1,60 +1,60 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -export type { DynamicAttribute } from '../../../../../../examples/simulator/server/ts-bindings/DynamicAttribute'; -export type { BinnedSpanSec } from '../../../../../../examples/simulator/server/ts-bindings/BinnedSpanSec'; -export type { BulkTimelineRequest } from '../../../../../../examples/simulator/server/ts-bindings/BulkTimelineRequest'; -export type { BulkTimelinesResponse } from '../../../../../../examples/simulator/server/ts-bindings/BulkTimelinesResponse'; -export type { BulkTimelinesResponseEntry } from '../../../../../../examples/simulator/server/ts-bindings/BulkTimelinesResponseEntry'; -export type { CapacityDecl } from '../../../../../../examples/simulator/server/ts-bindings/CapacityDecl'; -export type { CapacityKind } from '../../../../../../examples/simulator/server/ts-bindings/CapacityKind'; -export type { CategoricalDecl } from '../../../../../../examples/simulator/server/ts-bindings/CategoricalDecl'; -export type { CategoricalSeries } from '../../../../../../examples/simulator/server/ts-bindings/CategoricalSeries'; -export type { CategoricalTimelineRequest } from '../../../../../../examples/simulator/server/ts-bindings/CategoricalTimelineRequest'; -export type { DataFlowTimelineBinned } from '../../../../../../examples/simulator/server/ts-bindings/DataFlowTimelineBinned'; -export type { DimensionKeyDecl } from '../../../../../../examples/simulator/server/ts-bindings/DimensionKeyDecl'; -export type { Edge } from '../../../../../../examples/simulator/server/ts-bindings/Edge'; -export type { Engine } from '../../../../../../examples/simulator/server/ts-bindings/Engine'; -export type { EngineImplementationAttributes } from '../../../../../../examples/simulator/server/ts-bindings/EngineImplementationAttributes'; -export type { EntityFilter } from '../../../../../../examples/simulator/server/ts-bindings/EntityFilter'; -export type { EntityRef } from '../../../../../../examples/simulator/server/ts-bindings/EntityRef'; -export type { FiniteStateMachine } from '../../../../../../examples/simulator/server/ts-bindings/FiniteStateMachine'; -export type { FsmStateTypeDecl } from '../../../../../../examples/simulator/server/ts-bindings/FsmStateTypeDecl'; -export type { FsmTransition } from '../../../../../../examples/simulator/server/ts-bindings/FsmTransition'; -export type { FsmTransitionDecl } from '../../../../../../examples/simulator/server/ts-bindings/FsmTransitionDecl'; -export type { FsmTypeDecl } from '../../../../../../examples/simulator/server/ts-bindings/FsmTypeDecl'; -export type { FsmUsage } from '../../../../../../examples/simulator/server/ts-bindings/FsmUsage'; -export type { DynamicList } from '../../../../../../examples/simulator/server/ts-bindings/DynamicList'; -export type { Operator } from '../../../../../../examples/simulator/server/ts-bindings/Operator'; -export type { OperatorFilter } from '../../../../../../examples/simulator/server/ts-bindings/OperatorFilter'; -export type { OperatorStatistics } from '../../../../../../examples/simulator/server/ts-bindings/OperatorStatistics'; -export type { Plan } from '../../../../../../examples/simulator/server/ts-bindings/Plan'; -export type { PlanTree } from '../../../../../../examples/simulator/server/ts-bindings/PlanTree'; -export type { Port } from '../../../../../../examples/simulator/server/ts-bindings/Port'; -export type { PortStatistics } from '../../../../../../examples/simulator/server/ts-bindings/PortStatistics'; -export type { PrefixSystem } from '../../../../../../examples/simulator/server/ts-bindings/PrefixSystem'; -export type { QuantitySpec } from '../../../../../../examples/simulator/server/ts-bindings/QuantitySpec'; -export type { Query } from '../../../../../../examples/simulator/server/ts-bindings/Query'; -export type { QueryBundle } from '../../../../../../examples/simulator/server/ts-bindings/QueryBundle'; -export type { QueryEntities } from '../../../../../../examples/simulator/server/ts-bindings/QueryEntities'; -export type { QueryFilter } from '../../../../../../examples/simulator/server/ts-bindings/QueryFilter'; -export type { QueryGroup } from '../../../../../../examples/simulator/server/ts-bindings/QueryGroup'; -export type { Resource } from '../../../../../../examples/simulator/server/ts-bindings/Resource'; -export type { ResourceGroup } from '../../../../../../examples/simulator/server/ts-bindings/ResourceGroup'; -export type { ResourceGroupNode } from '../../../../../../examples/simulator/server/ts-bindings/ResourceGroupNode'; -export type { ResourceGroupTimelineRequest } from '../../../../../../examples/simulator/server/ts-bindings/ResourceGroupTimelineRequest'; -export type { ResourceGroupTypeDecl } from '../../../../../../examples/simulator/server/ts-bindings/ResourceGroupTypeDecl'; -export type { ResourceTimeline } from '../../../../../../examples/simulator/server/ts-bindings/ResourceTimeline'; -export type { ResourceTimelineBinned } from '../../../../../../examples/simulator/server/ts-bindings/ResourceTimelineBinned'; -export type { ResourceTimelineBinnedByState } from '../../../../../../examples/simulator/server/ts-bindings/ResourceTimelineBinnedByState'; -export type { ResourceTimelineRequest } from '../../../../../../examples/simulator/server/ts-bindings/ResourceTimelineRequest'; -export type { ResourceTree } from '../../../../../../examples/simulator/server/ts-bindings/ResourceTree'; -export type { ResourceTypeDecl } from '../../../../../../examples/simulator/server/ts-bindings/ResourceTypeDecl'; -export type { SingleTimelineRequest } from '../../../../../../examples/simulator/server/ts-bindings/SingleTimelineRequest'; -export type { SingleTimelineResponse } from '../../../../../../examples/simulator/server/ts-bindings/SingleTimelineResponse'; -export type { SpanSec } from '../../../../../../examples/simulator/server/ts-bindings/SpanSec'; -export type { DynamicStruct } from '../../../../../../examples/simulator/server/ts-bindings/DynamicStruct'; -export type { TimelineConfig } from '../../../../../../examples/simulator/server/ts-bindings/TimelineConfig'; -export type { TimelineRequest } from '../../../../../../examples/simulator/server/ts-bindings/TimelineRequest'; -export type { DynamicValue } from '../../../../../../examples/simulator/server/ts-bindings/DynamicValue'; -export type { Worker } from '../../../../../../examples/simulator/server/ts-bindings/Worker'; +export type { DynamicAttribute } from '../../../../../generated/ts-bindings/DynamicAttribute'; +export type { BinnedSpanSec } from '../../../../../generated/ts-bindings/BinnedSpanSec'; +export type { BulkTimelineRequest } from '../../../../../generated/ts-bindings/BulkTimelineRequest'; +export type { BulkTimelinesResponse } from '../../../../../generated/ts-bindings/BulkTimelinesResponse'; +export type { BulkTimelinesResponseEntry } from '../../../../../generated/ts-bindings/BulkTimelinesResponseEntry'; +export type { CapacityDecl } from '../../../../../generated/ts-bindings/CapacityDecl'; +export type { CapacityKind } from '../../../../../generated/ts-bindings/CapacityKind'; +export type { CategoricalDecl } from '../../../../../generated/ts-bindings/CategoricalDecl'; +export type { CategoricalSeries } from '../../../../../generated/ts-bindings/CategoricalSeries'; +export type { CategoricalTimelineRequest } from '../../../../../generated/ts-bindings/CategoricalTimelineRequest'; +export type { DataFlowTimelineBinned } from '../../../../../generated/ts-bindings/DataFlowTimelineBinned'; +export type { DimensionKeyDecl } from '../../../../../generated/ts-bindings/DimensionKeyDecl'; +export type { Edge } from '../../../../../generated/ts-bindings/Edge'; +export type { Engine } from '../../../../../generated/ts-bindings/Engine'; +export type { EngineImplementationAttributes } from '../../../../../generated/ts-bindings/EngineImplementationAttributes'; +export type { EntityFilter } from '../../../../../generated/ts-bindings/EntityFilter'; +export type { EntityRef } from '../../../../../generated/ts-bindings/EntityRef'; +export type { FiniteStateMachine } from '../../../../../generated/ts-bindings/FiniteStateMachine'; +export type { FsmStateTypeDecl } from '../../../../../generated/ts-bindings/FsmStateTypeDecl'; +export type { FsmTransition } from '../../../../../generated/ts-bindings/FsmTransition'; +export type { FsmTransitionDecl } from '../../../../../generated/ts-bindings/FsmTransitionDecl'; +export type { FsmTypeDecl } from '../../../../../generated/ts-bindings/FsmTypeDecl'; +export type { FsmUsage } from '../../../../../generated/ts-bindings/FsmUsage'; +export type { DynamicList } from '../../../../../generated/ts-bindings/DynamicList'; +export type { Operator } from '../../../../../generated/ts-bindings/Operator'; +export type { OperatorFilter } from '../../../../../generated/ts-bindings/OperatorFilter'; +export type { OperatorStatistics } from '../../../../../generated/ts-bindings/OperatorStatistics'; +export type { Plan } from '../../../../../generated/ts-bindings/Plan'; +export type { PlanTree } from '../../../../../generated/ts-bindings/PlanTree'; +export type { Port } from '../../../../../generated/ts-bindings/Port'; +export type { PortStatistics } from '../../../../../generated/ts-bindings/PortStatistics'; +export type { PrefixSystem } from '../../../../../generated/ts-bindings/PrefixSystem'; +export type { QuantitySpec } from '../../../../../generated/ts-bindings/QuantitySpec'; +export type { Query } from '../../../../../generated/ts-bindings/Query'; +export type { QueryBundle } from '../../../../../generated/ts-bindings/QueryBundle'; +export type { QueryEntities } from '../../../../../generated/ts-bindings/QueryEntities'; +export type { QueryFilter } from '../../../../../generated/ts-bindings/QueryFilter'; +export type { QueryGroup } from '../../../../../generated/ts-bindings/QueryGroup'; +export type { Resource } from '../../../../../generated/ts-bindings/Resource'; +export type { ResourceGroup } from '../../../../../generated/ts-bindings/ResourceGroup'; +export type { ResourceGroupNode } from '../../../../../generated/ts-bindings/ResourceGroupNode'; +export type { ResourceGroupTimelineRequest } from '../../../../../generated/ts-bindings/ResourceGroupTimelineRequest'; +export type { ResourceGroupTypeDecl } from '../../../../../generated/ts-bindings/ResourceGroupTypeDecl'; +export type { ResourceTimeline } from '../../../../../generated/ts-bindings/ResourceTimeline'; +export type { ResourceTimelineBinned } from '../../../../../generated/ts-bindings/ResourceTimelineBinned'; +export type { ResourceTimelineBinnedByState } from '../../../../../generated/ts-bindings/ResourceTimelineBinnedByState'; +export type { ResourceTimelineRequest } from '../../../../../generated/ts-bindings/ResourceTimelineRequest'; +export type { ResourceTree } from '../../../../../generated/ts-bindings/ResourceTree'; +export type { ResourceTypeDecl } from '../../../../../generated/ts-bindings/ResourceTypeDecl'; +export type { SingleTimelineRequest } from '../../../../../generated/ts-bindings/SingleTimelineRequest'; +export type { SingleTimelineResponse } from '../../../../../generated/ts-bindings/SingleTimelineResponse'; +export type { SpanSec } from '../../../../../generated/ts-bindings/SpanSec'; +export type { DynamicStruct } from '../../../../../generated/ts-bindings/DynamicStruct'; +export type { TimelineConfig } from '../../../../../generated/ts-bindings/TimelineConfig'; +export type { TimelineRequest } from '../../../../../generated/ts-bindings/TimelineRequest'; +export type { DynamicValue } from '../../../../../generated/ts-bindings/DynamicValue'; +export type { Worker } from '../../../../../generated/ts-bindings/Worker'; diff --git a/ui/packages/@quent/utils/tsconfig.json b/ui/packages/@quent/utils/tsconfig.json index 97de59990..6adad959e 100644 --- a/ui/packages/@quent/utils/tsconfig.json +++ b/ui/packages/@quent/utils/tsconfig.json @@ -6,7 +6,7 @@ "declarationMap": true, "noEmit": false, "outDir": "./dist", - "rootDir": "../../../.." + "rootDir": "../../.." }, - "include": ["src", "../../../../examples/simulator/server/ts-bindings"] + "include": ["src", "../../../generated/ts-bindings"] } diff --git a/ui/tsconfig.json b/ui/tsconfig.json index 4ede28be8..c24b98e80 100644 --- a/ui/tsconfig.json +++ b/ui/tsconfig.json @@ -24,9 +24,9 @@ /* Path aliases */ "paths": { "@/*": ["./src/*"], - "~quent/types/*": ["../examples/simulator/server/ts-bindings/*"], - }, + "~quent/types/*": ["./generated/ts-bindings/*"] + } }, - "include": ["src", "../examples/simulator/server/ts-bindings"], - "references": [{ "path": "./tsconfig.node.json" }], + "include": ["src", "generated/ts-bindings"], + "references": [{ "path": "./tsconfig.node.json" }] } diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 99e9e171e..4616e4e0f 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -68,7 +68,7 @@ export default defineConfig({ '@': path.resolve(__dirname, './src'), // TODO: Using ts bindings from quent for now this will need to change // to get bindings from webserver when we go that direction - '~quent/types': path.resolve(__dirname, '../examples/simulator/server/ts-bindings'), + '~quent/types': path.resolve(__dirname, 'generated/ts-bindings'), // Force elkjs to use bundled version (avoids web-worker module resolution issues) elkjs: 'elkjs/lib/elk.bundled.js', },