@ask-ell/sentry 0.0.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/README.md +11 -0
- package/package.json +12 -0
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +1 -0
- package/src/sentry.configuration.d.ts +20 -0
- package/src/sentry.configuration.d.ts.map +1 -0
- package/src/sentry.configuration.js +23 -0
package/README.md
ADDED
package/package.json
ADDED
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/sentry/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sentry.configuration.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ILogger, MaybeUndefined } from "@ask-ell/core";
|
|
2
|
+
import type { Client, Options } from "@sentry/core";
|
|
3
|
+
type SentryClientFactory = (options: Options) => MaybeUndefined<Client>;
|
|
4
|
+
export type SentryConfigurationProps = {
|
|
5
|
+
publicKey: string;
|
|
6
|
+
host: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
environment?: MaybeUndefined<string>;
|
|
9
|
+
logger: ILogger;
|
|
10
|
+
init: SentryClientFactory;
|
|
11
|
+
};
|
|
12
|
+
export declare class SentryConfiguration {
|
|
13
|
+
private props;
|
|
14
|
+
private inited;
|
|
15
|
+
private logger;
|
|
16
|
+
constructor(props: SentryConfigurationProps);
|
|
17
|
+
init(): void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=sentry.configuration.d.ts.map
|
|
@@ -0,0 +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,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGnD,KAAK,mBAAmB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,cAAc,CAAC,MAAM,CAAC,CAAC;AAExE,MAAM,MAAM,wBAAwB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF,qBAAa,mBAAmB;IAIhB,OAAO,CAAC,KAAK;IAHzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAU;gBAEJ,KAAK,EAAE,wBAAwB;IAInD,IAAI,IAAI,IAAI;CAiBf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class SentryConfiguration {
|
|
2
|
+
props;
|
|
3
|
+
inited = false;
|
|
4
|
+
logger;
|
|
5
|
+
constructor(props) {
|
|
6
|
+
this.props = props;
|
|
7
|
+
this.logger = this.props.logger;
|
|
8
|
+
}
|
|
9
|
+
init() {
|
|
10
|
+
if (this.inited) {
|
|
11
|
+
return this.logger.info("Sentry already inited. Step skipped");
|
|
12
|
+
}
|
|
13
|
+
const { publicKey, host, projectId, environment, init } = this.props;
|
|
14
|
+
const dsn = `${publicKey}@${host}/${projectId}`;
|
|
15
|
+
init({
|
|
16
|
+
dsn,
|
|
17
|
+
sendDefaultPii: true,
|
|
18
|
+
environment: environment ?? "production"
|
|
19
|
+
});
|
|
20
|
+
this.logger.info(`Sentry inited for environment "${environment}"`);
|
|
21
|
+
this.inited = true;
|
|
22
|
+
}
|
|
23
|
+
}
|