@sqlrooms/mosaic 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/use-mosaic.d.ts +0 -6
- package/dist/use-mosaic.d.ts.map +1 -1
- package/dist/use-mosaic.js +17 -12
- package/dist/use-mosaic.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* {@include ../README.md}
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
5
|
+
export { useMosaic } from './use-mosaic';
|
|
6
6
|
export { VgPlotChart } from './VgPlotChart';
|
|
7
7
|
export type { Spec } from '@uwdata/mosaic-spec';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\nexport {useMosaic} from './use-mosaic';\nexport {VgPlotChart} from './VgPlotChart';\nexport type {Spec} from '@uwdata/mosaic-spec';\n"]}
|
package/dist/use-mosaic.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieves a Mosaic connector for the DuckDB database.
|
|
3
|
-
*
|
|
4
|
-
* @returns {Promise<MosaicConnector>} The Mosaic connector for the DuckDB database.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getMosaicConnector(): Promise<(db?: any) => any>;
|
|
7
1
|
/**
|
|
8
2
|
* Hook to manage the Mosaic connector.
|
|
9
3
|
*
|
package/dist/use-mosaic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mosaic.d.ts","sourceRoot":"","sources":["../src/use-mosaic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-mosaic.d.ts","sourceRoot":"","sources":["../src/use-mosaic.ts"],"names":[],"mappings":"AAmCA;;;;GAIG;AACH,wBAAgB,SAAS;;;EAUxB"}
|
package/dist/use-mosaic.js
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDuckDb, WasmDuckDbConnector, } from '@sqlrooms/duckdb';
|
|
2
2
|
import { coordinator, wasmConnector } from '@uwdata/mosaic-core';
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
let
|
|
4
|
+
let mosaicConnector;
|
|
5
|
+
// TODO: Create MosaicSlice and keep the connector in the store
|
|
5
6
|
/**
|
|
6
7
|
* Retrieves a Mosaic connector for the DuckDB database.
|
|
7
8
|
*
|
|
8
9
|
* @returns {Promise<MosaicConnector>} The Mosaic connector for the DuckDB database.
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
return
|
|
11
|
+
async function getMosaicConnector(duckDb) {
|
|
12
|
+
if (mosaicConnector) {
|
|
13
|
+
return mosaicConnector;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (!(duckDb instanceof WasmDuckDbConnector)) {
|
|
16
|
+
throw new Error('Only WasmDuckDbConnector is currently supported');
|
|
17
|
+
}
|
|
18
|
+
await duckDb.initialize();
|
|
19
|
+
mosaicConnector = await coordinator().databaseConnector(wasmConnector({
|
|
20
|
+
duckDb: duckDb.getDb(),
|
|
21
|
+
connection: duckDb.getConnection(),
|
|
18
22
|
}));
|
|
19
|
-
return
|
|
23
|
+
return mosaicConnector;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* Hook to manage the Mosaic connector.
|
|
@@ -26,11 +30,12 @@ export async function getMosaicConnector() {
|
|
|
26
30
|
export function useMosaic() {
|
|
27
31
|
const [isLoading, setIsLoading] = useState(true);
|
|
28
32
|
const [connector, setConnector] = useState();
|
|
33
|
+
const duckDb = useDuckDb();
|
|
29
34
|
useEffect(() => {
|
|
30
|
-
getMosaicConnector()
|
|
35
|
+
getMosaicConnector(duckDb)
|
|
31
36
|
.then(setConnector)
|
|
32
37
|
.finally(() => setIsLoading(false));
|
|
33
|
-
}, []);
|
|
38
|
+
}, [duckDb]);
|
|
34
39
|
return { isMosaicLoading: isLoading, mosaicConnector: connector };
|
|
35
40
|
}
|
|
36
41
|
//# sourceMappingURL=use-mosaic.js.map
|
package/dist/use-mosaic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mosaic.js","sourceRoot":"","sources":["../src/use-mosaic.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-mosaic.js","sourceRoot":"","sources":["../src/use-mosaic.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,mBAAmB,GACp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DbConnector,\n useDuckDb,\n WasmDuckDbConnector,\n} from '@sqlrooms/duckdb';\nimport {coordinator, wasmConnector} from '@uwdata/mosaic-core';\nimport {useEffect, useState} from 'react';\n\ntype MosaicConnector = ReturnType<typeof coordinator>['databaseConnector'];\nlet mosaicConnector: MosaicConnector;\n\n// TODO: Create MosaicSlice and keep the connector in the store\n\n/**\n * Retrieves a Mosaic connector for the DuckDB database.\n *\n * @returns {Promise<MosaicConnector>} The Mosaic connector for the DuckDB database.\n */\nasync function getMosaicConnector(duckDb: DuckDbConnector) {\n if (mosaicConnector) {\n return mosaicConnector;\n }\n if (!(duckDb instanceof WasmDuckDbConnector)) {\n throw new Error('Only WasmDuckDbConnector is currently supported');\n }\n await duckDb.initialize();\n mosaicConnector = await coordinator().databaseConnector(\n wasmConnector({\n duckDb: duckDb.getDb(),\n connection: duckDb.getConnection(),\n }),\n );\n return mosaicConnector;\n}\n\n/**\n * Hook to manage the Mosaic connector.\n *\n * @returns {Object} An object containing the Mosaic connector and a loading state.\n */\nexport function useMosaic() {\n const [isLoading, setIsLoading] = useState(true);\n const [connector, setConnector] = useState<MosaicConnector>();\n const duckDb = useDuckDb();\n useEffect(() => {\n getMosaicConnector(duckDb)\n .then(setConnector)\n .finally(() => setIsLoading(false));\n }, [duckDb]);\n return {isMosaicLoading: isLoading, mosaicConnector: connector};\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/mosaic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@ai-sdk/provider": "^1.0.7",
|
|
23
|
-
"@sqlrooms/duckdb": "0.
|
|
23
|
+
"@sqlrooms/duckdb": "0.9.1",
|
|
24
24
|
"@uwdata/mosaic-core": "^0.12.2",
|
|
25
25
|
"@uwdata/mosaic-spec": "^0.12.2",
|
|
26
26
|
"@uwdata/vgplot": "^0.12.2"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"lint": "eslint .",
|
|
36
36
|
"typedoc": "typedoc"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "8ffc60d215729cae38631a5037866c193c7520e9"
|
|
39
39
|
}
|