Skip to content

Commit 866ff66

Browse files
rubentalstradanny-avila
authored andcommitted
🚀 feat: Refactor schema exports and update package version to 0.0.4 (#6455)
1 parent f591ea6 commit 866ff66

File tree

5 files changed

+120
-86
lines changed

5 files changed

+120
-86
lines changed

‎package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/data-schemas/package.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@librechat/data-schemas",
3-
"version": "0.0.3",
4-
"type": "module",
3+
"version": "0.0.4",
54
"description": "Mongoose schemas and models for LibreChat",
5+
"type": "module",
66
"main": "dist/index.cjs",
77
"module": "dist/index.es.js",
88
"types": "./dist/types/index.d.ts",
@@ -13,6 +13,9 @@
1313
"types": "./dist/types/index.d.ts"
1414
}
1515
},
16+
"files": [
17+
"dist"
18+
],
1619
"scripts": {
1720
"clean": "rimraf dist",
1821
"build": "npm run clean && rollup -c --silent --bundleConfigAsCjs",
@@ -55,14 +58,20 @@
5558
"ts-node": "^10.9.2",
5659
"typescript": "^5.0.4"
5760
},
58-
"publishConfig": {
59-
"registry": "https://registry.npmjs.org/",
60-
"access": "public"
61-
},
6261
"dependencies": {
6362
"mongoose": "^8.12.1"
6463
},
6564
"peerDependencies": {
6665
"keyv": "^4.5.4"
67-
}
66+
},
67+
"publishConfig": {
68+
"registry": "https://registry.npmjs.org/",
69+
"access": "public"
70+
},
71+
"keywords": [
72+
"mongoose",
73+
"schema",
74+
"typescript",
75+
"librechat"
76+
]
6877
}
Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
11
import json from '@rollup/plugin-json';
22
import typescript from '@rollup/plugin-typescript';
33
import commonjs from '@rollup/plugin-commonjs';
4+
import nodeResolve from '@rollup/plugin-node-resolve';
5+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
46

