Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,108 changes: 480 additions & 628 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/backend/src/anywidget/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function makeDatabaseConnector(model: AnyModel<Model>): Connector {
} else {
switch (msg.type) {
case "arrow": {
const table = decodeIPC(buffers[0].buffer as any);
const table = decodeIPC(buffers[0].buffer);
query.resolve(table);
break;
}
Expand Down
10 changes: 5 additions & 5 deletions packages/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
}
},
"peerDependencies": {
"@uwdata/mosaic-core": ">=0.15.0",
"@uwdata/mosaic-sql": ">=0.15.0",
"@uwdata/mosaic-core": ">=0.19.0",
"@uwdata/mosaic-sql": ">=0.19.0",
"svelte": ">=5.0.0"
},
"peerDependenciesMeta": {
Expand All @@ -39,9 +39,9 @@
"@sveltejs/vite-plugin-svelte": "^6.1.0",
"@tsconfig/svelte": "^5.0.4",
"@types/d3-color": "^3.1.3",
"@uwdata/mosaic-core": ">=0.18.0",
"@uwdata/mosaic-sql": ">=0.18.0",
"@uwdata/vgplot": ">=0.18.0",
"@uwdata/mosaic-core": ">=0.19.0",
"@uwdata/mosaic-sql": ">=0.19.0",
"@uwdata/vgplot": ">=0.19.0",
"@webgpu/types": "^0.1.64",
"d3-color": "^3.1.0",
"fast-kde": "0.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/demo/EmbeddingViewMosaicDemo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
await db.registerFileText("rows.json", JSON.stringify(dataset));
await (await db.connect()).insertJSONFromPath("rows.json", { name: "data_table" });

let r: any = await coordinator().query("SELECT COUNT(*) AS count FROM data_table");
let r = await coordinator().query("SELECT COUNT(*) AS count FROM data_table");
pointCount = r.get(0).count;

brush = vg.Selection.crossfilter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- Copyright (c) 2025 Apple Inc. Licensed under MIT License. -->
<script lang="ts">
import { coordinator as defaultCoordinator, isSelection, type MosaicClient } from "@uwdata/mosaic-core";
import { coordinator as defaultCoordinator, isSelection, makeClient, type MosaicClient } from "@uwdata/mosaic-core";
import * as SQL from "@uwdata/mosaic-sql";
import { untrack } from "svelte";

Expand All @@ -14,7 +14,6 @@
predicateForRangeSelection,
queryApproximateDensity,
} from "./mosaic_client.js";
import { makeClient } from "./mosaic_helper.js";
import type { DataPoint, DataPointID } from "./types.js";
import {
textSummarizerAdd,
Expand Down Expand Up @@ -90,7 +89,7 @@
// A client is a thing that queries data from a selection with user-defined query
client = makeClient({
coordinator: deps.coordinator,
selection: filter,
selection: filter ?? undefined,
query: (predicate) => {
return SQL.Query.from(source.table)
.select({
Expand All @@ -100,7 +99,7 @@
})
.where(predicate);
},
queryResult: (data) => {
queryResult: (data: any) => {
let xArray = data.getChild("x").toArray();
let yArray = data.getChild("y").toArray();
let categoryArray = data.getChild("c")?.toArray() ?? null;
Expand Down Expand Up @@ -346,7 +345,7 @@
let chunkSize = 10000;
let lastAdd: Promise<unknown> | null = null;
while (true) {
let r: any = await coordinator.query(
let r = await coordinator.query(
SQL.Query.from(table)
.select({ x: SQL.column(x), y: SQL.column(y), text: SQL.column(text) })
.offset(start)
Expand Down
11 changes: 5 additions & 6 deletions packages/component/src/lib/embedding_view/mosaic_client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) 2025 Apple Inc. Licensed under MIT License.

import type { Table } from "@uwdata/flechette";
import type { Coordinator } from "@uwdata/mosaic-core";
import * as SQL from "@uwdata/mosaic-sql";

Expand Down Expand Up @@ -108,7 +107,7 @@ export async function queryApproximateDensity(
}> {
let { x, y, table } = source;
// Find the view transform that fits all data points in a square view.
let r = (await coordinator.query(
let r = await coordinator.query(
SQL.Query.from(table).select({
centerX: SQL.sql`MEDIAN(${SQL.column(x)})`,
centerY: SQL.sql`MEDIAN(${SQL.column(y)})`,
Expand All @@ -120,7 +119,7 @@ export async function queryApproximateDensity(
}
: {}),
}),
)) as Table;
);
let { centerX, centerY, stdX, stdY, maxCategory } = r.get(0);
let scaler = 1.0 / (Math.max(stdX, stdY, 1e-3) * 3);

Expand All @@ -140,7 +139,7 @@ export async function queryApproximateDensity(
maxCount: SQL.sql`MAX(count)::INT`,
});

r = (await coordinator.query(q)) as Table;
r = await coordinator.query(q);
let { maxCount, totalCount } = r.get(0);
let maxDensity = maxCount / (binWidth * binWidth);

Expand Down Expand Up @@ -233,7 +232,7 @@ export class DataPointQuery {
q = q.where(predicate);
}
q = q.orderby(SQL.sql`(x - (${px}))**2 + (y - (${py}))**2`).limit(1);
let result = (await this.coordinator.query(q)) as Table;
let result = await this.coordinator.query(q);
let point = result.get(0);
if (point) {
this.lastDistance = Math.max(Math.abs(point.x - px), Math.abs(point.y - py)) * 4;
Expand All @@ -255,7 +254,7 @@ export class DataPointQuery {
identifiers.map((x) => SQL.literal(x)),
),
);
let result = Array.from((await this.coordinator.query(q)) as Table);
let result = Array.from(await this.coordinator.query(q));
return result.map((row) => this._convertToDataPoint(row));
}
}
66 changes: 0 additions & 66 deletions packages/component/src/lib/embedding_view/mosaic_helper.ts

This file was deleted.

8 changes: 4 additions & 4 deletions packages/embedding-atlas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
},
"dependencies": {},
"peerDependencies": {
"@uwdata/mosaic-core": ">=0.15.0",
"@uwdata/mosaic-spec": ">=0.15.0",
"@uwdata/mosaic-sql": ">=0.15.0",
"@uwdata/vgplot": ">=0.15.0",
"@uwdata/mosaic-core": ">=0.19.0",
"@uwdata/mosaic-spec": ">=0.19.0",
"@uwdata/mosaic-sql": ">=0.19.0",
"@uwdata/vgplot": ">=0.19.0",
"react": ">=17.0.0",
"svelte": ">=5.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"@tsconfig/svelte": "^5.0.4",
"@types/react": "^19.1.12",
"@types/react-dom": "^19.1.9",
"@uwdata/mosaic-core": ">=0.18.0",
"@uwdata/mosaic-spec": ">=0.18.0",
"@uwdata/mosaic-sql": ">=0.18.0",
"@uwdata/vgplot": ">=0.18.0",
"@uwdata/mosaic-core": ">=0.19.0",
"@uwdata/mosaic-spec": ">=0.19.0",
"@uwdata/mosaic-sql": ">=0.19.0",
"@uwdata/vgplot": ">=0.19.0",
"postcss": "^8.5.6",
"react": "^19.1.1",
"react-dom": "^19.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
await db.registerFileText("rows.json", JSON.stringify(dataset));
await (await db.connect()).insertJSONFromPath("rows.json", { name: "data_table" });

let r: any = await coordinator.query("SELECT COUNT(*) AS count FROM data_table");
let r = await coordinator.query("SELECT COUNT(*) AS count FROM data_table");
pointCount = r.get(0).count;

brush = vg.Selection.crossfilter();
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/src/svelte/TableExample.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const wasm = await wasmConnector();
coordinator.databaseConnector(wasm);
await createSampleDataTable(coordinator, "dataset", 100000);
let describe: any = await coordinator.query("DESCRIBE dataset");
let describe = await coordinator.query("DESCRIBE dataset");
columns = Array.from(describe.getChild("column_name"));
})();
</script>
Expand Down
4 changes: 2 additions & 2 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
}
},
"peerDependencies": {
"@uwdata/mosaic-core": ">=0.15.0",
"@uwdata/mosaic-sql": ">=0.15.0",
"@uwdata/mosaic-core": ">=0.19.0",
"@uwdata/mosaic-sql": ">=0.19.0",
"svelte": "^5.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/table/src/lib/controllers/TableController.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export class TableController {
.from("original")
.where(eq(column(this.rowKeyColumn!), literal(rowKey)));

const result: any = await this.coordinator.query(query);
const result = await this.coordinator.query(query);
const arr = result.toArray();
if (arr.length > 0) {
const offset = arr[0][OID] - 1;
Expand Down Expand Up @@ -431,7 +431,7 @@ export class TableController {
}, {});

const query = Query.from(tableName).select(select).offset(0).limit(10);
const sample: any = await this.coordinator.query(query);
const sample = await this.coordinator.query(query);
const arr = sample.toArray();
for (const row of arr) {
for (const col of cols) {
Expand Down
8 changes: 4 additions & 4 deletions packages/viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
}
},
"peerDependencies": {
"@uwdata/mosaic-core": ">=0.15.0",
"@uwdata/mosaic-spec": ">=0.15.0",
"@uwdata/mosaic-sql": ">=0.15.0",
"@uwdata/vgplot": ">=0.15.0"
"@uwdata/mosaic-core": ">=0.19.0",
"@uwdata/mosaic-spec": ">=0.19.0",
"@uwdata/mosaic-sql": ">=0.19.0",
"@uwdata/vgplot": ">=0.19.0"
},
"devDependencies": {
"@embedding-atlas/component": "*",
Expand Down
4 changes: 2 additions & 2 deletions packages/viewer/src/AdhocViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
let db = await (coordinator.databaseConnector()! as DuckDBWASMConnector).getDuckDB();
await db.registerFileBuffer(file.name, new Uint8Array(await file.arrayBuffer()));
await coordinator.exec(`CREATE TABLE dataset AS SELECT * FROM ${literal(file.name)}`);
let describeResult: any = await coordinator.query(`DESCRIBE TABLE dataset`);
describe = Array.from(describeResult);
let describeResult = await coordinator.query(`DESCRIBE TABLE dataset`);
describe = Array.from(describeResult) as typeof describe;
await coordinator.exec(`
ALTER TABLE dataset DROP COLUMN IF EXISTS __row_index__;
ALTER TABLE dataset ADD COLUMN __row_index__ INTEGER;
Expand Down
2 changes: 1 addition & 1 deletion packages/viewer/src/embedding/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function* inputBatches(
valueColumn: string,
batchSize: number,
): AsyncGenerator<any> {
let r: any = await coordinator.query(SQL.Query.from(table).select({ count: SQL.count() }));
let r = await coordinator.query(SQL.Query.from(table).select({ count: SQL.count() }));
let count = r.get(0).count;
let start = 0;
while (start < count) {
Expand Down
16 changes: 4 additions & 12 deletions packages/viewer/src/lib/EmbeddingAtlas.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import { Context } from "./contexts.js";
import { CustomOverlay, CustomTooltip } from "./custom_components.js";
import { makeDarkModeStore } from "./dark_mode_store.js";
import { TableInfo, type ColumnDesc, type EmbeddingLegend } from "./database_utils.js";
import { predicateToString, TableInfo, type ColumnDesc, type EmbeddingLegend } from "./database_utils.js";
import type { Plot } from "./plots/plot.js";
import { PlotStateStoreManager } from "./plots/plot_state_store.js";
import { getRenderer, type ColumnStyle } from "./renderers/index.js";
Expand Down Expand Up @@ -112,15 +112,7 @@
const crossFilter = vg.Selection.crossfilter();

function currentPredicate(): string | null {
let predicate: any = crossFilter.predicate(null as any);
if (predicate == null || predicate.length == 0) {
return null;
}
if (typeof predicate == "string") {
return predicate;
}
let joined = predicate.map((x: any) => x.toString()).join(" AND ");
return joined;
return predicateToString(crossFilter.predicate(null));
}

let columns: ColumnDesc[] = $state.raw([]);
Expand Down Expand Up @@ -338,15 +330,15 @@
if (data.projection == null) {
return;
}
let result: any = await coordinator.query(
let result = await coordinator.query(
SQL.Query.from(data.table)
.select({
x: SQL.column(data.projection.x),
y: SQL.column(data.projection.y),
})
.where(SQL.eq(SQL.column(data.id), SQL.literal(identifier))),
);
let item: { x: number; y: number } = result.get(0);
let item = result.get(0) as { x: number; y: number };
x = item.x;
y = item.y;
}
Expand Down
Loading