duckdb 0.6.2-dev6.0 → 0.6.2-dev604.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 (32) hide show
  1. package/.mocharc.json +2 -2
  2. package/README.md +17 -0
  3. package/lib/duckdb.d.ts +29 -11
  4. package/lib/duckdb.js +6 -0
  5. package/package.json +1 -1
  6. package/src/duckdb.cpp +17094 -14736
  7. package/src/duckdb.hpp +9807 -9354
  8. package/src/parquet-amalgamation.cpp +35355 -35128
  9. package/src/parquet-amalgamation.hpp +46 -4
  10. package/test/{affected.test.js → affected.test.ts} +8 -10
  11. package/test/{arrow.test.js → arrow.test.ts} +12 -11
  12. package/test/{data_type_support.test.js → data_type_support.test.ts} +36 -35
  13. package/test/{database_fail.test.js → database_fail.test.ts} +25 -24
  14. package/test/{each.test.js → each.test.ts} +10 -9
  15. package/test/{exec.test.js → exec.test.ts} +7 -6
  16. package/test/{extension.test.js → extension.test.ts} +20 -19
  17. package/test/{interrupt.test.js → interrupt.test.ts} +7 -7
  18. package/test/{jsdoc.test.js → jsdoc.test.ts} +19 -20
  19. package/test/{named_columns.test.js → named_columns.test.ts} +4 -6
  20. package/test/{null_error.test.js → null_error.test.ts} +5 -6
  21. package/test/{open_close.test.js → open_close.test.ts} +10 -10
  22. package/test/{parallel_insert.test.js → parallel_insert.test.ts} +6 -7
  23. package/test/{parquet.js → parquet.test.ts} +2 -4
  24. package/test/{pathnames.test.js → pathnames.test.ts} +24 -22
  25. package/test/{prepare.test.js → prepare.test.ts} +53 -50
  26. package/test/{query_result.test.js → query_result.test.ts} +4 -4
  27. package/test/{serialization.test.js → serialization.test.ts} +10 -9
  28. package/test/support/helper.ts +42 -0
  29. package/test/{syntax_error.test.js → syntax_error.test.ts} +4 -4
  30. package/test/{udf.test.js → udf.test.ts} +26 -25
  31. package/test/{unicode.test.js → unicode.test.ts} +23 -22
  32. package/test/support/helper.js +0 -37
package/.mocharc.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extension": ["js", "ts"],
3
- "spec": ["test/*.js", "test/*.ts"],
2
+ "extension": ["ts"],
3
+ "spec": ["test/*.ts"],
4
4
  "require": "ts-node/register"
5
5
  }
package/README.md CHANGED
@@ -99,3 +99,20 @@ var stmt = con.prepare('select ?::INTEGER as fortytwo', function(err, stmt) {
99
99
  });
100
100
  });
101
101
  ```
102
+
103
+ ## Development
104
+
105
+ ### First install:
106
+
107
+ To install all the dev dependencies of the project, navigate over to `tools/nodejs` and run `npm install` (this uses package.json)
108
+ You might want to add the `--ignore-scripts` option if you don't care about building the package for now and just want to install the dependencies.
109
+
110
+ ### Tests:
111
+ Tests are located in `tools/nodejs/test` and can be run with `npm test`
112
+ To run a single test, you can use `npm test -- --grep "name of test as given in describe"`
113
+
114
+ ### Additional notes:
115
+ To build the NodeJS package from source, when on Windows, requires the following extra steps:
116
+ - Set `OPENSSL_ROOT_DIR` to the root directory of an OpenSSL installation
117
+ - Supply the `STATIC_OPENSSL=1` option when executing `make`, or set `-DOPENSSL_USE_STATIC_LIBS=1` manually when calling `cmake`
118
+
package/lib/duckdb.d.ts CHANGED
@@ -49,15 +49,16 @@ export class QueryResult {
49
49
  }
50
50
 
51
51
  export class Database {
52
- constructor(path: string, accessMode?: number, callback?: Callback<any>);
52
+ constructor(path: string, accessMode?: number | Record<string,string>, callback?: Callback<any>);
53
+ constructor(path: string, callback?: Callback<any>);
53
54
 
54
- close(callback: Callback<void>): void;
55
+ close(callback?: Callback<void>): void;
55
56
 
56
57
  connect(): Connection;
57
58
 
58
- all(sql: string, ...args: [...any, Callback<TableData>] | []): void;
59
- arrowIPCAll(sql: string, ...args: [...any, Callback<TableData>] | []): void;
60
- each(sql: string, ...args: [...any, Callback<RowData>] | []): void;
59
+ all(sql: string, ...args: [...any, Callback<TableData>] | []): this;
60
+ arrowIPCAll(sql: string, ...args: [...any, Callback<QueryResult>] | []): void;
61
+ each(sql: string, ...args: [...any, Callback<RowData>] | []): this;
61
62
  exec(sql: string, ...args: [...any, Callback<void>] | []): void;
62
63
 
63
64
  prepare(sql: string, ...args: [...any, Callback<Statement>] | []): Statement;
@@ -71,21 +72,36 @@ export class Database {
71
72
  unregister_udf(name: string, callback: Callback<any>): void;
72
73
 
73
74
  stream(sql: any, ...args: any[]): QueryResult;
74
- arrowIPCStream(sql: any, ...args: any[]): QueryResult;
75
+ arrowIPCStream(sql: any, ...args: any[]): Promise<QueryResult>;
76
+
77
+ serialize(done?: Callback<void>): void;
78
+ parallelize(done?: Callback<void>): void;
79
+ wait(done: Callback<void>): void;
80
+
81
+ get(columnName: string, cb: Callback<RowData>): void;
82
+ get(columnName: string, num: number, cb: Callback<RowData>): void;
83
+
84
+ interrupt(): void;
85
+
86
+ register_buffer(name: string, array: ArrayLike<any>, force: boolean, callback?: Callback<void>): void;
87
+
88
+ unregister_buffer(name: string, callback?: Callback<void>): void;
75
89
  }
76
90
 
77
91
  export class Statement {
78
- constructor();
92
+ sql: string;
79
93
 
80
- all(...args: [...any, Callback<TableData>] | []): void;
94
+ constructor(connection: Connection, sql: string);
81
95
 
82
- arrowIPCAll(...args: [...any, Callback<TableData>] | []): void;
96
+ all(...args: [...any, Callback<TableData>] | any[]): this;
83
97
 
84
- each(...args: [...any, Callback<RowData>] | []): void;
98
+ arrowIPCAll(...args: [...any, Callback<TableData>] | any[]): void;
99
+
100
+ each(...args: [...any, Callback<RowData>] | any[]): this;
85
101
 
86
102
  finalize(callback?: Callback<void>): void;
87
103
 
88
- run(...args: [...any, Callback<void>] | []): Statement;
104
+ run(...args: [...any, Callback<void>] | any[]): Statement;
89
105
  }
90
106
 
91
107
  export const ERROR: number;
@@ -101,3 +117,5 @@ export const OPEN_READONLY: number;
101
117
  export const OPEN_READWRITE: number;
102
118
 
103
119
  export const OPEN_SHAREDCACHE: number;
120
+
121
+ export const INTERRUPT: number;
package/lib/duckdb.js CHANGED
@@ -670,3 +670,9 @@ Statement.prototype.finalize
670
670
  * @yield callback
671
671
  */
672
672
  Statement.prototype.stream;
673
+
674
+ /**
675
+ * @field
676
+ * @returns sql contained in statement
677
+ */
678
+ Statement.prototype.sql;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.6.2-dev6.0",
5
+ "version": "0.6.2-dev604.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {