@run-trace/duckdb-wasm 0.0.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.
Files changed (64) hide show
  1. package/README.md +228 -0
  2. package/dist/duckdb-browser-coi.pthread.worker.js +32 -0
  3. package/dist/duckdb-browser-coi.worker.js +31 -0
  4. package/dist/duckdb-browser-eh.worker.js +27 -0
  5. package/dist/duckdb-browser-mvp.worker.js +27 -0
  6. package/dist/duckdb-browser.d.ts +1 -0
  7. package/dist/duckdb-coi.wasm +0 -0
  8. package/dist/duckdb-eh.wasm +0 -0
  9. package/dist/duckdb-mvp.wasm +0 -0
  10. package/dist/duckdb-node-eh.worker.cjs +51 -0
  11. package/dist/duckdb-node-mvp.worker.cjs +51 -0
  12. package/dist/duckdb-node.d.ts +1 -0
  13. package/dist/duckdb-node.mjs +8 -0
  14. package/dist/duckdb-wasm.mjs +1160 -0
  15. package/dist/duckdb-wasm.umd.js +1 -0
  16. package/dist/types/bindings/bindings_base.d.ts +129 -0
  17. package/dist/types/bindings/bindings_browser_base.d.ts +18 -0
  18. package/dist/types/bindings/bindings_browser_coi.d.ts +12 -0
  19. package/dist/types/bindings/bindings_browser_eh.d.ts +12 -0
  20. package/dist/types/bindings/bindings_browser_mvp.d.ts +11 -0
  21. package/dist/types/bindings/bindings_interface.d.ts +44 -0
  22. package/dist/types/bindings/bindings_node_base.d.ts +22 -0
  23. package/dist/types/bindings/bindings_node_eh.d.ts +12 -0
  24. package/dist/types/bindings/bindings_node_mvp.d.ts +12 -0
  25. package/dist/types/bindings/config.d.ts +90 -0
  26. package/dist/types/bindings/connection.d.ts +62 -0
  27. package/dist/types/bindings/duckdb_module.d.ts +13 -0
  28. package/dist/types/bindings/file_stats.d.ts +36 -0
  29. package/dist/types/bindings/index.d.ts +11 -0
  30. package/dist/types/bindings/insert_options.d.ts +31 -0
  31. package/dist/types/bindings/progress.d.ts +9 -0
  32. package/dist/types/bindings/runtime.d.ts +99 -0
  33. package/dist/types/bindings/runtime_browser.d.ts +13 -0
  34. package/dist/types/bindings/runtime_node.d.ts +8 -0
  35. package/dist/types/bindings/tokens.d.ts +12 -0
  36. package/dist/types/bindings/udf_function.d.ts +13 -0
  37. package/dist/types/bindings/udf_runtime.d.ts +3 -0
  38. package/dist/types/bindings/web_file.d.ts +12 -0
  39. package/dist/types/duckdb.d.ts +8 -0
  40. package/dist/types/index.d.ts +11 -0
  41. package/dist/types/log.d.ts +61 -0
  42. package/dist/types/parallel/async_bindings.d.ts +137 -0
  43. package/dist/types/parallel/async_bindings_interface.d.ts +27 -0
  44. package/dist/types/parallel/async_connection.d.ts +64 -0
  45. package/dist/types/parallel/index.d.ts +5 -0
  46. package/dist/types/parallel/worker_dispatcher.d.ts +22 -0
  47. package/dist/types/parallel/worker_request.d.ts +101 -0
  48. package/dist/types/platform.d.ts +38 -0
  49. package/dist/types/sql_field.d.ts +14 -0
  50. package/dist/types/status.d.ts +7 -0
  51. package/dist/types/targets/duckdb-browser-coi.pthread.worker.d.ts +1 -0
  52. package/dist/types/targets/duckdb-browser-coi.worker.d.ts +2 -0
  53. package/dist/types/targets/duckdb-browser-eh.worker.d.ts +2 -0
  54. package/dist/types/targets/duckdb-browser-mvp.worker.d.ts +2 -0
  55. package/dist/types/targets/duckdb-node-eh.worker.d.ts +2 -0
  56. package/dist/types/targets/duckdb-node-mvp.worker.d.ts +2 -0
  57. package/dist/types/targets/duckdb.d.ts +10 -0
  58. package/dist/types/utils/binary_dump.d.ts +1 -0
  59. package/dist/types/utils/index.d.ts +2 -0
  60. package/dist/types/utils/opfs_util.d.ts +4 -0
  61. package/dist/types/utils/s3_helper.d.ts +27 -0
  62. package/dist/types/worker.d.ts +1 -0
  63. package/dist/types/worker_node.d.ts +6 -0
  64. package/package.json +89 -0
