librechat-data-provider 0.8.402 → 0.8.404

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.
Files changed (109) hide show
  1. package/dist/index.es.js +1 -1
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/react-query/index.es.js +1 -1
  6. package/dist/react-query/index.es.js.map +1 -1
  7. package/dist/types/accessPermissions.d.ts +744 -0
  8. package/dist/types/actions.d.ts +118 -0
  9. package/dist/types/api-endpoints.d.ts +150 -0
  10. package/dist/types/artifacts.d.ts +97 -0
  11. package/dist/types/azure.d.ts +22 -0
  12. package/dist/types/bedrock.d.ts +1220 -0
  13. package/dist/types/config.d.ts +14849 -0
  14. package/dist/types/config.spec.d.ts +1 -0
  15. package/dist/types/createPayload.d.ts +5 -0
  16. package/dist/types/data-service.d.ts +287 -0
  17. package/dist/types/feedback.d.ts +36 -0
  18. package/dist/types/file-config.d.ts +263 -0
  19. package/dist/types/file-config.spec.d.ts +1 -0
  20. package/dist/types/generate.d.ts +597 -0
  21. package/dist/types/headers-helpers.d.ts +2 -0
  22. package/{src/index.ts → dist/types/index.d.ts} +0 -15
  23. package/dist/types/keys.d.ts +92 -0
  24. package/dist/types/mcp.d.ts +2760 -0
  25. package/dist/types/messages.d.ts +10 -0
  26. package/dist/types/models.d.ts +1547 -0
  27. package/dist/types/parameterSettings.d.ts +69 -0
  28. package/dist/types/parsers.d.ts +110 -0
  29. package/dist/types/permissions.d.ts +522 -0
  30. package/dist/types/react-query/react-query-service.d.ts +85 -0
  31. package/dist/types/request.d.ts +25 -0
  32. package/dist/types/roles.d.ts +554 -0
  33. package/dist/types/roles.spec.d.ts +1 -0
  34. package/dist/types/schemas.d.ts +5110 -0
  35. package/dist/types/schemas.spec.d.ts +1 -0
  36. package/dist/types/types/agents.d.ts +433 -0
  37. package/dist/types/types/assistants.d.ts +547 -0
  38. package/dist/types/types/files.d.ts +172 -0
  39. package/dist/types/types/graph.d.ts +135 -0
  40. package/{src/types/mcpServers.ts → dist/types/types/mcpServers.d.ts} +12 -18
  41. package/dist/types/types/mutations.d.ts +209 -0
  42. package/dist/types/types/queries.d.ts +169 -0
  43. package/dist/types/types/runs.d.ts +36 -0
  44. package/dist/types/types/web.d.ts +520 -0
  45. package/dist/types/types.d.ts +503 -0
  46. package/dist/types/utils.d.ts +12 -0
  47. package/package.json +5 -1
  48. package/babel.config.js +0 -4
  49. package/check_updates.sh +0 -52
  50. package/jest.config.js +0 -19
  51. package/react-query/package-lock.json +0 -292
  52. package/react-query/package.json +0 -10
  53. package/rollup.config.js +0 -74
  54. package/server-rollup.config.js +0 -40
  55. package/specs/actions.spec.ts +0 -2533
  56. package/specs/api-endpoints-subdir.spec.ts +0 -140
  57. package/specs/api-endpoints.spec.ts +0 -74
  58. package/specs/azure.spec.ts +0 -844
  59. package/specs/bedrock.spec.ts +0 -862
  60. package/specs/filetypes.spec.ts +0 -175
  61. package/specs/generate.spec.ts +0 -770
  62. package/specs/headers-helpers.spec.ts +0 -24
  63. package/specs/mcp.spec.ts +0 -147
  64. package/specs/openapiSpecs.ts +0 -524
  65. package/specs/parsers.spec.ts +0 -601
  66. package/specs/request-interceptor.spec.ts +0 -304
  67. package/specs/utils.spec.ts +0 -196
  68. package/src/accessPermissions.ts +0 -346
  69. package/src/actions.ts +0 -813
  70. package/src/api-endpoints.ts +0 -440
  71. package/src/artifacts.ts +0 -3104
  72. package/src/azure.ts +0 -328
  73. package/src/bedrock.ts +0 -425
  74. package/src/config.spec.ts +0 -315
  75. package/src/config.ts +0 -2006
  76. package/src/createPayload.ts +0 -46
  77. package/src/data-service.ts +0 -1087
  78. package/src/feedback.ts +0 -141
  79. package/src/file-config.spec.ts +0 -1248
  80. package/src/file-config.ts +0 -764
  81. package/src/generate.ts +0 -634
  82. package/src/headers-helpers.ts +0 -13
  83. package/src/keys.ts +0 -99
  84. package/src/mcp.ts +0 -271
  85. package/src/messages.ts +0 -50
  86. package/src/models.ts +0 -69
  87. package/src/parameterSettings.ts +0 -1111
  88. package/src/parsers.ts +0 -563
  89. package/src/permissions.ts +0 -188
  90. package/src/react-query/react-query-service.ts +0 -566
  91. package/src/request.ts +0 -171
  92. package/src/roles.spec.ts +0 -132
  93. package/src/roles.ts +0 -225
  94. package/src/schemas.spec.ts +0 -355
  95. package/src/schemas.ts +0 -1234
  96. package/src/types/agents.ts +0 -470
  97. package/src/types/assistants.ts +0 -654
  98. package/src/types/files.ts +0 -191
  99. package/src/types/graph.ts +0 -145
  100. package/src/types/mutations.ts +0 -422
  101. package/src/types/queries.ts +0 -208
  102. package/src/types/runs.ts +0 -40
  103. package/src/types/web.ts +0 -588
  104. package/src/types.ts +0 -676
  105. package/src/utils.ts +0 -85
  106. package/tsconfig.json +0 -28
  107. package/tsconfig.spec.json +0 -10
  108. /package/{src/react-query/index.ts → dist/types/react-query/index.d.ts} +0 -0
  109. /package/{src/types/index.ts → dist/types/types/index.d.ts} +0 -0
