New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mailtrap

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailtrap - npm Package Compare versions

Comparing version 3.2.0-beta.0 to 3.2.0-beta.1

dist/adapters/attachement.d.ts

15

dist/index.d.ts

@@ -1,11 +0,4 @@

import { Mail, SendResponse } from "./lib/types";
declare type MailtrapClientConfig = {
endpoint?: string;
token: string;
};
export declare class MailtrapClient {
private axios;
constructor({ endpoint, token }: MailtrapClientConfig);
send(mail: Mail): Promise<SendResponse>;
}
export * from "./lib/types";
import MailtrapClient from "./lib/mailtrap-client";
import MailtrapTransport from "./lib/transport";
export * from "./types/mailtrap";
export { MailtrapClient, MailtrapTransport };

@@ -13,53 +13,5 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -69,57 +21,7 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.MailtrapClient = void 0;
var http = __importStar(require("http"));
var https = __importStar(require("https"));
var axios_1 = __importStar(require("axios"));
var encodeMailBuffers_1 = __importDefault(require("./lib/encodeMailBuffers"));
var MAILTRAP_ENDPOINT = "https://send.api.mailtrap.io";
var MailtrapClient = /** @class */ (function () {
function MailtrapClient(_a) {
var _b = _a.endpoint, endpoint = _b === void 0 ? MAILTRAP_ENDPOINT : _b, token = _a.token;
this.axios = axios_1.default.create({
httpAgent: new http.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true }),
baseURL: endpoint,
headers: {
Authorization: "Bearer ".concat(token),
Connection: "keep-alive",
},
maxRedirects: 0,
timeout: 10000,
});
}
MailtrapClient.prototype.send = function (mail) {
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var preparedMail, axiosResponse, err_1, unwrappedError;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
preparedMail = (0, encodeMailBuffers_1.default)(mail);
_c.label = 1;
case 1:
_c.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.axios.post("/api/send", preparedMail)];
case 2:
axiosResponse = _c.sent();
return [2 /*return*/, axiosResponse.data];
case 3:
err_1 = _c.sent();
if (err_1 instanceof axios_1.AxiosError) {
unwrappedError = (_b = (_a = err_1.response) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : {
success: false,
error: ["connection failed"],
};
throw unwrappedError;
}
// should not happen, but otherwise rethrow error as is
throw err_1;
case 4: return [2 /*return*/];
}
});
});
};
return MailtrapClient;
}());
exports.MailtrapClient = MailtrapClient;
__exportStar(require("./lib/types"), exports);
exports.MailtrapTransport = exports.MailtrapClient = void 0;
const mailtrap_client_1 = __importDefault(require("./lib/mailtrap-client"));
exports.MailtrapClient = mailtrap_client_1.default;
const transport_1 = __importDefault(require("./lib/transport"));
exports.MailtrapTransport = transport_1.default;
__exportStar(require("./types/mailtrap"), exports);
{
"name": "mailtrap",
"description": "Official mailtrap.io API client",
"version": "3.2.0-beta.0",
"version": "3.2.0-beta.1",
"author": "Railsware Products Studio LLC",

@@ -6,0 +6,0 @@ "dependencies": {

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