@duckdb/node-bindings 1.1.3-alpha.8 → 1.2.0-alpha.13

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018-2023 Stichting DuckDB Foundation
1
+ Copyright 2018-2025 Stichting DuckDB Foundation
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/duckdb.d.ts CHANGED
@@ -840,7 +840,7 @@ export function vector_ensure_validity_writable(vector: Vector): void;
840
840
  export function vector_assign_string_element(vector: Vector, index: number, str: string): void;
841
841
 
842
842
  // DUCKDB_API void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, idx_t str_len);
843
- // not exposed: JS string includes length
843
+ export function vector_assign_string_element_len(vector: Vector, index: number, data: Uint8Array): void;
844
844
 
845
845
  // DUCKDB_API duckdb_vector duckdb_list_vector_get_child(duckdb_vector vector);
846
846
  export function list_vector_get_child(vector: Vector): Vector;
@@ -1110,3 +1110,23 @@ export function fetch_chunk(result: Result): Promise<DataChunk | null>;
1110
1110
  * Used to read from `duckdb_string_t`s with non-inlined data that are embedded in VARCHAR, BLOB, and BIT vectors.
1111
1111
  */
1112
1112
  export function get_data_from_pointer(array_buffer: ArrayBuffer, pointer_offset: number, byte_count: number): Uint8Array;
1113
+
1114
+ // ADDED
1115
+ /**
1116
+ * Copy `source_byte_count` bytes from `source_buffer` at `source_byte_offset` into `target_vector` at `target_byte_offset`.
1117
+ *
1118
+ * Used to write to data chunks.
1119
+ *
1120
+ * Performs an efficient-but-unsafe memory copy. Use with care.
1121
+ */
1122
+ export function copy_data_to_vector(target_vector: Vector, target_byte_offset: number, source_buffer: ArrayBuffer, source_byte_offset: number, source_byte_count: number): void;
1123
+
1124
+ // ADDED
1125
+ /**
1126
+ * Copy `source_byte_count` bytes from `source_buffer` at `source_byte_offset` into the validity of `target_vector` at `target_byte_offset`.
1127
+ *
1128
+ * Used to write to data chunks.
1129
+ *
1130
+ * Performs an efficient-but-unsafe memory copy. Use with care.
1131
+ */
1132
+ export function copy_data_to_vector_validity(target_vector: Vector, target_byte_offset: number, source_buffer: ArrayBuffer, source_byte_offset: number, source_byte_count: number): void;
package/duckdb.js CHANGED
@@ -1 +1,24 @@
1
- module.exports = require(`@duckdb/node-bindings-${process.platform}-${process.arch}/duckdb.node`);
1
+ const getRuntimePlatformArch = () => `${process.platform}-${process.arch}`;
2
+
3
+ /**
4
+ * @throw Error if there isn't any available native binding for the current platform/arch.
5
+ */
6
+ const getNativeNodeBinding = (runtimePlatformArch) => {
7
+ switch(runtimePlatformArch) {
8
+ case `linux-x64`:
9
+ return require('@duckdb/node-bindings-linux-x64/duckdb.node');
10
+ case 'linux-arm64':
11
+ return require('@duckdb/node-bindings-linux-arm64/duckdb.node');
12
+ case 'darwin-arm64':
13
+ return require('@duckdb/node-bindings-darwin-arm64/duckdb.node');
14
+ case 'darwin-x64':
15
+ return require('@duckdb/node-bindings-darwin-x64/duckdb.node');
16
+ case 'win32-x64':
17
+ return require('@duckdb/node-bindings-win32-x64/duckdb.node');
18
+ default:
19
+ const [platform, arch] = runtimePlatformArch.split('-')
20
+ throw new Error(`Error loading duckdb native binding: unsupported arch '${arch}' for platform '${platform}'`);
21
+ }
22
+ }
23
+
24
+ module.exports = getNativeNodeBinding(getRuntimePlatformArch());
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@duckdb/node-bindings",
3
- "version": "1.1.3-alpha.8",
3
+ "version": "1.2.0-alpha.13",
4
+ "license": "MIT",
4
5
  "main": "./duckdb.js",
5
6
  "types": "./duckdb.d.ts",
6
7
  "optionalDependencies": {
7
- "@duckdb/node-bindings-darwin-arm64": "1.1.3-alpha.8",
8
- "@duckdb/node-bindings-darwin-x64": "1.1.3-alpha.8",
9
- "@duckdb/node-bindings-linux-arm64": "1.1.3-alpha.8",
10
- "@duckdb/node-bindings-linux-x64": "1.1.3-alpha.8",
11
- "@duckdb/node-bindings-win32-x64": "1.1.3-alpha.8"
8
+ "@duckdb/node-bindings-darwin-x64": "1.2.0-alpha.13",
9
+ "@duckdb/node-bindings-darwin-arm64": "1.2.0-alpha.13",
10
+ "@duckdb/node-bindings-linux-x64": "1.2.0-alpha.13",
11
+ "@duckdb/node-bindings-win32-x64": "1.2.0-alpha.13",
12
+ "@duckdb/node-bindings-linux-arm64": "1.2.0-alpha.13"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",