@y-monitor/types 1.0.5 → 1.0.7

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/types.d.ts CHANGED
@@ -11,6 +11,8 @@ export declare interface AuthInfo {
11
11
  }
12
12
 
13
13
  export declare interface BaseClientType<O extends BaseOptionsFieldsIntegrationType = BaseOptionsFieldsIntegrationType> {
14
+ SDK_NAME?: string;
15
+ SDK_VERSION: string;
14
16
  options: O;
15
17
  }
16
18
 
@@ -18,17 +20,21 @@ export declare type BaseOptionsFieldsIntegrationType = BaseOptionsFieldsType & B
18
20
 
19
21
  export declare interface BaseOptionsFieldsType {
20
22
  dsn?: string;
23
+ disabled?: boolean;
21
24
  apiKey?: string;
25
+ debug?: boolean;
26
+ maxBreadcrumbs?: number;
27
+ enableTraceId?: boolean;
28
+ traceIdFieldName?: string;
22
29
  includeHttpUrlTraceIdRegExp?: RegExp;
23
30
  filterXhrUrlRegExp?: RegExp;
24
- maxBreadcrumbs?: number;
25
31
  throttleDelayTime?: number;
26
32
  }
27
33
 
28
34
  export declare interface BaseOptionsHooksType {
29
35
  beforeDataReport?(): any;
30
36
  beforePushBreadcrumb?(): any;
31
- beforeAjaxSend?(): any;
37
+ beforeAjaxSend?(config: any, setRequestHeader: any): any;
32
38
  }
33
39
 
