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,140 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
-
5
- /**
6
- * Tests for buildLoginRedirectUrl and apiBaseUrl under subdirectory deployments.
7
- *
8
- * Uses jest.isolateModules to re-import api-endpoints with a <base href="/chat/">
9
- * element present, simulating a subdirectory deployment where BASE_URL = '/chat'.
10
- *
11
- * Tests that need to override window.location use explicit function arguments
12
- * instead of mocking the global, since jsdom 26+ does not allow redefining it.
13
- */
14
-
15
- function loadModuleWithBase(baseHref: string) {
16
- const base = document.createElement('base');
17
- base.setAttribute('href', baseHref);
18
- document.head.appendChild(base);
19
-
20
- const proc = process as typeof process & { browser?: boolean };
21
- const originalBrowser = proc.browser;
22
-
23
- let mod: typeof import('../src/api-endpoints');
24
- try {
25
- proc.browser = true;
26
- jest.isolateModules(() => {
27
- // eslint-disable-next-line @typescript-eslint/no-require-imports -- static import not usable inside isolateModules
28
- mod = require('../src/api-endpoints');
29
- });
30
- return mod!;
31
- } finally {
32
- proc.browser = originalBrowser;
33
- document.head.removeChild(base);
34
- }
35
- }
36
-
37
- describe('buildLoginRedirectUrl — subdirectory deployment (BASE_URL = /chat)', () => {
38
- let buildLoginRedirectUrl: typeof import('../src/api-endpoints').buildLoginRedirectUrl;
39
- let apiBaseUrl: typeof import('../src/api-endpoints').apiBaseUrl;
40
-
41
- beforeAll(() => {
42
- const mod = loadModuleWithBase('/chat/');
43
- buildLoginRedirectUrl = mod.buildLoginRedirectUrl;
44
- apiBaseUrl = mod.apiBaseUrl;
45
- });
46
-
47
- it('sets BASE_URL to "/chat" (trailing slash stripped)', () => {
48
- expect(apiBaseUrl()).toBe('/chat');
49
- });
50
-
51
- it('returns "/login" without base prefix (compatible with React Router navigate)', () => {
52
- const result = buildLoginRedirectUrl('/chat/c/new', '', '');
53
- expect(result).toMatch(/^\/login/);
54
- expect(result).not.toMatch(/^\/chat/);
55
- });
56
-
57
- it('strips base prefix from redirect_to when pathname includes base', () => {
58
- const result = buildLoginRedirectUrl('/chat/c/abc123', '?model=gpt-4', '');
59
- const redirectTo = decodeURIComponent(result.split('redirect_to=')[1]);
60
- expect(redirectTo).toBe('/c/abc123?model=gpt-4');
61
- expect(redirectTo).not.toContain('/chat/');
62
- });
63
-
64
- it('works with pathnames that do not include the base prefix', () => {
65
- const result = buildLoginRedirectUrl('/c/new', '', '');
66
- const redirectTo = decodeURIComponent(result.split('redirect_to=')[1]);
67
- expect(redirectTo).toBe('/c/new');
68
- });
69
-
70
- it('returns plain /login for base-prefixed login path', () => {
71
- expect(buildLoginRedirectUrl('/chat/login', '', '')).toBe('/login');
72
- });
73
-
74
- it('returns plain /login for base-prefixed login sub-path', () => {
75
- expect(buildLoginRedirectUrl('/chat/login/2fa', '', '')).toBe('/login');
76
- });
77
-
78
- it('returns plain /login when stripped path is root (no pointless redirect_to=/)', () => {
79
- const result = buildLoginRedirectUrl('/chat', '', '');
80
- expect(result).toBe('/login');
81
- expect(result).not.toContain('redirect_to');
82
- });
83
-
84
- it('composes correct full URL for window.location.href (apiBaseUrl + buildLoginRedirectUrl)', () => {
85
- const fullUrl = apiBaseUrl() + buildLoginRedirectUrl('/chat/c/abc123', '', '');
86
- expect(fullUrl).toBe('/chat/login?redirect_to=%2Fc%2Fabc123');
87
- expect(fullUrl).not.toContain('/chat/chat/');
88
- });
89
-
90
- it('encodes query params and hash correctly after stripping base', () => {
91
- const result = buildLoginRedirectUrl('/chat/c/deep', '?q=hello&submit=true', '#section');
92
- const redirectTo = decodeURIComponent(result.split('redirect_to=')[1]);
93
- expect(redirectTo).toBe('/c/deep?q=hello&submit=true#section');
94
- });
95
-
96
- it('does not strip base when path shares a prefix but is not a segment match', () => {
97
- const result = buildLoginRedirectUrl('/chatroom/c/abc123', '', '');
98
- const redirectTo = decodeURIComponent(result.split('redirect_to=')[1]);
99
- expect(redirectTo).toBe('/chatroom/c/abc123');
100
- });
101
-
102
- it('does not strip base from /chatbot path', () => {
103
- const result = buildLoginRedirectUrl('/chatbot', '', '');
104
- const redirectTo = decodeURIComponent(result.split('redirect_to=')[1]);
105
- expect(redirectTo).toBe('/chatbot');
106
- });
107
- });
108
-
109
- describe('buildLoginRedirectUrl — deep subdirectory (BASE_URL = /app/chat)', () => {
110
- let buildLoginRedirectUrl: typeof import('../src/api-endpoints').buildLoginRedirectUrl;
111
- let apiBaseUrl: typeof import('../src/api-endpoints').apiBaseUrl;
112
-
113
- beforeAll(() => {
114
- const mod = loadModuleWithBase('/app/chat/');
115
- buildLoginRedirectUrl = mod.buildLoginRedirectUrl;
116
- apiBaseUrl = mod.apiBaseUrl;
117
- });
118
-
119
- it('sets BASE_URL to "/app/chat"', () => {
120
- expect(apiBaseUrl()).toBe('/app/chat');
121
- });
122
-
123
- it('strips deep base prefix from redirect_to', () => {
124
- const result = buildLoginRedirectUrl('/app/chat/c/abc123', '', '');
125
- const redirectTo = decodeURIComponent(result.split('redirect_to=')[1]);
126
- expect(redirectTo).toBe('/c/abc123');
127
- });
128
-
129
- it('full URL does not double the base prefix', () => {
130
- const fullUrl = apiBaseUrl() + buildLoginRedirectUrl('/app/chat/c/abc123', '', '');
131
- expect(fullUrl).toBe('/app/chat/login?redirect_to=%2Fc%2Fabc123');
132
- expect(fullUrl).not.toContain('/app/chat/app/chat/');
133
- });
134
-
135
- it('does not strip from /app/chatroom (segment boundary check)', () => {
136
- const result = buildLoginRedirectUrl('/app/chatroom/page', '', '');
137
- const redirectTo = decodeURIComponent(result.split('redirect_to=')[1]);
138
- expect(redirectTo).toBe('/app/chatroom/page');
139
- });
140
- });
@@ -1,74 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- import { buildLoginRedirectUrl } from '../src/api-endpoints';
5
-
6
- describe('buildLoginRedirectUrl', () => {
7
- afterEach(() => {
8
- window.history.replaceState({}, '', '/');
9
- });
10
-
11
- it('builds a login URL from explicit args', () => {
12
- const result = buildLoginRedirectUrl('/c/new', '?q=hello', '');
13
- expect(result).toBe('/login?redirect_to=%2Fc%2Fnew%3Fq%3Dhello');
14
- });
15
-
16
- it('encodes complex paths with query and hash', () => {
17
- const result = buildLoginRedirectUrl('/c/new', '?q=hello&submit=true', '#section');
18
- expect(result).toContain('redirect_to=');
19
- const encoded = result.split('redirect_to=')[1];
20
- expect(decodeURIComponent(encoded)).toBe('/c/new?q=hello&submit=true#section');
21
- });
22
-
23
- it('falls back to window.location when no args provided', () => {
24
- window.history.replaceState({}, '', '/c/abc123?model=gpt-4#msg-5');
25
- const result = buildLoginRedirectUrl();
26
- const encoded = result.split('redirect_to=')[1];
27
- expect(decodeURIComponent(encoded)).toBe('/c/abc123?model=gpt-4#msg-5');
28
- });
29
-
30
- it('returns plain /login when all location parts are empty (root)', () => {
31
- window.history.replaceState({}, '', '/');
32
- const result = buildLoginRedirectUrl();
33
- expect(result).toBe('/login');
34
- });
35
-
36
- it('returns plain /login when pathname is /login (prevents recursive redirect)', () => {
37
- const result = buildLoginRedirectUrl('/login', '?redirect_to=%2Fc%2Fnew', '');
38
- expect(result).toBe('/login');
39
- });
40
-
41
- it('returns plain /login when window.location is already /login', () => {
42
- window.history.replaceState({}, '', '/login?redirect_to=%2Fc%2Fabc');
43
- const result = buildLoginRedirectUrl();
44
- expect(result).toBe('/login');
45
- });
46
-
47
- it('returns plain /login for /login sub-paths', () => {
48
- const result = buildLoginRedirectUrl('/login/2fa', '', '');
49
- expect(result).toBe('/login');
50
- });
51
-
52
- it('returns plain /login for basename-prefixed /login (e.g. /librechat/login)', () => {
53
- window.history.replaceState({}, '', '/librechat/login?redirect_to=%2Fc%2Fabc');
54
- const result = buildLoginRedirectUrl();
55
- expect(result).toBe('/login');
56
- });
57
-
58
- it('returns plain /login for basename-prefixed /login sub-paths', () => {
59
- const result = buildLoginRedirectUrl('/librechat/login/2fa', '', '');
60
- expect(result).toBe('/login');
61
- });
62
-
63
- it('returns plain /login for root path (no pointless redirect_to=/)', () => {
64
- const result = buildLoginRedirectUrl('/', '', '');
65
- expect(result).toBe('/login');
66
- expect(result).not.toContain('redirect_to');
67
- });
68
-
69
- it('does NOT match paths where "login" is a substring of a segment', () => {
70
- const result = buildLoginRedirectUrl('/c/loginhistory', '', '');
71
- expect(result).toContain('redirect_to=');
72
- expect(decodeURIComponent(result.split('redirect_to=')[1])).toBe('/c/loginhistory');
73
- });
74
- });