@ask-ell/sentry 0.0.3 → 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",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
7
7
  "dependencies": {
8
- "@sentry/core": "^10.39.0",
9
- "@ask-ell/core": "^1.3.1"
10
- },
11
- "type": "commonjs"
8
+ "@ask-ell/core": "^1.3.2",
9
+ "@sentry/core": "^10.66.0",
10
+ "tslib": "^2.8.1"
11
+ }
12
12
  }
@@ -1,19 +1,23 @@
1
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 = {
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 inited;
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,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;CAsBf"}
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"}
@@ -3,29 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SentryConfiguration = void 0;
4
4
  class SentryConfiguration {
5
5
  props;
6
- inited = false;
6
+ client;
7
7
  logger;
8
8
  constructor(props) {
9
9
  this.props = props;
10
10
  this.logger = this.props.logger;
11
11
  }
12
12
  init() {
13
- if (this.inited) {
13
+ if (this.client) {
14
14
  return this.logger.info("Sentry already inited. Step skipped");
15
15
  }
16
16
  const { publicKey, host, projectId, environment, init } = this.props;
17
17
  const dsn = `https://${publicKey}@${host}/${projectId}`;
18
- const client = init({
18
+ this.client = init({
19
19
  dsn,
20
20
  sendDefaultPii: true,
21
21
  environment: environment ?? "production"
22
22
  });
23
- if (!client) {
23
+ if (!this.client) {
24
24
  this.logger.warn(`Sentry not inited`);
25
25
  return;
26
26
  }
27
27
  this.logger.info(`Sentry inited for environment "${environment}"`);
28
- this.inited = true;
29
28
  }
30
29
  }
31
30
  exports.SentryConfiguration = SentryConfiguration;