34
40
  export declare interface BaseOptionsType<O extends BaseOptionsFieldsIntegrationType> extends BaseOptionsFieldsIntegrationType {
@@ -37,7 +43,7 @@ export declare interface BaseOptionsType<O extends BaseOptionsFieldsIntegrationT
37
43
 
38
44
  export declare interface BasePluginType<E extends EventTypes = EventTypes, T extends BaseClientType = BaseClientType> {
39
45
  name: E;
40
- monitor: (this: T, notify: () => void) => void;
46
+ monitor: (this: T, notify: (eventName: E, data: any) => void) => void;
41
47
  transform: (this: T, data: any) => void;
42
48
  consumer: (this: T, data: any) => void;
43
49
  }
@@ -64,6 +70,12 @@ export declare interface ConsoleCollectType {
64
70
  level: string;
65
71
  }
66
72
 
73
+ export declare interface DeviceInfo {
74
+ deviceOs: string;
75
+ deviceName: string;
76
+ deviceVersion: string;
77
+ }
78
+
67
79
  export declare interface HttpCollectedType {
68
80
  request: {
69
81
  httpType?: HttpTypes;
@@ -120,6 +132,10 @@ export declare enum Severity {
120
132
  Critical = "critical"
121
133
  }
122
134
 
135
+ export declare namespace Severity {
136
+ export function fromString(level: string): Severity;
137
+ }
138
+
123
139
  export declare type TNumStrObj = number | string | object;
124
140
 
125
141
  export declare interface TransportDataType {
package/dist/types.esm.js CHANGED
@@ -9,6 +9,30 @@ var Severity;
9
9
  Severity["Normal"] = "normal";
10
10
  Severity["High"] = "high";
11
11
  Severity["Critical"] = "critical";
12
+ })(Severity || (Severity = {}));
13
+ (function (Severity) {
14
+ function fromString(level) {
15
+ switch (level) {
16
+ case 'debug':
17
+ return Severity.Debug;
18
+ case 'info':
19
+ case 'log':
20
+ case 'assert':
21
+ return Severity.Info;
22
+ case 'warn':
23
+ case 'warning':
24
+ return Severity.Warning;
25
+ case Severity.Low:
26
+ case Severity.Normal:
27
+ case Severity.High:
28
+ case Severity.Critical:
29
+ case 'error':
30
+ return Severity.Error;
31
+ default:
32
+ return Severity.Else;
33
+ }
34
+ }
35
+ Severity.fromString = fromString;
12
36
  })(Severity || (Severity = {}));
13
37
 
14
38
  export { Severity };
@@ -1 +1 @@
1
- {"version":3,"file":"types.esm.js","sources":["../src/common.ts"],"sourcesContent":["import { HttpCollectedType } from './http';\n\nexport enum Severity {\n Else = 'else',\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Debug = 'debug',\n /** 上报的错误等级 */\n Low = 'low',\n Normal = 'normal',\n High = 'high',\n Critical = 'critical'\n}\n\nexport type NumStrObj = number | string | object;\n\nexport interface LogTypes {\n level?: Severity;\n message?: NumStrObj;\n}\n\nexport interface IAnyObject {\n [key: string]: any;\n}\n\nexport interface MITOXMLHttpRequest extends XMLHttpRequest {\n [key: string]: any;\n httpCollect?: HttpCollectedType;\n}\n\nexport type voidFun = () => void;\n\nexport type TNumStrObj = number | string | object;\n"],"names":[],"mappings":"IAEY,SAWX;AAXD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AAEf,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAXW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"types.esm.js","sources":["../src/common.ts"],"sourcesContent":["import { HttpCollectedType } from './http';\n\nexport enum Severity {\n Else = 'else',\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Debug = 'debug',\n /** 上报的错误等级 */\n Low = 'low',\n Normal = 'normal',\n High = 'high',\n Critical = 'critical'\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Severity {\n /**\n * Converts a string-based level into a {@link Severity}.\n *\n * @param level string representation of Severity\n * @returns Severity\n */\n export function fromString(level: string): Severity {\n switch (level) {\n case 'debug':\n return Severity.Debug;\n case 'info':\n case 'log':\n case 'assert':\n return Severity.Info;\n case 'warn':\n case 'warning':\n return Severity.Warning;\n case Severity.Low:\n case Severity.Normal:\n case Severity.High:\n case Severity.Critical:\n case 'error':\n return Severity.Error;\n default:\n return Severity.Else;\n }\n }\n}\n\nexport type NumStrObj = number | string | object;\n\nexport interface LogTypes {\n level?: Severity;\n message?: NumStrObj;\n}\n\nexport interface IAnyObject {\n [key: string]: any;\n}\n\nexport interface MITOXMLHttpRequest extends XMLHttpRequest {\n [key: string]: any;\n httpCollect?: HttpCollectedType;\n}\n\nexport type voidFun = () => void;\n\nexport type TNumStrObj = number | string | object;\n"],"names":[],"mappings":"IAEY,SAWX;AAXD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AAEf,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAXW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA,CAWnB;AAGD,CAAA,UAAiB,QAAQ,EAAA;IAOvB,SAAgB,UAAU,CAAC,KAAa,EAAA;AACtC,QAAA,QAAQ,KAAK;AACX,YAAA,KAAK,OAAO;gBACV,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,YAAA,KAAK,MAAM,CAAC;AACZ,YAAA,KAAK,KAAK,CAAC;AACX,YAAA,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,YAAA,KAAK,MAAM,CAAC;AACZ,YAAA,KAAK,SAAS;gBACZ,OAAO,QAAQ,CAAC,OAAO,CAAC;YAC1B,KAAK,QAAQ,CAAC,GAAG,CAAC;YAClB,KAAK,QAAQ,CAAC,MAAM,CAAC;YACrB,KAAK,QAAQ,CAAC,IAAI,CAAC;YACnB,KAAK,QAAQ,CAAC,QAAQ,CAAC;AACvB,YAAA,KAAK,OAAO;gBACV,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,YAAA;gBACE,OAAO,QAAQ,CAAC,IAAI,CAAC;AACxB,SAAA;IACH,CAAC;AApBe,IAAA,QAAA,CAAA,UAAU,aAoBzB,CAAA;AACH,CAAC,EA5BgB,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;;;;"}
package/dist/types.js CHANGED
@@ -11,5 +11,29 @@ exports.Severity = void 0;
11
11
  Severity["Normal"] = "normal";
12
12
  Severity["High"] = "high";
13
13
  Severity["Critical"] = "critical";
14
+ })(exports.Severity || (exports.Severity = {}));
15
+ (function (Severity) {
16
+ function fromString(level) {
17
+ switch (level) {
18
+ case 'debug':
19
+ return Severity.Debug;
20
+ case 'info':
21
+ case 'log':
22
+ case 'assert':
23
+ return Severity.Info;
24
+ case 'warn':
25
+ case 'warning':
26
+ return Severity.Warning;
27
+ case Severity.Low:
28
+ case Severity.Normal:
29
+ case Severity.High:
30
+ case Severity.Critical:
31
+ case 'error':
32
+ return Severity.Error;
33
+ default:
34
+ return Severity.Else;
35
+ }
36
+ }
37
+ Severity.fromString = fromString;
14
38
  })(exports.Severity || (exports.Severity = {}));
15
39
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../src/common.ts"],"sourcesContent":["import { HttpCollectedType } from './http';\n\nexport enum Severity {\n Else = 'else',\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Debug = 'debug',\n /** 上报的错误等级 */\n Low = 'low',\n Normal = 'normal',\n High = 'high',\n Critical = 'critical'\n}\n\nexport type NumStrObj = number | string | object;\n\nexport interface LogTypes {\n level?: Severity;\n message?: NumStrObj;\n}\n\nexport interface IAnyObject {\n [key: string]: any;\n}\n\nexport interface MITOXMLHttpRequest extends XMLHttpRequest {\n [key: string]: any;\n httpCollect?: HttpCollectedType;\n}\n\nexport type voidFun = () => void;\n\nexport type TNumStrObj = number | string | object;\n"],"names":["Severity"],"mappings":";;AAEYA,0BAWX;AAXD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AAEf,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAXWA,gBAAQ,KAARA,gBAAQ,GAAA,EAAA,CAAA,CAAA;;"}
1
+ {"version":3,"file":"types.js","sources":["../src/common.ts"],"sourcesContent":["import { HttpCollectedType } from './http';\n\nexport enum Severity {\n Else = 'else',\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Debug = 'debug',\n /** 上报的错误等级 */\n Low = 'low',\n Normal = 'normal',\n High = 'high',\n Critical = 'critical'\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Severity {\n /**\n * Converts a string-based level into a {@link Severity}.\n *\n * @param level string representation of Severity\n * @returns Severity\n */\n export function fromString(level: string): Severity {\n switch (level) {\n case 'debug':\n return Severity.Debug;\n case 'info':\n case 'log':\n case 'assert':\n return Severity.Info;\n case 'warn':\n case 'warning':\n return Severity.Warning;\n case Severity.Low:\n case Severity.Normal:\n case Severity.High:\n case Severity.Critical:\n case 'error':\n return Severity.Error;\n default:\n return Severity.Else;\n }\n }\n}\n\nexport type NumStrObj = number | string | object;\n\nexport interface LogTypes {\n level?: Severity;\n message?: NumStrObj;\n}\n\nexport interface IAnyObject {\n [key: string]: any;\n}\n\nexport interface MITOXMLHttpRequest extends XMLHttpRequest {\n [key: string]: any;\n httpCollect?: HttpCollectedType;\n}\n\nexport type voidFun = () => void;\n\nexport type TNumStrObj = number | string | object;\n"],"names":["Severity"],"mappings":";;AAEYA,0BAWX;AAXD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AAEf,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,QAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAXWA,gBAAQ,KAARA,gBAAQ,GAAA,EAAA,CAAA,CAAA,CAWnB;AAGD,CAAA,UAAiB,QAAQ,EAAA;IAOvB,SAAgB,UAAU,CAAC,KAAa,EAAA;AACtC,QAAA,QAAQ,KAAK;AACX,YAAA,KAAK,OAAO;gBACV,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,YAAA,KAAK,MAAM,CAAC;AACZ,YAAA,KAAK,KAAK,CAAC;AACX,YAAA,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,YAAA,KAAK,MAAM,CAAC;AACZ,YAAA,KAAK,SAAS;gBACZ,OAAO,QAAQ,CAAC,OAAO,CAAC;YAC1B,KAAK,QAAQ,CAAC,GAAG,CAAC;YAClB,KAAK,QAAQ,CAAC,MAAM,CAAC;YACrB,KAAK,QAAQ,CAAC,IAAI,CAAC;YACnB,KAAK,QAAQ,CAAC,QAAQ,CAAC;AACvB,YAAA,KAAK,OAAO;gBACV,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,YAAA;gBACE,OAAO,QAAQ,CAAC,IAAI,CAAC;AACxB,SAAA;IACH,CAAC;AApBe,IAAA,QAAA,CAAA,UAAU,aAoBzB,CAAA;AACH,CAAC,EA5BgBA,gBAAQ,KAARA,gBAAQ,GAAA,EAAA,CAAA,CAAA;;"}
package/dist/types.min.js CHANGED
@@ -1 +1 @@
1
- var MONITOR=function(r){"use strict";var i;return r.Severity=void 0,(i=r.Severity||(r.Severity={})).Else="else",i.Error="error",i.Warning="warning",i.Info="info",i.Debug="debug",i.Low="low",i.Normal="normal",i.High="high",i.Critical="critical",r}({});
1
+ var MONITOR=function(r){"use strict";var e;return r.Severity=void 0,(e=r.Severity||(r.Severity={})).Else="else",e.Error="error",e.Warning="warning",e.Info="info",e.Debug="debug",e.Low="low",e.Normal="normal",e.High="high",e.Critical="critical",function(r){r.fromString=function(e){switch(e){case"debug":return r.Debug;case"info":case"log":case"assert":return r.Info;case"warn":case"warning":return r.Warning;case r.Low:case r.Normal:case r.High:case r.Critical:case"error":return r.Error;default:return r.Else}}}(r.Severity||(r.Severity={})),r}({});
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@y-monitor/types",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "@y-monitor/types",
5
- "main": "src/index.ts",
5
+ "main": "dist/types.js",
6
+ "module": "dist/types.esm.js",
7
+ "types": "dist/types.d.ts",
6
8
  "scripts": {
7
9
  "test": "echo \"Error: no test specified\" && exit 1"
8
10
  },
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './basePluginType';
2
- export * from './baseClientType';
3
- export * from './baseOptionsType';
4
- export * from './common';
5
- export * from './breadcrumb';
6
- export * from './http';
7
- export * from './transport';