Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ikoabo/notifications

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ikoabo/notifications - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

58

lib/controllers/mails.controller.js

@@ -8,4 +8,4 @@ "use strict";

const core_1 = require("@ikoabo/core");
const request_1 = __importDefault(require("request"));
const errors_enum_1 = require("../models/errors.enum");
const axios_1 = __importDefault(require("axios"));
class Mails {

@@ -28,3 +28,3 @@ constructor() {

reject({
boError: errors_enum_1.NOTIFICATION_ERRORS.INVALID_NOTIFICATIONS_SERVER,
boError: errors_enum_1.NOTIFICATION_ERRORS.INVALID_MAIL_SERVER,
boStatus: core_1.HTTP_STATUS.HTTP_4XX_NOT_ACCEPTABLE

@@ -34,25 +34,21 @@ });

}
const opts = {
auth: { bearer: this._token },
json: {
project: project,
mail: mail,
subject: subject,
lang: lang,
to: to,
cc: cc,
bcc: bcc,
data: data
axios_1.default
.post(`${this._notificationsService}/v1/mails/send`, {
project: project,
mail: mail,
subject: subject,
lang: lang,
to: to,
cc: cc,
bcc: bcc,
data: data
}, {
headers: {
Authorization: `Bearer ${this._token}`
}
};
request_1.default.post(`${this._notificationsService}/v1/mails/send`, opts, (error, response, body) => {
if (error) {
reject({
boError: errors_enum_1.NOTIFICATION_ERRORS.UNKNOWN_NOTIFICATIONS_SERVER_ERROR,
boStatus: core_1.HTTP_STATUS.HTTP_4XX_FORBIDDEN
});
return;
}
})
.then((response) => {
try {
body = JSON.parse(body);
JSON.parse(response.data);
resolve();
}

@@ -66,7 +62,15 @@ catch (_a) {

}
if (body["error"]) {
reject({ boStatus: response.statusCode, boError: body["error"], boData: body["data"] });
return;
})
.catch((err) => {
if (core_1.Objects.get(err, "response.data.error", null)) {
return reject({
boStatus: err.response.status,
boError: core_1.Objects.get(err, "response.data.error", null),
boData: core_1.Objects.get(err, "response.data.data", null)
});
}
resolve();
reject({
boError: errors_enum_1.NOTIFICATION_ERRORS.UNKNOWN_NOTIFICATIONS_SERVER_ERROR,
boStatus: core_1.HTTP_STATUS.HTTP_4XX_FORBIDDEN
});
});

@@ -73,0 +77,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NOTIFICATION_ERRORS = exports.MailCtrl = void 0;
var mails_controller_1 = require("./controllers/mails.controller");

@@ -4,0 +5,0 @@ Object.defineProperty(exports, "MailCtrl", { enumerable: true, get: function () { return mails_controller_1.MailCtrl; } });

export declare enum NOTIFICATION_ERRORS {
INVALID_TEMPLATE = 1501,
INVALID_SETTINGS = 1502,
INVALID_NOTIFICATIONS_SERVER = 1503,
UNKNOWN_NOTIFICATIONS_SERVER_ERROR = 1504
UNKNOWN_NOTIFICATIONS_SERVER_ERROR = 1500,
INVALID_MAIL_TEMPLATE = 1501,
INVALID_MAIL_SETTINGS = 1502,
INVALID_MAIL_SERVER = 1503,
INVALID_PUSH_NOTIFICATION = 1525,
INVALID_TELEGRAM_SETTINGS = 1550,
INVALID_TELEGRAM_AUTHENTICATION = 1551
}

@@ -6,7 +6,10 @@ "use strict";

(function (NOTIFICATION_ERRORS) {
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_TEMPLATE"] = 1501] = "INVALID_TEMPLATE";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_SETTINGS"] = 1502] = "INVALID_SETTINGS";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_NOTIFICATIONS_SERVER"] = 1503] = "INVALID_NOTIFICATIONS_SERVER";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["UNKNOWN_NOTIFICATIONS_SERVER_ERROR"] = 1504] = "UNKNOWN_NOTIFICATIONS_SERVER_ERROR";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["UNKNOWN_NOTIFICATIONS_SERVER_ERROR"] = 1500] = "UNKNOWN_NOTIFICATIONS_SERVER_ERROR";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_MAIL_TEMPLATE"] = 1501] = "INVALID_MAIL_TEMPLATE";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_MAIL_SETTINGS"] = 1502] = "INVALID_MAIL_SETTINGS";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_MAIL_SERVER"] = 1503] = "INVALID_MAIL_SERVER";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_PUSH_NOTIFICATION"] = 1525] = "INVALID_PUSH_NOTIFICATION";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_TELEGRAM_SETTINGS"] = 1550] = "INVALID_TELEGRAM_SETTINGS";
NOTIFICATION_ERRORS[NOTIFICATION_ERRORS["INVALID_TELEGRAM_AUTHENTICATION"] = 1551] = "INVALID_TELEGRAM_AUTHENTICATION";
})(NOTIFICATION_ERRORS = exports.NOTIFICATION_ERRORS || (exports.NOTIFICATION_ERRORS = {}));
//# sourceMappingURL=errors.enum.js.map
{
"name": "@ikoabo/notifications",
"version": "1.0.2",
"version": "1.0.3",
"description": "IKOA Business Opportunity Notifications API",

@@ -8,9 +8,10 @@ "main": "lib/index.js",

"engines": {
"npm": ">=12.16.1"
"node": ">=12.0.0",
"npm": ">=6.0.0"
},
"scripts": {
"prepare": "install-peers",
"build": "tsc",
"deploy": "tsc && npm run publish-npm && npm run publish-nexus",
"deploy": "tsc && npm run publish-npm",
"publish-npm": "npm publish --registry='https://registry.npmjs.org/' --access public",
"publish-nexus": "npm publish --registry='https://nxs.ikoabo.com/repository/npm-local/'",
"lint": "tsc --noEmit && eslint '*/**/*.ts' --fix",

@@ -41,22 +42,24 @@ "test": "mocha --require ts-node/register tests/*.ts",

"dependencies": {
"@ikoabo/core": "^1.0.5",
"request": "^2.88.2"
"@ikoabo/core": "^1.1.2"
},
"devDependencies": {
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"@types/request": "^2.48.5",
"@typescript-eslint/eslint-plugin": "^3.9.0",
"@typescript-eslint/parser": "^3.9.0",
"chai": "^4.2.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"mocha": "^7.1.1",
"@types/chai": "^4.2.18",
"@types/mocha": "^8.2.2",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"chai": "^4.3.4",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-prettier": "^3.4.0",
"install-peers-cli": "^2.2.0",
"mocha": "^8.4.0",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"ts-node": "^8.10.2",
"typescript": "^3.8.3"
"prettier": "^2.3.0",
"ts-node": "^10.0.0",
"typescript": "^4.3.2"
},
"peerDependencies": {
"axios": "0.21.1"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc