@types/node 22.15.13 → 22.18.9

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 (76) hide show
  1. node v22.18/README.md +15 -0
  2. node/assert.d.ts → node v22.18/assert.d.ts +19 -0
  3. node/buffer.d.ts → node v22.18/buffer.d.ts +6 -2
  4. node/child_process.d.ts → node v22.18/child_process.d.ts +26 -122
  5. node/compatibility/disposable.d.ts → node v22.18/compatibility/disposable.d.ts +0 -2
  6. node/compatibility/indexable.d.ts → node v22.18/compatibility/indexable.d.ts +0 -3
  7. node/compatibility/iterators.d.ts → node v22.18/compatibility/iterators.d.ts +0 -1
  8. node/crypto.d.ts → node v22.18/crypto.d.ts +17 -1
  9. node/diagnostics_channel.d.ts → node v22.18/diagnostics_channel.d.ts +18 -13
  10. node/dns/promises.d.ts → node v22.18/dns/promises.d.ts +36 -9
  11. node/dns.d.ts → node v22.18/dns.d.ts +73 -20
  12. node/events.d.ts → node v22.18/events.d.ts +79 -34
  13. node/fs/promises.d.ts → node v22.18/fs/promises.d.ts +57 -39
  14. node/fs.d.ts → node v22.18/fs.d.ts +98 -47
  15. node v22.18/globals.d.ts +172 -0
  16. node/http.d.ts → node v22.18/http.d.ts +72 -6
  17. node/http2.d.ts → node v22.18/http2.d.ts +81 -2
  18. node/https.d.ts → node v22.18/https.d.ts +5 -0
  19. node/index.d.ts → node v22.18/index.d.ts +7 -3
  20. node/inspector.d.ts → node v22.18/inspector.generated.d.ts +219 -10
  21. node/module.d.ts → node v22.18/module.d.ts +136 -17
  22. node/net.d.ts → node v22.18/net.d.ts +3 -3
  23. node/package.json → node v22.18/package.json +3 -83
  24. node/perf_hooks.d.ts → node v22.18/perf_hooks.d.ts +2 -2
  25. node/process.d.ts → node v22.18/process.d.ts +3 -4
  26. node/readline/promises.d.ts → node v22.18/readline/promises.d.ts +0 -1
  27. node/repl.d.ts → node v22.18/repl.d.ts +3 -5
  28. node/sqlite.d.ts → node v22.18/sqlite.d.ts +207 -0
  29. node/stream/web.d.ts → node v22.18/stream/web.d.ts +8 -0
  30. node/stream.d.ts → node v22.18/stream.d.ts +5 -10
  31. node v22.18/test.d.ts +2162 -0
  32. node/ts5.6/index.d.ts → node v22.18/ts5.6/index.d.ts +7 -3
  33. node/url.d.ts → node v22.18/url.d.ts +12 -3
  34. node/util.d.ts → node v22.18/util.d.ts +20 -5
  35. node/v8.d.ts → node v22.18/v8.d.ts +60 -30
  36. node/vm.d.ts → node v22.18/vm.d.ts +61 -8
  37. node v22.18/web-globals/abortcontroller.d.ts +34 -0
  38. node v22.18/web-globals/domexception.d.ts +68 -0
  39. node v22.18/web-globals/events.d.ts +97 -0
  40. node v22.18/web-globals/fetch.d.ts +46 -0
  41. node v22.18/web-globals/navigator.d.ts +22 -0
  42. node v22.18/web-globals/storage.d.ts +24 -0
  43. node/worker_threads.d.ts → node v22.18/worker_threads.d.ts +105 -74
  44. node/zlib.d.ts → node v22.18/zlib.d.ts +8 -2
  45. node/README.md +0 -15
  46. node/dom-events.d.ts +0 -124
  47. node/globals.d.ts +0 -371
  48. node/test.d.ts +0 -2280
  49. {node → node v22.18}/LICENSE +0 -0
  50. {node → node v22.18}/assert/strict.d.ts +0 -0
  51. node/async_hooks.d.ts → node v22.18/async_hooks.d.ts +1 -1
  52. {node → node v22.18}/buffer.buffer.d.ts +0 -0
  53. {node → node v22.18}/cluster.d.ts +0 -0
  54. {node → node v22.18}/compatibility/index.d.ts +0 -0
  55. {node → node v22.18}/console.d.ts +0 -0
  56. {node → node v22.18}/constants.d.ts +0 -0
  57. {node → node v22.18}/dgram.d.ts +0 -0
  58. {node → node v22.18}/domain.d.ts +0 -0
  59. {node → node v22.18}/globals.typedarray.d.ts +0 -0
  60. {node → node v22.18}/os.d.ts +0 -0
  61. {node → node v22.18}/path.d.ts +0 -0
  62. {node → node v22.18}/punycode.d.ts +0 -0
  63. {node → node v22.18}/querystring.d.ts +0 -0
  64. {node → node v22.18}/readline.d.ts +0 -0
  65. {node → node v22.18}/sea.d.ts +0 -0
  66. {node → node v22.18}/stream/consumers.d.ts +0 -0
  67. {node → node v22.18}/stream/promises.d.ts +0 -0
  68. {node → node v22.18}/string_decoder.d.ts +0 -0
  69. {node → node v22.18}/timers/promises.d.ts +0 -0
  70. {node → node v22.18}/timers.d.ts +0 -0
  71. {node → node v22.18}/tls.d.ts +0 -0
  72. {node → node v22.18}/trace_events.d.ts +0 -0
  73. {node → node v22.18}/ts5.6/buffer.buffer.d.ts +0 -0
  74. {node → node v22.18}/ts5.6/globals.typedarray.d.ts +0 -0
  75. {node → node v22.18}/tty.d.ts +0 -0
  76. {node → node v22.18}/wasi.d.ts +0 -0
