From c5931169fc537a5d72e9b20f2c64472b841dcd6f Mon Sep 17 00:00:00 2001 From: "Barth, Chris" Date: Fri, 19 Feb 2016 14:11:06 -0500 Subject: [PATCH] Add support for process.domain and some other process stuff #5703 --- node/node.d.ts | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 7d6c1cd57..2980a46f0 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -211,6 +211,23 @@ declare module NodeJS { export interface ReadWriteStream extends ReadableStream, WritableStream {} + export interface Events extends EventEmitter { } + + export interface Domain extends Events { + run(fn: Function): void; + add(emitter: Events): void; + remove(emitter: Events): void; + bind(cb: (err: Error, data: any) => any): any; + intercept(cb: (data: any) => any): any; + dispose(): void; + + addListener(event: string, listener: Function): Domain; + on(event: string, listener: Function): Domain; + once(event: string, listener: Function): Domain; + removeListener(event: string, listener: Function): Domain; + removeAllListeners(event?: string): Domain; + } + export interface Process extends EventEmitter { stdout: WritableStream; stderr: WritableStream; @@ -275,9 +292,12 @@ declare module NodeJS { umask(mask?: number): number; uptime(): number; hrtime(time?:number[]): number[]; + domain: Domain; // Worker send?(message: any, sendHandle?: any): void; + disconnect(): void; + connected: boolean; } export interface Global { @@ -626,6 +646,12 @@ declare module "cluster" { silent?: boolean; } + export interface Address { + address: string; + port: number; + addressType: string; + } + export class Worker extends events.EventEmitter { id: string; process: child.ChildProcess; @@ -1720,15 +1746,18 @@ declare module "crypto" { final(): Buffer; final(output_encoding: string): string; setAutoPadding(auto_padding: boolean): void; + getAuthTag(): Buffer; } export function createDecipher(algorithm: string, password: any): Decipher; export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; export interface Decipher { update(data: Buffer): Buffer; - update(data: string, input_encoding?: string, output_encoding?: string): string; + update(data: string|Buffer, input_encoding?: string, output_encoding?: string): string; + update(data: string|Buffer, input_encoding?: string, output_encoding?: string): Buffer; final(): Buffer; final(output_encoding: string): string; setAutoPadding(auto_padding: boolean): void; + setAuthTag(tag: Buffer): void; } export function createSign(algorithm: string): Signer; export interface Signer extends NodeJS.WritableStream { @@ -1951,7 +1980,7 @@ declare module "tty" { declare module "domain" { import * as events from "events"; - export class Domain extends events.EventEmitter { + export class Domain extends events.EventEmitter implements NodeJS.Domain { run(fn: Function): void; add(emitter: events.EventEmitter): void; remove(emitter: events.EventEmitter): void;