Skip to content

Cube orderBy is not exposed in the WASM TypeScript SDK types #2700

Description

@goldmedal

Context

#2677 adds orderBy to CubeQuery in wren-core, so a cube query can be ranked natively (ORDER BY <ordinal> ASC|DESC) instead of requiring a SQL wrapper. That PR is deliberately scoped to core internals; this issue tracks the WASM/TypeScript consumer surface.

The WASM binding itself needs no change — WrenEngine::cubeQuery takes a JSON string and hands it straight to serde, so orderBy already works at runtime. What is missing is the typed surface: TS callers currently need a cast to pass it.

What to change

  • core/wren-core-wasm/sdk/src/index.ts:51 — CubeQueryInput has no orderBy. Add it plus the accompanying member/direction types, mirroring the Rust shape:

    export type SortDirection = "asc" | "desc";
    
    export interface CubeOrderByInput {
      member: string;
      direction: SortDirection;
    }

    and orderBy?: CubeOrderByInput[]; on CubeQueryInput.

  • docs/core/sdk/wasm.md:261 — the CubeQueryInput interface is duplicated verbatim in the docs and has to be updated in lockstep.

  • core/wren-core-wasm/AGENT_GUIDE.md:152 — the cubeQuery({ ... }) example is the agent-facing description of the input shape; worth showing a ranked query there.

  • core/wren-core-wasm/examples/cube-explorer.html — the form-driven CubeQuery builder has no ordering control, so the feature is not discoverable from the explorer.

Notes

  • Semantics to document: member must name a measure, dimension, or time dimension that the query already selects; each member may appear at most once; omitting orderBy (or passing []) preserves the existing default of ordering by the first time dimension.
  • No change needed in core/wren-core-py — that binding is also JSON-string based, and feat(core): support ordered cube queries #2677 already covers it with tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions