@librechat/data-schemas 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -225,6 +225,7 @@ const agentCategorySchema = new Schema({
225
225
  timestamps: true,
226
226
  });
227
227
  agentCategorySchema.index({ isActive: 1, order: 1 });
228
+ agentCategorySchema.index({ order: 1, label: 1 });
228
229
 
229
230
  const assistantSchema = new Schema({
230
231
  user: {
@@ -503,6 +504,9 @@ const conversationPreset = {
503
504
  disableStreaming: {
504
505
  type: Boolean,
505
506
  },
507
+ fileTokenLimit: {
508
+ type: Number,
509
+ },
506
510
  /** Reasoning models only */
507
511
  reasoning_effort: {
508
512
  type: String,
@@ -3049,13 +3053,27 @@ function createTokenMethods(mongoose) {
3049
3053
  async function deleteTokens(query) {
3050
3054
  try {
3051
3055
  const Token = mongoose.models.Token;
3056
+ const conditions = [];
3057
+ if (query.userId !== undefined) {
3058
+ conditions.push({ userId: query.userId });
3059
+ }
3060
+ if (query.token !== undefined) {
3061
+ conditions.push({ token: query.token });
3062
+ }
3063
+ if (query.email !== undefined) {
3064
+ conditions.push({ email: query.email });
3065
+ }
3066
+ if (query.identifier !== undefined) {
3067
+ conditions.push({ identifier: query.identifier });
3068
+ }
3069
+ /**
3070
+ * If no conditions are specified, throw an error to prevent accidental deletion of all tokens
3071
+ */
3072
+ if (conditions.length === 0) {
3073
+ throw new Error('At least one query parameter must be provided');
3074
+ }
3052
3075
  return await Token.deleteMany({
3053
- $or: [
3054
- { userId: query.userId },
3055
- { token: query.token },
3056
- { email: query.email },
3057
- { identifier: query.identifier },
3058
- ],
3076
+ $or: conditions,
3059
3077
  });
3060
3078
  }
3061
3079
  catch (error) {