@vasrefil/api-toolkit 1.0.12 → 1.0.14
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/app-middlewares/airbrake.d.ts +11 -9
- package/dist/app-middlewares/airbrake.js +37 -44
- package/dist/app-middlewares/index.d.ts +1 -0
- package/dist/app-middlewares/index.js +17 -0
- package/dist/interfaces/index.d.ts +5 -0
- package/dist/interfaces/index.js +21 -0
- package/dist/public-api.d.ts +2 -0
- package/dist/public-api.js +2 -0
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ServiceRespI } from '../interfaces/interface';
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
declare const airbrakeExpress: any;
|
|
3
|
+
declare const airbrake: any;
|
|
4
|
+
declare const airbrake_request_logger: (dto: {
|
|
5
|
+
serviceResponse: ServiceRespI;
|
|
6
|
+
}) => void;
|
|
7
|
+
declare const airtbrake_error_logger: (dto: {
|
|
8
|
+
error: any;
|
|
9
|
+
params: any;
|
|
10
|
+
route: any;
|
|
11
|
+
}) => void;
|
|
12
|
+
export { airbrake, airbrakeExpress, airbrake_request_logger, airtbrake_error_logger };
|
|
@@ -3,56 +3,49 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.airtbrake_error_logger = exports.airbrake_request_logger = exports.airbrakeExpress = exports.airbrake = void 0;
|
|
7
7
|
const env_1 = __importDefault(require("../env"));
|
|
8
8
|
const Airbrake = require('@airbrake/node');
|
|
9
9
|
const airbrakeExpress = require('@airbrake/node/dist/instrumentation/express');
|
|
10
|
+
exports.airbrakeExpress = airbrakeExpress;
|
|
10
11
|
const json_stringify_safe = require('json-stringify-safe');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const airbrake = new Airbrake.Notifier({
|
|
13
|
+
projectId: env_1.default.AIRBRAKE.PROJECT_ID,
|
|
14
|
+
projectKey: env_1.default.AIRBRAKE.PROJECT_KEY,
|
|
15
|
+
environment: `${env_1.default.NODE_ENV}`
|
|
16
|
+
});
|
|
17
|
+
exports.airbrake = airbrake;
|
|
18
|
+
const airbrake_request_logger = (dto) => {
|
|
19
|
+
try {
|
|
20
|
+
const { request, error, data, message, actionType } = dto.serviceResponse;
|
|
21
|
+
const dataErr = data ? json_stringify_safe(data) : null;
|
|
22
|
+
const errorErr = error ? json_stringify_safe(error, null) : null;
|
|
23
|
+
const messageErr = message ? json_stringify_safe(message) : null;
|
|
24
|
+
const error_ = messageErr || errorErr || dataErr;
|
|
25
|
+
const actionType_ = actionType || 'App Error';
|
|
26
|
+
const body = request && request.body ? request.body : 'no body';
|
|
27
|
+
const url = request && request.url ? request.url : 'no url';
|
|
28
|
+
airbrake.notify({
|
|
29
|
+
error: error_,
|
|
30
|
+
params: { url, body, actionType: actionType_ },
|
|
31
|
+
route: url
|
|
17
32
|
});
|
|
18
33
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { request, error, data, message, actionType } = serviceResponse;
|
|
22
|
-
const dataErr = data ? json_stringify_safe(data) : null;
|
|
23
|
-
const errorErr = error ? json_stringify_safe(error, null) : null;
|
|
24
|
-
const messageErr = message ? json_stringify_safe(message) : null;
|
|
25
|
-
const error_ = messageErr || errorErr || dataErr;
|
|
26
|
-
const actionType_ = actionType || 'App Error';
|
|
27
|
-
const body = request && request.body ? request.body : 'no body';
|
|
28
|
-
const url = request && request.url ? request.url : 'no url';
|
|
29
|
-
this.airbrake.notify({
|
|
30
|
-
error: error_,
|
|
31
|
-
params: { url, body, actionType: actionType_ },
|
|
32
|
-
route: url
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
this.airbrake.notify(error);
|
|
37
|
-
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
airbrake.notify(error);
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.airbrake.notify(error);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
getAirbrakeInstance() {
|
|
52
|
-
return this.airbrake;
|
|
37
|
+
};
|
|
38
|
+
exports.airbrake_request_logger = airbrake_request_logger;
|
|
39
|
+
const airtbrake_error_logger = (dto) => {
|
|
40
|
+
try {
|
|
41
|
+
airbrake.notify({
|
|
42
|
+
error: json_stringify_safe(dto.error, null),
|
|
43
|
+
params: dto.params,
|
|
44
|
+
route: dto.route
|
|
45
|
+
});
|
|
53
46
|
}
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
catch (error) {
|
|
48
|
+
airbrake.notify(error);
|
|
56
49
|
}
|
|
57
|
-
}
|
|
58
|
-
exports.
|
|
50
|
+
};
|
|
51
|
+
exports.airtbrake_error_logger = airtbrake_error_logger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './airbrake';
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./airbrake"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user.interface"), exports);
|
|
18
|
+
__exportStar(require("./status.interface"), exports);
|
|
19
|
+
__exportStar(require("./root-controller.interface"), exports);
|
|
20
|
+
__exportStar(require("./interface"), exports);
|
|
21
|
+
__exportStar(require("./env.interface"), exports);
|
package/dist/public-api.d.ts
CHANGED
package/dist/public-api.js
CHANGED
|
@@ -18,5 +18,7 @@ exports.setEnvs = void 0;
|
|
|
18
18
|
__exportStar(require("./controllers"), exports);
|
|
19
19
|
__exportStar(require("./helpers"), exports);
|
|
20
20
|
__exportStar(require("./utilities"), exports);
|
|
21
|
+
__exportStar(require("./app-middlewares"), exports);
|
|
22
|
+
__exportStar(require("./interfaces"), exports);
|
|
21
23
|
var env_1 = require("./env");
|
|
22
24
|
Object.defineProperty(exports, "setEnvs", { enumerable: true, get: function () { return env_1.setEnvs; } });
|