@@ -89,6 +89,41 @@ declare module "node:sqlite" {
89
89
  * @default false
90
90
  */
91
91
  allowExtension?: boolean | undefined;
92
+ /**
93
+ * The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of
94
+ * time that SQLite will wait for a database lock to be released before
95
+ * returning an error.
96
+ * @since v22.16.0
97
+ * @default 0
98
+ */
99
+ timeout?: number | undefined;
100
+ /**
101
+ * If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
102
+ * integer fields are read as JavaScript numbers.
103
+ * @since v22.18.0
104
+ * @default false
105
+ */
106
+ readBigInts?: boolean | undefined;
107
+ /**
108
+ * If `true`, query results are returned as arrays instead of objects.
109
+ * @since v22.18.0
110
+ * @default false
111
+ */
112
+ returnArrays?: boolean | undefined;
113
+ /**
114
+ * If `true`, allows binding named parameters without the prefix
115
+ * character (e.g., `foo` instead of `:foo`).
116
+ * @since v22.18.0
117
+ * @default true
118
+ */
119
+ allowBareNamedParameters?: boolean | undefined;
120
+ /**
121
+ * If `true`, unknown named parameters are ignored when binding.
122
+ * If `false`, an exception is thrown for unknown named parameters.
123
+ * @since v22.18.0
124
+ * @default false
125
+ */
126
+ allowUnknownNamedParameters?: boolean | undefined;
92
127
  }
93
128
  interface CreateSessionOptions {
94
129
  /**
@@ -166,6 +201,31 @@ declare module "node:sqlite" {
166
201
  */
167
202
  varargs?: boolean | undefined;
168
203
  }
