* 🏗️ feat: Add Group model and schema with GroupType enum * 🏗️ feat: Introduce Permissions module and refactor role-based access control * 🏗️ feat: Refactor permissions handling and consolidate permission schemas * 🏗️ feat: Refactor role permissions handling and improve role initialization logic * 🏗️ feat: Update Role.spec.js to improve imports and enhance test structure * 🏗️ feat: Update access control logic to ensure proper permission checks in role handling * 🏗️ chore: Bump versions for librechat-data-provider to 0.7.75 and @librechat/data-schemas to 0.0.6 * 🏗️ feat: Improve role permissions handling by ensuring defaults are applied correctly * 🏗️ feat: Update role permissions schema to comment out unused SHARE permission * 🏗️ chore: Bump version of librechat-data-provider to 0.7.77 and remove unused groups field from IUser interface * 🏗️ chore: Downgrade version of librechat-data-provider to 0.7.76 * 🔧 chore: Bump versions for librechat-data-provider to 0.7.77 and data-schemas to 0.0.6 * 🏗️ chore: Update version of librechat-data-provider to 0.7.789 --------- Co-authored-by: Danny Avila <danny@librechat.ai> |
||
|---|---|---|
| .. | ||
| src | ||
| .gitignore | ||
| babel.config.cjs | ||
| jest.config.mjs | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| rollup.config.js | ||
| tsconfig.json | ||
| tsconfig.spec.json | ||
@librechat/data-schemas
Mongoose schemas and models for LibreChat. This package provides a comprehensive collection of Mongoose schemas used across the LibreChat project, enabling robust data modeling and validation for various entities such as actions, agents, messages, users, and more.
Features
- Modular Schemas: Includes schemas for actions, agents, assistants, balance, banners, categories, conversation tags, conversations, files, keys, messages, plugin authentication, presets, projects, prompts, prompt groups, roles, sessions, shared links, tokens, tool calls, transactions, and users.
- TypeScript Support: Provides TypeScript definitions for type-safe development.
- Ready for Mongoose Integration: Easily integrate with Mongoose to create models and interact with your MongoDB database.
- Flexible & Extensible: Designed to support the evolving needs of LibreChat while being adaptable to other projects.
Installation
Install the package via npm or yarn:
npm install @librechat/data-schemas
Or with yarn:
yarn add @librechat/data-schemas
Usage
After installation, you can import and use the schemas in your project. For example, to create a Mongoose model for a user:
import mongoose from 'mongoose';
import { userSchema } from '@librechat/data-schemas';
const UserModel = mongoose.model('User', userSchema);
// Now you can use UserModel to create, read, update, and delete user documents.
You can also import other schemas as needed:
import { actionSchema, agentSchema, messageSchema } from '@librechat/data-schemas';
Each schema is designed to integrate seamlessly with Mongoose and provides indexes, timestamps, and validations tailored for LibreChat’s use cases.
Development
This package uses Rollup and TypeScript for building and bundling.
Available Scripts
-
Build:
Cleans thedistdirectory and builds the package.npm run build -
Build Watch:
Rebuilds automatically on file changes.npm run build:watch -
Test:
Runs tests with coverage in watch mode.npm run test -
Test (CI):
Runs tests with coverage for CI environments.npm run test:ci -
Verify:
Runs tests in CI mode to verify code integrity.npm run verify -
Clean:
Removes thedistdirectory.npm run clean
For those using Bun, equivalent scripts are available:
- Bun Clean:
bun run b:clean - Bun Build:
bun run b:build
Repository & Issues
The source code is maintained on GitHub.
- Repository: LibreChat Repository
- Issues & Bug Reports: LibreChat Issues
License
This project is licensed under the MIT License.
Contributing
Contributions to improve and expand the data schemas are welcome. If you have suggestions, improvements, or bug fixes, please open an issue or submit a pull request on the GitHub repository.
For more detailed documentation on each schema and model, please refer to the source code or visit the LibreChat website.