@motherduck/wasm-client 0.4.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.
- package/README.md +218 -0
- package/index.js +1 -0
- package/index.js.map +7 -0
- package/index_with_arrow.js +20 -0
- package/package.json +21 -0
- package/types/LogSink.d.ts +6 -0
- package/types/MaterializedQueryTask.d.ts +15 -0
- package/types/QueryTypes.d.ts +48 -0
- package/types/StreamingQueryTask.d.ts +14 -0
- package/types/TaskSequencer.d.ts +56 -0
- package/types/api.d.ts +32 -0
- package/types/arrow/AsyncDuckDBRecordBatchIterator.d.ts +13 -0
- package/types/arrow/DuckDBRecordBatch.d.ts +14 -0
- package/types/arrow/TypedTypeMap.d.ts +2 -0
- package/types/arrow/duckDBTypeFromArrowType.d.ts +4 -0
- package/types/arrow/duckDBValueFromArrowData.d.ts +8 -0
- package/types/createDeferred.d.ts +6 -0
- package/types/createHRTime.d.ts +1 -0
- package/types/duckdb/AsyncDuckDBDataBatchIterator.d.ts +3 -0
- package/types/duckdb/DuckDBData.d.ts +56 -0
- package/types/duckdb/DuckDBDataReader.d.ts +68 -0
- package/types/duckdb/DuckDBRow.d.ts +4 -0
- package/types/duckdb/conversion/dateTimeStringConversion.d.ts +12 -0
- package/types/duckdb/conversion/displayStringForDuckDBValue.d.ts +2 -0
- package/types/duckdb/conversion/stringFromBlob.d.ts +2 -0
- package/types/duckdb/conversion/stringFromDecimal.d.ts +18 -0
- package/types/duckdb/files.d.ts +13 -0
- package/types/duckdb/types/DuckDBType.d.ts +110 -0
- package/types/duckdb/types/DuckDBTypes.d.ts +39 -0
- package/types/duckdb/types/index.d.ts +2 -0
- package/types/duckdb/values/DuckDBBlob.d.ts +6 -0
- package/types/duckdb/values/DuckDBDate.d.ts +6 -0
- package/types/duckdb/values/DuckDBDecimal.d.ts +10 -0
- package/types/duckdb/values/DuckDBInterval.d.ts +8 -0
- package/types/duckdb/values/DuckDBList.d.ts +7 -0
- package/types/duckdb/values/DuckDBMap.d.ts +7 -0
- package/types/duckdb/values/DuckDBMapEntry.d.ts +5 -0
- package/types/duckdb/values/DuckDBStruct.d.ts +7 -0
- package/types/duckdb/values/DuckDBStructEntry.d.ts +5 -0
- package/types/duckdb/values/DuckDBTime.d.ts +6 -0
- package/types/duckdb/values/DuckDBTimestampMicroseconds.d.ts +8 -0
- package/types/duckdb/values/DuckDBTimestampMilliseconds.d.ts +6 -0
- package/types/duckdb/values/DuckDBTimestampNanoseconds.d.ts +6 -0
- package/types/duckdb/values/DuckDBTimestampSeconds.d.ts +6 -0
- package/types/duckdb/values/DuckDBValue.d.ts +2 -0
- package/types/duckdb/values/SpecialDuckDBValue.d.ts +4 -0
- package/types/duckdb/values/index.d.ts +16 -0
- package/types/duckdb/worker_factory.d.ts +13 -0
- package/types/extractWrappedErrorMessage.d.ts +17 -0
- package/types/getErrorMessage.d.ts +1 -0
- package/types/index.d.ts +12 -0
- package/types/nowMicroSec.d.ts +1 -0
- package/types/observability.d.ts +26 -0
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
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';
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
12
|
+
export declare function createDuckDbConnection(params: MDConnectionParams): Promise<AsyncDuckDBConnection>;
|
|
13
|
+
export declare function getAsyncDuckDb(params: MDConnectionParams): Promise<AsyncDuckDB>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given an error message string containing a wrapped, JSON-stringified error object
|
|
3
|
+
* after some prefix, attempt to extract and return the message from that inner object.
|
|
4
|
+
*
|
|
5
|
+
* Useful for getting display strings from error messages received through the DuckDB WASM client,
|
|
6
|
+
* which are often wrapped in this way and contain one or more prefixes. The inner message
|
|
7
|
+
* is typically more useful to the end user.
|
|
8
|
+
*
|
|
9
|
+
* Any sequence of characters not containing an opening '{' is treated as a prefix.
|
|
10
|
+
* In practice, the prefix will typically contain one or more error types each
|
|
11
|
+
* followed by " Error: ", such as "Invalid Error: ", but a wider set of prefixes
|
|
12
|
+
* is accepted to protect against future change.
|
|
13
|
+
*
|
|
14
|
+
* If the input does not match the expected pattern, or the JSON parsing fails,
|
|
15
|
+
* the input string is returned unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractWrappedErrorMessage(message: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getErrorMessage(maybeError: unknown): string;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './QueryTypes';
|
|
2
|
+
export * from './api';
|
|
3
|
+
export * from './arrow/TypedTypeMap';
|
|
4
|
+
export * from './duckdb/AsyncDuckDBDataBatchIterator';
|
|
5
|
+
export * from './duckdb/DuckDBData';
|
|
6
|
+
export * from './duckdb/DuckDBDataReader';
|
|
7
|
+
export * from './duckdb/DuckDBRow';
|
|
8
|
+
export * from './duckdb/files';
|
|
9
|
+
export * from './duckdb/types';
|
|
10
|
+
export * from './duckdb/values';
|
|
11
|
+
export { MDConnectionParams, getAsyncDuckDb } from './duckdb/worker_factory';
|
|
12
|
+
export * from './observability';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const nowMicroSec: any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
debug(message: string, context?: any): void;
|
|
3
|
+
info(message: string, context?: any): void;
|
|
4
|
+
log(message: string, context?: any): void;
|
|
5
|
+
warn(message: string, context?: any): void;
|
|
6
|
+
error(message: string, context?: any): void;
|
|
7
|
+
userAction(name: string, context?: any): void;
|
|
8
|
+
appAction(name: string, context: any): void;
|
|
9
|
+
startSpan(name: string, context?: any): Span;
|
|
10
|
+
finishSpan(span: Span): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class Span {
|
|
13
|
+
startTimeMs: number;
|
|
14
|
+
timeTakenMs: number;
|
|
15
|
+
name: string;
|
|
16
|
+
logger: Logger;
|
|
17
|
+
context: any;
|
|
18
|
+
spanId: string;
|
|
19
|
+
private internalError;
|
|
20
|
+
constructor(name: string, logger: Logger, context: any);
|
|
21
|
+
finish(): void;
|
|
22
|
+
setContextProperty(key: string, value: any): void;
|
|
23
|
+
get error(): Error | null;
|
|
24
|
+
set error(err: Error | null);
|
|
25
|
+
}
|
|
26
|
+
export declare function sanitize(queryText: string): string;
|