204
+ interface AggregateOptions<T extends SQLInputValue = SQLInputValue> extends FunctionOptions {
205
+ /**
206
+ * The identity value for the aggregation function. This value is used when the aggregation
207
+ * function is initialized. When a `Function` is passed the identity will be its return value.
208
+ */
209
+ start: T | (() => T);
210
+ /**
211
+ * The function to call for each row in the aggregation. The
212
+ * function receives the current state and the row value. The return value of
213
+ * this function should be the new state.
214
+ */
215
+ step: (accumulator: T, ...args: SQLOutputValue[]) => T;
216
+ /**
217
+ * The function to call to get the result of the
218
+ * aggregation. The function receives the final state and should return the
219
+ * result of the aggregation.
220
+ */
221
+ result?: ((accumulator: T) => SQLInputValue) | undefined;
222
+ /**
223
+ * When this function is provided, the `aggregate` method will work as a window function.
224
+ * The function receives the current state and the dropped row value. The return value of this function should be the
225
+ * new state.
226
+ */
227
+ inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined;
228
+ }
169
229
  /**
170
230
  * This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
171
231
  * exposed by this class execute synchronously.
@@ -181,6 +241,38 @@ declare module "node:sqlite" {
181
241
  * @param options Configuration options for the database connection.
182
242
  */
183
243
  constructor(path: string | Buffer | URL, options?: DatabaseSyncOptions);
244
+ /**
245
+ * Registers a new aggregate function with the SQLite database. This method is a wrapper around
246
+ * [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
247
+ *
248
+ * When used as a window function, the `result` function will be called multiple times.
249
+ *
250
+ * ```js
251
+ * import { DatabaseSync } from 'node:sqlite';
252
+ *
253
+ * const db = new DatabaseSync(':memory:');
254
+ * db.exec(`
255
+ * CREATE TABLE t3(x, y);
256
+ * INSERT INTO t3 VALUES ('a', 4),
257
+ * ('b', 5),
258
+ * ('c', 3),
259
+ * ('d', 8),
260
+ * ('e', 1);
261
+ * `);
262
+ *
263
+ * db.aggregate('sumint', {
264
+ * start: 0,
265
+ * step: (acc, value) => acc + value,
266
+ * });
267
+ *
268
+ * db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 }
269
+ * ```
270
+ * @since v22.16.0
271
+ * @param name The name of the SQLite function to create.
272
+ * @param options Function configuration settings.
273
+ */
274
+ aggregate(name: string, options: AggregateOptions): void;
275
+ aggregate<T extends SQLInputValue>(name: string, options: AggregateOptions<T>): void;
184
276
  /**
185
277
  * Closes the database connection. An exception is thrown if the database is not
186
278
  * open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html).
@@ -203,6 +295,15 @@ declare module "node:sqlite" {
203
295
  * @param allow Whether to allow loading extensions.
204
296
  */
205
297
  enableLoadExtension(allow: boolean): void;
298
+ /**
299
+ * This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
300
+ * @since v22.16.0
301
+ * @param dbName Name of the database. This can be `'main'` (the default primary database) or any other
302
+ * database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`.
303
+ * @returns The location of the database file. When using an in-memory database,
304
+ * this method returns null.
305
+ */
306
+ location(dbName?: string): string | null;
206
307
  /**
207
308
  * This method allows one or more SQL statements to be executed without returning
208
309
  * any results. This method is useful when executing SQL statements read from a
@@ -234,6 +335,12 @@ declare module "node:sqlite" {
234
335
  * @since v22.15.0
235
336
  */
236
337
  readonly isOpen: boolean;
338
+ /**
339
+ * Whether the database is currently within a transaction. This method
340
+ * is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).
341
+ * @since v22.16.0
342
+ */
343
+ readonly isTransaction: boolean;
237
344
  /**
238
345
  * 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
346
  * the constructor. An exception is thrown if the database is already open.
@@ -322,6 +429,38 @@ declare module "node:sqlite" {
322
429
  */
323
430
  close(): void;
324
431
  }
