@motherduck/wasm-client 0.6.5 → 0.7.0

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 (144) hide show
  1. package/index.js +1 -1
  2. package/index_with_arrow.js +8 -8
  3. package/package.json +1 -1
  4. package/types/@duckdb/data-reader/ColumnFilteredDuckDBData.d.ts +13 -0
  5. package/types/{motherduck/duckdb-data → @duckdb/data-reader}/DuckDBData.d.ts +2 -2
  6. package/types/{motherduck/duckdb-data → @duckdb/data-reader}/DuckDBDataReader.d.ts +2 -2
  7. package/types/{motherduck/duckdb-data → @duckdb/data-reader}/DuckDBRow.d.ts +1 -1
  8. package/types/{motherduck/duckdb-data → @duckdb/data-reader}/MemoryDuckDBData.d.ts +2 -2
  9. package/types/{motherduck/duckdb-data → @duckdb/data-reader}/index.d.ts +1 -0
  10. package/types/@duckdb/data-types/DuckDBType.d.ts +324 -0
  11. package/types/@duckdb/data-types/DuckDBTypeId.d.ts +41 -0
  12. package/types/@duckdb/data-types/extensionTypes.d.ts +12 -0
  13. package/types/@duckdb/data-types/index.d.ts +4 -0
  14. package/types/@duckdb/data-types/sql.d.ts +2 -0
  15. package/types/{motherduck/duckdb-values/DuckDBList.d.ts → @duckdb/data-values/DuckDBArrayValue.d.ts} +4 -2
  16. package/types/@duckdb/data-values/DuckDBBitValue.d.ts +19 -0
  17. package/types/{motherduck/duckdb-values/DuckDBBlob.d.ts → @duckdb/data-values/DuckDBBlobValue.d.ts} +4 -2
  18. package/types/{motherduck/duckdb-values/DuckDBDate.d.ts → @duckdb/data-values/DuckDBDateValue.d.ts} +4 -2
  19. package/types/{motherduck/duckdb-values/DuckDBDecimal.d.ts → @duckdb/data-values/DuckDBDecimalValue.d.ts} +4 -2
  20. package/types/{motherduck/duckdb-values/DuckDBInterval.d.ts → @duckdb/data-values/DuckDBIntervalValue.d.ts} +4 -2
  21. package/types/{motherduck/duckdb-values/DuckDBArray.d.ts → @duckdb/data-values/DuckDBListValue.d.ts} +4 -2
  22. package/types/{motherduck/duckdb-values/DuckDBMap.d.ts → @duckdb/data-values/DuckDBMapValue.d.ts} +4 -2
  23. package/types/{motherduck/duckdb-values/DuckDBStruct.d.ts → @duckdb/data-values/DuckDBStructValue.d.ts} +4 -2
  24. package/types/@duckdb/data-values/DuckDBTimeTZValue.d.ts +14 -0
  25. package/types/{motherduck/duckdb-values/DuckDBTime.d.ts → @duckdb/data-values/DuckDBTimeValue.d.ts} +4 -2
  26. package/types/@duckdb/data-values/DuckDBTimestampMicrosecondsValue.d.ts +10 -0
  27. package/types/{motherduck/duckdb-values/DuckDBTimestampMilliseconds.d.ts → @duckdb/data-values/DuckDBTimestampMillisecondsValue.d.ts} +4 -2
  28. package/types/{motherduck/duckdb-values/DuckDBTimestampNanoseconds.d.ts → @duckdb/data-values/DuckDBTimestampNanosecondsValue.d.ts} +4 -2
  29. package/types/{motherduck/duckdb-values/DuckDBTimestampSeconds.d.ts → @duckdb/data-values/DuckDBTimestampSecondsValue.d.ts} +4 -2
  30. package/types/@duckdb/data-values/DuckDBTimestampTZValue.d.ts +10 -0
  31. package/types/@duckdb/data-values/DuckDBToStringOptions.d.ts +3 -0
  32. package/types/@duckdb/data-values/DuckDBUUIDValue.d.ts +17 -0
  33. package/types/{motherduck/duckdb-values → @duckdb/data-values}/DuckDBValue.d.ts +0 -1
  34. package/types/@duckdb/data-values/Json.d.ts +3 -0
  35. package/types/@duckdb/data-values/SpecialDuckDBValue.d.ts +8 -0
  36. package/types/{motherduck/duckdb-values → @duckdb/data-values}/conversion/dateTimeStringConversion.d.ts +9 -5
  37. package/types/@duckdb/data-values/conversion/duckDBValueToSql.d.ts +3 -0
  38. package/types/@duckdb/data-values/conversion/getVarIntFromBytes.d.ts +12 -0
  39. package/types/@duckdb/data-values/conversion/jsonFromDuckDBValue.d.ts +3 -0
  40. package/types/@duckdb/data-values/index.d.ts +26 -0
  41. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_base.d.ts +11 -3
  42. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_interface.d.ts +8 -3
  43. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/config.d.ts +25 -1
  44. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/connection.d.ts +1 -1
  45. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/duckdb_module.d.ts +2 -0
  46. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/runtime.d.ts +18 -1
  47. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/runtime_browser.d.ts +4 -0
  48. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/log.d.ts +7 -0
  49. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/parallel/async_bindings.d.ts +18 -3
  50. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/parallel/async_bindings_interface.d.ts +4 -2
  51. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/parallel/async_connection.d.ts +3 -3
  52. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/parallel/worker_request.d.ts +8 -6
  53. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/platform.d.ts +4 -4
  54. package/types/@duckdb/duckdb-wasm/status.d.ts +7 -0
  55. package/types/@duckdb/duckdb-wasm/utils/opfs_util.d.ts +4 -0
  56. package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/utils/s3_helper.d.ts +1 -1
  57. package/types/{motherduck → @motherduck}/duckdb-arrow/AsyncDuckDBRecordBatchIterator.d.ts +1 -1
  58. package/types/{motherduck → @motherduck}/duckdb-arrow/DuckDBRecordBatch.d.ts +3 -3
  59. package/types/{motherduck → @motherduck}/duckdb-arrow/duckDBTypeFromArrowType.d.ts +1 -1
  60. package/types/{motherduck → @motherduck}/duckdb-arrow/duckDBValueFromArrowData.d.ts +1 -1
  61. package/types/@motherduck/duckdb-arrow/index.d.ts +5 -0
  62. package/types/@motherduck/task-sequencer/ConsoleLike.d.ts +1 -0
  63. package/types/@motherduck/task-sequencer/TaskSequencer.d.ts +59 -0
  64. package/types/@motherduck/task-sequencer/index.d.ts +2 -0
  65. package/types/{motherduck → @motherduck}/wasm-extension/LoadMotherDuckWasmExtensionOptions.d.ts +7 -1
  66. package/types/{motherduck → @motherduck}/wasm-extension/untilWorkerReady.d.ts +1 -1
  67. package/types/DuckDBInstance.d.ts +1 -1
  68. package/types/MDConnection.d.ts +1 -1
  69. package/types/MDConnectionParams.d.ts +3 -1
  70. package/types/MaterializedQueryTask.d.ts +2 -2
  71. package/types/QueryTypes.d.ts +3 -3
  72. package/types/StreamingQueryTask.d.ts +2 -2
  73. package/types/createDuckDbConnection.d.ts +1 -1
  74. package/types/fetchDuckDBBundlesFromDuckDBAssets.d.ts +1 -1
  75. package/types/getAsyncDuckDb.d.ts +1 -1
  76. package/types/index.d.ts +4 -4
  77. package/types/instantiateDB.d.ts +1 -1
  78. package/types/isDuckDBBundles.d.ts +1 -1
  79. package/types/prefixDuckDBBundles.d.ts +1 -1
  80. package/types/readLocalFS.d.ts +2 -2
  81. package/types/duckdb-wasm/status.d.ts +0 -3
  82. package/types/motherduck/duckdb-arrow/index.d.ts +0 -2
  83. package/types/motherduck/duckdb-types/DuckDBType.d.ts +0 -130
  84. package/types/motherduck/duckdb-types/DuckDBTypes.d.ts +0 -45
  85. package/types/motherduck/duckdb-types/duckDBTypeToString.d.ts +0 -2
  86. package/types/motherduck/duckdb-types/index.d.ts +0 -4
  87. package/types/motherduck/duckdb-values/DuckDBTimestampMicroseconds.d.ts +0 -9
  88. package/types/motherduck/duckdb-values/DuckDBUUID.d.ts +0 -7
  89. package/types/motherduck/duckdb-values/SpecialDuckDBValue.d.ts +0 -5
  90. package/types/motherduck/duckdb-values/index.d.ts +0 -18
  91. /package/types/{motherduck/duckdb-data → @duckdb/data-reader}/AsyncDuckDBDataBatchIterator.d.ts +0 -0
  92. /package/types/{motherduck/duckdb-types → @duckdb/data-types}/parseLogicalTypeString.d.ts +0 -0
  93. /package/types/{motherduck/duckdb-values → @duckdb/data-values}/DuckDBMapEntry.d.ts +0 -0
  94. /package/types/{motherduck/duckdb-values → @duckdb/data-values}/DuckDBStructEntry.d.ts +0 -0
  95. /package/types/{motherduck/duckdb-values → @duckdb/data-values}/conversion/displayStringForDuckDBValue.d.ts +0 -0
  96. /package/types/{motherduck/duckdb-values → @duckdb/data-values}/conversion/hexFromBlob.d.ts +0 -0
  97. /package/types/{motherduck/duckdb-values → @duckdb/data-values}/conversion/stringFromBlob.d.ts +0 -0
  98. /package/types/{motherduck/duckdb-values → @duckdb/data-values}/conversion/stringFromDecimal.d.ts +0 -0
  99. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_browser_base.d.ts +0 -0
  100. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_browser_coi.d.ts +0 -0
  101. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_browser_eh.d.ts +0 -0
  102. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_browser_mvp.d.ts +0 -0
  103. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_node_base.d.ts +0 -0
  104. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_node_eh.d.ts +0 -0
  105. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/bindings_node_mvp.d.ts +0 -0
  106. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/file_stats.d.ts +0 -0
  107. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/index.d.ts +0 -0
  108. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/insert_options.d.ts +0 -0
  109. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/progress.d.ts +0 -0
  110. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/runtime_node.d.ts +0 -0
  111. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/tokens.d.ts +0 -0
  112. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/udf_function.d.ts +0 -0
  113. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/udf_runtime.d.ts +0 -0
  114. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/bindings/web_file.d.ts +0 -0
  115. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/index.d.ts +0 -0
  116. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/index_docs.d.ts +0 -0
  117. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/json_typedef.d.ts +0 -0
  118. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/parallel/index.d.ts +0 -0
  119. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/parallel/worker_dispatcher.d.ts +0 -0
  120. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-browser-blocking.d.ts +0 -0
  121. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-browser-coi.pthread.worker.d.ts +0 -0
  122. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-browser-coi.worker.d.ts +0 -0
  123. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-browser-eh.worker.d.ts +0 -0
  124. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-browser-mvp.worker.d.ts +0 -0
  125. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-node-blocking.d.ts +0 -0
  126. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-node-eh.worker.d.ts +0 -0
  127. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb-node-mvp.worker.d.ts +0 -0
  128. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/targets/duckdb.d.ts +0 -0
  129. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/utils/binary_dump.d.ts +0 -0
  130. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/utils/index.d.ts +0 -0
  131. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/version.d.ts +0 -0
  132. /package/types/{duckdb-wasm → @duckdb/duckdb-wasm}/worker.d.ts +0 -0
  133. /package/types/{motherduck → @motherduck}/duckdb-arrow/TypedTypeMap.d.ts +0 -0
  134. /package/types/{motherduck → @motherduck}/wasm-extension/MDEvent.d.ts +0 -0
  135. /package/types/{motherduck → @motherduck}/wasm-extension/MotherDuckEvent.d.ts +0 -0
  136. /package/types/{motherduck → @motherduck}/wasm-extension/MotherDuckLogLevel.d.ts +0 -0
  137. /package/types/{motherduck → @motherduck}/wasm-extension/doesBrowserSupportWorkerInWorker.d.ts +0 -0
  138. /package/types/{motherduck → @motherduck}/wasm-extension/fetchMotherDuckWasmExtensionVersion.d.ts +0 -0
  139. /package/types/{motherduck → @motherduck}/wasm-extension/fetchVersion.d.ts +0 -0
  140. /package/types/{motherduck → @motherduck}/wasm-extension/getExtensionRepository.d.ts +0 -0
  141. /package/types/{motherduck → @motherduck}/wasm-extension/index.d.ts +0 -0
  142. /package/types/{motherduck → @motherduck}/wasm-extension/loadMotherDuckWasmExtension.d.ts +0 -0
  143. /package/types/{motherduck → @motherduck}/wasm-extension/motherDuckEventFromMessageEvent.d.ts +0 -0
  144. /package/types/{motherduck → @motherduck}/wasm-extension/pathConcat.d.ts +0 -0
