Skip to content

Commit 8ce3ec9

Browse files
committed
Added typings.
1 parent 55f7fa7 commit 8ce3ec9

File tree

7 files changed

+79
-64
lines changed

7 files changed

+79
-64
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
.idea
33
node_modules
44
public
5-
typings
5+
/typings
66
/dist/temp

src/services/NodeErrorParser.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,3 @@ export class NodeErrorParser implements IErrorParser {
4848
return frames;
4949
}
5050
}
51-
52-
declare module "stack-trace" {}

src/services/WebErrorParser.ts

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -43,64 +43,3 @@ export class WebErrorParser implements IErrorParser {
4343
return frames;
4444
}
4545
}
46-
47-
48-
declare module StackTrace {
49-
interface StackTraceOptions {
50-
filter?: (stackFrame:StackFrame) => boolean;
51-
sourceCache?: { URL:string };
52-
offline?: boolean;
53-
}
54-
55-
interface StackFrame {
56-
constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number);
57-
58-
functionName?:string;
59-
args?:any;
60-
fileName?:string;
61-
lineNumber?:number;
62-
columnNumber?:number;
63-
toString():string;
64-
}
65-
66-
/**
67-
* Get a backtrace from invocation point.
68-
* @param options Options Object
69-
* @return Array[StackFrame]
70-
*/
71-
function get(options: StackTraceOptions): Promise<StackFrame[]>;
72-
73-
/**
74-
* Given an error object, parse it.
75-
* @param error Error object
76-
* @param options Object for options
77-
* @return Array[StackFrame]
78-
*/
79-
function fromError(error:Error, options?:StackTraceOptions): Promise<StackFrame[]>;
80-
81-
/**
82-
* Use StackGenerator to generate a backtrace.
83-
* @param options Object options
84-
* @returns Array[StackFrame]
85-
*/
86-
function generateArtificially(options: StackTraceOptions): Promise<StackFrame[]>;
87-
88-
/**
89-
* Given a function, wrap it such that invocations trigger a callback that
90-
* is called with a stack trace.
91-
*
92-
* @param {Function} fn to be instrumented
93-
* @param {Function} callback function to call with a stack trace on invocation
94-
* @param {Function} errorCallback optional function to call with error if unable to get stack trace.
95-
* @param {Object} thisArg optional context object (e.g. window)
96-
*/
97-
function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:() => void, thisArg:any): void;
98-
99-
/**
100-
* Given a function that has been instrumented,
101-
* revert the function to it's original (non-instrumented) state.
102-
*
103-
* @param fn {Function}
104-
*/
105-
function deinstrument(fn:() => void): void;
106-
}

src/tsconfig.es5.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
"files": [
6969
"../typings/es6-promise/es6-promise.d.ts",
7070
"../typings/node/node.d.ts",
71+
"typings/node-stack-trace/node-stack-trace.d.ts",
72+
"typings/stacktrace/stacktrace.d.ts",
7173
"Exceptionless.ts"
7274
]
7375
}

src/tsconfig.es6.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
"exceptionless.es6": {
6666
"files": [
6767
"../typings/node/node.d.ts",
68+
"typings/node-stack-trace/node-stack-trace.d.ts",
69+
"typings/stacktrace/stacktrace.d.ts",
6870
"Exceptionless.ts"
6971
]
7072
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
declare module 'stack-trace' {
2+
export interface StackFrame {
3+
getTypeName():string;
4+
getFunctionName():string;
5+
getMethodName():string;
6+
getFileName():string;
7+
getTypeName():string;
8+
getLineNumber():number;
9+
getColumnNumber():number;
10+
isNative():boolean;
11+
}
12+
13+
export function get(belowFn:() => void): StackFrame[];
14+
export function parse(err:Error): StackFrame[];
15+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
declare module StackTrace {
2+
export interface StackTraceOptions {
3+
filter?: (stackFrame:StackFrame) => boolean;
4+
sourceCache?: { URL:string };
5+
offline?: boolean;
6+
}
7+
8+
export interface StackFrame {
9+
constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number);
10+
11+
functionName?:string;
12+
args?:any;
13+
fileName?:string;
14+
lineNumber?:number;
15+
columnNumber?:number;
16+
toString():string;
17+
}
18+
19+
/**
20+
* Get a backtrace from invocation point.
21+
* @param options Options Object
22+
* @return Array[StackFrame]
23+
*/
24+
export function get(options: StackTraceOptions): Promise<StackFrame[]>;
25+
26+
/**
27+
* Given an error object, parse it.
28+
* @param error Error object
29+
* @param options Object for options
30+
* @return Array[StackFrame]
31+
*/
32+
export function fromError(error:Error, options?:StackTraceOptions): Promise<StackFrame[]>;
33+
34+
/**
35+
* Use StackGenerator to generate a backtrace.
36+
* @param options Object options
37+
* @returns Array[StackFrame]
38+
*/
39+
export function generateArtificially(options: StackTraceOptions): Promise<StackFrame[]>;
40+
41+
/**
42+
* Given a function, wrap it such that invocations trigger a callback that
43+
* is called with a stack trace.
44+
*
45+
* @param {Function} fn to be instrumented
46+
* @param {Function} callback function to call with a stack trace on invocation
47+
* @param {Function} errorCallback optional function to call with error if unable to get stack trace.
48+
* @param {Object} thisArg optional context object (e.g. window)
49+
*/
50+
export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:() => void, thisArg:any): void;
51+
52+
/**
53+
* Given a function that has been instrumented,
54+
* revert the function to it's original (non-instrumented) state.
55+
*
56+
* @param fn {Function}
57+
*/
58+
export function deinstrument(fn:() => void): void;
59+
}

0 commit comments

Comments
 (0)