@accounts/common
Advanced tools
Comparing version 0.0.3 to 0.0.4-alpha.98931215
@@ -12,3 +12,6 @@ 'use strict'; | ||
exports.default = { | ||
siteUrl: 'http://localhost:3000', | ||
sendVerificationEmail: false, | ||
sendEnrollmentEmail: false, | ||
sendWelcomeEmail: false, | ||
forbidClientAccountCreation: false, | ||
@@ -15,0 +18,0 @@ restrictCreationByEmailDomain: null, |
@@ -6,9 +6,79 @@ 'use strict'; | ||
}); | ||
exports.AccountsError = undefined; | ||
var _apolloErrors = require('apollo-errors'); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var AccountsError = (0, _apolloErrors.createError)('AccountsError', {}); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _extendableBuiltin(cls) { | ||
function ExtendableBuiltin() { | ||
var instance = Reflect.construct(cls, Array.from(arguments)); | ||
Object.setPrototypeOf(instance, Object.getPrototypeOf(this)); | ||
return instance; | ||
} | ||
ExtendableBuiltin.prototype = Object.create(cls.prototype, { | ||
constructor: { | ||
value: cls, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (Object.setPrototypeOf) { | ||
Object.setPrototypeOf(ExtendableBuiltin, cls); | ||
} else { | ||
ExtendableBuiltin.__proto__ = cls; | ||
} | ||
return ExtendableBuiltin; | ||
} | ||
// eslint-disable-next-line import/prefer-default-export | ||
exports.AccountsError = AccountsError; | ||
var AccountsError = exports.AccountsError = function (_extendableBuiltin2) { | ||
_inherits(AccountsError, _extendableBuiltin2); | ||
function AccountsError(message, loginInfo, errorCode) { | ||
_classCallCheck(this, AccountsError); | ||
var _this = _possibleConstructorReturn(this, (AccountsError.__proto__ || Object.getPrototypeOf(AccountsError)).call(this, message)); | ||
_this.epochTime = Date.now(); | ||
if (loginInfo) { | ||
_this.loginInfo = loginInfo; | ||
} | ||
if (errorCode) { | ||
_this.errorCode = errorCode; | ||
} | ||
return _this; | ||
} | ||
_createClass(AccountsError, [{ | ||
key: 'toString', | ||
value: function toString() { | ||
try { | ||
return JSON.stringify({ | ||
message: this.message, | ||
loginInfo: this.loginInfo, | ||
errorCode: this.errorCode, | ||
epochTime: this.epochTime | ||
}); | ||
} catch (e) { | ||
return 'Error was thrown but could not be serialized. ' + 'Make sure there is no circular references parameters passed to constructor'; | ||
} | ||
} | ||
}, { | ||
key: 'serialize', | ||
value: function serialize() { | ||
return this.toString(); | ||
} | ||
}]); | ||
return AccountsError; | ||
}(_extendableBuiltin(Error)); |
@@ -34,2 +34,3 @@ 'use strict'; | ||
exports.toUsernameAndEmail = _toUsernameAndEmail2.default; | ||
exports.config = _config2.default; /* eslint-disable import/no-named-as-default */ | ||
exports.config = _config2.default; | ||
/* eslint-disable import/no-named-as-default */ |
@@ -13,8 +13,7 @@ 'use strict'; | ||
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | ||
// $FlowFixMe | ||
return re.test(email); | ||
return email && re.test(email); | ||
}; | ||
var validateEmail = exports.validateEmail = function validateEmail(email) { | ||
var isValid = !(0, _lodash.isEmpty)((0, _lodash.trim)(email)); | ||
var isValid = !(0, _lodash.isEmpty)((0, _lodash.trim)(email || '')); | ||
return isValid; | ||
@@ -29,4 +28,4 @@ }; | ||
var validateUsername = exports.validateUsername = function validateUsername(username) { | ||
var isValid = !(0, _lodash.isEmpty)((0, _lodash.trim)(username)); | ||
var isValid = !(0, _lodash.isEmpty)((0, _lodash.trim)(username || '')); | ||
return isValid; | ||
}; |
{ | ||
"name": "@accounts/common", | ||
"version": "0.0.3", | ||
"version": "0.0.4-alpha.98931215", | ||
"description": "Fullstack authentication and accounts-management", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"compile": "babel ./src --out-dir ./lib", | ||
"flow:check": "flow check", | ||
"postcompile": "npm run flow:prepublish", | ||
"prepublish": "npm run compile", | ||
@@ -18,2 +18,5 @@ "test": "npm run testonly", | ||
"testonly": "jest", | ||
"flow:check": "flow check", | ||
"flow:gen": "flow gen-flow-files ./src/index.js > ./lib/index.js.flow", | ||
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib/g\" | sed \"s/js/js\\.flow/g\"`; done", | ||
"coverage": "npm run testonly -- --coverage", | ||
@@ -24,3 +27,6 @@ "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" | ||
"testEnvironment": "node", | ||
"testRegex": "(/.*.(test|spec)).(js|jsx)$" | ||
"testRegex": "(/.*.(test|spec)).(js|jsx)$", | ||
"testPathDirs": [ | ||
"src" | ||
] | ||
}, | ||
@@ -49,2 +55,3 @@ "repository": { | ||
"babel-plugin-transform-async-to-generator": "^6.16.0", | ||
"babel-plugin-transform-builtin-extend": "^1.1.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.21.0", | ||
@@ -56,3 +63,3 @@ "babel-plugin-transform-object-rest-spread": "^6.16.0", | ||
"coveralls": "^2.11.14", | ||
"flow-bin": "^0.37.0", | ||
"flow-bin": "^0.39.0", | ||
"jest": "^18.0.0", | ||
@@ -65,5 +72,4 @@ "localstorage-polyfill": "^1.0.1", | ||
"dependencies": { | ||
"apollo-errors": "^1.2.1", | ||
"lodash": "^4.16.4" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114762
1
26
2541
18
1
- Removedapollo-errors@^1.2.1
- Removedapollo-errors@1.9.0(transitive)
- Removedassert@1.5.1(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedextendable-error@0.1.7(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinherits@2.0.3(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.5(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedutil@0.10.4(transitive)