@motherduck/wasm-client 0.6.2 → 0.6.4

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 (112) hide show
  1. package/package.json +1 -1
  2. package/types/DuckDBInstance.d.ts +1 -1
  3. package/types/MDConnection.d.ts +1 -1
  4. package/types/MaterializedQueryTask.d.ts +1 -1
  5. package/types/QueryTypes.d.ts +3 -3
  6. package/types/StreamingQueryTask.d.ts +1 -1
  7. package/types/createDuckDbConnection.d.ts +1 -1
  8. package/types/duckdb-wasm/bindings/bindings_base.d.ts +122 -0
  9. package/types/duckdb-wasm/bindings/bindings_browser_base.d.ts +19 -0
  10. package/types/duckdb-wasm/bindings/bindings_browser_coi.d.ts +12 -0
  11. package/types/duckdb-wasm/bindings/bindings_browser_eh.d.ts +12 -0
  12. package/types/duckdb-wasm/bindings/bindings_browser_mvp.d.ts +11 -0
  13. package/types/duckdb-wasm/bindings/bindings_interface.d.ts +41 -0
  14. package/types/duckdb-wasm/bindings/bindings_node_base.d.ts +23 -0
  15. package/types/duckdb-wasm/bindings/bindings_node_eh.d.ts +12 -0
  16. package/types/duckdb-wasm/bindings/bindings_node_mvp.d.ts +12 -0
  17. package/types/duckdb-wasm/bindings/config.d.ts +62 -0
  18. package/types/duckdb-wasm/bindings/connection.d.ts +74 -0
  19. package/types/duckdb-wasm/bindings/duckdb_module.d.ts +12 -0
  20. package/types/duckdb-wasm/bindings/file_stats.d.ts +36 -0
  21. package/types/duckdb-wasm/bindings/index.d.ts +11 -0
  22. package/types/duckdb-wasm/bindings/insert_options.d.ts +38 -0
  23. package/types/duckdb-wasm/bindings/progress.d.ts +9 -0
  24. package/types/duckdb-wasm/bindings/runtime.d.ts +83 -0
  25. package/types/duckdb-wasm/bindings/runtime_browser.d.ts +9 -0
  26. package/types/duckdb-wasm/bindings/runtime_node.d.ts +8 -0
  27. package/types/duckdb-wasm/bindings/tokens.d.ts +12 -0
  28. package/types/duckdb-wasm/bindings/udf_function.d.ts +14 -0
  29. package/types/duckdb-wasm/bindings/udf_runtime.d.ts +3 -0
  30. package/types/duckdb-wasm/bindings/web_file.d.ts +12 -0
  31. package/types/duckdb-wasm/index.d.ts +7 -0
  32. package/types/duckdb-wasm/index_docs.d.ts +1 -0
  33. package/types/duckdb-wasm/json_typedef.d.ts +17 -0
  34. package/types/duckdb-wasm/log.d.ts +54 -0
  35. package/types/duckdb-wasm/parallel/async_bindings.d.ts +122 -0
  36. package/types/duckdb-wasm/parallel/async_bindings_interface.d.ts +25 -0
  37. package/types/duckdb-wasm/parallel/async_connection.d.ts +75 -0
  38. package/types/duckdb-wasm/parallel/index.d.ts +5 -0
  39. package/types/duckdb-wasm/parallel/worker_dispatcher.d.ts +22 -0
  40. package/types/duckdb-wasm/parallel/worker_request.d.ts +99 -0
  41. package/types/duckdb-wasm/platform.d.ts +39 -0
  42. package/types/duckdb-wasm/status.d.ts +3 -0
  43. package/types/duckdb-wasm/targets/duckdb-browser-blocking.d.ts +12 -0
  44. package/types/duckdb-wasm/targets/duckdb-browser-coi.pthread.worker.d.ts +1 -0
  45. package/types/duckdb-wasm/targets/duckdb-browser-coi.worker.d.ts +2 -0
  46. package/types/duckdb-wasm/targets/duckdb-browser-eh.worker.d.ts +2 -0
  47. package/types/duckdb-wasm/targets/duckdb-browser-mvp.worker.d.ts +2 -0
  48. package/types/duckdb-wasm/targets/duckdb-node-blocking.d.ts +13 -0
  49. package/types/duckdb-wasm/targets/duckdb-node-eh.worker.d.ts +2 -0
  50. package/types/duckdb-wasm/targets/duckdb-node-mvp.worker.d.ts +2 -0
  51. package/types/duckdb-wasm/targets/duckdb.d.ts +9 -0
  52. package/types/duckdb-wasm/utils/binary_dump.d.ts +1 -0
  53. package/types/duckdb-wasm/utils/index.d.ts +2 -0
  54. package/types/duckdb-wasm/utils/s3_helper.d.ts +27 -0
  55. package/types/duckdb-wasm/version.d.ts +5 -0
  56. package/types/duckdb-wasm/worker.d.ts +1 -0
  57. package/types/getAsyncDuckDb.d.ts +1 -1
  58. package/types/getDuckDBBundlesFromDuckDBAssets.d.ts +1 -1
  59. package/types/index.d.ts +5 -5
  60. package/types/instantiateDB.d.ts +1 -1
  61. package/types/motherduck/duckdb-arrow/AsyncDuckDBRecordBatchIterator.d.ts +12 -0
  62. package/types/motherduck/duckdb-arrow/DuckDBRecordBatch.d.ts +14 -0
  63. package/types/motherduck/duckdb-arrow/TypedTypeMap.d.ts +2 -0
  64. package/types/motherduck/duckdb-arrow/duckDBTypeFromArrowType.d.ts +4 -0
  65. package/types/motherduck/duckdb-arrow/duckDBValueFromArrowData.d.ts +8 -0
  66. package/types/motherduck/duckdb-arrow/index.d.ts +2 -0
  67. package/types/motherduck/duckdb-data/AsyncDuckDBDataBatchIterator.d.ts +3 -0
  68. package/types/motherduck/duckdb-data/DuckDBData.d.ts +56 -0
  69. package/types/motherduck/duckdb-data/DuckDBDataReader.d.ts +68 -0
  70. package/types/motherduck/duckdb-data/DuckDBRow.d.ts +4 -0
  71. package/types/motherduck/duckdb-data/MemoryDuckDBData.d.ts +16 -0
  72. package/types/motherduck/duckdb-data/index.d.ts +5 -0
  73. package/types/motherduck/duckdb-types/DuckDBType.d.ts +124 -0
  74. package/types/motherduck/duckdb-types/DuckDBTypes.d.ts +43 -0
  75. package/types/motherduck/duckdb-types/index.d.ts +3 -0
  76. package/types/motherduck/duckdb-types/parseLogicalTypeString.d.ts +2 -0
  77. package/types/motherduck/duckdb-values/DuckDBArray.d.ts +7 -0
  78. package/types/motherduck/duckdb-values/DuckDBBlob.d.ts +6 -0
  79. package/types/motherduck/duckdb-values/DuckDBDate.d.ts +6 -0
  80. package/types/motherduck/duckdb-values/DuckDBDecimal.d.ts +10 -0
  81. package/types/motherduck/duckdb-values/DuckDBInterval.d.ts +8 -0
  82. package/types/motherduck/duckdb-values/DuckDBList.d.ts +7 -0
  83. package/types/motherduck/duckdb-values/DuckDBMap.d.ts +7 -0
  84. package/types/motherduck/duckdb-values/DuckDBMapEntry.d.ts +5 -0
  85. package/types/motherduck/duckdb-values/DuckDBStruct.d.ts +7 -0
  86. package/types/motherduck/duckdb-values/DuckDBStructEntry.d.ts +5 -0
  87. package/types/motherduck/duckdb-values/DuckDBTime.d.ts +6 -0
  88. package/types/motherduck/duckdb-values/DuckDBTimestampMicroseconds.d.ts +8 -0
  89. package/types/motherduck/duckdb-values/DuckDBTimestampMilliseconds.d.ts +6 -0
  90. package/types/motherduck/duckdb-values/DuckDBTimestampNanoseconds.d.ts +6 -0
  91. package/types/motherduck/duckdb-values/DuckDBTimestampSeconds.d.ts +6 -0
  92. package/types/motherduck/duckdb-values/DuckDBValue.d.ts +2 -0
  93. package/types/motherduck/duckdb-values/SpecialDuckDBValue.d.ts +4 -0
  94. package/types/motherduck/duckdb-values/conversion/dateTimeStringConversion.d.ts +12 -0
  95. package/types/motherduck/duckdb-values/conversion/displayStringForDuckDBValue.d.ts +2 -0
  96. package/types/motherduck/duckdb-values/conversion/stringFromBlob.d.ts +2 -0
  97. package/types/motherduck/duckdb-values/conversion/stringFromDecimal.d.ts +18 -0
  98. package/types/motherduck/duckdb-values/index.d.ts +17 -0
  99. package/types/motherduck/wasm-extension/LoadMotherDuckWasmExtensionOptions.d.ts +38 -0
  100. package/types/motherduck/wasm-extension/MDEvent.d.ts +1 -0
  101. package/types/motherduck/wasm-extension/MotherDuckEvent.d.ts +11 -0
  102. package/types/motherduck/wasm-extension/MotherDuckLogLevel.d.ts +7 -0
  103. package/types/motherduck/wasm-extension/doesBrowserSupportWorkerInWorker.d.ts +1 -0
  104. package/types/motherduck/wasm-extension/fetchVersion.d.ts +1 -0
  105. package/types/motherduck/wasm-extension/getExtensionRepository.d.ts +1 -0
  106. package/types/motherduck/wasm-extension/index.d.ts +4 -0
  107. package/types/motherduck/wasm-extension/loadMotherDuckWasmExtension.d.ts +2 -0
  108. package/types/motherduck/wasm-extension/motherDuckEventFromMessageEvent.d.ts +2 -0
  109. package/types/motherduck/wasm-extension/pathConcat.d.ts +1 -0
  110. package/types/motherduck/wasm-extension/untilWorkerReady.d.ts +2 -0
  111. package/types/readLocalFS.d.ts +1 -1
  112. package/index.js.map +0 -7
