@flareapp/js 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +97 -102
- package/dist/index.d.ts +97 -102
- package/dist/index.js +184 -212
- package/dist/index.mjs +182 -210
- package/package.json +1 -1
- package/src/Flare.ts +208 -0
- package/src/api/Api.ts +27 -0
- package/src/api/index.ts +1 -0
- package/src/{browserClient/index.ts → browser/catchWindowErrors.ts} +2 -3
- package/src/browser/index.ts +1 -0
- package/src/context/collectContext.ts +18 -0
- package/src/context/cookie.ts +1 -1
- package/src/context/index.ts +1 -17
- package/src/env/index.ts +12 -0
- package/src/index.ts +8 -5
- package/src/solutions/getSolutions.ts +35 -0
- package/src/solutions/index.ts +1 -44
- package/src/stacktrace/createStackTrace.ts +59 -0
- package/src/stacktrace/fileReader.ts +7 -21
- package/src/stacktrace/index.ts +1 -71
- package/src/types.ts +66 -82
- package/src/util/assert.ts +9 -0
- package/src/util/assertKey.ts +11 -0
- package/src/util/assertSolutionProvider.ts +12 -0
- package/src/util/flatJsonStringify.ts +22 -0
- package/src/util/flattenOnce.ts +5 -0
- package/src/util/index.ts +6 -44
- package/src/util/now.ts +3 -0
- package/tsconfig.json +1 -1
- package/src/FlareClient.ts +0 -285
- package/src/build.ts +0 -16
- package/src/module.d.ts +0 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,114 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
type Config = {
|
|
2
|
+
key: string | null;
|
|
3
|
+
version: string;
|
|
4
|
+
sourcemapVersion: string;
|
|
5
|
+
stage: string;
|
|
6
|
+
maxGlowsPerReport: number;
|
|
7
|
+
reportBrowserExtensionErrors: boolean;
|
|
8
|
+
reportingUrl: string;
|
|
9
|
+
debug: boolean;
|
|
10
|
+
beforeEvaluate: (error: Error) => Error | false | null | Promise<Error | false | null>;
|
|
11
|
+
beforeSubmit: (report: Report) => Report | false | null | Promise<Report | false | null>;
|
|
12
|
+
};
|
|
13
|
+
type Report = {
|
|
14
|
+
notifier: string;
|
|
15
|
+
exception_class: string;
|
|
16
|
+
seen_at: number;
|
|
17
|
+
message: string;
|
|
18
|
+
language: 'javascript';
|
|
19
|
+
glows: Glow[];
|
|
20
|
+
context: Context;
|
|
21
|
+
stacktrace: StackFrame[];
|
|
22
|
+
sourcemap_version_id: string;
|
|
23
|
+
solutions: Solution[];
|
|
24
|
+
stage?: string;
|
|
25
|
+
};
|
|
26
|
+
interface SolutionProviderExtraParameters {
|
|
27
|
+
}
|
|
28
|
+
type SolutionProvider = {
|
|
29
|
+
canSolve: (error: Error, extraParameters?: SolutionProviderExtraParameters) => boolean | Promise<boolean>;
|
|
30
|
+
getSolutions: (error: Error, extraParameters?: SolutionProviderExtraParameters) => Solution[] | Promise<Solution[]>;
|
|
31
|
+
};
|
|
32
|
+
type Solution = {
|
|
33
|
+
class: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description: string;
|
|
36
|
+
links: {
|
|
37
|
+
[label: string]: string;
|
|
29
38
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
action_description?: string;
|
|
40
|
+
is_runnable?: boolean;
|
|
41
|
+
};
|
|
42
|
+
type Context = {
|
|
43
|
+
request?: {
|
|
44
|
+
url?: String;
|
|
45
|
+
useragent?: String;
|
|
46
|
+
referrer?: String;
|
|
47
|
+
readyState?: String;
|
|
39
48
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
url?: String;
|
|
43
|
-
useragent?: String;
|
|
44
|
-
referrer?: String;
|
|
45
|
-
readyState?: String;
|
|
46
|
-
};
|
|
47
|
-
request_data?: {
|
|
48
|
-
queryString: {
|
|
49
|
-
[key: string]: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
cookies?: {
|
|
49
|
+
request_data?: {
|
|
50
|
+
queryString: {
|
|
53
51
|
[key: string]: string;
|
|
54
52
|
};
|
|
55
|
-
[key: string]: any;
|
|
56
53
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
column_number: number;
|
|
60
|
-
method: string;
|
|
61
|
-
file: string;
|
|
62
|
-
code_snippet: {
|
|
63
|
-
[key: number]: string;
|
|
64
|
-
};
|
|
65
|
-
trimmed_column_number: number | null;
|
|
66
|
-
class: string;
|
|
54
|
+
cookies?: {
|
|
55
|
+
[key: string]: string;
|
|
67
56
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
};
|
|
59
|
+
type StackFrame = {
|
|
60
|
+
line_number: number;
|
|
61
|
+
column_number: number;
|
|
62
|
+
method: string;
|
|
63
|
+
file: string;
|
|
64
|
+
code_snippet: {
|
|
65
|
+
[key: number]: string;
|
|
74
66
|
};
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
trimmed_column_number: number | null;
|
|
68
|
+
class: string;
|
|
69
|
+
};
|
|
70
|
+
type Glow = {
|
|
71
|
+
time: number;
|
|
72
|
+
microtime: number;
|
|
73
|
+
name: String;
|
|
74
|
+
message_level: MessageLevel;
|
|
75
|
+
meta_data: object | object[];
|
|
76
|
+
};
|
|
77
|
+
type MessageLevel = 'info' | 'debug' | 'warning' | 'error' | 'critical';
|
|
77
78
|
|
|
78
|
-
declare class
|
|
79
|
-
|
|
80
|
-
config: Flare.Config;
|
|
81
|
-
private glows;
|
|
82
|
-
private context;
|
|
83
|
-
beforeEvaluate: Flare.BeforeEvaluate;
|
|
84
|
-
beforeSubmit: Flare.BeforeSubmit;
|
|
85
|
-
private reportedErrorsTimestamps;
|
|
86
|
-
private solutionProviders;
|
|
87
|
-
private sourcemapVersion;
|
|
88
|
-
debug: boolean;
|
|
89
|
-
stage: string | undefined;
|
|
90
|
-
light(key?: string, debug?: boolean): FlareClient;
|
|
91
|
-
glow(name: string, level?: Flare.MessageLevel, metaData?: Array<object>): FlareClient;
|
|
92
|
-
addContext(name: string, value: any): FlareClient;
|
|
93
|
-
addContextGroup(groupName: string, value: object): FlareClient;
|
|
94
|
-
registerSolutionProvider(provider: Flare.SolutionProvider): FlareClient;
|
|
95
|
-
reportMessage(message: string, context?: Flare.Context, exceptionClass?: string): void;
|
|
96
|
-
report(error: Error, context?: Flare.Context, extraSolutionParameters?: Flare.SolutionProviderExtraParameters): void;
|
|
97
|
-
createReport(error: Error, context?: Flare.Context, extraSolutionParameters?: Flare.SolutionProviderExtraParameters): Promise<Flare.ErrorReport | false>;
|
|
98
|
-
private sendReport;
|
|
99
|
-
private maxReportsPerMinuteReached;
|
|
100
|
-
test(): FlareClient;
|
|
79
|
+
declare class Api {
|
|
80
|
+
report(report: Report, url: string, key: string | null, reportBrowserExtensionErrors: boolean): Promise<void>;
|
|
101
81
|
}
|
|
102
82
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
83
|
+
declare class Flare {
|
|
84
|
+
api: Api;
|
|
85
|
+
config: Config;
|
|
86
|
+
glows: Glow[];
|
|
87
|
+
context: Context;
|
|
88
|
+
solutionProviders: SolutionProvider[];
|
|
89
|
+
constructor(api?: Api);
|
|
90
|
+
light(key?: string, debug?: boolean): Flare;
|
|
91
|
+
configure(config: Partial<Config>): Flare;
|
|
92
|
+
test(): Promise<void>;
|
|
93
|
+
glow(name: string, level?: MessageLevel, data?: object | object[]): Flare;
|
|
94
|
+
clearGlows(): Flare;
|
|
95
|
+
addContext(name: string, value: any): Flare;
|
|
96
|
+
addContextGroup(groupName: string, value: object): Flare;
|
|
97
|
+
registerSolutionProvider(solutionProvider: SolutionProvider): Flare;
|
|
98
|
+
report(error: Error, context?: Context, extraSolutionParameters?: SolutionProviderExtraParameters): Promise<void>;
|
|
99
|
+
reportMessage(message: string, context?: Context, exceptionClass?: string): Promise<void>;
|
|
100
|
+
createReportFromError(error: Error, context?: Context, extraSolutionParameters?: SolutionProviderExtraParameters): Promise<Report | false>;
|
|
101
|
+
sendReport(report: Report): Promise<void>;
|
|
102
|
+
set beforeEvaluate(beforeEvaluate: Config['beforeEvaluate']);
|
|
103
|
+
set beforeSubmit(beforeSubmit: Config['beforeSubmit']);
|
|
104
|
+
set stage(stage: string | undefined);
|
|
105
|
+
}
|
|
111
106
|
|
|
112
|
-
declare const flare:
|
|
107
|
+
declare const flare: Flare;
|
|
113
108
|
|
|
114
|
-
export {
|
|
109
|
+
export { Flare, flare };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,114 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
type Config = {
|
|
2
|
+
key: string | null;
|
|
3
|
+
version: string;
|
|
4
|
+
sourcemapVersion: string;
|
|
5
|
+
stage: string;
|
|
6
|
+
maxGlowsPerReport: number;
|
|
7
|
+
reportBrowserExtensionErrors: boolean;
|
|
8
|
+
reportingUrl: string;
|
|
9
|
+
debug: boolean;
|
|
10
|
+
beforeEvaluate: (error: Error) => Error | false | null | Promise<Error | false | null>;
|
|
11
|
+
beforeSubmit: (report: Report) => Report | false | null | Promise<Report | false | null>;
|
|
12
|
+
};
|
|
13
|
+
type Report = {
|
|
14
|
+
notifier: string;
|
|
15
|
+
exception_class: string;
|
|
16
|
+
seen_at: number;
|
|
17
|
+
message: string;
|
|
18
|
+
language: 'javascript';
|
|
19
|
+
glows: Glow[];
|
|
20
|
+
context: Context;
|
|
21
|
+
stacktrace: StackFrame[];
|
|
22
|
+
sourcemap_version_id: string;
|
|
23
|
+
solutions: Solution[];
|
|
24
|
+
stage?: string;
|
|
25
|
+
};
|
|
26
|
+
interface SolutionProviderExtraParameters {
|
|
27
|
+
}
|
|
28
|
+
type SolutionProvider = {
|
|
29
|
+
canSolve: (error: Error, extraParameters?: SolutionProviderExtraParameters) => boolean | Promise<boolean>;
|
|
30
|
+
getSolutions: (error: Error, extraParameters?: SolutionProviderExtraParameters) => Solution[] | Promise<Solution[]>;
|
|
31
|
+
};
|
|
32
|
+
type Solution = {
|
|
33
|
+
class: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description: string;
|
|
36
|
+
links: {
|
|
37
|
+
[label: string]: string;
|
|
29
38
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
action_description?: string;
|
|
40
|
+
is_runnable?: boolean;
|
|
41
|
+
};
|
|
42
|
+
type Context = {
|
|
43
|
+
request?: {
|
|
44
|
+
url?: String;
|
|
45
|
+
useragent?: String;
|
|
46
|
+
referrer?: String;
|
|
47
|
+
readyState?: String;
|
|
39
48
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
url?: String;
|
|
43
|
-
useragent?: String;
|
|
44
|
-
referrer?: String;
|
|
45
|
-
readyState?: String;
|
|
46
|
-
};
|
|
47
|
-
request_data?: {
|
|
48
|
-
queryString: {
|
|
49
|
-
[key: string]: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
cookies?: {
|
|
49
|
+
request_data?: {
|
|
50
|
+
queryString: {
|
|
53
51
|
[key: string]: string;
|
|
54
52
|
};
|
|
55
|
-
[key: string]: any;
|
|
56
53
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
column_number: number;
|
|
60
|
-
method: string;
|
|
61
|
-
file: string;
|
|
62
|
-
code_snippet: {
|
|
63
|
-
[key: number]: string;
|
|
64
|
-
};
|
|
65
|
-
trimmed_column_number: number | null;
|
|
66
|
-
class: string;
|
|
54
|
+
cookies?: {
|
|
55
|
+
[key: string]: string;
|
|
67
56
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
};
|
|
59
|
+
type StackFrame = {
|
|
60
|
+
line_number: number;
|
|
61
|
+
column_number: number;
|
|
62
|
+
method: string;
|
|
63
|
+
file: string;
|
|
64
|
+
code_snippet: {
|
|
65
|
+
[key: number]: string;
|
|
74
66
|
};
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
trimmed_column_number: number | null;
|
|
68
|
+
class: string;
|
|
69
|
+
};
|
|
70
|
+
type Glow = {
|
|
71
|
+
time: number;
|
|
72
|
+
microtime: number;
|
|
73
|
+
name: String;
|
|
74
|
+
message_level: MessageLevel;
|
|
75
|
+
meta_data: object | object[];
|
|
76
|
+
};
|
|
77
|
+
type MessageLevel = 'info' | 'debug' | 'warning' | 'error' | 'critical';
|
|
77
78
|
|
|
78
|
-
declare class
|
|
79
|
-
|
|
80
|
-
config: Flare.Config;
|
|
81
|
-
private glows;
|
|
82
|
-
private context;
|
|
83
|
-
beforeEvaluate: Flare.BeforeEvaluate;
|
|
84
|
-
beforeSubmit: Flare.BeforeSubmit;
|
|
85
|
-
private reportedErrorsTimestamps;
|
|
86
|
-
private solutionProviders;
|
|
87
|
-
private sourcemapVersion;
|
|
88
|
-
debug: boolean;
|
|
89
|
-
stage: string | undefined;
|
|
90
|
-
light(key?: string, debug?: boolean): FlareClient;
|
|
91
|
-
glow(name: string, level?: Flare.MessageLevel, metaData?: Array<object>): FlareClient;
|
|
92
|
-
addContext(name: string, value: any): FlareClient;
|
|
93
|
-
addContextGroup(groupName: string, value: object): FlareClient;
|
|
94
|
-
registerSolutionProvider(provider: Flare.SolutionProvider): FlareClient;
|
|
95
|
-
reportMessage(message: string, context?: Flare.Context, exceptionClass?: string): void;
|
|
96
|
-
report(error: Error, context?: Flare.Context, extraSolutionParameters?: Flare.SolutionProviderExtraParameters): void;
|
|
97
|
-
createReport(error: Error, context?: Flare.Context, extraSolutionParameters?: Flare.SolutionProviderExtraParameters): Promise<Flare.ErrorReport | false>;
|
|
98
|
-
private sendReport;
|
|
99
|
-
private maxReportsPerMinuteReached;
|
|
100
|
-
test(): FlareClient;
|
|
79
|
+
declare class Api {
|
|
80
|
+
report(report: Report, url: string, key: string | null, reportBrowserExtensionErrors: boolean): Promise<void>;
|
|
101
81
|
}
|
|
102
82
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
83
|
+
declare class Flare {
|
|
84
|
+
api: Api;
|
|
85
|
+
config: Config;
|
|
86
|
+
glows: Glow[];
|
|
87
|
+
context: Context;
|
|
88
|
+
solutionProviders: SolutionProvider[];
|
|
89
|
+
constructor(api?: Api);
|
|
90
|
+
light(key?: string, debug?: boolean): Flare;
|
|
91
|
+
configure(config: Partial<Config>): Flare;
|
|
92
|
+
test(): Promise<void>;
|
|
93
|
+
glow(name: string, level?: MessageLevel, data?: object | object[]): Flare;
|
|
94
|
+
clearGlows(): Flare;
|
|
95
|
+
addContext(name: string, value: any): Flare;
|
|
96
|
+
addContextGroup(groupName: string, value: object): Flare;
|
|
97
|
+
registerSolutionProvider(solutionProvider: SolutionProvider): Flare;
|
|
98
|
+
report(error: Error, context?: Context, extraSolutionParameters?: SolutionProviderExtraParameters): Promise<void>;
|
|
99
|
+
reportMessage(message: string, context?: Context, exceptionClass?: string): Promise<void>;
|
|
100
|
+
createReportFromError(error: Error, context?: Context, extraSolutionParameters?: SolutionProviderExtraParameters): Promise<Report | false>;
|
|
101
|
+
sendReport(report: Report): Promise<void>;
|
|
102
|
+
set beforeEvaluate(beforeEvaluate: Config['beforeEvaluate']);
|
|
103
|
+
set beforeSubmit(beforeSubmit: Config['beforeSubmit']);
|
|
104
|
+
set stage(stage: string | undefined);
|
|
105
|
+
}
|
|
111
106
|
|
|
112
|
-
declare const flare:
|
|
107
|
+
declare const flare: Flare;
|
|
113
108
|
|
|
114
|
-
export {
|
|
109
|
+
export { Flare, flare };
|