@accounts/server
Advanced tools
Comparing version 0.0.4-alpha.9b2e36fb to 0.0.4-alpha.c26460cb
@@ -49,2 +49,10 @@ 'use strict'; | ||
key: 'config', | ||
/** | ||
* @description Configure AccountsServer. | ||
* @param {Object} options - Options for AccountsServer. | ||
* @param {Object} db - DBInterface for AccountsServer. | ||
* @returns {Object} - Return the options. | ||
*/ | ||
value: function config(options, db) { | ||
@@ -63,2 +71,8 @@ this._options = _extends({}, _config3.default, options); | ||
} | ||
/** | ||
* @description Return the AccountsServer options. | ||
* @returns {Object} - Return the options. | ||
*/ | ||
}, { | ||
@@ -70,2 +84,10 @@ key: 'options', | ||
/** | ||
* @description Login the user with his password. | ||
* @param {Object} user - User to login. | ||
* @param {string} password - Password of user to login. | ||
* @param {string} ip - User ip. | ||
* @param {string} userAgent - User user agent. | ||
* @returns {Promise<Object>} - LoginReturnType. | ||
*/ | ||
// eslint-disable-next-line max-len | ||
@@ -301,2 +323,9 @@ | ||
}() | ||
/** | ||
* @description Create a new user. | ||
* @param {Object} user - The user object. | ||
* @returns {Promise<string>} - Return the id of user created. | ||
*/ | ||
}, { | ||
@@ -393,2 +422,10 @@ key: 'createUser', | ||
/** | ||
* @description Refresh a user token. | ||
* @param {string} accessToken - User access token. | ||
* @param {string} refreshToken - User refresh token. | ||
* @param {string} ip - User ip. | ||
* @param {string} userAgent - User user agent. | ||
* @returns {Promise<Object>} - LoginReturnType. | ||
*/ | ||
// eslint-disable-next-line max-len | ||
@@ -492,2 +529,9 @@ | ||
}() | ||
/** | ||
* @description Refresh a user token. | ||
* @param {string} sessionId - User session id. | ||
* @returns {Promise<Object>} - Return a new accessToken and refreshToken. | ||
*/ | ||
}, { | ||
@@ -513,2 +557,9 @@ key: 'createTokens', | ||
} | ||
/** | ||
* @description Logout a user and invalidate his session. | ||
* @param {string} accessToken - User access token. | ||
* @returns {Promise<void>} - Return a promise. | ||
*/ | ||
}, { | ||
@@ -705,2 +756,9 @@ key: 'logout', | ||
}() | ||
/** | ||
* @description Find a user by one of his emails. | ||
* @param {string} email - User email. | ||
* @returns {Promise<Object>} - Return a user or null if not found. | ||
*/ | ||
}, { | ||
@@ -711,2 +769,9 @@ key: 'findUserByEmail', | ||
} | ||
/** | ||
* @description Find a user by his username. | ||
* @param {string} username - User username. | ||
* @returns {Promise<Object>} - Return a user or null if not found. | ||
*/ | ||
}, { | ||
@@ -717,2 +782,9 @@ key: 'findUserByUsername', | ||
} | ||
/** | ||
* @description Find a user by his id. | ||
* @param {string} userId - User id. | ||
* @returns {Promise<Object>} - Return a user or null if not found. | ||
*/ | ||
}, { | ||
@@ -723,2 +795,13 @@ key: 'findUserById', | ||
} | ||
/** | ||
* @description Add an email address for a user. | ||
* Use this instead of directly updating the database. | ||
* @param {string} userId - User id. | ||
* @param {string} newEmail - A new email address for the user. | ||
* @param {boolean} [verified] - Whether the new email address should be marked as verified. | ||
* Defaults to false. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -729,2 +812,11 @@ key: 'addEmail', | ||
} | ||
/** | ||
* @description Remove an email address for a user. | ||
* Use this instead of directly updating the database. | ||
* @param {string} userId - User id. | ||
* @param {string} email - The email address to remove. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -735,2 +827,9 @@ key: 'removeEmail', | ||
} | ||
/** | ||
* @description Marks the user's email address as verified. | ||
* @param {string} token - The token retrieved from the verification URL. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -802,2 +901,10 @@ key: 'verifyEmail', | ||
}() | ||
/** | ||
* @description Reset the password for a user using a token received in email. | ||
* @param {string} token - The token retrieved from the reset password URL. | ||
* @param {string} newPassword - A new password for the user. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -873,2 +980,10 @@ key: 'resetPassword', | ||
}() | ||
/** | ||
* @description Change the password for a user. | ||
* @param {string} userId - User id. | ||
* @param {string} newPassword - A new password for the user. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -879,2 +994,10 @@ key: 'setPassword', | ||
} | ||
/** | ||
* @description Change the profile for a user. | ||
* @param {string} userId - User id. | ||
* @param {Object} profile - The new user profile. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -920,2 +1043,11 @@ key: 'setProfile', | ||
}() | ||
/** | ||
* @description Update the profile for a user, | ||
* the new profile will be added to the existing one. | ||
* @param {string} userId - User id. | ||
* @param {Object} profile - User profile to add. | ||
* @returns {Promise<Object>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -965,2 +1097,12 @@ key: 'updateProfile', | ||
}() | ||
/** | ||
* @description Send an email with a link the user can use verify their email address. | ||
* @param {string} userId - The id of the user to send email to. | ||
* @param {string} [address] - Which address of the user's to send the email to. | ||
* This address must be in the user's emails list. | ||
* Defaults to the first unverified email in the list. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -1038,2 +1180,12 @@ key: 'sendVerificationEmail', | ||
}() | ||
/** | ||
* @description Send an email with a link the user can use to reset their password. | ||
* @param {string} userId - The id of the user to send email to. | ||
* @param {string} [address] - Which address of the user's to send the email to. | ||
* This address must be in the user's emails list. | ||
* Defaults to the first email in the list. | ||
* @returns {Promise<void>} - Return a Promise. | ||
*/ | ||
}, { | ||
@@ -1040,0 +1192,0 @@ key: 'sendResetPasswordEmail', |
{ | ||
"name": "@accounts/server", | ||
"version": "0.0.4-alpha.9b2e36fb", | ||
"version": "0.0.4-alpha.c26460cb", | ||
"description": "Fullstack authentication and accounts-management", | ||
@@ -46,3 +46,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@accounts/common": "^0.0.4-alpha.9b2e36fb", | ||
"@accounts/common": "^0.0.4-alpha.c26460cb", | ||
"bcryptjs": "^2.4.0", | ||
@@ -49,0 +49,0 @@ "crypto": "^0.0.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
333002
4068