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

@accounts/server

Package Overview
Dependencies
Maintainers
5
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accounts/server - npm Package Compare versions

Comparing version 0.1.0-alpha.42868044 to 0.1.0-alpha.04203cca

9

lib/accounts-server.d.ts
/// <reference types="@types/node" />
import { EventEmitter } from 'events';
import { UserObjectType, LoginReturnType, TokensType, SessionType, ImpersonateReturnType, HookListener } from '@accounts/common';
import { EmailConnector, EmailTemplateType } from './email';
import { AccountsServerOptions, ConnectionInformationsType } from './types';
import { EmailTemplateType } from './email';
import { AccountsServerOptions, ConnectionInformationsType, AuthService } from './types';
export interface TokenRecord {

@@ -29,3 +29,2 @@ token: string;

options: AccountsServerOptions;
email: EmailConnector;
private services;

@@ -35,3 +34,5 @@ private db;

constructor(options: AccountsServerOptions, services: any);
getServices(): any;
getServices(): {
[key: string]: AuthService;
};
getOptions(): AccountsServerOptions;

@@ -38,0 +39,0 @@ onLoginSuccess(callback: HookListener): RemoveListnerHandle;

@@ -67,2 +67,3 @@ "use strict";

userObjectSanitizer: function (user) { return user; },
sendMail: email_1.sendMail,
};

@@ -95,5 +96,2 @@ exports.ServerHooks = {

}
this.email = this.options.sendMail
? { sendMail: this.options.sendMail }
: new email_1.default(this.options.email);
this.hooks = new events_1.EventEmitter();

@@ -100,0 +98,0 @@ }

import { AccountsCommonConfiguration, SessionType, UserObjectType, CreateUserType, PasswordSignupFields } from '@accounts/common';
import { EmailTemplateType } from './email';
import { EmailTemplatesType, EmailTemplateType } from './email';
export declare type ResumeSessionValidator = (user: UserObjectType, session: SessionType) => Promise<any>;

@@ -23,2 +23,3 @@ export declare type TokenExpiration = string;

resumeSessionValidator?: ResumeSessionValidator;
emailTemplates?: EmailTemplatesType;
prepareMail?: PrepareMailFunction;

@@ -25,0 +26,0 @@ sendMail?: SendMailFunction;

@@ -28,10 +28,3 @@ import { UserObjectType } from '@accounts/common';

};
export interface EmailConnector {
sendMail(mail: object): Promise<object>;
}
declare class Email {
private server;
constructor(emailConfig: object);
sendMail(mail: object): Promise<object>;
}
export default Email;
export declare type SendMailType = (mail: object) => Promise<void>;
export declare const sendMail: (mail: object) => Promise<void>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
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) : new P(function (resolve) { resolve(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 = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, 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 _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var email = require("emailjs");
exports.emailTemplates = {

@@ -25,28 +60,9 @@ from: 'js-accounts <no-reply@js-accounts.com>',

};
var Email = (function () {
function Email(emailConfig) {
if (emailConfig) {
this.server = email.server.connect(emailConfig);
}
}
Email.prototype.sendMail = function (mail) {
var _this = this;
return new Promise(function (resolve, reject) {
if (!_this.server) {
console.warn('No configuration for email, you must set an email configuration');
console.log(mail);
resolve();
return;
}
_this.server.send(mail, function (err, message) {
if (err) {
return reject(err);
}
return resolve(message);
});
});
};
return Email;
}());
exports.default = Email;
exports.sendMail = function (mail) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
console.warn('No configuration for email, you must set an email configuration');
console.log(mail);
return [2];
});
}); };
//# sourceMappingURL=email.js.map
import { UserObjectType, CreateUserType, SessionType } from '@accounts/common';
import { EmailTemplatesType, EmailTemplateType } from './email';
import { EmailTemplatesType, EmailTemplateType, SendMailType } from './email';
import { AccountsServer } from './accounts-server';

@@ -16,3 +16,2 @@ export interface AuthService {

};
export declare type SendMailFunction = (emailConfig: EmailType | object) => Promise<object>;
export interface AccountsServerOptions {

@@ -36,3 +35,3 @@ db: DBInterface;

prepareMail?: PrepareMailFunction;
sendMail?: SendMailFunction;
sendMail?: SendMailType;
email?: object;

@@ -39,0 +38,0 @@ }

{
"name": "@accounts/server",
"version": "0.1.0-alpha.42868044",
"version": "0.1.0-alpha.04203cca",
"description": "Fullstack authentication and accounts-management",

@@ -15,3 +15,3 @@ "main": "lib/index.js",

"compile": "tsc",
"prepublish": "npm run compile",
"prepublishOnly": "npm run compile",
"test": "npm run testonly",

@@ -52,7 +52,6 @@ "test-ci": "npm lint && npm coverage",

"dependencies": {
"@accounts/common": "^0.1.0-alpha.42868044",
"@accounts/common": "^0.1.0-alpha.04203cca",
"babel-polyfill": "^6.23.0",
"bcryptjs": "^2.4.0",
"crypto": "^0.0.3",
"emailjs": "^1.0.8",
"jsonwebtoken": "^7.2.1",

@@ -65,4 +64,5 @@ "jwt-decode": "^2.1.0",

"@types/jwt-decode": "^2.2.1",
"coveralls": "^2.11.14"
"coveralls": "^2.11.14",
"rimraf": "^2.6.2"
}
}

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