@flareapp/js 2.0.0-rc.1 → 2.0.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/CHANGELOG.md +33 -0
- package/README.md +26 -5
- package/dist/index.cjs +603 -0
- package/dist/index.d.cts +122 -0
- package/dist/index.d.mts +109 -96
- package/dist/index.mjs +524 -420
- package/package.json +29 -11
- package/dist/index.d.ts +0 -109
- package/dist/index.js +0 -504
- package/src/Flare.ts +0 -208
- package/src/api/Api.ts +0 -27
- package/src/api/index.ts +0 -1
- package/src/browser/catchWindowErrors.ts +0 -36
- package/src/browser/index.ts +0 -1
- package/src/context/collectContext.ts +0 -18
- package/src/context/cookie.ts +0 -17
- package/src/context/index.ts +0 -1
- package/src/context/request.ts +0 -10
- package/src/context/requestData.ts +0 -13
- package/src/env/index.ts +0 -12
- package/src/index.ts +0 -14
- package/src/solutions/getSolutions.ts +0 -35
- package/src/solutions/index.ts +0 -1
- package/src/stacktrace/createStackTrace.ts +0 -59
- package/src/stacktrace/fileReader.ts +0 -96
- package/src/stacktrace/index.ts +0 -1
- package/src/types.ts +0 -76
- package/src/util/assert.ts +0 -9
- package/src/util/assertKey.ts +0 -11
- package/src/util/assertSolutionProvider.ts +0 -12
- package/src/util/flatJsonStringify.ts +0 -22
- package/src/util/flattenOnce.ts +0 -5
- package/src/util/index.ts +0 -6
- package/src/util/now.ts +0 -3
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type MessageLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency';
|
|
3
|
+
type AttributeValue = string | number | boolean | null | AttributeValue[] | {
|
|
4
|
+
[key: string]: AttributeValue;
|
|
5
|
+
};
|
|
6
|
+
type Attributes = Record<string, AttributeValue>;
|
|
7
|
+
type Config = {
|
|
8
|
+
key: string | null;
|
|
9
|
+
version: string;
|
|
10
|
+
sourcemapVersionId: string;
|
|
11
|
+
stage: string;
|
|
12
|
+
maxGlowsPerReport: number;
|
|
13
|
+
reportBrowserExtensionErrors: boolean;
|
|
14
|
+
ingestUrl: string;
|
|
15
|
+
debug: boolean;
|
|
16
|
+
urlDenylist: RegExp;
|
|
17
|
+
replaceDefaultUrlDenylist: boolean;
|
|
18
|
+
sampleRate: number;
|
|
19
|
+
beforeEvaluate: (error: Error) => Error | false | null | Promise<Error | false | null>;
|
|
20
|
+
beforeSubmit: (report: Report) => Report | false | null | Promise<Report | false | null>;
|
|
21
|
+
};
|
|
22
|
+
type StackFrame = {
|
|
23
|
+
file: string;
|
|
24
|
+
lineNumber: number;
|
|
25
|
+
columnNumber?: number;
|
|
26
|
+
method?: string;
|
|
27
|
+
class?: string;
|
|
28
|
+
codeSnippet?: {
|
|
29
|
+
[line: number]: string;
|
|
30
|
+
};
|
|
31
|
+
isApplicationFrame?: boolean;
|
|
32
|
+
arguments?: unknown[];
|
|
33
|
+
};
|
|
34
|
+
type SpanEvent = {
|
|
35
|
+
type: string;
|
|
36
|
+
startTimeUnixNano: number;
|
|
37
|
+
endTimeUnixNano: number | null;
|
|
38
|
+
attributes: Attributes;
|
|
39
|
+
};
|
|
40
|
+
type OverriddenGrouping = 'exception_class' | 'exception_message' | 'exception_message_and_class' | 'full_stacktrace_and_exception_class_and_code';
|
|
41
|
+
type Report = {
|
|
42
|
+
exceptionClass?: string | null;
|
|
43
|
+
message?: string | null;
|
|
44
|
+
code?: string;
|
|
45
|
+
seenAtUnixNano: number;
|
|
46
|
+
isLog?: boolean;
|
|
47
|
+
level?: MessageLevel;
|
|
48
|
+
sourcemapVersionId?: string;
|
|
49
|
+
trackingUuid?: string;
|
|
50
|
+
handled?: boolean;
|
|
51
|
+
openFrameIndex?: number;
|
|
52
|
+
applicationPath?: string;
|
|
53
|
+
overriddenGrouping?: OverriddenGrouping | null;
|
|
54
|
+
stacktrace: StackFrame[];
|
|
55
|
+
events: SpanEvent[];
|
|
56
|
+
attributes: Attributes;
|
|
57
|
+
};
|
|
58
|
+
type Glow = {
|
|
59
|
+
time: number;
|
|
60
|
+
microtime: number;
|
|
61
|
+
name: string;
|
|
62
|
+
messageLevel: MessageLevel;
|
|
63
|
+
metaData: Record<string, unknown> | Record<string, unknown>[];
|
|
64
|
+
};
|
|
65
|
+
type EntryPointHandler = {
|
|
66
|
+
identifier?: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
type?: string;
|
|
69
|
+
};
|
|
70
|
+
type SdkInfo = {
|
|
71
|
+
name: string;
|
|
72
|
+
version: string;
|
|
73
|
+
};
|
|
74
|
+
type Framework = {
|
|
75
|
+
name: string;
|
|
76
|
+
version?: string;
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/api/Api.d.ts
|
|
80
|
+
declare class Api {
|
|
81
|
+
report(report: Report, url: string, key: string | null, reportBrowserExtensionErrors: boolean, debug?: boolean): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/Flare.d.ts
|
|
85
|
+
declare class Flare {
|
|
86
|
+
api: Api;
|
|
87
|
+
private _config;
|
|
88
|
+
private _glows;
|
|
89
|
+
private pendingAttributes;
|
|
90
|
+
private entryPoint;
|
|
91
|
+
private sdkInfo;
|
|
92
|
+
private framework;
|
|
93
|
+
constructor(api?: Api);
|
|
94
|
+
get config(): Readonly<Config>;
|
|
95
|
+
get glows(): readonly Glow[];
|
|
96
|
+
light(key?: string, debug?: boolean): Flare;
|
|
97
|
+
configure(config: Partial<Config>): Flare;
|
|
98
|
+
test(): Promise<void>;
|
|
99
|
+
glow(name: string, level?: MessageLevel, data?: Record<string, unknown> | Record<string, unknown>[]): Flare;
|
|
100
|
+
clearGlows(): Flare;
|
|
101
|
+
addContext(name: string, value: AttributeValue): Flare;
|
|
102
|
+
addContextGroup(groupName: string, value: Record<string, AttributeValue>): Flare;
|
|
103
|
+
setEntryPoint(handler: EntryPointHandler): Flare;
|
|
104
|
+
setSdkInfo(info: SdkInfo): Flare;
|
|
105
|
+
setFramework(framework: Framework): Flare;
|
|
106
|
+
report(error: Error, attributes?: Attributes): Promise<void>;
|
|
107
|
+
reportUnhandledRejection(message: string, attributes?: Attributes): Promise<void>;
|
|
108
|
+
reportMessage(message: string, level?: MessageLevel, attributes?: Attributes): Promise<void>;
|
|
109
|
+
createReportFromError(error: Error, attributes?: Attributes, seenAtUnixNano?: number): Promise<Report | false>;
|
|
110
|
+
private buildReport;
|
|
111
|
+
sendReport(report: Report): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/util/redactUrl.d.ts
|
|
115
|
+
declare const DEFAULT_URL_DENYLIST: RegExp;
|
|
116
|
+
declare function resolveDenylist(custom?: RegExp, replaceDefault?: boolean, defaultDenylist?: RegExp): RegExp;
|
|
117
|
+
declare function redactFullPath(fullPath: string, denylist?: RegExp): string;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/index.d.ts
|
|
120
|
+
declare const flare: Flare;
|
|
121
|
+
//#endregion
|
|
122
|
+
export { type AttributeValue, type Attributes, type Config, DEFAULT_URL_DENYLIST, type EntryPointHandler, Flare, type Framework, type Glow, type MessageLevel, type OverriddenGrouping, type Report, type SdkInfo, type SpanEvent, type StackFrame, flare, redactFullPath, resolveDenylist };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,109 +1,122 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type MessageLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency';
|
|
3
|
+
type AttributeValue = string | number | boolean | null | AttributeValue[] | {
|
|
4
|
+
[key: string]: AttributeValue;
|
|
5
|
+
};
|
|
6
|
+
type Attributes = Record<string, AttributeValue>;
|
|
1
7
|
type Config = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
key: string | null;
|
|
9
|
+
version: string;
|
|
10
|
+
sourcemapVersionId: string;
|
|
11
|
+
stage: string;
|
|
12
|
+
maxGlowsPerReport: number;
|
|
13
|
+
reportBrowserExtensionErrors: boolean;
|
|
14
|
+
ingestUrl: string;
|
|
15
|
+
debug: boolean;
|
|
16
|
+
urlDenylist: RegExp;
|
|
17
|
+
replaceDefaultUrlDenylist: boolean;
|
|
18
|
+
sampleRate: number;
|
|
19
|
+
beforeEvaluate: (error: Error) => Error | false | null | Promise<Error | false | null>;
|
|
20
|
+
beforeSubmit: (report: Report) => Report | false | null | Promise<Report | false | null>;
|
|
12
21
|
};
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
stage?: string;
|
|
22
|
+
type StackFrame = {
|
|
23
|
+
file: string;
|
|
24
|
+
lineNumber: number;
|
|
25
|
+
columnNumber?: number;
|
|
26
|
+
method?: string;
|
|
27
|
+
class?: string;
|
|
28
|
+
codeSnippet?: {
|
|
29
|
+
[line: number]: string;
|
|
30
|
+
};
|
|
31
|
+
isApplicationFrame?: boolean;
|
|
32
|
+
arguments?: unknown[];
|
|
25
33
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
type SpanEvent = {
|
|
35
|
+
type: string;
|
|
36
|
+
startTimeUnixNano: number;
|
|
37
|
+
endTimeUnixNano: number | null;
|
|
38
|
+
attributes: Attributes;
|
|
31
39
|
};
|
|
32
|
-
type
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
type OverriddenGrouping = 'exception_class' | 'exception_message' | 'exception_message_and_class' | 'full_stacktrace_and_exception_class_and_code';
|
|
41
|
+
type Report = {
|
|
42
|
+
exceptionClass?: string | null;
|
|
43
|
+
message?: string | null;
|
|
44
|
+
code?: string;
|
|
45
|
+
seenAtUnixNano: number;
|
|
46
|
+
isLog?: boolean;
|
|
47
|
+
level?: MessageLevel;
|
|
48
|
+
sourcemapVersionId?: string;
|
|
49
|
+
trackingUuid?: string;
|
|
50
|
+
handled?: boolean;
|
|
51
|
+
openFrameIndex?: number;
|
|
52
|
+
applicationPath?: string;
|
|
53
|
+
overriddenGrouping?: OverriddenGrouping | null;
|
|
54
|
+
stacktrace: StackFrame[];
|
|
55
|
+
events: SpanEvent[];
|
|
56
|
+
attributes: Attributes;
|
|
41
57
|
};
|
|
42
|
-
type
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
request_data?: {
|
|
50
|
-
queryString: {
|
|
51
|
-
[key: string]: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
cookies?: {
|
|
55
|
-
[key: string]: string;
|
|
56
|
-
};
|
|
57
|
-
[key: string]: any;
|
|
58
|
+
type Glow = {
|
|
59
|
+
time: number;
|
|
60
|
+
microtime: number;
|
|
61
|
+
name: string;
|
|
62
|
+
messageLevel: MessageLevel;
|
|
63
|
+
metaData: Record<string, unknown> | Record<string, unknown>[];
|
|
58
64
|
};
|
|
59
|
-
type
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
file: string;
|
|
64
|
-
code_snippet: {
|
|
65
|
-
[key: number]: string;
|
|
66
|
-
};
|
|
67
|
-
trimmed_column_number: number | null;
|
|
68
|
-
class: string;
|
|
65
|
+
type EntryPointHandler = {
|
|
66
|
+
identifier?: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
type?: string;
|
|
69
69
|
};
|
|
70
|
-
type
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
type SdkInfo = {
|
|
71
|
+
name: string;
|
|
72
|
+
version: string;
|
|
73
|
+
};
|
|
74
|
+
type Framework = {
|
|
75
|
+
name: string;
|
|
76
|
+
version?: string;
|
|
76
77
|
};
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/api/Api.d.ts
|
|
79
80
|
declare class Api {
|
|
80
|
-
|
|
81
|
+
report(report: Report, url: string, key: string | null, reportBrowserExtensionErrors: boolean, debug?: boolean): Promise<void>;
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/Flare.d.ts
|
|
83
85
|
declare class Flare {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
api: Api;
|
|
87
|
+
private _config;
|
|
88
|
+
private _glows;
|
|
89
|
+
private pendingAttributes;
|
|
90
|
+
private entryPoint;
|
|
91
|
+
private sdkInfo;
|
|
92
|
+
private framework;
|
|
93
|
+
constructor(api?: Api);
|
|
94
|
+
get config(): Readonly<Config>;
|
|
95
|
+
get glows(): readonly Glow[];
|
|
96
|
+
light(key?: string, debug?: boolean): Flare;
|
|
97
|
+
configure(config: Partial<Config>): Flare;
|
|
98
|
+
test(): Promise<void>;
|
|
99
|
+
glow(name: string, level?: MessageLevel, data?: Record<string, unknown> | Record<string, unknown>[]): Flare;
|
|
100
|
+
clearGlows(): Flare;
|
|
101
|
+
addContext(name: string, value: AttributeValue): Flare;
|
|
102
|
+
addContextGroup(groupName: string, value: Record<string, AttributeValue>): Flare;
|
|
103
|
+
setEntryPoint(handler: EntryPointHandler): Flare;
|
|
104
|
+
setSdkInfo(info: SdkInfo): Flare;
|
|
105
|
+
setFramework(framework: Framework): Flare;
|
|
106
|
+
report(error: Error, attributes?: Attributes): Promise<void>;
|
|
107
|
+
reportUnhandledRejection(message: string, attributes?: Attributes): Promise<void>;
|
|
108
|
+
reportMessage(message: string, level?: MessageLevel, attributes?: Attributes): Promise<void>;
|
|
109
|
+
createReportFromError(error: Error, attributes?: Attributes, seenAtUnixNano?: number): Promise<Report | false>;
|
|
110
|
+
private buildReport;
|
|
111
|
+
sendReport(report: Report): Promise<void>;
|
|
105
112
|
}
|
|
106
|
-
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/util/redactUrl.d.ts
|
|
115
|
+
declare const DEFAULT_URL_DENYLIST: RegExp;
|
|
116
|
+
declare function resolveDenylist(custom?: RegExp, replaceDefault?: boolean, defaultDenylist?: RegExp): RegExp;
|
|
117
|
+
declare function redactFullPath(fullPath: string, denylist?: RegExp): string;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/index.d.ts
|
|
107
120
|
declare const flare: Flare;
|
|
108
|
-
|
|
109
|
-
export { Flare, flare };
|
|
121
|
+
//#endregion
|
|
122
|
+
export { type AttributeValue, type Attributes, type Config, DEFAULT_URL_DENYLIST, type EntryPointHandler, Flare, type Framework, type Glow, type MessageLevel, type OverriddenGrouping, type Report, type SdkInfo, type SpanEvent, type StackFrame, flare, redactFullPath, resolveDenylist };
|