@accounts/server
Advanced tools
Comparing version 1.0.0-alpha-20231109134411-9db5d55b to 1.0.0-alpha-20231110150116-1eb474da
@@ -40,2 +40,9 @@ "use strict"; | ||
let AccountsServer = class AccountsServer { | ||
services; | ||
db; | ||
context; | ||
options; | ||
hooks; | ||
micro; | ||
dbSessions; | ||
constructor(options, services, db, dbSessions) { | ||
@@ -46,3 +53,3 @@ this.services = services; | ||
this.micro = this.options.micro; | ||
this.dbSessions = dbSessions !== null && dbSessions !== void 0 ? dbSessions : db; | ||
this.dbSessions = dbSessions ?? db; | ||
if (this.options.tokenSecret === defaultOptions.tokenSecret) { | ||
@@ -374,3 +381,2 @@ console.log(` | ||
async resumeSession(accessToken) { | ||
var _a, _b; | ||
try { | ||
@@ -409,3 +415,3 @@ if (!(0, validation_1.isString)(accessToken)) { | ||
} | ||
await ((_b = (_a = this.options).resumeSessionValidator) === null || _b === void 0 ? void 0 : _b.call(_a, user, session)); | ||
await this.options.resumeSessionValidator?.(user, session); | ||
await this.hooks.emit(server_hooks_1.ServerHooks.ResumeSessionSuccess, { user, accessToken, session }); | ||
@@ -412,0 +418,0 @@ return this.sanitizeUser(user); |
@@ -5,2 +5,3 @@ "use strict"; | ||
class AccountsJsError extends Error { | ||
code; | ||
constructor(message, code) { | ||
@@ -7,0 +8,0 @@ super(message); |
@@ -5,3 +5,2 @@ "use strict"; | ||
function getFirstUserEmail(user, address) { | ||
var _a, _b; | ||
// Pick the first email if we weren't passed an email | ||
@@ -16,3 +15,3 @@ if (!address) { | ||
} | ||
const validAddresses = (_b = (_a = user.emails) === null || _a === void 0 ? void 0 : _a.map((email) => email.address)) !== null && _b !== void 0 ? _b : []; | ||
const validAddresses = user.emails?.map((email) => email.address) ?? []; | ||
const addressIsValid = validAddresses.includes(address); | ||
@@ -19,0 +18,0 @@ if (!addressIsValid) { |
{ | ||
"name": "@accounts/server", | ||
"version": "1.0.0-alpha-20231109134411-9db5d55b", | ||
"version": "1.0.0-alpha-20231110150116-1eb474da", | ||
"description": "Fullstack authentication and accounts-management", | ||
@@ -51,3 +51,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@accounts/types": "1.0.0-alpha-20231109134411-9db5d55b", | ||
"@accounts/types": "1.0.0-alpha-20231110150116-1eb474da", | ||
"@types/jsonwebtoken": "9.0.5", | ||
@@ -54,0 +54,0 @@ "emittery": "0.13.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
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
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
2368
119879
+ Added@accounts/types@1.0.0-alpha-20231110150116-1eb474da(transitive)
- Removed@accounts/types@1.0.0-alpha-20231109134411-9db5d55b(transitive)