@bugfender/rn-bugfender 2.1.0 → 2.1.2

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.
Files changed (114) hide show
  1. package/RnBugfender.podspec +17 -2
  2. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  3. package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
  4. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  5. package/android/.gradle/6.1.1/gc.properties +0 -0
  6. package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
  7. package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  8. package/android/.gradle/7.4.2/dependencies-accessors/gc.properties +0 -0
  9. package/android/.gradle/7.4.2/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
  12. package/android/.gradle/7.4.2/gc.properties +0 -0
  13. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  14. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  15. package/android/.gradle/checksums/checksums.lock +0 -0
  16. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  17. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  18. package/android/.gradle/vcs-1/gc.properties +0 -0
  19. package/android/.idea/codeStyles/Project.xml +116 -0
  20. package/android/.idea/gradle.xml +19 -0
  21. package/android/.idea/misc.xml +9 -0
  22. package/android/.idea/modules/android.iml +18 -0
  23. package/android/.idea/modules.xml +8 -0
  24. package/android/.idea/vcs.xml +6 -0
  25. package/android/.idea/workspace.xml +47 -0
  26. package/android/build.gradle +117 -40
  27. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
  29. package/android/gradle.properties +5 -0
  30. package/android/gradlew +21 -34
  31. package/android/gradlew.bat +19 -24
  32. package/android/local.properties +8 -0
  33. package/android/src/main/java/com/{bugfender/react → bugfender.react}/RnBugfenderModule.java +0 -0
  34. package/android/src/main/java/com/{bugfender/react → bugfender.react}/RnBugfenderPackage.java +0 -0
  35. package/ios/{RnBugfender.m → RnBugfender.mm} +16 -4
  36. package/ios/RnBugfender.xcodeproj/project.pbxproj +4 -17
  37. package/lib/commonjs/bugfender.js +14 -26
  38. package/lib/commonjs/bugfender.js.map +1 -1
  39. package/lib/commonjs/index.js +2 -2
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/index.web.js +2 -2
  42. package/lib/commonjs/index.web.js.map +1 -1
  43. package/lib/commonjs/override-console-methods.js +9 -9
  44. package/lib/commonjs/override-console-methods.js.map +1 -1
  45. package/lib/commonjs/sdk-options.js +5 -34
  46. package/lib/commonjs/sdk-options.js.map +1 -1
  47. package/lib/commonjs/types/sdk-options.js +2 -2
  48. package/lib/commonjs/types/sdk-options.js.map +1 -1
  49. package/lib/commonjs/user-feedback.js.map +1 -1
  50. package/lib/module/bugfender.js +12 -22
  51. package/lib/module/bugfender.js.map +1 -1
  52. package/lib/module/index.js +1 -1
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/index.web.js +1 -1
  55. package/lib/module/index.web.js.map +1 -1
  56. package/lib/module/override-console-methods.js +9 -9
  57. package/lib/module/override-console-methods.js.map +1 -1
  58. package/lib/module/sdk-options.js +5 -34
  59. package/lib/module/sdk-options.js.map +1 -1
  60. package/lib/module/types/sdk-options.js +2 -2
  61. package/lib/module/types/sdk-options.js.map +1 -1
  62. package/lib/module/user-feedback.js.map +1 -1
  63. package/lib/typescript/bugfender.d.ts +5 -6
  64. package/lib/typescript/bugfender.d.ts.map +1 -0
  65. package/lib/typescript/index.d.ts +2 -1
  66. package/lib/typescript/index.d.ts.map +1 -0
  67. package/lib/typescript/index.web.d.ts +2 -1
  68. package/lib/typescript/index.web.d.ts.map +1 -0
  69. package/lib/typescript/override-console-methods.d.ts +2 -2
  70. package/lib/typescript/override-console-methods.d.ts.map +1 -0
  71. package/lib/typescript/sdk-options.d.ts +3 -12
  72. package/lib/typescript/sdk-options.d.ts.map +1 -0
  73. package/lib/typescript/types/sdk-options.d.ts +1 -0
  74. package/lib/typescript/types/sdk-options.d.ts.map +1 -0
  75. package/lib/typescript/user-feedback.d.ts +3 -15
  76. package/lib/typescript/user-feedback.d.ts.map +1 -0
  77. package/package.json +28 -24
  78. package/src/bugfender.ts +12 -17
  79. package/src/index.tsx +1 -1
  80. package/src/index.web.tsx +1 -1
  81. package/src/override-console-methods.ts +8 -9
  82. package/src/sdk-options.ts +6 -35
  83. package/src/types/sdk-options.ts +2 -2
  84. package/src/user-feedback.ts +3 -16
  85. package/lib/commonjs/print-to-console.js +0 -78
  86. package/lib/commonjs/print-to-console.js.map +0 -1
  87. package/lib/commonjs/string-formatter.js +0 -55
  88. package/lib/commonjs/string-formatter.js.map +0 -1
  89. package/lib/commonjs/types/device.js +0 -2
  90. package/lib/commonjs/types/device.js.map +0 -1
  91. package/lib/commonjs/types/log.js +0 -35
  92. package/lib/commonjs/types/log.js.map +0 -1
  93. package/lib/commonjs/utilities.js +0 -18
  94. package/lib/commonjs/utilities.js.map +0 -1
  95. package/lib/module/print-to-console.js +0 -67
  96. package/lib/module/print-to-console.js.map +0 -1
  97. package/lib/module/string-formatter.js +0 -45
  98. package/lib/module/string-formatter.js.map +0 -1
  99. package/lib/module/types/device.js +0 -2
  100. package/lib/module/types/device.js.map +0 -1
  101. package/lib/module/types/log.js +0 -24
  102. package/lib/module/types/log.js.map +0 -1
  103. package/lib/module/utilities.js +0 -11
  104. package/lib/module/utilities.js.map +0 -1
  105. package/lib/typescript/print-to-console.d.ts +0 -14
  106. package/lib/typescript/string-formatter.d.ts +0 -4
  107. package/lib/typescript/types/device.d.ts +0 -4
  108. package/lib/typescript/types/log.d.ts +0 -59
  109. package/lib/typescript/utilities.d.ts +0 -1
  110. package/src/print-to-console.ts +0 -67
  111. package/src/string-formatter.ts +0 -44
  112. package/src/types/device.ts +0 -4
  113. package/src/types/log.ts +0 -75
  114. package/src/utilities.ts +0 -8
