@idlebox/stripe-node-types 24.0.14 → 24.0.15
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.
- package/README.md +1 -1
- package/assert/strict.d.ts +98 -1
- package/assert.d.ts +147 -248
- package/async_hooks.d.ts +5 -5
- package/buffer.buffer.d.ts +9 -6
- package/buffer.d.ts +49 -169
- package/child_process.d.ts +102 -223
- package/cluster.d.ts +236 -329
- package/console.d.ts +45 -346
- package/constants.d.ts +0 -1
- package/crypto.d.ts +698 -1149
- package/dgram.d.ts +15 -50
- package/diagnostics_channel.d.ts +1 -3
- package/dns.d.ts +135 -131
- package/domain.d.ts +10 -14
- package/events.d.ts +846 -722
- package/fs/promises.d.ts +102 -53
- package/fs.d.ts +714 -484
- package/globals.d.ts +130 -347
- package/globals.typedarray.d.ts +79 -0
- package/http.d.ts +343 -246
- package/http2.d.ts +563 -711
- package/https.d.ts +70 -216
- package/index.d.ts +24 -3
- package/inspector/promises.d.ts +54 -0
- package/inspector.d.ts +167 -3938
- package/inspector.generated.d.ts +4242 -0
- package/module.d.ts +45 -95
- package/net.d.ts +87 -186
- package/os.d.ts +17 -6
- package/package.json +3 -8
- package/path/posix.d.ts +20 -0
- package/path/win32.d.ts +20 -0
- package/path.d.ts +117 -122
- package/perf_hooks.d.ts +295 -644
- package/process.d.ts +177 -138
- package/punycode.d.ts +2 -2
- package/querystring.d.ts +1 -1
- package/quic.d.ts +926 -0
- package/readline/promises.d.ts +1 -1
- package/readline.d.ts +65 -118
- package/repl.d.ts +83 -96
- package/sea.d.ts +10 -1
- package/sqlite.d.ts +262 -13
- package/stream/consumers.d.ts +7 -7
- package/stream/promises.d.ts +133 -12
- package/stream/web.d.ts +173 -495
- package/stream.d.ts +593 -490
- package/string_decoder.d.ts +3 -3
- package/test/reporters.d.ts +112 -0
- package/test.d.ts +223 -199
- package/timers/promises.d.ts +1 -1
- package/timers.d.ts +1 -129
- package/tls.d.ts +148 -163
- package/trace_events.d.ts +6 -6
- package/ts5.6/buffer.buffer.d.ts +10 -8
- package/ts5.6/globals.typedarray.d.ts +16 -0
- package/ts5.6/index.d.ts +24 -3
- package/ts5.7/index.d.ts +24 -3
- package/tty.d.ts +55 -13
- package/url.d.ts +92 -587
- package/util/types.d.ts +571 -0
- package/util.d.ts +143 -792
- package/v8.d.ts +67 -7
- package/vm.d.ts +252 -108
- package/wasi.d.ts +23 -2
- package/web-globals/abortcontroller.d.ts +75 -0
- package/web-globals/blob.d.ts +39 -0
- package/{ts5.1/compatibility/disposable.d.ts → web-globals/console.d.ts} +6 -9
- package/web-globals/crypto.d.ts +55 -0
- package/web-globals/domexception.d.ts +84 -0
- package/web-globals/encoding.d.ts +27 -0
- package/{dom-events.d.ts → web-globals/events.d.ts} +57 -50
- package/web-globals/fetch.d.ts +70 -0
- package/web-globals/importmeta.d.ts +29 -0
- package/web-globals/messaging.d.ts +39 -0
- package/web-globals/navigator.d.ts +41 -0
- package/web-globals/performance.d.ts +61 -0
- package/web-globals/storage.d.ts +40 -0
- package/web-globals/streams.d.ts +131 -0
- package/web-globals/timers.d.ts +60 -0
- package/web-globals/url.d.ts +40 -0
- package/worker_threads.d.ts +291 -349
- package/zlib.d.ts +44 -94
- package/ts5.1/index.d.ts +0 -115
package/sqlite.d.ts
CHANGED
|
@@ -55,14 +55,13 @@
|
|
|
55
55
|
* ```
|
|
56
56
|
* @since v22.5.0
|
|
57
57
|
* @experimental
|
|
58
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
58
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/sqlite.js)
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
61
|
declare module "node:sqlite" {
|
|
62
|
+
import { PathLike } from '_not-use-node-type_fs';
|
|
62
63
|
type SQLInputValue = null | number | bigint | string | NodeJS.ArrayBufferView;
|
|
63
|
-
type SQLOutputValue = null | number | bigint | string |
|
|
64
|
-
/** @deprecated Use `SQLInputValue` or `SQLOutputValue` instead. */
|
|
65
|
-
type SupportedValueType = SQLOutputValue;
|
|
64
|
+
type SQLOutputValue = null | number | bigint | string | NodeJS.NonSharedUint8Array;
|
|
66
65
|
interface DatabaseSyncOptions {
|
|
67
66
|
/**
|
|
68
67
|
* If `true`, the database is opened by the constructor. When
|
|
@@ -113,6 +112,33 @@ declare module "node:sqlite" {
|
|
|
113
112
|
* @default 0
|
|
114
113
|
*/
|
|
115
114
|
timeout?: number | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
|
|
117
|
+
* integer fields are read as JavaScript numbers.
|
|
118
|
+
* @since v24.4.0
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
121
|
+
readBigInts?: boolean | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* If `true`, query results are returned as arrays instead of objects.
|
|
124
|
+
* @since v24.4.0
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
returnArrays?: boolean | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* If `true`, allows binding named parameters without the prefix
|
|
130
|
+
* character (e.g., `foo` instead of `:foo`).
|
|
131
|
+
* @since v24.4.40
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
allowBareNamedParameters?: boolean | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* If `true`, unknown named parameters are ignored when binding.
|
|
137
|
+
* If `false`, an exception is thrown for unknown named parameters.
|
|
138
|
+
* @since v24.4.40
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
allowUnknownNamedParameters?: boolean | undefined;
|
|
116
142
|
}
|
|
117
143
|
interface CreateSessionOptions {
|
|
118
144
|
/**
|
|
@@ -229,7 +255,7 @@ declare module "node:sqlite" {
|
|
|
229
255
|
* To use an in-memory database, the path should be the special name `':memory:'`.
|
|
230
256
|
* @param options Configuration options for the database connection.
|
|
231
257
|
*/
|
|
232
|
-
constructor(path:
|
|
258
|
+
constructor(path: PathLike, options?: DatabaseSyncOptions);
|
|
233
259
|
/**
|
|
234
260
|
* Registers a new aggregate function with the SQLite database. This method is a wrapper around
|
|
235
261
|
* [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
|
|
@@ -310,7 +336,7 @@ declare module "node:sqlite" {
|
|
|
310
336
|
* @param func The JavaScript function to call when the SQLite
|
|
311
337
|
* function is invoked. The return value of this function should be a valid
|
|
312
338
|
* SQLite data type: see
|
|
313
|
-
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-
|
|
339
|
+
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v25.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite).
|
|
314
340
|
* The result defaults to `NULL` if the return value is `undefined`.
|
|
315
341
|
*/
|
|
316
342
|
function(
|
|
@@ -319,6 +345,64 @@ declare module "node:sqlite" {
|
|
|
319
345
|
func: (...args: SQLOutputValue[]) => SQLInputValue,
|
|
320
346
|
): void;
|
|
321
347
|
function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void;
|
|
348
|
+
/**
|
|
349
|
+
* Sets an authorizer callback that SQLite will invoke whenever it attempts to
|
|
350
|
+
* access data or modify the database schema through prepared statements.
|
|
351
|
+
* This can be used to implement security policies, audit access, or restrict certain operations.
|
|
352
|
+
* This method is a wrapper around [`sqlite3_set_authorizer()`](https://sqlite.org/c3ref/set_authorizer.html).
|
|
353
|
+
*
|
|
354
|
+
* When invoked, the callback receives five arguments:
|
|
355
|
+
*
|
|
356
|
+
* * `actionCode` {number} The type of operation being performed (e.g.,
|
|
357
|
+
* `SQLITE_INSERT`, `SQLITE_UPDATE`, `SQLITE_SELECT`).
|
|
358
|
+
* * `arg1` {string|null} The first argument (context-dependent, often a table name).
|
|
359
|
+
* * `arg2` {string|null} The second argument (context-dependent, often a column name).
|
|
360
|
+
* * `dbName` {string|null} The name of the database.
|
|
361
|
+
* * `triggerOrView` {string|null} The name of the trigger or view causing the access.
|
|
362
|
+
*
|
|
363
|
+
* The callback must return one of the following constants:
|
|
364
|
+
*
|
|
365
|
+
* * `SQLITE_OK` - Allow the operation.
|
|
366
|
+
* * `SQLITE_DENY` - Deny the operation (causes an error).
|
|
367
|
+
* * `SQLITE_IGNORE` - Ignore the operation (silently skip).
|
|
368
|
+
*
|
|
369
|
+
* ```js
|
|
370
|
+
* import { DatabaseSync, constants } from 'node:sqlite';
|
|
371
|
+
* const db = new DatabaseSync(':memory:');
|
|
372
|
+
*
|
|
373
|
+
* // Set up an authorizer that denies all table creation
|
|
374
|
+
* db.setAuthorizer((actionCode) => {
|
|
375
|
+
* if (actionCode === constants.SQLITE_CREATE_TABLE) {
|
|
376
|
+
* return constants.SQLITE_DENY;
|
|
377
|
+
* }
|
|
378
|
+
* return constants.SQLITE_OK;
|
|
379
|
+
* });
|
|
380
|
+
*
|
|
381
|
+
* // This will work
|
|
382
|
+
* db.prepare('SELECT 1').get();
|
|
383
|
+
*
|
|
384
|
+
* // This will throw an error due to authorization denial
|
|
385
|
+
* try {
|
|
386
|
+
* db.exec('CREATE TABLE blocked (id INTEGER)');
|
|
387
|
+
* } catch (err) {
|
|
388
|
+
* console.log('Operation blocked:', err.message);
|
|
389
|
+
* }
|
|
390
|
+
* ```
|
|
391
|
+
* @since v24.10.0
|
|
392
|
+
* @param callback The authorizer function to set, or `null` to
|
|
393
|
+
* clear the current authorizer.
|
|
394
|
+
*/
|
|
395
|
+
setAuthorizer(
|
|
396
|
+
callback:
|
|
397
|
+
| ((
|
|
398
|
+
actionCode: number,
|
|
399
|
+
arg1: string | null,
|
|
400
|
+
arg2: string | null,
|
|
401
|
+
dbName: string | null,
|
|
402
|
+
triggerOrView: string | null,
|
|
403
|
+
) => number)
|
|
404
|
+
| null,
|
|
405
|
+
): void;
|
|
322
406
|
/**
|
|
323
407
|
* Whether the database is currently open or not.
|
|
324
408
|
* @since v22.15.0
|
|
@@ -344,6 +428,47 @@ declare module "node:sqlite" {
|
|
|
344
428
|
* @return The prepared statement.
|
|
345
429
|
*/
|
|
346
430
|
prepare(sql: string): StatementSync;
|
|
431
|
+
/**
|
|
432
|
+
* Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for
|
|
433
|
+
* storing prepared statements. This allows for the efficient reuse of prepared
|
|
434
|
+
* statements by tagging them with a unique identifier.
|
|
435
|
+
*
|
|
436
|
+
* When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared
|
|
437
|
+
* statement for that specific SQL string already exists in the cache. If it does,
|
|
438
|
+
* the cached statement is used. If not, a new prepared statement is created,
|
|
439
|
+
* executed, and then stored in the cache for future use. This mechanism helps to
|
|
440
|
+
* avoid the overhead of repeatedly parsing and preparing the same SQL statements.
|
|
441
|
+
*
|
|
442
|
+
* ```js
|
|
443
|
+
* import { DatabaseSync } from 'node:sqlite';
|
|
444
|
+
*
|
|
445
|
+
* const db = new DatabaseSync(':memory:');
|
|
446
|
+
* const sql = db.createSQLTagStore();
|
|
447
|
+
*
|
|
448
|
+
* db.exec('CREATE TABLE users (id INT, name TEXT)');
|
|
449
|
+
*
|
|
450
|
+
* // Using the 'run' method to insert data.
|
|
451
|
+
* // The tagged literal is used to identify the prepared statement.
|
|
452
|
+
* sql.run`INSERT INTO users VALUES (1, 'Alice')`;
|
|
453
|
+
* sql.run`INSERT INTO users VALUES (2, 'Bob')`;
|
|
454
|
+
*
|
|
455
|
+
* // Using the 'get' method to retrieve a single row.
|
|
456
|
+
* const id = 1;
|
|
457
|
+
* const user = sql.get`SELECT * FROM users WHERE id = ${id}`;
|
|
458
|
+
* console.log(user); // { id: 1, name: 'Alice' }
|
|
459
|
+
*
|
|
460
|
+
* // Using the 'all' method to retrieve all rows.
|
|
461
|
+
* const allUsers = sql.all`SELECT * FROM users ORDER BY id`;
|
|
462
|
+
* console.log(allUsers);
|
|
463
|
+
* // [
|
|
464
|
+
* // { id: 1, name: 'Alice' },
|
|
465
|
+
* // { id: 2, name: 'Bob' }
|
|
466
|
+
* // ]
|
|
467
|
+
* ```
|
|
468
|
+
* @since v24.9.0
|
|
469
|
+
* @returns A new SQL tag store for caching prepared statements.
|
|
470
|
+
*/
|
|
471
|
+
createTagStore(maxSize?: number): SQLTagStore;
|
|
347
472
|
/**
|
|
348
473
|
* Creates and attaches a session to the database. This method is a wrapper around
|
|
349
474
|
* [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and
|
|
@@ -385,7 +510,6 @@ declare module "node:sqlite" {
|
|
|
385
510
|
* Closes the database connection. If the database connection is already closed
|
|
386
511
|
* then this is a no-op.
|
|
387
512
|
* @since v22.15.0
|
|
388
|
-
* @experimental
|
|
389
513
|
*/
|
|
390
514
|
[Symbol.dispose](): void;
|
|
391
515
|
}
|
|
@@ -400,7 +524,7 @@ declare module "node:sqlite" {
|
|
|
400
524
|
* @returns Binary changeset that can be applied to other databases.
|
|
401
525
|
* @since v22.12.0
|
|
402
526
|
*/
|
|
403
|
-
changeset():
|
|
527
|
+
changeset(): NodeJS.NonSharedUint8Array;
|
|
404
528
|
/**
|
|
405
529
|
* Similar to the method above, but generates a more compact patchset. See
|
|
406
530
|
* [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets)
|
|
@@ -410,7 +534,7 @@ declare module "node:sqlite" {
|
|
|
410
534
|
* @returns Binary patchset that can be applied to other databases.
|
|
411
535
|
* @since v22.12.0
|
|
412
536
|
*/
|
|
413
|
-
patchset():
|
|
537
|
+
patchset(): NodeJS.NonSharedUint8Array;
|
|
414
538
|
/**
|
|
415
539
|
* Closes the session. An exception is thrown if the database or the session is not open. This method is a
|
|
416
540
|
* wrapper around
|
|
@@ -418,6 +542,73 @@ declare module "node:sqlite" {
|
|
|
418
542
|
*/
|
|
419
543
|
close(): void;
|
|
420
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* This class represents a single LRU (Least Recently Used) cache for storing
|
|
547
|
+
* prepared statements.
|
|
548
|
+
*
|
|
549
|
+
* Instances of this class are created via the database.createSQLTagStore() method,
|
|
550
|
+
* not by using a constructor. The store caches prepared statements based on the
|
|
551
|
+
* provided SQL query string. When the same query is seen again, the store
|
|
552
|
+
* retrieves the cached statement and safely applies the new values through
|
|
553
|
+
* parameter binding, thereby preventing attacks like SQL injection.
|
|
554
|
+
*
|
|
555
|
+
* The cache has a maxSize that defaults to 1000 statements, but a custom size can
|
|
556
|
+
* be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this
|
|
557
|
+
* class execute synchronously.
|
|
558
|
+
* @since v24.9.0
|
|
559
|
+
*/
|
|
560
|
+
interface SQLTagStore {
|
|
561
|
+
/**
|
|
562
|
+
* Executes the given SQL query and returns all resulting rows as an array of objects.
|
|
563
|
+
* @since v24.9.0
|
|
564
|
+
*/
|
|
565
|
+
all(
|
|
566
|
+
stringElements: TemplateStringsArray,
|
|
567
|
+
...boundParameters: SQLInputValue[]
|
|
568
|
+
): Record<string, SQLOutputValue>[];
|
|
569
|
+
/**
|
|
570
|
+
* Executes the given SQL query and returns the first resulting row as an object.
|
|
571
|
+
* @since v24.9.0
|
|
572
|
+
*/
|
|
573
|
+
get(
|
|
574
|
+
stringElements: TemplateStringsArray,
|
|
575
|
+
...boundParameters: SQLInputValue[]
|
|
576
|
+
): Record<string, SQLOutputValue> | undefined;
|
|
577
|
+
/**
|
|
578
|
+
* Executes the given SQL query and returns an iterator over the resulting rows.
|
|
579
|
+
* @since v24.9.0
|
|
580
|
+
*/
|
|
581
|
+
iterate(
|
|
582
|
+
stringElements: TemplateStringsArray,
|
|
583
|
+
...boundParameters: SQLInputValue[]
|
|
584
|
+
): NodeJS.Iterator<Record<string, SQLOutputValue>>;
|
|
585
|
+
/**
|
|
586
|
+
* Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
|
|
587
|
+
* @since v24.9.0
|
|
588
|
+
*/
|
|
589
|
+
run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges;
|
|
590
|
+
/**
|
|
591
|
+
* A read-only property that returns the number of prepared statements currently in the cache.
|
|
592
|
+
* @since v24.9.0
|
|
593
|
+
* @returns The maximum number of prepared statements the cache can hold.
|
|
594
|
+
*/
|
|
595
|
+
size(): number;
|
|
596
|
+
/**
|
|
597
|
+
* A read-only property that returns the maximum number of prepared statements the cache can hold.
|
|
598
|
+
* @since v24.9.0
|
|
599
|
+
*/
|
|
600
|
+
readonly capacity: number;
|
|
601
|
+
/**
|
|
602
|
+
* A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`.
|
|
603
|
+
* @since v24.9.0
|
|
604
|
+
*/
|
|
605
|
+
readonly db: DatabaseSync;
|
|
606
|
+
/**
|
|
607
|
+
* Resets the LRU cache, clearing all stored prepared statements.
|
|
608
|
+
* @since v24.9.0
|
|
609
|
+
*/
|
|
610
|
+
clear(): void;
|
|
611
|
+
}
|
|
421
612
|
interface StatementColumnMetadata {
|
|
422
613
|
/**
|
|
423
614
|
* The unaliased name of the column in the origin
|
|
@@ -583,6 +774,13 @@ declare module "node:sqlite" {
|
|
|
583
774
|
* @param enabled Enables or disables support for unknown named parameters.
|
|
584
775
|
*/
|
|
585
776
|
setAllowUnknownNamedParameters(enabled: boolean): void;
|
|
777
|
+
/**
|
|
778
|
+
* When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead
|
|
779
|
+
* of objects.
|
|
780
|
+
* @since v24.0.0
|
|
781
|
+
* @param enabled Enables or disables the return of query results as arrays.
|
|
782
|
+
*/
|
|
783
|
+
setReturnArrays(enabled: boolean): void;
|
|
586
784
|
/**
|
|
587
785
|
* When reading from the database, SQLite `INTEGER`s are mapped to JavaScript
|
|
588
786
|
* numbers by default. However, SQLite `INTEGER`s can store values larger than
|
|
@@ -620,8 +818,9 @@ declare module "node:sqlite" {
|
|
|
620
818
|
*/
|
|
621
819
|
rate?: number | undefined;
|
|
622
820
|
/**
|
|
623
|
-
*
|
|
624
|
-
*
|
|
821
|
+
* An optional callback function that will be called after each backup step. The argument passed
|
|
822
|
+
* to this callback is an `Object` with `remainingPages` and `totalPages` properties, describing the current progress
|
|
823
|
+
* of the backup operation.
|
|
625
824
|
*/
|
|
626
825
|
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
|
|
627
826
|
}
|
|
@@ -658,9 +857,10 @@ declare module "node:sqlite" {
|
|
|
658
857
|
* the contents will be overwritten.
|
|
659
858
|
* @param options Optional configuration for the backup. The
|
|
660
859
|
* following properties are supported:
|
|
661
|
-
* @returns A promise that
|
|
860
|
+
* @returns A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an
|
|
861
|
+
* error occurs.
|
|
662
862
|
*/
|
|
663
|
-
function backup(sourceDb: DatabaseSync, path:
|
|
863
|
+
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<number>;
|
|
664
864
|
/**
|
|
665
865
|
* @since v22.13.0
|
|
666
866
|
*/
|
|
@@ -700,5 +900,54 @@ declare module "node:sqlite" {
|
|
|
700
900
|
* @since v22.12.0
|
|
701
901
|
*/
|
|
702
902
|
const SQLITE_CHANGESET_ABORT: number;
|
|
903
|
+
/**
|
|
904
|
+
* Deny the operation and cause an error to be returned.
|
|
905
|
+
* @since v24.10.0
|
|
906
|
+
*/
|
|
907
|
+
const SQLITE_DENY: number;
|
|
908
|
+
/**
|
|
909
|
+
* Ignore the operation and continue as if it had never been requested.
|
|
910
|
+
* @since 24.10.0
|
|
911
|
+
*/
|
|
912
|
+
const SQLITE_IGNORE: number;
|
|
913
|
+
/**
|
|
914
|
+
* Allow the operation to proceed normally.
|
|
915
|
+
* @since v24.10.0
|
|
916
|
+
*/
|
|
917
|
+
const SQLITE_OK: number;
|
|
918
|
+
const SQLITE_CREATE_INDEX: number;
|
|
919
|
+
const SQLITE_CREATE_TABLE: number;
|
|
920
|
+
const SQLITE_CREATE_TEMP_INDEX: number;
|
|
921
|
+
const SQLITE_CREATE_TEMP_TABLE: number;
|
|
922
|
+
const SQLITE_CREATE_TEMP_TRIGGER: number;
|
|
923
|
+
const SQLITE_CREATE_TEMP_VIEW: number;
|
|
924
|
+
const SQLITE_CREATE_TRIGGER: number;
|
|
925
|
+
const SQLITE_CREATE_VIEW: number;
|
|
926
|
+
const SQLITE_DELETE: number;
|
|
927
|
+
const SQLITE_DROP_INDEX: number;
|
|
928
|
+
const SQLITE_DROP_TABLE: number;
|
|
929
|
+
const SQLITE_DROP_TEMP_INDEX: number;
|
|
930
|
+
const SQLITE_DROP_TEMP_TABLE: number;
|
|
931
|
+
const SQLITE_DROP_TEMP_TRIGGER: number;
|
|
932
|
+
const SQLITE_DROP_TEMP_VIEW: number;
|
|
933
|
+
const SQLITE_DROP_TRIGGER: number;
|
|
934
|
+
const SQLITE_DROP_VIEW: number;
|
|
935
|
+
const SQLITE_INSERT: number;
|
|
936
|
+
const SQLITE_PRAGMA: number;
|
|
937
|
+
const SQLITE_READ: number;
|
|
938
|
+
const SQLITE_SELECT: number;
|
|
939
|
+
const SQLITE_TRANSACTION: number;
|
|
940
|
+
const SQLITE_UPDATE: number;
|
|
941
|
+
const SQLITE_ATTACH: number;
|
|
942
|
+
const SQLITE_DETACH: number;
|
|
943
|
+
const SQLITE_ALTER_TABLE: number;
|
|
944
|
+
const SQLITE_REINDEX: number;
|
|
945
|
+
const SQLITE_ANALYZE: number;
|
|
946
|
+
const SQLITE_CREATE_VTABLE: number;
|
|
947
|
+
const SQLITE_DROP_VTABLE: number;
|
|
948
|
+
const SQLITE_FUNCTION: number;
|
|
949
|
+
const SQLITE_SAVEPOINT: number;
|
|
950
|
+
const SQLITE_COPY: number;
|
|
951
|
+
const SQLITE_RECURSIVE: number;
|
|
703
952
|
}
|
|
704
953
|
}
|
package/stream/consumers.d.ts
CHANGED
|
@@ -20,32 +20,32 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
declare module "node:stream/consumers" {
|
|
23
|
-
import { Blob
|
|
24
|
-
import { ReadableStream
|
|
23
|
+
import { Blob, NonSharedBuffer } from 'node:buffer';
|
|
24
|
+
import { ReadableStream } from 'node:stream/web';
|
|
25
25
|
/**
|
|
26
26
|
* @since v16.7.0
|
|
27
27
|
* @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream.
|
|
28
28
|
*/
|
|
29
|
-
function arrayBuffer(stream:
|
|
29
|
+
function arrayBuffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<ArrayBuffer>;
|
|
30
30
|
/**
|
|
31
31
|
* @since v16.7.0
|
|
32
32
|
* @returns Fulfills with a `Blob` containing the full contents of the stream.
|
|
33
33
|
*/
|
|
34
|
-
function blob(stream:
|
|
34
|
+
function blob(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<Blob>;
|
|
35
35
|
/**
|
|
36
36
|
* @since v16.7.0
|
|
37
37
|
* @returns Fulfills with a `Buffer` containing the full contents of the stream.
|
|
38
38
|
*/
|
|
39
|
-
function buffer(stream:
|
|
39
|
+
function buffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NonSharedBuffer>;
|
|
40
40
|
/**
|
|
41
41
|
* @since v16.7.0
|
|
42
42
|
* @returns Fulfills with the contents of the stream parsed as a
|
|
43
43
|
* UTF-8 encoded string that is then passed through `JSON.parse()`.
|
|
44
44
|
*/
|
|
45
|
-
function json(stream:
|
|
45
|
+
function json(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<unknown>;
|
|
46
46
|
/**
|
|
47
47
|
* @since v16.7.0
|
|
48
48
|
* @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string.
|
|
49
49
|
*/
|
|
50
|
-
function text(stream:
|
|
50
|
+
function text(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<string>;
|
|
51
51
|
}
|
package/stream/promises.d.ts
CHANGED
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
declare module "node:stream/promises" {
|
|
18
|
+
import { Abortable } from 'node:events';
|
|
18
19
|
import {
|
|
19
20
|
FinishedOptions as _FinishedOptions,
|
|
20
21
|
PipelineDestination,
|
|
21
|
-
PipelineOptions,
|
|
22
|
-
PipelinePromise,
|
|
23
22
|
PipelineSource,
|
|
24
23
|
PipelineTransform,
|
|
25
24
|
} from 'node:stream';
|
|
25
|
+
import { ReadableStream, WritableStream } from 'node:stream/web';
|
|
26
26
|
interface FinishedOptions extends _FinishedOptions {
|
|
27
27
|
/**
|
|
28
28
|
* If true, removes the listeners registered by this function before the promise is fulfilled.
|
|
@@ -30,15 +30,130 @@ declare module "node:stream/promises" {
|
|
|
30
30
|
*/
|
|
31
31
|
cleanup?: boolean | undefined;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* ```js
|
|
35
|
+
* import { finished } from 'node:stream/promises';
|
|
36
|
+
* import { createReadStream } from 'node:fs';
|
|
37
|
+
*
|
|
38
|
+
* const rs = createReadStream('archive.tar');
|
|
39
|
+
*
|
|
40
|
+
* async function run() {
|
|
41
|
+
* await finished(rs);
|
|
42
|
+
* console.log('Stream is done reading.');
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* run().catch(console.error);
|
|
46
|
+
* rs.resume(); // Drain the stream.
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* The `finished` API also provides a [callback version](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamfinishedstream-options-callback).
|
|
50
|
+
*
|
|
51
|
+
* `stream.finished()` leaves dangling event listeners (in particular
|
|
52
|
+
* `'error'`, `'end'`, `'finish'` and `'close'`) after the returned promise is
|
|
53
|
+
* resolved or rejected. The reason for this is so that unexpected `'error'`
|
|
54
|
+
* events (due to incorrect stream implementations) do not cause unexpected
|
|
55
|
+
* crashes. If this is unwanted behavior then `options.cleanup` should be set to
|
|
56
|
+
* `true`:
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* await finished(rs, { cleanup: true });
|
|
60
|
+
* ```
|
|
61
|
+
* @since v15.0.0
|
|
62
|
+
* @returns Fulfills when the stream is no longer readable or writable.
|
|
63
|
+
*/
|
|
33
64
|
function finished(
|
|
34
|
-
stream: NodeJS.ReadableStream | NodeJS.WritableStream |
|
|
65
|
+
stream: NodeJS.ReadableStream | NodeJS.WritableStream | ReadableStream | WritableStream,
|
|
35
66
|
options?: FinishedOptions,
|
|
36
67
|
): Promise<void>;
|
|
68
|
+
interface PipelineOptions extends Abortable {
|
|
69
|
+
end?: boolean | undefined;
|
|
70
|
+
}
|
|
71
|
+
type PipelineResult<S extends PipelineDestination<any, any>> = S extends (...args: any[]) => PromiseLike<infer R>
|
|
72
|
+
? Promise<R>
|
|
73
|
+
: Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* ```js
|
|
76
|
+
* import { pipeline } from 'node:stream/promises';
|
|
77
|
+
* import { createReadStream, createWriteStream } from 'node:fs';
|
|
78
|
+
* import { createGzip } from 'node:zlib';
|
|
79
|
+
*
|
|
80
|
+
* await pipeline(
|
|
81
|
+
* createReadStream('archive.tar'),
|
|
82
|
+
* createGzip(),
|
|
83
|
+
* createWriteStream('archive.tar.gz'),
|
|
84
|
+
* );
|
|
85
|
+
* console.log('Pipeline succeeded.');
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* To use an `AbortSignal`, pass it inside an options object, as the last argument.
|
|
89
|
+
* When the signal is aborted, `destroy` will be called on the underlying pipeline,
|
|
90
|
+
* with an `AbortError`.
|
|
91
|
+
*
|
|
92
|
+
* ```js
|
|
93
|
+
* import { pipeline } from 'node:stream/promises';
|
|
94
|
+
* import { createReadStream, createWriteStream } from 'node:fs';
|
|
95
|
+
* import { createGzip } from 'node:zlib';
|
|
96
|
+
*
|
|
97
|
+
* const ac = new AbortController();
|
|
98
|
+
* const { signal } = ac;
|
|
99
|
+
* setImmediate(() => ac.abort());
|
|
100
|
+
* try {
|
|
101
|
+
* await pipeline(
|
|
102
|
+
* createReadStream('archive.tar'),
|
|
103
|
+
* createGzip(),
|
|
104
|
+
* createWriteStream('archive.tar.gz'),
|
|
105
|
+
* { signal },
|
|
106
|
+
* );
|
|
107
|
+
* } catch (err) {
|
|
108
|
+
* console.error(err); // AbortError
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* The `pipeline` API also supports async generators:
|
|
113
|
+
*
|
|
114
|
+
* ```js
|
|
115
|
+
* import { pipeline } from 'node:stream/promises';
|
|
116
|
+
* import { createReadStream, createWriteStream } from 'node:fs';
|
|
117
|
+
*
|
|
118
|
+
* await pipeline(
|
|
119
|
+
* createReadStream('lowercase.txt'),
|
|
120
|
+
* async function* (source, { signal }) {
|
|
121
|
+
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
|
|
122
|
+
* for await (const chunk of source) {
|
|
123
|
+
* yield await processChunk(chunk, { signal });
|
|
124
|
+
* }
|
|
125
|
+
* },
|
|
126
|
+
* createWriteStream('uppercase.txt'),
|
|
127
|
+
* );
|
|
128
|
+
* console.log('Pipeline succeeded.');
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* Remember to handle the `signal` argument passed into the async generator.
|
|
132
|
+
* Especially in the case where the async generator is the source for the
|
|
133
|
+
* pipeline (i.e. first argument) or the pipeline will never complete.
|
|
134
|
+
*
|
|
135
|
+
* ```js
|
|
136
|
+
* import { pipeline } from 'node:stream/promises';
|
|
137
|
+
* import fs from 'node:fs';
|
|
138
|
+
* await pipeline(
|
|
139
|
+
* async function* ({ signal }) {
|
|
140
|
+
* await someLongRunningfn({ signal });
|
|
141
|
+
* yield 'asd';
|
|
142
|
+
* },
|
|
143
|
+
* fs.createWriteStream('uppercase.txt'),
|
|
144
|
+
* );
|
|
145
|
+
* console.log('Pipeline succeeded.');
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* The `pipeline` API provides [callback version](https://nodejs.org/docs/latest-v25.x/api/stream.html#streampipelinesource-transforms-destination-callback):
|
|
149
|
+
* @since v15.0.0
|
|
150
|
+
* @returns Fulfills when the pipeline is complete.
|
|
151
|
+
*/
|
|
37
152
|
function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
|
|
38
153
|
source: A,
|
|
39
154
|
destination: B,
|
|
40
155
|
options?: PipelineOptions,
|
|
41
|
-
):
|
|
156
|
+
): PipelineResult<B>;
|
|
42
157
|
function pipeline<
|
|
43
158
|
A extends PipelineSource<any>,
|
|
44
159
|
T1 extends PipelineTransform<A, any>,
|
|
@@ -48,7 +163,7 @@ declare module "node:stream/promises" {
|
|
|
48
163
|
transform1: T1,
|
|
49
164
|
destination: B,
|
|
50
165
|
options?: PipelineOptions,
|
|
51
|
-
):
|
|
166
|
+
): PipelineResult<B>;
|
|
52
167
|
function pipeline<
|
|
53
168
|
A extends PipelineSource<any>,
|
|
54
169
|
T1 extends PipelineTransform<A, any>,
|
|
@@ -60,7 +175,7 @@ declare module "node:stream/promises" {
|
|
|
60
175
|
transform2: T2,
|
|
61
176
|
destination: B,
|
|
62
177
|
options?: PipelineOptions,
|
|
63
|
-
):
|
|
178
|
+
): PipelineResult<B>;
|
|
64
179
|
function pipeline<
|
|
65
180
|
A extends PipelineSource<any>,
|
|
66
181
|
T1 extends PipelineTransform<A, any>,
|
|
@@ -74,7 +189,7 @@ declare module "node:stream/promises" {
|
|
|
74
189
|
transform3: T3,
|
|
75
190
|
destination: B,
|
|
76
191
|
options?: PipelineOptions,
|
|
77
|
-
):
|
|
192
|
+
): PipelineResult<B>;
|
|
78
193
|
function pipeline<
|
|
79
194
|
A extends PipelineSource<any>,
|
|
80
195
|
T1 extends PipelineTransform<A, any>,
|
|
@@ -90,14 +205,20 @@ declare module "node:stream/promises" {
|
|
|
90
205
|
transform4: T4,
|
|
91
206
|
destination: B,
|
|
92
207
|
options?: PipelineOptions,
|
|
93
|
-
):
|
|
208
|
+
): PipelineResult<B>;
|
|
94
209
|
function pipeline(
|
|
95
|
-
streams:
|
|
210
|
+
streams: readonly [PipelineSource<any>, ...PipelineTransform<any, any>[], PipelineDestination<any, any>],
|
|
96
211
|
options?: PipelineOptions,
|
|
97
212
|
): Promise<void>;
|
|
98
213
|
function pipeline(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
214
|
+
...streams: [PipelineSource<any>, ...PipelineTransform<any, any>[], PipelineDestination<any, any>]
|
|
215
|
+
): Promise<void>;
|
|
216
|
+
function pipeline(
|
|
217
|
+
...streams: [
|
|
218
|
+
PipelineSource<any>,
|
|
219
|
+
...PipelineTransform<any, any>[],
|
|
220
|
+
PipelineDestination<any, any>,
|
|
221
|
+
options: PipelineOptions,
|
|
222
|
+
]
|
|
102
223
|
): Promise<void>;
|
|
103
224
|
}
|