@motherduck/wasm-client 0.8.1 → 1.5.2-r.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motherduck/wasm-client",
3
- "version": "0.8.1",
3
+ "version": "1.5.2-r.2",
4
4
  "description": "Client library for MotherDuck-enabled DuckDB powered by WebAssembly (WASM)",
5
5
  "license": "MIT",
6
6
  "browser": "index.js",
@@ -41,6 +41,12 @@ export interface LoadMotherDuckWasmExtensionOptions {
41
41
  * Default: 'workspace' (attaches all available MotherDuck databases)
42
42
  */
43
43
  attachMode?: 'single' | 'workspace';
44
+ /**
45
+ * Set the MotherDuck session_name.
46
+ *
47
+ * See https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/connecting-to-motherduck/#annotating-queries-with-session-names
48
+ */
49
+ sessionName?: string;
44
50
  /**
45
51
  * Skip the "welcome pack", the first message exchange between the MotherDuck client and server.
46
52
  */
@@ -1,5 +1,4 @@
1
1
  export * from './fetchMotherDuckExtensionVersion.js';
2
- export * from './fetchMotherDuckUIVersion.js';
3
2
  export * from './loadMotherDuckWasmExtension.js';
4
3
  export * from './LoadMotherDuckWasmExtensionOptions.js';
5
4
  export * from './MotherDuckEvent.js';
@@ -1,3 +1,9 @@
1
1
  import { AsyncDuckDB } from '././@duckdb/duckdb-wasm';
2
2
  export declare function getDuckDBInstance(): Promise<AsyncDuckDB> | AsyncDuckDB | null;
3
3
  export declare function setDuckDBInstance(instance: Promise<AsyncDuckDB> | AsyncDuckDB): void;
4
+ export declare function clearDuckDBInstance(): void;
5
+ /**
6
+ * Terminate the DuckDB WASM instance (kills the Web Worker + frees WASM memory)
7
+ * and clear the singleton so the next call to getAsyncDuckDb() re-initializes.
8
+ */
9
+ export declare function terminateDuckDB(): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { AsyncPreparedStatement, ScriptTokens, TokenType } from '././@duckdb/duckdb-wasm';
2
- import { MDConnectionParams } from './MDConnectionParams';
3
- import { MaterializedQueryResult, SafePrepareResult, SafeQueryResult, StreamingQueryResult } from './QueryTypes';
2
+ import { MDConnectionParams } from './MDConnectionParams.js';
3
+ import { MaterializedQueryResult, SafePrepareResult, SafeQueryResult, StreamingQueryResult } from './QueryTypes.js';
4
4
  export { AsyncPreparedStatement, ScriptTokens, TokenType };
5
5
  export declare class MDConnection {
6
6
  readonly params: MDConnectionParams;
@@ -11,18 +11,18 @@ export declare class MDConnection {
11
11
  isInitialized(): Promise<boolean>;
12
12
  tokenize(text: string): Promise<ScriptTokens>;
13
13
  incompleteQueryCount(): number;
14
- enqueueQuery(query: string, args?: any[]): string;
14
+ enqueueQuery(query: string, args?: unknown[]): string;
15
15
  safePrepareQuery(query: string): Promise<SafePrepareResult>;
16
16
  safeEvaluateQuery(query: string): Promise<SafeQueryResult<MaterializedQueryResult>>;
17
- safeEvaluatePreparedStatement(query: string, ...args: any[]): Promise<SafeQueryResult<MaterializedQueryResult>>;
17
+ safeEvaluatePreparedStatement(query: string, ...args: unknown[]): Promise<SafeQueryResult<MaterializedQueryResult>>;
18
18
  safeEvaluateStreamingQuery(query: string): Promise<SafeQueryResult<StreamingQueryResult>>;
19
- safeEvaluateStreamingPreparedStatement(query: string, args: any[]): Promise<SafeQueryResult<StreamingQueryResult>>;
19
+ safeEvaluateStreamingPreparedStatement(query: string, args: unknown[]): Promise<SafeQueryResult<StreamingQueryResult>>;
20
20
  safeEvaluateQueuedQuery(queryId: string): Promise<SafeQueryResult<MaterializedQueryResult>>;
21
21
  prepareQuery(query: string): Promise<AsyncPreparedStatement>;
22
22
  evaluateQuery(query: string): Promise<MaterializedQueryResult>;
23
- evaluatePreparedStatement(query: string, args: any[]): Promise<MaterializedQueryResult>;
23
+ evaluatePreparedStatement(query: string, args: unknown[]): Promise<MaterializedQueryResult>;
24
24
  evaluateStreamingQuery(query: string): Promise<StreamingQueryResult>;
25
- evaluateStreamingPreparedStatement(query: string, args: any[]): Promise<StreamingQueryResult>;
25
+ evaluateStreamingPreparedStatement(query: string, args: unknown[]): Promise<StreamingQueryResult>;
26
26
  private evaluateExclusive;
27
27
  evaluateQueuedQuery(queryId: string): Promise<MaterializedQueryResult>;
28
28
  cancelQuery(queryId: string, errorMessage?: string): Promise<boolean>;
@@ -1,4 +1,5 @@
1
1
  import { ConsoleLike } from '././@motherduck/task-sequencer';
2
+ import { MDWasmEnvironement } from './environment.js';
2
3
  export { ConsoleLike };
3
4
  export interface MDConnectionParams {
4
5
  mdToken: string;
@@ -10,6 +11,10 @@ export interface MDConnectionParams {
10
11
  extensionVersion?: string;
11
12
  enableDebugLogging?: boolean;
12
13
  customUserAgent?: string;
14
+ databasePath?: string;
15
+ accessMode?: 'automatic' | 'read_only' | 'read_write';
13
16
  attachMode?: 'single' | 'workspace';
17
+ sessionName?: string;
14
18
  skipWelcomePack?: boolean;
19
+ mdWasmEnvironment?: MDWasmEnvironement;
15
20
  }
@@ -1,12 +1,12 @@
1
1
  import { AsyncDuckDBConnection } from '././@duckdb/duckdb-wasm';
2
2
  import { Task } from '././@motherduck/task-sequencer';
3
- import { MaterializedQueryResult } from './QueryTypes';
3
+ import { MaterializedQueryResult } from './QueryTypes.js';
4
4
  export declare class MaterializedQueryTask implements Task<MaterializedQueryResult> {
5
5
  private connection;
6
6
  private deferredConnection;
7
7
  private query;
8
8
  private args?;
9
- constructor(connection: Promise<AsyncDuckDBConnection>, query: string, args?: any[]);
9
+ constructor(connection: Promise<AsyncDuckDBConnection>, query: string, args?: unknown[]);
10
10
  run(): Promise<MaterializedQueryResult>;
11
11
  cancel(): Promise<boolean>;
12
12
  private getConnection;
@@ -1,12 +1,12 @@
1
1
  import { AsyncDuckDBConnection } from '././@duckdb/duckdb-wasm';
2
2
  import { Task } from '././@motherduck/task-sequencer';
3
- import { StreamingQueryResult } from './QueryTypes';
3
+ import { StreamingQueryResult } from './QueryTypes.js';
4
4
  export declare class StreamingQueryTask implements Task<StreamingQueryResult> {
5
5
  private connection;
6
6
  private deferredConnection;
7
7
  private query;
8
8
  private args?;
9
- constructor(connection: Promise<AsyncDuckDBConnection>, query: string, args?: any[]);
9
+ constructor(connection: Promise<AsyncDuckDBConnection>, query: string, args?: unknown[]);
10
10
  run(): Promise<StreamingQueryResult>;
11
11
  cancel(): Promise<boolean>;
12
12
  private getConnection;
@@ -0,0 +1,9 @@
1
+ import { DuckDBBundles } from '././@duckdb/duckdb-wasm';
2
+ /**
3
+ * Constructs DuckDB bundle URLs using the duckdb-wasm package version.
4
+ *
5
+ * Assets are served from the persistent store at
6
+ * `{baseUrl}/duckdb-wasm-assets/{version}/` with original filenames
7
+ * (e.g. `duckdb-eh.wasm`, `duckdb-browser-eh.worker.js`).
8
+ */
9
+ export declare function buildDuckDBBundleURLs(baseUrl: string, includeCOI: boolean | undefined): DuckDBBundles;
@@ -1,3 +1,3 @@
1
1
  import { AsyncDuckDBConnection } from '././@duckdb/duckdb-wasm';
2
- import { MDConnectionParams } from './MDConnectionParams';
2
+ import { MDConnectionParams } from './MDConnectionParams.js';
3
3
  export declare function createDuckDbConnection(params: MDConnectionParams): Promise<AsyncDuckDBConnection>;
@@ -0,0 +1,2 @@
1
+ import { DuckDBAccessMode } from '././@duckdb/duckdb-wasm';
2
+ export declare function duckdbAccessModeFromString(input: string | undefined): DuckDBAccessMode | undefined;
@@ -0,0 +1,6 @@
1
+ export type MDWasmEnvironmentVariable = 'MDWasmUseCooperativeNetwork';
2
+ export type MDWasmEnvironement = Partial<Record<MDWasmEnvironmentVariable, string>>;
3
+ export declare function createFragmentURLFromEnvironment(environment: MDWasmEnvironement): string;
4
+ export declare function parseFragmentURLToEnvironment(fragment: string): {
5
+ [key: string]: string;
6
+ };
@@ -1,4 +1,4 @@
1
1
  import { AsyncDuckDB } from '././@duckdb/duckdb-wasm';
2
- import { MDConnectionParams } from './MDConnectionParams';
2
+ import { MDConnectionParams } from './MDConnectionParams.js';
3
3
  export { AsyncDuckDB };
4
4
  export declare function getAsyncDuckDb(params: MDConnectionParams): Promise<AsyncDuckDB>;
package/types/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  export * from '././@duckdb/data-reader';
2
2
  export * from '././@duckdb/data-types';
3
3
  export * from '././@duckdb/data-values';
4
- export { MotherDuckCatalogChangeEvent, MotherDuckCatalogChangeEventDetail, MotherDuckEvent, MotherDuckEventBase, MotherDuckEventType } from '././@motherduck/wasm-extension';
5
- export * from './getAsyncDuckDb';
6
- export * from './MDConnection';
7
- export * from './MDConnectionParams';
8
- export * from './QueryTypes';
9
- export * from './readLocalFS';
10
- export * from './registerFiles';
4
+ export { MotherDuckCatalogChangeEvent, MotherDuckCatalogChangeEventDetail, MotherDuckEvent, MotherDuckEventBase, MotherDuckEventType, } from '././@motherduck/wasm-extension';
5
+ export { terminateDuckDB } from './DuckDBInstance.js';
6
+ export * from './getAsyncDuckDb.js';
7
+ export * from './MDConnection.js';
8
+ export * from './MDConnectionParams.js';
9
+ export * from './QueryTypes.js';
10
+ export * from './readLocalFS.js';
11
+ export * from './registerFiles.js';
12
+ export * from './environment.js';
@@ -1,3 +1,3 @@
1
1
  import { AsyncDuckDB } from '././@duckdb/duckdb-wasm';
2
- import { MDConnectionParams } from './MDConnectionParams';
2
+ import { MDConnectionParams } from './MDConnectionParams.js';
3
3
  export declare function instantiateDB(params: MDConnectionParams): Promise<AsyncDuckDB>;
@@ -1,5 +1,5 @@
1
1
  import { DuckDBDataProtocol, WebFile } from '././@duckdb/duckdb-wasm';
2
- import { MDConnectionParams } from './MDConnectionParams';
2
+ import { MDConnectionParams } from './MDConnectionParams.js';
3
3
  export { DuckDBDataProtocol, WebFile };
4
4
  /**
5
5
  * Read local data files from wasm db
@@ -1,4 +1,4 @@
1
- import { MDConnectionParams } from './MDConnectionParams';
1
+ import { MDConnectionParams } from './MDConnectionParams.js';
2
2
  /**
3
3
  * Register the files within DuckDB WASM
4
4
  */
@@ -1,2 +0,0 @@
1
- import { DuckDBBundles } from '././@duckdb/duckdb-wasm';
2
- export declare function fetchDuckDBBundlesFromDuckDBAssets(duckDBAssetsURLPrefix: string, version: string | undefined, includeCOI: boolean | undefined): Promise<DuckDBBundles>;
@@ -1 +0,0 @@
1
- export declare function getVersionSuffix(version?: string): string;
@@ -1,2 +0,0 @@
1
- import { DuckDBBundles } from '././@duckdb/duckdb-wasm';
2
- export declare function isDuckDBBundles(input: unknown): input is DuckDBBundles;
@@ -1,2 +0,0 @@
1
- import { DuckDBBundles } from '././@duckdb/duckdb-wasm';
2
- export declare function prefixDuckDBBundles(prefix: string, bundles: DuckDBBundles, includeCOI: boolean | undefined): DuckDBBundles;