@types/node 22.15.21 → 22.19.6
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 v22.19/README.md +15 -0
- node v22.19/assert/strict.d.ts +111 -0
- node/assert.d.ts → node v22.19/assert.d.ts +119 -95
- node/buffer.buffer.d.ts → node v22.19/buffer.buffer.d.ts +9 -0
- node/buffer.d.ts → node v22.19/buffer.d.ts +14 -6
- node/child_process.d.ts → node v22.19/child_process.d.ts +89 -162
- node/cluster.d.ts → node v22.19/cluster.d.ts +4 -5
- node/compatibility/disposable.d.ts → node v22.19/compatibility/disposable.d.ts +0 -2
- node/compatibility/indexable.d.ts → node v22.19/compatibility/indexable.d.ts +0 -3
- node/compatibility/iterators.d.ts → node v22.19/compatibility/iterators.d.ts +0 -1
- node/crypto.d.ts → node v22.19/crypto.d.ts +203 -167
- node/dgram.d.ts → node v22.19/dgram.d.ts +9 -8
- node/diagnostics_channel.d.ts → node v22.19/diagnostics_channel.d.ts +17 -12
- node/dns/promises.d.ts → node v22.19/dns/promises.d.ts +36 -9
- node/dns.d.ts → node v22.19/dns.d.ts +79 -21
- node/events.d.ts → node v22.19/events.d.ts +80 -35
- node/fs/promises.d.ts → node v22.19/fs/promises.d.ts +81 -58
- node/fs.d.ts → node v22.19/fs.d.ts +154 -130
- node v22.19/globals.d.ts +172 -0
- node v22.19/globals.typedarray.d.ts +38 -0
- node/http.d.ts → node v22.19/http.d.ts +140 -35
- node/http2.d.ts → node v22.19/http2.d.ts +114 -27
- node/https.d.ts → node v22.19/https.d.ts +96 -62
- node/index.d.ts → node v22.19/index.d.ts +7 -2
- node v22.19/inspector.d.ts +253 -0
- node/inspector.d.ts → node v22.19/inspector.generated.d.ts +880 -830
- node/module.d.ts → node v22.19/module.d.ts +136 -17
- node/net.d.ts → node v22.19/net.d.ts +33 -11
- node/os.d.ts → node v22.19/os.d.ts +14 -3
- node/package.json → node v22.19/package.json +3 -83
- node/path.d.ts → node v22.19/path.d.ts +1 -1
- node/perf_hooks.d.ts → node v22.19/perf_hooks.d.ts +8 -10
- node/process.d.ts → node v22.19/process.d.ts +53 -27
- node/readline/promises.d.ts → node v22.19/readline/promises.d.ts +1 -2
- node/repl.d.ts → node v22.19/repl.d.ts +3 -5
- node/sqlite.d.ts → node v22.19/sqlite.d.ts +219 -6
- node/stream/consumers.d.ts → node v22.19/stream/consumers.d.ts +2 -2
- node/stream/web.d.ts → node v22.19/stream/web.d.ts +8 -0
- node/stream.d.ts → node v22.19/stream.d.ts +34 -32
- node/string_decoder.d.ts → node v22.19/string_decoder.d.ts +2 -2
- node v22.19/test.d.ts +2162 -0
- node/tls.d.ts → node v22.19/tls.d.ts +126 -66
- node/ts5.6/buffer.buffer.d.ts → node v22.19/ts5.6/buffer.buffer.d.ts +10 -2
- node v22.19/ts5.6/globals.typedarray.d.ts +34 -0
- node/ts5.6/index.d.ts → node v22.19/ts5.6/index.d.ts +7 -2
- node/url.d.ts → node v22.19/url.d.ts +21 -9
- node/util.d.ts → node v22.19/util.d.ts +33 -11
- node/v8.d.ts → node v22.19/v8.d.ts +66 -35
- node/vm.d.ts → node v22.19/vm.d.ts +65 -56
- node/wasi.d.ts → node v22.19/wasi.d.ts +1 -1
- node v22.19/web-globals/abortcontroller.d.ts +34 -0
- node v22.19/web-globals/domexception.d.ts +68 -0
- node v22.19/web-globals/events.d.ts +97 -0
- node v22.19/web-globals/fetch.d.ts +46 -0
- node v22.19/web-globals/navigator.d.ts +22 -0
- node v22.19/web-globals/storage.d.ts +24 -0
- node/worker_threads.d.ts → node v22.19/worker_threads.d.ts +112 -74
- node/zlib.d.ts → node v22.19/zlib.d.ts +39 -26
- node/README.md +0 -15
- node/assert/strict.d.ts +0 -8
- node/dom-events.d.ts +0 -124
- node/globals.d.ts +0 -371
- node/globals.typedarray.d.ts +0 -21
- node/test.d.ts +0 -2280
- node/ts5.6/globals.typedarray.d.ts +0 -19
- {node → node v22.19}/LICENSE +0 -0
- node/async_hooks.d.ts → node v22.19/async_hooks.d.ts +1 -1
- {node → node v22.19}/compatibility/index.d.ts +0 -0
- {node → node v22.19}/console.d.ts +0 -0
- {node → node v22.19}/constants.d.ts +0 -0
- {node → node v22.19}/domain.d.ts +0 -0
- {node → node v22.19}/punycode.d.ts +0 -0
- {node → node v22.19}/querystring.d.ts +0 -0
- {node → node v22.19}/readline.d.ts +0 -0
- {node → node v22.19}/sea.d.ts +0 -0
- {node → node v22.19}/stream/promises.d.ts +0 -0
- {node → node v22.19}/timers/promises.d.ts +0 -0
- {node → node v22.19}/timers.d.ts +0 -0
- {node → node v22.19}/trace_events.d.ts +0 -0
- {node → node v22.19}/tty.d.ts +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
declare module "process" {
|
|
2
|
+
import { Control, MessageOptions, SendHandle } from "node:child_process";
|
|
3
|
+
import { PathLike } from "node:fs";
|
|
2
4
|
import * as tty from "node:tty";
|
|
3
5
|
import { Worker } from "node:worker_threads";
|
|
4
6
|
|
|
@@ -231,8 +233,9 @@ declare module "process" {
|
|
|
231
233
|
*/
|
|
232
234
|
readonly tls_sni: boolean;
|
|
233
235
|
/**
|
|
234
|
-
* A value that is `"strip"`
|
|
235
|
-
* `"transform"` if Node.js is run with `--experimental-transform-types`, and `false`
|
|
236
|
+
* A value that is `"strip"` by default,
|
|
237
|
+
* `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
|
|
238
|
+
* Node.js is run with `--no-experimental-strip-types`.
|
|
236
239
|
* @since v22.10.0
|
|
237
240
|
*/
|
|
238
241
|
readonly typescript: "strip" | "transform" | false;
|
|
@@ -331,7 +334,7 @@ declare module "process" {
|
|
|
331
334
|
*/
|
|
332
335
|
type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
|
|
333
336
|
type WarningListener = (warning: Error) => void;
|
|
334
|
-
type MessageListener = (message: unknown, sendHandle:
|
|
337
|
+
type MessageListener = (message: unknown, sendHandle: SendHandle) => void;
|
|
335
338
|
type SignalsListener = (signal: Signals) => void;
|
|
336
339
|
type MultipleResolveListener = (
|
|
337
340
|
type: MultipleResolveType,
|
|
@@ -347,7 +350,7 @@ declare module "process" {
|
|
|
347
350
|
/**
|
|
348
351
|
* Can be used to change the default timezone at runtime
|
|
349
352
|
*/
|
|
350
|
-
TZ?: string;
|
|
353
|
+
TZ?: string | undefined;
|
|
351
354
|
}
|
|
352
355
|
interface HRTime {
|
|
353
356
|
/**
|
|
@@ -471,6 +474,11 @@ declare module "process" {
|
|
|
471
474
|
* @default false
|
|
472
475
|
*/
|
|
473
476
|
reportOnUncaughtException: boolean;
|
|
477
|
+
/**
|
|
478
|
+
* If true, a diagnostic report is generated without the environment variables.
|
|
479
|
+
* @default false
|
|
480
|
+
*/
|
|
481
|
+
excludeEnv: boolean;
|
|
474
482
|
/**
|
|
475
483
|
* The signal used to trigger the creation of a diagnostic report.
|
|
476
484
|
* @default 'SIGUSR2'
|
|
@@ -991,7 +999,7 @@ declare module "process" {
|
|
|
991
999
|
* @since v0.1.13
|
|
992
1000
|
* @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
|
|
993
1001
|
*/
|
|
994
|
-
exit(code?: number | string | null
|
|
1002
|
+
exit(code?: number | string | null): never;
|
|
995
1003
|
/**
|
|
996
1004
|
* A number which will be the process exit code, when the process either
|
|
997
1005
|
* exits gracefully, or is exited via {@link exit} without specifying
|
|
@@ -1002,7 +1010,7 @@ declare module "process" {
|
|
|
1002
1010
|
* @default undefined
|
|
1003
1011
|
* @since v0.11.8
|
|
1004
1012
|
*/
|
|
1005
|
-
exitCode
|
|
1013
|
+
exitCode: number | string | null | undefined;
|
|
1006
1014
|
finalization: {
|
|
1007
1015
|
/**
|
|
1008
1016
|
* This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected.
|
|
@@ -1466,7 +1474,7 @@ declare module "process" {
|
|
|
1466
1474
|
* @since v20.12.0
|
|
1467
1475
|
* @param path The path to the .env file
|
|
1468
1476
|
*/
|
|
1469
|
-
loadEnvFile(path?:
|
|
1477
|
+
loadEnvFile(path?: PathLike): void;
|
|
1470
1478
|
/**
|
|
1471
1479
|
* The `process.pid` property returns the PID of the process.
|
|
1472
1480
|
*
|
|
@@ -1490,6 +1498,18 @@ declare module "process" {
|
|
|
1490
1498
|
* @since v9.2.0, v8.10.0, v6.13.0
|
|
1491
1499
|
*/
|
|
1492
1500
|
readonly ppid: number;
|
|
1501
|
+
/**
|
|
1502
|
+
* The `process.threadCpuUsage()` method returns the user and system CPU time usage of
|
|
1503
|
+
* the current worker thread, in an object with properties `user` and `system`, whose
|
|
1504
|
+
* values are microsecond values (millionth of a second).
|
|
1505
|
+
*
|
|
1506
|
+
* The result of a previous call to `process.threadCpuUsage()` can be passed as the
|
|
1507
|
+
* argument to the function, to get a diff reading.
|
|
1508
|
+
* @since v22.19.0
|
|
1509
|
+
* @param previousValue A previous return value from calling
|
|
1510
|
+
* `process.threadCpuUsage()`
|
|
1511
|
+
*/
|
|
1512
|
+
threadCpuUsage(previousValue?: CpuUsage): CpuUsage;
|
|
1493
1513
|
/**
|
|
1494
1514
|
* The `process.title` property returns the current process title (i.e. returns
|
|
1495
1515
|
* the current value of `ps`). Assigning a new value to `process.title` modifies
|
|
@@ -1556,7 +1576,7 @@ declare module "process" {
|
|
|
1556
1576
|
* @since v0.1.17
|
|
1557
1577
|
* @deprecated Since v14.0.0 - Use `main` instead.
|
|
1558
1578
|
*/
|
|
1559
|
-
mainModule?: Module
|
|
1579
|
+
mainModule?: Module;
|
|
1560
1580
|
memoryUsage: MemoryUsageFn;
|
|
1561
1581
|
/**
|
|
1562
1582
|
* Gets the amount of memory available to the process (in bytes) based on
|
|
@@ -1566,13 +1586,11 @@ declare module "process" {
|
|
|
1566
1586
|
* See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
|
|
1567
1587
|
* information.
|
|
1568
1588
|
* @since v19.6.0, v18.15.0
|
|
1569
|
-
* @experimental
|
|
1570
1589
|
*/
|
|
1571
1590
|
constrainedMemory(): number;
|
|
1572
1591
|
/**
|
|
1573
1592
|
* Gets the amount of free memory that is still available to the process (in bytes).
|
|
1574
1593
|
* See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v22.x/api/process.html#processavailablememory) for more information.
|
|
1575
|
-
* @experimental
|
|
1576
1594
|
* @since v20.13.0
|
|
1577
1595
|
*/
|
|
1578
1596
|
availableMemory(): number;
|
|
@@ -1692,6 +1710,11 @@ declare module "process" {
|
|
|
1692
1710
|
* @param args Additional arguments to pass when invoking the `callback`
|
|
1693
1711
|
*/
|
|
1694
1712
|
nextTick(callback: Function, ...args: any[]): void;
|
|
1713
|
+
/**
|
|
1714
|
+
* The process.noDeprecation property indicates whether the --no-deprecation flag is set on the current Node.js process.
|
|
1715
|
+
* See the documentation for the ['warning' event](https://nodejs.org/docs/latest/api/process.html#event-warning) and the [emitWarning()](https://nodejs.org/docs/latest/api/process.html#processemitwarningwarning-type-code-ctor) method for more information about this flag's behavior.
|
|
1716
|
+
*/
|
|
1717
|
+
noDeprecation?: boolean;
|
|
1695
1718
|
/**
|
|
1696
1719
|
* This API is available through the [--permission](https://nodejs.org/api/cli.html#--permission) flag.
|
|
1697
1720
|
*
|
|
@@ -1750,18 +1773,7 @@ declare module "process" {
|
|
|
1750
1773
|
* If no IPC channel exists, this property is undefined.
|
|
1751
1774
|
* @since v7.1.0
|
|
1752
1775
|
*/
|
|
1753
|
-
channel?:
|
|
1754
|
-
/**
|
|
1755
|
-
* This method makes the IPC channel keep the event loop of the process running if .unref() has been called before.
|
|
1756
|
-
* @since v7.1.0
|
|
1757
|
-
*/
|
|
1758
|
-
ref(): void;
|
|
1759
|
-
/**
|
|
1760
|
-
* This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open.
|
|
1761
|
-
* @since v7.1.0
|
|
1762
|
-
*/
|
|
1763
|
-
unref(): void;
|
|
1764
|
-
};
|
|
1776
|
+
channel?: Control;
|
|
1765
1777
|
/**
|
|
1766
1778
|
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
|
|
1767
1779
|
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
|
|
@@ -1775,10 +1787,17 @@ declare module "process" {
|
|
|
1775
1787
|
*/
|
|
1776
1788
|
send?(
|
|
1777
1789
|
message: any,
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1790
|
+
callback?: (error: Error | null) => void,
|
|
1791
|
+
): boolean;
|
|
1792
|
+
send?(
|
|
1793
|
+
message: any,
|
|
1794
|
+
sendHandle: SendHandle,
|
|
1795
|
+
callback?: (error: Error | null) => void,
|
|
1796
|
+
): boolean;
|
|
1797
|
+
send?(
|
|
1798
|
+
message: any,
|
|
1799
|
+
sendHandle: SendHandle,
|
|
1800
|
+
options: MessageOptions,
|
|
1782
1801
|
callback?: (error: Error | null) => void,
|
|
1783
1802
|
): boolean;
|
|
1784
1803
|
/**
|
|
@@ -1970,6 +1989,7 @@ declare module "process" {
|
|
|
1970
1989
|
addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
|
1971
1990
|
addListener(event: "warning", listener: WarningListener): this;
|
|
1972
1991
|
addListener(event: "message", listener: MessageListener): this;
|
|
1992
|
+
addListener(event: "workerMessage", listener: (value: any, source: number) => void): this;
|
|
1973
1993
|
addListener(event: Signals, listener: SignalsListener): this;
|
|
1974
1994
|
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
1975
1995
|
addListener(event: "worker", listener: WorkerListener): this;
|
|
@@ -1981,7 +2001,8 @@ declare module "process" {
|
|
|
1981
2001
|
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
|
|
1982
2002
|
emit(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
|
|
1983
2003
|
emit(event: "warning", warning: Error): boolean;
|
|
1984
|
-
emit(event: "message", message: unknown, sendHandle:
|
|
2004
|
+
emit(event: "message", message: unknown, sendHandle: SendHandle): this;
|
|
2005
|
+
emit(event: "workerMessage", value: any, source: number): this;
|
|
1985
2006
|
emit(event: Signals, signal?: Signals): boolean;
|
|
1986
2007
|
emit(
|
|
1987
2008
|
event: "multipleResolves",
|
|
@@ -2002,6 +2023,7 @@ declare module "process" {
|
|
|
2002
2023
|
on(event: Signals, listener: SignalsListener): this;
|
|
2003
2024
|
on(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
2004
2025
|
on(event: "worker", listener: WorkerListener): this;
|
|
2026
|
+
on(event: "workerMessage", listener: (value: any, source: number) => void): this;
|
|
2005
2027
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
2006
2028
|
once(event: "beforeExit", listener: BeforeExitListener): this;
|
|
2007
2029
|
once(event: "disconnect", listener: DisconnectListener): this;
|
|
@@ -2015,6 +2037,7 @@ declare module "process" {
|
|
|
2015
2037
|
once(event: Signals, listener: SignalsListener): this;
|
|
2016
2038
|
once(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
2017
2039
|
once(event: "worker", listener: WorkerListener): this;
|
|
2040
|
+
once(event: "workerMessage", listener: (value: any, source: number) => void): this;
|
|
2018
2041
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
2019
2042
|
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
|
|
2020
2043
|
prependListener(event: "disconnect", listener: DisconnectListener): this;
|
|
@@ -2025,6 +2048,7 @@ declare module "process" {
|
|
|
2025
2048
|
prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
|
2026
2049
|
prependListener(event: "warning", listener: WarningListener): this;
|
|
2027
2050
|
prependListener(event: "message", listener: MessageListener): this;
|
|
2051
|
+
prependListener(event: "workerMessage", listener: (value: any, source: number) => void): this;
|
|
2028
2052
|
prependListener(event: Signals, listener: SignalsListener): this;
|
|
2029
2053
|
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
2030
2054
|
prependListener(event: "worker", listener: WorkerListener): this;
|
|
@@ -2037,6 +2061,7 @@ declare module "process" {
|
|
|
2037
2061
|
prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
|
2038
2062
|
prependOnceListener(event: "warning", listener: WarningListener): this;
|
|
2039
2063
|
prependOnceListener(event: "message", listener: MessageListener): this;
|
|
2064
|
+
prependOnceListener(event: "workerMessage", listener: (value: any, source: number) => void): this;
|
|
2040
2065
|
prependOnceListener(event: Signals, listener: SignalsListener): this;
|
|
2041
2066
|
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
2042
2067
|
prependOnceListener(event: "worker", listener: WorkerListener): this;
|
|
@@ -2049,6 +2074,7 @@ declare module "process" {
|
|
|
2049
2074
|
listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
|
|
2050
2075
|
listeners(event: "warning"): WarningListener[];
|
|
2051
2076
|
listeners(event: "message"): MessageListener[];
|
|
2077
|
+
listeners(event: "workerMessage"): ((value: any, source: number) => void)[];
|
|
2052
2078
|
listeners(event: Signals): SignalsListener[];
|
|
2053
2079
|
listeners(event: "multipleResolves"): MultipleResolveListener[];
|
|
2054
2080
|
listeners(event: "worker"): WorkerListener[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since v17.0.0
|
|
3
|
-
* @experimental
|
|
4
3
|
*/
|
|
5
4
|
declare module "readline/promises" {
|
|
6
5
|
import { Abortable } from "node:events";
|
|
@@ -65,7 +64,7 @@ declare module "readline/promises" {
|
|
|
65
64
|
constructor(
|
|
66
65
|
stream: NodeJS.WritableStream,
|
|
67
66
|
options?: {
|
|
68
|
-
autoCommit?: boolean;
|
|
67
|
+
autoCommit?: boolean | undefined;
|
|
69
68
|
},
|
|
70
69
|
);
|
|
71
70
|
/**
|
|
@@ -37,12 +37,10 @@ declare module "repl" {
|
|
|
37
37
|
terminal?: boolean | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* The function to be used when evaluating each given line of input.
|
|
40
|
-
* Default
|
|
40
|
+
* **Default:** an async wrapper for the JavaScript `eval()` function. An `eval` function can
|
|
41
41
|
* error with `repl.Recoverable` to indicate the input was incomplete and prompt for
|
|
42
|
-
* additional lines.
|
|
43
|
-
*
|
|
44
|
-
* @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_default_evaluation
|
|
45
|
-
* @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_custom_evaluation_functions
|
|
42
|
+
* additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#custom-evaluation-functions)
|
|
43
|
+
* section for more details.
|
|
46
44
|
*/
|
|
47
45
|
eval?: REPLEval | undefined;
|
|
48
46
|
/**
|
|
@@ -43,10 +43,9 @@
|
|
|
43
43
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/sqlite.js)
|
|
44
44
|
*/
|
|
45
45
|
declare module "node:sqlite" {
|
|
46
|
+
import { PathLike } from "node:fs";
|
|
46
47
|
type SQLInputValue = null | number | bigint | string | NodeJS.ArrayBufferView;
|
|
47
|
-
type SQLOutputValue = null | number | bigint | string |
|
|
48
|
-
/** @deprecated Use `SQLInputValue` or `SQLOutputValue` instead. */
|
|
49
|
-
type SupportedValueType = SQLOutputValue;
|
|
48
|
+
type SQLOutputValue = null | number | bigint | string | NodeJS.NonSharedUint8Array;
|
|
50
49
|
interface DatabaseSyncOptions {
|
|
51
50
|
/**
|
|
52
51
|
* If `true`, the database is opened by the constructor. When
|
|
@@ -89,6 +88,41 @@ declare module "node:sqlite" {
|
|
|
89
88
|
* @default false
|
|
90
89
|
*/
|
|
91
90
|
allowExtension?: boolean | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of
|
|
93
|
+
* time that SQLite will wait for a database lock to be released before
|
|
94
|
+
* returning an error.
|
|
95
|
+
* @since v22.16.0
|
|
96
|
+
* @default 0
|
|
97
|
+
*/
|
|
98
|
+
timeout?: number | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
|
|
101
|
+
* integer fields are read as JavaScript numbers.
|
|
102
|
+
* @since v22.18.0
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
readBigInts?: boolean | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* If `true`, query results are returned as arrays instead of objects.
|
|
108
|
+
* @since v22.18.0
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
returnArrays?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* If `true`, allows binding named parameters without the prefix
|
|
114
|
+
* character (e.g., `foo` instead of `:foo`).
|
|
115
|
+
* @since v22.18.0
|
|
116
|
+
* @default true
|
|
117
|
+
*/
|
|
118
|
+
allowBareNamedParameters?: boolean | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* If `true`, unknown named parameters are ignored when binding.
|
|
121
|
+
* If `false`, an exception is thrown for unknown named parameters.
|
|
122
|
+
* @since v22.18.0
|
|
123
|
+
* @default false
|
|
124
|
+
*/
|
|
125
|
+
allowUnknownNamedParameters?: boolean | undefined;
|
|
92
126
|
}
|
|
93
127
|
interface CreateSessionOptions {
|
|
94
128
|
/**
|
|
@@ -166,6 +200,31 @@ declare module "node:sqlite" {
|
|
|
166
200
|
*/
|
|
167
201
|
varargs?: boolean | undefined;
|
|
168
202
|
}
|
|
203
|
+
interface AggregateOptions<T extends SQLInputValue = SQLInputValue> extends FunctionOptions {
|
|
204
|
+
/**
|
|
205
|
+
* The identity value for the aggregation function. This value is used when the aggregation
|
|
206
|
+
* function is initialized. When a `Function` is passed the identity will be its return value.
|
|
207
|
+
*/
|
|
208
|
+
start: T | (() => T);
|
|
209
|
+
/**
|
|
210
|
+
* The function to call for each row in the aggregation. The
|
|
211
|
+
* function receives the current state and the row value. The return value of
|
|
212
|
+
* this function should be the new state.
|
|
213
|
+
*/
|
|
214
|
+
step: (accumulator: T, ...args: SQLOutputValue[]) => T;
|
|
215
|
+
/**
|
|
216
|
+
* The function to call to get the result of the
|
|
217
|
+
* aggregation. The function receives the final state and should return the
|
|
218
|
+
* result of the aggregation.
|
|
219
|
+
*/
|
|
220
|
+
result?: ((accumulator: T) => SQLInputValue) | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* When this function is provided, the `aggregate` method will work as a window function.
|
|
223
|
+
* The function receives the current state and the dropped row value. The return value of this function should be the
|
|
224
|
+
* new state.
|
|
225
|
+
*/
|
|
226
|
+
inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined;
|
|
227
|
+
}
|
|
169
228
|
/**
|
|
170
229
|
* This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
|
|
171
230
|
* exposed by this class execute synchronously.
|
|
@@ -180,7 +239,39 @@ declare module "node:sqlite" {
|
|
|
180
239
|
* To use an in-memory database, the path should be the special name `':memory:'`.
|
|
181
240
|
* @param options Configuration options for the database connection.
|
|
182
241
|
*/
|
|
183
|
-
constructor(path:
|
|
242
|
+
constructor(path: PathLike, options?: DatabaseSyncOptions);
|
|
243
|
+
/**
|
|
244
|
+
* Registers a new aggregate function with the SQLite database. This method is a wrapper around
|
|
245
|
+
* [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
|
|
246
|
+
*
|
|
247
|
+
* When used as a window function, the `result` function will be called multiple times.
|
|
248
|
+
*
|
|
249
|
+
* ```js
|
|
250
|
+
* import { DatabaseSync } from 'node:sqlite';
|
|
251
|
+
*
|
|
252
|
+
* const db = new DatabaseSync(':memory:');
|
|
253
|
+
* db.exec(`
|
|
254
|
+
* CREATE TABLE t3(x, y);
|
|
255
|
+
* INSERT INTO t3 VALUES ('a', 4),
|
|
256
|
+
* ('b', 5),
|
|
257
|
+
* ('c', 3),
|
|
258
|
+
* ('d', 8),
|
|
259
|
+
* ('e', 1);
|
|
260
|
+
* `);
|
|
261
|
+
*
|
|
262
|
+
* db.aggregate('sumint', {
|
|
263
|
+
* start: 0,
|
|
264
|
+
* step: (acc, value) => acc + value,
|
|
265
|
+
* });
|
|
266
|
+
*
|
|
267
|
+
* db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 }
|
|
268
|
+
* ```
|
|
269
|
+
* @since v22.16.0
|
|
270
|
+
* @param name The name of the SQLite function to create.
|
|
271
|
+
* @param options Function configuration settings.
|
|
272
|
+
*/
|
|
273
|
+
aggregate(name: string, options: AggregateOptions): void;
|
|
274
|
+
aggregate<T extends SQLInputValue>(name: string, options: AggregateOptions<T>): void;
|
|
184
275
|
/**
|
|
185
276
|
* Closes the database connection. An exception is thrown if the database is not
|
|
186
277
|
* open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html).
|
|
@@ -203,6 +294,15 @@ declare module "node:sqlite" {
|
|
|
203
294
|
* @param allow Whether to allow loading extensions.
|
|
204
295
|
*/
|
|
205
296
|
enableLoadExtension(allow: boolean): void;
|
|
297
|
+
/**
|
|
298
|
+
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
|
|
299
|
+
* @since v22.16.0
|
|
300
|
+
* @param dbName Name of the database. This can be `'main'` (the default primary database) or any other
|
|
301
|
+
* database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`.
|
|
302
|
+
* @returns The location of the database file. When using an in-memory database,
|
|
303
|
+
* this method returns null.
|
|
304
|
+
*/
|
|
305
|
+
location(dbName?: string): string | null;
|
|
206
306
|
/**
|
|
207
307
|
* This method allows one or more SQL statements to be executed without returning
|
|
208
308
|
* any results. This method is useful when executing SQL statements read from a
|
|
@@ -234,6 +334,12 @@ declare module "node:sqlite" {
|
|
|
234
334
|
* @since v22.15.0
|
|
235
335
|
*/
|
|
236
336
|
readonly isOpen: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Whether the database is currently within a transaction. This method
|
|
339
|
+
* is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).
|
|
340
|
+
* @since v22.16.0
|
|
341
|
+
*/
|
|
342
|
+
readonly isTransaction: boolean;
|
|
237
343
|
/**
|
|
238
344
|
* Opens the database specified in the `path` argument of the `DatabaseSync`constructor. This method should only be used when the database is not opened via
|
|
239
345
|
* the constructor. An exception is thrown if the database is already open.
|
|
@@ -304,7 +410,7 @@ declare module "node:sqlite" {
|
|
|
304
410
|
* @returns Binary changeset that can be applied to other databases.
|
|
305
411
|
* @since v22.12.0
|
|
306
412
|
*/
|
|
307
|
-
changeset():
|
|
413
|
+
changeset(): NodeJS.NonSharedUint8Array;
|
|
308
414
|
/**
|
|
309
415
|
* Similar to the method above, but generates a more compact patchset. See
|
|
310
416
|
* [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets)
|
|
@@ -314,7 +420,7 @@ declare module "node:sqlite" {
|
|
|
314
420
|
* @returns Binary patchset that can be applied to other databases.
|
|
315
421
|
* @since v22.12.0
|
|
316
422
|
*/
|
|
317
|
-
patchset():
|
|
423
|
+
patchset(): NodeJS.NonSharedUint8Array;
|
|
318
424
|
/**
|
|
319
425
|
* Closes the session. An exception is thrown if the database or the session is not open. This method is a
|
|
320
426
|
* wrapper around
|
|
@@ -322,6 +428,38 @@ declare module "node:sqlite" {
|
|
|
322
428
|
*/
|
|
323
429
|
close(): void;
|
|
324
430
|
}
|
|
431
|
+
interface StatementColumnMetadata {
|
|
432
|
+
/**
|
|
433
|
+
* The unaliased name of the column in the origin
|
|
434
|
+
* table, or `null` if the column is the result of an expression or subquery.
|
|
435
|
+
* This property is the result of [`sqlite3_column_origin_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
|
|
436
|
+
*/
|
|
437
|
+
column: string | null;
|
|
438
|
+
/**
|
|
439
|
+
* The unaliased name of the origin database, or
|
|
440
|
+
* `null` if the column is the result of an expression or subquery. This
|
|
441
|
+
* property is the result of [`sqlite3_column_database_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
|
|
442
|
+
*/
|
|
443
|
+
database: string | null;
|
|
444
|
+
/**
|
|
445
|
+
* The name assigned to the column in the result set of a
|
|
446
|
+
* `SELECT` statement. This property is the result of
|
|
447
|
+
* [`sqlite3_column_name()`](https://www.sqlite.org/c3ref/column_name.html).
|
|
448
|
+
*/
|
|
449
|
+
name: string;
|
|
450
|
+
/**
|
|
451
|
+
* The unaliased name of the origin table, or `null` if
|
|
452
|
+
* the column is the result of an expression or subquery. This property is the
|
|
453
|
+
* result of [`sqlite3_column_table_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
|
|
454
|
+
*/
|
|
455
|
+
table: string | null;
|
|
456
|
+
/**
|
|
457
|
+
* The declared data type of the column, or `null` if the
|
|
458
|
+
* column is the result of an expression or subquery. This property is the
|
|
459
|
+
* result of [`sqlite3_column_decltype()`](https://www.sqlite.org/c3ref/column_decltype.html).
|
|
460
|
+
*/
|
|
461
|
+
type: string | null;
|
|
462
|
+
}
|
|
325
463
|
interface StatementResultingChanges {
|
|
326
464
|
/**
|
|
327
465
|
* The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement.
|
|
@@ -366,6 +504,14 @@ declare module "node:sqlite" {
|
|
|
366
504
|
namedParameters: Record<string, SQLInputValue>,
|
|
367
505
|
...anonymousParameters: SQLInputValue[]
|
|
368
506
|
): Record<string, SQLOutputValue>[];
|
|
507
|
+
/**
|
|
508
|
+
* This method is used to retrieve information about the columns returned by the
|
|
509
|
+
* prepared statement.
|
|
510
|
+
* @since v22.16.0
|
|
511
|
+
* @returns An array of objects. Each object corresponds to a column
|
|
512
|
+
* in the prepared statement, and contains the following properties:
|
|
513
|
+
*/
|
|
514
|
+
columns(): StatementColumnMetadata[];
|
|
369
515
|
/**
|
|
370
516
|
* The source SQL text of the prepared statement with parameter
|
|
371
517
|
* placeholders replaced by the values that were used during the most recent
|
|
@@ -447,6 +593,13 @@ declare module "node:sqlite" {
|
|
|
447
593
|
* @param enabled Enables or disables support for unknown named parameters.
|
|
448
594
|
*/
|
|
449
595
|
setAllowUnknownNamedParameters(enabled: boolean): void;
|
|
596
|
+
/**
|
|
597
|
+
* When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead
|
|
598
|
+
* of objects.
|
|
599
|
+
* @since v22.16.0
|
|
600
|
+
* @param enabled Enables or disables the return of query results as arrays.
|
|
601
|
+
*/
|
|
602
|
+
setReturnArrays(enabled: boolean): void;
|
|
450
603
|
/**
|
|
451
604
|
* When reading from the database, SQLite `INTEGER`s are mapped to JavaScript
|
|
452
605
|
* numbers by default. However, SQLite `INTEGER`s can store values larger than
|
|
@@ -465,6 +618,66 @@ declare module "node:sqlite" {
|
|
|
465
618
|
*/
|
|
466
619
|
readonly sourceSQL: string;
|
|
467
620
|
}
|
|
621
|
+
interface BackupOptions {
|
|
622
|
+
/**
|
|
623
|
+
* Name of the source database. This can be `'main'` (the default primary database) or any other
|
|
624
|
+
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
|
|
625
|
+
* @default 'main'
|
|
626
|
+
*/
|
|
627
|
+
source?: string | undefined;
|
|
628
|
+
/**
|
|
629
|
+
* Name of the target database. This can be `'main'` (the default primary database) or any other
|
|
630
|
+
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
|
|
631
|
+
* @default 'main'
|
|
632
|
+
*/
|
|
633
|
+
target?: string | undefined;
|
|
634
|
+
/**
|
|
635
|
+
* Number of pages to be transmitted in each batch of the backup.
|
|
636
|
+
* @default 100
|
|
637
|
+
*/
|
|
638
|
+
rate?: number | undefined;
|
|
639
|
+
/**
|
|
640
|
+
* Callback function that will be called with the number of pages copied and the total number of
|
|
641
|
+
* pages.
|
|
642
|
+
*/
|
|
643
|
+
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
|
|
644
|
+
}
|
|
645
|
+
interface BackupProgressInfo {
|
|
646
|
+
totalPages: number;
|
|
647
|
+
remainingPages: number;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* This method makes a database backup. This method abstracts the
|
|
651
|
+
* [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit),
|
|
652
|
+
* [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
|
|
653
|
+
* and [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions.
|
|
654
|
+
*
|
|
655
|
+
* The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same
|
|
656
|
+
* `DatabaseSync` - object will be reflected in the backup right away. However, mutations from other connections will cause
|
|
657
|
+
* the backup process to restart.
|
|
658
|
+
*
|
|
659
|
+
* ```js
|
|
660
|
+
* import { backup, DatabaseSync } from 'node:sqlite';
|
|
661
|
+
*
|
|
662
|
+
* const sourceDb = new DatabaseSync('source.db');
|
|
663
|
+
* const totalPagesTransferred = await backup(sourceDb, 'backup.db', {
|
|
664
|
+
* rate: 1, // Copy one page at a time.
|
|
665
|
+
* progress: ({ totalPages, remainingPages }) => {
|
|
666
|
+
* console.log('Backup in progress', { totalPages, remainingPages });
|
|
667
|
+
* },
|
|
668
|
+
* });
|
|
669
|
+
*
|
|
670
|
+
* console.log('Backup completed', totalPagesTransferred);
|
|
671
|
+
* ```
|
|
672
|
+
* @since v22.16.0
|
|
673
|
+
* @param sourceDb The database to backup. The source database must be open.
|
|
674
|
+
* @param path The path where the backup will be created. If the file already exists,
|
|
675
|
+
* the contents will be overwritten.
|
|
676
|
+
* @param options Optional configuration for the backup. The
|
|
677
|
+
* following properties are supported:
|
|
678
|
+
* @returns A promise that resolves when the backup is completed and rejects if an error occurs.
|
|
679
|
+
*/
|
|
680
|
+
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<void>;
|
|
468
681
|
/**
|
|
469
682
|
* @since v22.13.0
|
|
470
683
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @since v16.7.0
|
|
5
5
|
*/
|
|
6
6
|
declare module "stream/consumers" {
|
|
7
|
-
import { Blob as NodeBlob } from "node:buffer";
|
|
7
|
+
import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer";
|
|
8
8
|
import { ReadableStream as WebReadableStream } from "node:stream/web";
|
|
9
9
|
/**
|
|
10
10
|
* @since v16.7.0
|
|
@@ -20,7 +20,7 @@ declare module "stream/consumers" {
|
|
|
20
20
|
* @since v16.7.0
|
|
21
21
|
* @returns Fulfills with a `Buffer` containing the full contents of the stream.
|
|
22
22
|
*/
|
|
23
|
-
function buffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<
|
|
23
|
+
function buffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NonSharedBuffer>;
|
|
24
24
|
/**
|
|
25
25
|
* @since v16.7.0
|
|
26
26
|
* @returns Fulfills with the contents of the stream parsed as a
|
|
@@ -6,6 +6,8 @@ type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
|
|
6
6
|
: import("stream/web").CountQueuingStrategy;
|
|
7
7
|
type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
|
8
8
|
: import("stream/web").DecompressionStream;
|
|
9
|
+
type _QueuingStrategy<T = any> = typeof globalThis extends { onmessage: any } ? {}
|
|
10
|
+
: import("stream/web").QueuingStrategy<T>;
|
|
9
11
|
type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
|
|
10
12
|
: import("stream/web").ReadableByteStreamController;
|
|
11
13
|
type _ReadableStream<R = any> = typeof globalThis extends { onmessage: any } ? {}
|
|
@@ -143,6 +145,9 @@ declare module "stream/web" {
|
|
|
143
145
|
interface TransformerTransformCallback<I, O> {
|
|
144
146
|
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
|
145
147
|
}
|
|
148
|
+
interface TransformerCancelCallback {
|
|
149
|
+
(reason: any): void | PromiseLike<void>;
|
|
150
|
+
}
|
|
146
151
|
interface UnderlyingByteSource {
|
|
147
152
|
autoAllocateChunkSize?: number;
|
|
148
153
|
cancel?: ReadableStreamErrorCallback;
|
|
@@ -261,6 +266,7 @@ declare module "stream/web" {
|
|
|
261
266
|
readableType?: undefined;
|
|
262
267
|
start?: TransformerStartCallback<O>;
|
|
263
268
|
transform?: TransformerTransformCallback<I, O>;
|
|
269
|
+
cancel?: TransformerCancelCallback;
|
|
264
270
|
writableType?: undefined;
|
|
265
271
|
}
|
|
266
272
|
interface TransformStream<I = any, O = any> {
|
|
@@ -483,6 +489,8 @@ declare module "stream/web" {
|
|
|
483
489
|
}
|
|
484
490
|
: typeof import("stream/web").DecompressionStream;
|
|
485
491
|
|
|
492
|
+
interface QueuingStrategy<T = any> extends _QueuingStrategy<T> {}
|
|
493
|
+
|
|
486
494
|
interface ReadableByteStreamController extends _ReadableByteStreamController {}
|
|
487
495
|
/**
|
|
488
496
|
* `ReadableByteStreamController` class is a global reference for `import { ReadableByteStreamController } from 'node:stream/web'`.
|