@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.cjs
CHANGED
|
@@ -227,6 +227,7 @@ const agentCategorySchema = new mongoose.Schema({
|
|
|
227
227
|
timestamps: true,
|
|
228
228
|
});
|
|
229
229
|
agentCategorySchema.index({ isActive: 1, order: 1 });
|
|
230
|
+
agentCategorySchema.index({ order: 1, label: 1 });
|
|
230
231
|
|
|
231
232
|
const assistantSchema = new mongoose.Schema({
|
|
232
233
|
user: {
|
|
@@ -3054,13 +3055,27 @@ function createTokenMethods(mongoose) {
|
|
|
3054
3055
|
async function deleteTokens(query) {
|
|
3055
3056
|
try {
|
|
3056
3057
|
const Token = mongoose.models.Token;
|
|
3058
|
+
const conditions = [];
|
|
3059
|
+
if (query.userId !== undefined) {
|
|
3060
|
+
conditions.push({ userId: query.userId });
|
|
3061
|
+
}
|
|
3062
|
+
if (query.token !== undefined) {
|
|
3063
|
+
conditions.push({ token: query.token });
|
|
3064
|
+
}
|
|
3065
|
+
if (query.email !== undefined) {
|
|
3066
|
+
conditions.push({ email: query.email });
|
|
3067
|
+
}
|
|
3068
|
+
if (query.identifier !== undefined) {
|
|
3069
|
+
conditions.push({ identifier: query.identifier });
|
|
3070
|
+
}
|
|
3071
|
+
/**
|
|
3072
|
+
* If no conditions are specified, throw an error to prevent accidental deletion of all tokens
|
|
3073
|
+
*/
|
|
3074
|
+
if (conditions.length === 0) {
|
|
3075
|
+
throw new Error('At least one query parameter must be provided');
|
|
3076
|
+
}
|
|
3057
3077
|
return await Token.deleteMany({
|
|
3058
|
-
$or:
|
|
3059
|
-
{ userId: query.userId },
|
|
3060
|
-
{ token: query.token },
|
|
3061
|
-
{ email: query.email },
|
|
3062
|
-
{ identifier: query.identifier },
|
|
3063
|
-
],
|
|
3078
|
+
$or: conditions,
|
|
3064
3079
|
});
|
|
3065
3080
|
}
|
|
3066
3081
|
catch (error) {
|