57
export default {
68
input: 'src/index.ts',
79
output: [
810
{
9-
file: 'dist/index.cjs', // Changed from index.js to index.cjs
10-
format: 'cjs',
11+
file: 'dist/index.es.js',
12+
format: 'es',
1113
sourcemap: true,
12-
exports: 'named',
1314
},
1415
{
15-
file: 'dist/index.es.js',
16-
format: 'esm',
16+
file: 'dist/index.cjs',
17+
format: 'cjs',
1718
sourcemap: true,
18-
exports: 'named',
1919
},
2020
],
21-
plugins: [json(), commonjs(), typescript({ tsconfig: './tsconfig.json' })],
22-
external: [
23-
// list your external dependencies
21+
plugins: [
22+
// Allow importing JSON files
23+
json(),
24+
// Automatically externalize peer dependencies
25+
peerDepsExternal(),
26+
// Resolve modules from node_modules
27+
nodeResolve(),
28+
// Convert CommonJS modules to ES6
29+
commonjs(),
30+
// Compile TypeScript files and generate type declarations
31+
typescript({
32+
tsconfig: './tsconfig.json',
33+
declaration: true,
34+
declarationDir: 'dist/types',
35+
rootDir: 'src',
36+
}),
2437
],
38+
// Do not bundle these external dependencies
39+
external: ['mongoose'],
2540
};
Lines changed: 68 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,68 @@
1-
import actionSchema from './schema/action';
2-
import agentSchema from './schema/agent';
3-
import assistantSchema from './schema/assistant';
4-
import balanceSchema from './schema/balance';
5-
import bannerSchema from './schema/banner';
6-
import categoriesSchema from './schema/categories';
7-
import conversationTagSchema from './schema/conversationTag';
8-
import convoSchema from './schema/convo';
9-
import fileSchema from './schema/file';
10-
import keySchema from './schema/key';
11-
import messageSchema from './schema/message';
12-
import pluginAuthSchema from './schema/pluginAuth';
13-
import presetSchema from './schema/preset';
14-
import projectSchema from './schema/project';
15-
import promptSchema from './schema/prompt';
16-
import promptGroupSchema from './schema/promptGroup';
17-
import roleSchema from './schema/role';
18-
import sessionSchema from './schema/session';
19-
import shareSchema from './schema/share';
20-
import tokenSchema from './schema/token';
21-
import toolCallSchema from './schema/toolCall';
22-
import transactionSchema from './schema/transaction';
23-
import userSchema from './schema/user';
24-
25-
export {
26-
actionSchema,
27-
agentSchema,
28-
assistantSchema,
29-
balanceSchema,
30-
bannerSchema,
31-
categoriesSchema,
32-
conversationTagSchema,
33-
convoSchema,
34-
fileSchema,
35-
keySchema,
36-
messageSchema,
37-
pluginAuthSchema,
38-
presetSchema,
39-
projectSchema,
40-
promptSchema,
41-
promptGroupSchema,
42-
roleSchema,
43-
sessionSchema,
44-
shareSchema,
45-
tokenSchema,
46-
toolCallSchema,
47-
transactionSchema,
48-
userSchema,
49-
};
1+
export { default as actionSchema } from './schema/action';
2+
export type { IAction } from './schema/action';
3+
4+
export { default as agentSchema } from './schema/agent';
5+
export type { IAgent } from './schema/agent';
6+
7+
export { default as assistantSchema } from './schema/assistant';
8+
export type { IAssistant } from './schema/assistant';
9+
10+
export { default as balanceSchema } from './schema/balance';
11+
export type { IBalance } from './schema/balance';
12+
13+
export { default as bannerSchema } from './schema/banner';
14+
export type { IBanner } from './schema/banner';
15+
16+
export { default as categoriesSchema } from './schema/categories';
17+
export type { ICategory } from './schema/categories';
18+
19+
export { default as conversationTagSchema } from './schema/conversationTag';
20+
export type { IConversationTag } from './schema/conversationTag';
21+
22+
export { default as convoSchema } from './schema/convo';
23+
export type { IConversation } from './schema/convo';
24+
25+
export { default as fileSchema } from './schema/file';
26+
export type { IMongoFile } from './schema/file';
27+
28+
export { default as keySchema } from './schema/key';
29+
export type { IKey } from './schema/key';
30+
31+
export { default as messageSchema } from './schema/message';
32+
export type { IMessage } from './schema/message';
33+
34+
export { default as pluginAuthSchema } from './schema/pluginAuth';
35+
export type { IPluginAuth } from './schema/pluginAuth';
36+
37+
export { default as presetSchema } from './schema/preset';
38+
export type { IPreset } from './schema/preset';
39+
40+
export { default as projectSchema } from './schema/project';
41+
export type { IMongoProject } from './schema/project';
42+
43+
export { default as promptSchema } from './schema/prompt';
44+
export type { IPrompt } from './schema/prompt';
45+
46+
export { default as promptGroupSchema } from './schema/promptGroup';
47+
export type { IPromptGroup, IPromptGroupDocument } from './schema/promptGroup';
48+
49+
export { default as roleSchema } from './schema/role';
50+
export type { IRole } from './schema/role';
51+
52+
export { default as sessionSchema } from './schema/session';
53+
export type { ISession } from './schema/session';
54+
55+
export { default as shareSchema } from './schema/share';
56+
export type { ISharedLink } from './schema/share';
57+
58+
export { default as tokenSchema } from './schema/token';
59+
export type { IToken } from './schema/token';
60+
61+
export { default as toolCallSchema } from './schema/toolCall';
62+
export type { IToolCallData } from './schema/toolCall';
63+
64+
export { default as transactionSchema } from './schema/transaction';
65+
export type { ITransaction } from './schema/transaction';
66+
67+
export { default as userSchema } from './schema/user';
68+
export type { IUser } from './schema/user';
Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
{
22
"compilerOptions": {
3-
"declaration": true,
4-
"declarationDir": "./dist/types",
5-
"module": "esnext",
6-
"noImplicitAny": true,
7-
"outDir": "./dist",
8-
"target": "es2015",
3+
"target": "ES2019",
4+
"module": "ESNext",
95
"moduleResolution": "node",
10-
"lib": ["es2017", "dom", "ES2021.String"],
11-
"skipLibCheck": true,
12-
"esModuleInterop": true,
6+
"declaration": true,
7+
"declarationDir": "dist/types",
8+
"outDir": "dist",
139
"strict": true,
10+
"esModuleInterop": true,
11+
"allowSyntheticDefaultImports": true,
12+
"skipLibCheck": true,
1413
"forceConsistentCasingInFileNames": true,
1514
"resolveJsonModule": true,
16-
"isolatedModules": true,
17-
"noEmit": false,
18-
"sourceMap": true,
19-
"baseUrl": "."
20-
},
21-
"ts-node": {
22-
"experimentalSpecifierResolution": "node",
23-
"transpileOnly": true,
24-
"esm": true
15+
"sourceMap": true
2516
},
26-
"exclude": ["node_modules", "dist", "types"],
27-
"include": ["src/**/*", "types/index.d.ts", "types/react-query/index.d.ts"]
17+
"include": ["src/**/*"],
18+
"exclude": ["node_modules", "dist", "tests"]
2819
}

0 commit comments

Comments
 (0)