* fix: resolve MeiliSearch startup sync failure from model loading order
`indexSync.js` captures `mongoose.models.Message` and
`mongoose.models.Conversation` at module load time (lines 9-10).
Since PR #11830 moved model registration into `createModels()`,
these references are always `undefined` because `require('./indexSync')`
ran before `createModels(mongoose)` in `api/db/index.js`.
Move the `require('./indexSync')` below `createModels(mongoose)` so
Mongoose models are registered before `indexSync.js` captures them.
* fix: defer model lookups in indexSync, add load-order regression test
- Move mongoose.models.Message and mongoose.models.Conversation lookups
from module-level into performSync() and the indexSync() catch block,
eliminating the fragile load-order dependency that caused the original
regression
- Add guard assertion that throws a clear error if models are missing
- Add comment in api/db/index.js documenting the createModels ordering
constraint
- Add api/db/index.spec.js regression test to prevent future re-introduction
of the load-order bug
* fix: strengthen regression test to verify call order, add guard in setTimeout path
- Rewrite index.spec.js to track call sequence via callOrder array,
ensuring createModels executes before indexSync module loads
(verified: test fails if order is reversed)
- Add missing model guard assertion in the setTimeout fallback path
in indexSync.js for consistency with performSync
---------
Co-authored-by: Danny Avila <danny@librechat.ai>
* refactor: move model definitions and database-related methods to packages/data-schemas
* ci: update tests due to new DB structure
fix: disable mocking `librechat-data-provider`
feat: Add schema exports to data-schemas package
- Introduced a new schema module that exports various schemas including action, agent, and user schemas.
- Updated index.ts to include the new schema exports for better modularity and organization.
ci: fix appleStrategy tests
fix: Agent.spec.js
ci: refactor handleTools tests to use MongoMemoryServer for in-memory database
fix: getLogStores imports
ci: update banViolation tests to use MongoMemoryServer and improve session mocking
test: refactor samlStrategy tests to improve mock configurations and user handling
ci: fix crypto mock in handleText tests for improved accuracy
ci: refactor spendTokens tests to improve model imports and setup
ci: refactor Message model tests to use MongoMemoryServer and improve database interactions
* refactor: streamline IMessage interface and move feedback properties to types/message.ts
* refactor: use exported initializeRoles from `data-schemas`, remove api workspace version (this serves as an example of future migrations that still need to happen)
* refactor: update model imports to use destructuring from `~/db/models` for consistency and clarity
* refactor: remove unused mongoose imports from model files for cleaner code
* refactor: remove unused mongoose imports from Share, Prompt, and Transaction model files for cleaner code
* refactor: remove unused import in Transaction model for cleaner code
* ci: update deploy workflow to reference new Docker Dev Branch Images Build and add new workflow for building Docker images on dev branch
* chore: cleanup imports