@@ -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,13 @@
1
+ export * from '../bindings';
2
+ export * from '../log';
3
+ export * from '../platform';
4
+ export * from '../status';
5
+ export * from '../version';
6
+ export { DuckDBDataProtocol } from '../bindings/runtime';
7
+ export { DEFAULT_RUNTIME } from '../bindings/runtime';
8
+ export { NODE_RUNTIME } from '../bindings/runtime_node';
9
+ import { Logger } from '../log';
10
+ import { DuckDBRuntime } from '../bindings';
11
+ import { DuckDBNodeBindings } from '../bindings/bindings_node_base';
12
+ import { DuckDBBundles } from '../platform';
13
+ export declare function createDuckDB(bundles: DuckDBBundles, logger: Logger, runtime: DuckDBRuntime): Promise<DuckDBNodeBindings>;
@@ -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,9 @@
1
+ export * from '../bindings/config';
2
+ export * from '../bindings/tokens';
3
+ export * from '../log';
4
+ export * from '../status';
5
+ export * from '../parallel';
6
+ export * from '../platform';
7
+ export * from '../version';
8
+ export * from '../worker';
9
+ export { InstantiationProgress, InstantiationProgressHandler, DuckDBDataProtocol, WebFile } from '../bindings';
@@ -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,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,5 @@
1
+ export declare const PACKAGE_NAME: string;
2
+ export declare const PACKAGE_VERSION: string;
3
+ export declare const PACKAGE_VERSION_MAJOR: string;
4
+ export declare const PACKAGE_VERSION_MINOR: string;
5
+ export declare const PACKAGE_VERSION_PATCH: string;
@@ -0,0 +1 @@
1
+ export declare function createWorker(url: string): Promise<Worker>;
@@ -1,3 +1,3 @@
1
- import { AsyncDuckDB } from '@duckdb/duckdb-wasm';
1
+ import { AsyncDuckDB } from './duckdb-wasm';
2
2
  import { MDConnectionParams } from './MDConnectionParams';
