@librechat/data-schemas 0.0.16 → 0.0.17
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 +1 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +1 -109
- package/dist/index.es.js.map +1 -1
- package/dist/types/methods/index.d.ts +3 -159
- package/dist/types/schema/group.d.ts +2 -2
- package/dist/types/types/group.d.ts +2 -1
- package/package.json +1 -1
- package/dist/types/methods/group.d.ts +0 -40
- package/dist/types/methods/group.spec.d.ts +0 -1
|
@@ -34,166 +34,10 @@ import { type PluginAuthMethods } from './pluginAuth';
|
|
|
34
34
|
import { type AccessRoleMethods } from './accessRole';
|
|
35
35
|
import { type UserGroupMethods } from './userGroup';
|
|
36
36
|
import { type AclEntryMethods } from './aclEntry';
|
|
37
|
-
import { type GroupMethods } from './group';
|
|
38
37
|
import { type ShareMethods } from './share';
|
|
38
|
+
export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & MemoryMethods & AgentCategoryMethods & UserGroupMethods & AclEntryMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods;
|
|
39
39
|
/**
|
|
40
40
|
* Creates all database methods for all collections
|
|
41
41
|
*/
|
|
42
|
-
export declare function createMethods(mongoose: typeof import('mongoose')):
|
|
43
|
-
|
|
44
|
-
findPluginAuthsByKeys: ({ userId, pluginKeys, }: import("..").FindPluginAuthsByKeysParams) => Promise<import("..").IPluginAuth[]>;
|
|
45
|
-
updatePluginAuth: ({ userId, authField, pluginKey, value, }: import("..").UpdatePluginAuthParams) => Promise<import("..").IPluginAuth>;
|
|
46
|
-
deletePluginAuth: ({ userId, authField, pluginKey, all, }: import("..").DeletePluginAuthParams) => Promise<import("mongodb").DeleteResult>;
|
|
47
|
-
deleteAllUserPluginAuths: (userId: string) => Promise<import("mongodb").DeleteResult>;
|
|
48
|
-
getSharedLink: (user: string, conversationId: string) => Promise<import("..").GetShareLinkResult>;
|
|
49
|
-
getSharedLinks: (user: string, pageParam?: Date | undefined, pageSize?: number, isPublic?: boolean, sortBy?: string, sortDirection?: string, search?: string | undefined) => Promise<import("..").SharedLinksResult>;
|
|
50
|
-
createSharedLink: (user: string, conversationId: string) => Promise<import("..").CreateShareResult>;
|
|
51
|
-
updateSharedLink: (user: string, shareId: string) => Promise<import("..").UpdateShareResult>;
|
|
52
|
-
deleteSharedLink: (user: string, shareId: string) => Promise<import("..").DeleteShareResult | null>;
|
|
53
|
-
getSharedMessages: (shareId: string) => Promise<import("..").SharedMessagesResult | null>;
|
|
54
|
-
deleteAllSharedLinks: (user: string) => Promise<import("..").DeleteAllSharesResult>;
|
|
55
|
-
createGroup: (groupData: Partial<import("..").IGroup>) => Promise<import("..").IGroup>;
|
|
56
|
-
updateGroup: (groupId: string | import("mongoose").Types.ObjectId, updateData: Partial<import("..").IGroup>) => Promise<import("..").IGroup | null>;
|
|
57
|
-
deleteGroup: (groupId: string | import("mongoose").Types.ObjectId) => Promise<import("mongodb").DeleteResult>;
|
|
58
|
-
getAllGroups: () => Promise<import("..").IGroup[]>;
|
|
59
|
-
findGroupById: (groupId: string | import("mongoose").Types.ObjectId) => Promise<import("..").IGroup | null>;
|
|
60
|
-
addMemberToGroup: (groupId: string | import("mongoose").Types.ObjectId, memberId: string) => Promise<import("..").IGroup | null>;
|
|
61
|
-
findGroupsBySource: (source: "local" | "entra") => Promise<import("..").IGroup[]>;
|
|
62
|
-
removeMemberFromGroup: (groupId: string | import("mongoose").Types.ObjectId, memberId: string) => Promise<import("..").IGroup | null>;
|
|
63
|
-
findGroupsByMemberId: (memberId: string) => Promise<import("..").IGroup[]>;
|
|
64
|
-
findGroupByExternalId: (idOnTheSource: string, source?: "local" | "entra") => Promise<import("..").IGroup | null>;
|
|
65
|
-
findEntriesByPrincipal: (principalType: string, principalId: string | import("mongoose").Types.ObjectId, resourceType?: string | undefined) => Promise<import("..").IAclEntry[]>;
|
|
66
|
-
findEntriesByResource: (resourceType: string, resourceId: string | import("mongoose").Types.ObjectId) => Promise<import("..").IAclEntry[]>;
|
|
67
|
-
findEntriesByPrincipalsAndResource: (principalsList: {
|
|
68
|
-
principalType: string;
|
|
69
|
-
principalId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
70
|
-
}[], resourceType: string, resourceId: string | import("mongoose").Types.ObjectId) => Promise<import("..").IAclEntry[]>;
|
|
71
|
-
hasPermission: (principalsList: {
|
|
72
|
-
principalType: string;
|
|
73
|
-
principalId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
74
|
-
}[], resourceType: string, resourceId: string | import("mongoose").Types.ObjectId, permissionBit: number) => Promise<boolean>;
|
|
75
|
-
getEffectivePermissions: (principalsList: {
|
|
76
|
-
principalType: string;
|
|
77
|
-
principalId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
78
|
-
}[], resourceType: string, resourceId: string | import("mongoose").Types.ObjectId) => Promise<number>;
|
|
79
|
-
grantPermission: (principalType: string, principalId: string | import("mongoose").Types.ObjectId | null, resourceType: string, resourceId: string | import("mongoose").Types.ObjectId, permBits: number, grantedBy: string | import("mongoose").Types.ObjectId, session?: import("mongodb").ClientSession | undefined, roleId?: string | import("mongoose").Types.ObjectId | undefined) => Promise<import("..").IAclEntry | null>;
|
|
80
|
-
revokePermission: (principalType: string, principalId: string | import("mongoose").Types.ObjectId | null, resourceType: string, resourceId: string | import("mongoose").Types.ObjectId, session?: import("mongodb").ClientSession | undefined) => Promise<import("mongodb").DeleteResult>;
|
|
81
|
-
modifyPermissionBits: (principalType: string, principalId: string | import("mongoose").Types.ObjectId | null, resourceType: string, resourceId: string | import("mongoose").Types.ObjectId, addBits?: number | null | undefined, removeBits?: number | null | undefined, session?: import("mongodb").ClientSession | undefined) => Promise<import("..").IAclEntry | null>;
|
|
82
|
-
findAccessibleResources: (principalsList: {
|
|
83
|
-
principalType: string;
|
|
84
|
-
principalId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
85
|
-
}[], resourceType: string, requiredPermBit: number) => Promise<import("mongoose").Types.ObjectId[]>;
|
|
86
|
-
findGroupsByNamePattern: (namePattern: string, source?: "local" | "entra" | null, limit?: number, session?: import("mongodb").ClientSession | undefined) => Promise<import("..").IGroup[]>;
|
|
87
|
-
upsertGroupByExternalId: (idOnTheSource: string, source: "local" | "entra", updateData: Partial<import("..").IGroup>, session?: import("mongodb").ClientSession | undefined) => Promise<import("..").IGroup | null>;
|
|
88
|
-
addUserToGroup: (userId: string | import("mongoose").Types.ObjectId, groupId: string | import("mongoose").Types.ObjectId, session?: import("mongodb").ClientSession | undefined) => Promise<{
|
|
89
|
-
user: import("..").IUser;
|
|
90
|
-
group: import("..").IGroup | null;
|
|
91
|
-
}>;
|
|
92
|
-
removeUserFromGroup: (userId: string | import("mongoose").Types.ObjectId, groupId: string | import("mongoose").Types.ObjectId, session?: import("mongodb").ClientSession | undefined) => Promise<{
|
|
93
|
-
user: import("..").IUser;
|
|
94
|
-
group: import("..").IGroup | null;
|
|
95
|
-
}>;
|
|
96
|
-
getUserGroups: (userId: string | import("mongoose").Types.ObjectId, session?: import("mongodb").ClientSession | undefined) => Promise<import("..").IGroup[]>;
|
|
97
|
-
getUserPrincipals: (params: {
|
|
98
|
-
userId: string | import("mongoose").Types.ObjectId;
|
|
99
|
-
role?: string | null | undefined;
|
|
100
|
-
}, session?: import("mongodb").ClientSession | undefined) => Promise<{
|
|
101
|
-
principalType: string;
|
|
102
|
-
principalId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
103
|
-
}[]>;
|
|
104
|
-
syncUserEntraGroups: (userId: string | import("mongoose").Types.ObjectId, entraGroups: {
|
|
105
|
-
id: string;
|
|
106
|
-
name: string;
|
|
107
|
-
description?: string | undefined;
|
|
108
|
-
email?: string | undefined;
|
|
109
|
-
}[], session?: import("mongodb").ClientSession | undefined) => Promise<{
|
|
110
|
-
user: import("..").IUser;
|
|
111
|
-
addedGroups: import("..").IGroup[];
|
|
112
|
-
removedGroups: import("..").IGroup[];
|
|
113
|
-
}>;
|
|
114
|
-
searchPrincipals: (searchPattern: string, limitPerType?: number, typeFilter?: any[] | null, session?: import("mongodb").ClientSession | undefined) => Promise<TPrincipalSearchResult[]>;
|
|
115
|
-
calculateRelevanceScore: (item: TPrincipalSearchResult, searchPattern: string) => number;
|
|
116
|
-
sortPrincipalsByRelevance: <T extends {
|
|
117
|
-
_searchScore?: number | undefined;
|
|
118
|
-
type: string;
|
|
119
|
-
name?: string | undefined;
|
|
120
|
-
email?: string | undefined;
|
|
121
|
-
}>(results: T[]) => T[];
|
|
122
|
-
createRole: (roleData: Partial<import("..").IAccessRole>) => Promise<import("..").IAccessRole>;
|
|
123
|
-
updateRole: (accessRoleId: string | import("mongoose").Types.ObjectId, updateData: Partial<import("..").IAccessRole>) => Promise<import("..").IAccessRole | null>;
|
|
124
|
-
deleteRole: (accessRoleId: string | import("mongoose").Types.ObjectId) => Promise<import("mongodb").DeleteResult>;
|
|
125
|
-
getAllRoles: () => Promise<import("..").IAccessRole[]>;
|
|
126
|
-
findRoleById: (roleId: string | import("mongoose").Types.ObjectId) => Promise<import("..").IAccessRole | null>;
|
|
127
|
-
seedDefaultRoles: () => Promise<Record<string, import("..").IAccessRole>>;
|
|
128
|
-
findRoleByIdentifier: (accessRoleId: string | import("mongoose").Types.ObjectId) => Promise<import("..").IAccessRole | null>;
|
|
129
|
-
getRoleForPermissions: (resourceType: string, permBits: any) => Promise<import("..").IAccessRole | null>;
|
|
130
|
-
findRoleByPermissions: (resourceType: string, permBits: any) => Promise<import("..").IAccessRole | null>;
|
|
131
|
-
findRolesByResourceType: (resourceType: string) => Promise<import("..").IAccessRole[]>;
|
|
132
|
-
getActiveCategories: () => Promise<import("..").IAgentCategory[]>;
|
|
133
|
-
getCategoriesWithCounts: () => Promise<(import("..").AgentCategory & import("mongoose").Document<unknown, any, any> & {
|
|
134
|
-
_id: import("mongoose").Types.ObjectId;
|
|
135
|
-
} & {
|
|
136
|
-
agentCount: number;
|
|
137
|
-
})[]>;
|
|
138
|
-
getValidCategoryValues: () => Promise<string[]>;
|
|
139
|
-
seedCategories: (categories: {
|
|
140
|
-
value: string;
|
|
141
|
-
label?: string | undefined;
|
|
142
|
-
description?: string | undefined;
|
|
143
|
-
order?: number | undefined;
|
|
144
|
-
}[]) => Promise<any>;
|
|
145
|
-
findCategoryByValue: (value: string) => Promise<import("..").IAgentCategory | null>;
|
|
146
|
-
createCategory: (categoryData: Partial<import("..").IAgentCategory>) => Promise<import("..").IAgentCategory>;
|
|
147
|
-
updateCategory: (value: string, updateData: Partial<import("..").IAgentCategory>) => Promise<import("..").IAgentCategory | null>;
|
|
148
|
-
deleteCategory: (value: string) => Promise<boolean>;
|
|
149
|
-
findCategoryById: (id: string | import("mongoose").Types.ObjectId) => Promise<import("..").IAgentCategory | null>;
|
|
150
|
-
getAllCategories: () => Promise<import("..").IAgentCategory[]>;
|
|
151
|
-
ensureDefaultCategories: () => Promise<boolean>;
|
|
152
|
-
setMemory: ({ userId, key, value, tokenCount, }: import("..").SetMemoryParams) => Promise<import("..").MemoryResult>;
|
|
153
|
-
createMemory: ({ userId, key, value, tokenCount, }: import("..").SetMemoryParams) => Promise<import("..").MemoryResult>;
|
|
154
|
-
deleteMemory: ({ userId, key }: import("..").DeleteMemoryParams) => Promise<import("..").MemoryResult>;
|
|
155
|
-
getAllUserMemories: (userId: string | import("mongoose").Types.ObjectId) => Promise<import("..").IMemoryEntryLean[]>;
|
|
156
|
-
getFormattedMemories: ({ userId, }: import("..").GetFormattedMemoriesParams) => Promise<import("..").FormattedMemoriesResult>;
|
|
157
|
-
listRoles: () => Promise<(import("mongoose").FlattenMaps<any> & Required<{
|
|
158
|
-
_id: unknown;
|
|
159
|
-
}> & {
|
|
160
|
-
__v: number;
|
|
161
|
-
})[]>;
|
|
162
|
-
initializeRoles: () => Promise<void>;
|
|
163
|
-
findToken: (query: import("..").TokenQuery) => Promise<import("..").IToken | null>;
|
|
164
|
-
createToken: (tokenData: import("..").TokenCreateData) => Promise<import("..").IToken>;
|
|
165
|
-
updateToken: (query: import("..").TokenQuery, updateData: import("..").TokenUpdateData) => Promise<import("..").IToken | null>;
|
|
166
|
-
deleteTokens: (query: import("..").TokenQuery) => Promise<import("..").TokenDeleteResult>;
|
|
167
|
-
findSession: (params: import("..").SessionSearchParams, options?: import("..").SessionQueryOptions) => Promise<import("..").ISession | null>;
|
|
168
|
-
SessionError: typeof import("./session").SessionError;
|
|
169
|
-
deleteSession: (params: import("..").DeleteSessionParams) => Promise<{
|
|
170
|
-
deletedCount?: number | undefined;
|
|
171
|
-
}>;
|
|
172
|
-
createSession: (userId: string, options?: import("..").CreateSessionOptions) => Promise<import("..").SessionResult>;
|
|
173
|
-
updateExpiration: (session: string | import("..").ISession, newExpiration?: Date | undefined) => Promise<import("..").ISession>;
|
|
174
|
-
countActiveSessions: (userId: string) => Promise<number>;
|
|
175
|
-
generateRefreshToken: (session: import("..").ISession) => Promise<string>;
|
|
176
|
-
deleteAllUserSessions: (userId: string | {
|
|
177
|
-
userId: string;
|
|
178
|
-
}, options?: import("..").DeleteAllSessionsOptions) => Promise<{
|
|
179
|
-
deletedCount?: number | undefined;
|
|
180
|
-
}>;
|
|
181
|
-
findUser: (searchCriteria: import("mongoose").FilterQuery<import("..").IUser>, fieldsToSelect?: string | string[] | null | undefined) => Promise<import("..").IUser | null>;
|
|
182
|
-
countUsers: (filter?: import("mongoose").FilterQuery<import("..").IUser>) => Promise<number>;
|
|
183
|
-
createUser: (data: import("..").UserCreateData, balanceConfig?: import("..").BalanceConfig | undefined, disableTTL?: boolean, returnUser?: boolean) => Promise<Partial<import("..").IUser> | import("mongoose").Types.ObjectId>;
|
|
184
|
-
updateUser: (userId: string, updateData: Partial<import("..").IUser>) => Promise<import("..").IUser | null>;
|
|
185
|
-
searchUsers: ({ searchPattern, limit, fieldsToSelect, }: {
|
|
186
|
-
searchPattern: string;
|
|
187
|
-
limit?: number | undefined;
|
|
188
|
-
fieldsToSelect?: string | string[] | null | undefined;
|
|
189
|
-
}) => Promise<{
|
|
190
|
-
_id: unknown;
|
|
191
|
-
__v: number;
|
|
192
|
-
}[]>;
|
|
193
|
-
getUserById: (userId: string, fieldsToSelect?: string | string[] | null | undefined) => Promise<import("..").IUser | null>;
|
|
194
|
-
generateToken: (user: import("..").IUser) => Promise<string>;
|
|
195
|
-
deleteUserById: (userId: string) => Promise<import("..").UserUpdateResult>;
|
|
196
|
-
toggleUserMemories: (userId: string, memoriesEnabled: boolean) => Promise<import("..").IUser | null>;
|
|
197
|
-
};
|
|
198
|
-
export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, MemoryMethods, AgentCategoryMethods, UserGroupMethods, AclEntryMethods, GroupMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, };
|
|
199
|
-
export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & MemoryMethods & AgentCategoryMethods & UserGroupMethods & AclEntryMethods & GroupMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods;
|
|
42
|
+
export declare function createMethods(mongoose: typeof import('mongoose')): AllMethods;
|
|
43
|
+
export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, MemoryMethods, AgentCategoryMethods, UserGroupMethods, AclEntryMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, };
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
import { Schema } from 'mongoose';
|
|
27
27
|
import type { IGroup } from '~/types';
|
|
28
28
|
declare const groupSchema: Schema<IGroup, import("mongoose").Model<IGroup, any, any, any, import("mongoose").Document<unknown, any, IGroup> & IGroup & Required<{
|
|
29
|
-
_id:
|
|
29
|
+
_id: import("mongoose").Types.ObjectId;
|
|
30
30
|
}> & {
|
|
31
31
|
__v: number;
|
|
32
32
|
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IGroup, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IGroup>> & import("mongoose").FlatRecord<IGroup> & Required<{
|
|
33
|
-
_id:
|
|
33
|
+
_id: import("mongoose").Types.ObjectId;
|
|
34
34
|
}> & {
|
|
35
35
|
__v: number;
|
|
36
36
|
}>;
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
-
import { Document } from 'mongoose';
|
|
26
|
+
import type { Document, Types } from 'mongoose';
|
|
27
27
|
export interface IGroup extends Document {
|
|
28
|
+
_id: Types.ObjectId;
|
|
28
29
|
/** The name of the group */
|
|
29
30
|
name: string;
|
|
30
31
|
/** Optional description of the group */
|
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
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 { Types, DeleteResult } from 'mongoose';
|
|
27
|
-
import type { IGroup } from '~/types';
|
|
28
|
-
export declare function createGroupMethods(mongoose: typeof import('mongoose')): {
|
|
29
|
-
createGroup: (groupData: Partial<IGroup>) => Promise<IGroup>;
|
|
30
|
-
updateGroup: (groupId: string | Types.ObjectId, updateData: Partial<IGroup>) => Promise<IGroup | null>;
|
|
31
|
-
deleteGroup: (groupId: string | Types.ObjectId) => Promise<DeleteResult>;
|
|
32
|
-
getAllGroups: () => Promise<IGroup[]>;
|
|
33
|
-
findGroupById: (groupId: string | Types.ObjectId) => Promise<IGroup | null>;
|
|
34
|
-
addMemberToGroup: (groupId: string | Types.ObjectId, memberId: string) => Promise<IGroup | null>;
|
|
35
|
-
findGroupsBySource: (source: 'local' | 'entra') => Promise<IGroup[]>;
|
|
36
|
-
removeMemberFromGroup: (groupId: string | Types.ObjectId, memberId: string) => Promise<IGroup | null>;
|
|
37
|
-
findGroupsByMemberId: (memberId: string) => Promise<IGroup[]>;
|
|
38
|
-
findGroupByExternalId: (idOnTheSource: string, source?: 'local' | 'entra') => Promise<IGroup | null>;
|
|
39
|
-
};
|
|
40
|
-
export type GroupMethods = ReturnType<typeof createGroupMethods>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|