432
+ interface StatementColumnMetadata {
433
+ /**
434
+ * The unaliased name of the column in the origin
435
+ * table, or `null` if the column is the result of an expression or subquery.
436
+ * This property is the result of [`sqlite3_column_origin_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
437
+ */
438
+ column: string | null;
439
+ /**
440
+ * The unaliased name of the origin database, or
441
+ * `null` if the column is the result of an expression or subquery. This
442
+ * property is the result of [`sqlite3_column_database_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
443
+ */
444
+ database: string | null;
445
+ /**
446
+ * The name assigned to the column in the result set of a
447
+ * `SELECT` statement. This property is the result of
448
+ * [`sqlite3_column_name()`](https://www.sqlite.org/c3ref/column_name.html).
449
+ */
450
+ name: string;
451
+ /**
452
+ * The unaliased name of the origin table, or `null` if
453
+ * the column is the result of an expression or subquery. This property is the
454
+ * result of [`sqlite3_column_table_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
455
+ */
456
+ table: string | null;
457
+ /**
458
+ * The declared data type of the column, or `null` if the
459
+ * column is the result of an expression or subquery. This property is the
460
+ * result of [`sqlite3_column_decltype()`](https://www.sqlite.org/c3ref/column_decltype.html).
461
+ */
462
+ type: string | null;
463
+ }
325
464
  interface StatementResultingChanges {
326
465
  /**
327
466
  * The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement.
@@ -366,6 +505,14 @@ declare module "node:sqlite" {
366
505
  namedParameters: Record<string, SQLInputValue>,
367
506
  ...anonymousParameters: SQLInputValue[]
368
507
  ): Record<string, SQLOutputValue>[];
508
+ /**
509
+ * This method is used to retrieve information about the columns returned by the
510
+ * prepared statement.
511
+ * @since v22.16.0
512
+ * @returns An array of objects. Each object corresponds to a column
513
+ * in the prepared statement, and contains the following properties:
514
+ */
515
+ columns(): StatementColumnMetadata[];
369
516
  /**
370
517
  * The source SQL text of the prepared statement with parameter
371
518
  * placeholders replaced by the values that were used during the most recent
@@ -465,6 +612,66 @@ declare module "node:sqlite" {
465
612
  */
466
613
  readonly sourceSQL: string;
467
614
  }
615
+ interface BackupOptions {
616
+ /**
617
+ * Name of the source database. This can be `'main'` (the default primary database) or any other
618
+ * database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
619
+ * @default 'main'
620
+ */
621
+ source?: string | undefined;
622
+ /**
623
+ * Name of the target 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
+ target?: string | undefined;
628
+ /**
629
+ * Number of pages to be transmitted in each batch of the backup.
630
+ * @default 100
631
+ */
632
+ rate?: number | undefined;
633
+ /**
634
+ * Callback function that will be called with the number of pages copied and the total number of
635
+ * pages.
636
+ */
637
+ progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
638
+ }
639
+ interface BackupProgressInfo {
640
+ totalPages: number;
641
+ remainingPages: number;
642
+ }
643
+ /**
644
+ * This method makes a database backup. This method abstracts the
645
+ * [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit),
646
+ * [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
647
+ * and [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions.
648
+ *
649
+ * The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same
650
+ * `DatabaseSync` - object will be reflected in the backup right away. However, mutations from other connections will cause
651
+ * the backup process to restart.
652
+ *
653
+ * ```js
654
+ * import { backup, DatabaseSync } from 'node:sqlite';
655
+ *
656
+ * const sourceDb = new DatabaseSync('source.db');
657
+ * const totalPagesTransferred = await backup(sourceDb, 'backup.db', {
658
+ * rate: 1, // Copy one page at a time.
659
+ * progress: ({ totalPages, remainingPages }) => {
660
+ * console.log('Backup in progress', { totalPages, remainingPages });
661
+ * },
662
+ * });
663
+ *
664
+ * console.log('Backup completed', totalPagesTransferred);
665
+ * ```
666
+ * @since v22.16.0
667
+ * @param sourceDb The database to backup. The source database must be open.
668
+ * @param path The path where the backup will be created. If the file already exists,
669
+ * the contents will be overwritten.
670
+ * @param options Optional configuration for the backup. The
671
+ * following properties are supported:
672
+ * @returns A promise that resolves when the backup is completed and rejects if an error occurs.
673
+ */
674
+ function backup(sourceDb: DatabaseSync, path: string | Buffer | URL, options?: BackupOptions): Promise<void>;
468
675
  /**
469
676
  * @since v22.13.0
470
677
  */
