@ask-ell/sentry 0.0.2 → 0.0.4
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/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ask-ell/sentry",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"private": false,
|
|
5
|
-
"type": "module",
|
|
6
5
|
"main": "./src/index.js",
|
|
7
6
|
"types": "./src/index.d.ts",
|
|
8
|
-
"
|
|
9
|
-
"@
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@ask-ell/core": "^1.3.2",
|
|
9
|
+
"@sentry/core": "^10.66.0",
|
|
10
|
+
"tslib": "^2.8.1"
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import type { ILogger, MaybeUndefined } from "@ask-ell/core";
|
|
2
|
-
import
|
|
3
|
-
type
|
|
4
|
-
|
|
2
|
+
import { Client } from "@sentry/core";
|
|
3
|
+
type SentryClientFactoryParams = {
|
|
4
|
+
dsn: string;
|
|
5
|
+
sendDefaultPii: boolean;
|
|
6
|
+
environment?: string;
|
|
7
|
+
};
|
|
8
|
+
export type SentryConfigurationProps<SentryClientFactory extends (params: SentryClientFactoryParams) => MaybeUndefined<Client>> = {
|
|
5
9
|
publicKey: string;
|
|
6
10
|
host: string;
|
|
7
11
|
projectId: string;
|
|
8
|
-
environment?: MaybeUndefined<string>;
|
|
9
12
|
logger: ILogger;
|
|
10
13
|
init: SentryClientFactory;
|
|
14
|
+
environment?: MaybeUndefined<string>;
|
|
11
15
|
};
|
|
12
|
-
export declare class SentryConfiguration {
|
|
16
|
+
export declare class SentryConfiguration<SentryClientFactory extends (params: SentryClientFactoryParams) => MaybeUndefined<Client>> {
|
|
13
17
|
private props;
|
|
14
|
-
private
|
|
18
|
+
private client;
|
|
15
19
|
private logger;
|
|
16
|
-
constructor(props: SentryConfigurationProps);
|
|
20
|
+
constructor(props: SentryConfigurationProps<SentryClientFactory>);
|
|
17
21
|
init(): void;
|
|
18
22
|
}
|
|
19
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.configuration.d.ts","sourceRoot":"","sources":["../../../../packages/sentry/src/sentry.configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"sentry.configuration.d.ts","sourceRoot":"","sources":["../../../../packages/sentry/src/sentry.configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,KAAK,yBAAyB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,mBAAmB,SAAS,CAAC,MAAM,EAAE,yBAAyB,KAAK,cAAc,CAAC,MAAM,CAAC,IAAI;IAC9H,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,WAAW,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,qBAAa,mBAAmB,CAAC,mBAAmB,SAAS,CAAC,MAAM,EAAE,yBAAyB,KAAK,cAAc,CAAC,MAAM,CAAC;IAI1G,OAAO,CAAC,KAAK;IAHzB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,MAAM,CAAU;gBAEJ,KAAK,EAAE,wBAAwB,CAAC,mBAAmB,CAAC;IAIxE,IAAI,IAAI,IAAI;CAqBf"}
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SentryConfiguration = void 0;
|
|
4
|
+
class SentryConfiguration {
|
|
2
5
|
props;
|
|
3
|
-
|
|
6
|
+
client;
|
|
4
7
|
logger;
|
|
5
8
|
constructor(props) {
|
|
6
9
|
this.props = props;
|
|
7
10
|
this.logger = this.props.logger;
|
|
8
11
|
}
|
|
9
12
|
init() {
|
|
10
|
-
if (this.
|
|
13
|
+
if (this.client) {
|
|
11
14
|
return this.logger.info("Sentry already inited. Step skipped");
|
|
12
15
|
}
|
|
13
16
|
const { publicKey, host, projectId, environment, init } = this.props;
|
|
14
17
|
const dsn = `https://${publicKey}@${host}/${projectId}`;
|
|
15
|
-
|
|
18
|
+
this.client = init({
|
|
16
19
|
dsn,
|
|
17
20
|
sendDefaultPii: true,
|
|
18
21
|
environment: environment ?? "production"
|
|
19
22
|
});
|
|
20
|
-
if (!client) {
|
|
23
|
+
if (!this.client) {
|
|
21
24
|
this.logger.warn(`Sentry not inited`);
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
27
|
this.logger.info(`Sentry inited for environment "${environment}"`);
|
|
25
|
-
this.inited = true;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
30
|
+
exports.SentryConfiguration = SentryConfiguration;
|