cdk-common 2.1.68 → 2.1.69
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/.jsii +68 -2
- package/API.md +66 -0
- package/lib/main.js +1 -1
- package/lib/managed-policies.d.ts +12 -1
- package/lib/managed-policies.js +12 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +64 -25
- package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +18 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +237 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +19 -6
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +21 -6
- package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +25 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/process.d.ts +14 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/quic.d.ts +92 -11
- package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +55 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/iter.d.ts +150 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +32 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +112 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +19 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +84 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +8 -7
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +64 -25
- package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +18 -5
- package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +237 -3
- package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +19 -6
- package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +21 -6
- package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +25 -0
- package/node_modules/@types/form-data/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/process.d.ts +14 -1
- package/node_modules/@types/form-data/node_modules/@types/node/quic.d.ts +92 -11
- package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +55 -0
- package/node_modules/@types/form-data/node_modules/@types/node/stream/iter.d.ts +150 -0
- package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +32 -0
- package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +112 -2
- package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/form-data/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +19 -2
- package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +84 -2
- package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +8 -7
- package/node_modules/fast-uri/index.js +1 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +28 -0
- package/node_modules/sync-rpc/lib/index.js +6 -2
- package/node_modules/sync-rpc/lib/worker.js +16 -9
- package/node_modules/sync-rpc/package.json +1 -1
- package/package.json +4 -4
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated: Wed,
|
|
11
|
+
* Last updated: Wed, 08 Jul 2026 06:47:45 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -1550,11 +1550,12 @@ declare module "node:buffer" {
|
|
|
1550
1550
|
/**
|
|
1551
1551
|
* If `value` is:
|
|
1552
1552
|
*
|
|
1553
|
-
* * a string, `value` is interpreted according to the character encoding in
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1553
|
+
* * a string, `value` is interpreted according to the character encoding in
|
|
1554
|
+
* `encoding`.
|
|
1555
|
+
* * a `Buffer` or `Uint8Array`, `value` will be used in its entirety.
|
|
1556
|
+
* To compare a partial `Buffer`, use `buf.subarray`.
|
|
1556
1557
|
* * a number, `value` will be interpreted as an unsigned 8-bit integer
|
|
1557
|
-
*
|
|
1558
|
+
* value between `0` and `255`.
|
|
1558
1559
|
*
|
|
1559
1560
|
* ```js
|
|
1560
1561
|
* import { Buffer } from 'node:buffer';
|
|
@@ -1582,12 +1583,13 @@ declare module "node:buffer" {
|
|
|
1582
1583
|
* // Prints: 6
|
|
1583
1584
|
* ```
|
|
1584
1585
|
*
|
|
1585
|
-
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1586
|
+
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1587
|
+
* `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
|
1586
1588
|
* an integer between 0 and 255.
|
|
1587
1589
|
*
|
|
1588
1590
|
* If `byteOffset` is not a number, it will be coerced to a number. If the result
|
|
1589
1591
|
* of coercion is `NaN` or `0`, then the entire buffer will be searched. This
|
|
1590
|
-
* behavior matches
|
|
1592
|
+
* behavior matches `String.prototype.indexOf()`.
|
|
1591
1593
|
*
|
|
1592
1594
|
* ```js
|
|
1593
1595
|
* import { Buffer } from 'node:buffer';
|
|
@@ -1608,14 +1610,27 @@ declare module "node:buffer" {
|
|
|
1608
1610
|
* ```
|
|
1609
1611
|
*
|
|
1610
1612
|
* If `value` is an empty string or empty `Buffer` and `byteOffset` is less
|
|
1611
|
-
* than `buf.length`, `byteOffset` will be returned. If `value` is empty and
|
|
1613
|
+
* than `buf.length`, `byteOffset` will be returned. If `value` is empty and
|
|
1614
|
+
* `byteOffset` is at least `buf.length`, `buf.length` will be returned.
|
|
1612
1615
|
* @since v1.5.0
|
|
1613
1616
|
* @param value What to search for.
|
|
1614
|
-
* @param
|
|
1615
|
-
*
|
|
1616
|
-
* @
|
|
1617
|
-
|
|
1618
|
-
|
|
1617
|
+
* @param start Where to begin searching in `buf`. If negative, then
|
|
1618
|
+
* offset is calculated from the end of `buf`. **Default:** `0`.
|
|
1619
|
+
* @param end Where to stop searching in `buf` (exclusive). **Default:**
|
|
1620
|
+
* `buf.length`.
|
|
1621
|
+
* @param encoding If `value` is a string, this is the encoding used to
|
|
1622
|
+
* determine the binary representation of the string that will be searched for in
|
|
1623
|
+
* `buf`. **Default:** `'utf8'`.
|
|
1624
|
+
* @returns The index of the first occurrence of `value` in `buf`, or
|
|
1625
|
+
* `-1` if `buf` does not contain `value`.
|
|
1626
|
+
*/
|
|
1627
|
+
indexOf(
|
|
1628
|
+
value: string | number | Uint8Array,
|
|
1629
|
+
start?: number,
|
|
1630
|
+
end?: number,
|
|
1631
|
+
encoding?: BufferEncoding,
|
|
1632
|
+
): number;
|
|
1633
|
+
indexOf(value: string | number | Uint8Array, start: number, encoding: BufferEncoding): number;
|
|
1619
1634
|
indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1620
1635
|
/**
|
|
1621
1636
|
* Identical to `buf.indexOf()`, except the last occurrence of `value` is found
|
|
@@ -1649,12 +1664,13 @@ declare module "node:buffer" {
|
|
|
1649
1664
|
* // Prints: 4
|
|
1650
1665
|
* ```
|
|
1651
1666
|
*
|
|
1652
|
-
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1667
|
+
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1668
|
+
* `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
|
1653
1669
|
* an integer between 0 and 255.
|
|
1654
1670
|
*
|
|
1655
1671
|
* If `byteOffset` is not a number, it will be coerced to a number. Any arguments
|
|
1656
1672
|
* that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer.
|
|
1657
|
-
* This behavior matches
|
|
1673
|
+
* This behavior matches `String.prototype.lastIndexOf()`.
|
|
1658
1674
|
*
|
|
1659
1675
|
* ```js
|
|
1660
1676
|
* import { Buffer } from 'node:buffer';
|
|
@@ -1680,11 +1696,24 @@ declare module "node:buffer" {
|
|
|
1680
1696
|
* If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned.
|
|
1681
1697
|
* @since v6.0.0
|
|
1682
1698
|
* @param value What to search for.
|
|
1683
|
-
* @param
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1686
|
-
|
|
1687
|
-
|
|
1699
|
+
* @param start Where to begin searching in `buf`. If negative, then
|
|
1700
|
+
* offset is calculated from the end of `buf`. **Default:**
|
|
1701
|
+
* `buf.length - 1`.
|
|
1702
|
+
* @param end Where to stop searching in `buf` (exclusive). **Default:**
|
|
1703
|
+
* `buf.length`.
|
|
1704
|
+
* @param encoding If `value` is a string, this is the encoding used to
|
|
1705
|
+
* determine the binary representation of the string that will be searched for in
|
|
1706
|
+
* `buf`. **Default:** `'utf8'`.
|
|
1707
|
+
* @returns The index of the last occurrence of `value` in `buf`, or
|
|
1708
|
+
* `-1` if `buf` does not contain `value`.
|
|
1709
|
+
*/
|
|
1710
|
+
lastIndexOf(
|
|
1711
|
+
value: string | number | Uint8Array,
|
|
1712
|
+
start?: number,
|
|
1713
|
+
end?: number,
|
|
1714
|
+
encoding?: BufferEncoding,
|
|
1715
|
+
): number;
|
|
1716
|
+
lastIndexOf(value: string | number | Uint8Array, start: number, encoding: BufferEncoding): number;
|
|
1688
1717
|
lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1689
1718
|
/**
|
|
1690
1719
|
* Equivalent to `buf.indexOf() !== -1`.
|
|
@@ -1711,12 +1740,22 @@ declare module "node:buffer" {
|
|
|
1711
1740
|
* ```
|
|
1712
1741
|
* @since v5.3.0
|
|
1713
1742
|
* @param value What to search for.
|
|
1714
|
-
* @param
|
|
1715
|
-
*
|
|
1716
|
-
* @
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1743
|
+
* @param start Where to begin searching in `buf`. If negative, then
|
|
1744
|
+
* offset is calculated from the end of `buf`. **Default:** `0`.
|
|
1745
|
+
* @param end Where to stop searching in `buf` (exclusive). **Default:**
|
|
1746
|
+
* `buf.length`.
|
|
1747
|
+
* @param encoding If `value` is a string, this is its encoding.
|
|
1748
|
+
* **Default:** `'utf8'`.
|
|
1749
|
+
* @returns `true` if `value` was found in `buf`, `false` otherwise.
|
|
1750
|
+
*/
|
|
1751
|
+
includes(
|
|
1752
|
+
value: string | number | Uint8Array,
|
|
1753
|
+
start?: number,
|
|
1754
|
+
end?: number,
|
|
1755
|
+
encoding?: BufferEncoding,
|
|
1756
|
+
): boolean;
|
|
1757
|
+
includes(value: string | number | Uint8Array, start: number, encoding: BufferEncoding): boolean;
|
|
1758
|
+
includes(value: string | number | Uint8Array, encoding: BufferEncoding): boolean;
|
|
1720
1759
|
}
|
|
1721
1760
|
var Buffer: BufferConstructor;
|
|
1722
1761
|
}
|
|
@@ -1373,9 +1373,9 @@ declare module "node:crypto" {
|
|
|
1373
1373
|
*/
|
|
1374
1374
|
update(data: string | NodeJS.ArrayBufferView, inputEncoding?: BufferEncoding): Verify;
|
|
1375
1375
|
/**
|
|
1376
|
-
* Verifies the provided data using the given `
|
|
1376
|
+
* Verifies the provided data using the given `key` and `signature`.
|
|
1377
1377
|
*
|
|
1378
|
-
* If `
|
|
1378
|
+
* If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an
|
|
1379
1379
|
* object, the following additional properties can be passed:
|
|
1380
1380
|
*
|
|
1381
1381
|
* The `signature` argument is the previously calculated signature for the data, in
|
|
@@ -1392,7 +1392,7 @@ declare module "node:crypto" {
|
|
|
1392
1392
|
* @since v0.1.92
|
|
1393
1393
|
*/
|
|
1394
1394
|
verify(
|
|
1395
|
-
|
|
1395
|
+
key:
|
|
1396
1396
|
| KeyLike
|
|
1397
1397
|
| VerifyKeyObjectInput
|
|
1398
1398
|
| VerifyPublicKeyInput
|
|
@@ -1470,8 +1470,10 @@ declare module "node:crypto" {
|
|
|
1470
1470
|
* If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
|
|
1471
1471
|
*
|
|
1472
1472
|
* This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular,
|
|
1473
|
-
* once a private key has been generated or set, calling this function only
|
|
1474
|
-
* the public key
|
|
1473
|
+
* once a private key has been generated or set, calling this function only
|
|
1474
|
+
* recomputes the public key from the existing private key. Since the public key is
|
|
1475
|
+
* determined by the private key, the result will be the same unless the private key
|
|
1476
|
+
* has been changed via `diffieHellman.setPrivateKey()`.
|
|
1475
1477
|
* @since v0.5.0
|
|
1476
1478
|
* @param encoding The `encoding` of the return value.
|
|
1477
1479
|
*/
|
|
@@ -2997,6 +2999,7 @@ declare module "node:crypto" {
|
|
|
2997
2999
|
*/
|
|
2998
3000
|
disableEntropyCache?: boolean | undefined;
|
|
2999
3001
|
}
|
|
3002
|
+
interface RandomUUIDV7Options extends RandomUUIDOptions {}
|
|
3000
3003
|
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
3001
3004
|
/**
|
|
3002
3005
|
* Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
|
|
@@ -3004,6 +3007,16 @@ declare module "node:crypto" {
|
|
|
3004
3007
|
* @since v15.6.0, v14.17.0
|
|
3005
3008
|
*/
|
|
3006
3009
|
function randomUUID(options?: RandomUUIDOptions): UUID;
|
|
3010
|
+
/**
|
|
3011
|
+
* Generates a random [RFC 9562](https://www.rfc-editor.org/rfc/rfc9562.txt) version 7 UUID. The UUID contains a millisecond
|
|
3012
|
+
* precision Unix timestamp in the most significant 48 bits, followed by
|
|
3013
|
+
* cryptographically secure random bits for the remaining fields, making it
|
|
3014
|
+
* suitable for use as a database key with time-based sorting. The embedded
|
|
3015
|
+
* timestamp relies on a non-monotonic clock and is not guaranteed to be strictly
|
|
3016
|
+
* increasing.
|
|
3017
|
+
* @since v26.1.0
|
|
3018
|
+
*/
|
|
3019
|
+
function randomUUIDv7(options?: RandomUUIDV7Options): UUID;
|
|
3007
3020
|
interface X509CheckOptions {
|
|
3008
3021
|
subject?: "always" | "default" | "never" | undefined;
|
|
3009
3022
|
wildcards?: boolean | undefined;
|
|
@@ -102,6 +102,36 @@ declare module "node:diagnostics_channel" {
|
|
|
102
102
|
function tracingChannel<ContextType extends object = object, StoreType = ContextType>(
|
|
103
103
|
nameOrChannels: string | TracingChannelCollection<ContextType, StoreType>,
|
|
104
104
|
): TracingChannel<ContextType, StoreType>;
|
|
105
|
+
/**
|
|
106
|
+
* Creates a {@link BoundedChannel} wrapper for the given channels. If a name is
|
|
107
|
+
* given, the corresponding channels will be created in the form of
|
|
108
|
+
* `tracing:${name}:${eventType}` where `eventType` is `start` or `end`.
|
|
109
|
+
*
|
|
110
|
+
* A `BoundedChannel` is a simplified version of {@link TracingChannel} that only
|
|
111
|
+
* traces synchronous operations. It only has `start` and `end` events, without
|
|
112
|
+
* `asyncStart`, `asyncEnd`, or `error` events, making it suitable for tracing
|
|
113
|
+
* operations that don't involve asynchronous continuations or error handling.
|
|
114
|
+
*
|
|
115
|
+
* ```js
|
|
116
|
+
* import { boundedChannel, channel } from 'node:diagnostics_channel';
|
|
117
|
+
*
|
|
118
|
+
* const wc = boundedChannel('my-operation');
|
|
119
|
+
*
|
|
120
|
+
* // or...
|
|
121
|
+
*
|
|
122
|
+
* const wc2 = boundedChannel({
|
|
123
|
+
* start: channel('tracing:my-operation:start'),
|
|
124
|
+
* end: channel('tracing:my-operation:end'),
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
* @since v26.1.0
|
|
128
|
+
* @experimental
|
|
129
|
+
* @param nameOrChannels Channel name or
|
|
130
|
+
* object containing all the [BoundedChannel Channels](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html#boundedchannel-channels)
|
|
131
|
+
*/
|
|
132
|
+
function boundedChannel<ContextType extends object = object, StoreType = ContextType>(
|
|
133
|
+
nameOrChannels: string | BoundedChannelCollection<ContextType, StoreType>,
|
|
134
|
+
): BoundedChannel<ContextType, StoreType>;
|
|
105
135
|
/**
|
|
106
136
|
* The class `Channel` represents an individual named channel within the data
|
|
107
137
|
* pipeline. It is used to track subscribers and to publish messages when there
|
|
@@ -112,6 +142,7 @@ declare module "node:diagnostics_channel" {
|
|
|
112
142
|
* @since v15.1.0, v14.17.0
|
|
113
143
|
*/
|
|
114
144
|
class Channel<ContextType = any, StoreType = ContextType> {
|
|
145
|
+
private constructor();
|
|
115
146
|
readonly name: string | symbol;
|
|
116
147
|
/**
|
|
117
148
|
* Check if there are active subscribers to this channel. This is helpful if
|
|
@@ -132,7 +163,6 @@ declare module "node:diagnostics_channel" {
|
|
|
132
163
|
* @since v15.1.0, v14.17.0
|
|
133
164
|
*/
|
|
134
165
|
readonly hasSubscribers: boolean;
|
|
135
|
-
private constructor(name: string | symbol);
|
|
136
166
|
/**
|
|
137
167
|
* Publish a message to any subscribers to the channel. This will trigger
|
|
138
168
|
* message handlers synchronously so they will execute within the same context.
|
|
@@ -277,7 +307,48 @@ declare module "node:diagnostics_channel" {
|
|
|
277
307
|
thisArg?: ThisArg,
|
|
278
308
|
...args: Args
|
|
279
309
|
): Result;
|
|
310
|
+
/**
|
|
311
|
+
* Creates a disposable scope that binds the given data to any AsyncLocalStorage
|
|
312
|
+
* instances bound to the channel and publishes it to subscribers. The scope
|
|
313
|
+
* automatically restores the previous storage contexts when disposed.
|
|
314
|
+
*
|
|
315
|
+
* This method enables the use of JavaScript's explicit resource management
|
|
316
|
+
* (`using` syntax with `Symbol.dispose`) to manage store contexts without
|
|
317
|
+
* closure wrapping.
|
|
318
|
+
*
|
|
319
|
+
* ```js
|
|
320
|
+
* import { channel } from 'node:diagnostics_channel';
|
|
321
|
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
|
322
|
+
*
|
|
323
|
+
* const store = new AsyncLocalStorage();
|
|
324
|
+
* const ch = channel('my-channel');
|
|
325
|
+
*
|
|
326
|
+
* ch.bindStore(store, (message) => {
|
|
327
|
+
* return { ...message, timestamp: Date.now() };
|
|
328
|
+
* });
|
|
329
|
+
*
|
|
330
|
+
* {
|
|
331
|
+
* using scope = ch.withStoreScope({ request: 'data' });
|
|
332
|
+
* // Store is entered, data is published
|
|
333
|
+
* console.log(store.getStore()); // { request: 'data', timestamp: ... }
|
|
334
|
+
* }
|
|
335
|
+
* // Store is automatically restored on scope exit
|
|
336
|
+
* ```
|
|
337
|
+
* @since v26.1.0
|
|
338
|
+
* @experimental
|
|
339
|
+
*/
|
|
340
|
+
withStoreScope(data: ContextType): RunStoresScope;
|
|
280
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* The class `RunStoresScope` represents a disposable scope created by
|
|
344
|
+
* `channel.withStoreScope(data)`. It manages the lifecycle of store
|
|
345
|
+
* contexts and ensures they are properly restored when the scope exits.
|
|
346
|
+
*
|
|
347
|
+
* The scope must be used with the `using` syntax to ensure proper disposal.
|
|
348
|
+
* @since v26.1.0
|
|
349
|
+
* @experimental
|
|
350
|
+
*/
|
|
351
|
+
interface RunStoresScope extends Disposable {}
|
|
281
352
|
interface TracingChannelSubscribers<ContextType extends object> {
|
|
282
353
|
start: (message: ContextType) => void;
|
|
283
354
|
end: (
|
|
@@ -355,7 +426,7 @@ declare module "node:diagnostics_channel" {
|
|
|
355
426
|
* @experimental
|
|
356
427
|
* @param subscribers Set of `TracingChannel Channels` subscribers
|
|
357
428
|
*/
|
|
358
|
-
subscribe(subscribers: TracingChannelSubscribers<ContextType
|
|
429
|
+
subscribe(subscribers: NodeJS.PartialOptions<TracingChannelSubscribers<ContextType>>): void;
|
|
359
430
|
/**
|
|
360
431
|
* Helper to unsubscribe a collection of functions from the corresponding channels.
|
|
361
432
|
* This is the same as calling `channel.unsubscribe(onMessage)` on each channel
|
|
@@ -389,7 +460,7 @@ declare module "node:diagnostics_channel" {
|
|
|
389
460
|
* @param subscribers Set of `TracingChannel Channels` subscribers
|
|
390
461
|
* @return `true` if all handlers were successfully unsubscribed, and `false` otherwise.
|
|
391
462
|
*/
|
|
392
|
-
unsubscribe(subscribers: TracingChannelSubscribers<ContextType
|
|
463
|
+
unsubscribe(subscribers: NodeJS.PartialOptions<TracingChannelSubscribers<ContextType>>): void;
|
|
393
464
|
/**
|
|
394
465
|
* Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error.
|
|
395
466
|
* This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
|
|
@@ -554,6 +625,169 @@ declare module "node:diagnostics_channel" {
|
|
|
554
625
|
*/
|
|
555
626
|
readonly hasSubscribers: boolean;
|
|
556
627
|
}
|
|
628
|
+
interface BoundedChannelSubscribers<ContextType extends object> {
|
|
629
|
+
start: (message: ContextType) => void;
|
|
630
|
+
end: (message: ContextType) => void;
|
|
631
|
+
}
|
|
632
|
+
interface BoundedChannelCollection<ContextType extends object = object, StoreType = ContextType> {
|
|
633
|
+
start: Channel<ContextType, StoreType>;
|
|
634
|
+
end: Channel<ContextType, StoreType>;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* The class `BoundedChannel` is a simplified version of {@link TracingChannel} that
|
|
638
|
+
* only traces synchronous operations. It consists of two channels (`start` and
|
|
639
|
+
* `end`) instead of five, omitting the `asyncStart`, `asyncEnd`, and `error`
|
|
640
|
+
* events. This makes it suitable for tracing operations that don't involve
|
|
641
|
+
* asynchronous continuations or error handling.
|
|
642
|
+
*
|
|
643
|
+
* Like `TracingChannel`, it is recommended to create and reuse a single
|
|
644
|
+
* `BoundedChannel` at the top-level of the file rather than creating them
|
|
645
|
+
* dynamically.
|
|
646
|
+
* @since v26.1.0
|
|
647
|
+
* @experimental
|
|
648
|
+
*/
|
|
649
|
+
interface BoundedChannel<ContextType extends object = object, StoreType = ContextType>
|
|
650
|
+
extends BoundedChannelCollection<ContextType, StoreType>
|
|
651
|
+
{
|
|
652
|
+
/**
|
|
653
|
+
* Check if any of the `start` or `end` channels have subscribers.
|
|
654
|
+
*
|
|
655
|
+
* ```js
|
|
656
|
+
* import { boundedChannel } from 'node:diagnostics_channel';
|
|
657
|
+
*
|
|
658
|
+
* const wc = boundedChannel('my-operation');
|
|
659
|
+
*
|
|
660
|
+
* if (wc.hasSubscribers) {
|
|
661
|
+
* // There are subscribers, perform traced operation
|
|
662
|
+
* }
|
|
663
|
+
* ```
|
|
664
|
+
* @since v26.1.0
|
|
665
|
+
*/
|
|
666
|
+
readonly hasSubscribers: boolean;
|
|
667
|
+
/**
|
|
668
|
+
* Subscribe to the bounded channel events. This is equivalent to calling
|
|
669
|
+
* [`channel.subscribe(onMessage)`][] on each channel individually.
|
|
670
|
+
*
|
|
671
|
+
* ```mjs
|
|
672
|
+
* import { boundedChannel } from 'node:diagnostics_channel';
|
|
673
|
+
*
|
|
674
|
+
* const wc = boundedChannel('my-operation');
|
|
675
|
+
*
|
|
676
|
+
* wc.subscribe({
|
|
677
|
+
* start(message) {
|
|
678
|
+
* // Handle start
|
|
679
|
+
* },
|
|
680
|
+
* end(message) {
|
|
681
|
+
* // Handle end
|
|
682
|
+
* },
|
|
683
|
+
* });
|
|
684
|
+
* ```
|
|
685
|
+
* @since v26.1.0
|
|
686
|
+
* @param handlers Set of channel subscribers
|
|
687
|
+
*/
|
|
688
|
+
subscribe(handlers: NodeJS.PartialOptions<BoundedChannelSubscribers<ContextType>>): void;
|
|
689
|
+
/**
|
|
690
|
+
* Unsubscribe from the bounded channel events. This is equivalent to calling
|
|
691
|
+
* [`channel.unsubscribe(onMessage)`][] on each channel individually.
|
|
692
|
+
*
|
|
693
|
+
* ```js
|
|
694
|
+
* import { boundedChannel } from 'node:diagnostics_channel';
|
|
695
|
+
*
|
|
696
|
+
* const wc = boundedChannel('my-operation');
|
|
697
|
+
*
|
|
698
|
+
* const handlers = {
|
|
699
|
+
* start(message) {},
|
|
700
|
+
* end(message) {},
|
|
701
|
+
* };
|
|
702
|
+
*
|
|
703
|
+
* wc.subscribe(handlers);
|
|
704
|
+
* wc.unsubscribe(handlers);
|
|
705
|
+
* ```
|
|
706
|
+
* @since v26.1.0
|
|
707
|
+
* @param handlers Set of channel subscribers
|
|
708
|
+
* @returns `true` if all handlers were successfully unsubscribed,
|
|
709
|
+
* `false` otherwise.
|
|
710
|
+
*/
|
|
711
|
+
unsubscribe(handlers: NodeJS.PartialOptions<BoundedChannelSubscribers<ContextType>>): boolean;
|
|
712
|
+
/**
|
|
713
|
+
* Trace a synchronous function call. This will produce a `start` event and `end`
|
|
714
|
+
* event around the execution. This runs the given function using
|
|
715
|
+
* [`channel.runStores(context, ...)`][] on the `start` channel which ensures all
|
|
716
|
+
* events have any bound stores set to match this trace context.
|
|
717
|
+
*
|
|
718
|
+
* ```js
|
|
719
|
+
* import { boundedChannel } from 'node:diagnostics_channel';
|
|
720
|
+
*
|
|
721
|
+
* const wc = boundedChannel('my-operation');
|
|
722
|
+
*
|
|
723
|
+
* const result = wc.run({ operationId: '123' }, () => {
|
|
724
|
+
* // Perform operation
|
|
725
|
+
* return 42;
|
|
726
|
+
* });
|
|
727
|
+
* ```
|
|
728
|
+
* @since v26.1.0
|
|
729
|
+
* @param context Shared object to correlate events through
|
|
730
|
+
* @param fn Function to wrap a trace around
|
|
731
|
+
* @param thisArg The receiver to be used for the function call
|
|
732
|
+
* @param args Optional arguments to pass to the function
|
|
733
|
+
* @returns The return value of the given function
|
|
734
|
+
*/
|
|
735
|
+
run<ThisArg = any, Args extends any[] = any[], Result = any>(
|
|
736
|
+
fn: (this: ThisArg, ...args: Args) => Result,
|
|
737
|
+
context?: ContextType,
|
|
738
|
+
thisArg?: ThisArg,
|
|
739
|
+
...args: Args
|
|
740
|
+
): Result;
|
|
741
|
+
/**
|
|
742
|
+
* Create a disposable scope for tracing a synchronous operation using JavaScript's
|
|
743
|
+
* explicit resource management (`using` syntax). The scope automatically publishes
|
|
744
|
+
* `start` and `end` events, enters bound stores, and handles cleanup when disposed.
|
|
745
|
+
*
|
|
746
|
+
* ```js
|
|
747
|
+
* import { boundedChannel } from 'node:diagnostics_channel';
|
|
748
|
+
*
|
|
749
|
+
* const wc = boundedChannel('my-operation');
|
|
750
|
+
*
|
|
751
|
+
* const context = { operationId: '123' };
|
|
752
|
+
* {
|
|
753
|
+
* using scope = wc.withScope(context);
|
|
754
|
+
* // Stores are entered, start event is published
|
|
755
|
+
*
|
|
756
|
+
* // Perform work and set result on context
|
|
757
|
+
* context.result = 42;
|
|
758
|
+
* }
|
|
759
|
+
* // End event is published, stores are restored automatically
|
|
760
|
+
* ```
|
|
761
|
+
* @since v26.1.0
|
|
762
|
+
* @param context Shared object to correlate events through
|
|
763
|
+
* @returns Disposable scope object
|
|
764
|
+
*/
|
|
765
|
+
withScope(context: ContextType): BoundedChannelScope;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* The class `BoundedChannelScope` represents a disposable scope created by
|
|
769
|
+
* `boundedChannel.withScope(context)`. It manages the lifecycle of a traced
|
|
770
|
+
* operation, automatically publishing events and managing store contexts.
|
|
771
|
+
*
|
|
772
|
+
* The scope must be used with the `using` syntax to ensure proper disposal.
|
|
773
|
+
*
|
|
774
|
+
* ```js
|
|
775
|
+
* import { boundedChannel } from 'node:diagnostics_channel';
|
|
776
|
+
*
|
|
777
|
+
* const wc = boundedChannel('my-operation');
|
|
778
|
+
*
|
|
779
|
+
* const context = {};
|
|
780
|
+
* {
|
|
781
|
+
* using scope = wc.withScope(context);
|
|
782
|
+
* // Start event is published, stores are entered
|
|
783
|
+
* context.result = performOperation();
|
|
784
|
+
* // End event is automatically published at end of block
|
|
785
|
+
* }
|
|
786
|
+
* ```
|
|
787
|
+
* @since v26.1.0
|
|
788
|
+
* @experimental
|
|
789
|
+
*/
|
|
790
|
+
interface BoundedChannelScope extends Disposable {}
|
|
557
791
|
}
|
|
558
792
|
declare module "diagnostics_channel" {
|
|
559
793
|
export * from "node:diagnostics_channel";
|
|
@@ -34,7 +34,7 @@ declare module "node:dns" {
|
|
|
34
34
|
*/
|
|
35
35
|
all?: boolean | undefined;
|
|
36
36
|
/**
|
|
37
|
-
* When `verbatim`, the resolved addresses are
|
|
37
|
+
* When `verbatim`, the resolved addresses are returned unsorted. When `ipv4first`, the resolved addresses are sorted
|
|
38
38
|
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
|
|
39
39
|
* addresses before IPv4 addresses. Default value is configurable using
|
|
40
40
|
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v26.x/api/cli.html#--dns-result-orderorder).
|