UNPKG

@dynatrace/runtime-simulator

Version:

The Dynatrace JavaScript runtime simulator.

536 lines (534 loc) 27.8 kB
/** * This module is not supported by the Dynatrace Javascript Runtime and only * exists for its referenced types. * See the `Node.js Compatibility` section for more information. * @see https://dt-url.net/runtime-apis */ declare module 'async_hooks' { // DT-DISABLED ///** // DT-DISABLED // * ```js // DT-DISABLED // * import { executionAsyncId } from 'node:async_hooks'; // DT-DISABLED // * import fs from 'node:fs'; // DT-DISABLED // * // DT-DISABLED // * console.log(executionAsyncId()); // 1 - bootstrap // DT-DISABLED // * fs.open(path, 'r', (err, fd) => { // DT-DISABLED // * console.log(executionAsyncId()); // 6 - open() // DT-DISABLED // * }); // DT-DISABLED // * ``` // DT-DISABLED // * // DT-DISABLED // * The ID returned from `executionAsyncId()` is related to execution timing, not // DT-DISABLED // * causality (which is covered by `triggerAsyncId()`): // DT-DISABLED // * // DT-DISABLED // * ```js // DT-DISABLED // * const server = net.createServer((conn) => { // DT-DISABLED // * // Returns the ID of the server, not of the new connection, because the // DT-DISABLED // * // callback runs in the execution scope of the server's MakeCallback(). // DT-DISABLED // * async_hooks.executionAsyncId(); // DT-DISABLED // * // DT-DISABLED // * }).listen(port, () => { // DT-DISABLED // * // Returns the ID of a TickObject (process.nextTick()) because all // DT-DISABLED // * // callbacks passed to .listen() are wrapped in a nextTick(). // DT-DISABLED // * async_hooks.executionAsyncId(); // DT-DISABLED // * }); // DT-DISABLED // * ``` // DT-DISABLED // * // DT-DISABLED // * Promise contexts may not get precise `executionAsyncIds` by default. // DT-DISABLED // * See the section on `promise execution tracking`. // DT-DISABLED // * @since v8.1.0 // DT-DISABLED // * @return The `asyncId` of the current execution context. Useful to track when something calls. // DT-DISABLED // */ // DT-DISABLED //function executionAsyncId(): number; // DT-DISABLED ///** // DT-DISABLED // * Resource objects returned by `executionAsyncResource()` are most often internal // DT-DISABLED // * Node.js handle objects with undocumented APIs. Using any functions or properties // DT-DISABLED // * on the object is likely to crash your application and should be avoided. // DT-DISABLED // * // DT-DISABLED // * Using `executionAsyncResource()` in the top-level execution context will // DT-DISABLED // * return an empty object as there is no handle or request object to use, // DT-DISABLED // * but having an object representing the top-level can be helpful. // DT-DISABLED // * // DT-DISABLED // * ```js // DT-DISABLED // * import { open } from 'node:fs'; // DT-DISABLED // * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks'; // DT-DISABLED // * // DT-DISABLED // * console.log(executionAsyncId(), executionAsyncResource()); // 1 {} // DT-DISABLED // * open(new URL(import.meta.url), 'r', (err, fd) => { // DT-DISABLED // * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap // DT-DISABLED // * }); // DT-DISABLED // * ``` // DT-DISABLED // * // DT-DISABLED // * This can be used to implement continuation local storage without the // DT-DISABLED // * use of a tracking `Map` to store the metadata: // DT-DISABLED // * // DT-DISABLED // * ```js // DT-DISABLED // * import { createServer } from 'node:http'; // DT-DISABLED // * import { // DT-DISABLED // * executionAsyncId, // DT-DISABLED // * executionAsyncResource, // DT-DISABLED // * createHook, // DT-DISABLED // * } from 'async_hooks'; // DT-DISABLED // * const sym = Symbol('state'); // Private symbol to avoid pollution // DT-DISABLED // * // DT-DISABLED // * createHook({ // DT-DISABLED // * init(asyncId, type, triggerAsyncId, resource) { // DT-DISABLED // * const cr = executionAsyncResource(); // DT-DISABLED // * if (cr) { // DT-DISABLED // * resource[sym] = cr[sym]; // DT-DISABLED // * } // DT-DISABLED // * }, // DT-DISABLED // * }).enable(); // DT-DISABLED // * // DT-DISABLED // * const server = createServer((req, res) => { // DT-DISABLED // * executionAsyncResource()[sym] = { state: req.url }; // DT-DISABLED // * setTimeout(function() { // DT-DISABLED // * res.end(JSON.stringify(executionAsyncResource()[sym])); // DT-DISABLED // * }, 100); // DT-DISABLED // * }).listen(3000); // DT-DISABLED // * ``` // DT-DISABLED // * @since v13.9.0, v12.17.0 // DT-DISABLED // * @return The resource representing the current execution. Useful to store data within the resource. // DT-DISABLED // */ // DT-DISABLED //function executionAsyncResource(): object; // DT-DISABLED ///** // DT-DISABLED // * ```js // DT-DISABLED // * const server = net.createServer((conn) => { // DT-DISABLED // * // The resource that caused (or triggered) this callback to be called // DT-DISABLED // * // was that of the new connection. Thus the return value of triggerAsyncId() // DT-DISABLED // * // is the asyncId of "conn". // DT-DISABLED // * async_hooks.triggerAsyncId(); // DT-DISABLED // * // DT-DISABLED // * }).listen(port, () => { // DT-DISABLED // * // Even though all callbacks passed to .listen() are wrapped in a nextTick() // DT-DISABLED // * // the callback itself exists because the call to the server's .listen() // DT-DISABLED // * // was made. So the return value would be the ID of the server. // DT-DISABLED // * async_hooks.triggerAsyncId(); // DT-DISABLED // * }); // DT-DISABLED // * ``` // DT-DISABLED // * // DT-DISABLED // * Promise contexts may not get valid `triggerAsyncId`s by default. See // DT-DISABLED // * the section on `promise execution tracking`. // DT-DISABLED // * @return The ID of the resource responsible for calling the callback that is currently being executed. // DT-DISABLED // */ // DT-DISABLED //function triggerAsyncId(): number; // DT-DISABLED //interface HookCallbacks { // DT-DISABLED // /** // DT-DISABLED // * Called when a class is constructed that has the possibility to emit an asynchronous event. // DT-DISABLED // * @param asyncId a unique ID for the async resource // DT-DISABLED // * @param type the type of the async resource // DT-DISABLED // * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created // DT-DISABLED // * @param resource reference to the resource representing the async operation, needs to be released during destroy // DT-DISABLED // */ // DT-DISABLED // init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; // DT-DISABLED // /** // DT-DISABLED // * When an asynchronous operation is initiated or completes a callback is called to notify the user. // DT-DISABLED // * The before callback is called just before said callback is executed. // DT-DISABLED // * @param asyncId the unique identifier assigned to the resource about to execute the callback. // DT-DISABLED // */ // DT-DISABLED // before?(asyncId: number): void; // DT-DISABLED // /** // DT-DISABLED // * Called immediately after the callback specified in before is completed. // DT-DISABLED // * @param asyncId the unique identifier assigned to the resource which has executed the callback. // DT-DISABLED // */ // DT-DISABLED // after?(asyncId: number): void; // DT-DISABLED // /** // DT-DISABLED // * Called when a promise has resolve() called. This may not be in the same execution id // DT-DISABLED // * as the promise itself. // DT-DISABLED // * @param asyncId the unique id for the promise that was resolve()d. // DT-DISABLED // */ // DT-DISABLED // promiseResolve?(asyncId: number): void; // DT-DISABLED // /** // DT-DISABLED // * Called after the resource corresponding to asyncId is destroyed // DT-DISABLED // * @param asyncId a unique ID for the async resource // DT-DISABLED // */ // DT-DISABLED // destroy?(asyncId: number): void; // DT-DISABLED //} // DT-DISABLED //interface AsyncHook { // DT-DISABLED // /** // DT-DISABLED // * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. // DT-DISABLED // */ // DT-DISABLED // enable(): this; // DT-DISABLED // /** // DT-DISABLED // * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. // DT-DISABLED // */ // DT-DISABLED // disable(): this; // DT-DISABLED //} // DT-DISABLED ///** // DT-DISABLED // * Registers functions to be called for different lifetime events of each async // DT-DISABLED // * operation. // DT-DISABLED // * // DT-DISABLED // * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the // DT-DISABLED // * respective asynchronous event during a resource's lifetime. // DT-DISABLED // * // DT-DISABLED // * All callbacks are optional. For example, if only resource cleanup needs to // DT-DISABLED // * be tracked, then only the `destroy` callback needs to be passed. The // DT-DISABLED // * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. // DT-DISABLED // * // DT-DISABLED // * ```js // DT-DISABLED // * import { createHook } from 'node:async_hooks'; // DT-DISABLED // * // DT-DISABLED // * const asyncHook = createHook({ // DT-DISABLED // * init(asyncId, type, triggerAsyncId, resource) { }, // DT-DISABLED // * destroy(asyncId) { }, // DT-DISABLED // * }); // DT-DISABLED // * ``` // DT-DISABLED // * // DT-DISABLED // * The callbacks will be inherited via the prototype chain: // DT-DISABLED // * // DT-DISABLED // * ```js // DT-DISABLED // * class MyAsyncCallbacks { // DT-DISABLED // * init(asyncId, type, triggerAsyncId, resource) { } // DT-DISABLED // * destroy(asyncId) {} // DT-DISABLED // * } // DT-DISABLED // * // DT-DISABLED // * class MyAddedCallbacks extends MyAsyncCallbacks { // DT-DISABLED // * before(asyncId) { } // DT-DISABLED // * after(asyncId) { } // DT-DISABLED // * } // DT-DISABLED // * // DT-DISABLED // * const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); // DT-DISABLED // * ``` // DT-DISABLED // * // DT-DISABLED // * Because promises are asynchronous resources whose lifecycle is tracked // DT-DISABLED // * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. // DT-DISABLED // * @since v8.1.0 // DT-DISABLED // * @param callbacks The `Hook Callbacks` to register // DT-DISABLED // * @return Instance used for disabling and enabling hooks // DT-DISABLED // */ // DT-DISABLED //function createHook(callbacks: HookCallbacks): AsyncHook; interface AsyncResourceOptions { /** * The ID of the execution context that created this async event. * @default executionAsyncId() */ triggerAsyncId?: number | undefined; /** * Disables automatic `emitDestroy` when the object is garbage collected. * This usually does not need to be set (even if `emitDestroy` is called * manually), unless the resource's `asyncId` is retrieved and the * sensitive API's `emitDestroy` is called with it. * @default false */ requireManualDestroy?: boolean | undefined; } /** * The class `AsyncResource` is designed to be extended by the embedder's async * resources. Using this, users can easily trigger the lifetime events of their * own resources. * * The `init` hook will trigger when an `AsyncResource` is instantiated. * * The following is an overview of the `AsyncResource` API. * * ```js * import { AsyncResource, executionAsyncId } from 'node:async_hooks'; * * // AsyncResource() is meant to be extended. Instantiating a * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then * // async_hook.executionAsyncId() is used. * const asyncResource = new AsyncResource( * type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }, * ); * * // Run a function in the execution context of the resource. This will * // * establish the context of the resource * // * trigger the AsyncHooks before callbacks * // * call the provided function `fn` with the supplied arguments * // * trigger the AsyncHooks after callbacks * // * restore the original execution context * asyncResource.runInAsyncScope(fn, thisArg, ...args); * * // Call AsyncHooks destroy callbacks. * asyncResource.emitDestroy(); * * // Return the unique ID assigned to the AsyncResource instance. * asyncResource.asyncId(); * * // Return the trigger ID for the AsyncResource instance. * asyncResource.triggerAsyncId(); * ``` */ class AsyncResource { /** * AsyncResource() is meant to be extended. Instantiating a * new AsyncResource() also triggers init. If triggerAsyncId is omitted then * async_hook.executionAsyncId() is used. * @param type The type of async event. * @param triggerAsyncId The ID of the execution context that created * this async event (default: `executionAsyncId()`), or an * AsyncResourceOptions object (since v9.3.0) */ constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); /** * Binds the given function to the current execution context. * @since v14.8.0, v12.19.0 * @param fn The function to bind to the current execution context. * @param type An optional name to associate with the underlying `AsyncResource`. */ static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>( fn: Func, type?: string, thisArg?: ThisArg, ): Func; /** * Binds the given function to execute to this `AsyncResource`'s scope. * @since v14.8.0, v12.19.0 * @param fn The function to bind to the current `AsyncResource`. */ bind<Func extends (...args: any[]) => any>(fn: Func): Func; /** * Call the provided function with the provided arguments in the execution context * of the async resource. This will establish the context, trigger the AsyncHooks * before callbacks, call the function, trigger the AsyncHooks after callbacks, and * then restore the original execution context. * @since v9.6.0 * @param fn The function to call in the execution context of this async resource. * @param thisArg The receiver to be used for the function call. * @param args Optional arguments to pass to the function. */ runInAsyncScope<This, Result>( fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[] ): Result; /** * Call all `destroy` hooks. This should only ever be called once. An error will * be thrown if it is called more than once. This **must** be manually called. If * the resource is left to be collected by the GC then the `destroy` hooks will * never be called. * @return A reference to `asyncResource`. */ emitDestroy(): this; /** * @return The unique `asyncId` assigned to the resource. */ asyncId(): number; /** * * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. */ triggerAsyncId(): number; } /** * 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 * safe implementation that involves significant optimizations that are non-obvious * to implement. * * The following example uses `AsyncLocalStorage` to build a simple logger * that assigns IDs to incoming HTTP requests and includes them in messages * logged within each request. * * ```js * import http from 'node:http'; * import { AsyncLocalStorage } from 'node:async_hooks'; * * const asyncLocalStorage = new AsyncLocalStorage(); * * function logWithId(msg) { * const id = asyncLocalStorage.getStore(); * console.log(`${id !== undefined ? id : '-'}:`, msg); * } * * let idSeq = 0; * http.createServer((req, res) => { * asyncLocalStorage.run(idSeq++, () => { * logWithId('start'); * // Imagine any chain of async operations here * setImmediate(() => { * logWithId('finish'); * res.end(); * }); * }); * }).listen(8080); * * http.get('http://localhost:8080'); * http.get('http://localhost:8080'); * // Prints: * // 0: start * // 1: start * // 0: finish * // 1: finish * ``` * * Each instance of `AsyncLocalStorage` maintains an independent storage context. * Multiple instances can safely exist simultaneously without risk of interfering * with each other's data. * @since v13.10.0, v12.17.0 */ /// DT-DISABLED // class AsyncLocalStorage<T> { /// DT-DISABLED // /** /// DT-DISABLED // * Binds the given function to the current execution context. /// DT-DISABLED // * @since v19.8.0 /// DT-DISABLED // * @experimental /// DT-DISABLED // * @param fn The function to bind to the current execution context. /// DT-DISABLED // * @return A new function that calls `fn` within the captured execution context. /// DT-DISABLED // */ /// DT-DISABLED // static bind<Func extends (...args: any[]) => any>(fn: Func): Func; /// DT-DISABLED // /** /// DT-DISABLED // * Captures the current execution context and returns a function that accepts a /// DT-DISABLED // * function as an argument. Whenever the returned function is called, it /// DT-DISABLED // * calls the function passed to it within the captured context. /// DT-DISABLED // * /// DT-DISABLED // * ```js /// DT-DISABLED // * const asyncLocalStorage = new AsyncLocalStorage(); /// DT-DISABLED // * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot()); /// DT-DISABLED // * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore())); /// DT-DISABLED // * console.log(result); // returns 123 /// DT-DISABLED // * ``` /// DT-DISABLED // * /// DT-DISABLED // * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple /// DT-DISABLED // * async context tracking purposes, for example: /// DT-DISABLED // * /// DT-DISABLED // * ```js /// DT-DISABLED // * class Foo { /// DT-DISABLED // * #runInAsyncScope = AsyncLocalStorage.snapshot(); /// DT-DISABLED // * /// DT-DISABLED // * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); } /// DT-DISABLED // * } /// DT-DISABLED // * /// DT-DISABLED // * const foo = asyncLocalStorage.run(123, () => new Foo()); /// DT-DISABLED // * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123 /// DT-DISABLED // * ``` /// DT-DISABLED // * @since v19.8.0 /// DT-DISABLED // * @experimental /// DT-DISABLED // * @return A new function with the signature `(fn: (...args) : R, ...args) : R`. /// DT-DISABLED // */ /// DT-DISABLED // static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R; /// DT-DISABLED // /** /// DT-DISABLED // * Disables the instance of `AsyncLocalStorage`. All subsequent calls /// DT-DISABLED // * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. /// DT-DISABLED // * /// DT-DISABLED // * When calling `asyncLocalStorage.disable()`, all current contexts linked to the /// DT-DISABLED // * instance will be exited. /// DT-DISABLED // * /// DT-DISABLED // * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores /// DT-DISABLED // * provided by the `asyncLocalStorage`, as those objects are garbage collected /// DT-DISABLED // * along with the corresponding async resources. /// DT-DISABLED // * /// DT-DISABLED // * Use this method when the `asyncLocalStorage` is not in use anymore /// DT-DISABLED // * in the current process. /// DT-DISABLED // * @since v13.10.0, v12.17.0 /// DT-DISABLED // * @experimental /// DT-DISABLED // */ /// DT-DISABLED // disable(): void; /// DT-DISABLED // /** /// DT-DISABLED // * Returns the current store. /// DT-DISABLED // * If called outside of an asynchronous context initialized by /// DT-DISABLED // * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it /// DT-DISABLED // * returns `undefined`. /// DT-DISABLED // * @since v13.10.0, v12.17.0 /// DT-DISABLED // */ /// DT-DISABLED // getStore(): T | undefined; /// DT-DISABLED // /** /// DT-DISABLED // * Runs a function synchronously within a context and returns its /// DT-DISABLED // * return value. The store is not accessible outside of the callback function. /// DT-DISABLED // * The store is accessible to any asynchronous operations created within the /// DT-DISABLED // * callback. /// DT-DISABLED // * /// DT-DISABLED // * The optional `args` are passed to the callback function. /// DT-DISABLED // * /// DT-DISABLED // * If the callback function throws an error, the error is thrown by `run()` too. /// DT-DISABLED // * The stacktrace is not impacted by this call and the context is exited. /// DT-DISABLED // * /// DT-DISABLED // * Example: /// DT-DISABLED // * /// DT-DISABLED // * ```js /// DT-DISABLED // * const store = { id: 2 }; /// DT-DISABLED // * try { /// DT-DISABLED // * asyncLocalStorage.run(store, () => { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the store object /// DT-DISABLED // * setTimeout(() => { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the store object /// DT-DISABLED // * }, 200); /// DT-DISABLED // * throw new Error(); /// DT-DISABLED // * }); /// DT-DISABLED // * } catch (e) { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns undefined /// DT-DISABLED // * // The error will be caught here /// DT-DISABLED // * } /// DT-DISABLED // * ``` /// DT-DISABLED // * @since v13.10.0, v12.17.0 /// DT-DISABLED // */ /// DT-DISABLED // run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R; /// DT-DISABLED // /** /// DT-DISABLED // * Runs a function synchronously outside of a context and returns its /// DT-DISABLED // * return value. The store is not accessible within the callback function or /// DT-DISABLED // * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`. /// DT-DISABLED // * /// DT-DISABLED // * The optional `args` are passed to the callback function. /// DT-DISABLED // * /// DT-DISABLED // * If the callback function throws an error, the error is thrown by `exit()` too. /// DT-DISABLED // * The stacktrace is not impacted by this call and the context is re-entered. /// DT-DISABLED // * /// DT-DISABLED // * Example: /// DT-DISABLED // * /// DT-DISABLED // * ```js /// DT-DISABLED // * // Within a call to run /// DT-DISABLED // * try { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the store object or value /// DT-DISABLED // * asyncLocalStorage.exit(() => { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns undefined /// DT-DISABLED // * throw new Error(); /// DT-DISABLED // * }); /// DT-DISABLED // * } catch (e) { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the same object or value /// DT-DISABLED // * // The error will be caught here /// DT-DISABLED // * } /// DT-DISABLED // * ``` /// DT-DISABLED // * @since v13.10.0, v12.17.0 /// DT-DISABLED // * @experimental /// DT-DISABLED // */ /// DT-DISABLED // exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R; /// DT-DISABLED // /** /// DT-DISABLED // * Transitions into the context for the remainder of the current /// DT-DISABLED // * synchronous execution and then persists the store through any following /// DT-DISABLED // * asynchronous calls. /// DT-DISABLED // * /// DT-DISABLED // * Example: /// DT-DISABLED // * /// DT-DISABLED // * ```js /// DT-DISABLED // * const store = { id: 1 }; /// DT-DISABLED // * // Replaces previous store with the given store object /// DT-DISABLED // * asyncLocalStorage.enterWith(store); /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the store object /// DT-DISABLED // * someAsyncOperation(() => { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the same object /// DT-DISABLED // * }); /// DT-DISABLED // * ``` /// DT-DISABLED // * /// DT-DISABLED // * This transition will continue for the _entire_ synchronous execution. /// DT-DISABLED // * This means that if, for example, the context is entered within an event /// DT-DISABLED // * handler subsequent event handlers will also run within that context unless /// DT-DISABLED // * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons /// DT-DISABLED // * to use the latter method. /// DT-DISABLED // * /// DT-DISABLED // * ```js /// DT-DISABLED // * const store = { id: 1 }; /// DT-DISABLED // * /// DT-DISABLED // * emitter.on('my-event', () => { /// DT-DISABLED // * asyncLocalStorage.enterWith(store); /// DT-DISABLED // * }); /// DT-DISABLED // * emitter.on('my-event', () => { /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the same object /// DT-DISABLED // * }); /// DT-DISABLED // * /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns undefined /// DT-DISABLED // * emitter.emit('my-event'); /// DT-DISABLED // * asyncLocalStorage.getStore(); // Returns the same object /// DT-DISABLED // * ``` /// DT-DISABLED // * @since v13.11.0, v12.17.0 /// DT-DISABLED // * @experimental /// DT-DISABLED // */ /// DT-DISABLED // enterWith(store: T): void; /// DT-DISABLED // } } /** * This module is not supported by the Dynatrace Javascript Runtime and only * exists for its referenced types. * See the `Node.js Compatibility` section for more information. * @see https://dt-url.net/runtime-apis */ declare module 'node:async_hooks' { export * from 'async_hooks'; }