@librechat/data-schemas 0.0.38 → 0.0.39
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 +33 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +34 -7
- package/dist/index.es.js.map +1 -1
- package/dist/types/types/user.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2631,6 +2631,15 @@ const userSchema = new mongoose.Schema({
|
|
|
2631
2631
|
type: [BackupCodeSchema],
|
|
2632
2632
|
select: false,
|
|
2633
2633
|
},
|
|
2634
|
+
pendingTotpSecret: {
|
|
2635
|
+
type: String,
|
|
2636
|
+
select: false,
|
|
2637
|
+
},
|
|
2638
|
+
pendingBackupCodes: {
|
|
2639
|
+
type: [BackupCodeSchema],
|
|
2640
|
+
select: false,
|
|
2641
|
+
default: undefined,
|
|
2642
|
+
},
|
|
2634
2643
|
refreshToken: {
|
|
2635
2644
|
type: [SessionSchema],
|
|
2636
2645
|
},
|
|
@@ -3256,7 +3265,6 @@ function mongoMeili(schema, options) {
|
|
|
3256
3265
|
const client = new meilisearch.MeiliSearch({ host, apiKey });
|
|
3257
3266
|
/** Create index only if it doesn't exist */
|
|
3258
3267
|
const index = client.index(indexName);
|
|
3259
|
-
// Check if index exists and create if needed
|
|
3260
3268
|
(async () => {
|
|
3261
3269
|
try {
|
|
3262
3270
|
await index.getRawInfo();
|
|
@@ -3267,19 +3275,38 @@ function mongoMeili(schema, options) {
|
|
|
3267
3275
|
if (errorCode === 'index_not_found') {
|
|
3268
3276
|
try {
|
|
3269
3277
|
logger.info(`[mongoMeili] Creating new index: ${indexName}`);
|
|
3270
|
-
await client.createIndex(indexName, { primaryKey });
|
|
3271
|
-
|
|
3278
|
+
const enqueued = await client.createIndex(indexName, { primaryKey });
|
|
3279
|
+
const task = await client.waitForTask(enqueued.taskUid, {
|
|
3280
|
+
timeOutMs: 10000,
|
|
3281
|
+
intervalMs: 100,
|
|
3282
|
+
});
|
|
3283
|
+
logger.debug(`[mongoMeili] Index ${indexName} creation task:`, task);
|
|
3284
|
+
if (task.status !== 'succeeded') {
|
|
3285
|
+
const taskError = task.error;
|
|
3286
|
+
if ((taskError === null || taskError === void 0 ? void 0 : taskError.code) === 'index_already_exists') {
|
|
3287
|
+
logger.debug(`[mongoMeili] Index ${indexName} was created by another instance`);
|
|
3288
|
+
}
|
|
3289
|
+
else {
|
|
3290
|
+
logger.warn(`[mongoMeili] Index ${indexName} creation failed:`, taskError);
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
else {
|
|
3294
|
+
logger.info(`[mongoMeili] Successfully created index: ${indexName}`);
|
|
3295
|
+
}
|
|
3272
3296
|
}
|
|
3273
3297
|
catch (createError) {
|
|
3274
|
-
|
|
3275
|
-
|
|
3298
|
+
if (createError instanceof meilisearch.MeiliSearchTimeOutError) {
|
|
3299
|
+
logger.warn(`[mongoMeili] Timed out waiting for index ${indexName} creation`);
|
|
3300
|
+
}
|
|
3301
|
+
else {
|
|
3302
|
+
logger.warn(`[mongoMeili] Error creating index ${indexName}:`, createError);
|
|
3303
|
+
}
|
|
3276
3304
|
}
|
|
3277
3305
|
}
|
|
3278
3306
|
else {
|
|
3279
3307
|
logger.error(`[mongoMeili] Error checking index ${indexName}:`, error);
|
|
3280
3308
|
}
|
|
3281
3309
|
}
|
|
3282
|
-
// Configure index settings to make 'user' field filterable
|
|
3283
3310
|
try {
|
|
3284
3311
|
await index.updateSettings({
|
|
3285
3312
|
filterableAttributes: ['user'],
|