@librechat/data-schemas 0.0.31 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1159 -147
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +1146 -147
- package/dist/index.es.js.map +1 -1
- package/dist/types/app/endpoints.d.ts +0 -1
- package/dist/types/app/index.d.ts +1 -0
- package/dist/types/app/vertex.d.ts +19 -0
- package/dist/types/crypto/index.d.ts +52 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/methods/aclEntry.d.ts +4 -0
- package/dist/types/methods/file.d.ts +55 -0
- package/dist/types/methods/file.spec.d.ts +1 -0
- package/dist/types/methods/index.d.ts +9 -4
- package/dist/types/methods/key.d.ts +55 -0
- package/dist/types/methods/mcpServer.d.ts +57 -0
- package/dist/types/methods/mcpServer.spec.d.ts +1 -0
- package/dist/types/methods/session.d.ts +3 -1
- package/dist/types/methods/user.d.ts +4 -1
- package/dist/types/models/index.d.ts +1 -0
- package/dist/types/models/mcpServer.d.ts +30 -0
- package/dist/types/models/plugins/mongoMeili.d.ts +2 -13
- package/dist/types/models/plugins/mongoMeili.spec.d.ts +1 -0
- package/dist/types/schema/banner.d.ts +1 -0
- package/dist/types/schema/mcpServer.d.ts +37 -0
- package/dist/types/schema/preset.d.ts +0 -1
- package/dist/types/types/agent.d.ts +2 -0
- package/dist/types/types/app.d.ts +8 -5
- package/dist/types/types/banner.d.ts +1 -0
- package/dist/types/types/convo.d.ts +0 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/mcp.d.ts +34 -0
- package/dist/types/types/message.d.ts +1 -0
- package/dist/types/types/session.d.ts +6 -0
- package/dist/types/types/user.d.ts +5 -0
- package/package.json +1 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TCustomConfig, TVertexAISchema, TVertexAIConfig } from 'librechat-data-provider';
|
|
2
|
+
/**
|
|
3
|
+
* Default Vertex AI models available through Google Cloud
|
|
4
|
+
* These are the standard Anthropic model names as served by Vertex AI
|
|
5
|
+
*/
|
|
6
|
+
export declare const defaultVertexModels: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Validates and processes Vertex AI configuration
|
|
9
|
+
* @param vertexConfig - The Vertex AI configuration object
|
|
10
|
+
* @returns Validated configuration with errors if any
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateVertexConfig(vertexConfig: TVertexAISchema | undefined): TVertexAIConfig | null;
|
|
13
|
+
/**
|
|
14
|
+
* Sets up the Vertex AI configuration from the config (`librechat.yaml`) file.
|
|
15
|
+
* Similar to azureConfigSetup, this processes and validates the Vertex AI configuration.
|
|
16
|
+
* @param config - The loaded custom configuration.
|
|
17
|
+
* @returns The validated Vertex AI configuration or null if not configured.
|
|
18
|
+
*/
|
|
19
|
+
export declare function vertexConfigSetup(config: Partial<TCustomConfig>): TVertexAIConfig | null;
|
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
1
2
|
import { SignPayloadParams } from '~/types';
|
|
2
3
|
export declare function signPayload({ payload, secret, expirationTime, }: SignPayloadParams): Promise<string>;
|
|
3
4
|
export declare function hashToken(str: string): Promise<string>;
|
|
5
|
+
/** --- Legacy v1/v2 Setup: AES-CBC with fixed key and IV --- */
|
|
6
|
+
/**
|
|
7
|
+
* Encrypts a value using AES-CBC
|
|
8
|
+
* @param value - The plaintext to encrypt
|
|
9
|
+
* @returns The encrypted string in hex format
|
|
10
|
+
*/
|
|
11
|
+
export declare function encrypt(value: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Decrypts an encrypted value using AES-CBC
|
|
14
|
+
* @param encryptedValue - The encrypted string in hex format
|
|
15
|
+
* @returns The decrypted plaintext
|
|
16
|
+
*/
|
|
17
|
+
export declare function decrypt(encryptedValue: string): Promise<string>;
|
|
18
|
+
/** --- v2: AES-CBC with a random IV per encryption --- */
|
|
19
|
+
/**
|
|
20
|
+
* Encrypts a value using AES-CBC with a random IV per encryption
|
|
21
|
+
* @param value - The plaintext to encrypt
|
|
22
|
+
* @returns The encrypted string with IV prepended (iv:ciphertext format)
|
|
23
|
+
*/
|
|
24
|
+
export declare function encryptV2(value: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Decrypts an encrypted value using AES-CBC with random IV
|
|
27
|
+
* @param encryptedValue - The encrypted string in iv:ciphertext format
|
|
28
|
+
* @returns The decrypted plaintext
|
|
29
|
+
*/
|
|
30
|
+
export declare function decryptV2(encryptedValue: string): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Encrypts a value using AES-256-CTR.
|
|
33
|
+
* Note: AES-256 requires a 32-byte key. Ensure that process.env.CREDS_KEY is a 64-character hex string.
|
|
34
|
+
* @param value - The plaintext to encrypt.
|
|
35
|
+
* @returns The encrypted string with a "v3:" prefix.
|
|
36
|
+
*/
|
|
37
|
+
export declare function encryptV3(value: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Decrypts an encrypted value using AES-256-CTR.
|
|
40
|
+
* @param encryptedValue - The encrypted string with "v3:" prefix.
|
|
41
|
+
* @returns The decrypted plaintext.
|
|
42
|
+
*/
|
|
43
|
+
export declare function decryptV3(encryptedValue: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Generates random values as a hex string
|
|
46
|
+
* @param length - The number of random bytes to generate
|
|
47
|
+
* @returns The random values as a hex string
|
|
48
|
+
*/
|
|
49
|
+
export declare function getRandomValues(length: number): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Computes SHA-256 hash for the given input.
|
|
52
|
+
* @param input - The input to hash.
|
|
53
|
+
* @returns The SHA-256 hash of the input.
|
|
54
|
+
*/
|
|
55
|
+
export declare function hashBackupCode(input: string): Promise<string>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './crypto';
|
|
|
4
4
|
export * from './schema';
|
|
5
5
|
export * from './utils';
|
|
6
6
|
export { createModels } from './models';
|
|
7
|
-
export { createMethods } from './methods';
|
|
7
|
+
export { createMethods, DEFAULT_REFRESH_TOKEN_EXPIRY, DEFAULT_SESSION_EXPIRY } from './methods';
|
|
8
8
|
export type * from './types';
|
|
9
9
|
export type * from './methods';
|
|
10
10
|
export { default as logger } from './config/winston';
|
|
@@ -41,6 +41,10 @@ export declare function createAclEntryMethods(mongoose: typeof import('mongoose'
|
|
|
41
41
|
principalType: string;
|
|
42
42
|
principalId?: string | Types.ObjectId;
|
|
43
43
|
}>, resourceType: string, resourceId: string | Types.ObjectId) => Promise<number>;
|
|
44
|
+
getEffectivePermissionsForResources: (principalsList: Array<{
|
|
45
|
+
principalType: string;
|
|
46
|
+
principalId?: string | Types.ObjectId;
|
|
47
|
+
}>, resourceType: string, resourceIds: Array<string | Types.ObjectId>) => Promise<Map<string, number>>;
|
|
44
48
|
grantPermission: (principalType: string, principalId: string | Types.ObjectId | null, resourceType: string, resourceId: string | Types.ObjectId, permBits: number, grantedBy: string | Types.ObjectId, session?: ClientSession, roleId?: string | Types.ObjectId) => Promise<IAclEntry | null>;
|
|
45
49
|
revokePermission: (principalType: string, principalId: string | Types.ObjectId | null, resourceType: string, resourceId: string | Types.ObjectId, session?: ClientSession) => Promise<DeleteResult>;
|
|
46
50
|
modifyPermissionBits: (principalType: string, principalId: string | Types.ObjectId | null, resourceType: string, resourceId: string | Types.ObjectId, addBits?: number | null, removeBits?: number | null, session?: ClientSession) => Promise<IAclEntry | null>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import { EToolResources } from 'librechat-data-provider';
|
|
27
|
+
import type { FilterQuery, SortOrder } from 'mongoose';
|
|
28
|
+
import type { IMongoFile } from '~/types/file';
|
|
29
|
+
/** Factory function that takes mongoose instance and returns the file methods */
|
|
30
|
+
export declare function createFileMethods(mongoose: typeof import('mongoose')): {
|
|
31
|
+
findFileById: (file_id: string, options?: Record<string, unknown>) => Promise<IMongoFile | null>;
|
|
32
|
+
getFiles: (filter: FilterQuery<IMongoFile>, _sortOptions?: Record<string, SortOrder> | null, selectFields?: string | Record<string, 0 | 1> | null | undefined) => Promise<IMongoFile[] | null>;
|
|
33
|
+
getToolFilesByIds: (fileIds: string[], toolResourceSet?: Set<EToolResources>) => Promise<IMongoFile[]>;
|
|
34
|
+
createFile: (data: Partial<IMongoFile>, disableTTL?: boolean) => Promise<IMongoFile | null>;
|
|
35
|
+
updateFile: (data: Partial<IMongoFile> & {
|
|
36
|
+
file_id: string;
|
|
37
|
+
}) => Promise<IMongoFile | null>;
|
|
38
|
+
updateFileUsage: (data: {
|
|
39
|
+
file_id: string;
|
|
40
|
+
inc?: number;
|
|
41
|
+
}) => Promise<IMongoFile | null>;
|
|
42
|
+
deleteFile: (file_id: string) => Promise<IMongoFile | null>;
|
|
43
|
+
deleteFiles: (file_ids: string[], user?: string) => Promise<{
|
|
44
|
+
deletedCount?: number;
|
|
45
|
+
}>;
|
|
46
|
+
deleteFileByFilter: (filter: FilterQuery<IMongoFile>) => Promise<IMongoFile | null>;
|
|
47
|
+
batchUpdateFiles: (updates: Array<{
|
|
48
|
+
file_id: string;
|
|
49
|
+
filepath: string;
|
|
50
|
+
}>) => Promise<void>;
|
|
51
|
+
updateFilesUsage: (files: Array<{
|
|
52
|
+
file_id: string;
|
|
53
|
+
}>, fileIds?: string[]) => Promise<IMongoFile[]>;
|
|
54
|
+
};
|
|
55
|
+
export type FileMethods = ReturnType<typeof createFileMethods>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -24,20 +24,25 @@
|
|
|
24
24
|
/// <reference types="mongoose" />
|
|
25
25
|
/// <reference types="mongoose/types/inferschematype" />
|
|
26
26
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
27
|
-
import { type SessionMethods } from './session';
|
|
27
|
+
import { DEFAULT_REFRESH_TOKEN_EXPIRY, type SessionMethods } from './session';
|
|
28
28
|
import { type TokenMethods } from './token';
|
|
29
29
|
import { type RoleMethods } from './role';
|
|
30
|
-
import { type UserMethods } from './user';
|
|
30
|
+
import { DEFAULT_SESSION_EXPIRY, type UserMethods } from './user';
|
|
31
|
+
export { DEFAULT_REFRESH_TOKEN_EXPIRY, DEFAULT_SESSION_EXPIRY };
|
|
32
|
+
import { type KeyMethods } from './key';
|
|
33
|
+
import { type FileMethods } from './file';
|
|
31
34
|
import { type MemoryMethods } from './memory';
|
|
32
35
|
import { type AgentCategoryMethods } from './agentCategory';
|
|
36
|
+
import { type MCPServerMethods } from './mcpServer';
|
|
33
37
|
import { type PluginAuthMethods } from './pluginAuth';
|
|
34
38
|
import { type AccessRoleMethods } from './accessRole';
|
|
35
39
|
import { type UserGroupMethods } from './userGroup';
|
|
36
40
|
import { type AclEntryMethods } from './aclEntry';
|
|
37
41
|
import { type ShareMethods } from './share';
|
|
38
|
-
export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & MemoryMethods & AgentCategoryMethods & UserGroupMethods & AclEntryMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods;
|
|
42
|
+
export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & KeyMethods & FileMethods & MemoryMethods & AgentCategoryMethods & MCPServerMethods & UserGroupMethods & AclEntryMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods;
|
|
39
43
|
/**
|
|
40
44
|
* Creates all database methods for all collections
|
|
45
|
+
* @param mongoose - Mongoose instance
|
|
41
46
|
*/
|
|
42
47
|
export declare function createMethods(mongoose: typeof import('mongoose')): AllMethods;
|
|
43
|
-
export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, MemoryMethods, AgentCategoryMethods, UserGroupMethods, AclEntryMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, };
|
|
48
|
+
export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, KeyMethods, FileMethods, MemoryMethods, AgentCategoryMethods, MCPServerMethods, UserGroupMethods, AclEntryMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
27
|
+
/** Factory function that takes mongoose instance and returns the key methods */
|
|
28
|
+
export declare function createKeyMethods(mongoose: typeof import('mongoose')): {
|
|
29
|
+
getUserKey: (params: {
|
|
30
|
+
userId: string;
|
|
31
|
+
name: string;
|
|
32
|
+
}) => Promise<string>;
|
|
33
|
+
updateUserKey: (params: {
|
|
34
|
+
userId: string;
|
|
35
|
+
name: string;
|
|
36
|
+
value: string;
|
|
37
|
+
expiresAt?: Date | null;
|
|
38
|
+
}) => Promise<unknown>;
|
|
39
|
+
deleteUserKey: (params: {
|
|
40
|
+
userId: string;
|
|
41
|
+
name?: string;
|
|
42
|
+
all?: boolean;
|
|
43
|
+
}) => Promise<unknown>;
|
|
44
|
+
getUserKeyValues: (params: {
|
|
45
|
+
userId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}) => Promise<Record<string, string>>;
|
|
48
|
+
getUserKeyExpiry: (params: {
|
|
49
|
+
userId: string;
|
|
50
|
+
name: string;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
expiresAt: Date | 'never' | null;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
export type KeyMethods = ReturnType<typeof createKeyMethods>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import type { RootFilterQuery, Types } from 'mongoose';
|
|
27
|
+
import type { MCPServerDocument } from '../types';
|
|
28
|
+
import type { MCPOptions } from 'librechat-data-provider';
|
|
29
|
+
export declare function createMCPServerMethods(mongoose: typeof import('mongoose')): {
|
|
30
|
+
createMCPServer: (data: {
|
|
31
|
+
config: MCPOptions;
|
|
32
|
+
author: string | Types.ObjectId;
|
|
33
|
+
}) => Promise<MCPServerDocument>;
|
|
34
|
+
findMCPServerByServerName: (serverName: string) => Promise<MCPServerDocument | null>;
|
|
35
|
+
findMCPServerByObjectId: (_id: string | Types.ObjectId) => Promise<MCPServerDocument | null>;
|
|
36
|
+
findMCPServersByAuthor: (authorId: string | Types.ObjectId) => Promise<MCPServerDocument[]>;
|
|
37
|
+
getListMCPServersByIds: ({ ids, otherParams, limit, after, }: {
|
|
38
|
+
ids?: Types.ObjectId[] | undefined;
|
|
39
|
+
otherParams?: RootFilterQuery<MCPServerDocument> | undefined;
|
|
40
|
+
limit?: number | null | undefined;
|
|
41
|
+
after?: string | null | undefined;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
data: MCPServerDocument[];
|
|
44
|
+
has_more: boolean;
|
|
45
|
+
after: string | null;
|
|
46
|
+
}>;
|
|
47
|
+
getListMCPServersByNames: ({ names }: {
|
|
48
|
+
names: string[];
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
data: MCPServerDocument[];
|
|
51
|
+
}>;
|
|
52
|
+
updateMCPServer: (serverName: string, updateData: {
|
|
53
|
+
config?: MCPOptions;
|
|
54
|
+
}) => Promise<MCPServerDocument | null>;
|
|
55
|
+
deleteMCPServer: (serverName: string) => Promise<MCPServerDocument | null>;
|
|
56
|
+
};
|
|
57
|
+
export type MCPServerMethods = ReturnType<typeof createMCPServerMethods>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -29,6 +29,8 @@ export declare class SessionError extends Error {
|
|
|
29
29
|
code: string;
|
|
30
30
|
constructor(message: string, code?: string);
|
|
31
31
|
}
|
|
32
|
+
/** Default refresh token expiry: 7 days in milliseconds */
|
|
33
|
+
export declare const DEFAULT_REFRESH_TOKEN_EXPIRY: number;
|
|
32
34
|
export declare function createSessionMethods(mongoose: typeof import('mongoose')): {
|
|
33
35
|
findSession: (params: t.SessionSearchParams, options?: t.SessionQueryOptions) => Promise<t.ISession | null>;
|
|
34
36
|
SessionError: typeof SessionError;
|
|
@@ -36,7 +38,7 @@ export declare function createSessionMethods(mongoose: typeof import('mongoose')
|
|
|
36
38
|
deletedCount?: number;
|
|
37
39
|
}>;
|
|
38
40
|
createSession: (userId: string, options?: t.CreateSessionOptions) => Promise<t.SessionResult>;
|
|
39
|
-
updateExpiration: (session: t.ISession | string, newExpiration?: Date) => Promise<t.ISession>;
|
|
41
|
+
updateExpiration: (session: t.ISession | string, newExpiration?: Date, options?: t.UpdateExpirationOptions) => Promise<t.ISession>;
|
|
40
42
|
countActiveSessions: (userId: string) => Promise<number>;
|
|
41
43
|
generateRefreshToken: (session: t.ISession) => Promise<string>;
|
|
42
44
|
deleteAllUserSessions: (userId: string | {
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
import { FilterQuery } from 'mongoose';
|
|
27
27
|
import type { IUser, BalanceConfig, CreateUserRequest, UserDeleteResult } from '~/types';
|
|
28
|
+
/** Default JWT session expiry: 15 minutes in milliseconds */
|
|
29
|
+
export declare const DEFAULT_SESSION_EXPIRY: number;
|
|
28
30
|
/** Factory function that takes mongoose instance and returns the methods */
|
|
29
31
|
export declare function createUserMethods(mongoose: typeof import('mongoose')): {
|
|
30
32
|
findUser: (searchCriteria: FilterQuery<IUser>, fieldsToSelect?: string | string[] | null) => Promise<IUser | null>;
|
|
@@ -40,8 +42,9 @@ export declare function createUserMethods(mongoose: typeof import('mongoose')):
|
|
|
40
42
|
__v: number;
|
|
41
43
|
}[]>;
|
|
42
44
|
getUserById: (userId: string, fieldsToSelect?: string | string[] | null) => Promise<IUser | null>;
|
|
43
|
-
generateToken: (user: IUser) => Promise<string>;
|
|
45
|
+
generateToken: (user: IUser, expiresIn?: number) => Promise<string>;
|
|
44
46
|
deleteUserById: (userId: string) => Promise<UserDeleteResult>;
|
|
47
|
+
updateUserPlugins: (userId: string, plugins: string[] | undefined, pluginKey: string, action: 'install' | 'uninstall') => Promise<IUser | null>;
|
|
45
48
|
toggleUserMemories: (userId: string, memoriesEnabled: boolean) => Promise<IUser | null>;
|
|
46
49
|
};
|
|
47
50
|
export type UserMethods = ReturnType<typeof createUserMethods>;
|
|
@@ -36,6 +36,7 @@ export declare function createModels(mongoose: typeof import('mongoose')): {
|
|
|
36
36
|
Message: import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
37
37
|
Agent: import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
38
38
|
AgentCategory: import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
39
|
+
MCPServer: import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
39
40
|
Role: import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
40
41
|
Action: import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
41
42
|
Assistant: import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
27
|
+
/**
|
|
28
|
+
* Creates or returns the MCPServer model using the provided mongoose instance and schema
|
|
29
|
+
*/
|
|
30
|
+
export declare function createMCPServerModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
@@ -57,20 +57,9 @@ interface _DocumentWithMeiliIndex extends Document {
|
|
|
57
57
|
}
|
|
58
58
|
export type DocumentWithMeiliIndex = _DocumentWithMeiliIndex & IConversation & Partial<IMessage>;
|
|
59
59
|
export interface SchemaWithMeiliMethods extends Model<DocumentWithMeiliIndex> {
|
|
60
|
-
syncWithMeili(
|
|
61
|
-
resumeFromId?: string;
|
|
62
|
-
}): Promise<void>;
|
|
60
|
+
syncWithMeili(): Promise<void>;
|
|
63
61
|
getSyncProgress(): Promise<SyncProgress>;
|
|
64
|
-
processSyncBatch(index: Index<MeiliIndexable>, documents: Array<Record<string, unknown
|
|
65
|
-
updateOne: {
|
|
66
|
-
filter: Record<string, unknown>;
|
|
67
|
-
update: {
|
|
68
|
-
$set: {
|
|
69
|
-
_meiliIndex: boolean;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
}>): Promise<void>;
|
|
62
|
+
processSyncBatch(index: Index<MeiliIndexable>, documents: Array<Record<string, unknown>>): Promise<void>;
|
|
74
63
|
cleanupMeiliIndex(index: Index<MeiliIndexable>, primaryKey: string, batchSize: number, delayMs: number): Promise<void>;
|
|
75
64
|
setMeiliIndexSettings(settings: Record<string, unknown>): Promise<unknown>;
|
|
76
65
|
meiliSearch(q: string, params?: SearchParams, populate?: boolean): Promise<SearchResponse<MeiliIndexable, Record<string, unknown>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -31,6 +31,7 @@ export interface IBanner extends Document {
|
|
|
31
31
|
displayTo?: Date;
|
|
32
32
|
type: 'banner' | 'popup';
|
|
33
33
|
isPublic: boolean;
|
|
34
|
+
persistable: boolean;
|
|
34
35
|
}
|
|
35
36
|
declare const bannerSchema: Schema<IBanner, import("mongoose").Model<IBanner, any, any, any, Document<unknown, any, IBanner> & IBanner & Required<{
|
|
36
37
|
_id: unknown;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import { Schema } from 'mongoose';
|
|
27
|
+
import type { MCPServerDocument } from '~/types';
|
|
28
|
+
declare const mcpServerSchema: Schema<MCPServerDocument, import("mongoose").Model<MCPServerDocument, any, any, any, import("mongoose").Document<unknown, any, MCPServerDocument> & MCPServerDocument & Required<{
|
|
29
|
+
_id: import("mongoose").Types.ObjectId;
|
|
30
|
+
}> & {
|
|
31
|
+
__v: number;
|
|
32
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, MCPServerDocument, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<MCPServerDocument>> & import("mongoose").FlatRecord<MCPServerDocument> & Required<{
|
|
33
|
+
_id: import("mongoose").Types.ObjectId;
|
|
34
|
+
}> & {
|
|
35
|
+
__v: number;
|
|
36
|
+
}>;
|
|
37
|
+
export default mcpServerSchema;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TEndpoint, FileSources, TFileConfig, TAzureConfig, TCustomConfig, TMemoryConfig, TAssistantEndpoint } from 'librechat-data-provider';
|
|
1
|
+
import type { TEndpoint, FileSources, TFileConfig, TAzureConfig, TCustomConfig, TMemoryConfig, TVertexAIConfig, TAssistantEndpoint, TAnthropicEndpoint } from 'librechat-data-provider';
|
|
2
2
|
export type JsonSchemaType = {
|
|
3
3
|
type: 'string' | 'number' | 'integer' | 'float' | 'boolean' | 'array' | 'object';
|
|
4
4
|
enum?: string[];
|
|
@@ -67,6 +67,8 @@ export interface AppConfig {
|
|
|
67
67
|
speech?: TCustomConfig['speech'];
|
|
68
68
|
/** MCP server configuration */
|
|
69
69
|
mcpConfig?: TCustomConfig['mcpServers'] | null;
|
|
70
|
+
/** MCP settings (domain allowlist, etc.) */
|
|
71
|
+
mcpSettings?: TCustomConfig['mcpSettings'] | null;
|
|
70
72
|
/** File configuration */
|
|
71
73
|
fileConfig?: TFileConfig;
|
|
72
74
|
/** Secure image links configuration */
|
|
@@ -82,10 +84,11 @@ export interface AppConfig {
|
|
|
82
84
|
google?: Partial<TEndpoint>;
|
|
83
85
|
/** Bedrock endpoint configuration */
|
|
84
86
|
bedrock?: Partial<TEndpoint>;
|
|
85
|
-
/** Anthropic endpoint configuration */
|
|
86
|
-
anthropic?: Partial<
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
/** Anthropic endpoint configuration with optional Vertex AI support */
|
|
88
|
+
anthropic?: Partial<TAnthropicEndpoint> & {
|
|
89
|
+
/** Validated Vertex AI configuration */
|
|
90
|
+
vertexConfig?: TVertexAIConfig;
|
|
91
|
+
};
|
|
89
92
|
/** Azure OpenAI endpoint configuration */
|
|
90
93
|
azureOpenAI?: TAzureConfig;
|
|
91
94
|
/** Assistants endpoint configuration */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import { Document, Types } from 'mongoose';
|
|
27
|
+
import type { MCPServerDB } from 'librechat-data-provider';
|
|
28
|
+
/**
|
|
29
|
+
* Mongoose document interface for MCP Server
|
|
30
|
+
* Extends API interface with Mongoose-specific database fields
|
|
31
|
+
*/
|
|
32
|
+
export interface MCPServerDocument extends Omit<MCPServerDB, 'author' | '_id'>, Document<Types.ObjectId> {
|
|
33
|
+
author: Types.ObjectId;
|
|
34
|
+
}
|
|
@@ -31,6 +31,12 @@ export interface ISession extends Document {
|
|
|
31
31
|
}
|
|
32
32
|
export interface CreateSessionOptions {
|
|
33
33
|
expiration?: Date;
|
|
34
|
+
/** Duration in milliseconds for session expiry. Default: 7 days */
|
|
35
|
+
expiresIn?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface UpdateExpirationOptions {
|
|
38
|
+
/** Duration in milliseconds for session expiry. Default: 7 days */
|
|
39
|
+
expiresIn?: number;
|
|
34
40
|
}
|
|
35
41
|
export interface SessionSearchParams {
|
|
36
42
|
refreshToken?: string;
|
|
@@ -58,6 +58,11 @@ export interface IUser extends Document {
|
|
|
58
58
|
personalization?: {
|
|
59
59
|
memories?: boolean;
|
|
60
60
|
};
|
|
61
|
+
favorites?: Array<{
|
|
62
|
+
agentId?: string;
|
|
63
|
+
model?: string;
|
|
64
|
+
endpoint?: string;
|
|
65
|
+
}>;
|
|
61
66
|
createdAt?: Date;
|
|
62
67
|
updatedAt?: Date;
|
|
63
68
|
/** Field for external source identification (for consistency with TPrincipal schema) */
|