@librechat/data-schemas 0.0.42 → 0.0.43
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 +20 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +20 -12
- package/dist/index.es.js.map +1 -1
- package/dist/types/admin/capabilities.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1341,6 +1341,11 @@ function configCapability(section) {
|
|
|
1341
1341
|
function readConfigCapability(section) {
|
|
1342
1342
|
return `read:configs:${section}`;
|
|
1343
1343
|
}
|
|
1344
|
+
// ---------------------------------------------------------------------------
|
|
1345
|
+
// Reserved principal IDs
|
|
1346
|
+
// ---------------------------------------------------------------------------
|
|
1347
|
+
/** Reserved principalId for the DB base config (overrides YAML defaults). */
|
|
1348
|
+
const BASE_CONFIG_PRINCIPAL_ID = '__base__';
|
|
1344
1349
|
/** Pre-defined UI categories for grouping capabilities in the admin panel. */
|
|
1345
1350
|
const CAPABILITY_CATEGORIES = [
|
|
1346
1351
|
{
|
|
@@ -11401,18 +11406,21 @@ function createConfigMethods(mongoose) {
|
|
|
11401
11406
|
return await query.lean();
|
|
11402
11407
|
}
|
|
11403
11408
|
async function getApplicableConfigs(principals, session) {
|
|
11404
|
-
if (!principals || principals.length === 0) {
|
|
11405
|
-
return [];
|
|
11406
|
-
}
|
|
11407
11409
|
const Config = mongoose.models.Config;
|
|
11408
|
-
const
|
|
11409
|
-
.
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11410
|
+
const basePrincipal = {
|
|
11411
|
+
principalType: librechatDataProvider.PrincipalType.ROLE,
|
|
11412
|
+
principalId: BASE_CONFIG_PRINCIPAL_ID,
|
|
11413
|
+
};
|
|
11414
|
+
const principalsQuery = [basePrincipal];
|
|
11415
|
+
if (principals && principals.length > 0) {
|
|
11416
|
+
for (const p of principals) {
|
|
11417
|
+
if (p.principalId !== undefined) {
|
|
11418
|
+
principalsQuery.push({
|
|
11419
|
+
principalType: p.principalType,
|
|
11420
|
+
principalId: p.principalId,
|
|
11421
|
+
});
|
|
11422
|
+
}
|
|
11423
|
+
}
|
|
11416
11424
|
}
|
|
11417
11425
|
const configQuery = Config.find({
|
|
11418
11426
|
$or: principalsQuery,
|
|
@@ -11644,6 +11652,7 @@ async function dropSupersededTenantIndexes(connection) {
|
|
|
11644
11652
|
}
|
|
11645
11653
|
|
|
11646
11654
|
exports.AppService = AppService;
|
|
11655
|
+
exports.BASE_CONFIG_PRINCIPAL_ID = BASE_CONFIG_PRINCIPAL_ID;
|
|
11647
11656
|
exports.CANCEL_RATE = CANCEL_RATE;
|
|
11648
11657
|
exports.CAPABILITY_CATEGORIES = CAPABILITY_CATEGORIES;
|
|
11649
11658
|
exports.CapabilityImplications = CapabilityImplications;
|