@chainlink/external-adapter-framework 2.6.0 → 2.7.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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/adapter/types.d.ts +1 -1
  3. package/config/index.d.ts +4 -0
  4. package/config/index.js +4 -0
  5. package/config/index.js.map +1 -1
  6. package/debug/router.js +7 -36
  7. package/debug/router.js.map +1 -1
  8. package/debug/settings-page.d.ts +1 -7
  9. package/debug/settings-page.js +0 -22
  10. package/debug/settings-page.js.map +1 -1
  11. package/generator-adapter/generators/app/index.js +11 -5
  12. package/generator-adapter/node_modules/.yarn-integrity +2 -2
  13. package/generator-adapter/node_modules/@types/node/README.md +2 -2
  14. package/generator-adapter/node_modules/@types/node/async_hooks.d.ts +65 -1
  15. package/generator-adapter/node_modules/@types/node/buffer.buffer.d.ts +2 -0
  16. package/generator-adapter/node_modules/@types/node/buffer.d.ts +7 -2
  17. package/generator-adapter/node_modules/@types/node/cluster.d.ts +1 -1
  18. package/generator-adapter/node_modules/@types/node/compatibility/disposable.d.ts +0 -2
  19. package/generator-adapter/node_modules/@types/node/compatibility/indexable.d.ts +0 -3
  20. package/generator-adapter/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
  21. package/generator-adapter/node_modules/@types/node/diagnostics_channel.d.ts +37 -13
  22. package/generator-adapter/node_modules/@types/node/dns/promises.d.ts +36 -9
  23. package/generator-adapter/node_modules/@types/node/dns.d.ts +73 -20
  24. package/generator-adapter/node_modules/@types/node/dom-events.d.ts +60 -85
  25. package/generator-adapter/node_modules/@types/node/events.d.ts +0 -1
  26. package/generator-adapter/node_modules/@types/node/fs/promises.d.ts +21 -17
  27. package/generator-adapter/node_modules/@types/node/fs.d.ts +94 -10
  28. package/generator-adapter/node_modules/@types/node/globals.d.ts +136 -283
  29. package/generator-adapter/node_modules/@types/node/http.d.ts +88 -1
  30. package/generator-adapter/node_modules/@types/node/http2.d.ts +69 -1
  31. package/generator-adapter/node_modules/@types/node/module.d.ts +113 -18
  32. package/generator-adapter/node_modules/@types/node/net.d.ts +15 -9
  33. package/generator-adapter/node_modules/@types/node/package.json +2 -2
  34. package/generator-adapter/node_modules/@types/node/perf_hooks.d.ts +2 -2
  35. package/generator-adapter/node_modules/@types/node/process.d.ts +0 -2
  36. package/generator-adapter/node_modules/@types/node/querystring.d.ts +2 -3
  37. package/generator-adapter/node_modules/@types/node/repl.d.ts +3 -5
  38. package/generator-adapter/node_modules/@types/node/sqlite.d.ts +172 -0
  39. package/generator-adapter/node_modules/@types/node/stream/web.d.ts +7 -3
  40. package/generator-adapter/node_modules/@types/node/stream.d.ts +6 -0
  41. package/generator-adapter/node_modules/@types/node/test.d.ts +1865 -1970
  42. package/generator-adapter/node_modules/@types/node/tls.d.ts +1 -1
  43. package/generator-adapter/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +2 -0
  44. package/generator-adapter/node_modules/@types/node/util.d.ts +28 -3
  45. package/generator-adapter/node_modules/@types/node/v8.d.ts +33 -0
  46. package/generator-adapter/node_modules/@types/node/vm.d.ts +61 -8
  47. package/generator-adapter/node_modules/@types/node/worker_threads.d.ts +48 -25
  48. package/generator-adapter/package.json +1 -1
  49. package/index.js +3 -0
  50. package/index.js.map +1 -1
  51. package/package.json +14 -15
  52. package/status/router.d.ts +49 -0
  53. package/status/router.js +55 -0
  54. package/status/router.js.map +1 -0
  55. package/transports/sse.d.ts +2 -2
  56. package/transports/sse.js +2 -5
  57. package/transports/sse.js.map +1 -1
  58. package/util/settings.d.ts +11 -0
  59. package/util/settings.js +29 -0
  60. package/util/settings.js.map +1 -0
