Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 41 additions & 44 deletions types/node/assert.d.ts

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions types/node/async_hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* We strongly discourage the use of the `async_hooks` API.
* Other APIs that can cover most of its use cases include:
*
* * `AsyncLocalStorage` tracks async context
* * `process.getActiveResourcesInfo()` tracks active resources
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v20.x/api/async_context.html#class-asynclocalstorage) tracks async context
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
*
* The `node:async_hooks` module provides an API to track asynchronous resources.
* It can be accessed using:
Expand All @@ -12,7 +12,7 @@
* import async_hooks from 'node:async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/async_hooks.js)
*/
declare module "async_hooks" {
/**
Expand Down Expand Up @@ -44,7 +44,7 @@ declare module "async_hooks" {
* ```
*
* Promise contexts may not get precise `executionAsyncIds` by default.
* See the section on `promise execution tracking`.
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
* @since v8.1.0
* @return The `asyncId` of the current execution context. Useful to track when something calls.
*/
Expand Down Expand Up @@ -117,17 +117,17 @@ declare module "async_hooks" {
* ```
*
* Promise contexts may not get valid `triggerAsyncId`s by default. See
* the section on `promise execution tracking`.
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
* @return The ID of the resource responsible for calling the callback that is currently being executed.
*/
function triggerAsyncId(): number;
interface HookCallbacks {
/**
* Called when a class is constructed that has the possibility to emit an asynchronous event.
* @param asyncId a unique ID for the async resource
* @param type the type of the async resource
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
* @param resource reference to the resource representing the async operation, needs to be released during destroy
* @param asyncId A unique ID for the async resource
* @param type The type of the async resource
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
*/
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
/**
Expand All @@ -137,7 +137,9 @@ declare module "async_hooks" {
*/
before?(asyncId: number): void;
/**
* Called immediately after the callback specified in before is completed.
* Called immediately after the callback specified in `before` is completed.
*
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
*/
after?(asyncId: number): void;
Expand Down Expand Up @@ -321,7 +323,7 @@ declare module "async_hooks" {
/**
* This class creates stores that stay coherent through asynchronous operations.
*
* While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory
* While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
* safe implementation that involves significant optimizations that are non-obvious
* to implement.
*
Expand Down Expand Up @@ -407,12 +409,12 @@ declare module "async_hooks" {
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
/**
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
* to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
*
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
* instance will be exited.
*
* Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
* Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
* provided by the `asyncLocalStorage`, as those objects are garbage collected
* along with the corresponding async resources.
*
Expand Down Expand Up @@ -465,7 +467,7 @@ declare module "async_hooks" {
/**
* Runs a function synchronously outside of a context and returns its
* return value. The store is not accessible within the callback function or
* the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
* the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
*
* The optional `args` are passed to the callback function.
*
Expand Down Expand Up @@ -511,7 +513,7 @@ declare module "async_hooks" {
* This transition will continue for the _entire_ synchronous execution.
* This means that if, for example, the context is entered within an event
* handler subsequent event handlers will also run within that context unless
* specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
* specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
* to use the latter method.
*
* ```js
Expand Down
14 changes: 7 additions & 7 deletions types/node/buffer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
* const buf7 = Buffer.from('tést', 'latin1');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js)
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/buffer.js)
*/
declare module "buffer" {
import { BinaryLike } from "node:crypto";
Expand Down Expand Up @@ -311,12 +311,12 @@ declare module "buffer" {
*
* If `array` is an `Array`\-like object (that is, one with a `length` property of
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an`Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
*
* A `TypeError` will be thrown if `array` is not an `Array` or another type
* appropriate for `Buffer.from()` variants.
*
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
* @since v5.10.0
*/
from(
Expand Down Expand Up @@ -420,9 +420,9 @@ declare module "buffer" {
encoding?: BufferEncoding,
): number;
/**
* Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
*
* If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned.
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
*
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
* in `list` by adding their lengths.
Expand Down Expand Up @@ -476,7 +476,7 @@ declare module "buffer" {
*/
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
/**
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
*
* ```js
* import { Buffer } from 'node:buffer';
Expand Down Expand Up @@ -2098,7 +2098,7 @@ declare module "buffer" {
* // Prints: 6
* ```
*
* If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
* If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
* an integer between 0 and 255.
*
* If `byteOffset` is not a number, it will be coerced to a number. If the result
Expand Down
2 changes: 1 addition & 1 deletion types/node/child_process.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
* the synchronous methods can have significant impact on performance due to
* stalling the event loop while spawned processes complete.
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/child_process.js)
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/child_process.js)
*/
declare module "child_process" {
import { ObjectEncodingOptions } from "node:fs";
Expand Down
2 changes: 1 addition & 1 deletion types/node/cluster.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* ```
*
* On Windows, it is not yet possible to set up a named pipe server in a worker.
* @see [source](https://github.com/nodejs/node/blob/v20.11.1/lib/cluster.js)
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/cluster.js)
*/
declare module "cluster" {
import * as child from "node:child_process";
Expand Down
2 changes: 1 addition & 1 deletion types/node/console.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.12.1/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/console.js)
*/
declare module "console" {
import console = require("node:console");
Expand Down
37 changes: 34 additions & 3 deletions types/node/crypto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* // Prints:
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js)
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/crypto.js)
*/
declare module "crypto" {
import * as stream from "node:stream";
Expand All @@ -27,7 +27,7 @@ declare module "crypto" {
* should not use this element anymore.
*
* The `node:crypto` module provides the `Certificate` class for working with SPKAC
* data. The most common usage is handling output generated by the HTML5`<keygen>` element. Node.js uses [OpenSSL's SPKAC
* data. The most common usage is handling output generated by the HTML5 `<keygen>` element. Node.js uses [OpenSSL's SPKAC
* implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally.
* @since v0.11.8
*/
Expand Down Expand Up @@ -3344,7 +3344,7 @@ declare module "crypto" {
callback: (error: Error | null, data: Buffer) => void,
): void;
/**
* Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
* Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
* key type (especially Ed25519 and Ed448).
*
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
Expand Down Expand Up @@ -3378,6 +3378,37 @@ declare module "crypto" {
* @since v13.9.0, v12.17.0
*/
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
/**
* A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data
* (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm`
* is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases
* of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms.
*
* Example:
*
* ```js
* const crypto = require('node:crypto');
* const { Buffer } = require('node:buffer');
*
* // Hashing a string and return the result as a hex-encoded string.
* const string = 'Node.js';
* // 10b3493287f831e81a438811a1ffba01f8cec4b7
* console.log(crypto.hash('sha1', string));
*
* // Encode a base64-encoded string into a Buffer, hash it and return
* // the result as a buffer.
* const base64 = 'Tm9kZS5qcw==';
* // <Buffer 10 b3 49 32 87 f8 31 e8 1a 43 88 11 a1 ff ba 01 f8 ce c4 b7>
* console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer'));
* ```
* @since v21.7.0, v20.12.0
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user
* could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead.
* @param [outputEncoding='hex'] [Encoding](https://nodejs.org/docs/latest-v20.x/api/buffer.html#buffers-and-character-encodings) used to encode the returned digest.
*/
function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): Buffer;
Comment thread
This conversation was marked as resolved.
function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding | "buffer"): string | Buffer;
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
interface CipherInfoOptions {
/**
Expand Down
Loading