@types/node 22.4.1 → 22.5.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.
- node/README.md +1 -1
- node/globals.d.ts +47 -48
- node/http.d.ts +13 -0
- node/index.d.ts +1 -0
- node/package.json +2 -2
- node/path.d.ts +9 -0
- node/process.d.ts +35 -0
- node/sqlite.d.ts +213 -0
- node/worker_threads.d.ts +18 -0
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Wed, 21 Aug 2024 16:09:20 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/globals.d.ts
CHANGED
@@ -2,7 +2,7 @@ export {}; // Make this a module
|
|
2
2
|
|
3
3
|
// #region Fetch and friends
|
4
4
|
// Conditional type aliases, used at the end of this file.
|
5
|
-
// Will either be empty if lib
|
5
|
+
// Will either be empty if lib.dom (or lib.webworker) is included, or the undici version otherwise.
|
6
6
|
type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
|
7
7
|
type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
|
8
8
|
type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
|
@@ -17,6 +17,49 @@ type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : import("un
|
|
17
17
|
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource;
|
18
18
|
// #endregion Fetch and friends
|
19
19
|
|
20
|
+
// Conditional type definitions for webstorage interface, which conflicts with lib.dom otherwise.
|
21
|
+
type _Storage = typeof globalThis extends { onabort: any } ? {} : {
|
22
|
+
/**
|
23
|
+
* Returns the number of key/value pairs.
|
24
|
+
*
|
25
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/length)
|
26
|
+
*/
|
27
|
+
readonly length: number;
|
28
|
+
/**
|
29
|
+
* Removes all key/value pairs, if there are any.
|
30
|
+
*
|
31
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/clear)
|
32
|
+
*/
|
33
|
+
clear(): void;
|
34
|
+
/**
|
35
|
+
* Returns the current value associated with the given key, or null if the given key does not exist.
|
36
|
+
*
|
37
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/getItem)
|
38
|
+
*/
|
39
|
+
getItem(key: string): string | null;
|
40
|
+
/**
|
41
|
+
* Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
|
42
|
+
*
|
43
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/key)
|
44
|
+
*/
|
45
|
+
key(index: number): string | null;
|
46
|
+
/**
|
47
|
+
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
|
48
|
+
*
|
49
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/removeItem)
|
50
|
+
*/
|
51
|
+
removeItem(key: string): void;
|
52
|
+
/**
|
53
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
54
|
+
*
|
55
|
+
* Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set.
|
56
|
+
*
|
57
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/setItem)
|
58
|
+
*/
|
59
|
+
setItem(key: string, value: string): void;
|
60
|
+
[key: string]: any;
|
61
|
+
};
|
62
|
+
|
20
63
|
declare global {
|
21
64
|
// Declare "static" methods in Error
|
22
65
|
interface ErrorConstructor {
|
@@ -109,54 +152,10 @@ declare global {
|
|
109
152
|
*
|
110
153
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage)
|
111
154
|
*/
|
112
|
-
interface Storage {
|
113
|
-
/**
|
114
|
-
* Returns the number of key/value pairs.
|
115
|
-
*
|
116
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/length)
|
117
|
-
*/
|
118
|
-
readonly length: number;
|
119
|
-
/**
|
120
|
-
* Removes all key/value pairs, if there are any.
|
121
|
-
*
|
122
|
-
* Dispatches a storage event on Window objects holding an equivalent Storage object.
|
123
|
-
*
|
124
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/clear)
|
125
|
-
*/
|
126
|
-
clear(): void;
|
127
|
-
/**
|
128
|
-
* Returns the current value associated with the given key, or null if the given key does not exist.
|
129
|
-
*
|
130
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/getItem)
|
131
|
-
*/
|
132
|
-
getItem(key: string): string | null;
|
133
|
-
/**
|
134
|
-
* Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
|
135
|
-
*
|
136
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/key)
|
137
|
-
*/
|
138
|
-
key(index: number): string | null;
|
139
|
-
/**
|
140
|
-
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
|
141
|
-
*
|
142
|
-
* Dispatches a storage event on Window objects holding an equivalent Storage object.
|
143
|
-
*
|
144
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/removeItem)
|
145
|
-
*/
|
146
|
-
removeItem(key: string): void;
|
147
|
-
/**
|
148
|
-
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
149
|
-
*
|
150
|
-
* Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
|
151
|
-
*
|
152
|
-
* Dispatches a storage event on Window objects holding an equivalent Storage object.
|
153
|
-
*
|
154
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/setItem)
|
155
|
-
*/
|
156
|
-
setItem(key: string, value: string): void;
|
157
|
-
}
|
155
|
+
interface Storage extends _Storage {}
|
158
156
|
|
159
|
-
|
157
|
+
// Conditional on `onabort` rather than `onmessage`, in order to exclude lib.webworker
|
158
|
+
var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T
|
160
159
|
: {
|
161
160
|
prototype: Storage;
|
162
161
|
new(): Storage;
|
node/http.d.ts
CHANGED
@@ -1902,6 +1902,19 @@ declare module "http" {
|
|
1902
1902
|
* Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
|
1903
1903
|
*/
|
1904
1904
|
const maxHeaderSize: number;
|
1905
|
+
/**
|
1906
|
+
* A browser-compatible implementation of [WebSocket](https://nodejs.org/docs/latest/api/http.html#websocket).
|
1907
|
+
* @since v22.5.0
|
1908
|
+
*/
|
1909
|
+
const WebSocket: import("undici-types").WebSocket;
|
1910
|
+
/**
|
1911
|
+
* @since v22.5.0
|
1912
|
+
*/
|
1913
|
+
const CloseEvent: import("undici-types").CloseEvent;
|
1914
|
+
/**
|
1915
|
+
* @since v22.5.0
|
1916
|
+
*/
|
1917
|
+
const MessageEvent: import("undici-types").MessageEvent;
|
1905
1918
|
}
|
1906
1919
|
declare module "node:http" {
|
1907
1920
|
export * from "http";
|
node/index.d.ts
CHANGED
@@ -67,6 +67,7 @@
|
|
67
67
|
/// <reference path="readline/promises.d.ts" />
|
68
68
|
/// <reference path="repl.d.ts" />
|
69
69
|
/// <reference path="sea.d.ts" />
|
70
|
+
/// <reference path="sqlite.d.ts" />
|
70
71
|
/// <reference path="stream.d.ts" />
|
71
72
|
/// <reference path="stream/promises.d.ts" />
|
72
73
|
/// <reference path="stream/consumers.d.ts" />
|
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.
|
3
|
+
"version": "22.5.0",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -212,6 +212,6 @@
|
|
212
212
|
"dependencies": {
|
213
213
|
"undici-types": "~6.19.2"
|
214
214
|
},
|
215
|
-
"typesPublisherContentHash": "
|
215
|
+
"typesPublisherContentHash": "6e32f4b237ea4dd6efcade6ee8b163957a578f405f3c76453b372a2d32e00c03",
|
216
216
|
"typeScriptVersion": "4.8"
|
217
217
|
}
|
node/path.d.ts
CHANGED
@@ -94,6 +94,15 @@ declare module "path" {
|
|
94
94
|
* @throws {TypeError} if any of the arguments is not a string.
|
95
95
|
*/
|
96
96
|
resolve(...paths: string[]): string;
|
97
|
+
/**
|
98
|
+
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
|
99
|
+
* @param path The path to glob-match against.
|
100
|
+
* @param pattern The glob to check the path against.
|
101
|
+
* @returns Whether or not the `path` matched the `pattern`.
|
102
|
+
* @throws {TypeError} if `path` or `pattern` are not strings.
|
103
|
+
* @since v22.5.0
|
104
|
+
*/
|
105
|
+
matchesGlob(path: string, pattern: string): boolean;
|
97
106
|
/**
|
98
107
|
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
|
99
108
|
*
|
node/process.d.ts
CHANGED
@@ -75,6 +75,7 @@ declare module "process" {
|
|
75
75
|
"repl": typeof import("repl");
|
76
76
|
"node:repl": typeof import("node:repl");
|
77
77
|
"node:sea": typeof import("node:sea");
|
78
|
+
"node:sqlite": typeof import("node:sqlite");
|
78
79
|
"stream": typeof import("stream");
|
79
80
|
"node:stream": typeof import("node:stream");
|
80
81
|
"stream/consumers": typeof import("stream/consumers");
|
@@ -893,6 +894,40 @@ declare module "process" {
|
|
893
894
|
* @since v0.11.8
|
894
895
|
*/
|
895
896
|
exitCode?: number | string | number | undefined;
|
897
|
+
finalization: {
|
898
|
+
/**
|
899
|
+
* This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected.
|
900
|
+
* If the object `ref` was garbage collected before the `exit` event is emitted, the callback will be removed from the finalization registry, and it will not be called on process exit.
|
901
|
+
*
|
902
|
+
* Inside the callback you can release the resources allocated by the `ref` object.
|
903
|
+
* Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function,
|
904
|
+
* this means that there is a possibility that the callback will not be called under special circumstances.
|
905
|
+
*
|
906
|
+
* The idea of this function is to help you free up resources when the starts process exiting, but also let the object be garbage collected if it is no longer being used.
|
907
|
+
* @param ref The reference to the resource that is being tracked.
|
908
|
+
* @param callback The callback function to be called when the resource is finalized.
|
909
|
+
* @since v22.5.0
|
910
|
+
* @experimental
|
911
|
+
*/
|
912
|
+
register<T extends object>(ref: T, callback: (ref: T, event: "exit") => void): void;
|
913
|
+
/**
|
914
|
+
* This function behaves exactly like the `register`, except that the callback will be called when the process emits the `beforeExit` event if `ref` object was not garbage collected.
|
915
|
+
*
|
916
|
+
* Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function, this means that there is a possibility that the callback will not be called under special circumstances.
|
917
|
+
* @param ref The reference to the resource that is being tracked.
|
918
|
+
* @param callback The callback function to be called when the resource is finalized.
|
919
|
+
* @since v22.5.0
|
920
|
+
* @experimental
|
921
|
+
*/
|
922
|
+
registerBeforeExit<T extends object>(ref: T, callback: (ref: T, event: "beforeExit") => void): void;
|
923
|
+
/**
|
924
|
+
* This function remove the register of the object from the finalization registry, so the callback will not be called anymore.
|
925
|
+
* @param ref The reference to the resource that was registered previously.
|
926
|
+
* @since v22.5.0
|
927
|
+
* @experimental
|
928
|
+
*/
|
929
|
+
unregister(ref: object): void;
|
930
|
+
};
|
896
931
|
/**
|
897
932
|
* The `process.getActiveResourcesInfo()` method returns an array of strings containing
|
898
933
|
* the types of the active resources that are currently keeping the event loop alive.
|
node/sqlite.d.ts
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
/**
|
2
|
+
* The `node:sqlite` module facilitates working with SQLite databases.
|
3
|
+
* To access it:
|
4
|
+
*
|
5
|
+
* ```js
|
6
|
+
* import sqlite from 'node:sqlite';
|
7
|
+
* ```
|
8
|
+
*
|
9
|
+
* This module is only available under the `node:` scheme. The following will not
|
10
|
+
* work:
|
11
|
+
*
|
12
|
+
* ```js
|
13
|
+
* import sqlite from 'sqlite';
|
14
|
+
* ```
|
15
|
+
*
|
16
|
+
* The following example shows the basic usage of the `node:sqlite` module to open
|
17
|
+
* an in-memory database, write data to the database, and then read the data back.
|
18
|
+
*
|
19
|
+
* ```js
|
20
|
+
* import { DatabaseSync } from 'node:sqlite';
|
21
|
+
* const database = new DatabaseSync(':memory:');
|
22
|
+
*
|
23
|
+
* // Execute SQL statements from strings.
|
24
|
+
* database.exec(`
|
25
|
+
* CREATE TABLE data(
|
26
|
+
* key INTEGER PRIMARY KEY,
|
27
|
+
* value TEXT
|
28
|
+
* ) STRICT
|
29
|
+
* `);
|
30
|
+
* // Create a prepared statement to insert data into the database.
|
31
|
+
* const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
|
32
|
+
* // Execute the prepared statement with bound values.
|
33
|
+
* insert.run(1, 'hello');
|
34
|
+
* insert.run(2, 'world');
|
35
|
+
* // Create a prepared statement to read data from the database.
|
36
|
+
* const query = database.prepare('SELECT * FROM data ORDER BY key');
|
37
|
+
* // Execute the prepared statement and log the result set.
|
38
|
+
* console.log(query.all());
|
39
|
+
* // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]
|
40
|
+
* ```
|
41
|
+
* @since v22.5.0
|
42
|
+
* @experimental
|
43
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/sqlite.js)
|
44
|
+
*/
|
45
|
+
declare module "node:sqlite" {
|
46
|
+
interface DatabaseSyncOptions {
|
47
|
+
/**
|
48
|
+
* If `true`, the database is opened by the constructor.
|
49
|
+
* When this value is `false`, the database must be opened via the `open()` method.
|
50
|
+
*/
|
51
|
+
open?: boolean | undefined;
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
|
55
|
+
* exposed by this class execute synchronously.
|
56
|
+
* @since v22.5.0
|
57
|
+
*/
|
58
|
+
class DatabaseSync {
|
59
|
+
/**
|
60
|
+
* Constructs a new `DatabaseSync` instance.
|
61
|
+
* @param location The location of the database.
|
62
|
+
* A SQLite database can be stored in a file or completely [in memory](https://www.sqlite.org/inmemorydb.html).
|
63
|
+
* To use a file-backed database, the location should be a file path.
|
64
|
+
* To use an in-memory database, the location should be the special name `':memory:'`.
|
65
|
+
* @param options Configuration options for the database connection.
|
66
|
+
*/
|
67
|
+
constructor(location: string, options?: DatabaseSyncOptions);
|
68
|
+
/**
|
69
|
+
* Closes the database connection. An exception is thrown if the database is not
|
70
|
+
* open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html).
|
71
|
+
* @since v22.5.0
|
72
|
+
*/
|
73
|
+
close(): void;
|
74
|
+
/**
|
75
|
+
* This method allows one or more SQL statements to be executed without returning
|
76
|
+
* any results. This method is useful when executing SQL statements read from a
|
77
|
+
* file. This method is a wrapper around [`sqlite3_exec()`](https://www.sqlite.org/c3ref/exec.html).
|
78
|
+
* @since v22.5.0
|
79
|
+
* @param sql A SQL string to execute.
|
80
|
+
*/
|
81
|
+
exec(sql: string): void;
|
82
|
+
/**
|
83
|
+
* Opens the database specified in the `location` argument of the `DatabaseSync`constructor. This method should only be used when the database is not opened via
|
84
|
+
* the constructor. An exception is thrown if the database is already open.
|
85
|
+
* @since v22.5.0
|
86
|
+
*/
|
87
|
+
open(): void;
|
88
|
+
/**
|
89
|
+
* Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This method is a wrapper
|
90
|
+
* around [`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html).
|
91
|
+
* @since v22.5.0
|
92
|
+
* @param sql A SQL string to compile to a prepared statement.
|
93
|
+
* @return The prepared statement.
|
94
|
+
*/
|
95
|
+
prepare(sql: string): StatementSync;
|
96
|
+
}
|
97
|
+
type SupportedValueType = null | number | bigint | string | Uint8Array;
|
98
|
+
interface StatementResultingChanges {
|
99
|
+
/**
|
100
|
+
* The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement.
|
101
|
+
* This field is either a number or a `BigInt` depending on the prepared statement's configuration.
|
102
|
+
* This property is the result of [`sqlite3_changes64()`](https://www.sqlite.org/c3ref/changes.html).
|
103
|
+
*/
|
104
|
+
changes: number | bigint;
|
105
|
+
/**
|
106
|
+
* The most recently inserted rowid.
|
107
|
+
* This field is either a number or a `BigInt` depending on the prepared statement's configuration.
|
108
|
+
* This property is the result of [`sqlite3_last_insert_rowid()`](https://www.sqlite.org/c3ref/last_insert_rowid.html).
|
109
|
+
*/
|
110
|
+
lastInsertRowid: number | bigint;
|
111
|
+
}
|
112
|
+
/**
|
113
|
+
* This class represents a single [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This class cannot be
|
114
|
+
* instantiated via its constructor. Instead, instances are created via the`database.prepare()` method. All APIs exposed by this class execute
|
115
|
+
* synchronously.
|
116
|
+
*
|
117
|
+
* A prepared statement is an efficient binary representation of the SQL used to
|
118
|
+
* create it. Prepared statements are parameterizable, and can be invoked multiple
|
119
|
+
* times with different bound values. Parameters also offer protection against [SQL injection](https://en.wikipedia.org/wiki/SQL_injection) attacks. For these reasons, prepared statements are
|
120
|
+
* preferred
|
121
|
+
* over hand-crafted SQL strings when handling user input.
|
122
|
+
* @since v22.5.0
|
123
|
+
*/
|
124
|
+
class StatementSync {
|
125
|
+
private constructor();
|
126
|
+
/**
|
127
|
+
* This method executes a prepared statement and returns all results as an array of
|
128
|
+
* objects. If the prepared statement does not return any results, this method
|
129
|
+
* returns an empty array. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using
|
130
|
+
* the values in `namedParameters` and `anonymousParameters`.
|
131
|
+
* @since v22.5.0
|
132
|
+
* @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping.
|
133
|
+
* @param anonymousParameters Zero or more values to bind to anonymous parameters.
|
134
|
+
* @return An array of objects. Each object corresponds to a row returned by executing the prepared statement. The keys and values of each object correspond to the column names and values of
|
135
|
+
* the row.
|
136
|
+
*/
|
137
|
+
all(...anonymousParameters: SupportedValueType[]): unknown[];
|
138
|
+
all(
|
139
|
+
namedParameters: Record<string, SupportedValueType>,
|
140
|
+
...anonymousParameters: SupportedValueType[]
|
141
|
+
): unknown[];
|
142
|
+
/**
|
143
|
+
* This method returns the source SQL of the prepared statement with parameter
|
144
|
+
* placeholders replaced by values. This method is a wrapper around [`sqlite3_expanded_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html).
|
145
|
+
* @since v22.5.0
|
146
|
+
* @return The source SQL expanded to include parameter values.
|
147
|
+
*/
|
148
|
+
expandedSQL(): string;
|
149
|
+
/**
|
150
|
+
* This method executes a prepared statement and returns the first result as an
|
151
|
+
* object. If the prepared statement does not return any results, this method
|
152
|
+
* returns `undefined`. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the
|
153
|
+
* values in `namedParameters` and `anonymousParameters`.
|
154
|
+
* @since v22.5.0
|
155
|
+
* @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping.
|
156
|
+
* @param anonymousParameters Zero or more values to bind to anonymous parameters.
|
157
|
+
* @return An object corresponding to the first row returned by executing the prepared statement. The keys and values of the object correspond to the column names and values of the row. If no
|
158
|
+
* rows were returned from the database then this method returns `undefined`.
|
159
|
+
*/
|
160
|
+
get(...anonymousParameters: SupportedValueType[]): unknown;
|
161
|
+
get(namedParameters: Record<string, SupportedValueType>, ...anonymousParameters: SupportedValueType[]): unknown;
|
162
|
+
/**
|
163
|
+
* This method executes a prepared statement and returns an object summarizing the
|
164
|
+
* resulting changes. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the
|
165
|
+
* values in `namedParameters` and `anonymousParameters`.
|
166
|
+
* @since v22.5.0
|
167
|
+
* @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping.
|
168
|
+
* @param anonymousParameters Zero or more values to bind to anonymous parameters.
|
169
|
+
*/
|
170
|
+
run(...anonymousParameters: SupportedValueType[]): StatementResultingChanges;
|
171
|
+
run(
|
172
|
+
namedParameters: Record<string, SupportedValueType>,
|
173
|
+
...anonymousParameters: SupportedValueType[]
|
174
|
+
): StatementResultingChanges;
|
175
|
+
/**
|
176
|
+
* The names of SQLite parameters begin with a prefix character. By default,`node:sqlite` requires that this prefix character is present when binding
|
177
|
+
* parameters. However, with the exception of dollar sign character, these
|
178
|
+
* prefix characters also require extra quoting when used in object keys.
|
179
|
+
*
|
180
|
+
* To improve ergonomics, this method can be used to also allow bare named
|
181
|
+
* parameters, which do not require the prefix character in JavaScript code. There
|
182
|
+
* are several caveats to be aware of when enabling bare named parameters:
|
183
|
+
*
|
184
|
+
* * The prefix character is still required in SQL.
|
185
|
+
* * The prefix character is still allowed in JavaScript. In fact, prefixed names
|
186
|
+
* will have slightly better binding performance.
|
187
|
+
* * Using ambiguous named parameters, such as `$k` and `@k`, in the same prepared
|
188
|
+
* statement will result in an exception as it cannot be determined how to bind
|
189
|
+
* a bare name.
|
190
|
+
* @since v22.5.0
|
191
|
+
* @param enabled Enables or disables support for binding named parameters without the prefix character.
|
192
|
+
*/
|
193
|
+
setAllowBareNamedParameters(enabled: boolean): void;
|
194
|
+
/**
|
195
|
+
* When reading from the database, SQLite `INTEGER`s are mapped to JavaScript
|
196
|
+
* numbers by default. However, SQLite `INTEGER`s can store values larger than
|
197
|
+
* JavaScript numbers are capable of representing. In such cases, this method can
|
198
|
+
* be used to read `INTEGER` data using JavaScript `BigInt`s. This method has no
|
199
|
+
* impact on database write operations where numbers and `BigInt`s are both
|
200
|
+
* supported at all times.
|
201
|
+
* @since v22.5.0
|
202
|
+
* @param enabled Enables or disables the use of `BigInt`s when reading `INTEGER` fields from the database.
|
203
|
+
*/
|
204
|
+
setReadBigInts(enabled: boolean): void;
|
205
|
+
/**
|
206
|
+
* This method returns the source SQL of the prepared statement. This method is a
|
207
|
+
* wrapper around [`sqlite3_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html).
|
208
|
+
* @since v22.5.0
|
209
|
+
* @return The source SQL used to create this prepared statement.
|
210
|
+
*/
|
211
|
+
sourceSQL(): string;
|
212
|
+
}
|
213
|
+
}
|
node/worker_threads.d.ts
CHANGED
@@ -409,6 +409,24 @@ declare module "worker_threads" {
|
|
409
409
|
* @since v10.5.0
|
410
410
|
*/
|
411
411
|
postMessage(value: any, transferList?: readonly TransferListItem[]): void;
|
412
|
+
/**
|
413
|
+
* Sends a value to another worker, identified by its thread ID.
|
414
|
+
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
415
|
+
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
|
416
|
+
* @param value The value to send.
|
417
|
+
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
|
418
|
+
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
|
419
|
+
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
|
420
|
+
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
|
421
|
+
* @since v22.5.0
|
422
|
+
*/
|
423
|
+
postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
|
424
|
+
postMessageToThread(
|
425
|
+
threadId: number,
|
426
|
+
value: any,
|
427
|
+
transferList: readonly TransferListItem[],
|
428
|
+
timeout?: number,
|
429
|
+
): Promise<void>;
|
412
430
|
/**
|
413
431
|
* Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
|
414
432
|
* behavior). If the worker is `ref()`ed, calling `ref()` again has
|