@@ -1223,14 +1223,66 @@ declare module "http2" {
1223
1223
  }
1224
1224
  // Http2Server
1225
1225
  export interface SessionOptions {
1226
+ /**
1227
+ * Sets the maximum dynamic table size for deflating header fields.
1228
+ * @default 4Kib
1229
+ */
1226
1230
  maxDeflateDynamicTableSize?: number | undefined;
1231
+ /**
1232
+ * Sets the maximum number of settings entries per `SETTINGS` frame.
1233
+ * The minimum value allowed is `1`.
1234
+ * @default 32
1235
+ */
1236
+ maxSettings?: number | undefined;
1237
+ /**
1238
+ * Sets the maximum memory that the `Http2Session` is permitted to use.
1239
+ * The value is expressed in terms of number of megabytes, e.g. `1` equal 1 megabyte.
1240
+ * The minimum value allowed is `1`.
1241
+ * This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded,
1242
+ * but new `Http2Stream` instances will be rejected while this limit is exceeded.
1243
+ * The current number of `Http2Stream` sessions, the current memory use of the header compression tables,
1244
+ * current data queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all counted towards the current limit.
1245
+ * @default 10
1246
+ */
1227
1247
  maxSessionMemory?: number | undefined;
1248
+ /**
1249
+ * Sets the maximum number of header entries.
1250
+ * This is similar to `server.maxHeadersCount` or `request.maxHeadersCount` in the `node:http` module.
1251
+ * The minimum value is `1`.
1252
+ * @default 128
1253
+ */
1228
1254
  maxHeaderListPairs?: number | undefined;
1255
+ /**
1256
+ * Sets the maximum number of outstanding, unacknowledged pings.
1257
+ * @default 10
1258
+ */
1229
1259
  maxOutstandingPings?: number | undefined;
1260
+ /**
1261
+ * Sets the maximum allowed size for a serialized, compressed block of headers.
1262
+ * Attempts to send headers that exceed this limit will result in
1263
+ * a `'frameError'` event being emitted and the stream being closed and destroyed.
1264
+ */
1230
1265
  maxSendHeaderBlockLength?: number | undefined;
1266
+ /**
1267
+ * Strategy used for determining the amount of padding to use for `HEADERS` and `DATA` frames.
1268
+ * @default http2.constants.PADDING_STRATEGY_NONE
1269
+ */
1231
1270
  paddingStrategy?: number | undefined;
1271
+ /**
1272
+ * Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received.
1273
+ * Will be overridden if the remote peer sets its own value for `maxConcurrentStreams`.
1274
+ * @default 100
1275
+ */
1232
1276
  peerMaxConcurrentStreams?: number | undefined;
1277
+ /**
1278
+ * The initial settings to send to the remote peer upon connection.
1279
+ */
1233
1280
  settings?: Settings | undefined;
1281
+ /**
1282
+ * The array of integer values determines the settings types,
1283
+ * which are included in the `CustomSettings`-property of the received remoteSettings.
1284
+ * Please see the `CustomSettings`-property of the `Http2Settings` object for more information, on the allowed setting types.
1285
+ */
1234
1286
  remoteCustomSettings?: number[] | undefined;
1235
1287
  /**
1236
1288
  * Specifies a timeout in milliseconds that
@@ -1239,11 +1291,27 @@ declare module "http2" {
1239
1291
  * @default 100000
1240
1292
  */
1241
1293
  unknownProtocolTimeout?: number | undefined;
1242
- selectPadding?(frameLen: number, maxFrameLen: number): number;
1243
1294
  }