@@ -1,7 +1,9 @@
1
+ import { Json } from './Json.js';
1
2
  import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
2
- export declare class DuckDBTimestampSeconds extends SpecialDuckDBValue {
3
+ export declare class DuckDBTimestampSecondsValue extends SpecialDuckDBValue {
3
4
  readonly seconds: bigint;
4
5
  constructor(seconds: bigint);
5
6
  toDuckDBString(): string;
6
- toJS(): string;
7
+ toSql(): string;
8
+ toJson(): Json;
7
9
  }
@@ -0,0 +1,10 @@
1
+ import { DuckDBToStringOptions } from './DuckDBToStringOptions.js';
2
+ import { Json } from './Json.js';
3
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
4
+ export declare class DuckDBTimestampTZValue extends SpecialDuckDBValue {
5
+ readonly microseconds: bigint;
6
+ constructor(microseconds: bigint);
7
+ toDuckDBString(toStringOptions?: DuckDBToStringOptions): string;
8
+ toSql(): string;
9
+ toJson(): Json;
10
+ }
@@ -0,0 +1,3 @@
1
+ export interface DuckDBToStringOptions {
2
+ timezoneOffsetInMinutes?: number;
3
+ }
@@ -0,0 +1,17 @@
1
+ import { Json } from './Json.js';
2
+ import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
3
+ export declare class DuckDBUUIDValue extends SpecialDuckDBValue {
4
+ readonly bytes: Uint8Array;
5
+ constructor(bytes: Uint8Array);
6
+ toDuckDBString(): string;
7
+ toSql(): string;
8
+ toJson(): Json;
9
+ /**
10
+ * Create a DuckDBUUIDValue value from a HUGEINT as stored by DuckDB.
11
+ *
12
+ * UUID values are stored with their MSB flipped so their numeric ordering matches their string ordering.
13
+ */
14
+ static fromStoredHugeint(hugeint: bigint): DuckDBUUIDValue;
15
+ /** Create a DuckDBUUIDValue value from an unsigned 128-bit integer in a JS BigInt. */
16
+ static fromUint128(uint128: bigint): DuckDBUUIDValue;
17
+ }
@@ -1,3 +1,2 @@
1
1
  import { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
2
2
  export type DuckDBValue = null | boolean | number | string | bigint | SpecialDuckDBValue;
3
- export declare function duckDBValueToJS(value: DuckDBValue): any;
@@ -0,0 +1,3 @@
1
+ export type Json = null | boolean | number | string | Json[] | {
2
+ [key: string]: Json;
3
+ };
@@ -0,0 +1,8 @@
1
+ import { DuckDBToStringOptions } from './DuckDBToStringOptions.js';
2
+ import { Json } from './Json.js';
3
+ export declare abstract class SpecialDuckDBValue {
4
+ abstract toDuckDBString(toStringOptions?: DuckDBToStringOptions): string;
5
+ abstract toSql(): string;
6
+ toString(): string;
7
+ abstract toJson(): Json;
8
+ }
@@ -1,12 +1,16 @@
1
1
  export declare function getDuckDBDateStringFromYearMonthDay(year: number, month: number, dayOfMonth: number): string;
2
2
  export declare function getDuckDBDateStringFromDays(days: number): string;
3
+ export declare function getTimezoneOffsetString(timezoneOffsetInMinutes?: number): string | undefined;
4
+ export declare function getAbsoluteOffsetStringFromParts(hoursPart: number, minutesPart: number, secondsPart: number): string;
5
+ export declare function getOffsetStringFromAbsoluteSeconds(absoluteOffsetInSeconds: number): string;
6
+ export declare function getOffsetStringFromSeconds(offsetInSeconds: number): string;
3
7
  export declare function getDuckDBTimeStringFromParts(hoursPart: bigint, minutesPart: bigint, secondsPart: bigint, microsecondsPart: bigint): string;
4
8
  export declare function getDuckDBTimeStringFromPositiveMicroseconds(positiveMicroseconds: bigint): string;
5
9
  export declare function getDuckDBTimeStringFromMicrosecondsInDay(microsecondsInDay: bigint): string;
6
10
  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;
11
+ export declare function getDuckDBTimestampStringFromDaysAndMicroseconds(days: bigint, microsecondsInDay: bigint, timezonePart?: string): string;
12
+ export declare function getDuckDBTimestampStringFromMicroseconds(microseconds: bigint, timezoneOffsetInMinutes?: number): string;
13
+ export declare function getDuckDBTimestampStringFromSeconds(seconds: bigint): string;
14
+ export declare function getDuckDBTimestampStringFromMilliseconds(milliseconds: bigint): string;
15
+ export declare function getDuckDBTimestampStringFromNanoseconds(nanoseconds: bigint): string;
12
16
  export declare function getDuckDBIntervalString(months: number, days: number, microseconds: bigint): string;
@@ -0,0 +1,3 @@
1
+ import { DuckDBValue } from '../DuckDBValue.js';
2
+ /** Converts a DuckDBValue to a valid SQL string. */
3
+ export declare function duckDBValueToSql(value: DuckDBValue): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns the JS bigint value represented by the byte array a VARINT in DuckDB's internal format.
3
+ *
4
+ * DuckDB stores VARINTs as an array of bytes consisting of a three-byte header followed by a variable number of bytes
5
+ * (at least one). The header specifies the number of bytes after the header, and whether the number is positive or
6
+ * negative. The bytes after the header specify the absolute value of the number, in big endian format.
7
+ *
8
+ * The sign of the number is determined by the MSB of the header, which is 1 for positive and 0 for negative. Negative
9
+ * numbers also have all bytes of both the header and value inverted. (For negative numbers, the MSB is 0 after this
10
+ * inversion. Put another way: the MSB of the header is always 1, but it's inverted for negative numbers.)
11
+ */
12
+ export declare function getVarIntFromBytes(bytes: Uint8Array): bigint;
@@ -0,0 +1,3 @@
1
+ import { DuckDBValue } from '../DuckDBValue.js';
2
+ import { Json } from '../Json.js';
3
+ export declare function jsonFromDuckDBValue(value: DuckDBValue): Json;
@@ -0,0 +1,26 @@
1
+ export { duckDBValueToSql } from './conversion/duckDBValueToSql.js';
2
+ export { getVarIntFromBytes } from './conversion/getVarIntFromBytes.js';
3
+ export { jsonFromDuckDBValue } from './conversion/jsonFromDuckDBValue.js';
4
+ export { DuckDBArrayValue } from './DuckDBArrayValue.js';
5
+ export { DuckDBBitValue } from './DuckDBBitValue.js';
6
+ export { DuckDBBlobValue } from './DuckDBBlobValue.js';
7
+ export { DuckDBDateValue } from './DuckDBDateValue.js';
8
+ export { DuckDBDecimalValue } from './DuckDBDecimalValue.js';
9
+ export { DuckDBIntervalValue } from './DuckDBIntervalValue.js';
10
+ export { DuckDBListValue } from './DuckDBListValue.js';
11
+ export { DuckDBMapEntry } from './DuckDBMapEntry.js';
12
+ export { DuckDBMapValue } from './DuckDBMapValue.js';
13
+ export { DuckDBStructEntry } from './DuckDBStructEntry.js';
14
+ export { DuckDBStructValue } from './DuckDBStructValue.js';
15
+ export { DuckDBTimestampMicrosecondsValue } from './DuckDBTimestampMicrosecondsValue.js';
16
+ export { DuckDBTimestampMillisecondsValue } from './DuckDBTimestampMillisecondsValue.js';
17
+ export { DuckDBTimestampNanosecondsValue } from './DuckDBTimestampNanosecondsValue.js';
18
+ export { DuckDBTimestampSecondsValue } from './DuckDBTimestampSecondsValue.js';
19
+ export { DuckDBTimestampTZValue } from './DuckDBTimestampTZValue.js';
20
+ export { DuckDBTimeTZValue } from './DuckDBTimeTZValue.js';
21
+ export { DuckDBTimeValue } from './DuckDBTimeValue.js';
22
+ export { DuckDBToStringOptions } from './DuckDBToStringOptions.js';
23
+ export { DuckDBUUIDValue } from './DuckDBUUIDValue.js';
24
+ export { DuckDBValue } from './DuckDBValue.js';
25
+ export { Json } from './Json.js';
26
+ export { SpecialDuckDBValue } from './SpecialDuckDBValue.js';
@@ -70,13 +70,13 @@ export declare abstract class DuckDBBindingsBase implements DuckDBBindings {
70
70
  * On null, the query has to be executed using `pollPendingQuery` until that returns != null.
71
71
  * Results can then be fetched using `fetchQueryResults`
72
72
  */
73
- startPendingQuery(conn: number, text: string): Uint8Array | null;
73
+ startPendingQuery(conn: number, text: string, allowStreamResult?: boolean): Uint8Array | null;
74
74
  /** Poll a pending query */
75
75
  pollPendingQuery(conn: number): Uint8Array | null;
76
76
  /** Cancel a pending query */
77
77
  cancelPendingQuery(conn: number): boolean;
78
78
  /** Fetch query results */
79
- fetchQueryResults(conn: number): Uint8Array;
79
+ fetchQueryResults(conn: number): Uint8Array | null;
80
80
  /** Get table names */
81
81
  getTableNames(conn: number, text: string): string[];
82
82
  /** Create a scalar function */
@@ -103,12 +103,19 @@ export declare abstract class DuckDBBindingsBase implements DuckDBBindings {
103
103
  registerFileText(name: string, text: string): void;
104
104
  /** Register a file buffer */
105
105
  registerFileBuffer(name: string, buffer: Uint8Array): void;
106
+ prepareFileHandle(fileName: string, protocol: DuckDBDataProtocol): Promise<void>;
107
+ /** Prepare a file handle that could only be acquired aschronously */
108
+ prepareDBFileHandle(path: string, protocol: DuckDBDataProtocol): Promise<void>;
109
+ /** Prepare a file object URL */
110
+ prepareFileHandleAsync<HandleType>(name: string, handle: HandleType, protocol: DuckDBDataProtocol, directIO: boolean): Promise<HandleType>;
111
+ /** Register a file object URL async */
112
+ registerFileHandleAsync<HandleType>(name: string, handle: HandleType, protocol: DuckDBDataProtocol, directIO: boolean): Promise<void>;
106
113
  /** Register a file object URL */
107
114
  registerFileHandle<HandleType>(name: string, handle: HandleType, protocol: DuckDBDataProtocol, directIO: boolean): void;
108
115
  /** Drop file */
109
116
  dropFile(name: string): void;
110
117
  /** Drop files */
111
- dropFiles(): void;
118
+ dropFiles(names?: string[]): void;
112
119
  /** Flush all files */
113
120
  flushFiles(): void;
114
121
  /** Write a file to a path */
@@ -116,6 +123,7 @@ export declare abstract class DuckDBBindingsBase implements DuckDBBindings {
116
123
  /** Write a file to a buffer */
117
124
  copyFileToBuffer(name: string): Uint8Array;
118
125
  /** Enable tracking of file statistics */
126
+ registerOPFSFileName(file: string): Promise<void>;
119
127
  collectFileStatistics(file: string, enable: boolean): void;
120
128
  /** Export file statistics */
121
129
  exportFileStatistics(file: string): FileStatistics;
@@ -13,10 +13,10 @@ export interface DuckDBBindings {
13
13
  connect(): DuckDBConnection;
14
14
  disconnect(conn: number): void;
15
15
  runQuery(conn: number, text: string): Uint8Array;
16
- startPendingQuery(conn: number, text: string): Uint8Array | null;
16
+ startPendingQuery(conn: number, text: string, allowStreamResult: boolean): Uint8Array | null;
17
17
  pollPendingQuery(conn: number): Uint8Array | null;
18
18
  cancelPendingQuery(conn: number): boolean;
19
- fetchQueryResults(conn: number): Uint8Array;
19
+ fetchQueryResults(conn: number): Uint8Array | null;
20
20
  getTableNames(conn: number, text: string): string[];
21
21
  createPrepared(conn: number, text: string): number;
22
22
  closePrepared(conn: number, statement: number): void;
@@ -30,12 +30,17 @@ export interface DuckDBBindings {
30
30
  registerFileText(name: string, text: string): void;
31
31
  registerFileBuffer(name: string, buffer: Uint8Array): void;
32
32
  registerFileHandle<HandleType>(name: string, handle: HandleType, protocol: DuckDBDataProtocol, directIO: boolean): void;
33
+ registerFileHandleAsync<HandleType>(name: string, handle: HandleType, protocol: DuckDBDataProtocol, directIO: boolean): Promise<void>;
34
+ prepareFileHandleAsync<HandleType>(name: string, handle: HandleType, protocol: DuckDBDataProtocol, directIO: boolean): Promise<HandleType>;
35
+ prepareFileHandle(path: string, protocol: DuckDBDataProtocol): Promise<void>;
36
+ prepareDBFileHandle(path: string, protocol: DuckDBDataProtocol): Promise<void>;
33
37
  globFiles(path: string): WebFile[];
34
38
  dropFile(name: string): void;
35
- dropFiles(): void;
39
+ dropFiles(names?: string[]): void;
36
40
  flushFiles(): void;
37
41
  copyFileToPath(name: string, path: string): void;
38
42
  copyFileToBuffer(name: string): Uint8Array;
43
+ registerOPFSFileName(file: string): Promise<void>;
39
44
  collectFileStatistics(file: string, enable: boolean): void;
40
45
  exportFileStatistics(file: string): FileStatistics;
41
46
  }
@@ -21,11 +21,23 @@ export interface DuckDBQueryConfig {
21
21
  castDecimalToDouble?: boolean;
22
22
  }
23
23
  export interface DuckDBFilesystemConfig {
24
+ reliableHeadRequests?: boolean;
24
25
  /**
25
26
  * Allow falling back to full HTTP reads if the server does not support range requests.
26
27
  */
27
- reliableHeadRequests?: boolean;
28
28
  allowFullHTTPReads?: boolean;
29
+ /**
30
+ * Force use of full HTTP reads, suppressing range requests.
31
+ */
32
+ forceFullHTTPReads?: boolean;
33
+ }
34
+ export interface DuckDBOPFSConfig {
35
+ /**
36
+ * Defines how `opfs://` files are handled during SQL execution.
37
+ * - "auto": Automatically register `opfs://` files and drop them after execution.
38
+ * - "manual": Files must be manually registered and dropped.
39
+ */
40
+ fileHandling?: "auto" | "manual";
29
41
  }
30
42
  export declare enum DuckDBAccessMode {
31
43
  UNDEFINED = 0,
@@ -47,6 +59,10 @@ export interface DuckDBConfig {
47
59
  * Note that this will only work with cross-origin isolated sites since it requires SharedArrayBuffers.
48
60
  */
49
61
  maximumThreads?: number;
62
+ /**
63
+ * The direct io flag
64
+ */
65
+ useDirectIO?: boolean;
50
66
  /**
51
67
  * The query config
52
68
  */
@@ -59,8 +75,16 @@ export interface DuckDBConfig {
59
75
  * Whether to allow unsigned extensions
60
76
  */
61
77
  allowUnsignedExtensions?: boolean;
78
+ /**
79
+ * Whether to use alternate Arrow conversion that preserves full range and precision of data.
80
+ */
81
+ arrowLosslessConversion?: boolean;
62
82
  /**
63
83
  * Custom user agent string
64
84
  */
65
85
  customUserAgent?: string;
86
+ /**
87
+ * opfs string
88
+ */
89
+ opfs?: DuckDBOPFSConfig;
66
90
  }
@@ -20,7 +20,7 @@ export declare class DuckDBConnection {
20
20
  /** Send a query */
21
21
  send<T extends {
22
22
  [key: string]: arrow.DataType;
23
- } = any>(text: string): Promise<arrow.RecordBatchStreamReader<T>>;
23
+ } = any>(text: string, allowStreamResult?: boolean): Promise<arrow.RecordBatchStreamReader<T>>;
24
24
  /** Cancel a query that was sent earlier */
25
25
  cancelSent(): boolean;
26
26
  /** Get table names */
@@ -7,6 +7,8 @@ export interface DuckDBModule extends EmscriptenModule {
7
7
  stackSave: typeof stackSave;
8
8
  stackAlloc: typeof stackAlloc;
9
9
  stackRestore: typeof stackRestore;
10
+ lengthBytesUTF8: typeof lengthBytesUTF8;
11
+ stringToUTF8: typeof stringToUTF8;
10
12
  ccall: typeof ccall;
11
13
  PThread: PThread;
12
14
  }
@@ -25,7 +25,12 @@ export declare enum FileFlags {
25
25
  FILE_FLAGS_DIRECT_IO = 4,
26
26
  FILE_FLAGS_FILE_CREATE = 8,
27
27
  FILE_FLAGS_FILE_CREATE_NEW = 16,
28
- FILE_FLAGS_APPEND = 32
28
+ FILE_FLAGS_APPEND = 32,
29
+ FILE_FLAGS_PRIVATE = 64,
30
+ FILE_FLAGS_NULL_IF_NOT_EXISTS = 128,
31
+ FILE_FLAGS_PARALLEL_ACCESS = 256,
32
+ FILE_FLAGS_EXCLUSIVE_CREATE = 512,
33
+ FILE_FLAGS_NULL_IF_EXISTS = 1024
29
34
  }
30
35
  /** Configuration for the AWS S3 Filesystem */
31
36
  export interface S3Config {
@@ -44,6 +49,7 @@ export interface DuckDBFileInfo {
44
49
  dataUrl: string | null;
45
50
  reliableHeadRequests?: boolean;
46
51
  allowFullHttpReads?: boolean;
52
+ forceFullHttpReads?: boolean;
47
53
  s3Config?: S3Config;
48
54
  }
49
55
  /** Global info for all files registered with DuckDB */
@@ -51,8 +57,14 @@ export interface DuckDBGlobalFileInfo {
51
57
  cacheEpoch: number;
52
58
  reliableHeadRequests?: boolean;
53
59
  allowFullHttpReads?: boolean;
60
+ forceFullHttpReads?: boolean;
54
61
  s3Config?: S3Config;
55
62
  }
63
+ export interface PreparedDBFileHandle {
64
+ path: string;
65
+ handle: any;
66
+ fromCached: boolean;
67
+ }
56
68
  /** Call a function with packed response buffer */
57
69
  export declare function callSRet(mod: DuckDBModule, funcName: string, argTypes: Array<Emscripten.JSType>, args: Array<any>): [number, number, number];
58
70
  /** Drop response buffers */
@@ -66,6 +78,7 @@ export interface DuckDBRuntime {
66
78
  openFile(mod: DuckDBModule, fileId: number, flags: FileFlags): void;
67
79
  syncFile(mod: DuckDBModule, fileId: number): void;
68
80
  closeFile(mod: DuckDBModule, fileId: number): void;
81
+ dropFile(mod: DuckDBModule, fileNamePtr: number, fileNameLen: number): void;
69
82
  getLastFileModificationTime(mod: DuckDBModule, fileId: number): number;
70
83
  truncateFile(mod: DuckDBModule, fileId: number, newSize: number): void;
71
84
  readFile(mod: DuckDBModule, fileId: number, buffer: number, bytes: number, location: number): number;
@@ -78,6 +91,10 @@ export interface DuckDBRuntime {
78
91
  moveFile(mod: DuckDBModule, fromPtr: number, fromLen: number, toPtr: number, toLen: number): void;
79
92
  checkFile(mod: DuckDBModule, pathPtr: number, pathLen: number): boolean;
80
93
  removeFile(mod: DuckDBModule, pathPtr: number, pathLen: number): void;
94
+ prepareFileHandle?: (path: string, protocol: DuckDBDataProtocol) => Promise<PreparedDBFileHandle[]>;
95
+ prepareFileHandles?: (path: string[], protocol: DuckDBDataProtocol) => Promise<PreparedDBFileHandle[]>;
96
+ prepareDBFileHandle?: (path: string, protocol: DuckDBDataProtocol) => Promise<PreparedDBFileHandle[]>;
97
+ progressUpdate(final: number, percentage: number, iteration: number): void;
81
98
  callScalarUDF(mod: DuckDBModule, response: number, funcId: number, descPtr: number, descSize: number, ptrsPtr: number, ptrsSize: number): void;
82
99
  }
83
100
  export declare const DEFAULT_RUNTIME: DuckDBRuntime;
@@ -1,9 +1,13 @@
1
1
  import { DuckDBFileInfo, DuckDBGlobalFileInfo, DuckDBRuntime } from './runtime';
2
2
  import { DuckDBModule } from './duckdb_module';
3
3
  export declare const BROWSER_RUNTIME: DuckDBRuntime & {
4
+ _files: Map<string, any>;
4
5
  _fileInfoCache: Map<number, DuckDBFileInfo>;
5
6
  _globalFileInfo: DuckDBGlobalFileInfo | null;
7
+ _preparedHandles: Record<string, FileSystemSyncAccessHandle>;
8
+ _opfsRoot: FileSystemDirectoryHandle | null;
6
9
  getFileInfo(mod: DuckDBModule, fileId: number): DuckDBFileInfo | null;
7
10
  getGlobalFileInfo(mod: DuckDBModule): DuckDBGlobalFileInfo | null;
11
+ assignOPFSRoot(): Promise<void>;
8
12
  };
9
13
  export default BROWSER_RUNTIME;
@@ -36,6 +36,13 @@ export type LogEntry<O, T, E, V> = {
36
36
  readonly event: E;
37
37
  readonly value: V;
38
38
  };
39
+ export type ProgressEntry = {
40
+ readonly status: string;
41
+ readonly percentage: string;
42
+ readonly repetitions: string;
43
+ };
44
+ /** An execution progress handler */
45
+ export type ExecutionProgressHandler = (p: ProgressEntry) => void;
39
46
  export type LogEntryVariant = LogEntry<LogOrigin.BINDINGS, LogTopic.INSTANTIATE, LogEvent.ERROR, string> | LogEntry<LogOrigin.BINDINGS, LogTopic.QUERY, LogEvent.START, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.QUERY, LogEvent.OK, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.QUERY, LogEvent.ERROR, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.CONNECT, LogEvent.OK, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.CONNECT, LogEvent.ERROR, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.DISCONNECT, LogEvent.OK, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.DISCONNECT, LogEvent.ERROR, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.OPEN, LogEvent.START, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.OPEN, LogEvent.OK, void> | LogEntry<LogOrigin.BINDINGS, LogTopic.OPEN, LogEvent.ERROR, void> | LogEntry<LogOrigin.ASYNC_DUCKDB, LogTopic.QUERY, LogEvent.RUN, string>;
40
47
  export interface Logger {
41
48
  log(entry: LogEntryVariant): void;
@@ -9,6 +9,7 @@ import { DuckDBConfig } from '../bindings/config';
9
9
  import { InstantiationProgress } from '../bindings/progress';
10
10
  import { WebFile } from '../bindings/web_file';
11
11
  import { DuckDBDataProtocol } from '../bindings';
12
+ import { ProgressEntry } from '../log';
12
13
  export declare class AsyncDuckDB implements AsyncDuckDBBindings {
13
14
  /** The message handler */
14
15
  protected readonly _onMessageHandler: (event: MessageEvent) => void;
@@ -18,6 +19,8 @@ export declare class AsyncDuckDB implements AsyncDuckDBBindings {
18
19
  protected readonly _onCloseHandler: () => void;
19
20
  /** Instantiate the module */
20
21
  protected _onInstantiationProgress: ((p: InstantiationProgress) => void)[];
22
+ /** Progress callbacks */
23
+ protected _onExecutionProgress: ((p: ProgressEntry) => void)[];
21
24
  /** The logger */
22
25
  protected readonly _logger: Logger;
23
26
  /** The worker */
@@ -30,9 +33,13 @@ export declare class AsyncDuckDB implements AsyncDuckDBBindings {
30
33
  protected _nextMessageId: number;
31
34
  /** The pending requests */
32
35
  protected _pendingRequests: Map<number, WorkerTaskVariant>;
36
+ /** The DuckDBConfig */
37
+ protected _config: DuckDBConfig;
33
38
  constructor(logger: Logger, worker?: Worker | null);
34
39
  /** Get the logger */
35
40
  get logger(): Logger;
41
+ /** Get the logger */
42
+ get config(): DuckDBConfig;
36
43
  /** Attach to worker */
37
44
  protected attach(worker: Worker): void;
38
45
  /** Detach from worker */
@@ -47,6 +54,8 @@ export declare class AsyncDuckDB implements AsyncDuckDBBindings {
47
54
  protected onError(event: ErrorEvent): void;
48
55
  /** The worker was closed */
49
56
  protected onClose(): void;
57
+ /** Is in detached state, no worker defined */
58
+ isDetached(): boolean;
50
59
  /** Reset the duckdb */
51
60
  reset(): Promise<null>;
52
61
  /** Ping the worker thread */
@@ -54,7 +63,7 @@ export declare class AsyncDuckDB implements AsyncDuckDBBindings {
54
63
  /** Try to drop a file */
55
64
  dropFile(name: string): Promise<null>;
56
65
  /** Try to drop files */
57
- dropFiles(): Promise<null>;
66
+ dropFiles(names?: string[]): Promise<null>;
58
67
  /** Flush all files */
59
68
  flushFiles(): Promise<null>;
60
69
  /** Open the database */
@@ -75,14 +84,16 @@ export declare class AsyncDuckDB implements AsyncDuckDBBindings {
75
84
  disconnect(conn: ConnectionID): Promise<void>;
76
85
  /** Run a query */
77
86
  runQuery(conn: ConnectionID, text: string): Promise<Uint8Array>;
87
+ private _runQueryAsync;
78
88
  /** Start a pending query */
79
- startPendingQuery(conn: ConnectionID, text: string): Promise<Uint8Array | null>;
89
+ startPendingQuery(conn: ConnectionID, text: string, allowStreamResult?: boolean): Promise<Uint8Array | null>;
90
+ private _startPendingQueryAsync;
80
91
  /** Poll a pending query */
81
92
  pollPendingQuery(conn: ConnectionID): Promise<Uint8Array | null>;
82
93
  /** Cancel a pending query */
83
94
  cancelPendingQuery(conn: ConnectionID): Promise<boolean>;
84
95
  /** Fetch query results */
85
- fetchQueryResults(conn: ConnectionID): Promise<Uint8Array>;
96
+ fetchQueryResults(conn: ConnectionID): Promise<Uint8Array | null>;
86
97
  /** Get table names */
87
98
  getTableNames(conn: number, text: string): Promise<string[]>;
88
99
  /** Prepare a statement and return its identifier */
@@ -106,6 +117,8 @@ export declare class AsyncDuckDB implements AsyncDuckDBBindings {
106
117
  /** Register a file handle. */
107
118
  registerFileHandle<HandleType>(name: string, handle: HandleType, protocol: DuckDBDataProtocol, directIO: boolean): Promise<void>;
108
119
  /** Enable file statistics */
120
+ registerOPFSFileName(name: string): Promise<void>;
121
+ /** Enable file statistics */
109
122
  collectFileStatistics(name: string, enable: boolean): Promise<void>;
110
123
  /** Export file statistics */
111
124
  exportFileStatistics(name: string): Promise<FileStatistics>;
@@ -119,4 +132,6 @@ export declare class AsyncDuckDB implements AsyncDuckDBBindings {
119
132
  insertCSVFromPath(conn: ConnectionID, path: string, options: CSVInsertOptions): Promise<void>;
120
133
  /** Insert a json file */
121
134
  insertJSONFromPath(conn: ConnectionID, path: string, options: JSONInsertOptions): Promise<void>;
135
+ private shouldOPFSFileHandling;
136
+ private registerOPFSFileFromSQL;
122
137
  }
@@ -11,10 +11,10 @@ export interface AsyncDuckDBBindings {
11
11
  copyFileToBuffer(name: string): Promise<Uint8Array>;
12
12
  disconnect(conn: number): Promise<void>;
13
13
  runQuery(conn: number, text: string): Promise<Uint8Array>;
14
- startPendingQuery(conn: number, text: string): Promise<Uint8Array | null>;
14
+ startPendingQuery(conn: number, text: string, allowStreamResult: boolean): Promise<Uint8Array | null>;
15
15
  pollPendingQuery(conn: number): Promise<Uint8Array | null>;
16
16
  cancelPendingQuery(conn: number): Promise<boolean>;
17
- fetchQueryResults(conn: number): Promise<Uint8Array>;
17
+ fetchQueryResults(conn: number): Promise<Uint8Array | null>;
18
18
  createPrepared(conn: number, text: string): Promise<number>;
19
19
  closePrepared(conn: number, statement: number): Promise<void>;
20
20
  runPrepared(conn: number, statement: number, params: any[]): Promise<Uint8Array>;
@@ -22,4 +22,6 @@ export interface AsyncDuckDBBindings {
22
22
  insertArrowFromIPCStream(conn: number, buffer: Uint8Array, options?: CSVInsertOptions): Promise<void>;
23
23
  insertCSVFromPath(conn: number, path: string, options: CSVInsertOptions): Promise<void>;
24
24
  insertJSONFromPath(conn: number, path: string, options: JSONInsertOptions): Promise<void>;
25
+ dropFile(name: string): Promise<null>;
26
+ dropFiles(names?: string[]): Promise<null>;
25
27
  }
@@ -21,7 +21,7 @@ export declare class AsyncDuckDBConnection {
21
21
  /** Send a query */
22
22
  send<T extends {
23
23
  [key: string]: arrow.DataType;
24
- } = any>(text: string): Promise<arrow.AsyncRecordBatchStreamReader<T>>;
24
+ } = any>(text: string, allowStreamResult?: boolean): Promise<arrow.AsyncRecordBatchStreamReader<T>>;
25
25
  /** Cancel a query that was sent earlier */
26
26
  cancelSent(): Promise<boolean>;
27
27
  /** Get table names */
@@ -29,7 +29,7 @@ export declare class AsyncDuckDBConnection {
29
29
  /** Create a prepared statement */
30
30
  prepare<T extends {
31
31
  [key: string]: arrow.DataType;
32
- } = any>(text: string): Promise<AsyncPreparedStatement>;
32
+ } = any>(text: string): Promise<AsyncPreparedStatement<T>>;
33
33
  /** Insert an arrow table */
34
34
  insertArrowTable(table: arrow.Table, options: ArrowInsertOptions): Promise<void>;
35
35
  /** Insert an arrow table from an ipc stream */
@@ -49,7 +49,7 @@ export declare class AsyncResultStreamIterator implements AsyncIterable<Uint8Arr
49
49
  /** Reached end of stream? */
50
50
  protected _depleted: boolean;
51
51
  /** In-flight */
52
- protected _inFlight: Promise<Uint8Array> | null;
52
+ protected _inFlight: Promise<Uint8Array | null> | null;
53
53
  constructor(db: AsyncDuckDB, conn: number, header: Uint8Array);
54
54
  next(): Promise<IteratorResult<Uint8Array>>;
55
55
  [Symbol.asyncIterator](): this;
@@ -1,5 +1,5 @@
1
1
  import { CSVInsertOptions, JSONInsertOptions, ArrowInsertOptions } from '../bindings/insert_options';
2
- import { LogEntryVariant } from '../log';
2
+ import { LogEntryVariant, ProgressEntry } from '../log';
3
3
  import { ScriptTokens } from '../bindings/tokens';
4
4
  import { FileStatistics } from '../bindings/file_stats';
5
5
  import { DuckDBConfig } from '../bindings/config';
@@ -12,6 +12,7 @@ export declare enum WorkerRequestType {
12
12
  CANCEL_PENDING_QUERY = "CANCEL_PENDING_QUERY",
13
13
  CLOSE_PREPARED = "CLOSE_PREPARED",
14
14
  COLLECT_FILE_STATISTICS = "COLLECT_FILE_STATISTICS",
15
+ REGISTER_OPFS_FILE_NAME = "REGISTER_OPFS_FILE_NAME",
15
16
  CONNECT = "CONNECT",
16
17
  COPY_FILE_TO_BUFFER = "COPY_FILE_TO_BUFFER",
17
18
  COPY_FILE_TO_PATH = "COPY_FILE_TO_PATH",
@@ -53,6 +54,7 @@ export declare enum WorkerResponseType {
53
54
  FILE_STATISTICS = "FILE_STATISTICS",
54
55
  INSTANTIATE_PROGRESS = "INSTANTIATE_PROGRESS",
55
56
  LOG = "LOG",
57
+ PROGRESS_UPDATE = "PROGRESS_UPDATE",
56
58
  OK = "OK",
57
59
  PREPARED_STATEMENT_ID = "PREPARED_STATEMENT_ID",
58
60
  QUERY_PLAN = "QUERY_PLAN",
@@ -86,14 +88,14 @@ export declare class WorkerTask<T, D, P> {
86
88
  promiseRejecter: (value: any) => void;
87
89
  constructor(type: T, data: D);
88
90
  }
89
- export type WorkerRequestVariant = WorkerRequest<WorkerRequestType.CLOSE_PREPARED, [ConnectionID, StatementID]> | WorkerRequest<WorkerRequestType.CANCEL_PENDING_QUERY, number> | WorkerRequest<WorkerRequestType.COLLECT_FILE_STATISTICS, [string, boolean]> | WorkerRequest<WorkerRequestType.CONNECT, null> | WorkerRequest<WorkerRequestType.COPY_FILE_TO_BUFFER, string> | WorkerRequest<WorkerRequestType.COPY_FILE_TO_PATH, [string, string]> | WorkerRequest<WorkerRequestType.CREATE_PREPARED, [ConnectionID, string]> | WorkerRequest<WorkerRequestType.DISCONNECT, number> | WorkerRequest<WorkerRequestType.DROP_FILE, string> | WorkerRequest<WorkerRequestType.DROP_FILES, null> | WorkerRequest<WorkerRequestType.EXPORT_FILE_STATISTICS, string> | WorkerRequest<WorkerRequestType.FETCH_QUERY_RESULTS, number> | WorkerRequest<WorkerRequestType.FLUSH_FILES, null> | WorkerRequest<WorkerRequestType.GET_FEATURE_FLAGS, null> | WorkerRequest<WorkerRequestType.GET_TABLE_NAMES, [number, string]> | WorkerRequest<WorkerRequestType.GET_VERSION, null> | WorkerRequest<WorkerRequestType.GLOB_FILE_INFOS, string> | WorkerRequest<WorkerRequestType.INSERT_ARROW_FROM_IPC_STREAM, [
91
+ export type WorkerRequestVariant = WorkerRequest<WorkerRequestType.CLOSE_PREPARED, [ConnectionID, StatementID]> | WorkerRequest<WorkerRequestType.CANCEL_PENDING_QUERY, number> | WorkerRequest<WorkerRequestType.COLLECT_FILE_STATISTICS, [string, boolean]> | WorkerRequest<WorkerRequestType.REGISTER_OPFS_FILE_NAME, [string]> | WorkerRequest<WorkerRequestType.CONNECT, null> | WorkerRequest<WorkerRequestType.COPY_FILE_TO_BUFFER, string> | WorkerRequest<WorkerRequestType.COPY_FILE_TO_PATH, [string, string]> | WorkerRequest<WorkerRequestType.CREATE_PREPARED, [ConnectionID, string]> | WorkerRequest<WorkerRequestType.DISCONNECT, number> | WorkerRequest<WorkerRequestType.DROP_FILE, string> | WorkerRequest<WorkerRequestType.DROP_FILES, string[] | undefined> | WorkerRequest<WorkerRequestType.EXPORT_FILE_STATISTICS, string> | WorkerRequest<WorkerRequestType.FETCH_QUERY_RESULTS, number> | WorkerRequest<WorkerRequestType.FLUSH_FILES, null> | WorkerRequest<WorkerRequestType.GET_FEATURE_FLAGS, null> | WorkerRequest<WorkerRequestType.GET_TABLE_NAMES, [number, string]> | WorkerRequest<WorkerRequestType.GET_VERSION, null> | WorkerRequest<WorkerRequestType.GLOB_FILE_INFOS, string> | WorkerRequest<WorkerRequestType.INSERT_ARROW_FROM_IPC_STREAM, [
90
92
  number,
91
93
  Uint8Array,
92
94
  ArrowInsertOptions | undefined
93
- ]> | WorkerRequest<WorkerRequestType.INSERT_CSV_FROM_PATH, [number, string, CSVInsertOptions]> | WorkerRequest<WorkerRequestType.INSERT_JSON_FROM_PATH, [number, string, JSONInsertOptions]> | WorkerRequest<WorkerRequestType.INSTANTIATE, [string, string | null]> | WorkerRequest<WorkerRequestType.OPEN, DuckDBConfig> | WorkerRequest<WorkerRequestType.PING, null> | WorkerRequest<WorkerRequestType.POLL_PENDING_QUERY, number> | WorkerRequest<WorkerRequestType.REGISTER_FILE_BUFFER, [string, Uint8Array]> | WorkerRequest<WorkerRequestType.REGISTER_FILE_HANDLE, [string, any, DuckDBDataProtocol, boolean]> | WorkerRequest<WorkerRequestType.REGISTER_FILE_URL, [string, string, DuckDBDataProtocol, boolean]> | WorkerRequest<WorkerRequestType.RESET, null> | WorkerRequest<WorkerRequestType.RUN_PREPARED, [number, number, any[]]> | WorkerRequest<WorkerRequestType.RUN_QUERY, [number, string]> | WorkerRequest<WorkerRequestType.SEND_PREPARED, [number, number, any[]]> | WorkerRequest<WorkerRequestType.START_PENDING_QUERY, [number, string]> | WorkerRequest<WorkerRequestType.TOKENIZE, string>;
94
- export type WorkerResponseVariant = WorkerResponse<WorkerResponseType.CONNECTION_INFO, number> | WorkerResponse<WorkerResponseType.ERROR, any> | WorkerResponse<WorkerResponseType.FEATURE_FLAGS, number> | WorkerResponse<WorkerResponseType.FILE_BUFFER, Uint8Array> | WorkerResponse<WorkerResponseType.FILE_INFOS, WebFile[]> | WorkerResponse<WorkerResponseType.FILE_SIZE, number> | WorkerResponse<WorkerResponseType.FILE_STATISTICS, FileStatistics> | WorkerResponse<WorkerResponseType.INSTANTIATE_PROGRESS, InstantiationProgress> | WorkerResponse<WorkerResponseType.LOG, LogEntryVariant> | WorkerResponse<WorkerResponseType.OK, null> | WorkerResponse<WorkerResponseType.PREPARED_STATEMENT_ID, number> | WorkerResponse<WorkerResponseType.QUERY_PLAN, Uint8Array> | WorkerResponse<WorkerResponseType.QUERY_RESULT, Uint8Array> | WorkerResponse<WorkerResponseType.QUERY_RESULT_CHUNK, Uint8Array> | WorkerResponse<WorkerResponseType.QUERY_RESULT_HEADER, Uint8Array> | WorkerResponse<WorkerResponseType.QUERY_RESULT_HEADER_OR_NULL, Uint8Array | null> | WorkerResponse<WorkerResponseType.SCRIPT_TOKENS, ScriptTokens> | WorkerResponse<WorkerResponseType.SUCCESS, boolean> | WorkerResponse<WorkerResponseType.TABLE_NAMES, string[]> | WorkerResponse<WorkerResponseType.VERSION_STRING, string>;
95
- export type WorkerTaskVariant = WorkerTask<WorkerRequestType.COLLECT_FILE_STATISTICS, [string, boolean], null> | WorkerTask<WorkerRequestType.CLOSE_PREPARED, [number, number], null> | WorkerTask<WorkerRequestType.CONNECT, null, ConnectionID> | WorkerTask<WorkerRequestType.COPY_FILE_TO_BUFFER, string, Uint8Array> | WorkerTask<WorkerRequestType.COPY_FILE_TO_PATH, [string, string], null> | WorkerTask<WorkerRequestType.CREATE_PREPARED, [number, string], number> | WorkerTask<WorkerRequestType.DISCONNECT, ConnectionID, null> | WorkerTask<WorkerRequestType.DROP_FILE, string, null> | WorkerTask<WorkerRequestType.DROP_FILES, null, null> | WorkerTask<WorkerRequestType.EXPORT_FILE_STATISTICS, string, FileStatistics> | WorkerTask<WorkerRequestType.FETCH_QUERY_RESULTS, ConnectionID, Uint8Array> | WorkerTask<WorkerRequestType.FLUSH_FILES, null, null> | WorkerTask<WorkerRequestType.GET_FEATURE_FLAGS, null, number> | WorkerTask<WorkerRequestType.GET_TABLE_NAMES, [number, string], string[]> | WorkerTask<WorkerRequestType.GET_VERSION, null, string> | WorkerTask<WorkerRequestType.INSERT_ARROW_FROM_IPC_STREAM, [
95
+ ]> | WorkerRequest<WorkerRequestType.INSERT_CSV_FROM_PATH, [number, string, CSVInsertOptions]> | WorkerRequest<WorkerRequestType.INSERT_JSON_FROM_PATH, [number, string, JSONInsertOptions]> | WorkerRequest<WorkerRequestType.INSTANTIATE, [string, string | null]> | WorkerRequest<WorkerRequestType.OPEN, DuckDBConfig> | WorkerRequest<WorkerRequestType.PING, null> | WorkerRequest<WorkerRequestType.POLL_PENDING_QUERY, number> | WorkerRequest<WorkerRequestType.REGISTER_FILE_BUFFER, [string, Uint8Array]> | WorkerRequest<WorkerRequestType.REGISTER_FILE_HANDLE, [string, any, DuckDBDataProtocol, boolean]> | WorkerRequest<WorkerRequestType.REGISTER_FILE_URL, [string, string, DuckDBDataProtocol, boolean]> | WorkerRequest<WorkerRequestType.RESET, null> | WorkerRequest<WorkerRequestType.RUN_PREPARED, [number, number, any[]]> | WorkerRequest<WorkerRequestType.RUN_QUERY, [number, string]> | WorkerRequest<WorkerRequestType.SEND_PREPARED, [number, number, any[]]> | WorkerRequest<WorkerRequestType.START_PENDING_QUERY, [number, string, boolean]> | WorkerRequest<WorkerRequestType.TOKENIZE, string>;
96
+ export type WorkerResponseVariant = WorkerResponse<WorkerResponseType.CONNECTION_INFO, number> | WorkerResponse<WorkerResponseType.ERROR, any> | WorkerResponse<WorkerResponseType.FEATURE_FLAGS, number> | WorkerResponse<WorkerResponseType.FILE_BUFFER, Uint8Array> | WorkerResponse<WorkerResponseType.FILE_INFOS, WebFile[]> | WorkerResponse<WorkerResponseType.FILE_SIZE, number> | WorkerResponse<WorkerResponseType.FILE_STATISTICS, FileStatistics> | WorkerResponse<WorkerResponseType.INSTANTIATE_PROGRESS, InstantiationProgress> | WorkerResponse<WorkerResponseType.LOG, LogEntryVariant> | WorkerResponse<WorkerResponseType.PROGRESS_UPDATE, ProgressEntry> | WorkerResponse<WorkerResponseType.OK, null> | WorkerResponse<WorkerResponseType.PREPARED_STATEMENT_ID, number> | WorkerResponse<WorkerResponseType.QUERY_PLAN, Uint8Array> | WorkerResponse<WorkerResponseType.QUERY_RESULT, Uint8Array> | WorkerResponse<WorkerResponseType.QUERY_RESULT_CHUNK, Uint8Array | null> | WorkerResponse<WorkerResponseType.QUERY_RESULT_HEADER, Uint8Array> | WorkerResponse<WorkerResponseType.QUERY_RESULT_HEADER_OR_NULL, Uint8Array | null> | WorkerResponse<WorkerResponseType.SCRIPT_TOKENS, ScriptTokens> | WorkerResponse<WorkerResponseType.SUCCESS, boolean> | WorkerResponse<WorkerResponseType.TABLE_NAMES, string[]> | WorkerResponse<WorkerResponseType.VERSION_STRING, string>;
97
+ export type WorkerTaskVariant = WorkerTask<WorkerRequestType.COLLECT_FILE_STATISTICS, [string, boolean], null> | WorkerTask<WorkerRequestType.REGISTER_OPFS_FILE_NAME, [string], null> | WorkerTask<WorkerRequestType.CLOSE_PREPARED, [number, number], null> | WorkerTask<WorkerRequestType.CONNECT, null, ConnectionID> | WorkerTask<WorkerRequestType.COPY_FILE_TO_BUFFER, string, Uint8Array> | WorkerTask<WorkerRequestType.COPY_FILE_TO_PATH, [string, string], null> | WorkerTask<WorkerRequestType.CREATE_PREPARED, [number, string], number> | WorkerTask<WorkerRequestType.DISCONNECT, ConnectionID, null> | WorkerTask<WorkerRequestType.DROP_FILE, string, null> | WorkerTask<WorkerRequestType.DROP_FILES, string[] | undefined, null> | WorkerTask<WorkerRequestType.EXPORT_FILE_STATISTICS, string, FileStatistics> | WorkerTask<WorkerRequestType.FETCH_QUERY_RESULTS, ConnectionID, Uint8Array | null> | WorkerTask<WorkerRequestType.FLUSH_FILES, null, null> | WorkerTask<WorkerRequestType.GET_FEATURE_FLAGS, null, number> | WorkerTask<WorkerRequestType.GET_TABLE_NAMES, [number, string], string[]> | WorkerTask<WorkerRequestType.GET_VERSION, null, string> | WorkerTask<WorkerRequestType.INSERT_ARROW_FROM_IPC_STREAM, [
96
98
  number,
97
99
  Uint8Array,
98
100
  ArrowInsertOptions | undefined
99
- ], null> | WorkerTask<WorkerRequestType.INSERT_CSV_FROM_PATH, [number, string, CSVInsertOptions], null> | WorkerTask<WorkerRequestType.INSERT_JSON_FROM_PATH, [number, string, JSONInsertOptions], null> | WorkerTask<WorkerRequestType.INSTANTIATE, [string, string | null], null> | WorkerTask<WorkerRequestType.OPEN, DuckDBConfig, null> | WorkerTask<WorkerRequestType.PING, null, null> | WorkerTask<WorkerRequestType.REGISTER_FILE_BUFFER, [string, Uint8Array], null> | WorkerTask<WorkerRequestType.REGISTER_FILE_HANDLE, [string, any, DuckDBDataProtocol, boolean], null> | WorkerTask<WorkerRequestType.REGISTER_FILE_URL, [string, string, DuckDBDataProtocol, boolean], null> | WorkerTask<WorkerRequestType.GLOB_FILE_INFOS, string, WebFile[]> | WorkerTask<WorkerRequestType.RESET, null, null> | WorkerTask<WorkerRequestType.RUN_PREPARED, [number, number, any[]], Uint8Array> | WorkerTask<WorkerRequestType.RUN_QUERY, [ConnectionID, string], Uint8Array> | WorkerTask<WorkerRequestType.SEND_PREPARED, [number, number, any[]], Uint8Array> | WorkerTask<WorkerRequestType.START_PENDING_QUERY, [ConnectionID, string], Uint8Array | null> | WorkerTask<WorkerRequestType.POLL_PENDING_QUERY, ConnectionID, Uint8Array | null> | WorkerTask<WorkerRequestType.CANCEL_PENDING_QUERY, ConnectionID, boolean> | WorkerTask<WorkerRequestType.TOKENIZE, string, ScriptTokens>;
101
+ ], null> | WorkerTask<WorkerRequestType.INSERT_CSV_FROM_PATH, [number, string, CSVInsertOptions], null> | WorkerTask<WorkerRequestType.INSERT_JSON_FROM_PATH, [number, string, JSONInsertOptions], null> | WorkerTask<WorkerRequestType.INSTANTIATE, [string, string | null], null> | WorkerTask<WorkerRequestType.OPEN, DuckDBConfig, null> | WorkerTask<WorkerRequestType.PING, null, null> | WorkerTask<WorkerRequestType.REGISTER_FILE_BUFFER, [string, Uint8Array], null> | WorkerTask<WorkerRequestType.REGISTER_FILE_HANDLE, [string, any, DuckDBDataProtocol, boolean], null> | WorkerTask<WorkerRequestType.REGISTER_FILE_URL, [string, string, DuckDBDataProtocol, boolean], null> | WorkerTask<WorkerRequestType.GLOB_FILE_INFOS, string, WebFile[]> | WorkerTask<WorkerRequestType.RESET, null, null> | WorkerTask<WorkerRequestType.RUN_PREPARED, [number, number, any[]], Uint8Array> | WorkerTask<WorkerRequestType.RUN_QUERY, [ConnectionID, string], Uint8Array> | WorkerTask<WorkerRequestType.SEND_PREPARED, [number, number, any[]], Uint8Array> | WorkerTask<WorkerRequestType.START_PENDING_QUERY, [ConnectionID, string, boolean], Uint8Array | null> | WorkerTask<WorkerRequestType.POLL_PENDING_QUERY, ConnectionID, Uint8Array | null> | WorkerTask<WorkerRequestType.CANCEL_PENDING_QUERY, ConnectionID, boolean> | WorkerTask<WorkerRequestType.TOKENIZE, string, ScriptTokens>;
@@ -2,10 +2,10 @@ export declare const isNode: () => boolean;
2
2
  export declare const isFirefox: () => boolean;
3
3
  export declare const isSafari: () => boolean;
4
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
- */
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
9
  export interface DuckDBBundles {
10
10
  mvp: {
11
11
  mainModule: string;
@@ -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,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[];
@@ -1,4 +1,4 @@
1
- import { S3Config } from "../bindings";
1
+ import { S3Config } from '../bindings';
2
2
  export interface S3Params {
3
3
  url: string;
4
4
  query: string;
@@ -1,5 +1,5 @@
1
1
  import { RecordBatch } from 'apache-arrow';
2
- import { AsyncDuckDBDataBatchIterator, DuckDBData, DuckDBDataBatchIteratorResult } from '../../motherduck/duckdb-data';
2
+ import { AsyncDuckDBDataBatchIterator, DuckDBData, DuckDBDataBatchIteratorResult } from '../../@duckdb/data-reader';
3
3
  import { TypedTypeMap } from './TypedTypeMap.js';
4
4
  export type AsyncRecordBatchIterator = AsyncIterator<RecordBatch<TypedTypeMap>, RecordBatch<TypedTypeMap> | undefined>;
5
5
  export declare class AsyncDuckDBRecordBatchIterator implements AsyncDuckDBDataBatchIterator {