🔐 feat: Group schema support, refine user schema security, and improve types (#9070)

* feat: Add groupSchema and update userSchema to hide sensitive fields

* chore: Bump version of @librechat/data-schemas to 0.0.16
This commit is contained in:
Marco Beretta 2025-08-15 04:58:54 +02:00 committed by GitHub
parent d711fc7852
commit c78fd0fc83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 10 deletions

2
package-lock.json generated
View file

@ -51874,7 +51874,7 @@
}, },
"packages/data-schemas": { "packages/data-schemas": {
"name": "@librechat/data-schemas", "name": "@librechat/data-schemas",
"version": "0.0.15", "version": "0.0.16",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-alias": "^5.1.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "@librechat/data-schemas", "name": "@librechat/data-schemas",
"version": "0.0.15", "version": "0.0.16",
"description": "Mongoose schemas and models for LibreChat", "description": "Mongoose schemas and models for LibreChat",
"type": "module", "type": "module",
"main": "dist/index.cjs", "main": "dist/index.cjs",

View file

@ -23,3 +23,4 @@ export { default as toolCallSchema } from './toolCall';
export { default as transactionSchema } from './transaction'; export { default as transactionSchema } from './transaction';
export { default as userSchema } from './user'; export { default as userSchema } from './user';
export { default as memorySchema } from './memory'; export { default as memorySchema } from './memory';
export { default as groupSchema } from './group';

View file

@ -51,6 +51,7 @@ const userSchema = new Schema<IUser>(
trim: true, trim: true,
minlength: 8, minlength: 8,
maxlength: 128, maxlength: 128,
select: false,
}, },
avatar: { avatar: {
type: String, type: String,
@ -114,6 +115,7 @@ const userSchema = new Schema<IUser>(
}, },
totpSecret: { totpSecret: {
type: String, type: String,
select: false,
}, },
backupCodes: { backupCodes: {
type: [BackupCodeSchema], type: [BackupCodeSchema],

View file

@ -1,6 +1,6 @@
import type { Document, Types } from 'mongoose'; import { Document } from 'mongoose';
export type Group = { export interface IGroup extends Document {
/** The name of the group */ /** The name of the group */
name: string; name: string;
/** Optional description of the group */ /** Optional description of the group */
@ -15,9 +15,7 @@ export type Group = {
source: 'local' | 'entra'; source: 'local' | 'entra';
/** External ID (e.g., Entra ID) - required for non-local sources */ /** External ID (e.g., Entra ID) - required for non-local sources */
idOnTheSource?: string; idOnTheSource?: string;
}; /** Timestamps */
createdAt?: Date;
export type IGroup = Group & updatedAt?: Date;
Document & { }
_id: Types.ObjectId;
};