1244
1295
  export interface ClientSessionOptions extends SessionOptions {
1296
+ /**
1297
+ * Sets the maximum number of reserved push streams the client will accept at any given time.
1298
+ * Once the current number of currently reserved push streams exceeds reaches this limit,
1299
+ * new push streams sent by the server will be automatically rejected.
1300
+ * The minimum allowed value is 0. The maximum allowed value is 2<sup>32</sup>-1.
1301
+ * A negative value sets this option to the maximum allowed value.
1302
+ * @default 200
1303
+ */
1245
1304
  maxReservedRemoteStreams?: number | undefined;
1305
+ /**
1306
+ * An optional callback that receives the `URL` instance passed to `connect` and the `options` object,
1307
+ * and returns any `Duplex` stream that is to be used as the connection for this session.
1308
+ */
1246
1309
  createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
1310
+ /**
1311
+ * The protocol to connect with, if not set in the `authority`.
1312
+ * Value may be either `'http:'` or `'https:'`.
1313
+ * @default 'https:'
1314
+ */
1247
1315
  protocol?: "http:" | "https:" | undefined;
1248
1316
  }
1249
1317
  export interface ServerSessionOptions<
@@ -225,12 +225,12 @@ declare module "module" {
225
225
  * See [load hook](https://nodejs.org/docs/latest-v22.x/api/module.html#loadurl-context-nextload).
226
226
  * @default undefined
227
227
  */
228
- load?: LoadHook | undefined;
228
+ load?: LoadHookSync | undefined;
229
229
  /**
230
230
  * See [resolve hook](https://nodejs.org/docs/latest-v22.x/api/module.html#resolvespecifier-context-nextresolve).
231
231
  * @default undefined
232
232
  */
233
- resolve?: ResolveHook | undefined;
233
+ resolve?: ResolveHookSync | undefined;
234
234
  }
235
235
  interface ModuleHooks {
236
236
  /**
@@ -429,6 +429,14 @@ declare module "module" {
429
429
  context?: Partial<ResolveHookContext>,
430
430
  ) => ResolveFnOutput | Promise<ResolveFnOutput>,
431
431
  ) => ResolveFnOutput | Promise<ResolveFnOutput>;
432
+ type ResolveHookSync = (
433
+ specifier: string,
434
+ context: ResolveHookContext,
435
+ nextResolve: (
436
+ specifier: string,
437
+ context?: Partial<ResolveHookContext>,
438
+ ) => ResolveFnOutput,
439
+ ) => ResolveFnOutput;
432
440
  interface LoadHookContext {
433
441
  /**
434
442
  * Export conditions of the relevant `package.json`
@@ -444,7 +452,7 @@ declare module "module" {
444
452
  importAttributes: ImportAttributes;
445
453
  }
446
454
  interface LoadFnOutput {
447
- format: ModuleFormat;
455
+ format: string | null | undefined;
448
456
  /**
449
457
  * A signal that this hook intends to terminate the chain of `resolve` hooks.
450
458
  * @default false
@@ -468,6 +476,34 @@ declare module "module" {
468
476
  context?: Partial<LoadHookContext>,
469
477
  ) => LoadFnOutput | Promise<LoadFnOutput>,
470
478
  ) => LoadFnOutput | Promise<LoadFnOutput>;
479
+ type LoadHookSync = (
480
+ url: string,
481
+ context: LoadHookContext,
482
+ nextLoad: (
483
+ url: string,
484
+ context?: Partial<LoadHookContext>,
485
+ ) => LoadFnOutput,
486
+ ) => LoadFnOutput;
487
+ interface SourceMapsSupport {
488
+ /**
489
+ * If the source maps support is enabled
490
+ */
491
+ enabled: boolean;
492
+ /**
493
+ * If the support is enabled for files in `node_modules`.
494
+ */
495
+ nodeModules: boolean;
496
+ /**
497
+ * If the support is enabled for generated code from `eval` or `new Function`.
498
+ */
499
+ generatedCode: boolean;
500
+ }
501
+ /**
502
+ * This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack
503
+ * traces is enabled.
504
+ * @since v22.14.0
505
+ */
506
+ function getSourceMapsSupport(): SourceMapsSupport;
471
507
  /**
472
508
  * `path` is the resolved path for the file for which a corresponding source map
473
509
  * should be fetched.
@@ -475,6 +511,33 @@ declare module "module" {
475
511
  * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
476
512
  */
477
513
  function findSourceMap(path: string): SourceMap | undefined;
514
+ interface SetSourceMapsSupportOptions {
515
+ /**
516
+ * If enabling the support for files in `node_modules`.
517
+ * @default false
518
+ */
519
+ nodeModules?: boolean | undefined;
520
+ /**
521
+ * If enabling the support for generated code from `eval` or `new Function`.
522
+ * @default false
523
+ */
524
+ generatedCode?: boolean | undefined;
525
+ }
526
+ /**
527
+ * This function enables or disables the [Source Map v3](https://tc39.es/ecma426/) support for
528
+ * stack traces.
529
+ *
530
+ * It provides same features as launching Node.js process with commandline options
531
+ * `--enable-source-maps`, with additional options to alter the support for files
532
+ * in `node_modules` or generated codes.
533
+ *
534
+ * Only source maps in JavaScript files that are loaded after source maps has been
535
+ * enabled will be parsed and loaded. Preferably, use the commandline options
536
+ * `--enable-source-maps` to avoid losing track of source maps of modules loaded
537
+ * before this API call.
538
+ * @since v22.14.0
539
+ */
540
+ function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void;
478
541
  interface SourceMapConstructorOptions {
479
542
  /**
480
543
  * @since v21.0.0, v20.5.0
@@ -560,34 +623,67 @@ declare module "module" {
560
623
  global {
561
624
  interface ImportMeta {
562
625
  /**
563
- * The directory name of the current module. This is the same as the `path.dirname()` of the `import.meta.filename`.
564
- * **Caveat:** only present on `file:` modules.
626
+ * The directory name of the current module.
627
+ *
628
+ * This is the same as the `path.dirname()` of the `import.meta.filename`.
629
+ *
630
+ * > **Caveat**: only present on `file:` modules.
631
+ * @since v21.2.0, v20.11.0
565
632
  */
566
633
  dirname: string;
567
634
  /**
568
- * The full absolute path and filename of the current module, with symlinks resolved.
635
+ * The full absolute path and filename of the current module, with
636
+ * symlinks resolved.
637
+ *
569
638
  * This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
570
- * **Caveat:** only local modules support this property. Modules not using the `file:` protocol will not provide it.
639
+ *
640
+ * > **Caveat** only local modules support this property. Modules not using the
641
+ * > `file:` protocol will not provide it.
642
+ * @since v21.2.0, v20.11.0
571
643
  */
572
644
  filename: string;
573
645
  /**
574
646
  * The absolute `file:` URL of the module.
647
+ *
648
+ * This is defined exactly the same as it is in browsers providing the URL of the
649
+ * current module file.
650
+ *
651
+ * This enables useful patterns such as relative file loading:
652
+ *
653
+ * ```js
654
+ * import { readFileSync } from 'node:fs';
655
+ * const buffer = readFileSync(new URL('./data.proto', import.meta.url));
656
+ * ```
575
657
  */
576
658
  url: string;
577
659
  /**
578
- * Provides a module-relative resolution function scoped to each module, returning
579
- * the URL string.
660
+ * `import.meta.resolve` is a module-relative resolution function scoped to
661
+ * each module, returning the URL string.
580
662
  *
581
- * Second `parent` parameter is only used when the `--experimental-import-meta-resolve`
582
- * command flag enabled.
663
+ * ```js
664
+ * const dependencyAsset = import.meta.resolve('component-lib/asset.css');
665
+ * // file:///app/node_modules/component-lib/asset.css
666
+ * import.meta.resolve('./dep.js');
667
+ * // file:///app/dep.js
668
+ * ```
583
669
  *
584
- * @since v20.6.0
670
+ * All features of the Node.js module resolution are supported. Dependency
671
+ * resolutions are subject to the permitted exports resolutions within the package.
585
672
  *
586
- * @param specifier The module specifier to resolve relative to `parent`.
587
- * @param parent The absolute parent module URL to resolve from.
588
- * @returns The absolute (`file:`) URL string for the resolved module.
589
- */
590
- resolve(specifier: string, parent?: string | URL | undefined): string;
673
+ * **Caveats**:
674
+ *
675
+ * * This can result in synchronous file-system operations, which
676
+ * can impact performance similarly to `require.resolve`.
677
+ * * This feature is not available within custom loaders (it would
678
+ * create a deadlock).
679
+ * @since v13.9.0, v12.16.0
680
+ * @param specifier The module specifier to resolve relative to the
681
+ * current module.
682
+ * @param parent An optional absolute parent module URL to resolve from.
683
+ * **Default:** `import.meta.url`
684
+ * @returns The absolute URL string that the specifier would resolve to.
685
+ */
686
+ resolve(specifier: string, parent?: string | URL): string;
591
687
  }
592
688
  namespace NodeJS {
593
689
  interface Module {
@@ -756,7 +852,6 @@ declare module "module" {
756
852
  */
757
853
  var require: NodeJS.Require;
758
854
  // Global-scope aliases for backwards compatibility with @types/node <13.0.x
759
- // TODO: consider removing in a future major version update
760
855
  /** @deprecated Use `NodeJS.Module` instead. */
761
856
  interface NodeModule extends NodeJS.Module {}
762
857
  /** @deprecated Use `NodeJS.Require` instead. */
@@ -109,8 +109,8 @@ declare module "net" {
109
109
  * @since v0.1.90
110
110
  * @param [encoding='utf8'] Only used when data is `string`.
111
111
  */
112
- write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
113
- write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
112
+ write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
113
+ write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
114
114
  /**
115
115
  * Initiate a connection on a given socket.
116
116
  *
@@ -377,7 +377,7 @@ declare module "net" {
377
377
  addListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
378
378
  addListener(
379
379
  event: "connectionAttemptFailed",
380
- listener: (ip: string, port: number, family: number) => void,
380
+ listener: (ip: string, port: number, family: number, error: Error) => void,
381
381
  ): this;
382
382
  addListener(
383
383
  event: "connectionAttemptTimeout",
@@ -397,7 +397,7 @@ declare module "net" {
397
397
  emit(event: "close", hadError: boolean): boolean;
398
398
  emit(event: "connect"): boolean;
399
399
  emit(event: "connectionAttempt", ip: string, port: number, family: number): boolean;
400
- emit(event: "connectionAttemptFailed", ip: string, port: number, family: number): boolean;
400
+ emit(event: "connectionAttemptFailed", ip: string, port: number, family: number, error: Error): boolean;
401
401
  emit(event: "connectionAttemptTimeout", ip: string, port: number, family: number): boolean;
402
402
  emit(event: "data", data: Buffer): boolean;
403
403
  emit(event: "drain"): boolean;
@@ -410,7 +410,10 @@ declare module "net" {
410
410
  on(event: "close", listener: (hadError: boolean) => void): this;
411
411
  on(event: "connect", listener: () => void): this;
412
412
  on(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
413
- on(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this;
413
+ on(
414
+ event: "connectionAttemptFailed",
415
+ listener: (ip: string, port: number, family: number, error: Error) => void,
416
+ ): this;
414
417
  on(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
415
418
  on(event: "data", listener: (data: Buffer) => void): this;
416
419
  on(event: "drain", listener: () => void): this;
@@ -425,7 +428,10 @@ declare module "net" {
425
428
  once(event: string, listener: (...args: any[]) => void): this;
426
429
  once(event: "close", listener: (hadError: boolean) => void): this;
427
430
  once(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
428
- once(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this;
431
+ once(
432
+ event: "connectionAttemptFailed",
433
+ listener: (ip: string, port: number, family: number, error: Error) => void,
434
+ ): this;
429
435
  once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
430
436
  once(event: "connect", listener: () => void): this;
431
437
  once(event: "data", listener: (data: Buffer) => void): this;
@@ -444,7 +450,7 @@ declare module "net" {
444
450
  prependListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
445
451
  prependListener(
446
452
  event: "connectionAttemptFailed",
447
- listener: (ip: string, port: number, family: number) => void,
453
+ listener: (ip: string, port: number, family: number, error: Error) => void,
448
454
  ): this;
449
455
  prependListener(
450
456
  event: "connectionAttemptTimeout",
@@ -469,7 +475,7 @@ declare module "net" {
469
475
  ): this;
470
476
  prependOnceListener(
471
477
  event: "connectionAttemptFailed",
472
- listener: (ip: string, port: number, family: number) => void,
478
+ listener: (ip: string, port: number, family: number, error: Error) => void,
473
479
  ): this;
474
480
  prependOnceListener(
475
481
  event: "connectionAttemptTimeout",
@@ -656,7 +662,7 @@ declare module "net" {
656
662
  * Callback should take two arguments `err` and `count`.
657
663
  * @since v0.9.7
658
664
  */
659
- getConnections(cb: (error: Error | null, count: number) => void): void;
665
+ getConnections(cb: (error: Error | null, count: number) => void): this;
660
666
  /**
661
667
  * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior).
662
668
  * If the server is `ref`ed calling `ref()` again will have no effect.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.15.3",
3
+ "version": "22.16.3",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  "undici-types": "~6.21.0"
221
221
  },
222
222
  "peerDependencies": {},
223
- "typesPublisherContentHash": "2aecc93ec4fa0fcbf62f8df1fe665ab3615d3005c7b01703781b7e8c26655911",
223
+ "typesPublisherContentHash": "7159d16cfd01c052bbb85f0987775b21301e2769ae8b3305f8b90e868d05deea",
224
224
  "typeScriptVersion": "5.1"
225
225
  }
@@ -866,12 +866,12 @@ declare module "perf_hooks" {
866
866
  * The minimum recordable value. Must be an integer value greater than 0.
867
867
  * @default 1
868
868
  */
869
- min?: number | bigint | undefined;
869
+ lowest?: number | bigint | undefined;
870
870
  /**
871
871
  * The maximum recordable value. Must be an integer value greater than min.
872
872
  * @default Number.MAX_SAFE_INTEGER
873
873
  */
874
- max?: number | bigint | undefined;
874
+ highest?: number | bigint | undefined;
875
875
  /**
876
876
  * The number of accuracy digits. Must be a number between 1 and 5.
877
877
  * @default 3
@@ -1566,13 +1566,11 @@ declare module "process" {
1566
1566
  * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
1567
1567
  * information.
1568
1568
  * @since v19.6.0, v18.15.0
1569
- * @experimental
1570
1569
  */
1571
1570
  constrainedMemory(): number;
1572
1571
  /**
1573
1572
  * Gets the amount of free memory that is still available to the process (in bytes).
1574
1573
  * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v22.x/api/process.html#processavailablememory) for more information.
1575
- * @experimental
1576
1574
  * @since v20.13.0
1577
1575
  */
1578
1576
  availableMemory(): number;
@@ -37,9 +37,8 @@ declare module "querystring" {
37
37
  | string
38
38
  | number
39
39
  | boolean
40
- | readonly string[]
41
- | readonly number[]
42
- | readonly boolean[]
40
+ | bigint
41
+ | ReadonlyArray<string | number | boolean | bigint>
43
42
  | null
44
43
  >
45
44
  {}
@@ -37,12 +37,10 @@ declare module "repl" {
37
37
  terminal?: boolean | undefined;
38
38
  /**
39
39
  * The function to be used when evaluating each given line of input.
40
- * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
40
+ * **Default:** an async wrapper for the JavaScript `eval()` function. An `eval` function can
41
41
  * error with `repl.Recoverable` to indicate the input was incomplete and prompt for
42
- * additional lines.
43
- *
44
- * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_default_evaluation
45
- * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_custom_evaluation_functions
42
+ * additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#custom-evaluation-functions)
43
+ * section for more details.
46
44
  */
47
45
  eval?: REPLEval | undefined;
48
46
  /**
@@ -166,6 +166,31 @@ declare module "node:sqlite" {
166
166
  */
167
167
  varargs?: boolean | undefined;
168
168
  }
169
+ interface AggregateOptions<T extends SQLInputValue = SQLInputValue> extends FunctionOptions {
170
+ /**
171
+ * The identity value for the aggregation function. This value is used when the aggregation
172
+ * function is initialized. When a `Function` is passed the identity will be its return value.
173
+ */
174
+ start: T | (() => T);
175
+ /**
176
+ * The function to call for each row in the aggregation. The
177
+ * function receives the current state and the row value. The return value of
178
+ * this function should be the new state.
179
+ */
180
+ step: (accumulator: T, ...args: SQLOutputValue[]) => T;
181
+ /**
182
+ * The function to call to get the result of the
183
+ * aggregation. The function receives the final state and should return the
184
+ * result of the aggregation.
185
+ */
186
+ result?: ((accumulator: T) => SQLInputValue) | undefined;
187
+ /**
188
+ * When this function is provided, the `aggregate` method will work as a window function.
189
+ * The function receives the current state and the dropped row value. The return value of this function should be the
190
+ * new state.
191
+ */
192
+ inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined;
193
+ }
169
194
  /**
170
195
  * This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
171
196
  * exposed by this class execute synchronously.
@@ -181,6 +206,38 @@ declare module "node:sqlite" {
181
206
  * @param options Configuration options for the database connection.
182
207
  */
183
208
  constructor(path: string | Buffer | URL, options?: DatabaseSyncOptions);
209
+ /**
210
+ * Registers a new aggregate function with the SQLite database. This method is a wrapper around
211
+ * [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
212
+ *
213
+ * When used as a window function, the `result` function will be called multiple times.
214
+ *
215
+ * ```js
216
+ * import { DatabaseSync } from 'node:sqlite';
217
+ *
218
+ * const db = new DatabaseSync(':memory:');
219
+ * db.exec(`
220
+ * CREATE TABLE t3(x, y);
221
+ * INSERT INTO t3 VALUES ('a', 4),
222
+ * ('b', 5),
223
+ * ('c', 3),
224
+ * ('d', 8),
225
+ * ('e', 1);
226
+ * `);
227
+ *
228
+ * db.aggregate('sumint', {
229
+ * start: 0,
230
+ * step: (acc, value) => acc + value,
231
+ * });
232
+ *
233
+ * db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 }
234
+ * ```
235
+ * @since v22.16.0
236
+ * @param name The name of the SQLite function to create.
237
+ * @param options Function configuration settings.
238
+ */
239
+ aggregate(name: string, options: AggregateOptions): void;
240
+ aggregate<T extends SQLInputValue>(name: string, options: AggregateOptions<T>): void;
184
241
  /**
185
242
  * Closes the database connection. An exception is thrown if the database is not
186
243
  * open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html).
@@ -203,6 +260,15 @@ declare module "node:sqlite" {
203
260
  * @param allow Whether to allow loading extensions.
204
261
  */
205
262
  enableLoadExtension(allow: boolean): void;
263
+ /**
264
+ * This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
265
+ * @since v22.16.0
266
+ * @param dbName Name of the database. This can be `'main'` (the default primary database) or any other
267
+ * database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`.
268
+ * @returns The location of the database file. When using an in-memory database,
269
+ * this method returns null.
270
+ */
271
+ location(dbName?: string): string | null;
206
272
  /**
207
273
  * This method allows one or more SQL statements to be executed without returning
208
274
  * any results. This method is useful when executing SQL statements read from a
@@ -234,6 +300,12 @@ declare module "node:sqlite" {
234
300
  * @since v22.15.0
235
301
  */
236
302
  readonly isOpen: boolean;
303
+ /**
304
+ * Whether the database is currently within a transaction. This method
305
+ * is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).
306
+ * @since v22.16.0
307
+ */
308
+ readonly isTransaction: boolean;
237
309
  /**
238
310
  * Opens the database specified in the `path` argument of the `DatabaseSync`constructor. This method should only be used when the database is not opened via
239
311
  * the constructor. An exception is thrown if the database is already open.
@@ -322,6 +394,38 @@ declare module "node:sqlite" {
322
394
  */
323
395
  close(): void;
324
396
  }
397
+ interface StatementColumnMetadata {
398
+ /**
399
+ * The unaliased name of the column in the origin
400
+ * table, or `null` if the column is the result of an expression or subquery.
401
+ * This property is the result of [`sqlite3_column_origin_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
402
+ */
403
+ column: string | null;
404
+ /**
405
+ * The unaliased name of the origin database, or
406
+ * `null` if the column is the result of an expression or subquery. This
407
+ * property is the result of [`sqlite3_column_database_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
408
+ */
409
+ database: string | null;
410
+ /**
411
+ * The name assigned to the column in the result set of a
412
+ * `SELECT` statement. This property is the result of
413
+ * [`sqlite3_column_name()`](https://www.sqlite.org/c3ref/column_name.html).
414
+ */
415
+ name: string;
416
+ /**
417
+ * The unaliased name of the origin table, or `null` if
418
+ * the column is the result of an expression or subquery. This property is the
419
+ * result of [`sqlite3_column_table_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
420
+ */
421
+ table: string | null;
422
+ /**
423
+ * The declared data type of the column, or `null` if the
424
+ * column is the result of an expression or subquery. This property is the
425
+ * result of [`sqlite3_column_decltype()`](https://www.sqlite.org/c3ref/column_decltype.html).
426
+ */
427
+ type: string | null;
428
+ }
325
429
  interface StatementResultingChanges {
326
430
  /**
327
431
  * The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement.
@@ -366,6 +470,14 @@ declare module "node:sqlite" {
366
470
  namedParameters: Record<string, SQLInputValue>,
367
471
  ...anonymousParameters: SQLInputValue[]
368
472
  ): Record<string, SQLOutputValue>[];
473
+ /**
474
+ * This method is used to retrieve information about the columns returned by the
475
+ * prepared statement.
476
+ * @since v22.16.0
477
+ * @returns An array of objects. Each object corresponds to a column
478
+ * in the prepared statement, and contains the following properties:
479
+ */
480
+ columns(): StatementColumnMetadata[];
369
481
  /**
370
482
  * The source SQL text of the prepared statement with parameter
371
483
  * placeholders replaced by the values that were used during the most recent
@@ -465,6 +577,66 @@ declare module "node:sqlite" {
465
577
  */
466
578
  readonly sourceSQL: string;
467
579
  }
580
+ interface BackupOptions {
581
+ /**
582
+ * Name of the source database. This can be `'main'` (the default primary database) or any other
583
+ * database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
584
+ * @default 'main'
585
+ */
586
+ source?: string | undefined;
587
+ /**
588
+ * Name of the target database. This can be `'main'` (the default primary database) or any other
589
+ * database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
590
+ * @default 'main'
591
+ */
592
+ target?: string | undefined;
593
+ /**
594
+ * Number of pages to be transmitted in each batch of the backup.
595
+ * @default 100
596
+ */
597
+ rate?: number | undefined;
598
+ /**
599
+ * Callback function that will be called with the number of pages copied and the total number of
600
+ * pages.
601
+ */
602
+ progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
603
+ }
604
+ interface BackupProgressInfo {
605
+ totalPages: number;
606
+ remainingPages: number;
607
+ }
608
+ /**
609
+ * This method makes a database backup. This method abstracts the
610
+ * [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit),
611
+ * [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
612
+ * and [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions.
613
+ *
614
+ * The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same
615
+ * `DatabaseSync` - object will be reflected in the backup right away. However, mutations from other connections will cause
616
+ * the backup process to restart.
617
+ *
618
+ * ```js
619
+ * import { backup, DatabaseSync } from 'node:sqlite';
620
+ *
621
+ * const sourceDb = new DatabaseSync('source.db');
622
+ * const totalPagesTransferred = await backup(sourceDb, 'backup.db', {
623
+ * rate: 1, // Copy one page at a time.
624
+ * progress: ({ totalPages, remainingPages }) => {
625
+ * console.log('Backup in progress', { totalPages, remainingPages });
626
+ * },
627
+ * });
628
+ *
629
+ * console.log('Backup completed', totalPagesTransferred);
630
+ * ```
631
+ * @since v22.16.0
632
+ * @param sourceDb The database to backup. The source database must be open.
633
+ * @param path The path where the backup will be created. If the file already exists,
634
+ * the contents will be overwritten.
635
+ * @param options Optional configuration for the backup. The
636
+ * following properties are supported:
637
+ * @returns A promise that resolves when the backup is completed and rejects if an error occurs.
638
+ */
639
+ function backup(sourceDb: DatabaseSync, path: string | Buffer | URL, options?: BackupOptions): Promise<void>;
468
640
  /**
469
641
  * @since v22.13.0
470
642
  */