v0.7.4-rc1 (#3099)

* fix(openIdStrategy): return user object on new user creation

*  v0.7.4-rc1
This commit is contained in:
Danny Avila 2024-06-17 12:47:28 -04:00 committed by GitHub
parent dad25bd297
commit 302b28fc9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 10 additions and 7 deletions

View file

@ -56,10 +56,11 @@ const updateUser = async function (userId, updateData) {
* Creates a new user, optionally with a TTL of 1 week.
* @param {MongoUser} data - The user data to be created, must contain user_id.
* @param {boolean} [disableTTL=true] - Whether to disable the TTL. Defaults to `true`.
* @param {boolean} [returnUser=false] - Whether to disable the TTL. Defaults to `true`.
* @returns {Promise<ObjectId>} A promise that resolves to the created user document ID.
* @throws {Error} If a user with the same user_id already exists.
*/
const createUser = async (data, disableTTL = true) => {
const createUser = async (data, disableTTL = true, returnUser = false) => {
const userData = {
...data,
expiresAt: disableTTL ? null : new Date(Date.now() + 604800 * 1000), // 1 week in milliseconds
@ -71,6 +72,9 @@ const createUser = async (data, disableTTL = true) => {
try {
const user = await User.create(userData);
if (returnUser) {
return user.toObject();
}
return user._id;
} catch (error) {
if (error.code === 11000) {

View file

@ -164,8 +164,7 @@ async function setupOpenId() {
emailVerified: userinfo.email_verified || false,
name: fullName,
};
const userId = await createUser();
user._id = userId;
user = await createUser(user, true, true);
} else {
user.provider = 'openid';
user.openidId = userinfo.sub;

2
package-lock.json generated
View file

@ -29325,7 +29325,7 @@
},
"packages/data-provider": {
"name": "librechat-data-provider",
"version": "0.6.7",
"version": "0.6.8",
"license": "ISC",
"dependencies": {
"@types/js-yaml": "^4.0.9",

View file

@ -1,6 +1,6 @@
{
"name": "LibreChat",
"version": "0.7.3",
"version": "0.7.4-rc1",
"description": "",
"workspaces": [
"api",

View file

@ -1,6 +1,6 @@
{
"name": "librechat-data-provider",
"version": "0.6.7",
"version": "0.6.8",
"description": "data services for librechat apps",
"main": "dist/index.js",
"module": "dist/index.es.js",

View file

@ -786,7 +786,7 @@ export enum SettingsTabValues {
/** Enum for app-wide constants */
export enum Constants {
/** Key for the app's version. */
VERSION = 'v0.7.3',
VERSION = 'v0.7.4-rc1',
/** Key for the Custom Config's version (librechat.yaml). */
CONFIG_VERSION = '1.1.4',
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */