librechat-data-provider 0.8.402 → 0.8.403

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 (103) hide show
  1. package/dist/types/accessPermissions.d.ts +744 -0
  2. package/dist/types/actions.d.ts +118 -0
  3. package/dist/types/api-endpoints.d.ts +149 -0
  4. package/dist/types/artifacts.d.ts +97 -0
  5. package/dist/types/azure.d.ts +22 -0
  6. package/dist/types/bedrock.d.ts +1220 -0
  7. package/dist/types/config.d.ts +13916 -0
  8. package/dist/types/config.spec.d.ts +1 -0
  9. package/dist/types/createPayload.d.ts +5 -0
  10. package/dist/types/data-service.d.ts +284 -0
  11. package/dist/types/feedback.d.ts +36 -0
  12. package/dist/types/file-config.d.ts +263 -0
  13. package/dist/types/file-config.spec.d.ts +1 -0
  14. package/dist/types/generate.d.ts +597 -0
  15. package/dist/types/headers-helpers.d.ts +2 -0
  16. package/{src/index.ts → dist/types/index.d.ts} +0 -15
  17. package/dist/types/keys.d.ts +92 -0
  18. package/dist/types/mcp.d.ts +2760 -0
  19. package/dist/types/messages.d.ts +10 -0
  20. package/dist/types/models.d.ts +1677 -0
  21. package/dist/types/parameterSettings.d.ts +69 -0
  22. package/dist/types/parsers.d.ts +110 -0
  23. package/dist/types/permissions.d.ts +522 -0
  24. package/dist/types/react-query/react-query-service.d.ts +85 -0
  25. package/dist/types/request.d.ts +25 -0
  26. package/dist/types/roles.d.ts +554 -0
  27. package/dist/types/roles.spec.d.ts +1 -0
  28. package/dist/types/schemas.d.ts +4815 -0
  29. package/dist/types/schemas.spec.d.ts +1 -0
  30. package/dist/types/types/agents.d.ts +433 -0
  31. package/dist/types/types/assistants.d.ts +547 -0
  32. package/dist/types/types/files.d.ts +172 -0
  33. package/dist/types/types/graph.d.ts +135 -0
  34. package/{src/types/mcpServers.ts → dist/types/types/mcpServers.d.ts} +12 -18
  35. package/dist/types/types/mutations.d.ts +209 -0
  36. package/dist/types/types/queries.d.ts +169 -0
  37. package/dist/types/types/runs.d.ts +36 -0
  38. package/dist/types/types/web.d.ts +520 -0
  39. package/dist/types/types.d.ts +503 -0
  40. package/dist/types/utils.d.ts +12 -0
  41. package/package.json +4 -1
  42. package/babel.config.js +0 -4
  43. package/check_updates.sh +0 -52
  44. package/jest.config.js +0 -19
  45. package/react-query/package-lock.json +0 -292
  46. package/react-query/package.json +0 -10
  47. package/rollup.config.js +0 -74
  48. package/server-rollup.config.js +0 -40
  49. package/specs/actions.spec.ts +0 -2533
  50. package/specs/api-endpoints-subdir.spec.ts +0 -140
  51. package/specs/api-endpoints.spec.ts +0 -74
  52. package/specs/azure.spec.ts +0 -844
  53. package/specs/bedrock.spec.ts +0 -862
  54. package/specs/filetypes.spec.ts +0 -175
  55. package/specs/generate.spec.ts +0 -770
  56. package/specs/headers-helpers.spec.ts +0 -24
  57. package/specs/mcp.spec.ts +0 -147
  58. package/specs/openapiSpecs.ts +0 -524
  59. package/specs/parsers.spec.ts +0 -601
  60. package/specs/request-interceptor.spec.ts +0 -304
  61. package/specs/utils.spec.ts +0 -196
  62. package/src/accessPermissions.ts +0 -346
  63. package/src/actions.ts +0 -813
  64. package/src/api-endpoints.ts +0 -440
  65. package/src/artifacts.ts +0 -3104
  66. package/src/azure.ts +0 -328
  67. package/src/bedrock.ts +0 -425
  68. package/src/config.spec.ts +0 -315
  69. package/src/config.ts +0 -2006
  70. package/src/createPayload.ts +0 -46
  71. package/src/data-service.ts +0 -1087
  72. package/src/feedback.ts +0 -141
  73. package/src/file-config.spec.ts +0 -1248
  74. package/src/file-config.ts +0 -764
  75. package/src/generate.ts +0 -634
  76. package/src/headers-helpers.ts +0 -13
  77. package/src/keys.ts +0 -99
  78. package/src/mcp.ts +0 -271
  79. package/src/messages.ts +0 -50
  80. package/src/models.ts +0 -69
  81. package/src/parameterSettings.ts +0 -1111
  82. package/src/parsers.ts +0 -563
  83. package/src/permissions.ts +0 -188
  84. package/src/react-query/react-query-service.ts +0 -566
  85. package/src/request.ts +0 -171
  86. package/src/roles.spec.ts +0 -132
  87. package/src/roles.ts +0 -225
  88. package/src/schemas.spec.ts +0 -355
  89. package/src/schemas.ts +0 -1234
  90. package/src/types/agents.ts +0 -470
  91. package/src/types/assistants.ts +0 -654
  92. package/src/types/files.ts +0 -191
  93. package/src/types/graph.ts +0 -145
  94. package/src/types/mutations.ts +0 -422
  95. package/src/types/queries.ts +0 -208
  96. package/src/types/runs.ts +0 -40
  97. package/src/types/web.ts +0 -588
  98. package/src/types.ts +0 -676
  99. package/src/utils.ts +0 -85
  100. package/tsconfig.json +0 -28
  101. package/tsconfig.spec.json +0 -10
  102. /package/{src/react-query/index.ts → dist/types/react-query/index.d.ts} +0 -0
  103. /package/{src/types/index.ts → dist/types/types/index.d.ts} +0 -0
