@types/node 22.15.34 → 22.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. {node v22.15 → node v22.16}/README.md +1 -1
  2. {node v22.15 → node v22.16}/buffer.d.ts +2 -0
  3. {node v22.15 → node v22.16}/events.d.ts +0 -1
  4. {node v22.15 → node v22.16}/module.d.ts +47 -14
  5. {node v22.15 → node v22.16}/package.json +2 -2
  6. {node v22.15 → node v22.16}/process.d.ts +0 -2
  7. {node v22.15 → node v22.16}/repl.d.ts +3 -5
  8. {node v22.15 → node v22.16}/sqlite.d.ts +172 -0
  9. {node v22.15 → node v22.16}/stream/web.d.ts +4 -0
  10. node v22.16/test.d.ts +2175 -0
  11. {node v22.15 → node v22.16}/util.d.ts +14 -2
  12. {node v22.15 → node v22.16}/worker_threads.d.ts +28 -17
  13. node v22.15/test.d.ts +0 -2278
  14. {node v22.15 → node v22.16}/LICENSE +0 -0
  15. {node v22.15 → node v22.16}/assert/strict.d.ts +0 -0
  16. {node v22.15 → node v22.16}/assert.d.ts +0 -0
  17. {node v22.15 → node v22.16}/async_hooks.d.ts +1 -1
  18. {node v22.15 → node v22.16}/buffer.buffer.d.ts +0 -0
  19. {node v22.15 → node v22.16}/child_process.d.ts +0 -0
  20. {node v22.15 → node v22.16}/cluster.d.ts +0 -0
  21. {node v22.15 → node v22.16}/compatibility/disposable.d.ts +0 -0
  22. {node v22.15 → node v22.16}/compatibility/index.d.ts +0 -0
  23. {node v22.15 → node v22.16}/compatibility/indexable.d.ts +0 -0
  24. {node v22.15 → node v22.16}/compatibility/iterators.d.ts +0 -0
  25. {node v22.15 → node v22.16}/console.d.ts +0 -0
  26. {node v22.15 → node v22.16}/constants.d.ts +0 -0
  27. {node v22.15 → node v22.16}/crypto.d.ts +0 -0
  28. {node v22.15 → node v22.16}/dgram.d.ts +0 -0
  29. {node v22.15 → node v22.16}/diagnostics_channel.d.ts +0 -0
  30. {node v22.15 → node v22.16}/dns/promises.d.ts +0 -0
  31. {node v22.15 → node v22.16}/dns.d.ts +0 -0
  32. {node v22.15 → node v22.16}/dom-events.d.ts +0 -0
  33. {node v22.15 → node v22.16}/domain.d.ts +0 -0
  34. {node v22.15 → node v22.16}/fs/promises.d.ts +0 -0
  35. {node v22.15 → node v22.16}/fs.d.ts +0 -0
  36. {node v22.15 → node v22.16}/globals.d.ts +0 -0
  37. {node v22.15 → node v22.16}/globals.typedarray.d.ts +0 -0
  38. {node v22.15 → node v22.16}/http.d.ts +0 -0
  39. {node v22.15 → node v22.16}/http2.d.ts +0 -0
  40. {node v22.15 → node v22.16}/https.d.ts +0 -0
  41. {node v22.15 → node v22.16}/index.d.ts +0 -0
  42. {node v22.15 → node v22.16}/inspector.d.ts +0 -0
  43. {node v22.15 → node v22.16}/net.d.ts +0 -0
  44. {node v22.15 → node v22.16}/os.d.ts +0 -0
  45. {node v22.15 → node v22.16}/path.d.ts +0 -0
  46. {node v22.15 → node v22.16}/perf_hooks.d.ts +0 -0
  47. {node v22.15 → node v22.16}/punycode.d.ts +0 -0
  48. {node v22.15 → node v22.16}/querystring.d.ts +0 -0
  49. {node v22.15 → node v22.16}/readline/promises.d.ts +0 -0
  50. {node v22.15 → node v22.16}/readline.d.ts +0 -0
  51. {node v22.15 → node v22.16}/sea.d.ts +0 -0
  52. {node v22.15 → node v22.16}/stream/consumers.d.ts +0 -0
  53. {node v22.15 → node v22.16}/stream/promises.d.ts +0 -0
  54. {node v22.15 → node v22.16}/stream.d.ts +0 -0
  55. {node v22.15 → node v22.16}/string_decoder.d.ts +0 -0
  56. {node v22.15 → node v22.16}/timers/promises.d.ts +0 -0
  57. {node v22.15 → node v22.16}/timers.d.ts +0 -0
  58. {node v22.15 → node v22.16}/tls.d.ts +0 -0
  59. {node v22.15 → node v22.16}/trace_events.d.ts +0 -0
  60. {node v22.15 → node v22.16}/ts5.6/buffer.buffer.d.ts +0 -0
  61. {node v22.15 → node v22.16}/ts5.6/globals.typedarray.d.ts +0 -0
  62. {node v22.15 → node v22.16}/ts5.6/index.d.ts +0 -0
  63. {node v22.15 → node v22.16}/tty.d.ts +0 -0
  64. {node v22.15 → node v22.16}/url.d.ts +0 -0
  65. {node v22.15 → node v22.16}/v8.d.ts +0 -0
  66. {node v22.15 → node v22.16}/vm.d.ts +0 -0
  67. {node v22.15 → node v22.16}/wasi.d.ts +0 -0
  68. {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: Sat, 28 Jun 2025 07:33:25 GMT
11
+ * Last updated: Tue, 01 Jul 2025 20:02:28 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
  *
@@ -431,7 +431,6 @@ declare module "events" {
431
431
  * }
432
432
  * ```
433
433
  * @since v20.5.0
434
- * @experimental
435
434
  * @return Disposable that removes the `abort` listener.
436
435
  */
437
436
  static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
@@ -623,34 +623,67 @@ declare module "module" {
623
623
  global {
624
624
  interface ImportMeta {
625
625
  /**
626
- * The directory name of the current module. This is the same as the `path.dirname()` of the `import.meta.filename`.
627
- * **Caveat:** only present on `file:` modules.
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 symlinks resolved.
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
- * **Caveat:** only local modules support this property. Modules not using the `file:` protocol will not provide it.
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
- * Provides a module-relative resolution function scoped to each module, returning
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
- * Second `parent` parameter is only used when the `--experimental-import-meta-resolve`
645
- * command flag enabled.
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
- * @since v20.6.0
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
- * @param specifier The module specifier to resolve relative to `parent`.
650
- * @param parent The absolute parent module URL to resolve from.
651
- * @returns The absolute (`file:`) URL string for the resolved module.
652
- */
653
- resolve(specifier: string, parent?: string | URL | undefined): string;
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.15.34",
3
+ "version": "22.16.0",
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": "41775fc6753a5f26b0840aaad12ee761b0c4b320ba7f46ef61a24ce7aad81de9",
223
+ "typesPublisherContentHash": "3b4dc3ecaa3f888296eb8b7cb9d14cb24b118c6f2bf065e3344543c6b0359df5",
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: an async wrapper for the JavaScript `eval()` function. An `eval` function can
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> {