@types/node 22.15.33 → 22.18.13
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.18/README.md +15 -0
- {node v22.15 → node v22.18}/assert.d.ts +19 -0
- {node v22.15 → node v22.18}/buffer.buffer.d.ts +9 -0
- {node v22.15 → node v22.18}/buffer.d.ts +14 -6
- {node v22.15 → node v22.18}/child_process.d.ts +89 -162
- {node v22.15 → node v22.18}/cluster.d.ts +4 -5
- {node v22.15 → node v22.18}/crypto.d.ts +203 -167
- {node v22.15 → node v22.18}/dgram.d.ts +9 -8
- {node v22.15 → node v22.18}/dns/promises.d.ts +11 -10
- {node v22.15 → node v22.18}/dns.d.ts +19 -20
- {node v22.15 → node v22.18}/events.d.ts +80 -35
- {node v22.15 → node v22.18}/fs/promises.d.ts +78 -56
- {node v22.15 → node v22.18}/fs.d.ts +153 -129
- node v22.18/globals.d.ts +172 -0
- node v22.18/globals.typedarray.d.ts +38 -0
- {node v22.15 → node v22.18}/http.d.ts +112 -32
- {node v22.15 → node v22.18}/http2.d.ts +45 -26
- {node v22.15 → node v22.18}/https.d.ts +96 -62
- {node v22.15 → node v22.18}/index.d.ts +7 -3
- node v22.15/inspector.d.ts → node v22.18/inspector.generated.d.ts +219 -10
- {node v22.15 → node v22.18}/module.d.ts +70 -13
- {node v22.15 → node v22.18}/net.d.ts +12 -11
- {node v22.15 → node v22.18}/os.d.ts +14 -3
- {node v22.15 → node v22.18}/package.json +3 -83
- {node v22.15 → node v22.18}/perf_hooks.d.ts +6 -8
- {node v22.15 → node v22.18}/process.d.ts +15 -27
- {node v22.15 → node v22.18}/readline/promises.d.ts +1 -2
- {node v22.15 → node v22.18}/repl.d.ts +3 -5
- {node v22.15 → node v22.18}/sqlite.d.ts +212 -6
- {node v22.15 → node v22.18}/stream/consumers.d.ts +2 -2
- {node v22.15 → node v22.18}/stream/web.d.ts +8 -0
- {node v22.15 → node v22.18}/stream.d.ts +29 -33
- {node v22.15 → node v22.18}/string_decoder.d.ts +2 -2
- node v22.18/test.d.ts +2162 -0
- {node v22.15 → node v22.18}/tls.d.ts +90 -66
- {node v22.15 → node v22.18}/ts5.6/buffer.buffer.d.ts +10 -2
- node v22.18/ts5.6/globals.typedarray.d.ts +34 -0
- {node v22.15 → node v22.18}/ts5.6/index.d.ts +7 -3
- {node v22.15 → node v22.18}/url.d.ts +13 -4
- {node v22.15 → node v22.18}/util.d.ts +21 -6
- {node v22.15 → node v22.18}/v8.d.ts +33 -35
- {node v22.15 → node v22.18}/vm.d.ts +21 -50
- {node v22.15 → node v22.18}/wasi.d.ts +1 -1
- node v22.18/web-globals/abortcontroller.d.ts +34 -0
- node v22.18/web-globals/domexception.d.ts +68 -0
- node v22.15/dom-events.d.ts → node v22.18/web-globals/events.d.ts +49 -51
- node v22.18/web-globals/fetch.d.ts +46 -0
- node v22.18/web-globals/navigator.d.ts +22 -0
- node v22.18/web-globals/storage.d.ts +24 -0
- {node v22.15 → node v22.18}/worker_threads.d.ts +86 -67
- {node v22.15 → node v22.18}/zlib.d.ts +33 -26
- node v22.15/README.md +0 -15
- node v22.15/globals.d.ts +0 -364
- node v22.15/globals.typedarray.d.ts +0 -21
- node v22.15/test.d.ts +0 -2278
- node v22.15/ts5.6/globals.typedarray.d.ts +0 -19
- {node v22.15 → node v22.18}/LICENSE +0 -0
- {node v22.15 → node v22.18}/assert/strict.d.ts +0 -0
- {node v22.15 → node v22.18}/async_hooks.d.ts +1 -1
- {node v22.15 → node v22.18}/compatibility/disposable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/index.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/indexable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/iterators.d.ts +0 -0
- {node v22.15 → node v22.18}/console.d.ts +0 -0
- {node v22.15 → node v22.18}/constants.d.ts +0 -0
- {node v22.15 → node v22.18}/diagnostics_channel.d.ts +0 -0
- {node v22.15 → node v22.18}/domain.d.ts +0 -0
- {node v22.15 → node v22.18}/path.d.ts +0 -0
- {node v22.15 → node v22.18}/punycode.d.ts +0 -0
- {node v22.15 → node v22.18}/querystring.d.ts +0 -0
- {node v22.15 → node v22.18}/readline.d.ts +0 -0
- {node v22.15 → node v22.18}/sea.d.ts +0 -0
- {node v22.15 → node v22.18}/stream/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/timers/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/timers.d.ts +0 -0
- {node v22.15 → node v22.18}/trace_events.d.ts +0 -0
- {node v22.15 → node v22.18}/tty.d.ts +0 -0
|
@@ -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
|
|
@@ -465,6 +611,66 @@ declare module "node:sqlite" {
|
|
|
465
611
|
*/
|
|
466
612
|
readonly sourceSQL: string;
|
|
467
613
|
}
|
|
614
|
+
interface BackupOptions {
|
|
615
|
+
/**
|
|
616
|
+
* Name of the source database. This can be `'main'` (the default primary database) or any other
|
|
617
|
+
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
|
|
618
|
+
* @default 'main'
|
|
619
|
+
*/
|
|
620
|
+
source?: string | undefined;
|
|
621
|
+
/**
|
|
622
|
+
* Name of the target database. This can be `'main'` (the default primary database) or any other
|
|
623
|
+
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
|
|
624
|
+
* @default 'main'
|
|
625
|
+
*/
|
|
626
|
+
target?: string | undefined;
|
|
627
|
+
/**
|
|
628
|
+
* Number of pages to be transmitted in each batch of the backup.
|
|
629
|
+
* @default 100
|
|
630
|
+
*/
|
|
631
|
+
rate?: number | undefined;
|
|
632
|
+
/**
|
|
633
|
+
* Callback function that will be called with the number of pages copied and the total number of
|
|
634
|
+
* pages.
|
|
635
|
+
*/
|
|
636
|
+
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
|
|
637
|
+
}
|
|
638
|
+
interface BackupProgressInfo {
|
|
639
|
+
totalPages: number;
|
|
640
|
+
remainingPages: number;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* This method makes a database backup. This method abstracts the
|
|
644
|
+
* [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit),
|
|
645
|
+
* [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
|
|
646
|
+
* and [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions.
|
|
647
|
+
*
|
|
648
|
+
* The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same
|
|
649
|
+
* `DatabaseSync` - object will be reflected in the backup right away. However, mutations from other connections will cause
|
|
650
|
+
* the backup process to restart.
|
|
651
|
+
*
|
|
652
|
+
* ```js
|
|
653
|
+
* import { backup, DatabaseSync } from 'node:sqlite';
|
|
654
|
+
*
|
|
655
|
+
* const sourceDb = new DatabaseSync('source.db');
|
|
656
|
+
* const totalPagesTransferred = await backup(sourceDb, 'backup.db', {
|
|
657
|
+
* rate: 1, // Copy one page at a time.
|
|
658
|
+
* progress: ({ totalPages, remainingPages }) => {
|
|
659
|
+
* console.log('Backup in progress', { totalPages, remainingPages });
|
|
660
|
+
* },
|
|
661
|
+
* });
|
|
662
|
+
*
|
|
663
|
+
* console.log('Backup completed', totalPagesTransferred);
|
|
664
|
+
* ```
|
|
665
|
+
* @since v22.16.0
|
|
666
|
+
* @param sourceDb The database to backup. The source database must be open.
|
|
667
|
+
* @param path The path where the backup will be created. If the file already exists,
|
|
668
|
+
* the contents will be overwritten.
|
|
669
|
+
* @param options Optional configuration for the backup. The
|
|
670
|
+
* following properties are supported:
|
|
671
|
+
* @returns A promise that resolves when the backup is completed and rejects if an error occurs.
|
|
672
|
+
*/
|
|
673
|
+
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<void>;
|
|
468
674
|
/**
|
|
469
675
|
* @since v22.13.0
|
|
470
676
|
*/
|
|
@@ -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'`.
|
|
@@ -45,22 +45,22 @@ declare module "stream" {
|
|
|
45
45
|
emitClose?: boolean | undefined;
|
|
46
46
|
highWaterMark?: number | undefined;
|
|
47
47
|
objectMode?: boolean | undefined;
|
|
48
|
-
construct
|
|
49
|
-
destroy
|
|
48
|
+
construct?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined;
|
|
49
|
+
destroy?: ((this: T, error: Error | null, callback: (error?: Error | null) => void) => void) | undefined;
|
|
50
50
|
autoDestroy?: boolean | undefined;
|
|
51
51
|
}
|
|
52
52
|
interface ReadableOptions<T extends Readable = Readable> extends StreamOptions<T> {
|
|
53
53
|
encoding?: BufferEncoding | undefined;
|
|
54
|
-
read
|
|
54
|
+
read?: ((this: T, size: number) => void) | undefined;
|
|
55
55
|
}
|
|
56
56
|
interface ArrayOptions {
|
|
57
57
|
/**
|
|
58
58
|
* The maximum concurrent invocations of `fn` to call on the stream at once.
|
|
59
59
|
* @default 1
|
|
60
60
|
*/
|
|
61
|
-
concurrency?: number;
|
|
61
|
+
concurrency?: number | undefined;
|
|
62
62
|
/** Allows destroying the stream if the signal is aborted. */
|
|
63
|
-
signal?: AbortSignal;
|
|
63
|
+
signal?: AbortSignal | undefined;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* @since v0.9.4
|
|
@@ -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
|
/**
|
|
@@ -696,21 +692,25 @@ declare module "stream" {
|
|
|
696
692
|
interface WritableOptions<T extends Writable = Writable> extends StreamOptions<T> {
|
|
697
693
|
decodeStrings?: boolean | undefined;
|
|
698
694
|
defaultEncoding?: BufferEncoding | undefined;
|
|
699
|
-
write
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
695
|
+
write?:
|
|
696
|
+
| ((
|
|
697
|
+
this: T,
|
|
698
|
+
chunk: any,
|
|
699
|
+
encoding: BufferEncoding,
|
|
700
|
+
callback: (error?: Error | null) => void,
|
|
701
|
+
) => void)
|
|
702
|
+
| undefined;
|
|
703
|
+
writev?:
|
|
704
|
+
| ((
|
|
705
|
+
this: T,
|
|
706
|
+
chunks: Array<{
|
|
707
|
+
chunk: any;
|
|
708
|
+
encoding: BufferEncoding;
|
|
709
|
+
}>,
|
|
710
|
+
callback: (error?: Error | null) => void,
|
|
711
|
+
) => void)
|
|
712
|
+
| undefined;
|
|
713
|
+
final?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined;
|
|
714
714
|
}
|
|
715
715
|
/**
|
|
716
716
|
* @since v0.9.4
|
|
@@ -719,7 +719,6 @@ declare module "stream" {
|
|
|
719
719
|
/**
|
|
720
720
|
* A utility method for creating a `Writable` from a web `WritableStream`.
|
|
721
721
|
* @since v17.0.0
|
|
722
|
-
* @experimental
|
|
723
722
|
*/
|
|
724
723
|
static fromWeb(
|
|
725
724
|
writableStream: streamWeb.WritableStream,
|
|
@@ -728,7 +727,6 @@ declare module "stream" {
|
|
|
728
727
|
/**
|
|
729
728
|
* A utility method for creating a web `WritableStream` from a `Writable`.
|
|
730
729
|
* @since v17.0.0
|
|
731
|
-
* @experimental
|
|
732
730
|
*/
|
|
733
731
|
static toWeb(streamWritable: Writable): streamWeb.WritableStream;
|
|
734
732
|
/**
|
|
@@ -740,7 +738,6 @@ declare module "stream" {
|
|
|
740
738
|
/**
|
|
741
739
|
* Returns whether the stream was destroyed or errored before emitting `'finish'`.
|
|
742
740
|
* @since v18.0.0, v16.17.0
|
|
743
|
-
* @experimental
|
|
744
741
|
*/
|
|
745
742
|
readonly writableAborted: boolean;
|
|
746
743
|
/**
|
|
@@ -1090,7 +1087,6 @@ declare module "stream" {
|
|
|
1090
1087
|
/**
|
|
1091
1088
|
* A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
|
|
1092
1089
|
* @since v17.0.0
|
|
1093
|
-
* @experimental
|
|
1094
1090
|
*/
|
|
1095
1091
|
static toWeb(streamDuplex: Duplex): {
|
|
1096
1092
|
readable: streamWeb.ReadableStream;
|
|
@@ -1099,7 +1095,6 @@ declare module "stream" {
|
|
|
1099
1095
|
/**
|
|
1100
1096
|
* A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
|
|
1101
1097
|
* @since v17.0.0
|
|
1102
|
-
* @experimental
|
|
1103
1098
|
*/
|
|
1104
1099
|
static fromWeb(
|
|
1105
1100
|
duplexStream: {
|
|
@@ -1233,8 +1228,10 @@ declare module "stream" {
|
|
|
1233
1228
|
function duplexPair(options?: DuplexOptions): [Duplex, Duplex];
|
|
1234
1229
|
type TransformCallback = (error?: Error | null, data?: any) => void;
|
|
1235
1230
|
interface TransformOptions<T extends Transform = Transform> extends DuplexOptions<T> {
|
|
1236
|
-
transform
|
|
1237
|
-
|
|
1231
|
+
transform?:
|
|
1232
|
+
| ((this: T, chunk: any, encoding: BufferEncoding, callback: TransformCallback) => void)
|
|
1233
|
+
| undefined;
|
|
1234
|
+
flush?: ((this: T, callback: TransformCallback) => void) | undefined;
|
|
1238
1235
|
}
|
|
1239
1236
|
/**
|
|
1240
1237
|
* Transform streams are `Duplex` streams where the output is in some way
|
|
@@ -1641,6 +1638,7 @@ declare module "stream" {
|
|
|
1641
1638
|
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
|
|
1642
1639
|
): Promise<void>;
|
|
1643
1640
|
}
|
|
1641
|
+
// TODO: this interface never existed; remove in next major
|
|
1644
1642
|
interface Pipe {
|
|
1645
1643
|
close(): void;
|
|
1646
1644
|
hasRef(): boolean;
|
|
@@ -1650,13 +1648,11 @@ declare module "stream" {
|
|
|
1650
1648
|
/**
|
|
1651
1649
|
* Returns whether the stream has encountered an error.
|
|
1652
1650
|
* @since v17.3.0, v16.14.0
|
|
1653
|
-
* @experimental
|
|
1654
1651
|
*/
|
|
1655
1652
|
function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
|
|
1656
1653
|
/**
|
|
1657
1654
|
* Returns whether the stream is readable.
|
|
1658
1655
|
* @since v17.4.0, v16.14.0
|
|
1659
|
-
* @experimental
|
|
1660
1656
|
*/
|
|
1661
1657
|
function isReadable(stream: Readable | NodeJS.ReadableStream): boolean;
|
|
1662
1658
|
}
|
|
@@ -48,7 +48,7 @@ declare module "string_decoder" {
|
|
|
48
48
|
* @since v0.1.99
|
|
49
49
|
* @param buffer The bytes to decode.
|
|
50
50
|
*/
|
|
51
|
-
write(buffer: string |
|
|
51
|
+
write(buffer: string | NodeJS.ArrayBufferView): string;
|
|
52
52
|
/**
|
|
53
53
|
* Returns any remaining input stored in the internal buffer as a string. Bytes
|
|
54
54
|
* representing incomplete UTF-8 and UTF-16 characters will be replaced with
|
|
@@ -59,7 +59,7 @@ declare module "string_decoder" {
|
|
|
59
59
|
* @since v0.9.3
|
|
60
60
|
* @param buffer The bytes to decode.
|
|
61
61
|
*/
|
|
62
|
-
end(buffer?: string |
|
|
62
|
+
end(buffer?: string | NodeJS.ArrayBufferView): string;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
declare module "node:string_decoder" {
|