@ask-ell/sentry 0.0.3 → 0.0.6
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/.spec.swcrc +22 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/eslint.config.mjs +22 -0
- package/jest.config.ts +21 -0
- package/package.json +6 -5
- package/project.json +29 -0
- package/src/index.ts +1 -0
- package/src/sentry.configuration.ts +49 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.spec.json +21 -0
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -4
- package/src/sentry.configuration.d.ts +0 -20
- package/src/sentry.configuration.d.ts.map +0 -1
- package/src/sentry.configuration.js +0 -31
package/.spec.swcrc
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"jsc": {
|
|
3
|
+
"target": "es2017",
|
|
4
|
+
"parser": {
|
|
5
|
+
"syntax": "typescript",
|
|
6
|
+
"decorators": true,
|
|
7
|
+
"dynamicImport": true
|
|
8
|
+
},
|
|
9
|
+
"transform": {
|
|
10
|
+
"decoratorMetadata": true,
|
|
11
|
+
"legacyDecorator": true
|
|
12
|
+
},
|
|
13
|
+
"keepClassNames": true,
|
|
14
|
+
"externalHelpers": true,
|
|
15
|
+
"loose": true
|
|
16
|
+
},
|
|
17
|
+
"module": {
|
|
18
|
+
"type": "es6"
|
|
19
|
+
},
|
|
20
|
+
"sourceMaps": true,
|
|
21
|
+
"exclude": []
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"5.9.3"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import baseConfig from '../../eslint.config.mjs';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...baseConfig,
|
|
5
|
+
{
|
|
6
|
+
files: ['**/*.json'],
|
|
7
|
+
rules: {
|
|
8
|
+
'@nx/dependency-checks': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'],
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
languageOptions: {
|
|
16
|
+
parser: await import('jsonc-eslint-parser'),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
ignores: ['**/out-tsc'],
|
|
21
|
+
},
|
|
22
|
+
];
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
|
|
4
|
+
// Reading the SWC compilation config for the spec files
|
|
5
|
+
const swcJestConfig = JSON.parse(
|
|
6
|
+
readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8')
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
|
|
10
|
+
swcJestConfig.swcrc = false;
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
displayName: '@ask-ell/sentry',
|
|
14
|
+
preset: '../../jest.preset.js',
|
|
15
|
+
testEnvironment: 'node',
|
|
16
|
+
transform: {
|
|
17
|
+
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
|
18
|
+
},
|
|
19
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
20
|
+
coverageDirectory: 'test-output/jest/coverage',
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ask-ell/sentry",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"type": "commonjs",
|
|
4
5
|
"private": false,
|
|
5
6
|
"main": "./src/index.js",
|
|
6
7
|
"types": "./src/index.d.ts",
|
|
7
8
|
"dependencies": {
|
|
8
|
-
"@
|
|
9
|
-
"@
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
"@ask-ell/core": "*",
|
|
10
|
+
"@sentry/core": "*",
|
|
11
|
+
"tslib": "*"
|
|
12
|
+
}
|
|
12
13
|
}
|
package/project.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sentry",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/sentry/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/js:tsc",
|
|
10
|
+
"dependsOn": ["^build"],
|
|
11
|
+
"outputs": [
|
|
12
|
+
"{options.outputPath}"
|
|
13
|
+
],
|
|
14
|
+
"options": {
|
|
15
|
+
"outputPath": "dist/packages/sentry",
|
|
16
|
+
"main": "packages/sentry/src/index.ts",
|
|
17
|
+
"tsConfig": "packages/sentry/tsconfig.lib.json",
|
|
18
|
+
"assets": [
|
|
19
|
+
"packages/sentry/*.md"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"test": {
|
|
24
|
+
"options": {
|
|
25
|
+
"passWithNoTests": true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sentry.configuration.js';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ILogger, MaybeUndefined } from "@ask-ell/core";
|
|
2
|
+
import { Client } from "@sentry/core";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
type SentryClientFactoryParams = {
|
|
6
|
+
dsn: string;
|
|
7
|
+
sendDefaultPii: boolean;
|
|
8
|
+
environment?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type SentryConfigurationProps<SentryClientFactory extends (params: SentryClientFactoryParams) => MaybeUndefined<Client>> = {
|
|
12
|
+
publicKey: string;
|
|
13
|
+
host: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
logger: ILogger;
|
|
16
|
+
init: SentryClientFactory;
|
|
17
|
+
environment?: MaybeUndefined<string>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export class SentryConfiguration<SentryClientFactory extends (params: SentryClientFactoryParams) => MaybeUndefined<Client>> {
|
|
21
|
+
private client: MaybeUndefined<Client>;
|
|
22
|
+
private logger: ILogger;
|
|
23
|
+
|
|
24
|
+
constructor(private props: SentryConfigurationProps<SentryClientFactory>) {
|
|
25
|
+
this.logger = this.props.logger;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
init(): void {
|
|
29
|
+
if (this.client) {
|
|
30
|
+
return this.logger.info("Sentry already inited. Step skipped");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { publicKey, host, projectId, environment, init } = this.props;
|
|
34
|
+
const dsn: string = `https://${publicKey}@${host}/${projectId}`;
|
|
35
|
+
|
|
36
|
+
this.client = init({
|
|
37
|
+
dsn,
|
|
38
|
+
sendDefaultPii: true,
|
|
39
|
+
environment: environment ?? "production"
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!this.client) {
|
|
43
|
+
this.logger.warn(`Sentry not inited`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
this.logger.info(`Sentry inited for environment "${environment}"`);
|
|
48
|
+
}
|
|
49
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
8
|
+
"emitDeclarationOnly": false,
|
|
9
|
+
"module": "nodenext",
|
|
10
|
+
"moduleResolution": "nodenext",
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"types": ["node"]
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.ts"],
|
|
15
|
+
"references": [],
|
|
16
|
+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./out-tsc/jest",
|
|
5
|
+
"types": ["jest", "node"],
|
|
6
|
+
"module": "nodenext",
|
|
7
|
+
"moduleResolution": "nodenext",
|
|
8
|
+
"forceConsistentCasingInFileNames": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"jest.config.ts",
|
|
12
|
+
"src/**/*.test.ts",
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.d.ts"
|
|
15
|
+
],
|
|
16
|
+
"references": [
|
|
17
|
+
{
|
|
18
|
+
"path": "./tsconfig.lib.json"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
package/src/index.d.ts
DELETED
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/sentry/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
package/src/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SentryConfiguration = void 0;
|
|
4
|
-
class SentryConfiguration {
|
|
5
|
-
props;
|
|
6
|
-
inited = false;
|
|
7
|
-
logger;
|
|
8
|
-
constructor(props) {
|
|
9
|
-
this.props = props;
|
|
10
|
-
this.logger = this.props.logger;
|
|
11
|
-
}
|
|
12
|
-
init() {
|
|
13
|
-
if (this.inited) {
|
|
14
|
-
return this.logger.info("Sentry already inited. Step skipped");
|
|
15
|
-
}
|
|
16
|
-
const { publicKey, host, projectId, environment, init } = this.props;
|
|
17
|
-
const dsn = `https://${publicKey}@${host}/${projectId}`;
|
|
18
|
-
const client = init({
|
|
19
|
-
dsn,
|
|
20
|
-
sendDefaultPii: true,
|
|
21
|
-
environment: environment ?? "production"
|
|
22
|
-
});
|
|
23
|
-
if (!client) {
|
|
24
|
-
this.logger.warn(`Sentry not inited`);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
this.logger.info(`Sentry inited for environment "${environment}"`);
|
|
28
|
-
this.inited = true;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.SentryConfiguration = SentryConfiguration;
|