@librechat/data-schemas 0.0.21 → 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.cjs +21 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +21 -6
- package/dist/index.es.js.map +1 -1
- package/dist/types/methods/token.spec.d.ts +1 -0
- package/package.json +1 -2
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: {
|
|
@@ -3052,13 +3053,27 @@ function createTokenMethods(mongoose) {
|
|
|
3052
3053
|
async function deleteTokens(query) {
|
|
3053
3054
|
try {
|
|
3054
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
|
+
}
|
|
3055
3075
|
return await Token.deleteMany({
|
|
3056
|
-
$or:
|
|
3057
|
-
{ userId: query.userId },
|
|
3058
|
-
{ token: query.token },
|
|
3059
|
-
{ email: query.email },
|
|
3060
|
-
{ identifier: query.identifier },
|
|
3061
|
-
],
|
|
3076
|
+
$or: conditions,
|
|
3062
3077
|
});
|
|
3063
3078
|
}
|
|
3064
3079
|
catch (error) {
|