@@ -0,0 +1,38 @@
1
+ export declare const isNode: () => boolean;
2
+ export declare const isFirefox: () => boolean;
3
+ export declare const isSafari: () => boolean;
4
+ /** Bundles have different characteristics:
5
+ * - MVP: minimum viable product (uses features from first stable version of WebAssembly standard)
6
+ * - EH: exception handling
7
+ * - COI: cross origin isolation
8
+ */
9
+ export interface DuckDBBundles {
10
+ mvp: {
11
+ mainModule: string;
12
+ mainWorker: string;
13
+ };
14
+ eh?: {
15
+ mainModule: string;
16
+ mainWorker: string;
17
+ };
18
+ coi?: {
19
+ mainModule: string;
20
+ mainWorker: string;
21
+ pthreadWorker: string;
22
+ };
23
+ }
24
+ export interface DuckDBBundle {
25
+ mainModule: string;
26
+ mainWorker: string | null;
27
+ pthreadWorker: string | null;
28
+ }
29
+ export interface PlatformFeatures {
30
+ bigInt64Array: boolean;
31
+ crossOriginIsolated: boolean;
32
+ wasmExceptions: boolean;
33
+ wasmSIMD: boolean;
34
+ wasmBulkMemory: boolean;
35
+ wasmThreads: boolean;
36
+ }
37
+ export declare function getPlatformFeatures(): Promise<PlatformFeatures>;
38
+ export declare function selectBundle(bundles: DuckDBBundles): Promise<DuckDBBundle>;
@@ -0,0 +1,14 @@
1
+ export type SQLField = SQLType & {
2
+ name: string;
3
+ };
4
+ export interface SQLType {
5
+ sqlType: string;
6
+ nullable?: boolean;
7
+ precision?: number;
8
+ scale?: number;
9
+ timezone?: string;
10
+ byteWidth?: number;
11
+ keyType?: SQLType;
12
+ valueType?: SQLType;
13
+ fields?: SQLField[];
14
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum StatusCode {
2
+ SUCCESS = 0,
3
+ MAX_ARROW_ERROR = 255,
4
+ DUCKDB_WASM_RETRY = 256
5
+ }
6
+ export declare function IsArrowBuffer(status: StatusCode): boolean;
7
+ export declare function IsDuckDBWasmRetry(status: StatusCode): boolean;
@@ -0,0 +1,2 @@
1
+ /** Register the worker */
2
+ export declare function registerWorker(): void;
@@ -0,0 +1,2 @@
1
+ /** Register the worker */
2
+ export declare function registerWorker(): void;
@@ -0,0 +1,2 @@
1
+ /** Register the worker */
2
+ export declare function registerWorker(): void;
@@ -0,0 +1,2 @@
1
+ /** Register the worker */
2
+ export declare function registerWorker(): void;
@@ -0,0 +1,2 @@
1
+ /** Register the worker */
2
+ export declare function registerWorker(): void;
@@ -0,0 +1,10 @@
1
+ export * from '../bindings/config.js';
2
+ export * from '../bindings/tokens.js';
3
+ export * from '../log.js';
4
+ export * from '../status.js';
5
+ export * from '../parallel/index.js';
6
+ export * from '../platform.js';
7
+ export * from '../worker.js';
8
+ export type { InstantiationProgress, InstantiationProgressHandler } from '../bindings/progress.js';
9
+ export type { DuckDBDataProtocol } from '../bindings/runtime.js';
10
+ export type { WebFile } from '../bindings/web_file.js';
@@ -0,0 +1 @@
1
+ export declare function dumpBuffer(src: Uint8Array): string;
@@ -0,0 +1,2 @@
1
+ export * from './binary_dump';
2
+ export * from './s3_helper';
@@ -0,0 +1,4 @@
1
+ export declare const REGEX_OPFS_FILE: RegExp;
2
+ export declare const REGEX_OPFS_PROTOCOL: RegExp;
3
+ export declare function isOPFSProtocol(path: string): boolean;
4
+ export declare function searchOPFSFiles(text: string): string[];
@@ -0,0 +1,27 @@
1
+ import { S3Config } from '../bindings';
2
+ export interface S3Params {
3
+ url: string;
4
+ query: string;
5
+ host: string;
6
+ region: string;
7
+ service: string;
8
+ method: string;
9
+ accessKeyId: string;
10
+ secretAccessKey: string;
11
+ sessionToken: string;
12
+ dateNow: string;
13
+ datetimeNow: string;
14
+ }
15
+ export interface S3PayloadParams {
16
+ contentHash: string | null;
17
+ contentType: string | null;
18
+ }
19
+ export declare function getS3Params(config: S3Config | undefined, url: string, method: string): S3Params;
20
+ export declare function uriEncode(input: string, encode_slash?: boolean): string;
21
+ export declare function createS3Headers(params: S3Params, payloadParams?: S3PayloadParams | null): Map<string, string>;
22
+ export declare function addS3Headers(xhr: XMLHttpRequest, config: S3Config | undefined, url: string, method: string, contentType?: string | null, payload?: Uint8Array | null): void;
23
+ export declare function parseS3Url(url: string): {
24
+ bucket: string;
25
+ path: string;
26
+ };
27
+ export declare function getHTTPUrl(config: S3Config | undefined, url: string): string;
@@ -0,0 +1 @@
1
+ export declare function createWorker(url: string): Promise<Worker>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Creates a Node.js worker_threads Worker with Web Worker API compatibility.
3
+ * Shims globalThis.postMessage/onmessage inside the worker via parentPort,
4
+ * and wraps the main-thread handle with addEventListener/postMessage.
5
+ */
6
+ export declare function createWorker(workerPath: string): Worker;
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@run-trace/duckdb-wasm",
3
+ "version": "0.0.1",
4
+ "description": "A custom build of DuckDB-WASM with linked extensions, wasmfs, and example rust functions.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/trace-github/duckdb-wasm.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "keywords": [
14
+ "wasm",
15
+ "duckdb"
16
+ ],
17
+ "devDependencies": {
18
+ "@types/emscripten": "^1.40.1",
19
+ "@types/node": "^24.0.3",
20
+ "@uwdata/flechette": "^2.0.1",
21
+ "eslint": "^9.29.0",
22
+ "js-sha256": "^0.11.1",
23
+ "rimraf": "^6.0.1",
24
+ "typescript": "^5.8.3",
25
+ "typescript-eslint": "^8.34.1",
26
+ "vite": "^6.3.5",
27
+ "vitest": "^3.2.4",
28
+ "wasm-feature-detect": "^1.8.0",
29
+ "web-worker": "^1.5.0"
30
+ },
31
+ "scripts": {
32
+ "prebuild": "rimraf dist && mkdir dist",
33
+ "build": "vite build && npm run bundle && tsc",
34
+ "lint": "eslint src test",
35
+ "test": "vitest run",
36
+ "dev": "npm run bundle && vite",
37
+ "bundle:debug": "node bin/bundle.mjs debug",
38
+ "bundle": "node bin/bundle.mjs release",
39
+ "format": "prettier --write \"**/*.+(js|ts)\""
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "!dist/tests-*",
44
+ "!dist/**/*.map",
45
+ "!dist/types/test"
46
+ ],
47
+ "main": "dist/duckdb-wasm.mjs",
48
+ "module": "dist/duckdb-wasm.mjs",
49
+ "types": "dist/duckdb-browser.d.ts",
50
+ "jsdelivr": "dist/duckdb-wasm.mjs",
51
+ "unpkg": "dist/duckdb-wasm.mjs",
52
+ "sideEffects": false,
53
+ "browser": {
54
+ "fs": false,
55
+ "path": false,
56
+ "perf_hooks": false,
57
+ "os": false,
58
+ "worker_threads": false
59
+ },
60
+ "exports": {
61
+ "./dist/duckdb-mvp.wasm": "./dist/duckdb-mvp.wasm",
62
+ "./dist/duckdb-eh.wasm": "./dist/duckdb-eh.wasm",
63
+ "./dist/duckdb-coi.wasm": "./dist/duckdb-coi.wasm",
64
+ "./dist/duckdb-browser": "./dist/duckdb-wasm.mjs",
65
+ "./dist/duckdb-wasm.mjs": "./dist/duckdb-wasm.mjs",
66
+ "./dist/duckdb-wasm.umd.js": "./dist/duckdb-wasm.umd.js",
67
+ "./dist/duckdb-browser-coi.pthread.worker.js": "./dist/duckdb-browser-coi.pthread.worker.js",
68
+ "./dist/duckdb-browser-coi.worker.js": "./dist/duckdb-browser-coi.worker.js",
69
+ "./dist/duckdb-browser-eh.worker.js": "./dist/duckdb-browser-eh.worker.js",
70
+ "./dist/duckdb-browser-mvp.worker.js": "./dist/duckdb-browser-mvp.worker.js",
71
+ "./dist/duckdb-node-mvp.worker.cjs": "./dist/duckdb-node-mvp.worker.cjs",
72
+ "./dist/duckdb-node-eh.worker.cjs": "./dist/duckdb-node-eh.worker.cjs",
73
+ "./dist/duckdb-node.mjs": "./dist/duckdb-node.mjs",
74
+ ".": {
75
+ "browser": {
76
+ "types": "./dist/duckdb-browser.d.ts",
77
+ "import": "./dist/duckdb-wasm.mjs",
78
+ "require": "./dist/duckdb-wasm.umd.js"
79
+ },
80
+ "types": "./dist/duckdb-browser.d.ts",
81
+ "import": "./dist/duckdb-wasm.mjs",
82
+ "require": "./dist/duckdb-wasm.umd.js"
83
+ },
84
+ "./node": {
85
+ "types": "./dist/duckdb-node.d.ts",
86
+ "import": "./dist/duckdb-node.mjs"
87
+ }
88
+ }
89
+ }