🚀 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": { "packages/data-schemas": {
"name": "@librechat/data-schemas", "name": "@librechat/data-schemas",
"version": "0.0.3", "version": "0.0.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"mongoose": "^8.12.1" "mongoose": "^8.12.1"

View file

@ -1,8 +1,8 @@
{ {
"name": "@librechat/data-schemas", "name": "@librechat/data-schemas",
"version": "0.0.3", "version": "0.0.4",
"type": "module",
"description": "Mongoose schemas and models for LibreChat", "description": "Mongoose schemas and models for LibreChat",
"type": "module",
"main": "dist/index.cjs", "main": "dist/index.cjs",
"module": "dist/index.es.js", "module": "dist/index.es.js",
"types": "./dist/types/index.d.ts", "types": "./dist/types/index.d.ts",
@ -13,6 +13,9 @@
"types": "./dist/types/index.d.ts" "types": "./dist/types/index.d.ts"
} }
}, },
"files": [
"dist"
],
"scripts": { "scripts": {
"clean": "rimraf dist", "clean": "rimraf dist",
"build": "npm run clean && rollup -c --silent --bundleConfigAsCjs", "build": "npm run clean && rollup -c --silent --bundleConfigAsCjs",
@ -55,14 +58,20 @@
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.0.4" "typescript": "^5.0.4"
}, },
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"dependencies": { "dependencies": {
"mongoose": "^8.12.1" "mongoose": "^8.12.1"
}, },
"peerDependencies": { "peerDependencies": {
"keyv": "^4.5.4" "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 json from '@rollup/plugin-json';
import typescript from '@rollup/plugin-typescript'; import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs'; import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
export default { export default {
input: 'src/index.ts', input: 'src/index.ts',
output: [ output: [
{ {
file: 'dist/index.cjs', // Changed from index.js to index.cjs file: 'dist/index.es.js',
format: 'cjs', format: 'es',
sourcemap: true, sourcemap: true,
exports: 'named',
}, },
{ {
file: 'dist/index.es.js', file: 'dist/index.cjs',
format: 'esm', format: 'cjs',
sourcemap: true, sourcemap: true,
exports: 'named',
}, },
], ],
plugins: [json(), commonjs(), typescript({ tsconfig: './tsconfig.json' })], plugins: [
external: [ // Allow importing JSON files
// list your external dependencies 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'; export { default as actionSchema } from './schema/action';
import agentSchema from './schema/agent'; export type { IAction } from './schema/action';
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 { export { default as agentSchema } from './schema/agent';
actionSchema, export type { IAgent } from './schema/agent';
agentSchema,
assistantSchema, export { default as assistantSchema } from './schema/assistant';
balanceSchema, export type { IAssistant } from './schema/assistant';
bannerSchema,
categoriesSchema, export { default as balanceSchema } from './schema/balance';
conversationTagSchema, export type { IBalance } from './schema/balance';
convoSchema,
fileSchema, export { default as bannerSchema } from './schema/banner';
keySchema, export type { IBanner } from './schema/banner';
messageSchema,
pluginAuthSchema, export { default as categoriesSchema } from './schema/categories';
presetSchema, export type { ICategory } from './schema/categories';
projectSchema,
promptSchema, export { default as conversationTagSchema } from './schema/conversationTag';
promptGroupSchema, export type { IConversationTag } from './schema/conversationTag';
roleSchema,
sessionSchema, export { default as convoSchema } from './schema/convo';
shareSchema, export type { IConversation } from './schema/convo';
tokenSchema,
toolCallSchema, export { default as fileSchema } from './schema/file';
transactionSchema, export type { IMongoFile } from './schema/file';
userSchema,
}; 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": { "compilerOptions": {
"declaration": true, "target": "ES2019",
"declarationDir": "./dist/types", "module": "ESNext",
"module": "esnext",
"noImplicitAny": true,
"outDir": "./dist",
"target": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"lib": ["es2017", "dom", "ES2021.String"], "declaration": true,
"skipLibCheck": true, "declarationDir": "dist/types",
"esModuleInterop": true, "outDir": "dist",
"strict": true, "strict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "sourceMap": true
"noEmit": false,
"sourceMap": true,
"baseUrl": "."
}, },
"ts-node": { "include": ["src/**/*"],
"experimentalSpecifierResolution": "node", "exclude": ["node_modules", "dist", "tests"]
"transpileOnly": true,
"esm": true
},
"exclude": ["node_modules", "dist", "types"],
"include": ["src/**/*", "types/index.d.ts", "types/react-query/index.d.ts"]
} }