@laboratory-one/api-components 0.0.15 → 0.0.17
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/dist/cjs/auth/auth.service.d.ts +1 -1
- package/dist/cjs/auth/auth.service.d.ts.map +1 -1
- package/dist/cjs/auth/auth.service.js +1 -2
- package/dist/cjs/auth/auth.service.js.map +1 -1
- package/dist/cjs/cron/cron.service.d.ts.map +1 -1
- package/dist/cjs/cron/cron.service.js +4 -0
- package/dist/cjs/cron/cron.service.js.map +1 -1
- package/dist/cjs/cron/cron.util.d.ts +3 -0
- package/dist/cjs/cron/cron.util.d.ts.map +1 -0
- package/dist/cjs/cron/cron.util.js +13 -0
- package/dist/cjs/cron/cron.util.js.map +1 -0
- package/dist/cjs/cron/index.d.ts +1 -0
- package/dist/cjs/cron/index.d.ts.map +1 -1
- package/dist/cjs/cron/index.js +1 -0
- package/dist/cjs/cron/index.js.map +1 -1
- package/dist/cjs/services/instrument-sentry.d.ts +1 -1
- package/dist/cjs/services/instrument-sentry.d.ts.map +1 -1
- package/dist/cjs/services/instrument-sentry.js +4 -1
- package/dist/cjs/services/instrument-sentry.js.map +1 -1
- package/dist/esm/auth/auth.service.d.ts +1 -1
- package/dist/esm/auth/auth.service.d.ts.map +1 -1
- package/dist/esm/auth/auth.service.js +1 -2
- package/dist/esm/auth/auth.service.js.map +1 -1
- package/dist/esm/cron/cron.service.d.ts.map +1 -1
- package/dist/esm/cron/cron.service.js +4 -0
- package/dist/esm/cron/cron.service.js.map +1 -1
- package/dist/esm/cron/cron.util.d.ts +3 -0
- package/dist/esm/cron/cron.util.d.ts.map +1 -0
- package/dist/esm/cron/cron.util.js +9 -0
- package/dist/esm/cron/cron.util.js.map +1 -0
- package/dist/esm/cron/index.d.ts +1 -0
- package/dist/esm/cron/index.d.ts.map +1 -1
- package/dist/esm/cron/index.js +1 -0
- package/dist/esm/cron/index.js.map +1 -1
- package/dist/esm/services/instrument-sentry.d.ts +1 -1
- package/dist/esm/services/instrument-sentry.d.ts.map +1 -1
- package/dist/esm/services/instrument-sentry.js +4 -1
- package/dist/esm/services/instrument-sentry.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/src/auth/auth.service.ts +2 -5
- package/src/cron/cron.service.ts +8 -0
- package/src/cron/cron.util.ts +10 -0
- package/src/cron/index.ts +1 -0
- package/src/services/instrument-sentry.ts +4 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as stytch from 'stytch';
|
|
2
2
|
import { ConfigService } from '@nestjs/config';
|
|
3
|
-
import { RegisterRequestDto } from '../user
|
|
3
|
+
import { RegisterRequestDto } from '../user';
|
|
4
4
|
export declare class AuthService {
|
|
5
5
|
private configService;
|
|
6
6
|
private readonly logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"/","sources":["auth/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"/","sources":["auth/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,qBACa,WAAW;IAIV,OAAO,CAAC,aAAa;IAHjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,UAAU,CAAgB;gBAEd,aAAa,EAAE,aAAa;IAW1C,MAAM,CACV,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC;IAMpC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAiBjD,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKhD"}
|
|
@@ -21,8 +21,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
21
21
|
}
|
|
22
22
|
async signup(data) {
|
|
23
23
|
this.logger.debug('signup');
|
|
24
|
-
|
|
25
|
-
return res;
|
|
24
|
+
return await this.authClient.passwords.create(data);
|
|
26
25
|
}
|
|
27
26
|
async login(data) {
|
|
28
27
|
this.logger.debug('login');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"/","sources":["auth/auth.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,uDAAiC;AACjC,2CAA+C;AAG/C,oCAAuC;AAGhC,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAItB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAH/B,WAAM,GAAW,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;QAI7D,IAAI,CAAC,UAAU,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC;YAClC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,mBAAmB,CAAC;YAC/D,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,eAAe,CAAC;YACvD,GAAG,EACD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,YAAY,CAAC,KAAK,MAAM;gBACrD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;gBAClB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAwB;QAExB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE5B,
|
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRoot":"/","sources":["auth/auth.service.ts"],"names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AAC,CAAC;YAC5C,CAAC;YAED,IAAI,KAAK,CAAC,UAAU,KAAK,0BAA0B,EAAE,CAAC;gBACpD,IAAA,mBAAW,EAAC,4BAA4B,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE5B,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AA7CY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;6CAKwB,sBAAa;GAJrC,WAAW,CA6CvB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport * as stytch from 'stytch';\nimport { ConfigService } from '@nestjs/config';\n\nimport { RegisterRequestDto } from '../user';\nimport { handleError } from '../utils';\n\n@Injectable()\nexport class AuthService {\n private readonly logger: Logger = new Logger(AuthService.name);\n private authClient: stytch.Client;\n\n constructor(private configService: ConfigService) {\n this.authClient = new stytch.Client({\n project_id: this.configService.get<string>('STYTCH_PROJECT_ID'),\n secret: this.configService.get<string>('STYTCH_SECRET'),\n env:\n this.configService.get<string>('STYTCH_ENV') === 'test'\n ? stytch.envs.test\n : stytch.envs.live,\n });\n }\n\n async signup(\n data: RegisterRequestDto,\n ): Promise<stytch.PasswordsCreateResponse> {\n this.logger.debug('signup');\n\n return await this.authClient.passwords.create(data);\n }\n\n async login(data: RegisterRequestDto): Promise<boolean> {\n this.logger.debug('login');\n\n try {\n const res = await this.authClient.passwords.authenticate(data);\n return res['status_code'] === 200;\n } catch (error: any) {\n if (error.error_type === 'email_not_found') {\n handleError('Email or password is wrong');\n }\n\n if (error.error_type === 'unauthorized_credentials') {\n handleError('Email or password is wrong');\n }\n }\n }\n\n async delete(externalId: string): Promise<void> {\n this.logger.debug('delete');\n\n await this.authClient.users.delete({ user_id: externalId });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.service.d.ts","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cron.service.d.ts","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":"AAUA,qBACa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;;IAO/D,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -5,6 +5,9 @@ exports.CronService = void 0;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const common_1 = require("@nestjs/common");
|
|
7
7
|
const schedule_1 = require("@nestjs/schedule");
|
|
8
|
+
const nestjs_1 = require("@sentry/nestjs");
|
|
9
|
+
const cron_util_1 = require("./cron.util");
|
|
10
|
+
const handleTaskMonitorConfig = (0, cron_util_1.getCronMonitorConfig)('0 0 * * * *');
|
|
8
11
|
let CronService = CronService_1 = class CronService {
|
|
9
12
|
constructor() {
|
|
10
13
|
this.logger = new common_1.Logger(CronService_1.name);
|
|
@@ -16,6 +19,7 @@ let CronService = CronService_1 = class CronService {
|
|
|
16
19
|
exports.CronService = CronService;
|
|
17
20
|
tslib_1.__decorate([
|
|
18
21
|
(0, schedule_1.Cron)('0 0 * * * *'),
|
|
22
|
+
(0, nestjs_1.SentryCron)('handleTask', handleTaskMonitorConfig),
|
|
19
23
|
tslib_1.__metadata("design:type", Function),
|
|
20
24
|
tslib_1.__metadata("design:paramtypes", []),
|
|
21
25
|
tslib_1.__metadata("design:returntype", void 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.service.js","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,+CAAwC;
|
|
1
|
+
{"version":3,"file":"cron.service.js","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,+CAAwC;AACxC,2CAA4C;AAG5C,2CAAmD;AAEnD,MAAM,uBAAuB,GAC3B,IAAA,gCAAoB,EAAC,aAAa,CAAC,CAAC;AAG/B,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAGtB;QAFiB,WAAM,GAAW,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAEhD,CAAC;IAKhB,UAAU;QACR,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;CACF,CAAA;AAXY,kCAAW;AAQtB;IAFC,IAAA,eAAI,EAAC,aAAa,CAAC;IACnB,IAAA,mBAAU,EAAC,YAAY,EAAE,uBAAuB,CAAC;;;;6CAGjD;sBAVU,WAAW;IADvB,IAAA,mBAAU,GAAE;;GACA,WAAW,CAWvB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport { Cron } from '@nestjs/schedule';\nimport { SentryCron } from '@sentry/nestjs';\nimport { MonitorConfig } from '@sentry/types';\n\nimport { getCronMonitorConfig } from './cron.util';\n\nconst handleTaskMonitorConfig: MonitorConfig =\n getCronMonitorConfig('0 0 * * * *');\n\n@Injectable()\nexport class CronService {\n private readonly logger: Logger = new Logger(CronService.name);\n\n constructor() {}\n\n // @Cron('45 * * * * *')\n @Cron('0 0 * * * *')\n @SentryCron('handleTask', handleTaskMonitorConfig)\n handleTask(): void {\n this.logger.debug('handleTask');\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.util.d.ts","sourceRoot":"/","sources":["cron/cron.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,oBAAoB,aAAc,MAAM,KAAG,aAOvD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCronMonitorConfig = void 0;
|
|
4
|
+
const getCronMonitorConfig = (schedule) => {
|
|
5
|
+
return {
|
|
6
|
+
schedule: {
|
|
7
|
+
type: 'crontab',
|
|
8
|
+
value: schedule,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.getCronMonitorConfig = getCronMonitorConfig;
|
|
13
|
+
//# sourceMappingURL=cron.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.util.js","sourceRoot":"/","sources":["cron/cron.util.ts"],"names":[],"mappings":";;;AAEO,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAiB,EAAE;IACtE,OAAO;QACL,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,QAAQ;SAChB;KACF,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B","sourcesContent":["import type { MonitorConfig } from '@sentry/types';\n\nexport const getCronMonitorConfig = (schedule: string): MonitorConfig => {\n return {\n schedule: {\n type: 'crontab',\n value: schedule,\n },\n };\n};\n"]}
|
package/dist/cjs/cron/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
package/dist/cjs/cron/index.js
CHANGED
|
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./cron.module"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./cron.service"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./cron.util"), exports);
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,yDAA+B","sourcesContent":["export * from './cron.module';\nexport * from './cron.service';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,yDAA+B;AAC/B,sDAA4B","sourcesContent":["export * from './cron.module';\nexport * from './cron.service';\nexport * from './cron.util';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const initSentry: () => void;
|
|
1
|
+
export declare const initSentry: (projectName: string) => void;
|
|
2
2
|
//# sourceMappingURL=instrument-sentry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,gBAAiB,MAAM,SAkB7C,CAAC"}
|
|
@@ -4,11 +4,14 @@ exports.initSentry = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const Sentry = tslib_1.__importStar(require("@sentry/node"));
|
|
6
6
|
const profiling_node_1 = require("@sentry/profiling-node");
|
|
7
|
-
const initSentry = () => {
|
|
7
|
+
const initSentry = (projectName) => {
|
|
8
8
|
Sentry.init({
|
|
9
9
|
dsn: process.env.SENTRY_DSN,
|
|
10
|
+
environment: process.env.ENVIRONMENT,
|
|
11
|
+
release: `${projectName}@${process.env.npm_package_version}`,
|
|
10
12
|
integrations: [
|
|
11
13
|
(0, profiling_node_1.nodeProfilingIntegration)(),
|
|
14
|
+
Sentry.anrIntegration({ captureStackTrace: true }),
|
|
12
15
|
],
|
|
13
16
|
tracesSampleRate: 1.0,
|
|
14
17
|
profilesSampleRate: 1.0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":";;;;AAAA,6DAAuC;AACvC,2DAAkE;AAE3D,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":";;;;AAAA,6DAAuC;AACvC,2DAAkE;AAE3D,MAAM,UAAU,GAAG,CAAC,WAAmB,EAAE,EAAE;IAEhD,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC3B,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;QACpC,OAAO,EAAE,GAAG,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;QAC5D,YAAY,EAAE;YAEZ,IAAA,yCAAwB,GAAE;YAC1B,MAAM,CAAC,cAAc,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;SACnD;QAGD,gBAAgB,EAAE,GAAG;QAGrB,kBAAkB,EAAE,GAAG;KACxB,CAAC,CAAC;AACL,CAAC,CAAC;AAlBW,QAAA,UAAU,cAkBrB","sourcesContent":["import * as Sentry from '@sentry/node';\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';\n\nexport const initSentry = (projectName: string) => {\n // Ensure to call this before requiring any other modules!\n Sentry.init({\n dsn: process.env.SENTRY_DSN,\n environment: process.env.ENVIRONMENT,\n release: `${projectName}@${process.env.npm_package_version}`,\n integrations: [\n // Add our Profiling integration\n nodeProfilingIntegration(),\n Sentry.anrIntegration({ captureStackTrace: true }),\n ],\n // Add Tracing by setting tracesSampleRate\n // We recommend adjusting this value in production\n tracesSampleRate: 1.0,\n // Set sampling rate for profiling\n // This is relative to tracesSampleRate\n profilesSampleRate: 1.0,\n });\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as stytch from 'stytch';
|
|
2
2
|
import { ConfigService } from '@nestjs/config';
|
|
3
|
-
import { RegisterRequestDto } from '../user
|
|
3
|
+
import { RegisterRequestDto } from '../user';
|
|
4
4
|
export declare class AuthService {
|
|
5
5
|
private configService;
|
|
6
6
|
private readonly logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"/","sources":["auth/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"/","sources":["auth/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,qBACa,WAAW;IAIV,OAAO,CAAC,aAAa;IAHjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,UAAU,CAAgB;gBAEd,aAAa,EAAE,aAAa;IAW1C,MAAM,CACV,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC;IAMpC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAiBjD,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKhD"}
|
|
@@ -18,8 +18,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
18
18
|
}
|
|
19
19
|
async signup(data) {
|
|
20
20
|
this.logger.debug('signup');
|
|
21
|
-
|
|
22
|
-
return res;
|
|
21
|
+
return await this.authClient.passwords.create(data);
|
|
23
22
|
}
|
|
24
23
|
async login(data) {
|
|
25
24
|
this.logger.debug('login');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"/","sources":["auth/auth.service.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGhC,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAItB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAH/B,WAAM,GAAW,IAAI,MAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;QAI7D,IAAI,CAAC,UAAU,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC;YAClC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,mBAAmB,CAAC;YAC/D,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,eAAe,CAAC;YACvD,GAAG,EACD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,YAAY,CAAC,KAAK,MAAM;gBACrD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;gBAClB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAwB;QAExB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE5B,
|
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRoot":"/","sources":["auth/auth.service.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,QAAQ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C3C,WAAW,CAAC,4BAA4B,CAAC,CAAC;YAC5C,CAAC;YAED,IAAI,KAAK,CAAC,UAAU,KAAK,0BAA0B,EAAE,CAAC;gBACpD,WAAW,CAAC,4BAA4B,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE5B,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AA7CY,WAAW;IADvB,UAAU,EAAE;qCAKwB,aAAa;GAJrC,WAAW,CA6CvB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport * as stytch from 'stytch';\nimport { ConfigService } from '@nestjs/config';\n\nimport { RegisterRequestDto } from '../user';\nimport { handleError } from '../utils';\n\n@Injectable()\nexport class AuthService {\n private readonly logger: Logger = new Logger(AuthService.name);\n private authClient: stytch.Client;\n\n constructor(private configService: ConfigService) {\n this.authClient = new stytch.Client({\n project_id: this.configService.get<string>('STYTCH_PROJECT_ID'),\n secret: this.configService.get<string>('STYTCH_SECRET'),\n env:\n this.configService.get<string>('STYTCH_ENV') === 'test'\n ? stytch.envs.test\n : stytch.envs.live,\n });\n }\n\n async signup(\n data: RegisterRequestDto,\n ): Promise<stytch.PasswordsCreateResponse> {\n this.logger.debug('signup');\n\n return await this.authClient.passwords.create(data);\n }\n\n async login(data: RegisterRequestDto): Promise<boolean> {\n this.logger.debug('login');\n\n try {\n const res = await this.authClient.passwords.authenticate(data);\n return res['status_code'] === 200;\n } catch (error: any) {\n if (error.error_type === 'email_not_found') {\n handleError('Email or password is wrong');\n }\n\n if (error.error_type === 'unauthorized_credentials') {\n handleError('Email or password is wrong');\n }\n }\n }\n\n async delete(externalId: string): Promise<void> {\n this.logger.debug('delete');\n\n await this.authClient.users.delete({ user_id: externalId });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.service.d.ts","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cron.service.d.ts","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":"AAUA,qBACa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;;IAO/D,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -2,6 +2,9 @@ var CronService_1;
|
|
|
2
2
|
import { __decorate, __metadata } from "tslib";
|
|
3
3
|
import { Injectable, Logger } from '@nestjs/common';
|
|
4
4
|
import { Cron } from '@nestjs/schedule';
|
|
5
|
+
import { SentryCron } from '@sentry/nestjs';
|
|
6
|
+
import { getCronMonitorConfig } from './cron.util';
|
|
7
|
+
const handleTaskMonitorConfig = getCronMonitorConfig('0 0 * * * *');
|
|
5
8
|
let CronService = CronService_1 = class CronService {
|
|
6
9
|
constructor() {
|
|
7
10
|
this.logger = new Logger(CronService_1.name);
|
|
@@ -12,6 +15,7 @@ let CronService = CronService_1 = class CronService {
|
|
|
12
15
|
};
|
|
13
16
|
__decorate([
|
|
14
17
|
Cron('0 0 * * * *'),
|
|
18
|
+
SentryCron('handleTask', handleTaskMonitorConfig),
|
|
15
19
|
__metadata("design:type", Function),
|
|
16
20
|
__metadata("design:paramtypes", []),
|
|
17
21
|
__metadata("design:returntype", void 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.service.js","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"cron.service.js","sourceRoot":"/","sources":["cron/cron.service.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,uBAAuB,GAC3B,oBAAoB,CAAC,aAAa,CAAC,CAAC;AAG/B,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAGtB;QAFiB,WAAM,GAAW,IAAI,MAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAEhD,CAAC;IAKhB,UAAU;QACR,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;CACF,CAAA;AAHC;IAFC,IAAI,CAAC,aAAa,CAAC;IACnB,UAAU,CAAC,YAAY,EAAE,uBAAuB,CAAC;;;;6CAGjD;AAVU,WAAW;IADvB,UAAU,EAAE;;GACA,WAAW,CAWvB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport { Cron } from '@nestjs/schedule';\nimport { SentryCron } from '@sentry/nestjs';\nimport { MonitorConfig } from '@sentry/types';\n\nimport { getCronMonitorConfig } from './cron.util';\n\nconst handleTaskMonitorConfig: MonitorConfig =\n getCronMonitorConfig('0 0 * * * *');\n\n@Injectable()\nexport class CronService {\n private readonly logger: Logger = new Logger(CronService.name);\n\n constructor() {}\n\n // @Cron('45 * * * * *')\n @Cron('0 0 * * * *')\n @SentryCron('handleTask', handleTaskMonitorConfig)\n handleTask(): void {\n this.logger.debug('handleTask');\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.util.d.ts","sourceRoot":"/","sources":["cron/cron.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,oBAAoB,aAAc,MAAM,KAAG,aAOvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.util.js","sourceRoot":"/","sources":["cron/cron.util.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAiB,EAAE;IACtE,OAAO;QACL,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,QAAQ;SAChB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { MonitorConfig } from '@sentry/types';\n\nexport const getCronMonitorConfig = (schedule: string): MonitorConfig => {\n return {\n schedule: {\n type: 'crontab',\n value: schedule,\n },\n };\n};\n"]}
|
package/dist/esm/cron/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
package/dist/esm/cron/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './cron.module';\nexport * from './cron.service';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC","sourcesContent":["export * from './cron.module';\nexport * from './cron.service';\nexport * from './cron.util';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const initSentry: () => void;
|
|
1
|
+
export declare const initSentry: (projectName: string) => void;
|
|
2
2
|
//# sourceMappingURL=instrument-sentry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,gBAAiB,MAAM,SAkB7C,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as Sentry from '@sentry/node';
|
|
2
2
|
import { nodeProfilingIntegration } from '@sentry/profiling-node';
|
|
3
|
-
export const initSentry = () => {
|
|
3
|
+
export const initSentry = (projectName) => {
|
|
4
4
|
Sentry.init({
|
|
5
5
|
dsn: process.env.SENTRY_DSN,
|
|
6
|
+
environment: process.env.ENVIRONMENT,
|
|
7
|
+
release: `${projectName}@${process.env.npm_package_version}`,
|
|
6
8
|
integrations: [
|
|
7
9
|
nodeProfilingIntegration(),
|
|
10
|
+
Sentry.anrIntegration({ captureStackTrace: true }),
|
|
8
11
|
],
|
|
9
12
|
tracesSampleRate: 1.0,
|
|
10
13
|
profilesSampleRate: 1.0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,WAAmB,EAAE,EAAE;IAEhD,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC3B,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;QACpC,OAAO,EAAE,GAAG,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;QAC5D,YAAY,EAAE;YAEZ,wBAAwB,EAAE;YAC1B,MAAM,CAAC,cAAc,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;SACnD;QAGD,gBAAgB,EAAE,GAAG;QAGrB,kBAAkB,EAAE,GAAG;KACxB,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';\n\nexport const initSentry = (projectName: string) => {\n // Ensure to call this before requiring any other modules!\n Sentry.init({\n dsn: process.env.SENTRY_DSN,\n environment: process.env.ENVIRONMENT,\n release: `${projectName}@${process.env.npm_package_version}`,\n integrations: [\n // Add our Profiling integration\n nodeProfilingIntegration(),\n Sentry.anrIntegration({ captureStackTrace: true }),\n ],\n // Add Tracing by setting tracesSampleRate\n // We recommend adjusting this value in production\n tracesSampleRate: 1.0,\n // Set sampling rate for profiling\n // This is relative to tracesSampleRate\n profilesSampleRate: 1.0,\n });\n};\n"]}
|