@zuplo/cli 6.71.21 → 6.71.23

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 (109) hide show
  1. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.d.ts.map +1 -1
  2. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.js +6 -24
  3. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.mjs +7 -25
  4. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +6 -0
  5. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
  6. package/node_modules/@posthog/core/dist/posthog-core-stateless.js +75 -17
  7. package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +73 -18
  8. package/node_modules/@posthog/core/dist/posthog-core.d.ts +2 -2
  9. package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
  10. package/node_modules/@posthog/core/dist/posthog-core.js +10 -6
  11. package/node_modules/@posthog/core/dist/posthog-core.mjs +11 -7
  12. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts +1 -0
  13. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts.map +1 -1
  14. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.js +3 -0
  15. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.mjs +3 -0
  16. package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts +3 -0
  17. package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts.map +1 -1
  18. package/node_modules/@posthog/core/dist/utils/promise-queue.js +15 -3
  19. package/node_modules/@posthog/core/dist/utils/promise-queue.mjs +15 -3
  20. package/node_modules/@posthog/core/dist/utils/string-utils.d.ts +1 -0
  21. package/node_modules/@posthog/core/dist/utils/string-utils.d.ts.map +1 -1
  22. package/node_modules/@posthog/core/dist/utils/string-utils.js +21 -0
  23. package/node_modules/@posthog/core/dist/utils/string-utils.mjs +19 -1
  24. package/node_modules/@posthog/core/package.json +1 -1
  25. package/node_modules/@posthog/core/src/error-tracking/exception-steps.ts +5 -42
  26. package/node_modules/@posthog/core/src/posthog-core-stateless.ts +118 -23
  27. package/node_modules/@posthog/core/src/posthog-core.ts +18 -7
  28. package/node_modules/@posthog/core/src/testing/PostHogCoreTestClient.ts +4 -0
  29. package/node_modules/@posthog/core/src/utils/promise-queue.ts +17 -4
  30. package/node_modules/@posthog/core/src/utils/string-utils.spec.ts +38 -1
  31. package/node_modules/@posthog/core/src/utils/string-utils.ts +42 -0
  32. package/node_modules/@posthog/types/dist/posthog.d.ts +12 -0
  33. package/node_modules/@posthog/types/dist/posthog.d.ts.map +1 -1
  34. package/node_modules/@posthog/types/package.json +1 -1
  35. package/node_modules/@posthog/types/src/posthog.ts +13 -0
  36. package/node_modules/@types/node/README.md +1 -1
  37. package/node_modules/@types/node/buffer.d.ts +64 -25
  38. package/node_modules/@types/node/crypto.d.ts +18 -5
  39. package/node_modules/@types/node/diagnostics_channel.d.ts +237 -3
  40. package/node_modules/@types/node/dns.d.ts +1 -1
  41. package/node_modules/@types/node/ffi.d.ts +486 -0
  42. package/node_modules/@types/node/fs/promises.d.ts +3 -0
  43. package/node_modules/@types/node/fs.d.ts +21 -6
  44. package/node_modules/@types/node/http.d.ts +25 -0
  45. package/node_modules/@types/node/index.d.ts +1 -0
  46. package/node_modules/@types/node/package.json +2 -2
  47. package/node_modules/@types/node/process.d.ts +14 -1
  48. package/node_modules/@types/node/quic.d.ts +92 -11
  49. package/node_modules/@types/node/sqlite.d.ts +55 -0
  50. package/node_modules/@types/node/stream/iter.d.ts +150 -0
  51. package/node_modules/@types/node/stream.d.ts +32 -0
  52. package/node_modules/@types/node/test.d.ts +112 -2
  53. package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
  54. package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
  55. package/node_modules/@types/node/util.d.ts +19 -2
  56. package/node_modules/@types/node/v8.d.ts +84 -2
  57. package/node_modules/@types/node/worker_threads.d.ts +8 -7
  58. package/node_modules/@zuplo/core/customer.cli.minified.js +2 -2
  59. package/node_modules/@zuplo/core/index.minified.js +2 -2
  60. package/node_modules/@zuplo/core/package.json +1 -1
  61. package/node_modules/@zuplo/graphql/out/esm/index.js +11 -11
  62. package/node_modules/@zuplo/graphql/out/esm/index.js.map +1 -1
  63. package/node_modules/@zuplo/graphql/package.json +1 -1
  64. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  65. package/node_modules/@zuplo/otel/package.json +1 -1
  66. package/node_modules/@zuplo/runtime/out/esm/{chunk-DQ4ANJLR.js → chunk-4MNJC7E2.js} +2 -2
  67. package/node_modules/@zuplo/runtime/out/esm/chunk-4MNJC7E2.js.map +1 -0
  68. package/node_modules/@zuplo/runtime/out/esm/{chunk-2Y72LML3.js → chunk-4QJJMELB.js} +2 -2
  69. package/node_modules/@zuplo/runtime/out/esm/{chunk-2Y72LML3.js.map → chunk-4QJJMELB.js.map} +1 -1
  70. package/node_modules/@zuplo/runtime/out/esm/chunk-5CYWMN74.js +402 -0
  71. package/node_modules/@zuplo/runtime/out/esm/chunk-5CYWMN74.js.map +1 -0
  72. package/node_modules/@zuplo/runtime/out/esm/{chunk-L3MZGNQA.js → chunk-DSZS6PZJ.js} +10 -10
  73. package/node_modules/@zuplo/runtime/out/esm/chunk-DSZS6PZJ.js.map +1 -0
  74. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  75. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  76. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  77. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +7 -7
  78. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  79. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  80. package/node_modules/@zuplo/runtime/out/types/index.d.ts +1050 -18
  81. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +33 -7
  82. package/node_modules/@zuplo/runtime/package.json +1 -1
  83. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  84. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  85. package/node_modules/iconv-lite/package.json +2 -2
  86. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  87. package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
  88. package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
  89. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  90. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  91. package/node_modules/protobufjs/dist/protobuf.js +5 -2
  92. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  93. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  94. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  95. package/node_modules/protobufjs/package.json +1 -1
  96. package/node_modules/protobufjs/src/parse.js +3 -0
  97. package/node_modules/toad-cache/README.md +10 -9
  98. package/node_modules/toad-cache/dist/toad-cache.cjs +139 -139
  99. package/node_modules/toad-cache/dist/toad-cache.mjs +136 -140
  100. package/node_modules/toad-cache/package.json +8 -8
  101. package/node_modules/toad-cache/toad-cache.d.cts +20 -14
  102. package/node_modules/toad-cache/toad-cache.d.ts +18 -14
  103. package/package.json +6 -6
  104. package/node_modules/@zuplo/runtime/out/esm/chunk-DQ4ANJLR.js.map +0 -1
  105. package/node_modules/@zuplo/runtime/out/esm/chunk-I5HLAHUY.js +0 -357
  106. package/node_modules/@zuplo/runtime/out/esm/chunk-I5HLAHUY.js.map +0 -1
  107. package/node_modules/@zuplo/runtime/out/esm/chunk-L3MZGNQA.js.map +0 -1
  108. /package/node_modules/@zuplo/runtime/out/esm/{chunk-I5HLAHUY.js.LEGAL.txt → chunk-5CYWMN74.js.LEGAL.txt} +0 -0
  109. /package/node_modules/@zuplo/runtime/out/esm/{chunk-L3MZGNQA.js.LEGAL.txt → chunk-DSZS6PZJ.js.LEGAL.txt} +0 -0
