duckdb 0.5.2-dev870.0 → 0.5.2-dev878.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/.mocharc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extension": ["js", "ts"],
3
+ "spec": ["test/*.js", "test/*.ts"],
4
+ "require": "ts-node/register"
5
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * TypeScript declarations for Node.JS bindings for DuckDb.
3
+ * See https://duckdb.org/docs/api/nodejs/overview for details
4
+ * on Node.JS API
5
+ */
6
+ export class DuckDbError extends Error {
7
+ errno: number;
8
+ code: string;
9
+ }
10
+
11
+ type Callback<T> = (err: DuckDbError | null, res: T) => void;
12
+
13
+ export type RowData = {
14
+ [columnName: string]: any;
15
+ };
16
+
17
+ export type TableData = RowData[];
18
+
19
+ export class Connection {
20
+ constructor(db: Database, callback?: Callback<any>);
21
+
22
+ all(sql: string, ...args: [...any, Callback<TableData>] | []): void;
23
+ each(sql: string, ...args: [...any, Callback<RowData>] | []): void;
24
+ exec(sql: string, ...args: [...any, Callback<void>] | []): void;
25
+
26
+ prepare(sql: string, ...args: [...any, Callback<Statement>] | []): Statement;
27
+ run(sql: string, ...args: [...any, Callback<void>] | []): Statement;
28
+
29
+ register(
30
+ name: string,
31
+ return_type: string,
32
+ fun: (...args: any[]) => any
33
+ ): void;
34
+
35
+ register_bulk(
36
+ name: string,
37
+ return_type: string,
38
+ fun: (...args: any[]) => any
39
+ ): void;
40
+ unregister(name: string, callback: Callback<any>): void;
41
+
42
+ stream(sql: any, ...args: any[]): QueryResult;
43
+ }
44
+
45
+ export class QueryResult {
46
+ [Symbol.asyncIterator](): AsyncIterator<RowData>;
47
+ }
48
+
49
+ export class Database {
50
+ constructor(path: string, callback?: Callback<any>);
51
+
52
+ close(callback: Callback<void>): void;
53
+
54
+ connect(): Connection;
55
+
56
+ all(sql: string, ...args: [...any, Callback<TableData>] | []): void;
57
+ each(sql: string, ...args: [...any, Callback<RowData>] | []): void;
58
+ exec(sql: string, ...args: [...any, Callback<void>] | []): void;
59
+
60
+ prepare(sql: string, ...args: [...any, Callback<Statement>] | []): Statement;
61
+ run(sql: string, ...args: [...any, Callback<void>] | []): Statement;
62
+
63
+ register(
64
+ name: string,
65
+ return_type: string,
66
+ fun: (...args: any[]) => any
67
+ ): void;
68
+ unregister(name: string, callback: Callback<any>): void;
69
+ }
70
+
71
+ export class Statement {
72
+ constructor();
73
+
74
+ all(...args: [...any, Callback<TableData>] | []): void;
75
+ each(...args: [...any, Callback<RowData>] | []): void;
76
+
77
+ finalize(callback?: Callback<void>): void;
78
+
79
+ run(...args: [...any, Callback<void>] | []): Statement;
80
+ }
81
+
82
+ export const ERROR: number;
83
+
84
+ export const OPEN_CREATE: number;
85
+
86
+ export const OPEN_FULLMUTEX: number;
87
+
88
+ export const OPEN_PRIVATECACHE: number;
89
+
90
+ export const OPEN_READONLY: number;
91
+
92
+ export const OPEN_READWRITE: number;
93
+
94
+ export const OPEN_SHAREDCACHE: number;
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.5.2-dev870.0",
4
+ "types": "./lib/duckdb.d.ts",
5
+ "version": "0.5.2-dev878.0",
5
6
  "description": "DuckDB node.js API",
6
7
  "gypfile": true,
7
8
  "dependencies": {
@@ -25,15 +26,25 @@
25
26
  "test": "test"
26
27
  },
27
28
  "devDependencies": {
29
+ "@types/mocha": "^10.0.0",
30
+ "@types/node": "^18.11.0",
28
31
  "aws-sdk": "^2.790.0",
29
32
  "chai": "^4.3.6",
30
33
  "jsdoc3-parser": "^2.0.0",
31
- "mocha": "^8.3.0"
34
+ "mocha": "^8.3.0",
35
+ "ts-node": "^10.9.1",
36
+ "tsconfig-paths": "^4.0.0",
37
+ "typescript": "^4.8.4"
32
38
  },
33
39
  "repository": {
34
40
  "type": "git",
35
41
  "url": "git+https://github.com/cwida/duckdb.git"
36
42
  },
43
+ "ts-node": {
44
+ "require": [
45
+ "tsconfig-paths/register"
46
+ ]
47
+ },
37
48
  "keywords": [
38
49
  "database",
39
50
  "sql",
package/src/duckdb.cpp CHANGED
@@ -21126,7 +21126,7 @@ vector<string> LocalFileSystem::FetchFileWithoutGlob(const string &path, FileOpe
21126
21126
  result.push_back(path);
21127
21127
  } else if (!absolute_path) {
21128
21128
  Value value;
21129
- if (opener->TryGetCurrentSetting("file_search_path", value)) {
21129
+ if (opener && opener->TryGetCurrentSetting("file_search_path", value)) {
21130
21130
  auto search_paths_str = value.ToString();
21131
21131
  std::vector<std::string> search_paths = StringUtil::Split(search_paths_str, ',');
21132
21132
  for (const auto &search_path : search_paths) {
@@ -21192,7 +21192,18 @@ vector<string> LocalFileSystem::Glob(const string &path, FileOpener *opener) {
21192
21192
  if (absolute_path) {
21193
21193
  // for absolute paths, we don't start by scanning the current directory
21194
21194
  previous_directories.push_back(splits[0]);
21195
+ } else {
21196
+ // If file_search_path is set, use those paths as the first glob elements
21197
+ Value value;
21198
+ if (opener && opener->TryGetCurrentSetting("file_search_path", value)) {
21199
+ auto search_paths_str = value.ToString();
21200
+ std::vector<std::string> search_paths = StringUtil::Split(search_paths_str, ',');
21201
+ for (const auto &search_path : search_paths) {
21202
+ previous_directories.push_back(search_path);
21203
+ }
21204
+ }
21195
21205
  }
21206
+
21196
21207
  for (idx_t i = absolute_path ? 1 : 0; i < splits.size(); i++) {
21197
21208
  bool is_last_chunk = i + 1 == splits.size();
21198
21209
  bool has_glob = HasGlob(splits[i]);