3
3
  export declare function getAsyncDuckDb(params: MDConnectionParams): Promise<AsyncDuckDB>;
@@ -1,2 +1,2 @@
1
- import { DuckDBBundles } from '@duckdb/duckdb-wasm';
1
+ import { DuckDBBundles } from './duckdb-wasm';
2
2
  export declare function getDuckDBBundlesFromDuckDBAssets(duckDBAssetsURLPrefix: string, version: string | undefined, includeCOI: boolean | undefined): Promise<DuckDBBundles>;
package/types/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { TypedTypeMap } from '@motherduck/duckdb-arrow';
2
- export * from '@motherduck/duckdb-data';
3
- export * from '@motherduck/duckdb-types';
4
- export * from '@motherduck/duckdb-values';
5
- export { MotherDuckCatalogChangeEvent, MotherDuckCatalogChangeEventDetail, MotherDuckEvent, MotherDuckEventBase, MotherDuckEventType } from '@motherduck/wasm-extension';
1
+ export { TypedTypeMap } from './motherduck/duckdb-arrow';
2
+ export * from './motherduck/duckdb-data';
3
+ export * from './motherduck/duckdb-types';
4
+ export * from './motherduck/duckdb-values';
5
+ export { MotherDuckCatalogChangeEvent, MotherDuckCatalogChangeEventDetail, MotherDuckEvent, MotherDuckEventBase, MotherDuckEventType } from './motherduck/wasm-extension';
6
6
  export * from './getAsyncDuckDb';
