omegon 0.8.4 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/cleave/dispatcher.ts +213 -20
- package/extensions/cleave/rpc-child.ts +269 -0
- package/extensions/cleave/types.ts +52 -0
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +11 -5
- package/node_modules/@types/node/assert.d.ts +173 -50
- package/node_modules/@types/node/async_hooks.d.ts +8 -28
- package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/buffer.d.ts +168 -44
- package/node_modules/@types/node/child_process.d.ts +70 -27
- package/node_modules/@types/node/cluster.d.ts +332 -240
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
- package/node_modules/@types/node/console.d.ts +350 -49
- package/node_modules/@types/node/constants.d.ts +4 -3
- package/node_modules/@types/node/crypto.d.ts +1110 -630
- package/node_modules/@types/node/dgram.d.ts +51 -15
- package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
- package/node_modules/@types/node/dns/promises.d.ts +4 -4
- package/node_modules/@types/node/dns.d.ts +133 -132
- package/node_modules/@types/node/domain.d.ts +17 -13
- package/node_modules/@types/node/events.d.ts +663 -734
- package/node_modules/@types/node/fs/promises.d.ts +9 -43
- package/node_modules/@types/node/fs.d.ts +411 -628
- package/node_modules/@types/node/globals.d.ts +30 -8
- package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
- package/node_modules/@types/node/http.d.ts +265 -364
- package/node_modules/@types/node/http2.d.ts +715 -551
- package/node_modules/@types/node/https.d.ts +239 -65
- package/node_modules/@types/node/index.d.ts +6 -24
- package/node_modules/@types/node/inspector.d.ts +53 -69
- package/node_modules/@types/node/inspector.generated.d.ts +410 -759
- package/node_modules/@types/node/module.d.ts +186 -52
- package/node_modules/@types/node/net.d.ts +194 -70
- package/node_modules/@types/node/os.d.ts +11 -12
- package/node_modules/@types/node/package.json +3 -13
- package/node_modules/@types/node/path.d.ts +133 -120
- package/node_modules/@types/node/perf_hooks.d.ts +643 -318
- package/node_modules/@types/node/process.d.ts +132 -223
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +4 -4
- package/node_modules/@types/node/readline/promises.d.ts +3 -3
- package/node_modules/@types/node/readline.d.ts +120 -68
- package/node_modules/@types/node/repl.d.ts +100 -87
- package/node_modules/@types/node/sea.d.ts +1 -10
- package/node_modules/@types/node/sqlite.d.ts +19 -363
- package/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/stream/promises.d.ts +15 -136
- package/node_modules/@types/node/stream/web.d.ts +502 -176
- package/node_modules/@types/node/stream.d.ts +475 -581
- package/node_modules/@types/node/string_decoder.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +196 -308
- package/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/timers.d.ts +132 -4
- package/node_modules/@types/node/tls.d.ts +226 -110
- package/node_modules/@types/node/trace_events.d.ts +9 -9
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
- package/node_modules/@types/node/tty.d.ts +16 -58
- package/node_modules/@types/node/url.d.ts +573 -130
- package/node_modules/@types/node/util.d.ts +1100 -181
- package/node_modules/@types/node/v8.d.ts +8 -76
- package/node_modules/@types/node/vm.d.ts +72 -280
- package/node_modules/@types/node/wasi.d.ts +4 -25
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
- package/node_modules/@types/node/web-globals/events.d.ts +0 -9
- package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
- package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
- package/node_modules/@types/node/worker_threads.d.ts +335 -268
- package/node_modules/@types/node/zlib.d.ts +74 -9
- package/node_modules/undici-types/agent.d.ts +12 -13
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +12 -13
- package/node_modules/undici-types/client.d.ts +19 -19
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
- package/node_modules/undici-types/dispatcher.d.ts +103 -123
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici-types/errors.d.ts +54 -66
- package/node_modules/undici-types/eventsource.d.ts +4 -9
- package/node_modules/undici-types/fetch.d.ts +20 -22
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +7 -7
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/handlers.d.ts +8 -8
- package/node_modules/undici-types/header.d.ts +1 -157
- package/node_modules/undici-types/index.d.ts +47 -64
- package/node_modules/undici-types/interceptors.d.ts +8 -64
- package/node_modules/undici-types/mock-agent.d.ts +18 -36
- package/node_modules/undici-types/mock-client.d.ts +4 -6
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
- package/node_modules/undici-types/mock-pool.d.ts +4 -6
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +4 -0
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +13 -15
- package/node_modules/undici-types/proxy-agent.d.ts +4 -5
- package/node_modules/undici-types/readable.d.ts +16 -19
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +10 -19
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/webidl.d.ts +29 -142
- package/node_modules/undici-types/websocket.d.ts +10 -46
- package/package.json +2 -1
- package/scripts/check-vendor-dist.mjs +56 -0
- package/skills/cleave/SKILL.md +62 -2
- package/node_modules/@types/node/inspector/promises.d.ts +0 -41
- package/node_modules/@types/node/path/posix.d.ts +0 -8
- package/node_modules/@types/node/path/win32.d.ts +0 -8
- package/node_modules/@types/node/quic.d.ts +0 -910
- package/node_modules/@types/node/test/reporters.d.ts +0 -96
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
- package/node_modules/@types/node/util/types.d.ts +0 -558
- package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
- package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
- package/node_modules/undici-types/client-stats.d.ts +0 -15
- package/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
- package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
- package/node_modules/undici-types/utility.d.ts +0 -7
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* ```
|
|
41
41
|
* @since v22.5.0
|
|
42
42
|
* @experimental
|
|
43
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
43
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/sqlite.js)
|
|
44
44
|
*/
|
|
45
45
|
declare module "node:sqlite" {
|
|
46
46
|
import { PathLike } from "node:fs";
|
|
@@ -92,45 +92,37 @@ declare module "node:sqlite" {
|
|
|
92
92
|
* The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of
|
|
93
93
|
* time that SQLite will wait for a database lock to be released before
|
|
94
94
|
* returning an error.
|
|
95
|
-
* @since
|
|
95
|
+
* @since v22.16.0
|
|
96
96
|
* @default 0
|
|
97
97
|
*/
|
|
98
98
|
timeout?: number | undefined;
|
|
99
99
|
/**
|
|
100
100
|
* If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
|
|
101
101
|
* integer fields are read as JavaScript numbers.
|
|
102
|
-
* @since
|
|
102
|
+
* @since v22.18.0
|
|
103
103
|
* @default false
|
|
104
104
|
*/
|
|
105
105
|
readBigInts?: boolean | undefined;
|
|
106
106
|
/**
|
|
107
107
|
* If `true`, query results are returned as arrays instead of objects.
|
|
108
|
-
* @since
|
|
108
|
+
* @since v22.18.0
|
|
109
109
|
* @default false
|
|
110
110
|
*/
|
|
111
111
|
returnArrays?: boolean | undefined;
|
|
112
112
|
/**
|
|
113
113
|
* If `true`, allows binding named parameters without the prefix
|
|
114
114
|
* character (e.g., `foo` instead of `:foo`).
|
|
115
|
-
* @since
|
|
115
|
+
* @since v22.18.0
|
|
116
116
|
* @default true
|
|
117
117
|
*/
|
|
118
118
|
allowBareNamedParameters?: boolean | undefined;
|
|
119
119
|
/**
|
|
120
120
|
* If `true`, unknown named parameters are ignored when binding.
|
|
121
121
|
* If `false`, an exception is thrown for unknown named parameters.
|
|
122
|
-
* @since
|
|
122
|
+
* @since v22.18.0
|
|
123
123
|
* @default false
|
|
124
124
|
*/
|
|
125
125
|
allowUnknownNamedParameters?: boolean | undefined;
|
|
126
|
-
/**
|
|
127
|
-
* If `true`, enables the defensive flag. When the defensive flag is enabled,
|
|
128
|
-
* language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
|
|
129
|
-
* The defensive flag can also be set using `enableDefensive()`.
|
|
130
|
-
* @since v25.1.0
|
|
131
|
-
* @default true
|
|
132
|
-
*/
|
|
133
|
-
defensive?: boolean | undefined;
|
|
134
126
|
}
|
|
135
127
|
interface CreateSessionOptions {
|
|
136
128
|
/**
|
|
@@ -233,28 +225,6 @@ declare module "node:sqlite" {
|
|
|
233
225
|
*/
|
|
234
226
|
inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined;
|
|
235
227
|
}
|
|
236
|
-
interface PrepareOptions {
|
|
237
|
-
/**
|
|
238
|
-
* If `true`, integer fields are read as `BigInt`s.
|
|
239
|
-
* @since v25.5.0
|
|
240
|
-
*/
|
|
241
|
-
readBigInts?: boolean | undefined;
|
|
242
|
-
/**
|
|
243
|
-
* If `true`, results are returned as arrays.
|
|
244
|
-
* @since v25.5.0
|
|
245
|
-
*/
|
|
246
|
-
returnArrays?: boolean | undefined;
|
|
247
|
-
/**
|
|
248
|
-
* If `true`, allows binding named parameters without the prefix character.
|
|
249
|
-
* @since v25.5.0
|
|
250
|
-
*/
|
|
251
|
-
allowBareNamedParameters?: boolean | undefined;
|
|
252
|
-
/**
|
|
253
|
-
* If `true`, unknown named parameters are ignored.
|
|
254
|
-
* @since v25.5.0
|
|
255
|
-
*/
|
|
256
|
-
allowUnknownNamedParameters?: boolean | undefined;
|
|
257
|
-
}
|
|
258
228
|
/**
|
|
259
229
|
* This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
|
|
260
230
|
* exposed by this class execute synchronously.
|
|
@@ -296,7 +266,7 @@ declare module "node:sqlite" {
|
|
|
296
266
|
*
|
|
297
267
|
* db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 }
|
|
298
268
|
* ```
|
|
299
|
-
* @since
|
|
269
|
+
* @since v22.16.0
|
|
300
270
|
* @param name The name of the SQLite function to create.
|
|
301
271
|
* @param options Function configuration settings.
|
|
302
272
|
*/
|
|
@@ -324,17 +294,9 @@ declare module "node:sqlite" {
|
|
|
324
294
|
* @param allow Whether to allow loading extensions.
|
|
325
295
|
*/
|
|
326
296
|
enableLoadExtension(allow: boolean): void;
|
|
327
|
-
/**
|
|
328
|
-
* Enables or disables the defensive flag. When the defensive flag is active,
|
|
329
|
-
* language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
|
|
330
|
-
* See [`SQLITE_DBCONFIG_DEFENSIVE`](https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive) in the SQLite documentation for details.
|
|
331
|
-
* @since v25.1.0
|
|
332
|
-
* @param active Whether to set the defensive flag.
|
|
333
|
-
*/
|
|
334
|
-
enableDefensive(active: boolean): void;
|
|
335
297
|
/**
|
|
336
298
|
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
|
|
337
|
-
* @since
|
|
299
|
+
* @since v22.16.0
|
|
338
300
|
* @param dbName Name of the database. This can be `'main'` (the default primary database) or any other
|
|
339
301
|
* database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`.
|
|
340
302
|
* @returns The location of the database file. When using an in-memory database,
|
|
@@ -358,7 +320,7 @@ declare module "node:sqlite" {
|
|
|
358
320
|
* @param func The JavaScript function to call when the SQLite
|
|
359
321
|
* function is invoked. The return value of this function should be a valid
|
|
360
322
|
* SQLite data type: see
|
|
361
|
-
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-
|
|
323
|
+
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v22.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite).
|
|
362
324
|
* The result defaults to `NULL` if the return value is `undefined`.
|
|
363
325
|
*/
|
|
364
326
|
function(
|
|
@@ -367,64 +329,6 @@ declare module "node:sqlite" {
|
|
|
367
329
|
func: (...args: SQLOutputValue[]) => SQLInputValue,
|
|
368
330
|
): void;
|
|
369
331
|
function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void;
|
|
370
|
-
/**
|
|
371
|
-
* Sets an authorizer callback that SQLite will invoke whenever it attempts to
|
|
372
|
-
* access data or modify the database schema through prepared statements.
|
|
373
|
-
* This can be used to implement security policies, audit access, or restrict certain operations.
|
|
374
|
-
* This method is a wrapper around [`sqlite3_set_authorizer()`](https://sqlite.org/c3ref/set_authorizer.html).
|
|
375
|
-
*
|
|
376
|
-
* When invoked, the callback receives five arguments:
|
|
377
|
-
*
|
|
378
|
-
* * `actionCode` {number} The type of operation being performed (e.g.,
|
|
379
|
-
* `SQLITE_INSERT`, `SQLITE_UPDATE`, `SQLITE_SELECT`).
|
|
380
|
-
* * `arg1` {string|null} The first argument (context-dependent, often a table name).
|
|
381
|
-
* * `arg2` {string|null} The second argument (context-dependent, often a column name).
|
|
382
|
-
* * `dbName` {string|null} The name of the database.
|
|
383
|
-
* * `triggerOrView` {string|null} The name of the trigger or view causing the access.
|
|
384
|
-
*
|
|
385
|
-
* The callback must return one of the following constants:
|
|
386
|
-
*
|
|
387
|
-
* * `SQLITE_OK` - Allow the operation.
|
|
388
|
-
* * `SQLITE_DENY` - Deny the operation (causes an error).
|
|
389
|
-
* * `SQLITE_IGNORE` - Ignore the operation (silently skip).
|
|
390
|
-
*
|
|
391
|
-
* ```js
|
|
392
|
-
* import { DatabaseSync, constants } from 'node:sqlite';
|
|
393
|
-
* const db = new DatabaseSync(':memory:');
|
|
394
|
-
*
|
|
395
|
-
* // Set up an authorizer that denies all table creation
|
|
396
|
-
* db.setAuthorizer((actionCode) => {
|
|
397
|
-
* if (actionCode === constants.SQLITE_CREATE_TABLE) {
|
|
398
|
-
* return constants.SQLITE_DENY;
|
|
399
|
-
* }
|
|
400
|
-
* return constants.SQLITE_OK;
|
|
401
|
-
* });
|
|
402
|
-
*
|
|
403
|
-
* // This will work
|
|
404
|
-
* db.prepare('SELECT 1').get();
|
|
405
|
-
*
|
|
406
|
-
* // This will throw an error due to authorization denial
|
|
407
|
-
* try {
|
|
408
|
-
* db.exec('CREATE TABLE blocked (id INTEGER)');
|
|
409
|
-
* } catch (err) {
|
|
410
|
-
* console.log('Operation blocked:', err.message);
|
|
411
|
-
* }
|
|
412
|
-
* ```
|
|
413
|
-
* @since v24.10.0
|
|
414
|
-
* @param callback The authorizer function to set, or `null` to
|
|
415
|
-
* clear the current authorizer.
|
|
416
|
-
*/
|
|
417
|
-
setAuthorizer(
|
|
418
|
-
callback:
|
|
419
|
-
| ((
|
|
420
|
-
actionCode: number,
|
|
421
|
-
arg1: string | null,
|
|
422
|
-
arg2: string | null,
|
|
423
|
-
dbName: string | null,
|
|
424
|
-
triggerOrView: string | null,
|
|
425
|
-
) => number)
|
|
426
|
-
| null,
|
|
427
|
-
): void;
|
|
428
332
|
/**
|
|
429
333
|
* Whether the database is currently open or not.
|
|
430
334
|
* @since v22.15.0
|
|
@@ -433,7 +337,7 @@ declare module "node:sqlite" {
|
|
|
433
337
|
/**
|
|
434
338
|
* Whether the database is currently within a transaction. This method
|
|
435
339
|
* is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).
|
|
436
|
-
* @since
|
|
340
|
+
* @since v22.16.0
|
|
437
341
|
*/
|
|
438
342
|
readonly isTransaction: boolean;
|
|
439
343
|
/**
|
|
@@ -447,104 +351,9 @@ declare module "node:sqlite" {
|
|
|
447
351
|
* around [`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html).
|
|
448
352
|
* @since v22.5.0
|
|
449
353
|
* @param sql A SQL string to compile to a prepared statement.
|
|
450
|
-
* @param options Optional configuration for the prepared statement.
|
|
451
354
|
* @return The prepared statement.
|
|
452
355
|
*/
|
|
453
|
-
prepare(sql: string
|
|
454
|
-
/**
|
|
455
|
-
* Creates a new {@link SQLTagStore}, which is a Least Recently Used (LRU) cache
|
|
456
|
-
* for storing prepared statements. This allows for the efficient reuse of
|
|
457
|
-
* prepared statements by tagging them with a unique identifier.
|
|
458
|
-
*
|
|
459
|
-
* When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared
|
|
460
|
-
* statement for the corresponding SQL query string already exists in the cache.
|
|
461
|
-
* If it does, the cached statement is used. If not, a new prepared statement is
|
|
462
|
-
* created, executed, and then stored in the cache for future use. This mechanism
|
|
463
|
-
* helps to avoid the overhead of repeatedly parsing and preparing the same SQL
|
|
464
|
-
* statements.
|
|
465
|
-
*
|
|
466
|
-
* Tagged statements bind the placeholder values from the template literal as
|
|
467
|
-
* parameters to the underlying prepared statement. For example:
|
|
468
|
-
*
|
|
469
|
-
* ```js
|
|
470
|
-
* sqlTagStore.get`SELECT ${value}`;
|
|
471
|
-
* ```
|
|
472
|
-
*
|
|
473
|
-
* is equivalent to:
|
|
474
|
-
*
|
|
475
|
-
* ```js
|
|
476
|
-
* db.prepare('SELECT ?').get(value);
|
|
477
|
-
* ```
|
|
478
|
-
*
|
|
479
|
-
* However, in the first example, the tag store will cache the underlying prepared
|
|
480
|
-
* statement for future use.
|
|
481
|
-
*
|
|
482
|
-
* > **Note:** The `${value}` syntax in tagged statements _binds_ a parameter to
|
|
483
|
-
* > the prepared statement. This differs from its behavior in _untagged_ template
|
|
484
|
-
* > literals, where it performs string interpolation.
|
|
485
|
-
* >
|
|
486
|
-
* > ```js
|
|
487
|
-
* > // This a safe example of binding a parameter to a tagged statement.
|
|
488
|
-
* > sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`;
|
|
489
|
-
* >
|
|
490
|
-
* > // This is an *unsafe* example of an untagged template string.
|
|
491
|
-
* > // `id` is interpolated into the query text as a string.
|
|
492
|
-
* > // This can lead to SQL injection and data corruption.
|
|
493
|
-
* > db.run(`INSERT INTO t1 (id) VALUES (${id})`);
|
|
494
|
-
* > ```
|
|
495
|
-
*
|
|
496
|
-
* The tag store will match a statement from the cache if the query strings
|
|
497
|
-
* (including the positions of any bound placeholders) are identical.
|
|
498
|
-
*
|
|
499
|
-
* ```js
|
|
500
|
-
* // The following statements will match in the cache:
|
|
501
|
-
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
|
|
502
|
-
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${12345} AND active = 1`;
|
|
503
|
-
*
|
|
504
|
-
* // The following statements will not match, as the query strings
|
|
505
|
-
* // and bound placeholders differ:
|
|
506
|
-
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
|
|
507
|
-
* sqlTagStore.get`SELECT * FROM t1 WHERE id = 12345 AND active = 1`;
|
|
508
|
-
*
|
|
509
|
-
* // The following statements will not match, as matches are case-sensitive:
|
|
510
|
-
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
|
|
511
|
-
* sqlTagStore.get`select * from t1 where id = ${id} and active = 1`;
|
|
512
|
-
* ```
|
|
513
|
-
*
|
|
514
|
-
* The only way of binding parameters in tagged statements is with the `${value}`
|
|
515
|
-
* syntax. Do not add parameter binding placeholders (`?` etc.) to the SQL query
|
|
516
|
-
* string itself.
|
|
517
|
-
*
|
|
518
|
-
* ```js
|
|
519
|
-
* import { DatabaseSync } from 'node:sqlite';
|
|
520
|
-
*
|
|
521
|
-
* const db = new DatabaseSync(':memory:');
|
|
522
|
-
* const sql = db.createSQLTagStore();
|
|
523
|
-
*
|
|
524
|
-
* db.exec('CREATE TABLE users (id INT, name TEXT)');
|
|
525
|
-
*
|
|
526
|
-
* // Using the 'run' method to insert data.
|
|
527
|
-
* // The tagged literal is used to identify the prepared statement.
|
|
528
|
-
* sql.run`INSERT INTO users VALUES (1, 'Alice')`;
|
|
529
|
-
* sql.run`INSERT INTO users VALUES (2, 'Bob')`;
|
|
530
|
-
*
|
|
531
|
-
* // Using the 'get' method to retrieve a single row.
|
|
532
|
-
* const name = 'Alice';
|
|
533
|
-
* const user = sql.get`SELECT * FROM users WHERE name = ${name}`;
|
|
534
|
-
* console.log(user); // { id: 1, name: 'Alice' }
|
|
535
|
-
*
|
|
536
|
-
* // Using the 'all' method to retrieve all rows.
|
|
537
|
-
* const allUsers = sql.all`SELECT * FROM users ORDER BY id`;
|
|
538
|
-
* console.log(allUsers);
|
|
539
|
-
* // [
|
|
540
|
-
* // { id: 1, name: 'Alice' },
|
|
541
|
-
* // { id: 2, name: 'Bob' }
|
|
542
|
-
* // ]
|
|
543
|
-
* ```
|
|
544
|
-
* @since v24.9.0
|
|
545
|
-
* @returns A new SQL tag store for caching prepared statements.
|
|
546
|
-
*/
|
|
547
|
-
createTagStore(maxSize?: number): SQLTagStore;
|
|
356
|
+
prepare(sql: string): StatementSync;
|
|
548
357
|
/**
|
|
549
358
|
* Creates and attaches a session to the database. This method is a wrapper around
|
|
550
359
|
* [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and
|
|
@@ -560,8 +369,6 @@ declare module "node:sqlite" {
|
|
|
560
369
|
* [`sqlite3changeset_apply()`](https://www.sqlite.org/session/sqlite3changeset_apply.html).
|
|
561
370
|
*
|
|
562
371
|
* ```js
|
|
563
|
-
* import { DatabaseSync } from 'node:sqlite';
|
|
564
|
-
*
|
|
565
372
|
* const sourceDb = new DatabaseSync(':memory:');
|
|
566
373
|
* const targetDb = new DatabaseSync(':memory:');
|
|
567
374
|
*
|
|
@@ -588,6 +395,7 @@ declare module "node:sqlite" {
|
|
|
588
395
|
* Closes the database connection. If the database connection is already closed
|
|
589
396
|
* then this is a no-op.
|
|
590
397
|
* @since v22.15.0
|
|
398
|
+
* @experimental
|
|
591
399
|
*/
|
|
592
400
|
[Symbol.dispose](): void;
|
|
593
401
|
}
|
|
@@ -619,107 +427,6 @@ declare module "node:sqlite" {
|
|
|
619
427
|
* [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html).
|
|
620
428
|
*/
|
|
621
429
|
close(): void;
|
|
622
|
-
/**
|
|
623
|
-
* Closes the session. If the session is already closed, does nothing.
|
|
624
|
-
* @since v24.9.0
|
|
625
|
-
*/
|
|
626
|
-
[Symbol.dispose](): void;
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* This class represents a single LRU (Least Recently Used) cache for storing
|
|
630
|
-
* prepared statements.
|
|
631
|
-
*
|
|
632
|
-
* Instances of this class are created via the `database.createTagStore()`
|
|
633
|
-
* method, not by using a constructor. The store caches prepared statements based
|
|
634
|
-
* on the provided SQL query string. When the same query is seen again, the store
|
|
635
|
-
* retrieves the cached statement and safely applies the new values through
|
|
636
|
-
* parameter binding, thereby preventing attacks like SQL injection.
|
|
637
|
-
*
|
|
638
|
-
* The cache has a maxSize that defaults to 1000 statements, but a custom size can
|
|
639
|
-
* be provided (e.g., `database.createTagStore(100)`). All APIs exposed by this
|
|
640
|
-
* class execute synchronously.
|
|
641
|
-
* @since v24.9.0
|
|
642
|
-
*/
|
|
643
|
-
interface SQLTagStore {
|
|
644
|
-
/**
|
|
645
|
-
* Executes the given SQL query and returns all resulting rows as an array of
|
|
646
|
-
* objects.
|
|
647
|
-
*
|
|
648
|
-
* This function is intended to be used as a template literal tag, not to be
|
|
649
|
-
* called directly.
|
|
650
|
-
* @since v24.9.0
|
|
651
|
-
* @param stringElements Template literal elements containing the SQL
|
|
652
|
-
* query.
|
|
653
|
-
* @param boundParameters Parameter values to be bound to placeholders in the template string.
|
|
654
|
-
* @returns An array of objects representing the rows returned by the query.
|
|
655
|
-
*/
|
|
656
|
-
all(
|
|
657
|
-
stringElements: TemplateStringsArray,
|
|
658
|
-
...boundParameters: SQLInputValue[]
|
|
659
|
-
): Record<string, SQLOutputValue>[];
|
|
660
|
-
/**
|
|
661
|
-
* Executes the given SQL query and returns the first resulting row as an object.
|
|
662
|
-
*
|
|
663
|
-
* This function is intended to be used as a template literal tag, not to be
|
|
664
|
-
* called directly.
|
|
665
|
-
* @since v24.9.0
|
|
666
|
-
* @param stringElements Template literal elements containing the SQL
|
|
667
|
-
* query.
|
|
668
|
-
* @param boundParameters Parameter values to be bound to placeholders in the template string.
|
|
669
|
-
* @returns An object representing the first row returned by
|
|
670
|
-
* the query, or `undefined` if no rows are returned.
|
|
671
|
-
*/
|
|
672
|
-
get(
|
|
673
|
-
stringElements: TemplateStringsArray,
|
|
674
|
-
...boundParameters: SQLInputValue[]
|
|
675
|
-
): Record<string, SQLOutputValue> | undefined;
|
|
676
|
-
/**
|
|
677
|
-
* Executes the given SQL query and returns an iterator over the resulting rows.
|
|
678
|
-
*
|
|
679
|
-
* This function is intended to be used as a template literal tag, not to be
|
|
680
|
-
* called directly.
|
|
681
|
-
* @since v24.9.0
|
|
682
|
-
* @param stringElements Template literal elements containing the SQL
|
|
683
|
-
* query.
|
|
684
|
-
* @param boundParameters Parameter values to be bound to placeholders in the template string.
|
|
685
|
-
* @returns An iterator that yields objects representing the rows returned by the query.
|
|
686
|
-
*/
|
|
687
|
-
iterate(
|
|
688
|
-
stringElements: TemplateStringsArray,
|
|
689
|
-
...boundParameters: SQLInputValue[]
|
|
690
|
-
): NodeJS.Iterator<Record<string, SQLOutputValue>>;
|
|
691
|
-
/**
|
|
692
|
-
* Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
|
|
693
|
-
*
|
|
694
|
-
* This function is intended to be used as a template literal tag, not to be
|
|
695
|
-
* called directly.
|
|
696
|
-
* @since v24.9.0
|
|
697
|
-
* @param stringElements Template literal elements containing the SQL
|
|
698
|
-
* query.
|
|
699
|
-
* @param boundParameters Parameter values to be bound to placeholders in the template string.
|
|
700
|
-
* @returns An object containing information about the execution, including `changes` and `lastInsertRowid`.
|
|
701
|
-
*/
|
|
702
|
-
run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges;
|
|
703
|
-
/**
|
|
704
|
-
* A read-only property that returns the number of prepared statements currently in the cache.
|
|
705
|
-
* @since v24.9.0
|
|
706
|
-
*/
|
|
707
|
-
readonly size: number;
|
|
708
|
-
/**
|
|
709
|
-
* A read-only property that returns the maximum number of prepared statements the cache can hold.
|
|
710
|
-
* @since v24.9.0
|
|
711
|
-
*/
|
|
712
|
-
readonly capacity: number;
|
|
713
|
-
/**
|
|
714
|
-
* A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`.
|
|
715
|
-
* @since v24.9.0
|
|
716
|
-
*/
|
|
717
|
-
readonly db: DatabaseSync;
|
|
718
|
-
/**
|
|
719
|
-
* Resets the LRU cache, clearing all stored prepared statements.
|
|
720
|
-
* @since v24.9.0
|
|
721
|
-
*/
|
|
722
|
-
clear(): void;
|
|
723
430
|
}
|
|
724
431
|
interface StatementColumnMetadata {
|
|
725
432
|
/**
|
|
@@ -800,7 +507,7 @@ declare module "node:sqlite" {
|
|
|
800
507
|
/**
|
|
801
508
|
* This method is used to retrieve information about the columns returned by the
|
|
802
509
|
* prepared statement.
|
|
803
|
-
* @since
|
|
510
|
+
* @since v22.16.0
|
|
804
511
|
* @returns An array of objects. Each object corresponds to a column
|
|
805
512
|
* in the prepared statement, and contains the following properties:
|
|
806
513
|
*/
|
|
@@ -889,7 +596,7 @@ declare module "node:sqlite" {
|
|
|
889
596
|
/**
|
|
890
597
|
* When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead
|
|
891
598
|
* of objects.
|
|
892
|
-
* @since
|
|
599
|
+
* @since v22.16.0
|
|
893
600
|
* @param enabled Enables or disables the return of query results as arrays.
|
|
894
601
|
*/
|
|
895
602
|
setReturnArrays(enabled: boolean): void;
|
|
@@ -930,9 +637,8 @@ declare module "node:sqlite" {
|
|
|
930
637
|
*/
|
|
931
638
|
rate?: number | undefined;
|
|
932
639
|
/**
|
|
933
|
-
*
|
|
934
|
-
*
|
|
935
|
-
* of the backup operation.
|
|
640
|
+
* Callback function that will be called with the number of pages copied and the total number of
|
|
641
|
+
* pages.
|
|
936
642
|
*/
|
|
937
643
|
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
|
|
938
644
|
}
|
|
@@ -963,16 +669,15 @@ declare module "node:sqlite" {
|
|
|
963
669
|
*
|
|
964
670
|
* console.log('Backup completed', totalPagesTransferred);
|
|
965
671
|
* ```
|
|
966
|
-
* @since
|
|
672
|
+
* @since v22.16.0
|
|
967
673
|
* @param sourceDb The database to backup. The source database must be open.
|
|
968
674
|
* @param path The path where the backup will be created. If the file already exists,
|
|
969
675
|
* the contents will be overwritten.
|
|
970
676
|
* @param options Optional configuration for the backup. The
|
|
971
677
|
* following properties are supported:
|
|
972
|
-
* @returns A promise that
|
|
973
|
-
* error occurs.
|
|
678
|
+
* @returns A promise that resolves when the backup is completed and rejects if an error occurs.
|
|
974
679
|
*/
|
|
975
|
-
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<
|
|
680
|
+
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<void>;
|
|
976
681
|
/**
|
|
977
682
|
* @since v22.13.0
|
|
978
683
|
*/
|
|
@@ -1012,54 +717,5 @@ declare module "node:sqlite" {
|
|
|
1012
717
|
* @since v22.12.0
|
|
1013
718
|
*/
|
|
1014
719
|
const SQLITE_CHANGESET_ABORT: number;
|
|
1015
|
-
/**
|
|
1016
|
-
* Deny the operation and cause an error to be returned.
|
|
1017
|
-
* @since v24.10.0
|
|
1018
|
-
*/
|
|
1019
|
-
const SQLITE_DENY: number;
|
|
1020
|
-
/**
|
|
1021
|
-
* Ignore the operation and continue as if it had never been requested.
|
|
1022
|
-
* @since 24.10.0
|
|
1023
|
-
*/
|
|
1024
|
-
const SQLITE_IGNORE: number;
|
|
1025
|
-
/**
|
|
1026
|
-
* Allow the operation to proceed normally.
|
|
1027
|
-
* @since v24.10.0
|
|
1028
|
-
*/
|
|
1029
|
-
const SQLITE_OK: number;
|
|
1030
|
-
const SQLITE_CREATE_INDEX: number;
|
|
1031
|
-
const SQLITE_CREATE_TABLE: number;
|
|
1032
|
-
const SQLITE_CREATE_TEMP_INDEX: number;
|
|
1033
|
-
const SQLITE_CREATE_TEMP_TABLE: number;
|
|
1034
|
-
const SQLITE_CREATE_TEMP_TRIGGER: number;
|
|
1035
|
-
const SQLITE_CREATE_TEMP_VIEW: number;
|
|
1036
|
-
const SQLITE_CREATE_TRIGGER: number;
|
|
1037
|
-
const SQLITE_CREATE_VIEW: number;
|
|
1038
|
-
const SQLITE_DELETE: number;
|
|
1039
|
-
const SQLITE_DROP_INDEX: number;
|
|
1040
|
-
const SQLITE_DROP_TABLE: number;
|
|
1041
|
-
const SQLITE_DROP_TEMP_INDEX: number;
|
|
1042
|
-
const SQLITE_DROP_TEMP_TABLE: number;
|
|
1043
|
-
const SQLITE_DROP_TEMP_TRIGGER: number;
|
|
1044
|
-
const SQLITE_DROP_TEMP_VIEW: number;
|
|
1045
|
-
const SQLITE_DROP_TRIGGER: number;
|
|
1046
|
-
const SQLITE_DROP_VIEW: number;
|
|
1047
|
-
const SQLITE_INSERT: number;
|
|
1048
|
-
const SQLITE_PRAGMA: number;
|
|
1049
|
-
const SQLITE_READ: number;
|
|
1050
|
-
const SQLITE_SELECT: number;
|
|
1051
|
-
const SQLITE_TRANSACTION: number;
|
|
1052
|
-
const SQLITE_UPDATE: number;
|
|
1053
|
-
const SQLITE_ATTACH: number;
|
|
1054
|
-
const SQLITE_DETACH: number;
|
|
1055
|
-
const SQLITE_ALTER_TABLE: number;
|
|
1056
|
-
const SQLITE_REINDEX: number;
|
|
1057
|
-
const SQLITE_ANALYZE: number;
|
|
1058
|
-
const SQLITE_CREATE_VTABLE: number;
|
|
1059
|
-
const SQLITE_DROP_VTABLE: number;
|
|
1060
|
-
const SQLITE_FUNCTION: number;
|
|
1061
|
-
const SQLITE_SAVEPOINT: number;
|
|
1062
|
-
const SQLITE_COPY: number;
|
|
1063
|
-
const SQLITE_RECURSIVE: number;
|
|
1064
720
|
}
|
|
1065
721
|
}
|
|
@@ -3,36 +3,36 @@
|
|
|
3
3
|
* streams.
|
|
4
4
|
* @since v16.7.0
|
|
5
5
|
*/
|
|
6
|
-
declare module "
|
|
7
|
-
import { Blob, NonSharedBuffer } from "node:buffer";
|
|
8
|
-
import { ReadableStream } from "node:stream/web";
|
|
6
|
+
declare module "stream/consumers" {
|
|
7
|
+
import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer";
|
|
8
|
+
import { ReadableStream as WebReadableStream } from "node:stream/web";
|
|
9
9
|
/**
|
|
10
10
|
* @since v16.7.0
|
|
11
11
|
* @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream.
|
|
12
12
|
*/
|
|
13
|
-
function arrayBuffer(stream:
|
|
13
|
+
function arrayBuffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<ArrayBuffer>;
|
|
14
14
|
/**
|
|
15
15
|
* @since v16.7.0
|
|
16
16
|
* @returns Fulfills with a `Blob` containing the full contents of the stream.
|
|
17
17
|
*/
|
|
18
|
-
function blob(stream:
|
|
18
|
+
function blob(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NodeBlob>;
|
|
19
19
|
/**
|
|
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:
|
|
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
|
|
27
27
|
* UTF-8 encoded string that is then passed through `JSON.parse()`.
|
|
28
28
|
*/
|
|
29
|
-
function json(stream:
|
|
29
|
+
function json(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<unknown>;
|
|
30
30
|
/**
|
|
31
31
|
* @since v16.7.0
|
|
32
32
|
* @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string.
|
|
33
33
|
*/
|
|
34
|
-
function text(stream:
|
|
34
|
+
function text(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<string>;
|
|
35
35
|
}
|
|
36
|
-
declare module "stream/consumers" {
|
|
37
|
-
export * from "
|
|
36
|
+
declare module "node:stream/consumers" {
|
|
37
|
+
export * from "stream/consumers";
|
|
38
38
|
}
|