LibreChat/api/models/index.js
Dustin Healy 7dd4fafdf3
📬 feat: Persist Channel Events and Delivery Receipts (#17595)
* 📬 feat: Persist Channel Events and Delivery Receipts

* fix: enforce channel run identity and fenced recovery

* fix: fence and erase channel state during account deletion

* refactor: share channel owner admission with private persistence

* refactor: name channel account-erasure boundary explicitly

* fix: prove channel identity and delivery authority at storage boundaries

* refactor: enforce channel delivery protocol and terminal lifecycle

* fix: enforce channel tenant and operation boundaries

* fix: initialize channel config from its composition owner

* test: verify config installs channel storage reader

* test: complete config initializer contract in model mocks

* test: include channel config reader in migration fixture

* test: await SSE subscription before advancing keepalive time

* test: Observe and Drain Concurrent Fixture Work
2026-11-10 21:03:57 -08:00

36 lines
1 KiB
JavaScript

const mongoose = require('mongoose');
const { createMethods } = require('@librechat/data-schemas');
const {
matchModelName,
findMatchingPattern,
isDeploymentSkillId,
createMessageBudgetReader,
createChannelStorageConfigReader,
} = require('@librechat/api');
const getLogStores = require('~/cache/getLogStores');
const messageBudget = createMessageBudgetReader();
const channelStorageConfig = createChannelStorageConfigReader();
const methods = createMethods(mongoose, {
matchModelName,
findMatchingPattern,
isExternalSkillId: isDeploymentSkillId,
getCache: getLogStores,
getChannelStorageConfig: channelStorageConfig.getConfig,
getMCPAppMessageBudget: messageBudget.getBudget,
});
const seedDatabase = async () => {
await methods.initializeRoles();
await methods.seedDefaultRoles();
await methods.ensureDefaultCategories();
await methods.seedSystemGrants();
};
module.exports = {
...methods,
initializeMessageBudget: messageBudget.initialize,
initializeChannelStorageConfig: channelStorageConfig.initialize,
seedDatabase,
};