🚀 feat: Refactor schema exports and update package version to 0.0.4 (#6455)

This commit is contained in:
Ruben Talstra 2025-03-21 13:20:23 +01:00 committed by GitHub
parent b70d9f1a82
commit c58a9c4f33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 119 additions and 85 deletions

2
package-lock.json generated
View file

@ -44120,7 +44120,7 @@
},
"packages/data-schemas": {
"name": "@librechat/data-schemas",
"version": "0.0.3",
"version": "0.0.4",
"license": "MIT",
"dependencies": {
"mongoose": "^8.12.1"

View file

@ -1,8 +1,8 @@
{
"name": "@librechat/data-schemas",
"version": "0.0.3",
"type": "module",
"version": "0.0.4",
"description": "Mongoose schemas and models for LibreChat",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.es.js",
"types": "./dist/types/index.d.ts",
@ -13,6 +13,9 @@
"types": "./dist/types/index.d.ts"
}
},
"files": [
"dist"
],
"scripts": {
"clean": "rimraf dist",
"build": "npm run clean && rollup -c --silent --bundleConfigAsCjs",
@ -55,14 +58,20 @@
"ts-node": "^10.9.2",
"typescript": "^5.0.4"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"dependencies": {
"mongoose": "^8.12.1"
},
"peerDependencies": {
"keyv": "^4.5.4"
}
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"keywords": [
"mongoose",
"schema",
"typescript",
"librechat"
]
}

View file

@ -1,25 +1,40 @@
import json from '@rollup/plugin-json';
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
export default {
input: 'src/index.ts',
output: [
{
file: 'dist/index.cjs', // Changed from index.js to index.cjs
format: 'cjs',
file: 'dist/index.es.js',
format: 'es',
sourcemap: true,
exports: 'named',
},
{
file: 'dist/index.es.js',
format: 'esm',
file: 'dist/index.cjs',
format: 'cjs',
sourcemap: true,
exports: 'named',
},
],
plugins: [json(), commonjs(), typescript({ tsconfig: './tsconfig.json' })],
external: [
// list your external dependencies
plugins: [
// Allow importing JSON files
json(),
// Automatically externalize peer dependencies
peerDepsExternal(),
// Resolve modules from node_modules
nodeResolve(),
// Convert CommonJS modules to ES6
commonjs(),
// Compile TypeScript files and generate type declarations
typescript({
tsconfig: './tsconfig.json',
declaration: true,
declarationDir: 'dist/types',
rootDir: 'src',
}),
],
// Do not bundle these external dependencies
external: ['mongoose'],
};

View file

@ -1,49 +1,68 @@
import actionSchema from './schema/action';
import agentSchema from './schema/agent';
import assistantSchema from './schema/assistant';
import balanceSchema from './schema/balance';
import bannerSchema from './schema/banner';
import categoriesSchema from './schema/categories';
import conversationTagSchema from './schema/conversationTag';
import convoSchema from './schema/convo';
import fileSchema from './schema/file';
import keySchema from './schema/key';
import messageSchema from './schema/message';
import pluginAuthSchema from './schema/pluginAuth';
import presetSchema from './schema/preset';
import projectSchema from './schema/project';
import promptSchema from './schema/prompt';
import promptGroupSchema from './schema/promptGroup';
import roleSchema from './schema/role';
import sessionSchema from './schema/session';
import shareSchema from './schema/share';
import tokenSchema from './schema/token';
import toolCallSchema from './schema/toolCall';
import transactionSchema from './schema/transaction';
import userSchema from './schema/user';
export { default as actionSchema } from './schema/action';
export type { IAction } from './schema/action';
export {
actionSchema,
agentSchema,
assistantSchema,
balanceSchema,
bannerSchema,
categoriesSchema,
conversationTagSchema,
convoSchema,
fileSchema,
keySchema,
messageSchema,
pluginAuthSchema,
presetSchema,
projectSchema,
promptSchema,
promptGroupSchema,
roleSchema,
sessionSchema,
shareSchema,
tokenSchema,
toolCallSchema,
transactionSchema,
userSchema,
};
export { default as agentSchema } from './schema/agent';
export type { IAgent } from './schema/agent';
export { default as assistantSchema } from './schema/assistant';
export type { IAssistant } from './schema/assistant';
export { default as balanceSchema } from './schema/balance';
export type { IBalance } from './schema/balance';
export { default as bannerSchema } from './schema/banner';
export type { IBanner } from './schema/banner';
export { default as categoriesSchema } from './schema/categories';
export type { ICategory } from './schema/categories';
export { default as conversationTagSchema } from './schema/conversationTag';
export type { IConversationTag } from './schema/conversationTag';
export { default as convoSchema } from './schema/convo';
export type { IConversation } from './schema/convo';
export { default as fileSchema } from './schema/file';
export type { IMongoFile } from './schema/file';
export { default as keySchema } from './schema/key';
export type { IKey } from './schema/key';
export { default as messageSchema } from './schema/message';
export type { IMessage } from './schema/message';
export { default as pluginAuthSchema } from './schema/pluginAuth';
export type { IPluginAuth } from './schema/pluginAuth';
export { default as presetSchema } from './schema/preset';
export type { IPreset } from './schema/preset';
export { default as projectSchema } from './schema/project';
export type { IMongoProject } from './schema/project';
export { default as promptSchema } from './schema/prompt';
export type { IPrompt } from './schema/prompt';
export { default as promptGroupSchema } from './schema/promptGroup';
export type { IPromptGroup, IPromptGroupDocument } from './schema/promptGroup';
export { default as roleSchema } from './schema/role';
export type { IRole } from './schema/role';
export { default as sessionSchema } from './schema/session';
export type { ISession } from './schema/session';
export { default as shareSchema } from './schema/share';
export type { ISharedLink } from './schema/share';
export { default as tokenSchema } from './schema/token';
export type { IToken } from './schema/token';
export { default as toolCallSchema } from './schema/toolCall';
export type { IToolCallData } from './schema/toolCall';
export { default as transactionSchema } from './schema/transaction';
export type { ITransaction } from './schema/transaction';
export { default as userSchema } from './schema/user';
export type { IUser } from './schema/user';

View file

@ -1,28 +1,19 @@
{
"compilerOptions": {
"declaration": true,
"declarationDir": "./dist/types",
"module": "esnext",
"noImplicitAny": true,
"outDir": "./dist",
"target": "es2015",
"target": "ES2019",
"module": "ESNext",
"moduleResolution": "node",
"lib": ["es2017", "dom", "ES2021.String"],
"skipLibCheck": true,
"esModuleInterop": true,
"declaration": true,
"declarationDir": "dist/types",
"outDir": "dist",
"strict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": false,
"sourceMap": true,
"baseUrl": "."
"sourceMap": true
},
"ts-node": {
"experimentalSpecifierResolution": "node",
"transpileOnly": true,
"esm": true
},
"exclude": ["node_modules", "dist", "types"],
"include": ["src/**/*", "types/index.d.ts", "types/react-query/index.d.ts"]
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests"]
}