@@ -1,346 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /**
4
- * Granular Permission System Types for Agent Sharing
5
- *
6
- * This file contains TypeScript interfaces and Zod schemas for the enhanced
7
- * agent permission system that supports sharing with specific users/groups
8
- * and Entra ID integration.
9
- */
10
-
11
- // ===== ENUMS & CONSTANTS =====
12
-
13
- /**
14
- * Principal types for permission system
15
- */
16
- export enum PrincipalType {
17
- USER = 'user',
18
- GROUP = 'group',
19
- PUBLIC = 'public',
20
- ROLE = 'role',
21
- }
22
-
23
- /**
24
- * Principal model types for MongoDB references
25
- */
26
- export enum PrincipalModel {
27
- USER = 'User',
28
- GROUP = 'Group',
29
- ROLE = 'Role',
30
- }
31
-
32
- /**
33
- * Source of the principal (local LibreChat or external Entra ID)
34
- */
35
- export type TPrincipalSource = 'local' | 'entra';
36
-
37
- /**
38
- * Access levels for agents
39
- */
40
- export type TAccessLevel = 'none' | 'viewer' | 'editor' | 'owner';
41
-
42
- /**
43
- * Resource types for permission system
44
- */
45
- export enum ResourceType {
46
- AGENT = 'agent',
47
- PROMPTGROUP = 'promptGroup',
48
- MCPSERVER = 'mcpServer',
49
- REMOTE_AGENT = 'remoteAgent',
50
- }
51
-
52
- /**
53
- * Permission bit constants for bitwise operations
54
- */
55
- export enum PermissionBits {
56
- /** 001 - Can view and use agent */
57
- VIEW = 1,
58
- /** 010 - Can modify agent settings */
59
- EDIT = 2,
60
- /** 100 - Can delete agent */
61
- DELETE = 4,
62
- /** 1000 - Can share agent with others (future) */
63
- SHARE = 8,
64
- }
65
-
66
- /**
67
- * Standard access role IDs
68
- */
69
- export enum AccessRoleIds {
70
- AGENT_VIEWER = 'agent_viewer',
71
- AGENT_EDITOR = 'agent_editor',
72
- AGENT_OWNER = 'agent_owner',
73
- PROMPTGROUP_VIEWER = 'promptGroup_viewer',
74
- PROMPTGROUP_EDITOR = 'promptGroup_editor',
75
- PROMPTGROUP_OWNER = 'promptGroup_owner',
76
- MCPSERVER_VIEWER = 'mcpServer_viewer',
77
- MCPSERVER_EDITOR = 'mcpServer_editor',
78
- MCPSERVER_OWNER = 'mcpServer_owner',
79
- REMOTE_AGENT_VIEWER = 'remoteAgent_viewer',
80
- REMOTE_AGENT_EDITOR = 'remoteAgent_editor',
81
- REMOTE_AGENT_OWNER = 'remoteAgent_owner',
82
- }
83
-
84
- // ===== ZOD SCHEMAS =====
85
-
86
- /**
87
- * Principal schema - represents a user, group, role, or public access
88
- */
89
- export const principalSchema = z.object({
90
- type: z.nativeEnum(PrincipalType),
91
- id: z.string().optional(), // undefined for 'public' type, role name for 'role' type
92
- name: z.string().optional(),
93
- email: z.string().optional(), // for user and group types
94
- source: z.enum(['local', 'entra']).optional(),
95
- avatar: z.string().optional(), // for user and group types
96
- description: z.string().optional(), // for group and role types
97
- idOnTheSource: z.string().optional(), // Entra ID for users/groups
98
- accessRoleId: z.nativeEnum(AccessRoleIds).optional(), // Access role ID for permissions
99
- memberCount: z.number().optional(), // for group type
100
- });
101
-
102
- /**
103
- * Access role schema - defines named permission sets
104
- */
105
- export const accessRoleSchema = z.object({
106
- accessRoleId: z.nativeEnum(AccessRoleIds),
107
- name: z.string(),
108
- description: z.string().optional(),
109
- resourceType: z.nativeEnum(ResourceType).default(ResourceType.AGENT),
110
- permBits: z.number(),
111
- });
112
-
113
- /**
114
- * Permission entry schema - represents a single ACL entry
115
- */
116
- export const permissionEntrySchema = z.object({
117
- id: z.string(),
118
- principalType: z.nativeEnum(PrincipalType),
119
- principalId: z.string().optional(), // undefined for 'public'
120
- principalName: z.string().optional(),
121
- role: accessRoleSchema,
122
- grantedBy: z.string(),
123
- grantedAt: z.string(), // ISO date string
124
- inheritedFrom: z.string().optional(), // for project-level inheritance
125
- source: z.enum(['local', 'entra']).optional(),
126
- });
127
-
128
- /**
129
- * Resource permissions response schema
130
- */
131
- export const resourcePermissionsResponseSchema = z.object({
132
- resourceType: z.nativeEnum(ResourceType),
133
- resourceId: z.string(),
134
- permissions: z.array(permissionEntrySchema),
135
- });
136
-
137
- /**
138
- * Update resource permissions request schema
139
- * This matches the user's requirement for the frontend DTO structure
140
- */
141
- export const updateResourcePermissionsRequestSchema = z.object({
142
- updated: principalSchema.array(),
143
- removed: principalSchema.array(),
144
- public: z.boolean(),
145
- publicAccessRoleId: z.string().optional(),
146
- });
147
-
148
- /**
149
- * Update resource permissions response schema
150
- * Returns the updated permissions with accessRoleId included
151
- */
152
- export const updateResourcePermissionsResponseSchema = z.object({
153
- message: z.string(),
154
- results: z.object({
155
- principals: principalSchema.array(),
156
- public: z.boolean(),
157
- publicAccessRoleId: z.string().optional(),
158
- }),
159
- });
160
-
161
- // ===== TYPESCRIPT TYPES =====
162
-
163
- /**
164
- * Principal - represents a user, group, or public access
165
- */
166
- export type TPrincipal = z.infer<typeof principalSchema>;
167
-
168
- /**
169
- * Access role - defines named permission sets
170
- */
171
- export type TAccessRole = z.infer<typeof accessRoleSchema>;
172
-
173
- /**
174
- * Permission entry - represents a single ACL entry
175
- */
176
- export type TPermissionEntry = z.infer<typeof permissionEntrySchema>;
177
-
178
- /**
179
- * Resource permissions response
180
- */
181
- export type TResourcePermissionsResponse = z.infer<typeof resourcePermissionsResponseSchema>;
182
-
183
- /**
184
- * Update resource permissions request
185
- * This matches the user's requirement for the frontend DTO structure
186
- */
187
- export type TUpdateResourcePermissionsRequest = z.infer<
188
- typeof updateResourcePermissionsRequestSchema
189
- >;
190
-
191
- /**
192
- * Update resource permissions response
193
- * Returns the updated permissions with accessRoleId included
194
- */
195
- export type TUpdateResourcePermissionsResponse = z.infer<
196
- typeof updateResourcePermissionsResponseSchema
197
- >;
198
-
199
- /**
200
- * Principal search request parameters
201
- */
202
- export type TPrincipalSearchParams = {
203
- q: string;
204
- limit?: number;
205
- types?: Array<PrincipalType.USER | PrincipalType.GROUP | PrincipalType.ROLE>;
206
- };
207
-
208
- /**
209
- * Principal search result item
210
- */
211
- export type TPrincipalSearchResult = {
212
- id?: string | null; // null for Entra ID principals that don't exist locally yet
213
- type: PrincipalType.USER | PrincipalType.GROUP | PrincipalType.ROLE;
214
- name: string;
215
- email?: string; // for users and groups
216
- username?: string; // for users
217
- avatar?: string; // for users and groups
218
- provider?: string; // for users
219
- source: 'local' | 'entra';
220
- memberCount?: number; // for groups
221
- description?: string; // for groups
222
- idOnTheSource?: string; // Entra ID for users (maps to openidId) and groups (maps to idOnTheSource)
223
- };
224
-
225
- /**
226
- * Principal search response
227
- */
228
- export type TPrincipalSearchResponse = {
229
- query: string;
230
- limit: number;
231
- types?: Array<PrincipalType.USER | PrincipalType.GROUP | PrincipalType.ROLE> | null;
232
- results: TPrincipalSearchResult[];
233
- count: number;
234
- sources: {
235
- local: number;
236
- entra: number;
237
- };
238
- };
239
-
240
- /**
241
- * Available roles response
242
- */
243
- export type TAvailableRolesResponse = {
244
- resourceType: ResourceType;
245
- roles: TAccessRole[];
246
- };
247
-
248
- /**
249
- * Get resource permissions response schema
250
- * This matches the enhanced aggregation-based endpoint response format
251
- */
252
- export const getResourcePermissionsResponseSchema = z.object({
253
- resourceType: z.nativeEnum(ResourceType),
254
- resourceId: z.nativeEnum(AccessRoleIds),
255
- principals: z.array(principalSchema),
256
- public: z.boolean(),
257
- publicAccessRoleId: z.nativeEnum(AccessRoleIds).optional(),
258
- });
259
-
260
- /**
261
- * Get resource permissions response type
262
- * This matches the enhanced aggregation-based endpoint response format
263
- */
264
- export type TGetResourcePermissionsResponse = z.infer<typeof getResourcePermissionsResponseSchema>;
265
-
266
- /**
267
- * Effective permissions response schema
268
- * Returns just the permission bitmask for a user on a resource
269
- */
270
- export const effectivePermissionsResponseSchema = z.object({
271
- permissionBits: z.number(),
272
- });
273
-
274
- /**
275
- * Effective permissions response type
276
- * Returns just the permission bitmask for a user on a resource
277
- */
278
- export type TEffectivePermissionsResponse = z.infer<typeof effectivePermissionsResponseSchema>;
279
-
280
- /**
281
- * All effective permissions response type
282
- * Map of resourceId to permissionBits for all accessible resources
283
- */
284
- export type TAllEffectivePermissionsResponse = Record<string, number>;
285
-
286
- // ===== UTILITY TYPES =====
287
-
288
- /**
289
- * Permission check result
290
- */
291
- export interface TPermissionCheck {
292
- canView: boolean;
293
- canEdit: boolean;
294
- canDelete: boolean;
295
- canShare: boolean;
296
- accessLevel: TAccessLevel;
297
- }
298
-
299
- // ===== HELPER FUNCTIONS =====
300
-
301
- /**
302
- * Convert permission bits to access level
303
- */
304
- export function permBitsToAccessLevel(permBits: number): TAccessLevel {
305
- if ((permBits & PermissionBits.DELETE) > 0) return 'owner';
306
- if ((permBits & PermissionBits.EDIT) > 0) return 'editor';
307
- if ((permBits & PermissionBits.VIEW) > 0) return 'viewer';
308
- return 'none';
309
- }
310
-
311
- /**
312
- * Convert access role ID to permission bits
313
- */
314
- export function accessRoleToPermBits(accessRoleId: string): number {
315
- switch (accessRoleId) {
316
- case AccessRoleIds.AGENT_VIEWER:
317
- case AccessRoleIds.PROMPTGROUP_VIEWER:
318
- case AccessRoleIds.MCPSERVER_VIEWER:
319
- case AccessRoleIds.REMOTE_AGENT_VIEWER:
320
- return PermissionBits.VIEW;
321
- case AccessRoleIds.AGENT_EDITOR:
322
- case AccessRoleIds.PROMPTGROUP_EDITOR:
323
- case AccessRoleIds.MCPSERVER_EDITOR:
324
- case AccessRoleIds.REMOTE_AGENT_EDITOR:
325
- return PermissionBits.VIEW | PermissionBits.EDIT;
326
- case AccessRoleIds.AGENT_OWNER:
327
- case AccessRoleIds.PROMPTGROUP_OWNER:
328
- case AccessRoleIds.MCPSERVER_OWNER:
329
- case AccessRoleIds.REMOTE_AGENT_OWNER:
330
- return (
331
- PermissionBits.VIEW | PermissionBits.EDIT | PermissionBits.DELETE | PermissionBits.SHARE
332
- );
333
- default:
334
- return PermissionBits.VIEW;
335
- }
336
- }
337
-
338
- /**
339
- * Check if permission bitmask contains other bitmask
340
- * @param permissions - The permission bitmask to check
341
- * @param requiredPermission - The required permission bit(s)
342
- * @returns {boolean} Whether permissions contains requiredPermission
343
- */
344
- export function hasPermissions(permissions: number, requiredPermission: number): boolean {
345
- return (permissions & requiredPermission) === requiredPermission;
346
- }