@dynatrace/runtime-simulator
Version:
The Dynatrace JavaScript runtime simulator.
31 lines (30 loc) • 974 B
TypeScript
/// <reference path="../../src/vm.d.ts" />
/// <reference types="node" />
/// <reference types="node/vm" />
import * as vm from 'vm';
export interface ContextConfiguration {
appId: string;
appName: string;
appVersion: string;
environmentUrl: string;
token: string;
tenantId?: string;
devProxyUrl: string;
userDetails: UserDetails;
}
export interface UserDetails {
id: string;
name: string;
email: string;
}
export interface RuntimeContext {
/** The Node.js `vm` context */
vmContext: vm.Context;
/**
* This function should be called from outside when an unhandled promise rejection was detected
* @returns `false` if `preventDefault` was called, otherwise `true`
*/
reportUnhandledRejection: (reason: any, promise: Promise<unknown>) => boolean;
}
/** Creates a new VM context */
export declare function createContext(cwd: string, urlPathname: string, config?: ContextConfiguration): RuntimeContext;