From b5938987cae2990e0dcef2b63c02026e78d134c7 Mon Sep 17 00:00:00 2001 From: Ralf Gaudes Date: Tue, 12 Nov 2024 00:18:18 +0100 Subject: [PATCH] Update Sentry dependency --- build/modules/global-helper.js | 2 +- build/modules/global-helper.js.map | 4 ++-- package-lock.json | 11 ++++++----- package.json | 2 +- src/modules/global-helper.ts | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build/modules/global-helper.js b/build/modules/global-helper.js index 0bc99a75..5023ee20 100644 --- a/build/modules/global-helper.js +++ b/build/modules/global-helper.js @@ -98,7 +98,7 @@ class GlobalHelper { (_a = this.Sentry) == null ? void 0 : _a.addBreadcrumb({ category: Category, message: Message, - level: Level, + //level: Level as SentryObj.Severity, data: Data }); } diff --git a/build/modules/global-helper.js.map b/build/modules/global-helper.js.map index 847eae43..2d5859b6 100644 --- a/build/modules/global-helper.js.map +++ b/build/modules/global-helper.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../src/modules/global-helper.ts"], - "sourcesContent": ["import * as SentryObj from \"@sentry/types\";\n\nexport class GlobalHelper{\n\tAdapter: ioBroker.Adapter;\n\tSentry?: SentryObj.Hub;\n\n\tconstructor(adapterInstance: ioBroker.Adapter){\n\t\tthis.Adapter = adapterInstance;\n\t\t// Init Sentry\n\t\tif (this.Adapter.supportsFeature && this.Adapter.supportsFeature(\"PLUGINS\")) {\n\t\t\tconst sentryInstance: ioBroker.Plugin|null = this.Adapter.getPluginInstance(\"sentry\");\n\t\t\tif (sentryInstance) {\n\t\t\t\tthis.Sentry = sentryInstance.getSentryObject();\n\t\t\t}\n\t\t}\n\t}\n\n\t//#region Helper Function ReportingError\n\t/**\n\t * Function for global error reporting\n\t * @param {Object} Err Error-Object\n\t * @param {string} FriendlyError Error message for user\n\t * @param {string} NameFunction Name of the function where error occured\n\t * @param {string} NameAction Name of the subfunction where error occured\n\t * @param {string} Info Contextual information\n\t * @param {boolean} ReportSentry Report error to sentry, default true\n\t */\n\tasync ReportingError(Err: Error|null, FriendlyError: string, NameFunction: string, NameAction = \"\", Info = \"\", ReportSentry = true): Promise{\n\t\ttry{\n\t\t\tlet sErrMsg = `Error occured: ${FriendlyError} in ${NameFunction}`;\n\t\t\tif (NameAction !== \"\") sErrMsg = sErrMsg + `(${NameAction})`;\n\t\t\tif (Err !== null) sErrMsg = sErrMsg + ` [${Err}] [${Info}]`;\n\t\t\tthis.Adapter.log.error(sErrMsg);\n\t\t} catch (e){\n\t\t\tthis.Adapter.log.error(`Exception in ErrorReporting [${e}]`);\n\t\t}\n\t\t// Sentry reporting\n\t\ttry{\n\t\t\tif (this.Sentry && this.Adapter.config.sentry_disable === false && ReportSentry === true) {\n\t\t\t\tthis.Sentry && this.Sentry.withScope(scope => {\n\t\t\t\t\tscope.setLevel(\"error\" as SentryObj.SeverityLevel);\n\t\t\t\t\tscope.setExtra(\"NameFunction\", NameFunction);\n\t\t\t\t\tscope.setExtra(\"NameAction\", NameAction);\n\t\t\t\t\tif (Info){\n\t\t\t\t\t\tscope.setExtra(\"Info\", Info);\n\t\t\t\t\t}\n\t\t\t\t\t//scope.setExtra(\"Config\", this.config);\n\t\t\t\t\tif (this.Sentry){\n\t\t\t\t\t\tthis.Sentry.captureException(Err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (e){\n\t\t\tthis.Adapter.log.error(`Exception in ErrorReporting Sentry [${e}]`);\n\t\t}\n\t}\n\t//#endregion\n\n\t//#region Helper Function ReportingInfo\n\t/**\n\t * Function for global information reporting\n\t * @param {\"Info\"|\"Debug\"} Level Level for ioBroker Logging\n\t * @param {string} Category Category of information\n\t * @param {string} Message Message\n\t * @param {{[Key: string]: any}|undefined} Data Contextual data information\n\t */\n\tReportingInfo(Level: \"Info\"|\"Debug\", Category: string, Message: string, Data?:{[Key: string]: any}|undefined): void {\n\t\tlet iobMessage = Message;\n\t\tif (this.Adapter.log.level === \"debug\" || this.Adapter.log.level === \"silly\"){\n\t\t\tiobMessage = `[${Category}] ${Message}`;\n\t\t}\n\t\tswitch(Level){\n\t\t\tcase \"Debug\":\n\t\t\t\tthis.Adapter.log.debug(iobMessage);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis.Adapter.log.info(iobMessage);\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.Sentry?.addBreadcrumb({\n\t\t\tcategory: Category,\n\t\t\tmessage: Message,\n\t\t\tlevel: Level as SentryObj.Severity,\n\t\t\tdata: Data\n\t\t})\n\t}\n\t//#endregion\n}"], - "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,aAAY;AAAA,EACxB;AAAA,EACA;AAAA,EAEA,YAAY,iBAAkC;AAC7C,SAAK,UAAU;AAEf,QAAI,KAAK,QAAQ,mBAAmB,KAAK,QAAQ,gBAAgB,SAAS,GAAG;AAC5E,YAAM,iBAAwC,KAAK,QAAQ,kBAAkB,QAAQ;AACrF,UAAI,gBAAgB;AACnB,aAAK,SAAS,eAAe,gBAAgB;AAAA,MAC9C;AAAA,IACD;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,eAAe,KAAiB,eAAuB,cAAsB,aAAa,IAAI,OAAO,IAAI,eAAe,MAAoB;AACjJ,QAAG;AACF,UAAI,UAAU,kBAAkB,aAAa,OAAO,YAAY;AAChE,UAAI,eAAe;AAAI,kBAAU,UAAU,IAAI,UAAU;AACzD,UAAI,QAAQ;AAAM,kBAAU,UAAU,KAAK,GAAG,MAAM,IAAI;AACxD,WAAK,QAAQ,IAAI,MAAM,OAAO;AAAA,IAC/B,SAAS,GAAE;AACV,WAAK,QAAQ,IAAI,MAAM,gCAAgC,CAAC,GAAG;AAAA,IAC5D;AAEA,QAAG;AACF,UAAI,KAAK,UAAU,KAAK,QAAQ,OAAO,mBAAmB,SAAS,iBAAiB,MAAM;AACzF,aAAK,UAAU,KAAK,OAAO,UAAU,WAAS;AAC7C,gBAAM,SAAS,OAAkC;AACjD,gBAAM,SAAS,gBAAgB,YAAY;AAC3C,gBAAM,SAAS,cAAc,UAAU;AACvC,cAAI,MAAK;AACR,kBAAM,SAAS,QAAQ,IAAI;AAAA,UAC5B;AAEA,cAAI,KAAK,QAAO;AACf,iBAAK,OAAO,iBAAiB,GAAG;AAAA,UACjC;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD,SAAS,GAAE;AACV,WAAK,QAAQ,IAAI,MAAM,uCAAuC,CAAC,GAAG;AAAA,IACnE;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,cAAc,OAAuB,UAAkB,SAAiB,MAA4C;AAlErH;AAmEE,QAAI,aAAa;AACjB,QAAI,KAAK,QAAQ,IAAI,UAAU,WAAW,KAAK,QAAQ,IAAI,UAAU,SAAQ;AAC5E,mBAAa,IAAI,QAAQ,KAAK,OAAO;AAAA,IACtC;AACA,YAAO,OAAM;AAAA,MACZ,KAAK;AACJ,aAAK,QAAQ,IAAI,MAAM,UAAU;AACjC;AAAA,MACD;AACC,aAAK,QAAQ,IAAI,KAAK,UAAU;AAChC;AAAA,IACF;AACA,eAAK,WAAL,mBAAa,cAAc;AAAA,MAC1B,UAAU;AAAA,MACV,SAAS;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACP;AAAA,EACD;AAAA;AAED;", + "sourcesContent": ["import * as SentryObj from \"@sentry/types\";\n\nexport class GlobalHelper{\n\tAdapter: ioBroker.Adapter;\n\tSentry?: SentryObj.Hub;\n\n\tconstructor(adapterInstance: ioBroker.Adapter){\n\t\tthis.Adapter = adapterInstance;\n\t\t// Init Sentry\n\t\tif (this.Adapter.supportsFeature && this.Adapter.supportsFeature(\"PLUGINS\")) {\n\t\t\tconst sentryInstance: ioBroker.Plugin|null = this.Adapter.getPluginInstance(\"sentry\");\n\t\t\tif (sentryInstance) {\n\t\t\t\tthis.Sentry = sentryInstance.getSentryObject();\n\t\t\t}\n\t\t}\n\t}\n\n\t//#region Helper Function ReportingError\n\t/**\n\t * Function for global error reporting\n\t * @param {Object} Err Error-Object\n\t * @param {string} FriendlyError Error message for user\n\t * @param {string} NameFunction Name of the function where error occured\n\t * @param {string} NameAction Name of the subfunction where error occured\n\t * @param {string} Info Contextual information\n\t * @param {boolean} ReportSentry Report error to sentry, default true\n\t */\n\tasync ReportingError(Err: Error|null, FriendlyError: string, NameFunction: string, NameAction = \"\", Info = \"\", ReportSentry = true): Promise{\n\t\ttry{\n\t\t\tlet sErrMsg = `Error occured: ${FriendlyError} in ${NameFunction}`;\n\t\t\tif (NameAction !== \"\") sErrMsg = sErrMsg + `(${NameAction})`;\n\t\t\tif (Err !== null) sErrMsg = sErrMsg + ` [${Err}] [${Info}]`;\n\t\t\tthis.Adapter.log.error(sErrMsg);\n\t\t} catch (e){\n\t\t\tthis.Adapter.log.error(`Exception in ErrorReporting [${e}]`);\n\t\t}\n\t\t// Sentry reporting\n\t\ttry{\n\t\t\tif (this.Sentry && this.Adapter.config.sentry_disable === false && ReportSentry === true) {\n\t\t\t\tthis.Sentry && this.Sentry.withScope(scope => {\n\t\t\t\t\tscope.setLevel(\"error\" as SentryObj.SeverityLevel);\n\t\t\t\t\tscope.setExtra(\"NameFunction\", NameFunction);\n\t\t\t\t\tscope.setExtra(\"NameAction\", NameAction);\n\t\t\t\t\tif (Info){\n\t\t\t\t\t\tscope.setExtra(\"Info\", Info);\n\t\t\t\t\t}\n\t\t\t\t\t//scope.setExtra(\"Config\", this.config);\n\t\t\t\t\tif (this.Sentry){\n\t\t\t\t\t\tthis.Sentry.captureException(Err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (e){\n\t\t\tthis.Adapter.log.error(`Exception in ErrorReporting Sentry [${e}]`);\n\t\t}\n\t}\n\t//#endregion\n\n\t//#region Helper Function ReportingInfo\n\t/**\n\t * Function for global information reporting\n\t * @param {\"Info\"|\"Debug\"} Level Level for ioBroker Logging\n\t * @param {string} Category Category of information\n\t * @param {string} Message Message\n\t * @param {{[Key: string]: any}|undefined} Data Contextual data information\n\t */\n\tReportingInfo(Level: \"Info\"|\"Debug\", Category: string, Message: string, Data?:{[Key: string]: any}|undefined): void {\n\t\tlet iobMessage = Message;\n\t\tif (this.Adapter.log.level === \"debug\" || this.Adapter.log.level === \"silly\"){\n\t\t\tiobMessage = `[${Category}] ${Message}`;\n\t\t}\n\t\tswitch(Level){\n\t\t\tcase \"Debug\":\n\t\t\t\tthis.Adapter.log.debug(iobMessage);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis.Adapter.log.info(iobMessage);\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.Sentry?.addBreadcrumb({\n\t\t\tcategory: Category,\n\t\t\tmessage: Message,\n\t\t\t//level: Level as SentryObj.Severity,\n\t\t\tdata: Data\n\t\t})\n\t}\n\t//#endregion\n}"], + "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,aAAY;AAAA,EACxB;AAAA,EACA;AAAA,EAEA,YAAY,iBAAkC;AAC7C,SAAK,UAAU;AAEf,QAAI,KAAK,QAAQ,mBAAmB,KAAK,QAAQ,gBAAgB,SAAS,GAAG;AAC5E,YAAM,iBAAwC,KAAK,QAAQ,kBAAkB,QAAQ;AACrF,UAAI,gBAAgB;AACnB,aAAK,SAAS,eAAe,gBAAgB;AAAA,MAC9C;AAAA,IACD;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,eAAe,KAAiB,eAAuB,cAAsB,aAAa,IAAI,OAAO,IAAI,eAAe,MAAoB;AACjJ,QAAG;AACF,UAAI,UAAU,kBAAkB,aAAa,OAAO,YAAY;AAChE,UAAI,eAAe;AAAI,kBAAU,UAAU,IAAI,UAAU;AACzD,UAAI,QAAQ;AAAM,kBAAU,UAAU,KAAK,GAAG,MAAM,IAAI;AACxD,WAAK,QAAQ,IAAI,MAAM,OAAO;AAAA,IAC/B,SAAS,GAAE;AACV,WAAK,QAAQ,IAAI,MAAM,gCAAgC,CAAC,GAAG;AAAA,IAC5D;AAEA,QAAG;AACF,UAAI,KAAK,UAAU,KAAK,QAAQ,OAAO,mBAAmB,SAAS,iBAAiB,MAAM;AACzF,aAAK,UAAU,KAAK,OAAO,UAAU,WAAS;AAC7C,gBAAM,SAAS,OAAkC;AACjD,gBAAM,SAAS,gBAAgB,YAAY;AAC3C,gBAAM,SAAS,cAAc,UAAU;AACvC,cAAI,MAAK;AACR,kBAAM,SAAS,QAAQ,IAAI;AAAA,UAC5B;AAEA,cAAI,KAAK,QAAO;AACf,iBAAK,OAAO,iBAAiB,GAAG;AAAA,UACjC;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD,SAAS,GAAE;AACV,WAAK,QAAQ,IAAI,MAAM,uCAAuC,CAAC,GAAG;AAAA,IACnE;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,cAAc,OAAuB,UAAkB,SAAiB,MAA4C;AAlErH;AAmEE,QAAI,aAAa;AACjB,QAAI,KAAK,QAAQ,IAAI,UAAU,WAAW,KAAK,QAAQ,IAAI,UAAU,SAAQ;AAC5E,mBAAa,IAAI,QAAQ,KAAK,OAAO;AAAA,IACtC;AACA,YAAO,OAAM;AAAA,MACZ,KAAK;AACJ,aAAK,QAAQ,IAAI,MAAM,UAAU;AACjC;AAAA,MACD;AACC,aAAK,QAAQ,IAAI,KAAK,UAAU;AAChC;AAAA,IACF;AACA,eAAK,WAAL,mBAAa,cAAc;AAAA,MAC1B,UAAU;AAAA,MACV,SAAS;AAAA;AAAA,MAET,MAAM;AAAA,IACP;AAAA,EACD;AAAA;AAED;", "names": [] } diff --git a/package-lock.json b/package-lock.json index 2317ce14..ce5ef589 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "@alcalzone/release-script-plugin-license": "^3.7.0", "@iobroker/adapter-dev": "^1.3.0", "@iobroker/testing": "^5.0.0", - "@sentry/types": "^7.104.0", + "@sentry/types": "^8.37.1", "@tsconfig/node18": "^18.2.4", "@types/chai": "^4.3.20", "@types/chai-as-promised": "^8.0.1", @@ -1349,12 +1349,13 @@ "dev": true }, "node_modules/@sentry/types": { - "version": "7.119.2", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.119.2.tgz", - "integrity": "sha512-ydq1tWsdG7QW+yFaTp0gFaowMLNVikIqM70wxWNK+u98QzKnVY/3XTixxNLsUtnAB4Y+isAzFhrc6Vb5GFdFeg==", + "version": "8.37.1", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.37.1.tgz", + "integrity": "sha512-ryMOTROLSLINKFEbHWvi7GigNrsQhsaScw2NddybJGztJQ5UhxIGESnxGxWCufBmWFDwd7+5u0jDPCVUJybp7w==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14.18" } }, "node_modules/@sinonjs/commons": { diff --git a/package.json b/package.json index 6baaafa1..bf851824 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@alcalzone/release-script-plugin-license": "^3.7.0", "@iobroker/adapter-dev": "^1.3.0", "@iobroker/testing": "^5.0.0", - "@sentry/types": "^7.104.0", + "@sentry/types": "^8.37.1", "@tsconfig/node18": "^18.2.4", "@types/chai": "^4.3.20", "@types/chai-as-promised": "^8.0.1", diff --git a/src/modules/global-helper.ts b/src/modules/global-helper.ts index 6079445c..78cd95d9 100644 --- a/src/modules/global-helper.ts +++ b/src/modules/global-helper.ts @@ -80,7 +80,7 @@ export class GlobalHelper{ this.Sentry?.addBreadcrumb({ category: Category, message: Message, - level: Level as SentryObj.Severity, + //level: Level as SentryObj.Severity, data: Data }) }