@@ -123,6 +123,13 @@ declare module "node:quic" {
123
123
  */
124
124
  maxDatagramFrameSize?: bigint | number | undefined;
125
125
  }
126
+ interface SNIEntry {
127
+ keys: KeyObject | readonly KeyObject[];
128
+ certs: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView>;
129
+ ca?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
130
+ crl?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
131
+ verifyPrivateKey?: boolean | undefined;
132
+ }
126
133
  /**
127
134
  * @since v23.8.0
128
135
  */
@@ -133,12 +140,25 @@ declare module "node:quic" {
133
140
  */
134
141
  endpoint?: EndpointOptions | QuicEndpoint | undefined;
135
142
  /**
136
- * The ALPN protocol identifier.
137
- * @since v23.8.0
143
+ * The ALPN (Application-Layer Protocol Negotiation) identifier(s).
144
+ *
145
+ * For **client** sessions, this is a single string specifying the protocol
146
+ * the client wants to use (e.g. `'h3'`).
147
+ *
148
+ * For **server** sessions, this is an array of protocol names in preference
149
+ * order that the server supports (e.g. `['h3', 'h3-29']`). During the TLS
150
+ * handshake, the server selects the first protocol from its list that the
151
+ * client also supports.
152
+ *
153
+ * The negotiated ALPN determines which Application implementation is used
154
+ * for the session. `'h3'` and `'h3-*'` variants select the HTTP/3
155
+ * application; all other values select the default application.
156
+ * @since v26.1.0
138
157
  */
139
- alpn?: string | undefined;
158
+ alpn?: string | readonly string[] | undefined;
140
159
  /**
141
- * The CA certificates to use for sessions.
160
+ * The CA certificates to use for client sessions. For server sessions, CA
161
+ * certificates are specified per-identity in the `sessionOptions.sni` map.
142
162
  * @since v23.8.0
143
163
  */
144
164
  ca?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
@@ -151,7 +171,8 @@ declare module "node:quic" {
151
171
  */
152
172
  cc?: `${constants.cc}` | undefined;
153
173
  /**
154
- * The TLS certificates to use for sessions.
174
+ * The TLS certificates to use for client sessions. For server sessions,
175
+ * certificates are specified per-identity in the `sessionOptions.sni` map.
155
176
  * @since v23.8.0
156
177
  */
157
178
  certs?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
@@ -161,7 +182,8 @@ declare module "node:quic" {
161
182
  */
162
183
  ciphers?: string | undefined;
163
184
  /**
164
- * The CRL to use for sessions.
185
+ * The CRL to use for client sessions. For server sessions, CRLs are specified
186
+ * per-identity in the `sessionOptions.sni` map.
165
187
  * @since v23.8.0
166
188
  */
167
189
  crl?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
@@ -176,7 +198,8 @@ declare module "node:quic" {
176
198
  */
177
199
  keylog?: boolean | undefined;
178
200
  /**
179
- * The TLS crypto keys to use for sessions.
201
+ * The TLS crypto keys to use for client sessions. For server sessions,
202
+ * keys are specified per-identity in the `sessionOptions.sni` map.
180
203
  * @since v23.8.0
181
204
  */
182
205
  keys?: KeyObject | readonly KeyObject[] | undefined;
@@ -224,10 +247,37 @@ declare module "node:quic" {
224
247
  */
225
248
  handshakeTimeout?: bigint | number | undefined;
226
249
  /**
227
- * The peer server name to target.
228
- * @since v23.8.0
250
+ * The peer server name to target (SNI). Defaults to `'localhost'`.
251
+ * @since v26.1.0
229
252
  */
230
- sni?: string | undefined;
253
+ servername?: string | undefined;
254
+ /**
255
+ * An object mapping host names to TLS identity options for Server Name
256
+ * Indication (SNI) support. This is required for server sessions. The
257
+ * special key `'*'` specifies the default/fallback identity used when
258
+ * no other host name matches. Each entry may contain:
259
+ *
260
+ * ```js
261
+ * const endpoint = await listen(callback, {
262
+ * sni: {
263
+ * '*': { keys: [defaultKey], certs: [defaultCert] },
264
+ * 'api.example.com': { keys: [apiKey], certs: [apiCert] },
265
+ * 'www.example.com': { keys: [wwwKey], certs: [wwwCert], ca: [customCA] },
266
+ * },
267
+ * });
268
+ * ```
269
+ *
270
+ * Shared TLS options (such as `ciphers`, `groups`, `keylog`, and `verifyClient`)
271
+ * are specified at the top level of the session options and apply to all
272
+ * identities. Each SNI entry overrides only the per-identity certificate
273
+ * fields.
274
+ *
275
+ * The SNI map can be replaced at runtime using `endpoint.setSNIContexts()`,
276
+ * which atomically swaps the map for new sessions while existing sessions
277
+ * continue to use their original identity.
278
+ * @since v26.1.0
279
+ */
280
+ sni?: Record<string, SNIEntry> | undefined;
231
281
  /**
232
282
  * True to enable TLS tracing output.
233
283
  * @since v23.8.0
@@ -249,7 +299,9 @@ declare module "node:quic" {
249
299
  */
250
300
  verifyClient?: boolean | undefined;
251
301
  /**
252
- * True to require private key verification.
302
+ * True to require private key verification for client sessions. For server
303
+ * sessions, this option is specified per-identity in the
304
+ * `sessionOptions.sni` map.
253
305
  * @since v23.8.0
254
306
  */
255
307
  verifyPrivateKey?: boolean | undefined;
@@ -406,6 +458,9 @@ declare module "node:quic" {
406
458
  */
407
459
  validateAddress?: boolean | undefined;
408
460
  }
461
+ interface SetSNIContextsOptions {
462
+ replace?: boolean | undefined;
463
+ }
409
464
  /**
410
465
  * A `QuicEndpoint` encapsulates the local UDP-port binding for QUIC. It can be
411
466
  * used as both a client and a server.
@@ -468,6 +523,32 @@ declare module "node:quic" {
468
523
  * @since v23.8.0
469
524
  */
470
525
  readonly destroyed: boolean;
526
+ /**
527
+ * True if the endpoint is actively listening for incoming connections. Read only.
528
+ * @since v26.1.0
529
+ */
530
+ readonly listening: boolean;
531
+ /**
532
+ * Replaces or updates the SNI TLS contexts for this endpoint. This allows
533
+ * changing the TLS identity (key/certificate) used for specific host names
534
+ * without restarting the endpoint. Existing sessions are unaffected — only
535
+ * new sessions will use the updated contexts.
536
+ *
537
+ * ```js
538
+ * endpoint.setSNIContexts({
539
+ * 'api.example.com': { keys: [newApiKey], certs: [newApiCert] },
540
+ * });
541
+ *
542
+ * // Replace the entire SNI map
543
+ * endpoint.setSNIContexts({
544
+ * 'api.example.com': { keys: [newApiKey], certs: [newApiCert] },
545
+ * }, { replace: true });
546
+ * ```
547
+ * @since v26.1.0
548
+ * @param entries An object mapping host names to TLS identity options.
549
+ * Each entry must include `keys` and `certs`.
550
+ */
551
+ setSNIContexts(entries: Record<string, SNIEntry>, options?: SetSNIContextsOptions): void;
471
552
  /**
472
553
  * The statistics collected for an active session. Read only.
473
554
  * @since v23.8.0
@@ -158,6 +158,13 @@ declare module "node:sqlite" {
158
158
  */
159
159
  onConflict?: ((conflictType: number) => number) | undefined;
160
160
  }
161
+ interface DeserializeOptions {
162
+ /**
163
+ * Name of the database to deserialize into.
164
+ * @default 'main'
165
+ */
166
+ dbName?: string | undefined;
167
+ }
161
168
  interface FunctionOptions {
162
169
  /**
163
170
  * If `true`, the [`SQLITE_DETERMINISTIC`](https://www.sqlite.org/c3ref/c_deterministic.html) flag is
@@ -445,6 +452,54 @@ declare module "node:sqlite" {
445
452
  * @since v22.5.0
446
453
  */
447
454
  open(): void;
455
+ /**
456
+ * Serializes the database into a binary representation, returned as a
457
+ * `Uint8Array`. This is useful for saving, cloning, or transferring an in-memory
458
+ * database. This method is a wrapper around [`sqlite3_serialize()`](https://sqlite.org/c3ref/serialize.html).
459
+ *
460
+ * ```js
461
+ * import { DatabaseSync } from 'node:sqlite';
462
+ *
463
+ * const db = new DatabaseSync(':memory:');
464
+ * db.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');
465
+ * db.exec("INSERT INTO t VALUES (1, 'hello')");
466
+ * const buffer = db.serialize();
467
+ * console.log(buffer.length); // Prints the byte length of the database
468
+ * ```
469
+ * @since v26.1.0
470
+ * @param dbName Name of the database to serialize. This can be `'main'`
471
+ * (the default primary database) or any other database that has been added with
472
+ * [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html). **Default:** `'main'`.
473
+ * @returns A binary representation of the database.
474
+ */
475
+ serialize(dbName?: string): NodeJS.NonSharedUint8Array;
476
+ /**
477
+ * Loads a serialized database into this connection, replacing the current
478
+ * database. The deserialized database is writable. Existing prepared statements
479
+ * are finalized before deserialization is attempted, even if the operation
480
+ * subsequently fails. This method is a wrapper around
481
+ * [`sqlite3_deserialize()`](https://sqlite.org/c3ref/deserialize.html).
482
+ *
483
+ * ```js
484
+ * import { DatabaseSync } from 'node:sqlite';
485
+ *
486
+ * const original = new DatabaseSync(':memory:');
487
+ * original.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');
488
+ * original.exec("INSERT INTO t VALUES (1, 'hello')");
489
+ * const buffer = original.serialize();
490
+ * original.close();
491
+ *
492
+ * const clone = new DatabaseSync(':memory:');
493
+ * clone.deserialize(buffer);
494
+ * console.log(clone.prepare('SELECT value FROM t').get());
495
+ * // Prints: { value: 'hello' }
496
+ * ```
497
+ * @since v26.1.0
498
+ * @param buffer A binary representation of a database, such as the
499
+ * output of `database.serialize()`.
500
+ * @param options Optional configuration for the deserialization.
501
+ */
502
+ deserialize(buffer: Uint8Array, options?: DeserializeOptions): void;
448
503
  /**
449
504
  * Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This method is a wrapper
450
505
  * around [`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html).
@@ -1,4 +1,6 @@
1
1
  declare module "node:stream/iter" {
2
+ import { Abortable } from "node:events";
3
+ import { Readable, Writable } from "node:stream";
2
4
  // Symbols and custom typedefs
3
5
  const broadcastProtocol: unique symbol;
4
6
  const drainableProtocol: unique symbol;
@@ -262,6 +264,154 @@ declare module "node:stream/iter" {
262
264
  */
263
265
  function from(input: SyncByteReadableStream | SyncShareable, options?: ShareSyncOptions): SyncShare;
264
266
  }
267
+ /**
268
+ * Converts a classic Readable stream (or duck-typed equivalent) into a
269
+ * stream/iter async iterable source that can be passed to `from()`,
270
+ * `pull()`, `text()`, etc.
271
+ *
272
+ * If the object implements the `toAsyncStreamable` protocol (as
273
+ * `stream.Readable` does), that protocol is used. Otherwise, the function
274
+ * duck-types on `read()` and `on()` (EventEmitter) and wraps the stream with
275
+ * a batched async iterator.
276
+ *
277
+ * The result is cached per instance -- calling `fromReadable()` twice with the
278
+ * same stream returns the same iterable.
279
+ *
280
+ * For object-mode or encoded Readable streams, chunks are automatically
281
+ * normalized to `Uint8Array`.
282
+ *
283
+ * ```js
284
+ * import { Readable } from 'node:stream';
285
+ * import { fromReadable, text } from 'node:stream/iter';
286
+ *
287
+ * const readable = new Readable({
288
+ * read() { this.push('hello world'); this.push(null); },
289
+ * });
290
+ *
291
+ * const result = await text(fromReadable(readable));
292
+ * console.log(result); // 'hello world'
293
+ * ```
294
+ * @since v26.1.0
295
+ * @experimental
296
+ * @param readable A classic Readable stream or any object
297
+ * with `read()` and `on()` methods.
298
+ * @returns A stream/iter async iterable source.
299
+ */
300
+ function fromReadable(readable: NodeJS.ReadableStream): ByteReadableStream;
301
+ interface FromWritableOptions {
302
+ backpressure?: BackpressurePolicy | undefined;
303
+ }
304
+ /**
305
+ * Creates a stream/iter Writer adapter from a classic Writable stream (or
306
+ * duck-typed equivalent). The adapter can be passed to `pipeTo()` as a
307
+ * destination.
308
+ *
309
+ * Since all writes on a classic Writable are fundamentally asynchronous,
310
+ * the synchronous Writer methods (`writeSync`, `writevSync`, `endSync`) always
311
+ * return `false` or `-1`, deferring to the async path. The per-write
312
+ * `options.signal` parameter from the Writer interface is also ignored.
313
+ *
314
+ * The result is cached per instance -- calling `fromWritable()` twice with the
315
+ * same stream returns the same Writer.
316
+ *
317
+ * For duck-typed streams that do not expose `writableHighWaterMark`,
318
+ * `writableLength`, or similar properties, sensible defaults are used.
319
+ * Object-mode writables (if detectable) are rejected since the Writer
320
+ * interface is bytes-only.
321
+ *
322
+ * ```js
323
+ * import { Writable } from 'node:stream';
324
+ * import { from, fromWritable, pipeTo } from 'node:stream/iter';
325
+ *
326
+ * const writable = new Writable({
327
+ * write(chunk, encoding, cb) { console.log(chunk.toString()); cb(); },
328
+ * });
329
+ *
330
+ * await pipeTo(from('hello world'),
331
+ * fromWritable(writable, { backpressure: 'block' }));
332
+ * ```
333
+ * @since v26.1.0
334
+ * @experimental
335
+ * @param writable A classic Writable stream or any object
336
+ * with `write()` and `on()` methods.
337
+ * @returns A stream/iter Writer adapter.
338
+ */
339
+ function fromWritable(writable: NodeJS.WritableStream, options?: FromWritableOptions): Writer;
340
+ interface ToReadableOptions extends Abortable {
341
+ highWaterMark?: number | undefined;
342
+ }
343
+ /**
344
+ * Creates a byte-mode `stream.Readable` from an `AsyncIterable<Uint8Array[]>`
345
+ * (the native batch format used by the stream/iter API). Each `Uint8Array` in a
346
+ * yielded batch is pushed as a separate chunk into the Readable.
347
+ *
348
+ * ```js
349
+ * import { createWriteStream } from 'node:fs';
350
+ * import { from, pull, toReadable } from 'node:stream/iter';
351
+ * import { compressGzip } from 'node:zlib/iter';
352
+ *
353
+ * const source = pull(from('hello world'), compressGzip());
354
+ * const readable = toReadable(source);
355
+ *
356
+ * readable.pipe(createWriteStream('output.gz'));
357
+ * ```
358
+ * @since v26.1.0
359
+ * @experimental
360
+ * @param source An `AsyncIterable<Uint8Array[]>` source, such as
361
+ * the return value of `pull()` or `from()`.
362
+ */
363
+ function toReadable(source: Source, options?: ToReadableOptions): Readable;
364
+ interface ToReadableSyncOptions {
365
+ highWaterMark?: number | undefined;
366
+ }
367
+ /**
368
+ * Creates a byte-mode `stream.Readable` from a synchronous
369
+ * `Iterable<Uint8Array[]>`. The `_read()` method pulls from the iterator
370
+ * synchronously, so data is available immediately via `readable.read()`.
371
+ *
372
+ * ```js
373
+ * import { fromSync, toReadableSync } from 'node:stream/iter';
374
+ *
375
+ * const source = fromSync('hello world');
376
+ * const readable = toReadableSync(source);
377
+ *
378
+ * console.log(readable.read().toString()); // 'hello world'
379
+ * ```
380
+ * @since v26.1.0
381
+ * @experimental
382
+ * @param source An `Iterable<Uint8Array[]>` source, such as the
383
+ * return value of `pullSync()` or `fromSync()`.
384
+ */
385
+ function toReadableSync(source: SyncSource, options?: ToReadableSyncOptions): Readable;
386
+ /**
387
+ * Creates a classic `stream.Writable` backed by a stream/iter Writer.
388
+ *
389
+ * Each `_write()` / `_writev()` call attempts the Writer's synchronous method
390
+ * first (`writeSync` / `writevSync`), falling back to the async method if the
391
+ * sync path returns `false` or throws. Similarly, `_final()` tries `endSync()`
392
+ * before `end()`. When the sync path succeeds, the callback is deferred via
393
+ * `queueMicrotask` to preserve the async resolution contract.
394
+ *
395
+ * The Writable's `highWaterMark` is set to `Number.MAX_SAFE_INTEGER` to
396
+ * effectively disable its internal buffering, allowing the underlying Writer
397
+ * to manage backpressure directly.
398
+ *
399
+ * ```js
400
+ * import { push, toWritable } from 'node:stream/iter';
401
+ *
402
+ * const { writer, readable } = push();
403
+ * const writable = toWritable(writer);
404
+ *
405
+ * writable.write('hello');
406
+ * writable.end();
407
+ * ```
408
+ * @since v26.1.0
409
+ * @experimental
410
+ * @param writer A stream/iter Writer. Only the `write()` method is
411
+ * required; `end()`, `fail()`, `writeSync()`, `writevSync()`, `endSync()`,
412
+ * and `writev()` are optional.
413
+ */
414
+ function toWritable(writer: PartialWriter): Writable;
265
415
  namespace Stream {
266
416
  export {
267
417
  array,
@@ -1,6 +1,7 @@
1
1
  declare module "node:stream" {
2
2
  import { Blob } from "node:buffer";
3
3
  import { Abortable, EventEmitter } from "node:events";
4
+ import { ByteReadableStream, toAsyncStreamable } from "node:stream/iter";
4
5
  import * as promises from "node:stream/promises";
5
6
  import * as web from "node:stream/web";
6
7
  class Stream extends EventEmitter {
@@ -651,6 +652,37 @@ declare module "node:stream" {
651
652
  * @since v10.0.0
652
653
  */
653
654
  [Symbol.asyncIterator](): NodeJS.AsyncIterator<any>;
655
+ /**
656
+ * When the `--experimental-stream-iter` flag is enabled, `Readable` streams
657
+ * implement the `Stream.toAsyncStreamable` protocol, enabling efficient
658
+ * consumption by the `stream/iter` API.
659
+ *
660
+ * This provides a batched async iterator that drains the stream's internal
661
+ * buffer into `Uint8Array[]` batches, amortizing the per-chunk Promise overhead
662
+ * of the standard `Symbol.asyncIterator` path. For byte-mode streams, chunks
663
+ * are yielded directly as `Buffer` instances (which are `Uint8Array` subclasses).
664
+ * For object-mode or encoded streams, each chunk is normalized to `Uint8Array`
665
+ * before batching.
666
+ *
667
+ * The returned iterator is tagged as a validated source, so `from()`
668
+ * passes it through without additional normalization.
669
+ *
670
+ * ```js
671
+ * import { Readable } from 'node:stream';
672
+ * import { text, from } from 'node:stream/iter';
673
+ *
674
+ * const readable = new Readable({
675
+ * read() { this.push('hello'); this.push(null); },
676
+ * });
677
+ *
678
+ * // Readable is automatically consumed via toAsyncStreamable
679
+ * console.log(await text(from(readable))); // 'hello'
680
+ * ```
681
+ *
682
+ * Without the `--experimental-stream-iter` flag, calling this method throws
683
+ * `ERR_STREAM_ITER_MISSING_FLAG`.
684
+ */
685
+ [toAsyncStreamable](): ByteReadableStream;
654
686
  /**
655
687
  * Calls `readable.destroy()` with an `AbortError` and returns
656
688
  * a promise that fulfills when the stream is finished.
@@ -280,6 +280,20 @@ declare module "node:test" {
280
280
  * @default undefined
281
281
  */
282
282
  shard?: TestShard | undefined;
283
+ /**
284
+ * Randomize execution order for test files and queued tests.
285
+ * This option is not supported with `watch: true`.
286
+ * @since v26.1.0
287
+ * @default false
288
+ */
289
+ randomize?: boolean | undefined;
290
+ /**
291
+ * Seed used when randomizing execution order. If this
292
+ * option is set, runs can replay the same randomized order deterministically,
293
+ * and setting this option also enables randomization. The value must be an
294
+ * integer between `0` and `4294967295`.
295
+ */
296
+ randomSeed?: number | undefined;
283
297
  /**
284
298
  * A file path where the test runner will
285
299
  * store the state of the tests to allow rerunning only the failed tests on a next run.
@@ -336,7 +350,7 @@ declare module "node:test" {
336
350
  functionCoverage?: number | undefined;
337
351
  /**
338
352
  * Specify environment variables to be passed along to the test process.
339
- * This options is not compatible with `isolation='none'`. These variables will override
353
+ * This option is not compatible with `isolation='none'`. These variables will override
340
354
  * those from the main process, and are not merged with `process.env`.
341
355
  * @since v25.6.0
342
356
  * @default process.env
@@ -654,6 +668,12 @@ declare module "node:test" {
654
668
  * The nesting level of the test.
655
669
  */
656
670
  nesting: number;
671
+ /**
672
+ * A numeric identifier for this test instance, unique
673
+ * within the test file's process. Consistent across all events for the same
674
+ * test instance, enabling reliable correlation in custom reporters.
675
+ */
676
+ testId: number;
657
677
  /**
658
678
  * The ordinal number of the test.
659
679
  */
@@ -676,6 +696,12 @@ declare module "node:test" {
676
696
  * The nesting level of the test.
677
697
  */
678
698
  nesting: number;
699
+ /**
700
+ * A numeric identifier for this test instance, unique
701
+ * within the test file's process. Consistent across all events for the same
702
+ * test instance, enabling reliable correlation in custom reporters.
703
+ */
704
+ testId: number;
679
705
  /**
680
706
  * The test type. Either `'suite'` or `'test'`.
681
707
  * @since v22.15.0
@@ -691,6 +717,12 @@ declare module "node:test" {
691
717
  * The nesting level of the test.
692
718
  */
693
719
  nesting: number;
720
+ /**
721
+ * A numeric identifier for this test instance, unique
722
+ * within the test file's process. Consistent across all events for the same
723
+ * test instance, enabling reliable correlation in custom reporters.
724
+ */
725
+ testId: number;
694
726
  /**
695
727
  * The test type. Either `'suite'` or `'test'`.
696
728
  * @since v22.15.0
@@ -730,6 +762,12 @@ declare module "node:test" {
730
762
  * The nesting level of the test.
731
763
  */
732
764
  nesting: number;
765
+ /**
766
+ * A numeric identifier for this test instance, unique
767
+ * within the test file's process. Consistent across all events for the same
768
+ * test instance, enabling reliable correlation in custom reporters.
769
+ */
770
+ testId: number;
733
771
  /**
734
772
  * The ordinal number of the test.
735
773
  */
@@ -785,6 +823,12 @@ declare module "node:test" {
785
823
  * The nesting level of the test.
786
824
  */
787
825
  nesting: number;
826
+ /**
827
+ * A numeric identifier for this test instance, unique
828
+ * within the test file's process. Consistent across all events for the same
829
+ * test instance, enabling reliable correlation in custom reporters.
830
+ */
831
+ testId: number;
788
832
  /**
789
833
  * The ordinal number of the test.
790
834
  */
@@ -817,6 +861,12 @@ declare module "node:test" {
817
861
  * The nesting level of the test.
818
862
  */
819
863
  nesting: number;
864
+ /**
865
+ * A numeric identifier for this test instance, unique
866
+ * within the test file's process. Consistent across all events for the same
867
+ * test instance, enabling reliable correlation in custom reporters.
868
+ */
869
+ testId: number;
820
870
  }
821
871
  interface TestStderr {
822
872
  /**
@@ -890,6 +940,39 @@ declare module "node:test" {
890
940
  success: boolean;
891
941
  }
892
942
  }
943
+ /**
944
+ * Returns the {@link TestContext} or {@link SuiteContext} object associated with the
945
+ * currently executing test or suite, or `undefined` if called outside of a test or
946
+ * suite. This function can be used to access context information from within the
947
+ * test or suite function or any async operations within them.
948
+
949
+ * ```js
950
+ * import { getTestContext } from 'node:test';
951
+ *
952
+ * test('example test', async () => {
953
+ * const ctx = getTestContext();
954
+ * console.log(`Running test: ${ctx.name}`);
955
+ * });
956
+ *
957
+ * describe('example suite', () => {
958
+ * const ctx = getTestContext();
959
+ * console.log(`Running suite: ${ctx.name}`);
960
+ * });
961
+ * ```
962
+ *
963
+ * When called from a test, returns a `TestContext`.
964
+ * When called from a suite, returns a `SuiteContext`.
965
+ *
966
+ * If called from outside a test or suite (e.g., at the top level of a module or in
967
+ * a setTimeout callback after execution has completed), this function returns
968
+ * `undefined`.
969
+ *
970
+ * When called from within a hook (before, beforeEach, after, afterEach), this
971
+ * function returns the context of the test or suite that the hook is associated
972
+ * with.
973
+ * @since v26.1.0
974
+ */
975
+ function getTestContext(): TestContext | SuiteContext | undefined;
893
976
  /**
894
977
  * An instance of `TestContext` is passed to each test function in order to
895
978
  * interact with the test runner. However, the `TestContext` constructor is not
@@ -993,7 +1076,9 @@ declare module "node:test" {
993
1076
  */
994
1077
  readonly error: EventData.Error | null;
995
1078
  /**
996
- * Number of times the test has been attempted.
1079
+ * The attempt number of the test. This value is zero-based, so the first attempt is `0`,
1080
+ * the second attempt is `1`, and so on. This property is useful in conjunction with the
1081
+ * `--test-rerun-failures` option to determine which attempt the test is currently running.
997
1082
  * @since v21.7.0, v20.12.0
998
1083
  */
999
1084
  readonly attempt: number;
@@ -1294,6 +1379,31 @@ declare module "node:test" {
1294
1379
  * @since v18.7.0, v16.17.0
1295
1380
  */
1296
1381
  readonly signal: AbortSignal;
1382
+ /**
1383
+ * Indicates whether the suite and all of its subtests have passed.
1384
+ * @since v26.1.0
1385
+ */
1386
+ readonly passed: boolean;
1387
+ /**
1388
+ * The attempt number of the suite. This value is zero-based, so the first attempt is `0`,
1389
+ * the second attempt is `1`, and so on. This property is useful in conjunction with the
1390
+ * `--test-rerun-failures` option to determine the attempt number of the current run.
1391
+ * @since v26.1.0
1392
+ */
1393
+ readonly attempt: number;
1394
+ /**
1395
+ * Output a diagnostic message. This is typically used for logging information
1396
+ * about the current suite or its tests.
1397
+ *
1398
+ * ```js
1399
+ * test.describe('my suite', (suite) => {
1400
+ * suite.diagnostic('Suite diagnostic message');
1401
+ * });
1402
+ * ```
1403
+ * @since v26.1.0
1404
+ * @param message A diagnostic message to output.
1405
+ */
1406
+ diagnostic(message: string): void;
1297
1407
  }
1298
1408
  interface TestOptions {
1299
1409
  /**
@@ -68,6 +68,7 @@
68
68
  /// <reference path="../dns/promises.d.ts" />
69
69
  /// <reference path="../domain.d.ts" />
70
70
  /// <reference path="../events.d.ts" />
71
+ /// <reference path="../ffi.d.ts" />
71
72
  /// <reference path="../fs.d.ts" />
72
73
  /// <reference path="../fs/promises.d.ts" />
73
74
  /// <reference path="../http.d.ts" />
@@ -68,6 +68,7 @@
68
68
  /// <reference path="../dns/promises.d.ts" />
69
69
  /// <reference path="../domain.d.ts" />
70
70
  /// <reference path="../events.d.ts" />
71
+ /// <reference path="../ffi.d.ts" />
71
72
  /// <reference path="../fs.d.ts" />
72
73
  /// <reference path="../fs/promises.d.ts" />
73
74
  /// <reference path="../http.d.ts" />