7
7
  export * from './MDConnection';
8
8
  export * from './MDConnectionParams';
@@ -1,2 +1,2 @@
1
1
  import { MDConnectionParams } from './MDConnectionParams';
2
- export declare function instantiateDB(params: MDConnectionParams): Promise<import("@duckdb/duckdb-wasm").AsyncDuckDB>;
2
+ export declare function instantiateDB(params: MDConnectionParams): Promise<import("./duckdb-wasm").AsyncDuckDB>;
@@ -0,0 +1,12 @@
1
+ import { RecordBatch } from 'apache-arrow';
2
+ import { AsyncDuckDBDataBatchIterator, DuckDBData, DuckDBDataBatchIteratorResult } from '../../motherduck/duckdb-data';
3
+ import { TypedTypeMap } from './TypedTypeMap.js';
4
+ export type AsyncRecordBatchIterator = AsyncIterator<RecordBatch<TypedTypeMap>, RecordBatch<TypedTypeMap> | undefined>;
5
+ export declare class AsyncDuckDBRecordBatchIterator implements AsyncDuckDBDataBatchIterator {
6
+ private recordBatchIterator;
7
+ constructor(recordBatchIterator: AsyncRecordBatchIterator);
8
+ next(): Promise<DuckDBDataBatchIteratorResult>;
9
+ return(value?: DuckDBData): Promise<DuckDBDataBatchIteratorResult>;
10
+ throw(e?: any): Promise<DuckDBDataBatchIteratorResult>;
11
+ [Symbol.asyncIterator](): AsyncDuckDBDataBatchIterator;
12
+ }
@@ -0,0 +1,14 @@
1
+ import { DuckDBData } from '../../motherduck/duckdb-data';
2
+ import { DuckDBType } from '../../motherduck/duckdb-types';
3
+ import { DuckDBValue } from '../../motherduck/duckdb-values';
4
+ import { RecordBatch } from 'apache-arrow';
5
+ import { TypedTypeMap } from './TypedTypeMap.js';
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
+ }
@@ -0,0 +1,2 @@
1
+ import { DataType, Type } from 'apache-arrow';
2
+ export type TypedTypeMap = Record<string | number | symbol, DataType<Type, TypedTypeMap>>;
@@ -0,0 +1,4 @@
1
+ import { DuckDBType } from '../../motherduck/duckdb-types';
2
+ import { DataType, Type } from 'apache-arrow';
3
+ import { TypedTypeMap } from './TypedTypeMap.js';
4
+ export declare function duckDBTypeFromArrowType(type: DataType<Type, TypedTypeMap>): DuckDBType;
@@ -0,0 +1,8 @@
1
+ import { DuckDBValue } from '../../motherduck/duckdb-values';
2
+ import { Data, DataType, Type } from 'apache-arrow';
3
+ import { TypedTypeMap } from './TypedTypeMap.js';
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 {};
@@ -0,0 +1,2 @@
1
+ export * from './AsyncDuckDBRecordBatchIterator.js';
2
+ export * from './TypedTypeMap.js';
@@ -0,0 +1,3 @@
1
+ import { DuckDBData } from './DuckDBData.js';
2
+ export type DuckDBDataBatchIteratorResult = IteratorResult<DuckDBData, DuckDBData | undefined>;
3
+ export type AsyncDuckDBDataBatchIterator = AsyncIterator<DuckDBData, DuckDBData | undefined>;
@@ -0,0 +1,56 @@
1
+ import { DuckDBType } from '../../motherduck/duckdb-types';
2
+ import { DuckDBValue } from '../../motherduck/duckdb-values';
3
+ import { DuckDBRow } from './DuckDBRow.js';
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
+ }
@@ -0,0 +1,68 @@
1
+ import { DuckDBType } from '../../motherduck/duckdb-types';
2
+ import { DuckDBValue } from '../../motherduck/duckdb-values';
3
+ import { AsyncDuckDBDataBatchIterator } from './AsyncDuckDBDataBatchIterator.js';
4
+ import { DuckDBData } from './DuckDBData.js';
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
+ }
@@ -0,0 +1,4 @@
1
+ import { DuckDBValue } from '../../motherduck/duckdb-values';
2
+ export interface DuckDBRow {
3
+ readonly [columnName: string]: DuckDBValue;
4
+ }
@@ -0,0 +1,16 @@
1
+ import { DuckDBType } from '../../motherduck/duckdb-types';
2
+ import { DuckDBValue } from '../../motherduck/duckdb-values';
3
+ import { DuckDBData } from './DuckDBData.js';
4
+ export declare class MemoryDuckDBData extends DuckDBData {
5
+ private columns;
6
+ private values;
7
+ constructor(columns: {
8
+ name: string;
9
+ type: DuckDBType;
10
+ }[], values: DuckDBValue[][]);
11
+ get columnCount(): number;
12
+ get rowCount(): number;
13
+ columnName(columnIndex: number): string;
14
+ columnType(columnIndex: number): DuckDBType;
15
+ value(columnIndex: number, rowIndex: number): DuckDBValue;
16
+ }
@@ -0,0 +1,5 @@
1
+ export * from './AsyncDuckDBDataBatchIterator.js';
2
+ export * from './DuckDBData.js';
3
+ export * from './DuckDBDataReader.js';
4
+ export * from './DuckDBRow.js';
5
+ export * from './MemoryDuckDBData.js';
@@ -0,0 +1,124 @@
1
+ export type StructEntry = {
2
+ readonly key: string;
3
+ readonly valueType: DuckDBType;
4
+ };
5
+ export type UnionAlternative = {
6
+ readonly tag: string;
7
+ readonly valueType: DuckDBType;
8
+ };
9
+ export type ArrayDuckDBType = {
10
+ readonly name: 'ARRAY';
11
+ readonly valueType: DuckDBType;
12
+ readonly length: number;
13
+ };
14
+ export type BigIntDuckDBType = {
15
+ readonly name: 'BIGINT';
16
+ };
17
+ export type BitDuckDBType = {
18
+ readonly name: 'BIT';
19
+ };
20
+ export type BooleanDuckDBType = {
21
+ readonly name: 'BOOLEAN';
22
+ };
23
+ export type BlobDuckDBType = {
24
+ readonly name: 'BLOB';
25
+ };
26
+ export type DateDuckDBType = {
27
+ readonly name: 'DATE';
28
+ };
29
+ export type DoubleDuckDBType = {
30
+ readonly name: 'DOUBLE';
31
+ };
32
+ export type DecimalDuckDBType = {
33
+ readonly name: 'DECIMAL';
34
+ readonly width?: number;
35
+ readonly scale?: number;
36
+ };
37
+ export type EnumDuckDBType = {
38
+ readonly name: 'ENUM';
39
+ };
40
+ export type HugeIntDuckDBType = {
41
+ readonly name: 'HUGEINT';
42
+ };
43
+ export type IntegerDuckDBType = {
44
+ readonly name: 'INTEGER';
45
+ };
46
+ export type IntervalDuckDBType = {
47
+ readonly name: 'INTERVAL';
48
+ };
49
+ export type ListDuckDBType = {
50
+ readonly name: 'LIST';
51
+ readonly valueType: DuckDBType;
52
+ };
53
+ export type MapDuckDBType = {
54
+ readonly name: 'MAP';
55
+ readonly keyType: DuckDBType;
56
+ readonly valueType: DuckDBType;
57
+ };
58
+ export type RealDuckDBType = {
59
+ readonly name: 'REAL';
60
+ };
61
+ export type SmallIntDuckDBType = {
62
+ readonly name: 'SMALLINT';
63
+ };
64
+ export type SQLNullDuckDBType = {
65
+ readonly name: 'SQLNULL';
66
+ };
67
+ export type StructDuckDBType = {
68
+ readonly name: 'STRUCT';
69
+ readonly entries: readonly StructEntry[];
70
+ };
71
+ export type TimeDuckDBType = {
72
+ readonly name: 'TIME';
73
+ };
74
+ export type TimeWithTimeZoneDuckDBType = {
75
+ readonly name: 'TIME_TZ';
76
+ };
77
+ export type TimestampDuckDBType = {
78
+ readonly name: 'TIMESTAMP';
79
+ };
80
+ export type TimestampSecondsDuckDBType = {
81
+ readonly name: 'TIMESTAMP_S';
82
+ };
83
+ export type TimestampMillisecondsDuckDBType = {
84
+ readonly name: 'TIMESTAMP_MS';
85
+ };
86
+ export type TimestampNanosecondsDuckDBType = {
87
+ readonly name: 'TIMESTAMP_NS';
88
+ };
89
+ export type TimestampWithTimeZoneDuckDBType = {
90
+ readonly name: 'TIMESTAMP_TZ';
91
+ };
92
+ export type TinyIntDuckDBType = {
93
+ readonly name: 'TINYINT';
94
+ };
95
+ export type UBigIntDuckDBType = {
96
+ readonly name: 'UBIGINT';
97
+ };
98
+ export type UIntegerDuckDBType = {
99
+ readonly name: 'UINTEGER';
100
+ };
101
+ export type USmallIntDuckDBType = {
102
+ readonly name: 'USMALLINT';
103
+ };
104
+ export type UTinyIntDuckDBType = {
105
+ readonly name: 'UTINYINT';
106
+ };
107
+ export type UUIDDuckDBType = {
108
+ readonly name: 'UUID';
109
+ };
110
+ export type UnionDuckDBType = {
111
+ readonly name: 'UNION';
112
+ readonly alternatives: readonly UnionAlternative[];
113
+ };
114
+ export type VarCharDuckDBType = {
115
+ readonly name: 'VARCHAR';
116
+ readonly length?: number;
117
+ };
118
+ export type GeometryDuckDBType = {
119
+ readonly name: 'GEOMETRY';
120
+ };
121
+ export type WKBBlobDuckDBType = {
122
+ readonly name: 'WKB_BLOB';
123
+ };
124
+ export type DuckDBType = ArrayDuckDBType | BigIntDuckDBType | BitDuckDBType | BooleanDuckDBType | BlobDuckDBType | DateDuckDBType | DoubleDuckDBType | DecimalDuckDBType | EnumDuckDBType | HugeIntDuckDBType | IntegerDuckDBType | IntervalDuckDBType | ListDuckDBType | MapDuckDBType | RealDuckDBType | SmallIntDuckDBType | SQLNullDuckDBType | StructDuckDBType | TimeDuckDBType | TimeWithTimeZoneDuckDBType | TimestampDuckDBType | TimestampSecondsDuckDBType | TimestampMillisecondsDuckDBType | TimestampNanosecondsDuckDBType | TimestampWithTimeZoneDuckDBType | TinyIntDuckDBType | UBigIntDuckDBType | UIntegerDuckDBType | USmallIntDuckDBType | UTinyIntDuckDBType | UUIDDuckDBType | UnionDuckDBType | VarCharDuckDBType | GeometryDuckDBType | WKBBlobDuckDBType;
@@ -0,0 +1,43 @@
1
+ import { ArrayDuckDBType, BigIntDuckDBType, BitDuckDBType, BlobDuckDBType, BooleanDuckDBType, DateDuckDBType, DecimalDuckDBType, DoubleDuckDBType, DuckDBType, EnumDuckDBType, GeometryDuckDBType, HugeIntDuckDBType, IntegerDuckDBType, IntervalDuckDBType, ListDuckDBType, MapDuckDBType, RealDuckDBType, SQLNullDuckDBType, SmallIntDuckDBType, StructDuckDBType, StructEntry, TimeDuckDBType, TimeWithTimeZoneDuckDBType, TimestampDuckDBType, TimestampMillisecondsDuckDBType, TimestampNanosecondsDuckDBType, TimestampSecondsDuckDBType, TimestampWithTimeZoneDuckDBType, TinyIntDuckDBType, UBigIntDuckDBType, UIntegerDuckDBType, USmallIntDuckDBType, UTinyIntDuckDBType, UUIDDuckDBType, UnionAlternative, UnionDuckDBType, VarCharDuckDBType, WKBBlobDuckDBType } from './DuckDBType.js';
2
+ export declare class DuckDBTypes {
3
+ private constructor();
4
+ static ARRAY(valueType: DuckDBType, length: number): ArrayDuckDBType;
5
+ static BIGINT: BigIntDuckDBType;
6
+ static BIT: BitDuckDBType;
7
+ static BOOLEAN: BooleanDuckDBType;
8
+ static BLOB: BlobDuckDBType;
9
+ static DATE: DateDuckDBType;
10
+ static DOUBLE: DoubleDuckDBType;
11
+ private static default_DECIMAL;
12
+ static DECIMAL(width?: number, scale?: number): DecimalDuckDBType;
13
+ static ENUM: EnumDuckDBType;
14
+ static GEOMETRY: GeometryDuckDBType;
15
+ static HUGEINT: HugeIntDuckDBType;
16
+ static INTEGER: IntegerDuckDBType;
17
+ static INTERVAL: IntervalDuckDBType;
18
+ static LIST(valueType: DuckDBType): ListDuckDBType;
19
+ static MAP(keyType: DuckDBType, valueType: DuckDBType): MapDuckDBType;
20
+ static REAL: RealDuckDBType;
21
+ static SMALLINT: SmallIntDuckDBType;
22
+ static SQLNULL: SQLNullDuckDBType;
23
+ static STRUCT(entries: readonly StructEntry[]): StructDuckDBType;
24
+ static STRUCT_entry(key: string, valueType: DuckDBType): StructEntry;
25
+ static TIME: TimeDuckDBType;
26
+ static TIME_TZ: TimeWithTimeZoneDuckDBType;
27
+ static TIMESTAMP: TimestampDuckDBType;
28
+ static TIMESTAMP_S: TimestampSecondsDuckDBType;
29
+ static TIMESTAMP_MS: TimestampMillisecondsDuckDBType;
30
+ static TIMESTAMP_NS: TimestampNanosecondsDuckDBType;
31
+ static TIMESTAMP_TZ: TimestampWithTimeZoneDuckDBType;
32
+ static TINYINT: TinyIntDuckDBType;
33
+ static UBIGINT: UBigIntDuckDBType;
34
+ static UINTEGER: UIntegerDuckDBType;
35
+ static USMALLINT: USmallIntDuckDBType;
36
+ static UTINYINT: UTinyIntDuckDBType;
37
+ static UUID: UUIDDuckDBType;
38
+ static UNION(alternatives: readonly UnionAlternative[]): UnionDuckDBType;
39
+ static UNION_alternative(tag: string, valueType: DuckDBType): UnionAlternative;
40
+ static VARCHAR: VarCharDuckDBType;
41
+ static VARCHAR_withLength(length: number): VarCharDuckDBType;
42
+ static WKB_BLOB: WKBBlobDuckDBType;
43
+ }
@@ -0,0 +1,3 @@
1
+ export * from './DuckDBType.js';
2
+ export { DuckDBTypes } from './DuckDBTypes.js';
3
+ export { parseLogicalTypeString } from './parseLogicalTypeString.js';
@@ -0,0 +1,2 @@
1
+ import { DuckDBType } from './DuckDBType.js';
2
+ export declare function parseLogicalTypeString(typeString: string): DuckDBType;
@@ -0,0 +1,7 @@
1
+ import { DuckDBValue } from './DuckDBValue.js';
2
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
3
+ export declare class DuckDBArray extends SpecialDuckDBValue {
4
+ readonly values: readonly DuckDBValue[];
5
+ constructor(values: readonly DuckDBValue[]);
6
+ toDuckDBString(): string;
7
+ }
@@ -0,0 +1,6 @@
1
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
2
+ export declare class DuckDBBlob extends SpecialDuckDBValue {
3
+ readonly bytes: Uint8Array;
4
+ constructor(bytes: Uint8Array);
5
+ toDuckDBString(): string;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
2
+ export declare class DuckDBDate extends SpecialDuckDBValue {
3
+ readonly days: number;
4
+ constructor(days: number);
5
+ toDuckDBString(): string;
6
+ }
@@ -0,0 +1,10 @@
1
+ import { DuckDBDecimalFormatOptions } from './conversion/stringFromDecimal.js';
2
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
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
+ }
@@ -0,0 +1,8 @@
1
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
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
+ }
@@ -0,0 +1,7 @@
1
+ import { DuckDBValue } from './DuckDBValue.js';
2
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
3
+ export declare class DuckDBList extends SpecialDuckDBValue {
4
+ readonly values: readonly DuckDBValue[];
5
+ constructor(values: readonly DuckDBValue[]);
6
+ toDuckDBString(): string;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { DuckDBMapEntry } from './DuckDBMapEntry.js';
2
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
3
+ export declare class DuckDBMap extends SpecialDuckDBValue {
4
+ readonly entries: readonly DuckDBMapEntry[];
5
+ constructor(entries: readonly DuckDBMapEntry[]);
6
+ toDuckDBString(): string;
7
+ }
@@ -0,0 +1,5 @@
1
+ import { DuckDBValue } from './DuckDBValue.js';
2
+ export interface DuckDBMapEntry {
3
+ readonly key: DuckDBValue;
4
+ readonly value: DuckDBValue;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { DuckDBStructEntry } from './DuckDBStructEntry.js';
2
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
3
+ export declare class DuckDBStruct extends SpecialDuckDBValue {
4
+ readonly entries: readonly DuckDBStructEntry[];
5
+ constructor(entries: readonly DuckDBStructEntry[]);
6
+ toDuckDBString(): string;
7
+ }
@@ -0,0 +1,5 @@
1
+ import { DuckDBValue } from './DuckDBValue.js';
2
+ export interface DuckDBStructEntry {
3
+ readonly key: string;
4
+ readonly value: DuckDBValue;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
2
+ export declare class DuckDBTime extends SpecialDuckDBValue {
3
+ readonly microseconds: bigint;
4
+ constructor(microseconds: bigint);
5
+ toDuckDBString(): string;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
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;
@@ -0,0 +1,6 @@
1
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
2
+ export declare class DuckDBTimestampMilliseconds extends SpecialDuckDBValue {
3
+ readonly milliseconds: bigint;
4
+ constructor(milliseconds: bigint);
5
+ toDuckDBString(): string;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
2
+ export declare class DuckDBTimestampNanoseconds extends SpecialDuckDBValue {
3
+ readonly nanoseconds: bigint;
4
+ constructor(nanoseconds: bigint);
5
+ toDuckDBString(): string;
6
+ }