@types/node 22.15.35 → 22.16.1
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.15 → node v22.16}/README.md +1 -1
- {node v22.15 → node v22.16}/buffer.d.ts +2 -0
- {node v22.15 → node v22.16}/dns/promises.d.ts +11 -10
- {node v22.15 → node v22.16}/dns.d.ts +18 -19
- {node v22.15 → node v22.16}/events.d.ts +0 -1
- {node v22.15 → node v22.16}/module.d.ts +47 -14
- {node v22.15 → node v22.16}/package.json +2 -2
- {node v22.15 → node v22.16}/process.d.ts +0 -2
- {node v22.15 → node v22.16}/repl.d.ts +3 -5
- {node v22.15 → node v22.16}/sqlite.d.ts +172 -0
- {node v22.15 → node v22.16}/stream/web.d.ts +4 -0
- {node v22.15 → node v22.16}/util.d.ts +14 -2
- {node v22.15 → node v22.16}/worker_threads.d.ts +28 -17
- {node v22.15 → node v22.16}/LICENSE +0 -0
- {node v22.15 → node v22.16}/assert/strict.d.ts +0 -0
- {node v22.15 → node v22.16}/assert.d.ts +0 -0
- {node v22.15 → node v22.16}/async_hooks.d.ts +1 -1
- {node v22.15 → node v22.16}/buffer.buffer.d.ts +0 -0
- {node v22.15 → node v22.16}/child_process.d.ts +0 -0
- {node v22.15 → node v22.16}/cluster.d.ts +0 -0
- {node v22.15 → node v22.16}/compatibility/disposable.d.ts +0 -0
- {node v22.15 → node v22.16}/compatibility/index.d.ts +0 -0
- {node v22.15 → node v22.16}/compatibility/indexable.d.ts +0 -0
- {node v22.15 → node v22.16}/compatibility/iterators.d.ts +0 -0
- {node v22.15 → node v22.16}/console.d.ts +0 -0
- {node v22.15 → node v22.16}/constants.d.ts +0 -0
- {node v22.15 → node v22.16}/crypto.d.ts +0 -0
- {node v22.15 → node v22.16}/dgram.d.ts +0 -0
- {node v22.15 → node v22.16}/diagnostics_channel.d.ts +0 -0
- {node v22.15 → node v22.16}/dom-events.d.ts +0 -0
- {node v22.15 → node v22.16}/domain.d.ts +0 -0
- {node v22.15 → node v22.16}/fs/promises.d.ts +0 -0
- {node v22.15 → node v22.16}/fs.d.ts +0 -0
- {node v22.15 → node v22.16}/globals.d.ts +0 -0
- {node v22.15 → node v22.16}/globals.typedarray.d.ts +0 -0
- {node v22.15 → node v22.16}/http.d.ts +0 -0
- {node v22.15 → node v22.16}/http2.d.ts +0 -0
- {node v22.15 → node v22.16}/https.d.ts +0 -0
- {node v22.15 → node v22.16}/index.d.ts +0 -0
- {node v22.15 → node v22.16}/inspector.d.ts +0 -0
- {node v22.15 → node v22.16}/net.d.ts +0 -0
- {node v22.15 → node v22.16}/os.d.ts +0 -0
- {node v22.15 → node v22.16}/path.d.ts +0 -0
- {node v22.15 → node v22.16}/perf_hooks.d.ts +0 -0
- {node v22.15 → node v22.16}/punycode.d.ts +0 -0
- {node v22.15 → node v22.16}/querystring.d.ts +0 -0
- {node v22.15 → node v22.16}/readline/promises.d.ts +0 -0
- {node v22.15 → node v22.16}/readline.d.ts +0 -0
- {node v22.15 → node v22.16}/sea.d.ts +0 -0
- {node v22.15 → node v22.16}/stream/consumers.d.ts +0 -0
- {node v22.15 → node v22.16}/stream/promises.d.ts +0 -0
- {node v22.15 → node v22.16}/stream.d.ts +0 -0
- {node v22.15 → node v22.16}/string_decoder.d.ts +0 -0
- {node v22.15 → node v22.16}/test.d.ts +0 -0
- {node v22.15 → node v22.16}/timers/promises.d.ts +0 -0
- {node v22.15 → node v22.16}/timers.d.ts +0 -0
- {node v22.15 → node v22.16}/tls.d.ts +0 -0
- {node v22.15 → node v22.16}/trace_events.d.ts +0 -0
- {node v22.15 → node v22.16}/ts5.6/buffer.buffer.d.ts +0 -0
- {node v22.15 → node v22.16}/ts5.6/globals.typedarray.d.ts +0 -0
- {node v22.15 → node v22.16}/ts5.6/index.d.ts +0 -0
- {node v22.15 → node v22.16}/tty.d.ts +0 -0
- {node v22.15 → node v22.16}/url.d.ts +0 -0
- {node v22.15 → node v22.16}/v8.d.ts +0 -0
- {node v22.15 → node v22.16}/vm.d.ts +0 -0
- {node v22.15 → node v22.16}/wasi.d.ts +0 -0
- {node v22.15 → node v22.16}/zlib.d.ts +0 -0
@@ -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/v22.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated: Tue,
|
11
|
+
* Last updated: Tue, 08 Jul 2025 17:03:33 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
@@ -1702,6 +1702,8 @@ declare module "buffer" {
|
|
1702
1702
|
* @return A reference to `buf`.
|
1703
1703
|
*/
|
1704
1704
|
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
1705
|
+
fill(value: string | Uint8Array | number, offset: number, encoding: BufferEncoding): this;
|
1706
|
+
fill(value: string | Uint8Array | number, encoding: BufferEncoding): this;
|
1705
1707
|
/**
|
1706
1708
|
* If `value` is:
|
1707
1709
|
*
|
@@ -127,24 +127,25 @@ declare module "dns/promises" {
|
|
127
127
|
* @param [rrtype='A'] Resource record type.
|
128
128
|
*/
|
129
129
|
function resolve(hostname: string): Promise<string[]>;
|
130
|
-
function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
|
131
|
-
function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
|
130
|
+
function resolve(hostname: string, rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
132
131
|
function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
133
132
|
function resolve(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
|
134
|
-
function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
|
135
133
|
function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
136
134
|
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
137
|
-
function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
|
138
|
-
function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
|
139
135
|
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
140
136
|
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
141
137
|
function resolve(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
|
142
138
|
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
143
|
-
function resolve(
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
139
|
+
function resolve(hostname: string, rrtype: string): Promise<
|
140
|
+
| string[]
|
141
|
+
| CaaRecord[]
|
142
|
+
| MxRecord[]
|
143
|
+
| NaptrRecord[]
|
144
|
+
| SoaRecord
|
145
|
+
| SrvRecord[]
|
146
|
+
| TlsaRecord[]
|
147
|
+
| string[][]
|
148
|
+
| AnyRecord[]
|
148
149
|
>;
|
149
150
|
/**
|
150
151
|
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4
|
@@ -250,6 +250,9 @@ declare module "dns" {
|
|
250
250
|
contactemail?: string | undefined;
|
251
251
|
contactphone?: string | undefined;
|
252
252
|
}
|
253
|
+
export interface AnyCaaRecord extends CaaRecord {
|
254
|
+
type: "CAA";
|
255
|
+
}
|
253
256
|
export interface MxRecord {
|
254
257
|
priority: number;
|
255
258
|
exchange: string;
|
@@ -317,6 +320,7 @@ declare module "dns" {
|
|
317
320
|
export type AnyRecord =
|
318
321
|
| AnyARecord
|
319
322
|
| AnyAaaaRecord
|
323
|
+
| AnyCaaRecord
|
320
324
|
| AnyCnameRecord
|
321
325
|
| AnyMxRecord
|
322
326
|
| AnyNaptrRecord
|
@@ -345,12 +349,7 @@ declare module "dns" {
|
|
345
349
|
): void;
|
346
350
|
export function resolve(
|
347
351
|
hostname: string,
|
348
|
-
rrtype: "A",
|
349
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
350
|
-
): void;
|
351
|
-
export function resolve(
|
352
|
-
hostname: string,
|
353
|
-
rrtype: "AAAA",
|
352
|
+
rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR",
|
354
353
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
355
354
|
): void;
|
356
355
|
export function resolve(
|
@@ -360,8 +359,8 @@ declare module "dns" {
|
|
360
359
|
): void;
|
361
360
|
export function resolve(
|
362
361
|
hostname: string,
|
363
|
-
rrtype: "
|
364
|
-
callback: (err: NodeJS.ErrnoException | null,
|
362
|
+
rrtype: "CAA",
|
363
|
+
callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void,
|
365
364
|
): void;
|
366
365
|
export function resolve(
|
367
366
|
hostname: string,
|
@@ -373,16 +372,6 @@ declare module "dns" {
|
|
373
372
|
rrtype: "NAPTR",
|
374
373
|
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
375
374
|
): void;
|
376
|
-
export function resolve(
|
377
|
-
hostname: string,
|
378
|
-
rrtype: "NS",
|
379
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
380
|
-
): void;
|
381
|
-
export function resolve(
|
382
|
-
hostname: string,
|
383
|
-
rrtype: "PTR",
|
384
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
385
|
-
): void;
|
386
375
|
export function resolve(
|
387
376
|
hostname: string,
|
388
377
|
rrtype: "SOA",
|
@@ -410,6 +399,7 @@ declare module "dns" {
|
|
410
399
|
err: NodeJS.ErrnoException | null,
|
411
400
|
addresses:
|
412
401
|
| string[]
|
402
|
+
| CaaRecord[]
|
413
403
|
| MxRecord[]
|
414
404
|
| NaptrRecord[]
|
415
405
|
| SoaRecord
|
@@ -422,6 +412,7 @@ declare module "dns" {
|
|
422
412
|
export namespace resolve {
|
423
413
|
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
424
414
|
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
415
|
+
function __promisify__(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
|
425
416
|
function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
426
417
|
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
427
418
|
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
@@ -432,7 +423,15 @@ declare module "dns" {
|
|
432
423
|
hostname: string,
|
433
424
|
rrtype: string,
|
434
425
|
): Promise<
|
435
|
-
|
426
|
+
| string[]
|
427
|
+
| CaaRecord[]
|
428
|
+
| MxRecord[]
|
429
|
+
| NaptrRecord[]
|
430
|
+
| SoaRecord
|
431
|
+
| SrvRecord[]
|
432
|
+
| TlsaRecord[]
|
433
|
+
| string[][]
|
434
|
+
| AnyRecord[]
|
436
435
|
>;
|
437
436
|
}
|
438
437
|
/**
|
@@ -623,34 +623,67 @@ declare module "module" {
|
|
623
623
|
global {
|
624
624
|
interface ImportMeta {
|
625
625
|
/**
|
626
|
-
* The directory name of the current module.
|
627
|
-
*
|
626
|
+
* The directory name of the current module.
|
627
|
+
*
|
628
|
+
* This is the same as the `path.dirname()` of the `import.meta.filename`.
|
629
|
+
*
|
630
|
+
* > **Caveat**: only present on `file:` modules.
|
631
|
+
* @since v21.2.0, v20.11.0
|
628
632
|
*/
|
629
633
|
dirname: string;
|
630
634
|
/**
|
631
|
-
* The full absolute path and filename of the current module, with
|
635
|
+
* The full absolute path and filename of the current module, with
|
636
|
+
* symlinks resolved.
|
637
|
+
*
|
632
638
|
* This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
|
633
|
-
*
|
639
|
+
*
|
640
|
+
* > **Caveat** only local modules support this property. Modules not using the
|
641
|
+
* > `file:` protocol will not provide it.
|
642
|
+
* @since v21.2.0, v20.11.0
|
634
643
|
*/
|
635
644
|
filename: string;
|
636
645
|
/**
|
637
646
|
* The absolute `file:` URL of the module.
|
647
|
+
*
|
648
|
+
* This is defined exactly the same as it is in browsers providing the URL of the
|
649
|
+
* current module file.
|
650
|
+
*
|
651
|
+
* This enables useful patterns such as relative file loading:
|
652
|
+
*
|
653
|
+
* ```js
|
654
|
+
* import { readFileSync } from 'node:fs';
|
655
|
+
* const buffer = readFileSync(new URL('./data.proto', import.meta.url));
|
656
|
+
* ```
|
638
657
|
*/
|
639
658
|
url: string;
|
640
659
|
/**
|
641
|
-
*
|
642
|
-
* the URL string.
|
660
|
+
* `import.meta.resolve` is a module-relative resolution function scoped to
|
661
|
+
* each module, returning the URL string.
|
643
662
|
*
|
644
|
-
*
|
645
|
-
*
|
663
|
+
* ```js
|
664
|
+
* const dependencyAsset = import.meta.resolve('component-lib/asset.css');
|
665
|
+
* // file:///app/node_modules/component-lib/asset.css
|
666
|
+
* import.meta.resolve('./dep.js');
|
667
|
+
* // file:///app/dep.js
|
668
|
+
* ```
|
646
669
|
*
|
647
|
-
*
|
670
|
+
* All features of the Node.js module resolution are supported. Dependency
|
671
|
+
* resolutions are subject to the permitted exports resolutions within the package.
|
648
672
|
*
|
649
|
-
*
|
650
|
-
*
|
651
|
-
*
|
652
|
-
|
653
|
-
|
673
|
+
* **Caveats**:
|
674
|
+
*
|
675
|
+
* * This can result in synchronous file-system operations, which
|
676
|
+
* can impact performance similarly to `require.resolve`.
|
677
|
+
* * This feature is not available within custom loaders (it would
|
678
|
+
* create a deadlock).
|
679
|
+
* @since v13.9.0, v12.16.0
|
680
|
+
* @param specifier The module specifier to resolve relative to the
|
681
|
+
* current module.
|
682
|
+
* @param parent An optional absolute parent module URL to resolve from.
|
683
|
+
* **Default:** `import.meta.url`
|
684
|
+
* @returns The absolute URL string that the specifier would resolve to.
|
685
|
+
*/
|
686
|
+
resolve(specifier: string, parent?: string | URL): string;
|
654
687
|
}
|
655
688
|
namespace NodeJS {
|
656
689
|
interface Module {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.
|
3
|
+
"version": "22.16.1",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -220,6 +220,6 @@
|
|
220
220
|
"undici-types": "~6.21.0"
|
221
221
|
},
|
222
222
|
"peerDependencies": {},
|
223
|
-
"typesPublisherContentHash": "
|
223
|
+
"typesPublisherContentHash": "9330dcf33e6f8538db41d4c56b65319f35c2ab636a7ed37d9caaa95e373ea64e",
|
224
224
|
"typeScriptVersion": "5.1"
|
225
225
|
}
|
@@ -1566,13 +1566,11 @@ declare module "process" {
|
|
1566
1566
|
* See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
|
1567
1567
|
* information.
|
1568
1568
|
* @since v19.6.0, v18.15.0
|
1569
|
-
* @experimental
|
1570
1569
|
*/
|
1571
1570
|
constrainedMemory(): number;
|
1572
1571
|
/**
|
1573
1572
|
* Gets the amount of free memory that is still available to the process (in bytes).
|
1574
1573
|
* See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v22.x/api/process.html#processavailablememory) for more information.
|
1575
|
-
* @experimental
|
1576
1574
|
* @since v20.13.0
|
1577
1575
|
*/
|
1578
1576
|
availableMemory(): number;
|
@@ -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
|
/**
|
@@ -166,6 +166,31 @@ declare module "node:sqlite" {
|
|
166
166
|
*/
|
167
167
|
varargs?: boolean | undefined;
|
168
168
|
}
|
169
|
+
interface AggregateOptions<T extends SQLInputValue = SQLInputValue> extends FunctionOptions {
|
170
|
+
/**
|
171
|
+
* The identity value for the aggregation function. This value is used when the aggregation
|
172
|
+
* function is initialized. When a `Function` is passed the identity will be its return value.
|
173
|
+
*/
|
174
|
+
start: T | (() => T);
|
175
|
+
/**
|
176
|
+
* The function to call for each row in the aggregation. The
|
177
|
+
* function receives the current state and the row value. The return value of
|
178
|
+
* this function should be the new state.
|
179
|
+
*/
|
180
|
+
step: (accumulator: T, ...args: SQLOutputValue[]) => T;
|
181
|
+
/**
|
182
|
+
* The function to call to get the result of the
|
183
|
+
* aggregation. The function receives the final state and should return the
|
184
|
+
* result of the aggregation.
|
185
|
+
*/
|
186
|
+
result?: ((accumulator: T) => SQLInputValue) | undefined;
|
187
|
+
/**
|
188
|
+
* When this function is provided, the `aggregate` method will work as a window function.
|
189
|
+
* The function receives the current state and the dropped row value. The return value of this function should be the
|
190
|
+
* new state.
|
191
|
+
*/
|
192
|
+
inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined;
|
193
|
+
}
|
169
194
|
/**
|
170
195
|
* This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
|
171
196
|
* exposed by this class execute synchronously.
|
@@ -181,6 +206,38 @@ declare module "node:sqlite" {
|
|
181
206
|
* @param options Configuration options for the database connection.
|
182
207
|
*/
|
183
208
|
constructor(path: string | Buffer | URL, options?: DatabaseSyncOptions);
|
209
|
+
/**
|
210
|
+
* Registers a new aggregate function with the SQLite database. This method is a wrapper around
|
211
|
+
* [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
|
212
|
+
*
|
213
|
+
* When used as a window function, the `result` function will be called multiple times.
|
214
|
+
*
|
215
|
+
* ```js
|
216
|
+
* import { DatabaseSync } from 'node:sqlite';
|
217
|
+
*
|
218
|
+
* const db = new DatabaseSync(':memory:');
|
219
|
+
* db.exec(`
|
220
|
+
* CREATE TABLE t3(x, y);
|
221
|
+
* INSERT INTO t3 VALUES ('a', 4),
|
222
|
+
* ('b', 5),
|
223
|
+
* ('c', 3),
|
224
|
+
* ('d', 8),
|
225
|
+
* ('e', 1);
|
226
|
+
* `);
|
227
|
+
*
|
228
|
+
* db.aggregate('sumint', {
|
229
|
+
* start: 0,
|
230
|
+
* step: (acc, value) => acc + value,
|
231
|
+
* });
|
232
|
+
*
|
233
|
+
* db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 }
|
234
|
+
* ```
|
235
|
+
* @since v22.16.0
|
236
|
+
* @param name The name of the SQLite function to create.
|
237
|
+
* @param options Function configuration settings.
|
238
|
+
*/
|
239
|
+
aggregate(name: string, options: AggregateOptions): void;
|
240
|
+
aggregate<T extends SQLInputValue>(name: string, options: AggregateOptions<T>): void;
|
184
241
|
/**
|
185
242
|
* Closes the database connection. An exception is thrown if the database is not
|
186
243
|
* open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html).
|
@@ -203,6 +260,15 @@ declare module "node:sqlite" {
|
|
203
260
|
* @param allow Whether to allow loading extensions.
|
204
261
|
*/
|
205
262
|
enableLoadExtension(allow: boolean): void;
|
263
|
+
/**
|
264
|
+
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
|
265
|
+
* @since v22.16.0
|
266
|
+
* @param dbName Name of the database. This can be `'main'` (the default primary database) or any other
|
267
|
+
* database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`.
|
268
|
+
* @returns The location of the database file. When using an in-memory database,
|
269
|
+
* this method returns null.
|
270
|
+
*/
|
271
|
+
location(dbName?: string): string | null;
|
206
272
|
/**
|
207
273
|
* This method allows one or more SQL statements to be executed without returning
|
208
274
|
* any results. This method is useful when executing SQL statements read from a
|
@@ -234,6 +300,12 @@ declare module "node:sqlite" {
|
|
234
300
|
* @since v22.15.0
|
235
301
|
*/
|
236
302
|
readonly isOpen: boolean;
|
303
|
+
/**
|
304
|
+
* Whether the database is currently within a transaction. This method
|
305
|
+
* is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).
|
306
|
+
* @since v22.16.0
|
307
|
+
*/
|
308
|
+
readonly isTransaction: boolean;
|
237
309
|
/**
|
238
310
|
* 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
311
|
* the constructor. An exception is thrown if the database is already open.
|
@@ -322,6 +394,38 @@ declare module "node:sqlite" {
|
|
322
394
|
*/
|
323
395
|
close(): void;
|
324
396
|
}
|
397
|
+
interface StatementColumnMetadata {
|
398
|
+
/**
|
399
|
+
* The unaliased name of the column in the origin
|
400
|
+
* table, or `null` if the column is the result of an expression or subquery.
|
401
|
+
* This property is the result of [`sqlite3_column_origin_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
|
402
|
+
*/
|
403
|
+
column: string | null;
|
404
|
+
/**
|
405
|
+
* The unaliased name of the origin database, or
|
406
|
+
* `null` if the column is the result of an expression or subquery. This
|
407
|
+
* property is the result of [`sqlite3_column_database_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
|
408
|
+
*/
|
409
|
+
database: string | null;
|
410
|
+
/**
|
411
|
+
* The name assigned to the column in the result set of a
|
412
|
+
* `SELECT` statement. This property is the result of
|
413
|
+
* [`sqlite3_column_name()`](https://www.sqlite.org/c3ref/column_name.html).
|
414
|
+
*/
|
415
|
+
name: string;
|
416
|
+
/**
|
417
|
+
* The unaliased name of the origin table, or `null` if
|
418
|
+
* the column is the result of an expression or subquery. This property is the
|
419
|
+
* result of [`sqlite3_column_table_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
|
420
|
+
*/
|
421
|
+
table: string | null;
|
422
|
+
/**
|
423
|
+
* The declared data type of the column, or `null` if the
|
424
|
+
* column is the result of an expression or subquery. This property is the
|
425
|
+
* result of [`sqlite3_column_decltype()`](https://www.sqlite.org/c3ref/column_decltype.html).
|
426
|
+
*/
|
427
|
+
type: string | null;
|
428
|
+
}
|
325
429
|
interface StatementResultingChanges {
|
326
430
|
/**
|
327
431
|
* The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement.
|
@@ -366,6 +470,14 @@ declare module "node:sqlite" {
|
|
366
470
|
namedParameters: Record<string, SQLInputValue>,
|
367
471
|
...anonymousParameters: SQLInputValue[]
|
368
472
|
): Record<string, SQLOutputValue>[];
|
473
|
+
/**
|
474
|
+
* This method is used to retrieve information about the columns returned by the
|
475
|
+
* prepared statement.
|
476
|
+
* @since v22.16.0
|
477
|
+
* @returns An array of objects. Each object corresponds to a column
|
478
|
+
* in the prepared statement, and contains the following properties:
|
479
|
+
*/
|
480
|
+
columns(): StatementColumnMetadata[];
|
369
481
|
/**
|
370
482
|
* The source SQL text of the prepared statement with parameter
|
371
483
|
* placeholders replaced by the values that were used during the most recent
|
@@ -465,6 +577,66 @@ declare module "node:sqlite" {
|
|
465
577
|
*/
|
466
578
|
readonly sourceSQL: string;
|
467
579
|
}
|
580
|
+
interface BackupOptions {
|
581
|
+
/**
|
582
|
+
* Name of the source database. This can be `'main'` (the default primary database) or any other
|
583
|
+
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
|
584
|
+
* @default 'main'
|
585
|
+
*/
|
586
|
+
source?: string | undefined;
|
587
|
+
/**
|
588
|
+
* Name of the target database. This can be `'main'` (the default primary database) or any other
|
589
|
+
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
|
590
|
+
* @default 'main'
|
591
|
+
*/
|
592
|
+
target?: string | undefined;
|
593
|
+
/**
|
594
|
+
* Number of pages to be transmitted in each batch of the backup.
|
595
|
+
* @default 100
|
596
|
+
*/
|
597
|
+
rate?: number | undefined;
|
598
|
+
/**
|
599
|
+
* Callback function that will be called with the number of pages copied and the total number of
|
600
|
+
* pages.
|
601
|
+
*/
|
602
|
+
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
|
603
|
+
}
|
604
|
+
interface BackupProgressInfo {
|
605
|
+
totalPages: number;
|
606
|
+
remainingPages: number;
|
607
|
+
}
|
608
|
+
/**
|
609
|
+
* This method makes a database backup. This method abstracts the
|
610
|
+
* [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit),
|
611
|
+
* [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
|
612
|
+
* and [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions.
|
613
|
+
*
|
614
|
+
* The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same
|
615
|
+
* `DatabaseSync` - object will be reflected in the backup right away. However, mutations from other connections will cause
|
616
|
+
* the backup process to restart.
|
617
|
+
*
|
618
|
+
* ```js
|
619
|
+
* import { backup, DatabaseSync } from 'node:sqlite';
|
620
|
+
*
|
621
|
+
* const sourceDb = new DatabaseSync('source.db');
|
622
|
+
* const totalPagesTransferred = await backup(sourceDb, 'backup.db', {
|
623
|
+
* rate: 1, // Copy one page at a time.
|
624
|
+
* progress: ({ totalPages, remainingPages }) => {
|
625
|
+
* console.log('Backup in progress', { totalPages, remainingPages });
|
626
|
+
* },
|
627
|
+
* });
|
628
|
+
*
|
629
|
+
* console.log('Backup completed', totalPagesTransferred);
|
630
|
+
* ```
|
631
|
+
* @since v22.16.0
|
632
|
+
* @param sourceDb The database to backup. The source database must be open.
|
633
|
+
* @param path The path where the backup will be created. If the file already exists,
|
634
|
+
* the contents will be overwritten.
|
635
|
+
* @param options Optional configuration for the backup. The
|
636
|
+
* following properties are supported:
|
637
|
+
* @returns A promise that resolves when the backup is completed and rejects if an error occurs.
|
638
|
+
*/
|
639
|
+
function backup(sourceDb: DatabaseSync, path: string | Buffer | URL, options?: BackupOptions): Promise<void>;
|
468
640
|
/**
|
469
641
|
* @since v22.13.0
|
470
642
|
*/
|
@@ -143,6 +143,9 @@ declare module "stream/web" {
|
|
143
143
|
interface TransformerTransformCallback<I, O> {
|
144
144
|
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
145
145
|
}
|
146
|
+
interface TransformerCancelCallback {
|
147
|
+
(reason: any): void | PromiseLike<void>;
|
148
|
+
}
|
146
149
|
interface UnderlyingByteSource {
|
147
150
|
autoAllocateChunkSize?: number;
|
148
151
|
cancel?: ReadableStreamErrorCallback;
|
@@ -261,6 +264,7 @@ declare module "stream/web" {
|
|
261
264
|
readableType?: undefined;
|
262
265
|
start?: TransformerStartCallback<O>;
|
263
266
|
transform?: TransformerTransformCallback<I, O>;
|
267
|
+
cancel?: TransformerCancelCallback;
|
264
268
|
writableType?: undefined;
|
265
269
|
}
|
266
270
|
interface TransformStream<I = any, O = any> {
|
@@ -433,7 +433,6 @@ declare module "util" {
|
|
433
433
|
* });
|
434
434
|
* ```
|
435
435
|
* @since v19.7.0
|
436
|
-
* @experimental
|
437
436
|
* @param resource Any non-null object tied to the abortable operation and held weakly.
|
438
437
|
* If `resource` is garbage collected before the `signal` aborts, the promise remains pending,
|
439
438
|
* allowing Node.js to stop tracking it.
|
@@ -1481,7 +1480,7 @@ declare module "util" {
|
|
1481
1480
|
/**
|
1482
1481
|
* This function returns a formatted text considering the `format` passed
|
1483
1482
|
* for printing in a terminal. It is aware of the terminal's capabilities
|
1484
|
-
* and acts according to the configuration set via `
|
1483
|
+
* and acts according to the configuration set via `NO_COLOR`,
|
1485
1484
|
* `NODE_DISABLE_COLORS` and `FORCE_COLOR` environment variables.
|
1486
1485
|
*
|
1487
1486
|
* ```js
|
@@ -2226,6 +2225,19 @@ declare module "util/types" {
|
|
2226
2225
|
* @since v10.0.0
|
2227
2226
|
*/
|
2228
2227
|
function isExternal(object: unknown): boolean;
|
2228
|
+
/**
|
2229
|
+
* Returns `true` if the value is a built-in `Float16Array` instance.
|
2230
|
+
*
|
2231
|
+
* ```js
|
2232
|
+
* util.types.isFloat16Array(new ArrayBuffer()); // Returns false
|
2233
|
+
* util.types.isFloat16Array(new Float16Array()); // Returns true
|
2234
|
+
* util.types.isFloat16Array(new Float32Array()); // Returns false
|
2235
|
+
* ```
|
2236
|
+
* @since v22.16.0
|
2237
|
+
*/
|
2238
|
+
// This does NOT return a type predicate in v22.x.
|
2239
|
+
// The Float16Array feature does not yet exist in this version of Node.js.
|
2240
|
+
function isFloat16Array(object: unknown): boolean;
|
2229
2241
|
/**
|
2230
2242
|
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
2231
2243
|
*
|
@@ -15,28 +15,31 @@
|
|
15
15
|
*
|
16
16
|
* ```js
|
17
17
|
* import {
|
18
|
-
* Worker,
|
18
|
+
* Worker,
|
19
|
+
* isMainThread,
|
20
|
+
* parentPort,
|
21
|
+
* workerData,
|
19
22
|
* } from 'node:worker_threads';
|
20
|
-
* import { parse } from 'some-js-parsing-library';
|
21
23
|
*
|
22
|
-
* if (isMainThread) {
|
23
|
-
*
|
24
|
-
* return new Promise((resolve, reject) => {
|
25
|
-
* const worker = new Worker(__filename, {
|
26
|
-
* workerData: script,
|
27
|
-
* });
|
28
|
-
* worker.on('message', resolve);
|
29
|
-
* worker.on('error', reject);
|
30
|
-
* worker.on('exit', (code) => {
|
31
|
-
* if (code !== 0)
|
32
|
-
* reject(new Error(`Worker stopped with exit code ${code}`));
|
33
|
-
* });
|
34
|
-
* });
|
35
|
-
* };
|
36
|
-
* } else {
|
24
|
+
* if (!isMainThread) {
|
25
|
+
* const { parse } = await import('some-js-parsing-library');
|
37
26
|
* const script = workerData;
|
38
27
|
* parentPort.postMessage(parse(script));
|
39
28
|
* }
|
29
|
+
*
|
30
|
+
* export default function parseJSAsync(script) {
|
31
|
+
* return new Promise((resolve, reject) => {
|
32
|
+
* const worker = new Worker(new URL(import.meta.url), {
|
33
|
+
* workerData: script,
|
34
|
+
* });
|
35
|
+
* worker.on('message', resolve);
|
36
|
+
* worker.on('error', reject);
|
37
|
+
* worker.on('exit', (code) => {
|
38
|
+
* if (code !== 0)
|
39
|
+
* reject(new Error(`Worker stopped with exit code ${code}`));
|
40
|
+
* });
|
41
|
+
* });
|
42
|
+
* };
|
40
43
|
* ```
|
41
44
|
*
|
42
45
|
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
|
@@ -59,6 +62,7 @@ declare module "worker_threads" {
|
|
59
62
|
import { Readable, Writable } from "node:stream";
|
60
63
|
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
|
61
64
|
import { URL } from "node:url";
|
65
|
+
import { HeapInfo } from "node:v8";
|
62
66
|
const isInternalThread: boolean;
|
63
67
|
const isMainThread: boolean;
|
64
68
|
const parentPort: null | MessagePort;
|
@@ -465,6 +469,13 @@ declare module "worker_threads" {
|
|
465
469
|
* @return A promise for a Readable Stream containing a V8 heap snapshot
|
466
470
|
*/
|
467
471
|
getHeapSnapshot(): Promise<Readable>;
|
472
|
+
/**
|
473
|
+
* This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
|
474
|
+
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
|
475
|
+
* This methods allows the statistics to be observed from outside the actual thread.
|
476
|
+
* @since v22.16.0
|
477
|
+
*/
|
478
|
+
getHeapStatistics(): Promise<HeapInfo>;
|
468
479
|
addListener(event: "error", listener: (err: Error) => void): this;
|
469
480
|
addListener(event: "exit", listener: (exitCode: number) => void): this;
|
470
481
|
addListener(event: "message", listener: (value: any) => void): this;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|