@motherduck/wasm-client 0.6.1 → 0.6.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.
Files changed (55) hide show
  1. package/README.md +38 -22
  2. package/index.js +1 -1
  3. package/index_with_arrow.js +11 -11
  4. package/package.json +2 -2
  5. package/types/DuckDBInstance.d.ts +3 -0
  6. package/types/{api.d.ts → MDConnection.d.ts} +6 -4
  7. package/types/MDConnectionParams.d.ts +11 -0
  8. package/types/QueryTypes.d.ts +17 -5
  9. package/types/TaskSequencer.d.ts +1 -0
  10. package/types/createDuckDbConnection.d.ts +3 -0
  11. package/types/fetchDuckDBAssets.d.ts +17 -0
  12. package/types/fetchVersion.d.ts +1 -0
  13. package/types/genConnectionId.d.ts +1 -0
  14. package/types/getAsyncDuckDb.d.ts +3 -0
  15. package/types/getDuckDBBundlesFromDuckDBAssets.d.ts +2 -0
  16. package/types/getVersionSuffix.d.ts +1 -0
  17. package/types/index.d.ts +9 -9
  18. package/types/instantiateDB.d.ts +2 -0
  19. package/types/{duckdb/files.d.ts → readLocalFS.d.ts} +1 -5
  20. package/types/recursivelyPrefix.d.ts +1 -0
  21. package/types/registerFiles.d.ts +5 -0
  22. package/types/transformQueryError.d.ts +2 -0
  23. package/types/urlPathConcat.d.ts +1 -0
  24. package/types/arrow/AsyncDuckDBRecordBatchIterator.d.ts +0 -13
  25. package/types/arrow/DuckDBRecordBatch.d.ts +0 -14
  26. package/types/arrow/TypedTypeMap.d.ts +0 -2
  27. package/types/arrow/duckDBTypeFromArrowType.d.ts +0 -4
  28. package/types/arrow/duckDBValueFromArrowData.d.ts +0 -8
  29. package/types/createDeferred.d.ts +0 -6
  30. package/types/duckdb/AsyncDuckDBDataBatchIterator.d.ts +0 -3
  31. package/types/duckdb/DuckDBData.d.ts +0 -56
  32. package/types/duckdb/DuckDBDataReader.d.ts +0 -68
  33. package/types/duckdb/DuckDBRow.d.ts +0 -4
  34. package/types/duckdb/conversion/dateTimeStringConversion.d.ts +0 -12
  35. package/types/duckdb/conversion/displayStringForDuckDBValue.d.ts +0 -2
  36. package/types/duckdb/conversion/stringFromBlob.d.ts +0 -2
  37. package/types/duckdb/conversion/stringFromDecimal.d.ts +0 -18
  38. package/types/duckdb/values/DuckDBBlob.d.ts +0 -6
  39. package/types/duckdb/values/DuckDBDate.d.ts +0 -6
  40. package/types/duckdb/values/DuckDBDecimal.d.ts +0 -10
  41. package/types/duckdb/values/DuckDBInterval.d.ts +0 -8
  42. package/types/duckdb/values/DuckDBList.d.ts +0 -7
  43. package/types/duckdb/values/DuckDBMap.d.ts +0 -7
  44. package/types/duckdb/values/DuckDBMapEntry.d.ts +0 -5
  45. package/types/duckdb/values/DuckDBStruct.d.ts +0 -7
  46. package/types/duckdb/values/DuckDBStructEntry.d.ts +0 -5
  47. package/types/duckdb/values/DuckDBTime.d.ts +0 -6
  48. package/types/duckdb/values/DuckDBTimestampMicroseconds.d.ts +0 -8
  49. package/types/duckdb/values/DuckDBTimestampMilliseconds.d.ts +0 -6
  50. package/types/duckdb/values/DuckDBTimestampNanoseconds.d.ts +0 -6
  51. package/types/duckdb/values/DuckDBTimestampSeconds.d.ts +0 -6
  52. package/types/duckdb/values/DuckDBValue.d.ts +0 -2
  53. package/types/duckdb/values/SpecialDuckDBValue.d.ts +0 -4
  54. package/types/duckdb/values/index.d.ts +0 -16
  55. package/types/duckdb/worker_factory.d.ts +0 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motherduck/wasm-client",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Client library for MotherDuck-enabled DuckDB powered by WebAssembly (WASM)",
