@chainlink/external-adapter-framework 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/adapter/basic.js +21 -4
- package/adapter/basic.js.map +1 -1
- package/adapter/endpoint.js +13 -0
- package/adapter/endpoint.js.map +1 -1
- package/adapter/por.js +6 -6
- package/adapter/por.js.map +1 -1
- package/adapter/price.js +1 -0
- package/adapter/price.js.map +1 -1
- package/cache/local.js +5 -1
- package/cache/local.js.map +1 -1
- package/cache/redis.js +3 -1
- package/cache/redis.js.map +1 -1
- package/cache/response.js +5 -0
- package/cache/response.js.map +1 -1
- package/config/index.js +9 -6
- package/config/index.js.map +1 -1
- package/generator-adapter/node_modules/.yarn-integrity +4 -4
- package/generator-adapter/node_modules/@types/node/README.md +3 -3
- package/generator-adapter/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/generator-adapter/node_modules/@types/node/assert.d.ts +162 -101
- package/generator-adapter/node_modules/@types/node/async_hooks.d.ts +25 -5
- package/generator-adapter/node_modules/@types/node/buffer.buffer.d.ts +9 -0
- package/generator-adapter/node_modules/@types/node/buffer.d.ts +9 -5
- package/generator-adapter/node_modules/@types/node/child_process.d.ts +67 -44
- package/generator-adapter/node_modules/@types/node/cluster.d.ts +19 -20
- package/generator-adapter/node_modules/@types/node/compatibility/iterators.d.ts +1 -0
- package/generator-adapter/node_modules/@types/node/console.d.ts +19 -18
- package/generator-adapter/node_modules/@types/node/crypto.d.ts +1247 -355
- package/generator-adapter/node_modules/@types/node/dgram.d.ts +10 -9
- package/generator-adapter/node_modules/@types/node/diagnostics_channel.d.ts +1 -3
- package/generator-adapter/node_modules/@types/node/dns/promises.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/dns.d.ts +23 -18
- package/generator-adapter/node_modules/@types/node/domain.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/events.d.ts +81 -35
- package/generator-adapter/node_modules/@types/node/fs/promises.d.ts +62 -22
- package/generator-adapter/node_modules/@types/node/fs.d.ts +364 -98
- package/generator-adapter/node_modules/@types/node/globals.d.ts +4 -4
- package/generator-adapter/node_modules/@types/node/globals.typedarray.d.ts +20 -0
- package/generator-adapter/node_modules/@types/node/http.d.ts +120 -32
- package/generator-adapter/node_modules/@types/node/http2.d.ts +185 -65
- package/generator-adapter/node_modules/@types/node/https.d.ts +92 -63
- package/generator-adapter/node_modules/@types/node/index.d.ts +10 -5
- package/generator-adapter/node_modules/@types/node/inspector.d.ts +277 -0
- package/generator-adapter/node_modules/@types/node/inspector.generated.d.ts +908 -886
- package/generator-adapter/node_modules/@types/node/module.d.ts +21 -18
- package/generator-adapter/node_modules/@types/node/net.d.ts +35 -16
- package/generator-adapter/node_modules/@types/node/os.d.ts +22 -10
- package/generator-adapter/node_modules/@types/node/package.json +13 -3
- package/generator-adapter/node_modules/@types/node/path.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/perf_hooks.d.ts +28 -16
- package/generator-adapter/node_modules/@types/node/process.d.ts +30 -30
- package/generator-adapter/node_modules/@types/node/punycode.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/querystring.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/readline.d.ts +13 -13
- package/generator-adapter/node_modules/@types/node/repl.d.ts +23 -13
- package/generator-adapter/node_modules/@types/node/sea.d.ts +10 -1
- package/generator-adapter/node_modules/@types/node/sqlite.d.ts +245 -23
- package/generator-adapter/node_modules/@types/node/stream/consumers.d.ts +2 -2
- package/generator-adapter/node_modules/@types/node/stream/web.d.ts +6 -55
- package/generator-adapter/node_modules/@types/node/stream.d.ts +63 -37
- package/generator-adapter/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/generator-adapter/node_modules/@types/node/test.d.ts +196 -40
- package/generator-adapter/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/timers.d.ts +1 -3
- package/generator-adapter/node_modules/@types/node/tls.d.ts +124 -114
- package/generator-adapter/node_modules/@types/node/trace_events.d.ts +6 -6
- package/generator-adapter/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
- package/generator-adapter/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/generator-adapter/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +17 -0
- package/generator-adapter/node_modules/@types/node/ts5.6/index.d.ts +12 -5
- package/generator-adapter/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/generator-adapter/node_modules/@types/node/ts5.7/index.d.ts +103 -0
- package/generator-adapter/node_modules/@types/node/tty.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/url.d.ts +109 -33
- package/generator-adapter/node_modules/@types/node/util.d.ts +31 -305
- package/generator-adapter/node_modules/@types/node/v8.d.ts +41 -8
- package/generator-adapter/node_modules/@types/node/vm.d.ts +258 -107
- package/generator-adapter/node_modules/@types/node/wasi.d.ts +23 -2
- package/generator-adapter/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/generator-adapter/node_modules/@types/node/web-globals/events.d.ts +3 -0
- package/generator-adapter/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
- package/generator-adapter/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
- package/generator-adapter/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/generator-adapter/node_modules/@types/node/worker_threads.d.ts +142 -51
- package/generator-adapter/node_modules/@types/node/zlib.d.ts +36 -31
- package/generator-adapter/node_modules/undici-types/agent.d.ts +12 -11
- package/generator-adapter/node_modules/undici-types/api.d.ts +24 -24
- package/generator-adapter/node_modules/undici-types/balanced-pool.d.ts +11 -11
- package/generator-adapter/node_modules/undici-types/cache-interceptor.d.ts +172 -0
- package/generator-adapter/node_modules/undici-types/client-stats.d.ts +15 -0
- package/generator-adapter/node_modules/undici-types/client.d.ts +18 -18
- package/generator-adapter/node_modules/undici-types/cookies.d.ts +2 -0
- package/generator-adapter/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
- package/generator-adapter/node_modules/undici-types/dispatcher.d.ts +119 -99
- package/generator-adapter/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
- package/generator-adapter/node_modules/undici-types/errors.d.ts +66 -54
- package/generator-adapter/node_modules/undici-types/eventsource.d.ts +9 -4
- package/generator-adapter/node_modules/undici-types/fetch.d.ts +18 -16
- package/generator-adapter/node_modules/undici-types/formdata.d.ts +7 -7
- package/generator-adapter/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/generator-adapter/node_modules/undici-types/global-origin.d.ts +5 -5
- package/generator-adapter/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/generator-adapter/node_modules/undici-types/handlers.d.ts +8 -8
- package/generator-adapter/node_modules/undici-types/header.d.ts +157 -1
- package/generator-adapter/node_modules/undici-types/index.d.ts +56 -47
- package/generator-adapter/node_modules/undici-types/interceptors.d.ts +30 -8
- package/generator-adapter/node_modules/undici-types/mock-agent.d.ts +36 -18
- package/generator-adapter/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/generator-adapter/node_modules/undici-types/mock-client.d.ts +6 -4
- package/generator-adapter/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/generator-adapter/node_modules/undici-types/mock-interceptor.d.ts +21 -20
- package/generator-adapter/node_modules/undici-types/mock-pool.d.ts +6 -4
- package/generator-adapter/node_modules/undici-types/package.json +1 -1
- package/generator-adapter/node_modules/undici-types/patch.d.ts +0 -4
- package/generator-adapter/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/generator-adapter/node_modules/undici-types/pool.d.ts +14 -12
- package/generator-adapter/node_modules/undici-types/proxy-agent.d.ts +5 -4
- package/generator-adapter/node_modules/undici-types/readable.d.ts +18 -15
- package/generator-adapter/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/generator-adapter/node_modules/undici-types/retry-handler.d.ts +19 -10
- package/generator-adapter/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/generator-adapter/node_modules/undici-types/util.d.ts +3 -3
- package/generator-adapter/node_modules/undici-types/utility.d.ts +7 -0
- package/generator-adapter/node_modules/undici-types/webidl.d.ts +142 -29
- package/generator-adapter/node_modules/undici-types/websocket.d.ts +38 -2
- package/generator-adapter/package.json +1 -1
- package/metrics/index.js +3 -0
- package/metrics/index.js.map +1 -1
- package/package.json +8 -8
- package/rate-limiting/burst.js +6 -6
- package/rate-limiting/burst.js.map +1 -1
- package/rate-limiting/fixed-interval.js +2 -3
- package/rate-limiting/fixed-interval.js.map +1 -1
- package/transports/abstract/streaming.js +7 -10
- package/transports/abstract/streaming.js.map +1 -1
- package/transports/abstract/subscription.js +4 -0
- package/transports/abstract/subscription.js.map +1 -1
- package/transports/http.js +5 -3
- package/transports/http.js.map +1 -1
- package/transports/index.js +1 -3
- package/transports/index.js.map +1 -1
- package/transports/sse.js +6 -2
- package/transports/sse.js.map +1 -1
- package/transports/websocket.d.ts +9 -1
- package/transports/websocket.js +25 -13
- package/transports/websocket.js.map +1 -1
- package/util/censor/censor-list.js +1 -1
- package/util/censor/censor-list.js.map +1 -1
- package/util/group-runner.js +3 -2
- package/util/group-runner.js.map +1 -1
- package/util/index.js +8 -1
- package/util/index.js.map +1 -1
- package/util/logger.js +8 -1
- package/util/logger.js.map +1 -1
- package/util/requester.js +11 -3
- package/util/requester.js.map +1 -1
- package/util/subscription-set/expiring-sorted-set.js +3 -0
- package/util/subscription-set/expiring-sorted-set.js.map +1 -1
- package/util/subscription-set/redis-sorted-set.js +3 -0
- package/util/subscription-set/redis-sorted-set.js.map +1 -1
- package/util/subscription-set/subscription-set.js +5 -0
- package/util/subscription-set/subscription-set.js.map +1 -1
- package/util/testing-utils.js +13 -6
- package/util/testing-utils.js.map +1 -1
- package/validation/error.js +13 -0
- package/validation/error.js.map +1 -1
- package/validation/input-params.js +14 -0
- package/validation/input-params.js.map +1 -1
- package/generator-adapter/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
- package/generator-adapter/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/generator-adapter/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/generator-adapter/node_modules/undici-types/file.d.ts +0 -39
- package/generator-adapter/node_modules/undici-types/filereader.d.ts +0 -54
|
@@ -40,13 +40,12 @@
|
|
|
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/v24.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
|
|
@@ -93,34 +92,34 @@ declare module "node:sqlite" {
|
|
|
93
92
|
* The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of
|
|
94
93
|
* time that SQLite will wait for a database lock to be released before
|
|
95
94
|
* returning an error.
|
|
96
|
-
* @since
|
|
95
|
+
* @since v24.0.0
|
|
97
96
|
* @default 0
|
|
98
97
|
*/
|
|
99
98
|
timeout?: number | undefined;
|
|
100
99
|
/**
|
|
101
100
|
* If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
|
|
102
101
|
* integer fields are read as JavaScript numbers.
|
|
103
|
-
* @since
|
|
102
|
+
* @since v24.4.0
|
|
104
103
|
* @default false
|
|
105
104
|
*/
|
|
106
105
|
readBigInts?: boolean | undefined;
|
|
107
106
|
/**
|
|
108
107
|
* If `true`, query results are returned as arrays instead of objects.
|
|
109
|
-
* @since
|
|
108
|
+
* @since v24.4.0
|
|
110
109
|
* @default false
|
|
111
110
|
*/
|
|
112
111
|
returnArrays?: boolean | undefined;
|
|
113
112
|
/**
|
|
114
113
|
* If `true`, allows binding named parameters without the prefix
|
|
115
114
|
* character (e.g., `foo` instead of `:foo`).
|
|
116
|
-
* @since
|
|
115
|
+
* @since v24.4.40
|
|
117
116
|
* @default true
|
|
118
117
|
*/
|
|
119
118
|
allowBareNamedParameters?: boolean | undefined;
|
|
120
119
|
/**
|
|
121
120
|
* If `true`, unknown named parameters are ignored when binding.
|
|
122
121
|
* If `false`, an exception is thrown for unknown named parameters.
|
|
123
|
-
* @since
|
|
122
|
+
* @since v24.4.40
|
|
124
123
|
* @default false
|
|
125
124
|
*/
|
|
126
125
|
allowUnknownNamedParameters?: boolean | undefined;
|
|
@@ -240,7 +239,7 @@ declare module "node:sqlite" {
|
|
|
240
239
|
* To use an in-memory database, the path should be the special name `':memory:'`.
|
|
241
240
|
* @param options Configuration options for the database connection.
|
|
242
241
|
*/
|
|
243
|
-
constructor(path:
|
|
242
|
+
constructor(path: PathLike, options?: DatabaseSyncOptions);
|
|
244
243
|
/**
|
|
245
244
|
* Registers a new aggregate function with the SQLite database. This method is a wrapper around
|
|
246
245
|
* [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
|
|
@@ -267,7 +266,7 @@ declare module "node:sqlite" {
|
|
|
267
266
|
*
|
|
268
267
|
* db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 }
|
|
269
268
|
* ```
|
|
270
|
-
* @since
|
|
269
|
+
* @since v24.0.0
|
|
271
270
|
* @param name The name of the SQLite function to create.
|
|
272
271
|
* @param options Function configuration settings.
|
|
273
272
|
*/
|
|
@@ -297,7 +296,7 @@ declare module "node:sqlite" {
|
|
|
297
296
|
enableLoadExtension(allow: boolean): void;
|
|
298
297
|
/**
|
|
299
298
|
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
|
|
300
|
-
* @since
|
|
299
|
+
* @since v24.0.0
|
|
301
300
|
* @param dbName Name of the database. This can be `'main'` (the default primary database) or any other
|
|
302
301
|
* database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`.
|
|
303
302
|
* @returns The location of the database file. When using an in-memory database,
|
|
@@ -321,7 +320,7 @@ declare module "node:sqlite" {
|
|
|
321
320
|
* @param func The JavaScript function to call when the SQLite
|
|
322
321
|
* function is invoked. The return value of this function should be a valid
|
|
323
322
|
* SQLite data type: see
|
|
324
|
-
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-
|
|
323
|
+
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v24.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite).
|
|
325
324
|
* The result defaults to `NULL` if the return value is `undefined`.
|
|
326
325
|
*/
|
|
327
326
|
function(
|
|
@@ -330,6 +329,64 @@ declare module "node:sqlite" {
|
|
|
330
329
|
func: (...args: SQLOutputValue[]) => SQLInputValue,
|
|
331
330
|
): void;
|
|
332
331
|
function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void;
|
|
332
|
+
/**
|
|
333
|
+
* Sets an authorizer callback that SQLite will invoke whenever it attempts to
|
|
334
|
+
* access data or modify the database schema through prepared statements.
|
|
335
|
+
* This can be used to implement security policies, audit access, or restrict certain operations.
|
|
336
|
+
* This method is a wrapper around [`sqlite3_set_authorizer()`](https://sqlite.org/c3ref/set_authorizer.html).
|
|
337
|
+
*
|
|
338
|
+
* When invoked, the callback receives five arguments:
|
|
339
|
+
*
|
|
340
|
+
* * `actionCode` {number} The type of operation being performed (e.g.,
|
|
341
|
+
* `SQLITE_INSERT`, `SQLITE_UPDATE`, `SQLITE_SELECT`).
|
|
342
|
+
* * `arg1` {string|null} The first argument (context-dependent, often a table name).
|
|
343
|
+
* * `arg2` {string|null} The second argument (context-dependent, often a column name).
|
|
344
|
+
* * `dbName` {string|null} The name of the database.
|
|
345
|
+
* * `triggerOrView` {string|null} The name of the trigger or view causing the access.
|
|
346
|
+
*
|
|
347
|
+
* The callback must return one of the following constants:
|
|
348
|
+
*
|
|
349
|
+
* * `SQLITE_OK` - Allow the operation.
|
|
350
|
+
* * `SQLITE_DENY` - Deny the operation (causes an error).
|
|
351
|
+
* * `SQLITE_IGNORE` - Ignore the operation (silently skip).
|
|
352
|
+
*
|
|
353
|
+
* ```js
|
|
354
|
+
* import { DatabaseSync, constants } from 'node:sqlite';
|
|
355
|
+
* const db = new DatabaseSync(':memory:');
|
|
356
|
+
*
|
|
357
|
+
* // Set up an authorizer that denies all table creation
|
|
358
|
+
* db.setAuthorizer((actionCode) => {
|
|
359
|
+
* if (actionCode === constants.SQLITE_CREATE_TABLE) {
|
|
360
|
+
* return constants.SQLITE_DENY;
|
|
361
|
+
* }
|
|
362
|
+
* return constants.SQLITE_OK;
|
|
363
|
+
* });
|
|
364
|
+
*
|
|
365
|
+
* // This will work
|
|
366
|
+
* db.prepare('SELECT 1').get();
|
|
367
|
+
*
|
|
368
|
+
* // This will throw an error due to authorization denial
|
|
369
|
+
* try {
|
|
370
|
+
* db.exec('CREATE TABLE blocked (id INTEGER)');
|
|
371
|
+
* } catch (err) {
|
|
372
|
+
* console.log('Operation blocked:', err.message);
|
|
373
|
+
* }
|
|
374
|
+
* ```
|
|
375
|
+
* @since v24.10.0
|
|
376
|
+
* @param callback The authorizer function to set, or `null` to
|
|
377
|
+
* clear the current authorizer.
|
|
378
|
+
*/
|
|
379
|
+
setAuthorizer(
|
|
380
|
+
callback:
|
|
381
|
+
| ((
|
|
382
|
+
actionCode: number,
|
|
383
|
+
arg1: string | null,
|
|
384
|
+
arg2: string | null,
|
|
385
|
+
dbName: string | null,
|
|
386
|
+
triggerOrView: string | null,
|
|
387
|
+
) => number)
|
|
388
|
+
| null,
|
|
389
|
+
): void;
|
|
333
390
|
/**
|
|
334
391
|
* Whether the database is currently open or not.
|
|
335
392
|
* @since v22.15.0
|
|
@@ -338,7 +395,7 @@ declare module "node:sqlite" {
|
|
|
338
395
|
/**
|
|
339
396
|
* Whether the database is currently within a transaction. This method
|
|
340
397
|
* is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).
|
|
341
|
-
* @since
|
|
398
|
+
* @since v24.0.0
|
|
342
399
|
*/
|
|
343
400
|
readonly isTransaction: boolean;
|
|
344
401
|
/**
|
|
@@ -355,6 +412,47 @@ declare module "node:sqlite" {
|
|
|
355
412
|
* @return The prepared statement.
|
|
356
413
|
*/
|
|
357
414
|
prepare(sql: string): StatementSync;
|
|
415
|
+
/**
|
|
416
|
+
* Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for
|
|
417
|
+
* storing prepared statements. This allows for the efficient reuse of prepared
|
|
418
|
+
* statements by tagging them with a unique identifier.
|
|
419
|
+
*
|
|
420
|
+
* When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared
|
|
421
|
+
* statement for that specific SQL string already exists in the cache. If it does,
|
|
422
|
+
* the cached statement is used. If not, a new prepared statement is created,
|
|
423
|
+
* executed, and then stored in the cache for future use. This mechanism helps to
|
|
424
|
+
* avoid the overhead of repeatedly parsing and preparing the same SQL statements.
|
|
425
|
+
*
|
|
426
|
+
* ```js
|
|
427
|
+
* import { DatabaseSync } from 'node:sqlite';
|
|
428
|
+
*
|
|
429
|
+
* const db = new DatabaseSync(':memory:');
|
|
430
|
+
* const sql = db.createSQLTagStore();
|
|
431
|
+
*
|
|
432
|
+
* db.exec('CREATE TABLE users (id INT, name TEXT)');
|
|
433
|
+
*
|
|
434
|
+
* // Using the 'run' method to insert data.
|
|
435
|
+
* // The tagged literal is used to identify the prepared statement.
|
|
436
|
+
* sql.run`INSERT INTO users VALUES (1, 'Alice')`;
|
|
437
|
+
* sql.run`INSERT INTO users VALUES (2, 'Bob')`;
|
|
438
|
+
*
|
|
439
|
+
* // Using the 'get' method to retrieve a single row.
|
|
440
|
+
* const id = 1;
|
|
441
|
+
* const user = sql.get`SELECT * FROM users WHERE id = ${id}`;
|
|
442
|
+
* console.log(user); // { id: 1, name: 'Alice' }
|
|
443
|
+
*
|
|
444
|
+
* // Using the 'all' method to retrieve all rows.
|
|
445
|
+
* const allUsers = sql.all`SELECT * FROM users ORDER BY id`;
|
|
446
|
+
* console.log(allUsers);
|
|
447
|
+
* // [
|
|
448
|
+
* // { id: 1, name: 'Alice' },
|
|
449
|
+
* // { id: 2, name: 'Bob' }
|
|
450
|
+
* // ]
|
|
451
|
+
* ```
|
|
452
|
+
* @since v24.9.0
|
|
453
|
+
* @returns A new SQL tag store for caching prepared statements.
|
|
454
|
+
*/
|
|
455
|
+
createTagStore(maxSize?: number): SQLTagStore;
|
|
358
456
|
/**
|
|
359
457
|
* Creates and attaches a session to the database. This method is a wrapper around
|
|
360
458
|
* [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and
|
|
@@ -396,7 +494,6 @@ declare module "node:sqlite" {
|
|
|
396
494
|
* Closes the database connection. If the database connection is already closed
|
|
397
495
|
* then this is a no-op.
|
|
398
496
|
* @since v22.15.0
|
|
399
|
-
* @experimental
|
|
400
497
|
*/
|
|
401
498
|
[Symbol.dispose](): void;
|
|
402
499
|
}
|
|
@@ -411,7 +508,7 @@ declare module "node:sqlite" {
|
|
|
411
508
|
* @returns Binary changeset that can be applied to other databases.
|
|
412
509
|
* @since v22.12.0
|
|
413
510
|
*/
|
|
414
|
-
changeset():
|
|
511
|
+
changeset(): NodeJS.NonSharedUint8Array;
|
|
415
512
|
/**
|
|
416
513
|
* Similar to the method above, but generates a more compact patchset. See
|
|
417
514
|
* [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets)
|
|
@@ -421,7 +518,7 @@ declare module "node:sqlite" {
|
|
|
421
518
|
* @returns Binary patchset that can be applied to other databases.
|
|
422
519
|
* @since v22.12.0
|
|
423
520
|
*/
|
|
424
|
-
patchset():
|
|
521
|
+
patchset(): NodeJS.NonSharedUint8Array;
|
|
425
522
|
/**
|
|
426
523
|
* Closes the session. An exception is thrown if the database or the session is not open. This method is a
|
|
427
524
|
* wrapper around
|
|
@@ -429,6 +526,73 @@ declare module "node:sqlite" {
|
|
|
429
526
|
*/
|
|
430
527
|
close(): void;
|
|
431
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* This class represents a single LRU (Least Recently Used) cache for storing
|
|
531
|
+
* prepared statements.
|
|
532
|
+
*
|
|
533
|
+
* Instances of this class are created via the database.createSQLTagStore() method,
|
|
534
|
+
* not by using a constructor. The store caches prepared statements based on the
|
|
535
|
+
* provided SQL query string. When the same query is seen again, the store
|
|
536
|
+
* retrieves the cached statement and safely applies the new values through
|
|
537
|
+
* parameter binding, thereby preventing attacks like SQL injection.
|
|
538
|
+
*
|
|
539
|
+
* The cache has a maxSize that defaults to 1000 statements, but a custom size can
|
|
540
|
+
* be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this
|
|
541
|
+
* class execute synchronously.
|
|
542
|
+
* @since v24.9.0
|
|
543
|
+
*/
|
|
544
|
+
interface SQLTagStore {
|
|
545
|
+
/**
|
|
546
|
+
* Executes the given SQL query and returns all resulting rows as an array of objects.
|
|
547
|
+
* @since v24.9.0
|
|
548
|
+
*/
|
|
549
|
+
all(
|
|
550
|
+
stringElements: TemplateStringsArray,
|
|
551
|
+
...boundParameters: SQLInputValue[]
|
|
552
|
+
): Record<string, SQLOutputValue>[];
|
|
553
|
+
/**
|
|
554
|
+
* Executes the given SQL query and returns the first resulting row as an object.
|
|
555
|
+
* @since v24.9.0
|
|
556
|
+
*/
|
|
557
|
+
get(
|
|
558
|
+
stringElements: TemplateStringsArray,
|
|
559
|
+
...boundParameters: SQLInputValue[]
|
|
560
|
+
): Record<string, SQLOutputValue> | undefined;
|
|
561
|
+
/**
|
|
562
|
+
* Executes the given SQL query and returns an iterator over the resulting rows.
|
|
563
|
+
* @since v24.9.0
|
|
564
|
+
*/
|
|
565
|
+
iterate(
|
|
566
|
+
stringElements: TemplateStringsArray,
|
|
567
|
+
...boundParameters: SQLInputValue[]
|
|
568
|
+
): NodeJS.Iterator<Record<string, SQLOutputValue>>;
|
|
569
|
+
/**
|
|
570
|
+
* Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
|
|
571
|
+
* @since v24.9.0
|
|
572
|
+
*/
|
|
573
|
+
run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges;
|
|
574
|
+
/**
|
|
575
|
+
* A read-only property that returns the number of prepared statements currently in the cache.
|
|
576
|
+
* @since v24.9.0
|
|
577
|
+
* @returns The maximum number of prepared statements the cache can hold.
|
|
578
|
+
*/
|
|
579
|
+
size(): number;
|
|
580
|
+
/**
|
|
581
|
+
* A read-only property that returns the maximum number of prepared statements the cache can hold.
|
|
582
|
+
* @since v24.9.0
|
|
583
|
+
*/
|
|
584
|
+
readonly capacity: number;
|
|
585
|
+
/**
|
|
586
|
+
* A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`.
|
|
587
|
+
* @since v24.9.0
|
|
588
|
+
*/
|
|
589
|
+
readonly db: DatabaseSync;
|
|
590
|
+
/**
|
|
591
|
+
* Resets the LRU cache, clearing all stored prepared statements.
|
|
592
|
+
* @since v24.9.0
|
|
593
|
+
*/
|
|
594
|
+
clear(): void;
|
|
595
|
+
}
|
|
432
596
|
interface StatementColumnMetadata {
|
|
433
597
|
/**
|
|
434
598
|
* The unaliased name of the column in the origin
|
|
@@ -508,7 +672,7 @@ declare module "node:sqlite" {
|
|
|
508
672
|
/**
|
|
509
673
|
* This method is used to retrieve information about the columns returned by the
|
|
510
674
|
* prepared statement.
|
|
511
|
-
* @since
|
|
675
|
+
* @since v23.11.0
|
|
512
676
|
* @returns An array of objects. Each object corresponds to a column
|
|
513
677
|
* in the prepared statement, and contains the following properties:
|
|
514
678
|
*/
|
|
@@ -594,6 +758,13 @@ declare module "node:sqlite" {
|
|
|
594
758
|
* @param enabled Enables or disables support for unknown named parameters.
|
|
595
759
|
*/
|
|
596
760
|
setAllowUnknownNamedParameters(enabled: boolean): void;
|
|
761
|
+
/**
|
|
762
|
+
* When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead
|
|
763
|
+
* of objects.
|
|
764
|
+
* @since v24.0.0
|
|
765
|
+
* @param enabled Enables or disables the return of query results as arrays.
|
|
766
|
+
*/
|
|
767
|
+
setReturnArrays(enabled: boolean): void;
|
|
597
768
|
/**
|
|
598
769
|
* When reading from the database, SQLite `INTEGER`s are mapped to JavaScript
|
|
599
770
|
* numbers by default. However, SQLite `INTEGER`s can store values larger than
|
|
@@ -631,8 +802,9 @@ declare module "node:sqlite" {
|
|
|
631
802
|
*/
|
|
632
803
|
rate?: number | undefined;
|
|
633
804
|
/**
|
|
634
|
-
*
|
|
635
|
-
*
|
|
805
|
+
* An optional callback function that will be called after each backup step. The argument passed
|
|
806
|
+
* to this callback is an `Object` with `remainingPages` and `totalPages` properties, describing the current progress
|
|
807
|
+
* of the backup operation.
|
|
636
808
|
*/
|
|
637
809
|
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
|
|
638
810
|
}
|
|
@@ -663,15 +835,16 @@ declare module "node:sqlite" {
|
|
|
663
835
|
*
|
|
664
836
|
* console.log('Backup completed', totalPagesTransferred);
|
|
665
837
|
* ```
|
|
666
|
-
* @since
|
|
838
|
+
* @since v23.8.0
|
|
667
839
|
* @param sourceDb The database to backup. The source database must be open.
|
|
668
840
|
* @param path The path where the backup will be created. If the file already exists,
|
|
669
841
|
* the contents will be overwritten.
|
|
670
842
|
* @param options Optional configuration for the backup. The
|
|
671
843
|
* following properties are supported:
|
|
672
|
-
* @returns A promise that
|
|
844
|
+
* @returns A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an
|
|
845
|
+
* error occurs.
|
|
673
846
|
*/
|
|
674
|
-
function backup(sourceDb: DatabaseSync, path:
|
|
847
|
+
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<number>;
|
|
675
848
|
/**
|
|
676
849
|
* @since v22.13.0
|
|
677
850
|
*/
|
|
@@ -711,5 +884,54 @@ declare module "node:sqlite" {
|
|
|
711
884
|
* @since v22.12.0
|
|
712
885
|
*/
|
|
713
886
|
const SQLITE_CHANGESET_ABORT: number;
|
|
887
|
+
/**
|
|
888
|
+
* Deny the operation and cause an error to be returned.
|
|
889
|
+
* @since v24.10.0
|
|
890
|
+
*/
|
|
891
|
+
const SQLITE_DENY: number;
|
|
892
|
+
/**
|
|
893
|
+
* Ignore the operation and continue as if it had never been requested.
|
|
894
|
+
* @since 24.10.0
|
|
895
|
+
*/
|
|
896
|
+
const SQLITE_IGNORE: number;
|
|
897
|
+
/**
|
|
898
|
+
* Allow the operation to proceed normally.
|
|
899
|
+
* @since v24.10.0
|
|
900
|
+
*/
|
|
901
|
+
const SQLITE_OK: number;
|
|
902
|
+
const SQLITE_CREATE_INDEX: number;
|
|
903
|
+
const SQLITE_CREATE_TABLE: number;
|
|
904
|
+
const SQLITE_CREATE_TEMP_INDEX: number;
|
|
905
|
+
const SQLITE_CREATE_TEMP_TABLE: number;
|
|
906
|
+
const SQLITE_CREATE_TEMP_TRIGGER: number;
|
|
907
|
+
const SQLITE_CREATE_TEMP_VIEW: number;
|
|
908
|
+
const SQLITE_CREATE_TRIGGER: number;
|
|
909
|
+
const SQLITE_CREATE_VIEW: number;
|
|
910
|
+
const SQLITE_DELETE: number;
|
|
911
|
+
const SQLITE_DROP_INDEX: number;
|
|
912
|
+
const SQLITE_DROP_TABLE: number;
|
|
913
|
+
const SQLITE_DROP_TEMP_INDEX: number;
|
|
914
|
+
const SQLITE_DROP_TEMP_TABLE: number;
|
|
915
|
+
const SQLITE_DROP_TEMP_TRIGGER: number;
|
|
916
|
+
const SQLITE_DROP_TEMP_VIEW: number;
|
|
917
|
+
const SQLITE_DROP_TRIGGER: number;
|
|
918
|
+
const SQLITE_DROP_VIEW: number;
|
|
919
|
+
const SQLITE_INSERT: number;
|
|
920
|
+
const SQLITE_PRAGMA: number;
|
|
921
|
+
const SQLITE_READ: number;
|
|
922
|
+
const SQLITE_SELECT: number;
|
|
923
|
+
const SQLITE_TRANSACTION: number;
|
|
924
|
+
const SQLITE_UPDATE: number;
|
|
925
|
+
const SQLITE_ATTACH: number;
|
|
926
|
+
const SQLITE_DETACH: number;
|
|
927
|
+
const SQLITE_ALTER_TABLE: number;
|
|
928
|
+
const SQLITE_REINDEX: number;
|
|
929
|
+
const SQLITE_ANALYZE: number;
|
|
930
|
+
const SQLITE_CREATE_VTABLE: number;
|
|
931
|
+
const SQLITE_DROP_VTABLE: number;
|
|
932
|
+
const SQLITE_FUNCTION: number;
|
|
933
|
+
const SQLITE_SAVEPOINT: number;
|
|
934
|
+
const SQLITE_COPY: number;
|
|
935
|
+
const SQLITE_RECURSIVE: number;
|
|
714
936
|
}
|
|
715
937
|
}
|
|
@@ -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
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
|
2
2
|
: import("stream/web").ByteLengthQueuingStrategy;
|
|
3
|
-
type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
|
4
|
-
: import("stream/web").CompressionStream;
|
|
5
3
|
type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
|
6
4
|
: import("stream/web").CountQueuingStrategy;
|
|
7
|
-
type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
|
8
|
-
: import("stream/web").DecompressionStream;
|
|
9
5
|
type _QueuingStrategy<T = any> = typeof globalThis extends { onmessage: any } ? {}
|
|
10
6
|
: import("stream/web").QueuingStrategy<T>;
|
|
11
7
|
type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
|
|
@@ -412,22 +408,17 @@ declare module "stream/web" {
|
|
|
412
408
|
prototype: TextDecoderStream;
|
|
413
409
|
new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
|
|
414
410
|
};
|
|
415
|
-
|
|
411
|
+
type CompressionFormat = "brotli" | "deflate" | "deflate-raw" | "gzip";
|
|
412
|
+
class CompressionStream {
|
|
413
|
+
constructor(format: CompressionFormat);
|
|
416
414
|
readonly readable: ReadableStream;
|
|
417
415
|
readonly writable: WritableStream;
|
|
418
416
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream;
|
|
422
|
-
};
|
|
423
|
-
interface DecompressionStream {
|
|
424
|
-
readonly writable: WritableStream;
|
|
417
|
+
class DecompressionStream {
|
|
418
|
+
constructor(format: CompressionFormat);
|
|
425
419
|
readonly readable: ReadableStream;
|
|
420
|
+
readonly writable: WritableStream;
|
|
426
421
|
}
|
|
427
|
-
const DecompressionStream: {
|
|
428
|
-
prototype: DecompressionStream;
|
|
429
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream;
|
|
430
|
-
};
|
|
431
422
|
|
|
432
423
|
global {
|
|
433
424
|
interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
|
|
@@ -440,26 +431,6 @@ declare module "stream/web" {
|
|
|
440
431
|
? T
|
|
441
432
|
: typeof import("stream/web").ByteLengthQueuingStrategy;
|
|
442
433
|
|
|
443
|
-
interface CompressionStream extends _CompressionStream {}
|
|
444
|
-
/**
|
|
445
|
-
* `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`.
|
|
446
|
-
* https://nodejs.org/api/globals.html#class-compressionstream
|
|
447
|
-
* @since v18.0.0
|
|
448
|
-
*/
|
|
449
|
-
var CompressionStream: typeof globalThis extends {
|
|
450
|
-
onmessage: any;
|
|
451
|
-
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
|
452
|
-
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
|
453
|
-
ReportingObserver: any;
|
|
454
|
-
CompressionStream: infer T;
|
|
455
|
-
} ? T
|
|
456
|
-
// TS 4.8, 4.9, 5.0
|
|
457
|
-
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
|
458
|
-
prototype: T;
|
|
459
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
|
460
|
-
}
|
|
461
|
-
: typeof import("stream/web").CompressionStream;
|
|
462
|
-
|
|
463
434
|
interface CountQueuingStrategy extends _CountQueuingStrategy {}
|
|
464
435
|
/**
|
|
465
436
|
* `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`.
|
|
@@ -469,26 +440,6 @@ declare module "stream/web" {
|
|
|
469
440
|
var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
|
|
470
441
|
: typeof import("stream/web").CountQueuingStrategy;
|
|
471
442
|
|
|
472
|
-
interface DecompressionStream extends _DecompressionStream {}
|
|
473
|
-
/**
|
|
474
|
-
* `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`.
|
|
475
|
-
* https://nodejs.org/api/globals.html#class-decompressionstream
|
|
476
|
-
* @since v18.0.0
|
|
477
|
-
*/
|
|
478
|
-
var DecompressionStream: typeof globalThis extends {
|
|
479
|
-
onmessage: any;
|
|
480
|
-
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
|
481
|
-
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
|
482
|
-
ReportingObserver: any;
|
|
483
|
-
DecompressionStream: infer T extends object;
|
|
484
|
-
} ? T
|
|
485
|
-
// TS 4.8, 4.9, 5.0
|
|
486
|
-
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
|
487
|
-
prototype: T;
|
|
488
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
|
489
|
-
}
|
|
490
|
-
: typeof import("stream/web").DecompressionStream;
|
|
491
|
-
|
|
492
443
|
interface QueuingStrategy<T = any> extends _QueuingStrategy<T> {}
|
|
493
444
|
|
|
494
445
|
interface ReadableByteStreamController extends _ReadableByteStreamController {}
|