@@ -1,67 +0,0 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
- import { format } from 'util';
4
- import { LogLevel } from "./types/log";
5
- export class PrintToConsole {
6
- constructor(console) {
7
- this.console = console;
8
-
9
- _defineProperty(this, "printToConsole", false);
10
- }
11
-
12
- init(printToConsole) {
13
- this.printToConsole = printToConsole;
14
- }
15
-
16
- error() {
17
- if (this.printToConsole) {
18
- this.console.error(...arguments);
19
- }
20
- }
21
-
22
- info() {
23
- if (this.printToConsole) {
24
- this.console.info(...arguments);
25
- }
26
- }
27
-
28
- log() {
29
- if (this.printToConsole) {
30
- this.console.log(...arguments);
31
- }
32
- }
33
-
34
- debug() {
35
- if (this.printToConsole) {
36
- this.console.debug(...arguments);
37
- }
38
- }
39
-
40
- trace() {
41
- if (this.printToConsole) {
42
- this.console.trace(...arguments);
43
- }
44
- }
45
-
46
- warn() {
47
- if (this.printToConsole) {
48
- this.console.warn(...arguments);
49
- }
50
- }
51
-
52
- printLog(log) {
53
- if (this.printToConsole) {
54
- // Log to browser console
55
- // debug, warning, error, trace, info, fatal
56
- const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];
57
- const method = levelToMethod[log.level || LogLevel.Debug];
58
- const tag = log.tag ? `[${log.tag}] ` : '';
59
- const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');
60
- const message = `${tag}${format(log.text)} ${location}`; // @ts-ignore
61
-
62
- this.console[method](message);
63
- }
64
- }
65
-
66
- }
67
- //# sourceMappingURL=print-to-console.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["print-to-console.ts"],"names":["format","LogLevel","PrintToConsole","constructor","console","init","printToConsole","error","info","log","debug","trace","warn","printLog","levelToMethod","method","level","Debug","tag","location","file","line","filter","p","join","message","text"],"mappings":";;AAAA,SAAQA,MAAR,QAAqB,MAArB;AAEA,SAAQC,QAAR,QAAuB,aAAvB;AAEA,OAAO,MAAMC,cAAN,CAAqB;AAG1BC,EAAAA,WAAW,CACUC,OADV,EAET;AAAA,SADmBA,OACnB,GADmBA,OACnB;;AAAA,4CAJkC,KAIlC;AACD;;AAEMC,EAAAA,IAAI,CAACC,cAAD,EAAgC;AACzC,SAAKA,cAAL,GAAsBA,cAAtB;AACD;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKD,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaG,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKF,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaI,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,GAAG,GAAiC;AACzC,QAAI,KAAKH,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaK,GAAb,CAAiB,YAAjB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKJ,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaM,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKL,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaO,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKN,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaQ,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,QAAQ,CAACJ,GAAD,EAAuB;AACpC,QAAI,KAAKH,cAAT,EAAyB;AACvB;AACA;AACA,YAAMQ,aAAa,GAAG,CAAC,KAAD,EAAQ,MAAR,EAAgB,OAAhB,EAAyB,OAAzB,EAAkC,MAAlC,EAA0C,OAA1C,CAAtB;AACA,YAAMC,MAAM,GAAGD,aAAa,CAACL,GAAG,CAACO,KAAJ,IAAaf,QAAQ,CAACgB,KAAvB,CAA5B;AACA,YAAMC,GAAG,GAAGT,GAAG,CAACS,GAAJ,GAAW,IAAGT,GAAG,CAACS,GAAI,IAAtB,GAA4B,EAAxC;AACA,YAAMC,QAAQ,GAAG,CAACV,GAAG,CAACW,IAAJ,IAAY,EAAb,EAAiBX,GAAG,CAACM,MAAJ,IAAc,EAA/B,EAAmCN,GAAG,CAACY,IAAJ,IAAY,EAA/C,EAAmDC,MAAnD,CAA0DC,CAAC,IAAIA,CAAC,KAAK,EAArE,EAAyEC,IAAzE,CAA8E,GAA9E,CAAjB;AACA,YAAMC,OAAO,GAAI,GAAEP,GAAI,GAAElB,MAAM,CAACS,GAAG,CAACiB,IAAL,CAAW,IAAGP,QAAS,EAAtD,CAPuB,CASvB;;AACA,WAAKf,OAAL,CAAaW,MAAb,EAAqBU,OAArB;AACD;AACF;;AA7DyB","sourcesContent":["import {format} from 'util';\nimport type {ILogEntry} from \"./types/log\";\nimport {LogLevel} from \"./types/log\";\n\nexport class PrintToConsole {\n protected printToConsole: boolean = false;\n\n constructor(\n protected readonly console: Console,\n ) {\n }\n\n public init(printToConsole: boolean): void {\n this.printToConsole = printToConsole;\n }\n\n public error(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.error(...parameters);\n }\n }\n\n public info(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.info(...parameters);\n }\n }\n\n public log(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.log(...parameters);\n }\n }\n\n public debug(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.debug(...parameters);\n }\n }\n\n public trace(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.trace(...parameters);\n }\n }\n\n public warn(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.warn(...parameters);\n }\n }\n\n public printLog(log: ILogEntry): void {\n if (this.printToConsole) {\n // Log to browser console\n // debug, warning, error, trace, info, fatal\n const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];\n const method = levelToMethod[log.level || LogLevel.Debug];\n const tag = log.tag ? `[${log.tag}] ` : '';\n const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');\n const message = `${tag}${format(log.text)} ${location}`;\n\n // @ts-ignore\n this.console[method](message);\n }\n }\n}\n"]}
@@ -1,45 +0,0 @@
1
- import { format } from "util";
2
- export class StringFormatter {
3
- format(parameters) {
4
- const [, ...textParams] = parameters;
5
- let [textFormat] = parameters;
6
- let text;
7
-
8
- try {
9
- // Our sanitizer gives better results, try with it first
10
- textFormat = this.toString(textFormat);
11
- } catch {
12
- // Fallback to `format`
13
- textFormat = format(textFormat);
14
- }
15
-
16
- if (textParams.length > 0) {
17
- text = format(textFormat, ...textParams);
18
- } else {
19
- text = textFormat;
20
- }
21
-
22
- return text;
23
- }
24
-
25
- toString(value) {
26
- // Depending on the type we prefer to do `String` or `stringify`
27
- const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;
28
-
29
- if (isToString) {
30
- try {
31
- return String(value);
32
- } catch {
33
- return JSON.stringify(value);
34
- }
35
- } else {
36
- try {
37
- return JSON.stringify(value);
38
- } catch {
39
- return String(value);
40
- }
41
- }
42
- }
43
-
44
- }
45
- //# sourceMappingURL=string-formatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["string-formatter.ts"],"names":["format","StringFormatter","parameters","textParams","textFormat","text","toString","length","value","isToString","includes","Error","String","JSON","stringify"],"mappings":"AAAA,SAAQA,MAAR,QAAqB,MAArB;AAEA,OAAO,MAAMC,eAAN,CAAsB;AACpBD,EAAAA,MAAM,CAACE,UAAD,EAAgC;AAC3C,UAAM,GAAG,GAAGC,UAAN,IAAoBD,UAA1B;AACA,QAAI,CAACE,UAAD,IAAeF,UAAnB;AACA,QAAIG,IAAJ;;AAEA,QAAI;AACF;AACAD,MAAAA,UAAU,GAAG,KAAKE,QAAL,CAAcF,UAAd,CAAb;AACD,KAHD,CAGE,MAAM;AACN;AACAA,MAAAA,UAAU,GAAGJ,MAAM,CAACI,UAAD,CAAnB;AACD;;AAED,QAAID,UAAU,CAACI,MAAX,GAAoB,CAAxB,EAA2B;AACzBF,MAAAA,IAAI,GAAGL,MAAM,CAACI,UAAD,EAAa,GAAGD,UAAhB,CAAb;AACD,KAFD,MAEO;AACLE,MAAAA,IAAI,GAAGD,UAAP;AACD;;AAED,WAAOC,IAAP;AACD;;AAEOC,EAAAA,QAAQ,CAACE,KAAD,EAAyB;AACvC;AACA,UAAMC,UAAU,GAAG,CAAC,QAAD,EAAW,QAAX,EAAqB,QAArB,EAA+B,UAA/B,EAA2CC,QAA3C,CAAoD,OAAOF,KAA3D,KAAqEA,KAAK,YAAYG,KAAzG;;AAEA,QAAIF,UAAJ,EAAgB;AACd,UAAI;AACF,eAAOG,MAAM,CAACJ,KAAD,CAAb;AACD,OAFD,CAEE,MAAM;AACN,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD;AACF,KAND,MAMO;AACL,UAAI;AACF,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD,OAFD,CAEE,MAAM;AACN,eAAOI,MAAM,CAACJ,KAAD,CAAb;AACD;AACF;AACF;;AAxC0B","sourcesContent":["import {format} from \"util\";\n\nexport class StringFormatter {\n public format(parameters: unknown[]): string {\n const [, ...textParams] = parameters;\n let [textFormat] = parameters as string[];\n let text: string;\n\n try {\n // Our sanitizer gives better results, try with it first\n textFormat = this.toString(textFormat);\n } catch {\n // Fallback to `format`\n textFormat = format(textFormat);\n }\n\n if (textParams.length > 0) {\n text = format(textFormat, ...textParams);\n } else {\n text = textFormat;\n }\n\n return text;\n }\n\n private toString(value: unknown): string {\n // Depending on the type we prefer to do `String` or `stringify`\n const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;\n\n if (isToString) {\n try {\n return String(value);\n } catch {\n return JSON.stringify(value);\n }\n } else {\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n }\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=device.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1,24 +0,0 @@
1
- /**
2
- * Log Levels
3
- *
4
- * Check the main README to see how to access the `LogLevel` enum.
5
- */
6
- export let LogLevel;
7
- /**
8
- * @hidden
9
- */
10
-
11
- (function (LogLevel) {
12
- LogLevel[LogLevel["Debug"] = 0] = "Debug";
13
- LogLevel[LogLevel["Warning"] = 1] = "Warning";
14
- LogLevel[LogLevel["Error"] = 2] = "Error";
15
- LogLevel[LogLevel["Trace"] = 3] = "Trace";
16
- LogLevel[LogLevel["Info"] = 4] = "Info";
17
- LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
18
- })(LogLevel || (LogLevel = {}));
19
-
20
- export const LOG_LEVELS = [LogLevel.Debug, LogLevel.Warning, LogLevel.Error, LogLevel.Trace, LogLevel.Info, LogLevel.Fatal];
21
- /**
22
- * @hidden
23
- */
24
- //# sourceMappingURL=log.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["log.ts"],"names":["LogLevel","LOG_LEVELS","Debug","Warning","Error","Trace","Info","Fatal"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,WAAYA,QAAZ;AASA;AACA;AACA;;WAXYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAYZ,OAAO,MAAMC,UAAsB,GAAG,CACpCD,QAAQ,CAACE,KAD2B,EAEpCF,QAAQ,CAACG,OAF2B,EAGpCH,QAAQ,CAACI,KAH2B,EAIpCJ,QAAQ,CAACK,KAJ2B,EAKpCL,QAAQ,CAACM,IAL2B,EAMpCN,QAAQ,CAACO,KAN2B,CAA/B;AASP;AACA;AACA","sourcesContent":["/**\n * Log Levels\n *\n * Check the main README to see how to access the `LogLevel` enum.\n */\nexport enum LogLevel {\n Debug = 0,\n Warning = 1,\n Error = 2,\n Trace = 3,\n Info = 4,\n Fatal = 5,\n}\n\n/**\n * @hidden\n */\nexport const LOG_LEVELS: LogLevel[] = [\n LogLevel.Debug,\n LogLevel.Warning,\n LogLevel.Error,\n LogLevel.Trace,\n LogLevel.Info,\n LogLevel.Fatal,\n];\n\n/**\n * @hidden\n */\nexport interface ILogEntryShort {\n /** Date ISO */\n x: string;\n /** Text */\n t: string;\n /** Method */\n m: string;\n /** Absolute Time */\n at: number;\n /** Tag */\n tg: string;\n /** File */\n f: string;\n /** Line */\n l: number;\n /** Level */\n ll: number;\n /** URL */\n u: string;\n}\n\n/**\n * Log Entry object interface\n */\nexport interface ILogEntry {\n /** The line number where the log was triggered from */\n line?: number;\n\n /** The log's level based on LogLevel constant */\n level?: LogLevel;\n\n /** The log's tag */\n tag?: string;\n\n /** The method name where the log was triggered from */\n method?: string;\n\n /** The file name where the log was triggered from */\n file?: string;\n\n /** The log's text content */\n text?: string;\n\n /** The log's origin URL. This attribute is ignored on Android & iOS */\n url?: string;\n}\n"]}
@@ -1,11 +0,0 @@
1
- export function removeUndefinedAttributes(object) {
2
- Object.entries(object).forEach(_ref => {
3
- let [key, value] = _ref;
4
-
5
- if (value === undefined) {
6
- // @ts-ignore
7
- delete object[key];
8
- }
9
- });
10
- }
11
- //# sourceMappingURL=utilities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utilities.ts"],"names":["removeUndefinedAttributes","object","Object","entries","forEach","key","value","undefined"],"mappings":"AAAA,OAAO,SAASA,yBAAT,CAAmCC,MAAnC,EAAgD;AACrDC,EAAAA,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,OAAvB,CAA+B,QAAkB;AAAA,QAAjB,CAACC,GAAD,EAAMC,KAAN,CAAiB;;AAC/C,QAAIA,KAAK,KAAKC,SAAd,EAAyB;AACvB;AACA,aAAON,MAAM,CAACI,GAAD,CAAb;AACD;AACF,GALD;AAMD","sourcesContent":["export function removeUndefinedAttributes(object: any) {\n Object.entries(object).forEach(([key, value]) => {\n if (value === undefined) {\n // @ts-ignore\n delete object[key];\n }\n });\n}\n"]}
@@ -1,14 +0,0 @@
1
- import type { ILogEntry } from "./types/log";
2
- export declare class PrintToConsole {
3
- protected readonly console: Console;
4
- protected printToConsole: boolean;
5
- constructor(console: Console);
6
- init(printToConsole: boolean): void;
7
- error(...parameters: unknown[]): void;
8
- info(...parameters: unknown[]): void;
9
- log(...parameters: unknown[]): void;
10
- debug(...parameters: unknown[]): void;
11
- trace(...parameters: unknown[]): void;
12
- warn(...parameters: unknown[]): void;
13
- printLog(log: ILogEntry): void;
14
- }
@@ -1,4 +0,0 @@
1
- export declare class StringFormatter {
2
- format(parameters: unknown[]): string;
3
- private toString;
4
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Device Key Value
3
- */
4
- export declare type DeviceKeyValue = string | number | boolean;
@@ -1,59 +0,0 @@
1
- /**
2
- * Log Levels
3
- *
4
- * Check the main README to see how to access the `LogLevel` enum.
5
- */
6
- export declare enum LogLevel {
7
- Debug = 0,
8
- Warning = 1,
9
- Error = 2,
10
- Trace = 3,
11
- Info = 4,
12
- Fatal = 5
13
- }
14
- /**
15
- * @hidden
16
- */
17
- export declare const LOG_LEVELS: LogLevel[];
18
- /**
19
- * @hidden
20
- */
21
- export interface ILogEntryShort {
22
- /** Date ISO */
23
- x: string;
24
- /** Text */
25
- t: string;
26
- /** Method */
27
- m: string;
28
- /** Absolute Time */
29
- at: number;
30
- /** Tag */
31
- tg: string;
32
- /** File */
33
- f: string;
34
- /** Line */
35
- l: number;
36
- /** Level */
37
- ll: number;
38
- /** URL */
39
- u: string;
40
- }
41
- /**
42
- * Log Entry object interface
43
- */
44
- export interface ILogEntry {
45
- /** The line number where the log was triggered from */
46
- line?: number;
47
- /** The log's level based on LogLevel constant */
48
- level?: LogLevel;
49
- /** The log's tag */
50
- tag?: string;
51
- /** The method name where the log was triggered from */
52
- method?: string;
53
- /** The file name where the log was triggered from */
54
- file?: string;
55
- /** The log's text content */
56
- text?: string;
57
- /** The log's origin URL. This attribute is ignored on Android & iOS */
58
- url?: string;
59
- }
@@ -1 +0,0 @@
1
- export declare function removeUndefinedAttributes(object: any): void;
@@ -1,67 +0,0 @@
1
- import {format} from 'util';
2
- import type {ILogEntry} from "./types/log";
3
- import {LogLevel} from "./types/log";
4
-
5
- export class PrintToConsole {
6
- protected printToConsole: boolean = false;
7
-
8
- constructor(
9
- protected readonly console: Console,
10
- ) {
11
- }
12
-
13
- public init(printToConsole: boolean): void {
14
- this.printToConsole = printToConsole;
15
- }
16
-
17
- public error(...parameters: unknown[]): void {
18
- if (this.printToConsole) {
19
- this.console.error(...parameters);
20
- }
21
- }
22
-
23
- public info(...parameters: unknown[]): void {
24
- if (this.printToConsole) {
25
- this.console.info(...parameters);
26
- }
27
- }
28
-
29
- public log(...parameters: unknown[]): void {
30
- if (this.printToConsole) {
31
- this.console.log(...parameters);
32
- }
33
- }
34
-
35
- public debug(...parameters: unknown[]): void {
36
- if (this.printToConsole) {
37
- this.console.debug(...parameters);
38
- }
39
- }
40
-
41
- public trace(...parameters: unknown[]): void {
42
- if (this.printToConsole) {
43
- this.console.trace(...parameters);
44
- }
45
- }
46
-
47
- public warn(...parameters: unknown[]): void {
48
- if (this.printToConsole) {
49
- this.console.warn(...parameters);
50
- }
51
- }
52
-
53
- public printLog(log: ILogEntry): void {
54
- if (this.printToConsole) {
55
- // Log to browser console
56
- // debug, warning, error, trace, info, fatal
57
- const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];
58
- const method = levelToMethod[log.level || LogLevel.Debug];
59
- const tag = log.tag ? `[${log.tag}] ` : '';
60
- const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');
61
- const message = `${tag}${format(log.text)} ${location}`;
62
-
63
- // @ts-ignore
64
- this.console[method](message);
65
- }
66
- }
67
- }
@@ -1,44 +0,0 @@
1
- import {format} from "util";
2
-
3
- export class StringFormatter {
4
- public format(parameters: unknown[]): string {
5
- const [, ...textParams] = parameters;
6
- let [textFormat] = parameters as string[];
7
- let text: string;
8
-
9
- try {
10
- // Our sanitizer gives better results, try with it first
11
- textFormat = this.toString(textFormat);
12
- } catch {
13
- // Fallback to `format`
14
- textFormat = format(textFormat);
15
- }
16
-
17
- if (textParams.length > 0) {
18
- text = format(textFormat, ...textParams);
19
- } else {
20
- text = textFormat;
21
- }
22
-
23
- return text;
24
- }
25
-
26
- private toString(value: unknown): string {
27
- // Depending on the type we prefer to do `String` or `stringify`
28
- const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;
29
-
30
- if (isToString) {
31
- try {
32
- return String(value);
33
- } catch {
34
- return JSON.stringify(value);
35
- }
36
- } else {
37
- try {
38
- return JSON.stringify(value);
39
- } catch {
40
- return String(value);
41
- }
42
- }
43
- }
44
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Device Key Value
3
- */
4
- export type DeviceKeyValue = string | number | boolean;
package/src/types/log.ts DELETED
@@ -1,75 +0,0 @@
1
- /**
2
- * Log Levels
3
- *
4
- * Check the main README to see how to access the `LogLevel` enum.
5
- */
6
- export enum LogLevel {
7
- Debug = 0,
8
- Warning = 1,
9
- Error = 2,
10
- Trace = 3,
11
- Info = 4,
12
- Fatal = 5,
13
- }
14
-
15
- /**
16
- * @hidden
17
- */
18
- export const LOG_LEVELS: LogLevel[] = [
19
- LogLevel.Debug,
20
- LogLevel.Warning,
21
- LogLevel.Error,
22
- LogLevel.Trace,
23
- LogLevel.Info,
24
- LogLevel.Fatal,
25
- ];
26
-
27
- /**
28
- * @hidden
29
- */
30
- export interface ILogEntryShort {
31
- /** Date ISO */
32
- x: string;
33
- /** Text */
34
- t: string;
35
- /** Method */
36
- m: string;
37
- /** Absolute Time */
38
- at: number;
39
- /** Tag */
40
- tg: string;
41
- /** File */
42
- f: string;
43
- /** Line */
44
- l: number;
45
- /** Level */
46
- ll: number;
47
- /** URL */
48
- u: string;
49
- }
50
-
51
- /**
52
- * Log Entry object interface
53
- */
54
- export interface ILogEntry {
55
- /** The line number where the log was triggered from */
56
- line?: number;
57
-
58
- /** The log's level based on LogLevel constant */
59
- level?: LogLevel;
60
-
61
- /** The log's tag */
62
- tag?: string;
63
-
64
- /** The method name where the log was triggered from */
65
- method?: string;
66
-
67
- /** The file name where the log was triggered from */
68
- file?: string;
69
-
70
- /** The log's text content */
71
- text?: string;
72
-
73
- /** The log's origin URL. This attribute is ignored on Android & iOS */
74
- url?: string;
75
- }
package/src/utilities.ts DELETED
@@ -1,8 +0,0 @@
1
- export function removeUndefinedAttributes(object: any) {
2
- Object.entries(object).forEach(([key, value]) => {
3
- if (value === undefined) {
4
- // @ts-ignore
5
- delete object[key];
6
- }
7
- });
8
- }