@@ -1,315 +0,0 @@
1
- import type { TEndpointsConfig } from './types';
2
- import { EModelEndpoint, isDocumentSupportedProvider } from './schemas';
3
- import { getEndpointFileConfig, mergeFileConfig } from './file-config';
4
- import { resolveEndpointType } from './config';
5
-
6
- const endpointsConfig: TEndpointsConfig = {
7
- [EModelEndpoint.openAI]: { userProvide: false, order: 0 },
8
- [EModelEndpoint.agents]: { userProvide: false, order: 1 },
9
- [EModelEndpoint.anthropic]: { userProvide: false, order: 6 },
10
- [EModelEndpoint.bedrock]: { userProvide: false, order: 7 },
11
- Moonshot: { type: EModelEndpoint.custom, userProvide: false, order: 9999 },
12
- 'Some Endpoint': { type: EModelEndpoint.custom, userProvide: false, order: 9999 },
13
- Gemini: { type: EModelEndpoint.custom, userProvide: false, order: 9999 },
14
- };
15
-
16
- describe('resolveEndpointType', () => {
17
- describe('non-agents endpoints', () => {
18
- it('returns the config type for a custom endpoint', () => {
19
- expect(resolveEndpointType(endpointsConfig, 'Moonshot')).toBe(EModelEndpoint.custom);
20
- });
21
-
22
- it('returns the config type for a custom endpoint with spaces', () => {
23
- expect(resolveEndpointType(endpointsConfig, 'Some Endpoint')).toBe(EModelEndpoint.custom);
24
- });
25
-
26
- it('returns the endpoint itself for a standard endpoint without a type field', () => {
27
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.openAI)).toBe(
28
- EModelEndpoint.openAI,
29
- );
30
- });
31
-
32
- it('returns the endpoint itself for anthropic', () => {
33
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.anthropic)).toBe(
34
- EModelEndpoint.anthropic,
35
- );
36
- });
37
-
38
- it('ignores agentProvider when endpoint is not agents', () => {
39
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.openAI, 'Moonshot')).toBe(
40
- EModelEndpoint.openAI,
41
- );
42
- });
43
- });
44
-
45
- describe('agents endpoint with provider', () => {
46
- it('resolves to custom for a custom agent provider', () => {
47
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'Moonshot')).toBe(
48
- EModelEndpoint.custom,
49
- );
50
- });
51
-
52
- it('resolves to custom for a custom agent provider with spaces', () => {
53
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'Some Endpoint')).toBe(
54
- EModelEndpoint.custom,
55
- );
56
- });
57
-
58
- it('returns the provider itself for a standard agent provider (no type field)', () => {
59
- expect(
60
- resolveEndpointType(endpointsConfig, EModelEndpoint.agents, EModelEndpoint.openAI),
61
- ).toBe(EModelEndpoint.openAI);
62
- });
63
-
64
- it('returns bedrock for a bedrock agent provider', () => {
65
- expect(
66
- resolveEndpointType(endpointsConfig, EModelEndpoint.agents, EModelEndpoint.bedrock),
67
- ).toBe(EModelEndpoint.bedrock);
68
- });
69
-
70
- it('returns the provider name when provider is not in endpointsConfig', () => {
71
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'UnknownProvider')).toBe(
72
- 'UnknownProvider',
73
- );
74
- });
75
- });
76
-
77
- describe('agents endpoint without provider', () => {
78
- it('falls back to agents when no provider', () => {
79
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.agents)).toBe(
80
- EModelEndpoint.agents,
81
- );
82
- });
83
-
84
- it('falls back to agents when provider is null', () => {
85
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.agents, null)).toBe(
86
- EModelEndpoint.agents,
87
- );
88
- });
89
-
90
- it('falls back to agents when provider is undefined', () => {
91
- expect(resolveEndpointType(endpointsConfig, EModelEndpoint.agents, undefined)).toBe(
92
- EModelEndpoint.agents,
93
- );
94
- });
95
- });
96
-
97
- describe('edge cases', () => {
98
- it('returns undefined for null endpoint', () => {
99
- expect(resolveEndpointType(endpointsConfig, null)).toBeUndefined();
100
- });
101
-
102
- it('returns undefined for undefined endpoint', () => {
103
- expect(resolveEndpointType(endpointsConfig, undefined)).toBeUndefined();
104
- });
105
-
106
- it('handles null endpointsConfig', () => {
107
- expect(resolveEndpointType(null, EModelEndpoint.agents, 'Moonshot')).toBe('Moonshot');
108
- });
109
-
110
- it('handles undefined endpointsConfig', () => {
111
- expect(resolveEndpointType(undefined, 'Moonshot')).toBe('Moonshot');
112
- });
113
- });
114
- });
115
-
116
- describe('resolveEndpointType + getEndpointFileConfig integration', () => {
117
- const fileConfig = mergeFileConfig({
118
- endpoints: {
119
- Moonshot: { fileLimit: 5 },
120
- [EModelEndpoint.agents]: { fileLimit: 20 },
121
- default: { fileLimit: 10 },
122
- },
123
- });
124
-
125
- it('agent with Moonshot provider uses Moonshot-specific config', () => {
126
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'Moonshot');
127
- const config = getEndpointFileConfig({
128
- fileConfig,
129
- endpointType,
130
- endpoint: 'Moonshot',
131
- });
132
- expect(config.fileLimit).toBe(5);
133
- });
134
-
135
- it('agent with provider not in fileConfig falls back through custom → agents', () => {
136
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'Gemini');
137
- const config = getEndpointFileConfig({
138
- fileConfig,
139
- endpointType,
140
- endpoint: 'Gemini',
141
- });
142
- expect(config.fileLimit).toBe(20);
143
- });
144
-
145
- it('agent without provider falls back to agents config', () => {
146
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.agents);
147
- const config = getEndpointFileConfig({
148
- fileConfig,
149
- endpointType,
150
- endpoint: EModelEndpoint.agents,
151
- });
152
- expect(config.fileLimit).toBe(20);
153
- });
154
-
155
- it('custom fallback is used when present and provider has no specific config', () => {
156
- const fileConfigWithCustom = mergeFileConfig({
157
- endpoints: {
158
- custom: { fileLimit: 15 },
159
- [EModelEndpoint.agents]: { fileLimit: 20 },
160
- default: { fileLimit: 10 },
161
- },
162
- });
163
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'Gemini');
164
- const config = getEndpointFileConfig({
165
- fileConfig: fileConfigWithCustom,
166
- endpointType,
167
- endpoint: 'Gemini',
168
- });
169
- expect(config.fileLimit).toBe(15);
170
- });
171
-
172
- it('non-agents custom endpoint uses its specific config directly', () => {
173
- const endpointType = resolveEndpointType(endpointsConfig, 'Moonshot');
174
- const config = getEndpointFileConfig({
175
- fileConfig,
176
- endpointType,
177
- endpoint: 'Moonshot',
178
- });
179
- expect(config.fileLimit).toBe(5);
180
- });
181
-
182
- it('non-agents standard endpoint falls back to default when no specific config', () => {
183
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.openAI);
184
- const config = getEndpointFileConfig({
185
- fileConfig,
186
- endpointType,
187
- endpoint: EModelEndpoint.openAI,
188
- });
189
- expect(config.fileLimit).toBe(10);
190
- });
191
- });
192
-
193
- describe('resolveEndpointType + isDocumentSupportedProvider (upload menu)', () => {
194
- it('agent with custom provider shows "Upload to Provider" (custom is document-supported)', () => {
195
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'Moonshot');
196
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
197
- });
198
-
199
- it('agent with custom provider with spaces shows "Upload to Provider"', () => {
200
- const endpointType = resolveEndpointType(
201
- endpointsConfig,
202
- EModelEndpoint.agents,
203
- 'Some Endpoint',
204
- );
205
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
206
- });
207
-
208
- it('agent without provider falls back to agents (not document-supported)', () => {
209
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.agents);
210
- expect(isDocumentSupportedProvider(endpointType)).toBe(false);
211
- });
212
-
213
- it('agent with openAI provider is document-supported', () => {
214
- const endpointType = resolveEndpointType(
215
- endpointsConfig,
216
- EModelEndpoint.agents,
217
- EModelEndpoint.openAI,
218
- );
219
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
220
- });
221
-
222
- it('agent with anthropic provider is document-supported', () => {
223
- const endpointType = resolveEndpointType(
224
- endpointsConfig,
225
- EModelEndpoint.agents,
226
- EModelEndpoint.anthropic,
227
- );
228
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
229
- });
230
-
231
- it('agent with bedrock provider is document-supported', () => {
232
- const endpointType = resolveEndpointType(
233
- endpointsConfig,
234
- EModelEndpoint.agents,
235
- EModelEndpoint.bedrock,
236
- );
237
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
238
- });
239
-
240
- it('direct custom endpoint (not agents) is document-supported', () => {
241
- const endpointType = resolveEndpointType(endpointsConfig, 'Moonshot');
242
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
243
- });
244
-
245
- it('direct standard endpoint is document-supported', () => {
246
- const endpointType = resolveEndpointType(endpointsConfig, EModelEndpoint.openAI);
247
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
248
- });
249
-
250
- it('agent with unknown provider not in endpointsConfig is not document-supported', () => {
251
- const endpointType = resolveEndpointType(
252
- endpointsConfig,
253
- EModelEndpoint.agents,
254
- 'UnknownProvider',
255
- );
256
- expect(isDocumentSupportedProvider(endpointType)).toBe(false);
257
- });
258
-
259
- it('same custom endpoint shows same result whether used directly or through agents', () => {
260
- const directType = resolveEndpointType(endpointsConfig, 'Moonshot');
261
- const agentType = resolveEndpointType(endpointsConfig, EModelEndpoint.agents, 'Moonshot');
262
- expect(isDocumentSupportedProvider(directType)).toBe(isDocumentSupportedProvider(agentType));
263
- });
264
- });
265
-
266
- describe('any custom endpoint is document-supported regardless of name', () => {
267
- const arbitraryNames = [
268
- 'My LLM Gateway',
269
- 'company-internal-api',
270
- 'LiteLLM Proxy',
271
- 'test_endpoint_123',
272
- 'AI Studio',
273
- 'ACME Corp',
274
- 'localhost:8080',
275
- ];
276
-
277
- const configWithArbitraryEndpoints: TEndpointsConfig = {
278
- [EModelEndpoint.agents]: { userProvide: false, order: 1 },
279
- ...Object.fromEntries(
280
- arbitraryNames.map((name) => [
281
- name,
282
- { type: EModelEndpoint.custom, userProvide: false, order: 9999 },
283
- ]),
284
- ),
285
- };
286
-
287
- it.each(arbitraryNames)('direct custom endpoint "%s" is document-supported', (name) => {
288
- const endpointType = resolveEndpointType(configWithArbitraryEndpoints, name);
289
- expect(endpointType).toBe(EModelEndpoint.custom);
290
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
291
- });
292
-
293
- it.each(arbitraryNames)('agent with custom provider "%s" is document-supported', (name) => {
294
- const endpointType = resolveEndpointType(
295
- configWithArbitraryEndpoints,
296
- EModelEndpoint.agents,
297
- name,
298
- );
299
- expect(endpointType).toBe(EModelEndpoint.custom);
300
- expect(isDocumentSupportedProvider(endpointType)).toBe(true);
301
- });
302
-
303
- it.each(arbitraryNames)(
304
- '"%s" resolves the same whether used directly or through an agent',
305
- (name) => {
306
- const directType = resolveEndpointType(configWithArbitraryEndpoints, name);
307
- const agentType = resolveEndpointType(
308
- configWithArbitraryEndpoints,
309
- EModelEndpoint.agents,
310
- name,
311
- );
312
- expect(directType).toBe(agentType);
313
- },
314
- );
315
- });