@servicelabsco/nestjs-utility-services 3.0.6 → 3.0.8
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/CHANGELOG.md +58 -0
- package/dist/auth/auth.module.js +2 -2
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/es6.classes.d.ts +0 -2
- package/dist/auth/es6.classes.js +1 -11
- package/dist/auth/es6.classes.js.map +1 -1
- package/dist/auth/services/device.token.service.js +2 -35
- package/dist/auth/services/device.token.service.js.map +1 -1
- package/dist/common/decorators/public.exposed.decorator.d.ts +2 -1
- package/dist/common/decorators/public.exposed.decorator.js +21 -6
- package/dist/common/decorators/public.exposed.decorator.js.map +1 -1
- package/dist/common/es6.classes.d.ts +1 -0
- package/dist/common/es6.classes.js +3 -0
- package/dist/common/es6.classes.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/interfaces/index.d.ts +1 -0
- package/dist/common/interfaces/index.js +18 -0
- package/dist/common/interfaces/index.js.map +1 -0
- package/dist/common/interfaces/platform.registry.resolver.interface.d.ts +5 -0
- package/dist/common/interfaces/platform.registry.resolver.interface.js +3 -0
- package/dist/common/interfaces/platform.registry.resolver.interface.js.map +1 -0
- package/dist/common/libraries/common.service.d.ts +1 -1
- package/dist/common/libraries/common.service.js.map +1 -1
- package/dist/common/libraries/common.subscriber.js +2 -35
- package/dist/common/libraries/common.subscriber.js.map +1 -1
- package/dist/common/libraries/custom.crypt.js +2 -2
- package/dist/common/libraries/custom.crypt.js.map +1 -1
- package/dist/common/libraries/index.d.ts +1 -0
- package/dist/common/libraries/index.js +1 -0
- package/dist/common/libraries/index.js.map +1 -1
- package/dist/common/libraries/platform.utility.d.ts +3 -0
- package/dist/common/libraries/platform.utility.js +6 -3
- package/dist/common/libraries/platform.utility.js.map +1 -1
- package/dist/common/libraries/sentry.sdk.d.ts +11 -0
- package/dist/common/libraries/sentry.sdk.js +26 -0
- package/dist/common/libraries/sentry.sdk.js.map +1 -0
- package/dist/config/sentry.options.d.ts +2 -1
- package/dist/config/sentry.options.js +7 -36
- package/dist/config/sentry.options.js.map +1 -1
- package/dist/platformUtility/consumers/job.consumer.js +2 -35
- package/dist/platformUtility/consumers/job.consumer.js.map +1 -1
- package/dist/platformUtility/es6.classes.d.ts +2 -2
- package/dist/platformUtility/es6.classes.js +2 -2
- package/dist/platformUtility/es6.classes.js.map +1 -1
- package/dist/platformUtility/filters/sentry.reporting.filter.d.ts +8 -7
- package/dist/platformUtility/filters/sentry.reporting.filter.js +66 -41
- package/dist/platformUtility/filters/sentry.reporting.filter.js.map +1 -1
- package/dist/platformUtility/libraries/common.sqs.polling.js +3 -36
- package/dist/platformUtility/libraries/common.sqs.polling.js.map +1 -1
- package/dist/platformUtility/libraries/sentry.bootstrap.d.ts +3 -2
- package/dist/platformUtility/libraries/sentry.bootstrap.js +3 -1
- package/dist/platformUtility/libraries/sentry.bootstrap.js.map +1 -1
- package/dist/platformUtility/libraries/sentry.context.js +4 -2
- package/dist/platformUtility/libraries/sentry.context.js.map +1 -1
- package/dist/platformUtility/platform.utility.module.js +2 -0
- package/dist/platformUtility/platform.utility.module.js.map +1 -1
- package/dist/platformUtility/sentry.reporting.module.js +2 -2
- package/dist/platformUtility/sentry.reporting.module.js.map +1 -1
- package/dist/platformUtility/services/aws.secret.service.js +2 -35
- package/dist/platformUtility/services/aws.secret.service.js.map +1 -1
- package/dist/platformUtility/services/emithook.mail.service.d.ts +0 -1
- package/dist/platformUtility/services/emithook.mail.service.js +2 -1
- package/dist/platformUtility/services/emithook.mail.service.js.map +1 -1
- package/dist/platformUtility/services/index.d.ts +1 -0
- package/dist/platformUtility/services/index.js +1 -0
- package/dist/platformUtility/services/index.js.map +1 -1
- package/dist/platformUtility/services/pdf.service.d.ts +0 -1
- package/dist/platformUtility/services/pdf.service.js +2 -1
- package/dist/platformUtility/services/pdf.service.js.map +1 -1
- package/dist/platformUtility/services/platform.registry.service.d.ts +23 -0
- package/dist/platformUtility/services/platform.registry.service.js +122 -0
- package/dist/platformUtility/services/platform.registry.service.js.map +1 -0
- package/dist/platformUtility/services/sql.service.js +6 -39
- package/dist/platformUtility/services/sql.service.js.map +1 -1
- package/dist/platformUtility/subscribers/dispatcher.subscriber.d.ts +3 -0
- package/dist/platformUtility/subscribers/dispatcher.subscriber.js +27 -38
- package/dist/platformUtility/subscribers/dispatcher.subscriber.js.map +1 -1
- package/dist/system/libraries/business.rule.query.evaluator.js +2 -35
- package/dist/system/libraries/business.rule.query.evaluator.js.map +1 -1
- package/dist/system/services/event.queue.service.js +2 -35
- package/dist/system/services/event.queue.service.js.map +1 -1
- package/docs/sentry-reporting.md +22 -13
- package/docs/subscribe-for.md +1 -0
- package/package.json +1 -1
- package/dist/platformUtility/services/es6.service.d.ts +0 -10
- package/dist/platformUtility/services/es6.service.js +0 -41
- package/dist/platformUtility/services/es6.service.js.map +0 -1
|
@@ -6,10 +6,13 @@ export declare class DispatcherSubscriber extends CommonSubscriber<any> implemen
|
|
|
6
6
|
private readonly dataSource;
|
|
7
7
|
private readonly moduleRef;
|
|
8
8
|
private readonly jobs;
|
|
9
|
+
private readonly jobsByTarget;
|
|
10
|
+
private initialized;
|
|
9
11
|
constructor(dataSource: DataSource, moduleRef: ModuleRef);
|
|
10
12
|
onModuleInit(): Promise<void>;
|
|
11
13
|
private warnIgnoredPrePersistHooks;
|
|
12
14
|
afterInsert(evt: InsertEvent<any>): Promise<any>;
|
|
13
15
|
afterUpdate(evt: UpdateEvent<any>): Promise<any>;
|
|
14
16
|
private routeDispatch;
|
|
17
|
+
private jobsFor;
|
|
15
18
|
}
|
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
10
|
};
|
|
@@ -45,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
12
|
exports.DispatcherSubscriber = void 0;
|
|
46
13
|
const common_1 = require("@nestjs/common");
|
|
47
14
|
const core_1 = require("@nestjs/core");
|
|
48
|
-
const
|
|
15
|
+
const sentry_sdk_1 = require("../../common/libraries/sentry.sdk");
|
|
49
16
|
const typeorm_1 = require("typeorm");
|
|
50
17
|
const common_subscriber_1 = require("../../common/libraries/common.subscriber");
|
|
51
18
|
const subscriber_registry_1 = require("../../common/libraries/subscriber.registry");
|
|
@@ -55,6 +22,8 @@ let DispatcherSubscriber = class DispatcherSubscriber extends common_subscriber_
|
|
|
55
22
|
this.dataSource = dataSource;
|
|
56
23
|
this.moduleRef = moduleRef;
|
|
57
24
|
this.jobs = new Map();
|
|
25
|
+
this.jobsByTarget = new Map();
|
|
26
|
+
this.initialized = false;
|
|
58
27
|
dataSource.subscribers.push(this);
|
|
59
28
|
}
|
|
60
29
|
async onModuleInit() {
|
|
@@ -72,6 +41,8 @@ let DispatcherSubscriber = class DispatcherSubscriber extends common_subscriber_
|
|
|
72
41
|
}
|
|
73
42
|
this.jobs.set(entityClass, resolved);
|
|
74
43
|
}
|
|
44
|
+
this.jobsByTarget.clear();
|
|
45
|
+
this.initialized = true;
|
|
75
46
|
}
|
|
76
47
|
warnIgnoredPrePersistHooks(job, jobClass, entityClass) {
|
|
77
48
|
const hooks = ['beforeInsert', 'beforeUpdate'].filter((hook) => typeof job?.[hook] === 'function');
|
|
@@ -80,7 +51,7 @@ let DispatcherSubscriber = class DispatcherSubscriber extends common_subscriber_
|
|
|
80
51
|
const message = `DispatcherSubscriber: ${jobClass.name} (@SubscribeFor ${entityClass.name}) defines ${hooks.join(' / ')}, ` +
|
|
81
52
|
`which is no longer invoked on jobs. Move pre-persist logic to a standalone CommonSubscriber.`;
|
|
82
53
|
global.console.error(message);
|
|
83
|
-
|
|
54
|
+
sentry_sdk_1.SentrySdk.captureMessage(message, { level: 'error', tags: { component: 'DispatcherSubscriber', job: jobClass.name } });
|
|
84
55
|
}
|
|
85
56
|
async afterInsert(evt) {
|
|
86
57
|
return this.routeDispatch(evt);
|
|
@@ -89,15 +60,33 @@ let DispatcherSubscriber = class DispatcherSubscriber extends common_subscriber_
|
|
|
89
60
|
return this.routeDispatch(evt);
|
|
90
61
|
}
|
|
91
62
|
async routeDispatch(evt) {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
if (!jobs?.length)
|
|
63
|
+
const jobs = this.jobsFor(evt.metadata.target);
|
|
64
|
+
if (!jobs.length)
|
|
95
65
|
return;
|
|
96
66
|
const data = this.getEventData(evt);
|
|
97
67
|
for (const job of jobs) {
|
|
98
68
|
await this.enqueueDispatch(evt.queryRunner, job, data);
|
|
99
69
|
}
|
|
100
70
|
}
|
|
71
|
+
jobsFor(target) {
|
|
72
|
+
const cached = this.jobsByTarget.get(target);
|
|
73
|
+
if (cached)
|
|
74
|
+
return cached;
|
|
75
|
+
const lineage = [];
|
|
76
|
+
for (let cls = target; typeof cls === 'function' && cls !== Function.prototype; cls = Object.getPrototypeOf(cls)) {
|
|
77
|
+
lineage.unshift(cls);
|
|
78
|
+
}
|
|
79
|
+
const jobs = [];
|
|
80
|
+
for (const cls of lineage) {
|
|
81
|
+
for (const job of this.jobs.get(cls) ?? []) {
|
|
82
|
+
if (!jobs.includes(job))
|
|
83
|
+
jobs.push(job);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (this.initialized)
|
|
87
|
+
this.jobsByTarget.set(target, jobs);
|
|
88
|
+
return jobs;
|
|
89
|
+
}
|
|
101
90
|
};
|
|
102
91
|
exports.DispatcherSubscriber = DispatcherSubscriber;
|
|
103
92
|
exports.DispatcherSubscriber = DispatcherSubscriber = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.subscriber.js","sourceRoot":"","sources":["../../../src/platformUtility/subscribers/dispatcher.subscriber.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispatcher.subscriber.js","sourceRoot":"","sources":["../../../src/platformUtility/subscribers/dispatcher.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA0D;AAC1D,uCAAyC;AACzC,kEAA8D;AAC9D,qCAAgF;AAChF,gFAA4E;AAC5E,oFAAgF;AA4BzE,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,oCAAqB;IAS3D,YACqB,UAAsB,EACtB,SAAoB;QAErC,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACtB,cAAS,GAAT,SAAS,CAAW;QAVxB,SAAI,GAAG,IAAI,GAAG,EAAkC,CAAC;QAGjD,iBAAY,GAAG,IAAI,GAAG,EAA8B,CAAC;QAG9D,gBAAW,GAAG,KAAK,CAAC;QAOxB,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,YAAY;QACd,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,wCAAkB,CAAC,OAAO,EAAE,EAAE,CAAC;YACnE,MAAM,QAAQ,GAAsB,EAAE,CAAC;YACvC,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;gBAChC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAgC,CAAC;gBAClG,IAAI,CAAC,GAAG,EAAE,CAAC;oBACP,MAAM,IAAI,KAAK,CACX,+CAA+C,QAAQ,CAAC,IAAI,GAAG;wBAC3D,cAAc,WAAW,CAAC,IAAI,kBAAkB;wBAChD,qEAAqE,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QAC1D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AA1HY,oDAAoB;+BAApB,oBAAoB;IAFhC,IAAA,mBAAU,GAAE;IACZ,IAAA,yBAAe,GAAE;qCAWmB,oBAAU;QACX,gBAAS;GAXhC,oBAAoB,CA0HhC"}
|
|
@@ -1,40 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.BusinessRuleQueryEvaluator = void 0;
|
|
37
|
-
const
|
|
4
|
+
const sentry_sdk_1 = require("../../common/libraries/sentry.sdk");
|
|
38
5
|
const auth_1 = require("../../common/libraries/auth");
|
|
39
6
|
const system_script_entity_1 = require("../entities/system.script.entity");
|
|
40
7
|
const sandboxed_script_executor_1 = require("./sandboxed.script.executor");
|
|
@@ -63,7 +30,7 @@ class BusinessRuleQueryEvaluator {
|
|
|
63
30
|
}),
|
|
64
31
|
});
|
|
65
32
|
if (!result.ok) {
|
|
66
|
-
|
|
33
|
+
sentry_sdk_1.SentrySdk.captureException(new Error(result.error), {
|
|
67
34
|
level: 'error',
|
|
68
35
|
tags: { service: 'BusinessRuleQueryEvaluator' },
|
|
69
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business.rule.query.evaluator.js","sourceRoot":"","sources":["../../../src/system/libraries/business.rule.query.evaluator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"business.rule.query.evaluator.js","sourceRoot":"","sources":["../../../src/system/libraries/business.rule.query.evaluator.ts"],"names":[],"mappings":";;;AAAA,kEAA8D;AAC9D,sDAAmD;AACnD,2EAAsE;AAGtE,2EAAsE;AACtE,2DAAsD;AAQtD,MAAa,0BAA0B;IAQnC,YACqB,IAAwB,EACxB,aAA0B;QAD1B,SAAI,GAAJ,IAAI,CAAoB;QACxB,kBAAa,GAAb,aAAa,CAAa;QAT9B,aAAQ,GAAG,IAAI,mDAAuB,EAAE,CAAC;IAUvD,CAAC;IAMJ,KAAK,CAAC,OAAO;QACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzD,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,OA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Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
10
|
};
|
|
@@ -45,7 +12,7 @@ var EventQueueService_1;
|
|
|
45
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
13
|
exports.EventQueueService = void 0;
|
|
47
14
|
const common_1 = require("@nestjs/common");
|
|
48
|
-
const
|
|
15
|
+
const sentry_sdk_1 = require("../../common/libraries/sentry.sdk");
|
|
49
16
|
const typeorm_1 = require("typeorm");
|
|
50
17
|
const operation_exception_1 = require("../../common/exceptions/operation.exception");
|
|
51
18
|
const date_util_1 = require("../../common/libraries/date.util");
|
|
@@ -150,7 +117,7 @@ let EventQueueService = EventQueueService_1 = class EventQueueService {
|
|
|
150
117
|
const identifier = event.event?.identifier ?? 'unknown';
|
|
151
118
|
const message = error instanceof Error ? error.message : String(error);
|
|
152
119
|
global.console.error(`event-trigger-failed (event_id=${event.id}, identifier=${identifier}): ${message}`);
|
|
153
|
-
|
|
120
|
+
sentry_sdk_1.SentrySdk.captureException(error, {
|
|
154
121
|
level: 'error',
|
|
155
122
|
tags: { service: 'EventQueueService' },
|
|
156
123
|
extra: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.queue.service.js","sourceRoot":"","sources":["../../../src/system/services/event.queue.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event.queue.service.js","sourceRoot":"","sources":["../../../src/system/services/event.queue.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,kEAA8D;AAC9D,qCAA6B;AAC7B,qFAAiF;AACjF,gEAA4D;AAC5D,gFAA4E;AAC5E,4EAAwE;AACxE,yEAAoE;AACpE,uEAAkE;AAS3D,IAAM,iBAAi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,CAAC;QAErC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC;QAEtD,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IASO,iBAAiB,CAAC,KAAa;QACnC,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,KAAK,CAAC;QAElC,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAEhC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,IAAI,GAAG,KAAK,MAAM;gBAAE,OAAO,IAAI,CAAC;YAChC,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;;AA3QQ,8CAAiB;AAKF,kCAAgB,GAAG,EAAE,AAAL,CAAM;4BALrC,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAc0B,4BAAY;QACd,wBAAU;GAdlC,iBAAiB,CA4Q7B"}
|
package/docs/sentry-reporting.md
CHANGED
|
@@ -8,7 +8,8 @@ package's security defaults:
|
|
|
8
8
|
- `includeLocalVariables: false`, `sendDefaultPii: false`
|
|
9
9
|
- Redacted request context and auth user (`id` + `email` only)
|
|
10
10
|
- HTTP **5xx** reporting (4xx `HttpException` values stay out of Sentry)
|
|
11
|
-
- **No reporting from queue worker processes** (`worker.ts` entrypoint)
|
|
11
|
+
- **No reporting from queue worker processes** (`worker.ts` entrypoint) unless opted in
|
|
12
|
+
with `SENTRY_ENABLE_WORKER=true` (see §5)
|
|
12
13
|
- Quiet one-line **ERROR** logs in local/dev (full stacks still go to Sentry)
|
|
13
14
|
|
|
14
15
|
Peer dependencies `@sentry/nestjs`, `@sentry/node`, and `@sentry/core` are bundled
|
|
@@ -25,9 +26,10 @@ directly.
|
|
|
25
26
|
| `HTTP_EXCEPTION_VERBOSE_LOG=true` | Optional | Force full local stack traces even in local/dev. |
|
|
26
27
|
| `HTTP_EXCEPTION_QUIET_LOG=true` | Optional | Force quiet logs in any environment. |
|
|
27
28
|
| `SENTRY_DEBUG=true` | Optional | SDK transport debug lines in the terminal. |
|
|
29
|
+
| `SENTRY_ENABLE_WORKER=true` | Optional | Opt a queue worker (`worker.ts` / `dist/worker.js`) in to Sentry. Only the exact value `true` counts. Has no effect on the API process. |
|
|
28
30
|
|
|
29
31
|
Workers may share the same `.env` file. Sentry stays off when the process is started
|
|
30
|
-
via `worker.ts` / `dist/worker.js
|
|
32
|
+
via `worker.ts` / `dist/worker.js` unless that process also has `SENTRY_ENABLE_WORKER=true`.
|
|
31
33
|
|
|
32
34
|
## 2. Early init (`instrument.ts`)
|
|
33
35
|
|
|
@@ -55,8 +57,9 @@ async function bootstrap() {
|
|
|
55
57
|
bootstrap();
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
`
|
|
60
|
+
Import `./instrument` as the first line of `worker.ts` too. `initSentry()` is a
|
|
61
|
+
no-op on the worker entrypoint unless `SENTRY_ENABLE_WORKER=true`, so importing it
|
|
62
|
+
is safe either way and lets each deployment decide through env alone.
|
|
60
63
|
|
|
61
64
|
## 3. Nest module wiring
|
|
62
65
|
|
|
@@ -98,14 +101,16 @@ any custom exception filters, or compose filters explicitly so Sentry still runs
|
|
|
98
101
|
|
|
99
102
|
## 4. Manual `captureException`
|
|
100
103
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
`
|
|
104
|
+
Prefer the package's lazy `SentrySdk` over importing `@sentry/*` directly. A top-level
|
|
105
|
+
`import * as Sentry from '@sentry/node'` loads the SDK (~14 MB heap, ~1,300 modules) into every
|
|
106
|
+
process, including those where Sentry is off; `SentrySdk` only loads it when Sentry is enabled
|
|
107
|
+
for the process and is a no-op otherwise. Events pass through the same `beforeSend` redaction
|
|
108
|
+
configured in `initSentry()`.
|
|
104
109
|
|
|
105
110
|
```typescript
|
|
106
|
-
import {
|
|
111
|
+
import { SentrySdk } from '@servicelabsco/nestjs-utility-services';
|
|
107
112
|
|
|
108
|
-
captureException(error);
|
|
113
|
+
SentrySdk.captureException(error, { tags: { service: 'MyService' } });
|
|
109
114
|
```
|
|
110
115
|
|
|
111
116
|
On HTTP requests, `SentryUserScopeInterceptor` already attaches the authenticated user
|
|
@@ -116,10 +121,14 @@ On HTTP requests, `SentryUserScopeInterceptor` already attaches the authenticate
|
|
|
116
121
|
| Process | `initSentry()` | `SentryReportingModule` |
|
|
117
122
|
| --- | --- | --- |
|
|
118
123
|
| `main.ts` (API) | Yes (`instrument.ts`) | Yes |
|
|
119
|
-
| `worker.ts` (BullMQ) |
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
| `worker.ts` (BullMQ), default | No-op | Registers nothing (no HTTP on a worker) |
|
|
125
|
+
| `worker.ts` with `SENTRY_ENABLE_WORKER=true` | Initialises with the same redacting options | Registers nothing (no HTTP on a worker) |
|
|
126
|
+
|
|
127
|
+
With the opt-in, a worker reports uncaught exceptions, unhandled rejections and any
|
|
128
|
+
explicit `captureException` from jobs, consumers and subscribers (e.g. post-commit
|
|
129
|
+
dispatch failures). Without it, job failures are **not** reported — log/handle them in
|
|
130
|
+
worker code. `SentryBootstrap.isWorkerEnabled()` / `isSentryWorkerEnabled()` tell you
|
|
131
|
+
which mode a process is in.
|
|
123
132
|
|
|
124
133
|
## 6. Verify
|
|
125
134
|
|
package/docs/subscribe-for.md
CHANGED
|
@@ -170,6 +170,7 @@ other job.
|
|
|
170
170
|
| `afterInsert` / `afterUpdate` | Fan-out to **all** `@SubscribeFor` jobs for that entity (registration order, sequential enqueue). |
|
|
171
171
|
| `beforeInsert` / `beforeUpdate` | **Only** on standalone `CommonSubscriber`s. Never routed to jobs. |
|
|
172
172
|
| Standalone subscriber + `@SubscribeFor` | Allowed. Mutation on subscriber; post-persist via dispatcher. |
|
|
173
|
+
| Saving a subclass entity (e.g. `LocalEmailMessageEntity extends EmailMessageEntity`) | Runs the jobs bound to the subclass **and** to every entity it extends (parents first), like TypeORM `listenTo()`. A job bound to several classes on the chain runs once. Saving the parent never runs subclass-only jobs. |
|
|
173
174
|
| Transactional saves | Dispatch is buffered until commit (see `CommonSubscriber` / dispatcher); rolled back on rollback. |
|
|
174
175
|
|
|
175
176
|
Platform modules usually register before the app, so NU’s job is typically
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { EmithookMailService } from './emithook.mail.service';
|
|
2
|
-
import { PdfService } from './pdf.service';
|
|
3
|
-
export declare class Es6Service {
|
|
4
|
-
private readonly emithookMailService;
|
|
5
|
-
private readonly pdfService;
|
|
6
|
-
private services;
|
|
7
|
-
constructor(emithookMailService: EmithookMailService, pdfService: PdfService);
|
|
8
|
-
alignServices(): void;
|
|
9
|
-
setServices(): void;
|
|
10
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Es6Service = void 0;
|
|
13
|
-
const common_1 = require("@nestjs/common");
|
|
14
|
-
const emithook_mail_service_1 = require("./emithook.mail.service");
|
|
15
|
-
const pdf_service_1 = require("./pdf.service");
|
|
16
|
-
const platform_utility_1 = require("../../common/libraries/platform.utility");
|
|
17
|
-
let Es6Service = class Es6Service {
|
|
18
|
-
constructor(emithookMailService, pdfService) {
|
|
19
|
-
this.emithookMailService = emithookMailService;
|
|
20
|
-
this.pdfService = pdfService;
|
|
21
|
-
this.services = {};
|
|
22
|
-
this.alignServices();
|
|
23
|
-
this.setServices();
|
|
24
|
-
}
|
|
25
|
-
alignServices() {
|
|
26
|
-
this.services = {
|
|
27
|
-
'4783f96d655aa1ff8ca76641cbe12d4c': this.emithookMailService,
|
|
28
|
-
'3411202afaa6c30b8a4566d2749c6531': this.pdfService,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
setServices() {
|
|
32
|
-
platform_utility_1.PlatformUtility.setServices(this.services);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.Es6Service = Es6Service;
|
|
36
|
-
exports.Es6Service = Es6Service = __decorate([
|
|
37
|
-
(0, common_1.Injectable)(),
|
|
38
|
-
__metadata("design:paramtypes", [emithook_mail_service_1.EmithookMailService,
|
|
39
|
-
pdf_service_1.PdfService])
|
|
40
|
-
], Es6Service);
|
|
41
|
-
//# sourceMappingURL=es6.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"es6.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/es6.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mEAA8D;AAC9D,+CAA2C;AAC3C,8EAA0E;AAQnE,IAAM,UAAU,GAAhB,MAAM,UAAU;IAGnB,YACqB,mBAAwC,EACxC,UAAsB;QADtB,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,eAAU,GAAV,UAAU,CAAY;QAJnC,aAAQ,GAAG,EAAE,CAAC;QAMlB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAMD,aAAa;QACT,IAAI,CAAC,QAAQ,GAAG;YACZ,kCAAkC,EAAE,IAAI,CAAC,mBAAmB;YAC5D,kCAAkC,EAAE,IAAI,CAAC,UAAU;SACtD,CAAC;IACN,CAAC;IAMD,WAAW;QACP,kCAAe,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAA;AA7BY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;qCAKiC,2CAAmB;QAC5B,wBAAU;GALlC,UAAU,CA6BtB"}
|