@@ -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'`.
@@ -76,7 +76,6 @@ declare module "stream" {
76
76
  /**
77
77
  * A utility method for creating a `Readable` from a web `ReadableStream`.
78
78
  * @since v17.0.0
79
- * @experimental
80
79
  */
81
80
  static fromWeb(
82
81
  readableStream: streamWeb.ReadableStream,
@@ -85,7 +84,6 @@ declare module "stream" {
85
84
  /**
86
85
  * A utility method for creating a web `ReadableStream` from a `Readable`.
87
86
  * @since v17.0.0
88
- * @experimental
89
87
  */
90
88
  static toWeb(
91
89
  streamReadable: Readable,
@@ -101,7 +99,6 @@ declare module "stream" {
101
99
  /**
102
100
  * Returns whether the stream was destroyed or errored before emitting `'end'`.
103
101
  * @since v16.8.0
104
- * @experimental
105
102
  */
106
103
  readonly readableAborted: boolean;
107
104
  /**
@@ -113,7 +110,6 @@ declare module "stream" {
113
110
  /**
114
111
  * Returns whether `'data'` has been emitted.
115
112
  * @since v16.7.0, v14.18.0
116
- * @experimental
117
113
  */
118
114
  readonly readableDidRead: boolean;
119
115
  /**
@@ -719,7 +715,6 @@ declare module "stream" {
719
715
  /**
720
716
  * A utility method for creating a `Writable` from a web `WritableStream`.
721
717
  * @since v17.0.0
722
- * @experimental
723
718
  */
724
719
  static fromWeb(
725
720
  writableStream: streamWeb.WritableStream,
@@ -728,7 +723,6 @@ declare module "stream" {
728
723
  /**
729
724
  * A utility method for creating a web `WritableStream` from a `Writable`.
730
725
  * @since v17.0.0
731
- * @experimental
732
726
  */
733
727
  static toWeb(streamWritable: Writable): streamWeb.WritableStream;
734
728
  /**
@@ -737,6 +731,11 @@ declare module "stream" {
737
731
  * @since v11.4.0
738
732
  */
739
733
  readonly writable: boolean;
734
+ /**
735
+ * Returns whether the stream was destroyed or errored before emitting `'finish'`.
736
+ * @since v18.0.0, v16.17.0
737
+ */
738
+ readonly writableAborted: boolean;
740
739
  /**
741
740
  * Is `true` after `writable.end()` has been called. This property
742
741
  * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead.
@@ -1084,7 +1083,6 @@ declare module "stream" {
1084
1083
  /**
1085
1084
  * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
1086
1085
  * @since v17.0.0
1087
- * @experimental
1088
1086
  */
1089
1087
  static toWeb(streamDuplex: Duplex): {
1090
1088
  readable: streamWeb.ReadableStream;
@@ -1093,7 +1091,6 @@ declare module "stream" {
1093
1091
  /**
1094
1092
  * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
1095
1093
  * @since v17.0.0
1096
- * @experimental
1097
1094
  */
1098
1095
  static fromWeb(
1099
1096
  duplexStream: {
@@ -1644,13 +1641,11 @@ declare module "stream" {
1644
1641
  /**
1645
1642
  * Returns whether the stream has encountered an error.
1646
1643
  * @since v17.3.0, v16.14.0
1647
- * @experimental
1648
1644
  */
1649
1645
  function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
1650
1646
  /**
1651
1647
  * Returns whether the stream is readable.
1652
1648
  * @since v17.4.0, v16.14.0
1653
- * @experimental
1654
1649
  */
1655
1650
  function isReadable(stream: Readable | NodeJS.ReadableStream): boolean;
1656
1651
  }