@visactor/vquery 0.1.32 → 0.1.34

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.
@@ -5,7 +5,7 @@ export declare class DuckDB {
5
5
  /**
6
6
  * @description 初始化 DuckDB 实例
7
7
  */
8
- instantiate: () => Promise<void>;
8
+ init: () => Promise<void>;
9
9
  /**
10
10
  * @description 释放 DuckDB 实例
11
11
  */
package/dist/index.cjs CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
+ return 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
+ }();
2
5
  var __webpack_require__ = {};
3
6
  (()=>{
4
7
  __webpack_require__.d = (exports1, definition)=>{
@@ -31,9 +34,18 @@ class DuckDB {
31
34
  db = null;
32
35
  connection = null;
33
36
  constructor(){}
34
- instantiate = async ()=>{
35
- const JSDELIVR_BUNDLES = (0, duckdb_wasm_namespaceObject.getJsDelivrBundles)();
36
- const bundle = await (0, duckdb_wasm_namespaceObject.selectBundle)(JSDELIVR_BUNDLES);
37
+ init = async ()=>{
38
+ const MANUAL_BUNDLES = {
39
+ mvp: {
40
+ mainModule: new URL('@duckdb/duckdb-wasm/dist/duckdb-mvp.wasm', __rslib_import_meta_url__).href,
41
+ mainWorker: new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js', __rslib_import_meta_url__).toString()
42
+ },
43
+ eh: {
44
+ mainModule: new URL('@duckdb/duckdb-wasm/dist/duckdb-eh.wasm', __rslib_import_meta_url__).href,
45
+ mainWorker: new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', __rslib_import_meta_url__).toString()
46
+ }
47
+ };
48
+ const bundle = await (0, duckdb_wasm_namespaceObject.selectBundle)(MANUAL_BUNDLES);
37
49
  const worker_url = URL.createObjectURL(new Blob([
38
50
  `importScripts("${bundle.mainWorker}");`
39
51
  ], {
@@ -165,8 +177,8 @@ class VQuery {
165
177
  this.duckDB = new DuckDB();
166
178
  this.indexedDB = new IndexedDB(dbName);
167
179
  }
168
- instantiate = async ()=>{
169
- await this.duckDB.instantiate();
180
+ init = async ()=>{
181
+ await this.duckDB.init();
170
182
  await this.indexedDB.open();
171
183
  };
172
184
  close = async ()=>{
package/dist/index.d.ts CHANGED
@@ -1,41 +1 @@
1
- export declare class VQuery {
2
- private duckDB;
3
- private indexedDB;
4
- constructor(dbName?: string);
5
- /**
6
- * @description 初始化数据库
7
- */
8
- instantiate: () => Promise<void>;
9
- /**
10
- * @description 关闭数据库
11
- */
12
- close: () => Promise<void>;
13
- /**
14
- * @description 注册文件
15
- * @param fileName 文件名
16
- * @param source 文件内容
17
- */
18
- writeFile: (fileName: string, source: string | ArrayBuffer | Uint8Array | Blob) => Promise<void>;
19
- /**
20
- * @description 从 IndexedDB 读取文件并注册到 DuckDB
21
- * @param fileName 文件名
22
- */
23
- readFile: (fileName: string) => Promise<void>;
24
- /**
25
- * @description 列出 IndexedDB 中的所有文件
26
- */
27
- listFiles: () => Promise<string[]>;
28
- /**
29
- * @description 执行 SQL 查询
30
- * @param sql SQL 语句
31
- */
32
- query: (sql: string) => Promise<{
33
- performance: {
34
- startAt: string;
35
- endAt: string;
36
- duration: number;
37
- };
38
- dataset: any[];
39
- table: any;
40
- }>;
41
- }
1
+ export { VQuery } from './vquery';
package/dist/index.js CHANGED
@@ -1,11 +1,20 @@
1
- import { AsyncDuckDB, ConsoleLogger, getJsDelivrBundles, selectBundle } from "@duckdb/duckdb-wasm";
1
+ import { AsyncDuckDB, ConsoleLogger, selectBundle } from "@duckdb/duckdb-wasm";
2
2
  class DuckDB {
3
3
  db = null;
4
4
  connection = null;
5
5
  constructor(){}
6
- instantiate = async ()=>{
7
- const JSDELIVR_BUNDLES = getJsDelivrBundles();
8
- const bundle = await selectBundle(JSDELIVR_BUNDLES);
6
+ init = async ()=>{
7
+ const MANUAL_BUNDLES = {
8
+ mvp: {
9
+ mainModule: new URL('@duckdb/duckdb-wasm/dist/duckdb-mvp.wasm', import.meta.url).href,
10
+ mainWorker: new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js', import.meta.url).toString()
11
+ },
12
+ eh: {
13
+ mainModule: new URL('@duckdb/duckdb-wasm/dist/duckdb-eh.wasm', import.meta.url).href,
14
+ mainWorker: new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', import.meta.url).toString()
15
+ }
16
+ };
17
+ const bundle = await selectBundle(MANUAL_BUNDLES);
9
18
  const worker_url = URL.createObjectURL(new Blob([
10
19
  `importScripts("${bundle.mainWorker}");`
11
20
  ], {
@@ -137,8 +146,8 @@ class VQuery {
137
146
  this.duckDB = new DuckDB();
138
147
  this.indexedDB = new IndexedDB(dbName);
139
148
  }
140
- instantiate = async ()=>{
141
- await this.duckDB.instantiate();
149
+ init = async ()=>{
150
+ await this.duckDB.init();
142
151
  await this.indexedDB.open();
143
152
  };
144
153
  close = async ()=>{
@@ -0,0 +1,41 @@
1
+ export declare class VQuery {
2
+ private duckDB;
3
+ private indexedDB;
4
+ constructor(dbName?: string);
5
+ /**
6
+ * @description 初始化数据库
7
+ */
8
+ init: () => Promise<void>;
9
+ /**
10
+ * @description 关闭数据库
11
+ */
12
+ close: () => Promise<void>;
13
+ /**
14
+ * @description 注册文件
15
+ * @param fileName 文件名
16
+ * @param source 文件内容
17
+ */
18
+ writeFile: (fileName: string, source: string | ArrayBuffer | Uint8Array | Blob) => Promise<void>;
19
+ /**
20
+ * @description 从 IndexedDB 读取文件并注册到 DuckDB
21
+ * @param fileName 文件名
22
+ */
23
+ readFile: (fileName: string) => Promise<void>;
24
+ /**
25
+ * @description 列出 IndexedDB 中的所有文件
26
+ */
27
+ listFiles: () => Promise<string[]>;
28
+ /**
29
+ * @description 执行 SQL 查询
30
+ * @param sql SQL 语句
31
+ */
32
+ query: (sql: string) => Promise<{
33
+ performance: {
34
+ startAt: string;
35
+ endAt: string;
36
+ duration: number;
37
+ };
38
+ dataset: any[];
39
+ table: any;
40
+ }>;
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vquery",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {