@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.es.js CHANGED
@@ -1339,6 +1339,11 @@ function configCapability(section) {
1339
1339
  function readConfigCapability(section) {
1340
1340
  return `read:configs:${section}`;
1341
1341
  }
1342
+ // ---------------------------------------------------------------------------
1343
+ // Reserved principal IDs
1344
+ // ---------------------------------------------------------------------------
1345
+ /** Reserved principalId for the DB base config (overrides YAML defaults). */
1346
+ const BASE_CONFIG_PRINCIPAL_ID = '__base__';
1342
1347
  /** Pre-defined UI categories for grouping capabilities in the admin panel. */
1343
1348
  const CAPABILITY_CATEGORIES = [
1344
1349
  {
@@ -11399,18 +11404,21 @@ function createConfigMethods(mongoose) {
11399
11404
  return await query.lean();
11400
11405
  }
11401
11406
  async function getApplicableConfigs(principals, session) {
11402
- if (!principals || principals.length === 0) {
11403
- return [];
11404
- }
11405
11407
  const Config = mongoose.models.Config;
11406
- const principalsQuery = principals
11407
- .map((p) => ({
11408
- principalType: p.principalType,
11409
- principalId: p.principalId,
11410
- }))
11411
- .filter((p) => p.principalId !== undefined);
11412
- if (principalsQuery.length === 0) {
11413
- return [];
11408
+ const basePrincipal = {
11409
+ principalType: PrincipalType.ROLE,
11410
+ principalId: BASE_CONFIG_PRINCIPAL_ID,
11411
+ };
11412
+ const principalsQuery = [basePrincipal];
11413
+ if (principals && principals.length > 0) {
11414
+ for (const p of principals) {
11415
+ if (p.principalId !== undefined) {
11416
+ principalsQuery.push({
11417
+ principalType: p.principalType,
11418
+ principalId: p.principalId,
11419
+ });
11420
+ }
11421
+ }
11414
11422
  }
11415
11423
  const configQuery = Config.find({
11416
11424
  $or: principalsQuery,
@@ -11641,5 +11649,5 @@ async function dropSupersededTenantIndexes(connection) {
11641
11649
  return result;
11642
11650
  }
11643
11651
 
11644
- export { AppService, CANCEL_RATE, CAPABILITY_CATEGORIES, CapabilityImplications, DEFAULT_REFRESH_TOKEN_EXPIRY, DEFAULT_RETENTION_HOURS, DEFAULT_SESSION_EXPIRY, MAX_RETENTION_HOURS, MIN_RETENTION_HOURS, ResourceCapabilityMap, RoleBits, SYSTEM_TENANT_ID, SystemCapabilities, Action as actionSchema, agentApiKeySchema, agentCategorySchema, agentSchema, agentsConfigSetup, assistantSchema, balanceSchema, bannerSchema, cacheTokenValues, categoriesSchema, configCapability, configSchema, conversationTag as conversationTagSchema, convoSchema, createMethods, createModels, createTempChatExpirationDate, decrypt, decryptV2, decryptV3, defaultRate, defaultVertexModels, dropSupersededTenantIndexes, encrypt, encryptV2, encryptV3, escapeRegExp, expandImplications, file as fileSchema, getRandomValues, getTempChatRetentionHours, getTenantId, getTransactionSupport, getWebSearchKeys, groupSchema, hasImpliedCapability, hashBackupCode, hashToken, keySchema, loadDefaultInterface, loadTurnstileConfig, loadWebSearchConfig, logger$1 as logger, logger as meiliLogger, MemoryEntrySchema as memorySchema, mergeConfigOverrides, messageSchema, normalizePrincipalId, pluginAuthSchema, premiumTokenValues, presetSchema, processModelSpecs, promptGroupSchema, promptSchema, readConfigCapability, roleSchema, runAsSystem, sessionSchema, shareSchema, signPayload, supportsTransactions, systemGrantSchema, tenantStorage, tokenSchema, tokenValues, toolCallSchema, transactionSchema, userSchema, validateVertexConfig, vertexConfigSetup, webSearchAuth, webSearchKeys };
11652
+ export { AppService, BASE_CONFIG_PRINCIPAL_ID, CANCEL_RATE, CAPABILITY_CATEGORIES, CapabilityImplications, DEFAULT_REFRESH_TOKEN_EXPIRY, DEFAULT_RETENTION_HOURS, DEFAULT_SESSION_EXPIRY, MAX_RETENTION_HOURS, MIN_RETENTION_HOURS, ResourceCapabilityMap, RoleBits, SYSTEM_TENANT_ID, SystemCapabilities, Action as actionSchema, agentApiKeySchema, agentCategorySchema, agentSchema, agentsConfigSetup, assistantSchema, balanceSchema, bannerSchema, cacheTokenValues, categoriesSchema, configCapability, configSchema, conversationTag as conversationTagSchema, convoSchema, createMethods, createModels, createTempChatExpirationDate, decrypt, decryptV2, decryptV3, defaultRate, defaultVertexModels, dropSupersededTenantIndexes, encrypt, encryptV2, encryptV3, escapeRegExp, expandImplications, file as fileSchema, getRandomValues, getTempChatRetentionHours, getTenantId, getTransactionSupport, getWebSearchKeys, groupSchema, hasImpliedCapability, hashBackupCode, hashToken, keySchema, loadDefaultInterface, loadTurnstileConfig, loadWebSearchConfig, logger$1 as logger, logger as meiliLogger, MemoryEntrySchema as memorySchema, mergeConfigOverrides, messageSchema, normalizePrincipalId, pluginAuthSchema, premiumTokenValues, presetSchema, processModelSpecs, promptGroupSchema, promptSchema, readConfigCapability, roleSchema, runAsSystem, sessionSchema, shareSchema, signPayload, supportsTransactions, systemGrantSchema, tenantStorage, tokenSchema, tokenValues, toolCallSchema, transactionSchema, userSchema, validateVertexConfig, vertexConfigSetup, webSearchAuth, webSearchKeys };
11645
11653
  //# sourceMappingURL=index.es.js.map