5
5
  "browser": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  }
16
16
  },
17
17
  "peerDependencies": {
18
- "apache-arrow": "^15.0.0"
18
+ "apache-arrow": "^16.0.0"
19
19
  },
20
20
  "scripts": {}
21
21
  }
@@ -0,0 +1,3 @@
1
+ import { AsyncDuckDB } from '@duckdb/duckdb-wasm';
2
+ export declare function getDuckDBInstance(): Promise<AsyncDuckDB> | AsyncDuckDB | null;
3
+ export declare function setDuckDBInstance(instance: Promise<AsyncDuckDB> | AsyncDuckDB): void;
@@ -1,7 +1,7 @@
1
- import { ScriptTokens, /*StreamToTableOptions,*/ TokenType } from '@duckdb/duckdb-wasm';
2
- import { MaterializedQueryResult, SafeQueryResult, StreamingQueryResult } from './QueryTypes';
3
- import { MDConnectionParams } from './duckdb/worker_factory';
4
- export { ScriptTokens, /*StreamToTableOptions,*/ TokenType };
1
+ import { AsyncPreparedStatement, ScriptTokens, TokenType } from '@duckdb/duckdb-wasm';
2
+ import { MDConnectionParams } from './MDConnectionParams';
3
+ import { MaterializedQueryResult, SafePrepareResult, SafeQueryResult, StreamingQueryResult } from './QueryTypes';
4
+ export { ScriptTokens, TokenType };
5
5
  export declare class MDConnection {
6
6
  readonly params: MDConnectionParams;
7
7
  private deferredDdbConnection;
@@ -17,11 +17,13 @@ export declare class MDConnection {
17
17
  tokenize(text: string): Promise<ScriptTokens>;
18
18
  incompleteQueryCount(): number;
19
19
  enqueueQuery(query: string, args?: any[]): string;
20
+ safePrepareQuery(query: string): Promise<SafePrepareResult>;
20
21
  safeEvaluateQuery(query: string): Promise<SafeQueryResult<MaterializedQueryResult>>;
21
22
  safeEvaluatePreparedStatement(query: string, ...args: any[]): Promise<SafeQueryResult<MaterializedQueryResult>>;
22
23
  safeEvaluateStreamingQuery(query: string): Promise<SafeQueryResult<StreamingQueryResult>>;
23
24
  safeEvaluateStreamingPreparedStatement(query: string, args: any[]): Promise<SafeQueryResult<StreamingQueryResult>>;
24
25
  safeEvaluateQueuedQuery(queryId: string): Promise<SafeQueryResult<MaterializedQueryResult>>;
26
+ prepareQuery(query: string): Promise<AsyncPreparedStatement>;
25
27
  evaluateQuery(query: string): Promise<MaterializedQueryResult>;
26
28
  evaluatePreparedStatement(query: string, args: any[]): Promise<MaterializedQueryResult>;
27
29
  evaluateStreamingQuery(query: string): Promise<StreamingQueryResult>;
@@ -0,0 +1,11 @@
1
+ import { LogSink } from './LogSink';
2
+ export interface MDConnectionParams {
3
+ mdToken: string;
4
+ mdServerURL?: string;
5
+ duckDBAssetsURLPrefix?: string;
6
+ useDuckDBWasmCOI?: boolean;
7
+ logSink?: LogSink;
8
+ skipWelcomePack?: boolean;
9
+ version?: string;
10
+ enableDebugLogging?: boolean;
11
+ }
@@ -1,8 +1,7 @@
1
- import { AsyncRecordBatchStreamReader } from 'apache-arrow';
2
- import { TypedTypeMap } from './arrow/TypedTypeMap';
3
- import { AsyncDuckDBDataBatchIterator } from './duckdb/AsyncDuckDBDataBatchIterator';
4
- import { DuckDBData } from './duckdb/DuckDBData';
5
- import { DuckDBDataReader } from './duckdb/DuckDBDataReader';
1
+ import { AsyncPreparedStatement } from '@duckdb/duckdb-wasm';
2
+ import { TypedTypeMap } from '@motherduck/duckdb-arrow';
3
+ import { AsyncDuckDBDataBatchIterator, DuckDBData, DuckDBDataReader } from '@motherduck/duckdb-data';
4
+ import { AsyncRecordBatchStreamReader, DataType } from 'apache-arrow';
6
5
  export interface MaterializedQueryResult {
7
6
  type: 'materialized';
8
7
  startTimeMs: number;
@@ -45,3 +44,16 @@ export interface QueryError {
45
44
  err: Error;
46
45
  }
47
46
  export type SafeQueryResult<T extends QueryResult> = QuerySuccess<T> | QueryError;
47
+ export type PrepareSuccess<T extends {
48
+ [key: string]: DataType;
49
+ } = any> = {
50
+ status: 'success';
51
+ preparedStatement: AsyncPreparedStatement<T>;
52
+ };
53
+ export type PrepareError = {
54
+ status: 'error';
55
+ err: Error;
56
+ };
57
+ export type SafePrepareResult<T extends {
58
+ [key: string]: DataType;
59
+ } = any> = PrepareSuccess<T> | PrepareError;
@@ -1,3 +1,4 @@
1
+ import 'core-js/actual/promise/with-resolvers';
1
2
  import { LogSink } from './LogSink';
2
3
  /**
3
4
  * Represents a task that can be sequenced by TaskSequencer.
@@ -0,0 +1,3 @@
1
+ import { AsyncDuckDBConnection } from '@duckdb/duckdb-wasm';
2
+ import { MDConnectionParams } from './MDConnectionParams';
3
+ export declare function createDuckDbConnection(params: MDConnectionParams): Promise<AsyncDuckDBConnection>;
@@ -0,0 +1,17 @@
1
+ export declare function fetchDuckDBAssets(duckDBAssetsURLPrefix: string, version?: string): Promise<{
2
+ coi?: {
3
+ mainModule: string;
4
+ mainWorker: string;
5
+ pthreadWorker: string;
6
+ };
7
+ mvp?: {
8
+ mainModule: string;
9
+ mainWorker: string;
10
+ pthreadWorker: undefined;
11
+ };
12
+ eh?: {
13
+ mainModule: string;
14
+ mainWorker: string;
15
+ pthreadWorker: undefined;
16
+ };
17
+ }>;
@@ -0,0 +1 @@
1
+ export declare function fetchVersion(duckDBAssetsURLPrefix: string): Promise<string | undefined>;
@@ -0,0 +1 @@
1
+ export declare function genConnectionId(): string;
@@ -0,0 +1,3 @@
1
+ import { AsyncDuckDB } from '@duckdb/duckdb-wasm';
2
+ import { MDConnectionParams } from './MDConnectionParams';
3
+ export declare function getAsyncDuckDb(params: MDConnectionParams): Promise<AsyncDuckDB>;
@@ -0,0 +1,2 @@
1
+ import { DuckDBBundles } from '@duckdb/duckdb-wasm';
2
+ export declare function getDuckDBBundlesFromDuckDBAssets(duckDBAssetsURLPrefix: string, version: string | undefined, includeCOI: boolean | undefined): Promise<DuckDBBundles>;
@@ -0,0 +1 @@
1
+ export declare function getVersionSuffix(version?: string): string;
package/types/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
+ export { TypedTypeMap } from '@motherduck/duckdb-arrow';
2
+ export * from '@motherduck/duckdb-data';
1
3
  export * from '@motherduck/duckdb-types';
4
+ export * from '@motherduck/duckdb-values';
5
+ export { MotherDuckCatalogChangeEvent, MotherDuckCatalogChangeEventDetail, MotherDuckEvent, MotherDuckEventBase, MotherDuckEventType } from '@motherduck/wasm-extension';
6
+ export * from './getAsyncDuckDb';
7
+ export * from './MDConnection';
8
+ export * from './MDConnectionParams';
2
9
  export * from './QueryTypes';
3
- export * from './api';
4
- export * from './arrow/TypedTypeMap';
5
- export * from './duckdb/AsyncDuckDBDataBatchIterator';
6
- export * from './duckdb/DuckDBData';
7
- export * from './duckdb/DuckDBDataReader';
8
- export * from './duckdb/DuckDBRow';
9
- export * from './duckdb/files';
10
- export * from './duckdb/values';
11
- export { CATALOG_CHANGE_EVENT, MDConnectionParams, getAsyncDuckDb } from './duckdb/worker_factory';
10
+ export * from './readLocalFS';
11
+ export * from './registerFiles';
@@ -0,0 +1,2 @@
1
+ import { MDConnectionParams } from './MDConnectionParams';
2
+ export declare function instantiateDB(params: MDConnectionParams): Promise<import("@duckdb/duckdb-wasm").AsyncDuckDB>;
@@ -1,9 +1,5 @@
1
1
  import { WebFile } from '@duckdb/duckdb-wasm';
2
- import { MDConnectionParams } from './worker_factory';
3
- /**
4
- * Register the files within DuckDB WASM
5
- */
6
- export declare function registerFiles(params: MDConnectionParams, files: FileList): Promise<void>;
2
+ import { MDConnectionParams } from './MDConnectionParams';
7
3
  /**
8
4
  * Read local data files from wasm db
9
5
  *
@@ -0,0 +1 @@
1
+ export declare function recursivelyPrefix(prefix: string, json: any): any;
@@ -0,0 +1,5 @@
1
+ import { MDConnectionParams } from './MDConnectionParams';
2
+ /**
3
+ * Register the files within DuckDB WASM
4
+ */
5
+ export declare function registerFiles(params: MDConnectionParams, files: FileList): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { QueryResult } from './QueryTypes';
2
+ export declare function transformQueryError(reason: any): QueryResult;
@@ -0,0 +1 @@
1
+ export declare function urlPathConcat(url: string, path: string): string;
@@ -1,13 +0,0 @@
1
- import { RecordBatch } from 'apache-arrow';
2
- import { AsyncDuckDBDataBatchIterator, DuckDBDataBatchIteratorResult } from '../duckdb/AsyncDuckDBDataBatchIterator';
3
- import { DuckDBData } from '../duckdb/DuckDBData';
4
- import { TypedTypeMap } from './TypedTypeMap';
5
- export type AsyncRecordBatchIterator = AsyncIterator<RecordBatch<TypedTypeMap>, RecordBatch<TypedTypeMap> | undefined>;
6
- export declare class AsyncDuckDBRecordBatchIterator implements AsyncDuckDBDataBatchIterator {
7
- private recordBatchIterator;
8
- constructor(recordBatchIterator: AsyncRecordBatchIterator);
9
- next(): Promise<DuckDBDataBatchIteratorResult>;
10
- return(value?: DuckDBData): Promise<DuckDBDataBatchIteratorResult>;
11
- throw(e?: any): Promise<DuckDBDataBatchIteratorResult>;
12
- [Symbol.asyncIterator](): AsyncDuckDBDataBatchIterator;
13
- }
@@ -1,14 +0,0 @@
1
- import { DuckDBType } from '@motherduck/duckdb-types';
2
- import { RecordBatch } from 'apache-arrow';
3
- import { DuckDBData } from '../duckdb/DuckDBData';
4
- import { DuckDBValue } from '../duckdb/values';
5
- import { TypedTypeMap } from './TypedTypeMap';
6
- export declare class DuckDBRecordBatch extends DuckDBData {
7
- private recordBatch;
8
- constructor(recordBatch: RecordBatch<TypedTypeMap>);
9
- get columnCount(): number;
10
- get rowCount(): number;
11
- columnName(columnIndex: number): string;
12
- columnType(columnIndex: number): DuckDBType;
13
- value(columnIndex: number, rowIndex: number): DuckDBValue;
14
- }
@@ -1,2 +0,0 @@
1
- import { DataType, Type } from 'apache-arrow';
2
- export type TypedTypeMap = Record<string | number | symbol, DataType<Type, TypedTypeMap>>;
@@ -1,4 +0,0 @@
1
- import { DuckDBType } from '@motherduck/duckdb-types';
2
- import { DataType, Type } from 'apache-arrow';
3
- import { TypedTypeMap } from './TypedTypeMap';
4
- export declare function duckDBTypeFromArrowType(type: DataType<Type, TypedTypeMap>): DuckDBType;
@@ -1,8 +0,0 @@
1
- import { Data, DataType, Type } from 'apache-arrow';
2
- import { DuckDBValue } from '../duckdb/values';
3
- import { TypedTypeMap } from './TypedTypeMap';
4
- type ArrowDataType = DataType<Type, TypedTypeMap>;
5
- type ArrowData = Data<ArrowDataType>;
6
- export declare function duckDBValueFromArrowData(data: ArrowData, rowIndex: number): DuckDBValue;
7
- export declare function duckDBValuesFromArrowData(data: ArrowData, begin: number, end: number): readonly DuckDBValue[];
8
- export {};
@@ -1,6 +0,0 @@
1
- export interface Deferred<T> {
2
- readonly promise: Promise<T>;
3
- readonly resolve: (value: T | PromiseLike<T>) => void;
4
- readonly reject: (reason?: any) => void;
5
- }
6
- export declare function createDeferred<T = unknown>(): Deferred<T>;
@@ -1,3 +0,0 @@
1
- import { DuckDBData } from './DuckDBData';
2
- export type DuckDBDataBatchIteratorResult = IteratorResult<DuckDBData, DuckDBData | undefined>;
3
- export type AsyncDuckDBDataBatchIterator = AsyncIterator<DuckDBData, DuckDBData | undefined>;
@@ -1,56 +0,0 @@
1
- import { DuckDBType } from '@motherduck/duckdb-types';
2
- import { DuckDBRow } from './DuckDBRow';
3
- import { DuckDBValue } from './values';
4
- /**
5
- * A two-dimensional table of data along with column metadata.
6
- *
7
- * May represent either a partial or full result set, or a batch of rows read from a result stream.
8
- * */
9
- export declare abstract class DuckDBData {
10
- /**
11
- * Number of columns.
12
- *
13
- * May be zero until the first part of the result is read. Will not change after the initial read.
14
- */
15
- abstract get columnCount(): number;
16
- /**
17
- * Current number of rows.
18
- *
19
- * For a partial result set, this may change as more rows are read.
20
- * For a full result, or a batch, this will not change.
21
- */
22
- abstract get rowCount(): number;
23
- /**
24
- * Returns the name of column at the given index (starting at zero).
25
- *
26
- * Note that duplicate column names are possible.
27
- */
28
- abstract columnName(columnIndex: number): string;
29
- /**
30
- * Returns the type of the column at the given index (starting at zero).
31
- */
32
- abstract columnType(columnIndex: number): DuckDBType;
33
- /**
34
- * Returns the value for the given column and row. Both are zero-indexed.
35
- */
36
- abstract value(columnIndex: number, rowIndex: number): DuckDBValue;
37
- /**
38
- * Returns the single value, assuming exactly one column and row. Throws otherwise.
39
- */
40
- singleValue(): DuckDBValue;
41
- /**
42
- * Returns the column names as an array.
43
- */
44
- columnNames(): readonly string[];
45
- /**
46
- * Returns the column names as an array, deduplicated following DuckDB's "Auto-Increment Duplicate Column Names"
47
- * behavior.
48
- */
49
- deduplicatedColumnNames(): readonly string[];
50
- /**
51
- * Returns the data as an array of row objects, keyed by column names.
52
- *
53
- * The column names are deduplicated following DuckDB's "Auto-Increment Duplicate Column Names" behavior.
54
- */
55
- toRows(): readonly DuckDBRow[];
56
- }
@@ -1,68 +0,0 @@
1
- import { DuckDBType } from '@motherduck/duckdb-types';
2
- import { AsyncDuckDBDataBatchIterator } from './AsyncDuckDBDataBatchIterator';
3
- import { DuckDBData } from './DuckDBData';
4
- import { DuckDBValue } from './values';
5
- /**
6
- * A result set that can be read incrementally.
7
- *
8
- * Represents either a partial or full result.
9
- * For full results, the `done` property will be true.
10
- * To read more rows into a partial result, use the `readUntil` or `readAll` methods.
11
- */
12
- export declare class DuckDBDataReader extends DuckDBData {
13
- private readonly iterator;
14
- private iteratorDone;
15
- private totalRowsRead;
16
- private readonly batches;
17
- private readonly batchSizeRuns;
18
- constructor(iterator: AsyncDuckDBDataBatchIterator);
19
- /**
20
- * Number of columns.
21
- *
22
- * Will be zero until the first part of the result is read. Will not change after the initial read.
23
- */
24
- get columnCount(): number;
25
- /**
26
- * Current number of rows.
27
- *
28
- * For a partial result set, with `done` false, this may change as more rows are read.
29
- * For a full result, with `done` true, this will not change.
30
- */
31
- get rowCount(): number;
32
- /**
33
- * Returns the name of column at the given index (starting at zero).
34
- *
35
- * Note that duplicate column names are possible.
36
- *
37
- * Will return an error if no part of the result has been read yet.
38
- */
39
- columnName(columnIndex: number): string;
40
- /**
41
- * Returns the type of the column at the given index (starting at zero).
42
- *
43
- * Will return an error if no part of the result has been read yet.
44
- */
45
- columnType(columnIndex: number): DuckDBType;
46
- /**
47
- * Returns the value for the given column and row. Both are zero-indexed.
48
- *
49
- * Will return an error if `rowIndex` is not less than the current `rowCount`.
50
- */
51
- value(columnIndex: number, rowIndex: number): DuckDBValue;
52
- /**
53
- * Returns true if all rows have been read.
54
- */
55
- get done(): boolean;
56
- /**
57
- * Read all rows.
58
- */
59
- readAll(): Promise<void>;
60
- /**
61
- * Read rows until at least the given target row count has been met.
62
- *
63
- * Note that the resulting row count could be greater than the target, since rows are read in batches, typically of 2048 rows each.
64
- */
65
- readUntil(targetRowCount: number): Promise<void>;
66
- private read;
67
- private updateBatchSizeRuns;
68
- }
@@ -1,4 +0,0 @@
1
- import { DuckDBValue } from './values/DuckDBValue';
2
- export interface DuckDBRow {
3
- readonly [columnName: string]: DuckDBValue;
4
- }
@@ -1,12 +0,0 @@
1
- export declare function getDuckDBDateStringFromYearMonthDay(year: number, month: number, dayOfMonth: number): string;
2
- export declare function getDuckDBDateStringFromDays(days: number): string;
3
- export declare function getDuckDBTimeStringFromParts(hoursPart: bigint, minutesPart: bigint, secondsPart: bigint, microsecondsPart: bigint): string;
4
- export declare function getDuckDBTimeStringFromPositiveMicroseconds(positiveMicroseconds: bigint): string;
5
- export declare function getDuckDBTimeStringFromMicrosecondsInDay(microsecondsInDay: bigint): string;
6
- export declare function getDuckDBTimeStringFromMicroseconds(microseconds: bigint): string;
7
- export declare function getDuckDBTimestampStringFromDaysAndMicroseconds(days: bigint, microsecondsInDay: bigint, timezone?: string | null): string;
8
- export declare function getDuckDBTimestampStringFromMicroseconds(microseconds: bigint, timezone?: string | null): string;
9
- export declare function getDuckDBTimestampStringFromSeconds(seconds: bigint, timezone?: string | null): string;
10
- export declare function getDuckDBTimestampStringFromMilliseconds(milliseconds: bigint, timezone?: string | null): string;
11
- export declare function getDuckDBTimestampStringFromNanoseconds(nanoseconds: bigint, timezone?: string | null): string;
12
- export declare function getDuckDBIntervalString(months: number, days: number, microseconds: bigint): string;
@@ -1,2 +0,0 @@
1
- import { DuckDBValue } from '../values/DuckDBValue';
2
- export declare function displayStringForDuckDBValue(value: DuckDBValue): string;
@@ -1,2 +0,0 @@
1
- /** Matches BLOB-to-VARCHAR conversion behavior of DuckDB. */
2
- export declare function stringFromBlob(bytes: Uint8Array): string;
@@ -1,18 +0,0 @@
1
- /**
2
- * Decimal string formatting.
3
- *
4
- * Supports a subset of the functionality of `BigInt.prototype.toLocaleString` for locale-specific formatting.
5
- */
6
- export interface DuckDBDecimalFormatOptions {
7
- useGrouping?: boolean;
8
- minimumFractionDigits?: number;
9
- maximumFractionDigits?: number;
10
- }
11
- export interface LocaleOptions {
12
- locales?: string | string[];
13
- options?: DuckDBDecimalFormatOptions;
14
- }
15
- /**
16
- * Convert a scaled decimal value to a string, possibly using locale-specific formatting.
17
- */
18
- export declare function stringFromDecimal(scaledValue: bigint, scale: number, localeOptions?: LocaleOptions): string;
@@ -1,6 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBBlob extends SpecialDuckDBValue {
3
- readonly bytes: Uint8Array;
4
- constructor(bytes: Uint8Array);
5
- toDuckDBString(): string;
6
- }
@@ -1,6 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBDate extends SpecialDuckDBValue {
3
- readonly days: number;
4
- constructor(days: number);
5
- toDuckDBString(): string;
6
- }
@@ -1,10 +0,0 @@
1
- import { DuckDBDecimalFormatOptions } from '../conversion/stringFromDecimal';
2
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
3
- export declare class DuckDBDecimal extends SpecialDuckDBValue {
4
- readonly scaledValue: bigint;
5
- readonly scale: number;
6
- constructor(scaledValue: bigint, scale: number);
7
- toDuckDBString(): string;
8
- /** Returns a string representation appropriate to the host environment's current locale. */
9
- toLocaleString(locales?: string | string[], options?: DuckDBDecimalFormatOptions): string;
10
- }
@@ -1,8 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBInterval extends SpecialDuckDBValue {
3
- readonly months: number;
4
- readonly days: number;
5
- readonly microseconds: bigint;
6
- constructor(months: number, days: number, microseconds: bigint);
7
- toDuckDBString(): string;
8
- }
@@ -1,7 +0,0 @@
1
- import { DuckDBValue } from './DuckDBValue';
2
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
3
- export declare class DuckDBList extends SpecialDuckDBValue {
4
- readonly values: readonly DuckDBValue[];
5
- constructor(values: readonly DuckDBValue[]);
6
- toDuckDBString(): string;
7
- }
@@ -1,7 +0,0 @@
1
- import { DuckDBMapEntry } from './DuckDBMapEntry';
2
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
3
- export declare class DuckDBMap extends SpecialDuckDBValue {
4
- readonly entries: readonly DuckDBMapEntry[];
5
- constructor(entries: readonly DuckDBMapEntry[]);
6
- toDuckDBString(): string;
7
- }
@@ -1,5 +0,0 @@
1
- import { DuckDBValue } from './DuckDBValue';
2
- export interface DuckDBMapEntry {
3
- readonly key: DuckDBValue;
4
- readonly value: DuckDBValue;
5
- }
@@ -1,7 +0,0 @@
1
- import { DuckDBStructEntry } from './DuckDBStructEntry';
2
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
3
- export declare class DuckDBStruct extends SpecialDuckDBValue {
4
- readonly entries: readonly DuckDBStructEntry[];
5
- constructor(entries: readonly DuckDBStructEntry[]);
6
- toDuckDBString(): string;
7
- }
@@ -1,5 +0,0 @@
1
- import { DuckDBValue } from './DuckDBValue';
2
- export interface DuckDBStructEntry {
3
- readonly key: string;
4
- readonly value: DuckDBValue;
5
- }
@@ -1,6 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBTime extends SpecialDuckDBValue {
3
- readonly microseconds: bigint;
4
- constructor(microseconds: bigint);
5
- toDuckDBString(): string;
6
- }
@@ -1,8 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBTimestampMicroseconds extends SpecialDuckDBValue {
3
- readonly microseconds: bigint;
4
- readonly timezone: string | null | undefined;
5
- constructor(microseconds: bigint, timezone?: string | null);
6
- toDuckDBString(): string;
7
- }
8
- export type DuckDBTimestamp = DuckDBTimestampMicroseconds;
@@ -1,6 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBTimestampMilliseconds extends SpecialDuckDBValue {
3
- readonly milliseconds: bigint;
4
- constructor(milliseconds: bigint);
5
- toDuckDBString(): string;
6
- }
@@ -1,6 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBTimestampNanoseconds extends SpecialDuckDBValue {
3
- readonly nanoseconds: bigint;
4
- constructor(nanoseconds: bigint);
5
- toDuckDBString(): string;
6
- }
@@ -1,6 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export declare class DuckDBTimestampSeconds extends SpecialDuckDBValue {
3
- readonly seconds: bigint;
4
- constructor(seconds: bigint);
5
- toDuckDBString(): string;
6
- }
@@ -1,2 +0,0 @@
1
- import { SpecialDuckDBValue } from './SpecialDuckDBValue';
2
- export type DuckDBValue = null | boolean | number | string | bigint | SpecialDuckDBValue;
@@ -1,4 +0,0 @@
1
- export declare abstract class SpecialDuckDBValue {
2
- abstract toDuckDBString(): string;
3
- toString(): string;
4
- }
@@ -1,16 +0,0 @@
1
- export { DuckDBBlob } from './DuckDBBlob';
2
- export { DuckDBDate } from './DuckDBDate';
3
- export { DuckDBDecimal } from './DuckDBDecimal';
4
- export { DuckDBInterval } from './DuckDBInterval';
5
- export { DuckDBList } from './DuckDBList';
6
- export { DuckDBMap } from './DuckDBMap';
7
- export { DuckDBMapEntry } from './DuckDBMapEntry';
8
- export { DuckDBStruct } from './DuckDBStruct';
9
- export { DuckDBStructEntry } from './DuckDBStructEntry';
10
- export { DuckDBTime } from './DuckDBTime';
11
- export { DuckDBTimestampMicroseconds } from './DuckDBTimestampMicroseconds';
12
- export { DuckDBTimestampMilliseconds } from './DuckDBTimestampMilliseconds';
13
- export { DuckDBTimestampNanoseconds } from './DuckDBTimestampNanoseconds';
14
- export { DuckDBTimestampSeconds } from './DuckDBTimestampSeconds';
15
- export { DuckDBValue } from './DuckDBValue';
16
- export { SpecialDuckDBValue } from './SpecialDuckDBValue';
@@ -1,15 +0,0 @@
1
- import { AsyncDuckDB, AsyncDuckDBConnection } from '@duckdb/duckdb-wasm';
2
- import { LogSink } from '../LogSink';
3
- export interface MDConnectionParams {
4
- mdToken: string;
5
- mdServerURL?: string;
6
- duckDBAssetsURLPrefix?: string;
7
- useDuckDBWasmCOI?: boolean;
8
- logSink?: LogSink;
9
- skipWelcomePack?: boolean;
10
- version?: string;
11
- enableDebugLogging?: boolean;
12
- }
13
- export declare const CATALOG_CHANGE_EVENT = "CatalogChangeEvent";
14
- export declare function createDuckDbConnection(params: MDConnectionParams): Promise<AsyncDuckDBConnection>;
15
- export declare function getAsyncDuckDb(params: MDConnectionParams): Promise<AsyncDuckDB>;