@sneat/logging 0.26.0 → 0.26.1
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/esm2022/lib/analytics/fire-analytics.service.js +3 -3
- package/esm2022/lib/analytics/posthog-analytics.service.js +3 -3
- package/esm2022/lib/error-logger.service.js +5 -5
- package/esm2022/lib/error-logger.service.js.map +1 -1
- package/esm2022/lib/sneat-logging.module.js +4 -4
- package/lib/error-logger.service.d.ts +1 -1
- package/package.json +7 -6
- package/tsconfig.lib.prod.tsbuildinfo +1 -1
|
@@ -59,10 +59,10 @@ export class FireAnalyticsService {
|
|
|
59
59
|
this.logError(e, 'Failed to logout user from Firebase analytics');
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
63
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
62
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FireAnalyticsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
63
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FireAnalyticsService }); }
|
|
64
64
|
}
|
|
65
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FireAnalyticsService, decorators: [{
|
|
66
66
|
type: Injectable
|
|
67
67
|
}], ctorParameters: () => [] });
|
|
68
68
|
//# sourceMappingURL=fire-analytics.service.js.map
|
|
@@ -38,10 +38,10 @@ export class PosthogAnalyticsService {
|
|
|
38
38
|
this.errorLogger.logError(e, 'Failed to reset Posthog', { show: false });
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
42
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
41
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PosthogAnalyticsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
42
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PosthogAnalyticsService }); }
|
|
43
43
|
}
|
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PosthogAnalyticsService, decorators: [{
|
|
45
45
|
type: Injectable
|
|
46
46
|
}] });
|
|
47
47
|
//# sourceMappingURL=posthog-analytics.service.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
2
2
|
import { Injectable, Optional } from '@angular/core';
|
|
3
|
-
import { ToastController } from '@ionic/angular
|
|
3
|
+
import { ToastController } from '@ionic/angular';
|
|
4
4
|
import { captureException, showReportDialog } from '@sentry/angular';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "@ionic/angular
|
|
6
|
+
import * as i1 from "@ionic/angular";
|
|
7
7
|
const defaultErrorToastDuration = 7000;
|
|
8
8
|
export class ErrorLoggerService {
|
|
9
9
|
constructor(toastController) {
|
|
@@ -98,10 +98,10 @@ export class ErrorLoggerService {
|
|
|
98
98
|
show: false,
|
|
99
99
|
}));
|
|
100
100
|
}
|
|
101
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
102
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
101
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ErrorLoggerService, deps: [{ token: i1.ToastController, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
102
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ErrorLoggerService }); }
|
|
103
103
|
}
|
|
104
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ErrorLoggerService, decorators: [{
|
|
105
105
|
type: Injectable
|
|
106
106
|
}], ctorParameters: () => [{ type: i1.ToastController, decorators: [{
|
|
107
107
|
type: Optional
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-logger.service.js","sourceRoot":"","sources":["../../../../../libs/logging/src/lib/error-logger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"error-logger.service.js","sourceRoot":"","sources":["../../../../../libs/logging/src/lib/error-logger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;;;AAGrE,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAGvC,MAAM,OAAO,kBAAkB;IAC7B,YAAyC,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;QAEzD,oBAAe,GAC7B,CAA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AAC,CAAC;YACvE,OAAO;QACT,CAAC;QACD,IAAI,CAAC,eAAe;aACjB,MAAM,CAAC;YACN,OAAO;YACP,QAAQ,EAAE,QAAQ,IAAI,yBAAyB;YAC/C,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,KAAK;oBACX,OAAO,EAAE,GAAG,EAAE,CACZ,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CACzC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,gCAAgC,EAAE;wBACjD,IAAI,EAAE,KAAK;qBACZ,CAAC,CACH;iBACJ;aACF;YACD,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,sBAAsB;YAC9B,QAAQ,EAAE,KAAK;SAChB,CAAC;aACD,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CACd,KAAK;aACF,OAAO,EAAE;aACT,KAAK,CACJ,IAAI,CAAC,eAAe,CAClB,6CAA6C,EAC7C,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CACF,CACJ;aACA,KAAK,CACJ,IAAI,CAAC,eAAe,CAAC,8CAA8C,EAAE;YACnE,IAAI,EAAE,KAAK;SACZ,CAAC,CACH,CAAC;IACN,CAAC;8GAxHU,kBAAkB;kHAAlB,kBAAkB;;2FAAlB,kBAAkB;kBAD9B,UAAU;;0BAEI,QAAQ","sourcesContent":["import { HttpErrorResponse } from '@angular/common/http';\nimport { Injectable, Optional } from '@angular/core';\nimport { ToastController } from '@ionic/angular';\nimport { captureException, showReportDialog } from '@sentry/angular';\nimport { IErrorLogger, ILogErrorOptions } from '@sneat/core';\n\nconst defaultErrorToastDuration = 7000;\n\n@Injectable()\nexport class ErrorLoggerService implements IErrorLogger {\n constructor(@Optional() private readonly toastController: ToastController) {}\n\n public readonly logErrorHandler =\n (message?: string, options?: ILogErrorOptions) => (e: unknown) =>\n this.logError(e, message, options);\n\n public readonly logError = (\n e: unknown,\n message?: string,\n options?: ILogErrorOptions,\n ): void => {\n console.error(\n `ErrorLoggerService.logError: ${message || 'Error'}:`,\n e,\n '; Logging options:',\n options,\n );\n if (e === true || e === false) {\n try {\n // noinspection ExceptionCaughtLocallyJS\n throw new Error(`got boolean value as an error: ${e}: ${message}`);\n } catch (ex) {\n console.error('Argument exception at logError():', ex, options);\n return;\n }\n }\n if (options?.report === undefined || options.report) {\n if (window.location.hostname !== 'localhost') {\n try {\n const eventId = message\n ? captureException(message, { originalException: e })\n : captureException(e);\n\n // console.log('Captured error by Sentry with eventId:', eventId);\n if (options?.feedback === undefined || options.feedback) {\n showReportDialog({ eventId });\n }\n } catch (ex) {\n console.error(\n 'Sentry failed to capture or show error report dialog',\n ex,\n );\n }\n }\n }\n if (options?.show || options?.show === undefined) {\n this.showError(e, options?.showDuration);\n }\n return; // return message ? { error: e, message } : e;\n };\n\n public showError(e: unknown, duration?: number): void {\n let clientMessage: string | undefined;\n\n if ((e as { message?: string }).message) {\n clientMessage =\n (clientMessage &&\n `${clientMessage}: ${(e as { message?: string }).message}`) ||\n (e as { message?: string }).message;\n } else if (!clientMessage) {\n clientMessage = (e as object).toString();\n }\n if (!clientMessage) {\n throw new Error('showError() have not received a message to display');\n }\n if (duration && duration < 0) {\n throw new Error('showError received negative duration');\n }\n\n let message = clientMessage;\n\n let serverMessage: string | undefined;\n if (e instanceof HttpErrorResponse) {\n const e2 = e as HttpErrorResponse;\n serverMessage = e2.error?.error?.message;\n if (serverMessage) {\n message += `.\\n\\nServer returned error message: ${serverMessage}`;\n }\n }\n if (!this.toastController) {\n console.warn('ToastController not available, cannot show error toast');\n return;\n }\n this.toastController\n .create({\n message,\n duration: duration || defaultErrorToastDuration,\n keyboardClose: true,\n buttons: [\n {\n icon: 'close',\n side: 'end',\n handler: () =>\n this.toastController.dismiss().catch((e) =>\n this.logError(e, 'Failed to dismiss error dialog', {\n show: false,\n }),\n ),\n },\n ],\n color: 'danger',\n header: 'Something went wrong',\n position: 'top',\n })\n .then((toast) =>\n toast\n .present()\n .catch(\n this.logErrorHandler(\n 'Failed to present toast with error message:',\n { show: false },\n ),\n ),\n )\n .catch(\n this.logErrorHandler('Failed to create a toast with error message:', {\n show: false,\n }),\n );\n }\n}\n"]}
|
|
@@ -9,11 +9,11 @@ export function provideErrorLogger() {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export class SneatLoggingModule {
|
|
12
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
13
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
14
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SneatLoggingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
13
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: SneatLoggingModule }); }
|
|
14
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SneatLoggingModule, providers: [provideErrorLogger()] }); }
|
|
15
15
|
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SneatLoggingModule, decorators: [{
|
|
17
17
|
type: NgModule,
|
|
18
18
|
args: [{
|
|
19
19
|
imports: [],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToastController } from '@ionic/angular
|
|
1
|
+
import { ToastController } from '@ionic/angular';
|
|
2
2
|
import { IErrorLogger, ILogErrorOptions } from '@sneat/core';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class ErrorLoggerService implements IErrorLogger {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sneat/logging",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@angular/common": ">=
|
|
9
|
-
"@angular/core": ">=
|
|
10
|
-
"@angular/router": ">=
|
|
8
|
+
"@angular/common": ">=22.0.0 <23.0.0",
|
|
9
|
+
"@angular/core": ">=22.0.0 <23.0.0",
|
|
10
|
+
"@angular/router": ">=22.0.0 <23.0.0",
|
|
11
11
|
"@angular/fire": ">=20",
|
|
12
|
-
"@ionic/angular": ">=
|
|
12
|
+
"@ionic/angular": ">=9.0.0 <10.0.0",
|
|
13
13
|
"@sentry/angular": "*",
|
|
14
14
|
"@sneat/core": "^0.26.0",
|
|
15
15
|
"firebase": "*",
|
|
@@ -30,5 +30,6 @@
|
|
|
30
30
|
"default": "./esm2022/sneat-logging.js"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"sideEffects": false
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"type": "module"
|
|
34
35
|
}
|