@superinterface/server 1.0.17 → 1.0.19

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 (250) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_btwyo7 +1 -1
  5. package/.next/fallback-build-manifest.json +2 -2
  6. package/.next/server/app/_not-found.html +1 -1
  7. package/.next/server/app/_not-found.rsc +1 -1
  8. package/.next/server/app/api/files/[fileId]/contents/route.js +1 -1
  9. package/.next/server/app/api/files/[fileId]/contents/route.js.nft.json +1 -1
  10. package/.next/server/app/api/files/route.js +1 -1
  11. package/.next/server/app/api/files/route.js.nft.json +1 -1
  12. package/.next/server/app/api/messages/route.js +3 -3
  13. package/.next/server/app/api/messages/route.js.nft.json +1 -1
  14. package/.next/server/app/index.html +1 -1
  15. package/.next/server/app/index.rsc +1 -1
  16. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
  17. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
  18. package/.next/server/chunks/[root-of-the-server]__13c6bd62._.js +1 -1
  19. package/.next/server/chunks/[root-of-the-server]__13c6bd62._.js.map +1 -1
  20. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
  21. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
  22. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
  23. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
  24. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
  25. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
  26. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
  27. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
  28. package/.next/server/chunks/[root-of-the-server]__29b43490._.js +2 -2
  29. package/.next/server/chunks/[root-of-the-server]__29b43490._.js.map +1 -1
  30. package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
  31. package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
  32. package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
  33. package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
  34. package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
  35. package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
  36. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
  37. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
  38. package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
  39. package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
  40. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
  41. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
  42. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
  43. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
  44. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
  45. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
  46. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
  47. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
  48. package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js +1 -1
  49. package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js.map +1 -1
  50. package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
  51. package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
  52. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
  53. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
  54. package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
  55. package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
  56. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
  57. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
  58. package/.next/server/chunks/[root-of-the-server]__b9a334c3._.js +1 -1
  59. package/.next/server/chunks/[root-of-the-server]__b9a334c3._.js.map +1 -1
  60. package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
  61. package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
  62. package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js +2 -2
  63. package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js.map +1 -1
  64. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
  65. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
  66. package/.next/server/chunks/[root-of-the-server]__ed6cf593._.js +1 -1
  67. package/.next/server/chunks/[root-of-the-server]__ed6cf593._.js.map +1 -1
  68. package/.next/server/chunks/{[root-of-the-server]__30845206._.js → [root-of-the-server]__ff90af03._.js} +3 -3
  69. package/.next/server/chunks/{[root-of-the-server]__30845206._.js.map → [root-of-the-server]__ff90af03._.js.map} +1 -1
  70. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
  71. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
  72. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
  73. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
  74. package/.next/server/chunks/supercorp_superinterface_bebd2c96._.js +2 -2
  75. package/.next/server/chunks/supercorp_superinterface_bebd2c96._.js.map +1 -1
  76. package/.next/server/pages/404.html +1 -1
  77. package/.next/server/pages/500.html +1 -1
  78. package/.next/trace +1 -1
  79. package/bin/index.cjs +2 -0
  80. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts +55 -0
  81. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
  82. package/dist/app/api/api-keys/[apiKeyId]/route.js +10 -4
  83. package/dist/app/api/api-keys/route.d.ts +29 -0
  84. package/dist/app/api/api-keys/route.d.ts.map +1 -1
  85. package/dist/app/api/api-keys/route.js +8 -3
  86. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts +172 -0
  87. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
  88. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +11 -4
  89. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts +113 -0
  90. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
  91. package/dist/app/api/assistants/[assistantId]/functions/route.js +8 -3
  92. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts +39 -0
  93. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
  94. package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +8 -3
  95. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts +94 -0
  96. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
  97. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +10 -4
  98. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts +61 -0
  99. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
  100. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +7 -3
  101. package/dist/app/api/assistants/[assistantId]/route.d.ts +123 -0
  102. package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
  103. package/dist/app/api/assistants/[assistantId]/route.js +15 -6
  104. package/dist/app/api/assistants/route.d.ts +59 -0
  105. package/dist/app/api/assistants/route.d.ts.map +1 -1
  106. package/dist/app/api/assistants/route.js +8 -4
  107. package/dist/app/api/files/[fileId]/contents/route.d.ts +3 -2
  108. package/dist/app/api/files/[fileId]/contents/route.d.ts.map +1 -1
  109. package/dist/app/api/files/[fileId]/contents/route.js +6 -3
  110. package/dist/app/api/files/route.d.ts +10 -0
  111. package/dist/app/api/files/route.d.ts.map +1 -1
  112. package/dist/app/api/files/route.js +7 -3
  113. package/dist/app/api/messages/route.d.ts +24 -1
  114. package/dist/app/api/messages/route.d.ts.map +1 -1
  115. package/dist/app/api/messages/route.js +27 -6
  116. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts +19 -0
  117. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
  118. package/dist/app/api/providers/[modelProviderId]/assistants/route.js +4 -2
  119. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts +14 -0
  120. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
  121. package/dist/app/api/providers/[modelProviderId]/models/route.js +4 -2
  122. package/dist/app/api/providers/[modelProviderId]/route.d.ts +64 -0
  123. package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
  124. package/dist/app/api/providers/[modelProviderId]/route.js +12 -6
  125. package/dist/app/api/providers/route.d.ts +35 -0
  126. package/dist/app/api/providers/route.d.ts.map +1 -1
  127. package/dist/app/api/providers/route.js +9 -5
  128. package/dist/app/api/tasks/[taskId]/route.d.ts +61 -0
  129. package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
  130. package/dist/app/api/tasks/[taskId]/route.js +11 -5
  131. package/dist/app/api/tasks/callback/route.d.ts.map +1 -1
  132. package/dist/app/api/tasks/callback/route.js +14 -6
  133. package/dist/app/api/tasks/route.d.ts +33 -0
  134. package/dist/app/api/tasks/route.d.ts.map +1 -1
  135. package/dist/app/api/tasks/route.js +8 -4
  136. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts +9 -1
  137. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
  138. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +5 -3
  139. package/dist/app/api/workspaces/[workspaceId]/route.d.ts +33 -0
  140. package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
  141. package/dist/app/api/workspaces/[workspaceId]/route.js +7 -3
  142. package/dist/app/api/workspaces/route.d.ts +17 -3
  143. package/dist/app/api/workspaces/route.d.ts.map +1 -1
  144. package/dist/app/api/workspaces/route.js +8 -4
  145. package/dist/lib/apiKeys/getApiKey.d.ts +3 -2
  146. package/dist/lib/apiKeys/getApiKey.d.ts.map +1 -1
  147. package/dist/lib/apiKeys/getApiKey.js +1 -2
  148. package/dist/lib/apiKeys/workspaceAccessWhere.d.ts +3 -1
  149. package/dist/lib/apiKeys/workspaceAccessWhere.d.ts.map +1 -1
  150. package/dist/lib/apiKeys/workspaceAccessWhere.js +2 -1
  151. package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts +3 -2
  152. package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts.map +1 -1
  153. package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.js +3 -3
  154. package/dist/lib/assistants/assistantClientAdapter/index.d.ts.map +1 -1
  155. package/dist/lib/assistants/assistantClientAdapter/index.js +7 -2
  156. package/dist/lib/computerCalls/handleComputerCall/index.d.ts +3 -2
  157. package/dist/lib/computerCalls/handleComputerCall/index.d.ts.map +1 -1
  158. package/dist/lib/computerCalls/handleComputerCall/index.js +5 -1
  159. package/dist/lib/functions/createFunction.d.ts +2 -1
  160. package/dist/lib/functions/createFunction.d.ts.map +1 -1
  161. package/dist/lib/functions/createFunction.js +2 -2
  162. package/dist/lib/functions/handleFunction/handleAssistant.d.ts +3 -2
  163. package/dist/lib/functions/handleFunction/handleAssistant.d.ts.map +1 -1
  164. package/dist/lib/functions/handleFunction/handleAssistant.js +12 -2
  165. package/dist/lib/functions/handleFunction/handleClientTool.d.ts +3 -2
  166. package/dist/lib/functions/handleFunction/handleClientTool.d.ts.map +1 -1
  167. package/dist/lib/functions/handleFunction/handleClientTool.js +2 -1
  168. package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts +3 -2
  169. package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts.map +1 -1
  170. package/dist/lib/functions/handleFunction/handleFirecrawl.js +7 -1
  171. package/dist/lib/functions/handleFunction/handleReplicate.d.ts +3 -2
  172. package/dist/lib/functions/handleFunction/handleReplicate.d.ts.map +1 -1
  173. package/dist/lib/functions/handleFunction/handleReplicate.js +4 -1
  174. package/dist/lib/functions/handleFunction/handleRequest.d.ts +3 -2
  175. package/dist/lib/functions/handleFunction/handleRequest.d.ts.map +1 -1
  176. package/dist/lib/functions/handleFunction/handleRequest.js +6 -1
  177. package/dist/lib/functions/handleFunction/index.d.ts +3 -2
  178. package/dist/lib/functions/handleFunction/index.d.ts.map +1 -1
  179. package/dist/lib/functions/handleFunction/index.js +25 -1
  180. package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts +3 -2
  181. package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts.map +1 -1
  182. package/dist/lib/functions/handleFunction/tasks/handleCreateTask.js +4 -4
  183. package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts +3 -2
  184. package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts.map +1 -1
  185. package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.js +3 -3
  186. package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts +3 -2
  187. package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts.map +1 -1
  188. package/dist/lib/functions/handleFunction/tasks/handleListTasks.js +3 -3
  189. package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts +3 -2
  190. package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts.map +1 -1
  191. package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.js +4 -4
  192. package/dist/lib/functions/updateFunction.d.ts +2 -1
  193. package/dist/lib/functions/updateFunction.d.ts.map +1 -1
  194. package/dist/lib/functions/updateFunction.js +2 -2
  195. package/dist/lib/handlers/handlerPrismaInput.d.ts +3 -1
  196. package/dist/lib/handlers/handlerPrismaInput.d.ts.map +1 -1
  197. package/dist/lib/handlers/handlerPrismaInput.jsx +1 -2
  198. package/dist/lib/initialMessages/updateInitialMessages.d.ts +3 -2
  199. package/dist/lib/initialMessages/updateInitialMessages.d.ts.map +1 -1
  200. package/dist/lib/initialMessages/updateInitialMessages.js +1 -2
  201. package/dist/lib/logs/createLog.d.ts +3 -2
  202. package/dist/lib/logs/createLog.d.ts.map +1 -1
  203. package/dist/lib/logs/createLog.js +1 -2
  204. package/dist/lib/mcpServers/connectMcpServer.d.ts +6 -4
  205. package/dist/lib/mcpServers/connectMcpServer.d.ts.map +1 -1
  206. package/dist/lib/mcpServers/connectMcpServer.js +7 -5
  207. package/dist/lib/mcpServers/getToolCallMcpServer.d.ts +3 -2
  208. package/dist/lib/mcpServers/getToolCallMcpServer.d.ts.map +1 -1
  209. package/dist/lib/mcpServers/getToolCallMcpServer.js +2 -1
  210. package/dist/lib/mcpServers/headers.d.ts +3 -2
  211. package/dist/lib/mcpServers/headers.d.ts.map +1 -1
  212. package/dist/lib/mcpServers/headers.js +2 -1
  213. package/dist/lib/mcpServers/url.d.ts +3 -2
  214. package/dist/lib/mcpServers/url.d.ts.map +1 -1
  215. package/dist/lib/mcpServers/url.js +2 -1
  216. package/dist/lib/metadata/serializeMetadata.d.ts +3 -1
  217. package/dist/lib/metadata/serializeMetadata.d.ts.map +1 -1
  218. package/dist/lib/metadata/serializeMetadata.js +3 -2
  219. package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts +3 -2
  220. package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts.map +1 -1
  221. package/dist/lib/organizationApiKeys/getOrganizationApiKey.js +1 -2
  222. package/dist/lib/runs/createRunOpts.d.ts +3 -2
  223. package/dist/lib/runs/createRunOpts.d.ts.map +1 -1
  224. package/dist/lib/runs/createRunOpts.js +2 -2
  225. package/dist/lib/tasks/getTaskToolKey.d.ts +3 -2
  226. package/dist/lib/tasks/getTaskToolKey.d.ts.map +1 -1
  227. package/dist/lib/tasks/getTaskToolKey.js +2 -1
  228. package/dist/lib/tasks/parseTaskToolArgs.d.ts +3 -2
  229. package/dist/lib/tasks/parseTaskToolArgs.d.ts.map +1 -1
  230. package/dist/lib/tasks/parseTaskToolArgs.js +4 -1
  231. package/dist/lib/tasks/scheduleTask.d.ts +3 -2
  232. package/dist/lib/tasks/scheduleTask.d.ts.map +1 -1
  233. package/dist/lib/tasks/scheduleTask.js +1 -2
  234. package/dist/lib/threads/createThread/index.d.ts +3 -3
  235. package/dist/lib/threads/createThread/index.d.ts.map +1 -1
  236. package/dist/lib/threads/createThread/index.js +1 -0
  237. package/dist/lib/threads/managedOpenaiThreadId.d.ts +3 -2
  238. package/dist/lib/threads/managedOpenaiThreadId.d.ts.map +1 -1
  239. package/dist/lib/threads/managedOpenaiThreadId.js +1 -2
  240. package/dist/lib/toolCalls/handleToolCall.d.ts +3 -2
  241. package/dist/lib/toolCalls/handleToolCall.d.ts.map +1 -1
  242. package/dist/lib/toolCalls/handleToolCall.js +5 -1
  243. package/dist/lib/tools/tools/index.d.ts +3 -2
  244. package/dist/lib/tools/tools/index.d.ts.map +1 -1
  245. package/dist/lib/tools/tools/index.js +9 -6
  246. package/package.json +2 -2
  247. package/scripts/utils/loadPrisma.ts +1 -2
  248. /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_buildManifest.js +0 -0
  249. /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_clientMiddlewareManifest.json +0 -0
  250. /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_ssgManifest.js +0 -0
@@ -2,11 +2,11 @@ import { NextResponse } from 'next/server';
2
2
  import { ApiKeyType, TransportType } from '@prisma/client';
3
3
  import { headers } from 'next/headers';
4
4
  import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
5
- import { prisma } from '../../../../../lib/prisma';
5
+ import { prisma as defaultPrisma } from '../../../../../lib/prisma';
6
6
  import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
7
7
  import { serializeApiMcpServer } from '../../../../../lib/mcpServers/serializeApiMcpServer';
8
8
  import { mcpServerSchema } from '../../../../../lib/mcpServers/mcpServerSchema';
9
- export const GET = async (_request, props) => {
9
+ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
10
10
  const { assistantId } = await props.params;
11
11
  const headersList = await headers();
12
12
  const authorization = headersList.get('authorization');
@@ -16,6 +16,7 @@ export const GET = async (_request, props) => {
16
16
  const privateApiKey = await getApiKey({
17
17
  type: ApiKeyType.PRIVATE,
18
18
  authorization,
19
+ prisma,
19
20
  });
20
21
  if (!privateApiKey) {
21
22
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -47,7 +48,8 @@ export const GET = async (_request, props) => {
47
48
  })),
48
49
  }, { headers: cacheHeaders });
49
50
  };
50
- export const POST = async (request, props) => {
51
+ export const GET = buildGET();
52
+ export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
51
53
  const { assistantId } = await props.params;
52
54
  const headersList = await headers();
53
55
  const authorization = headersList.get('authorization');
@@ -57,6 +59,7 @@ export const POST = async (request, props) => {
57
59
  const privateApiKey = await getApiKey({
58
60
  authorization,
59
61
  type: ApiKeyType.PRIVATE,
62
+ prisma,
60
63
  });
61
64
  if (!privateApiKey) {
62
65
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -109,6 +112,7 @@ export const POST = async (request, props) => {
109
112
  mcpServer: serializeApiMcpServer({ mcpServer }),
110
113
  }, { headers: cacheHeaders });
111
114
  };
115
+ export const POST = buildPOST();
112
116
  export const OPTIONS = () => NextResponse.json({}, {
113
117
  headers: cacheHeaders,
114
118
  });
@@ -1,4 +1,61 @@
1
1
  import { type NextRequest, NextResponse } from 'next/server';
2
+ import { type PrismaClient } from '@prisma/client';
3
+ export declare const buildGET: ({ prisma }?: {
4
+ prisma?: PrismaClient;
5
+ }) => (request: NextRequest, props: {
6
+ params: Promise<{
7
+ assistantId: string;
8
+ }>;
9
+ }) => Promise<NextResponse<{
10
+ error: string;
11
+ }> | NextResponse<{
12
+ assistant: {
13
+ id: string;
14
+ storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
15
+ storageProviderAssistantId: string | null;
16
+ modelProviderId: string;
17
+ model: string;
18
+ name: string;
19
+ description: string;
20
+ instructions: string;
21
+ codeInterpreterEnabled: boolean;
22
+ fileSearchEnabled: boolean;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ avatar: {
26
+ type: import("@prisma/client").$Enums.AvatarType;
27
+ imageAvatar: {
28
+ url: string;
29
+ } | null;
30
+ iconAvatar: {
31
+ name: import("@prisma/client").$Enums.IconAvatarName;
32
+ } | null;
33
+ };
34
+ };
35
+ }> | NextResponse<{
36
+ assistant: {
37
+ id: string;
38
+ name: string;
39
+ description: string;
40
+ theme: {
41
+ accentColor: "gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky";
42
+ grayColor: "auto" | "gray" | "mauve" | "slate" | "sage" | "olive" | "sand";
43
+ appearance: "inherit" | "light" | "dark";
44
+ radius: "small" | "none" | "medium" | "large" | "full";
45
+ scaling: "90%" | "95%" | "100%" | "105%" | "110%";
46
+ panelBackground: "solid";
47
+ };
48
+ avatar: {
49
+ type: import("@prisma/client").$Enums.AvatarType;
50
+ imageAvatar: {
51
+ url: string;
52
+ } | null;
53
+ iconAvatar: {
54
+ name: import("@prisma/client").$Enums.IconAvatarName;
55
+ } | null;
56
+ };
57
+ };
58
+ }>>;
2
59
  export declare const GET: (request: NextRequest, props: {
3
60
  params: Promise<{
4
61
  assistantId: string;
@@ -53,6 +110,39 @@ export declare const GET: (request: NextRequest, props: {
53
110
  };
54
111
  };
55
112
  }>>;
113
+ export declare const buildPATCH: ({ prisma }?: {
114
+ prisma?: PrismaClient;
115
+ }) => (request: NextRequest, props: {
116
+ params: Promise<{
117
+ assistantId: string;
118
+ }>;
119
+ }) => Promise<NextResponse<{
120
+ error: string;
121
+ }> | NextResponse<{
122
+ assistant: {
123
+ id: string;
124
+ storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
125
+ storageProviderAssistantId: string | null;
126
+ modelProviderId: string;
127
+ model: string;
128
+ name: string;
129
+ description: string;
130
+ instructions: string;
131
+ codeInterpreterEnabled: boolean;
132
+ fileSearchEnabled: boolean;
133
+ createdAt: string;
134
+ updatedAt: string;
135
+ avatar: {
136
+ type: import("@prisma/client").$Enums.AvatarType;
137
+ imageAvatar: {
138
+ url: string;
139
+ } | null;
140
+ iconAvatar: {
141
+ name: import("@prisma/client").$Enums.IconAvatarName;
142
+ } | null;
143
+ };
144
+ };
145
+ }>>;
56
146
  export declare const PATCH: (request: NextRequest, props: {
57
147
  params: Promise<{
58
148
  assistantId: string;
@@ -84,6 +174,39 @@ export declare const PATCH: (request: NextRequest, props: {
84
174
  };
85
175
  };
86
176
  }>>;
177
+ export declare const buildDELETE: ({ prisma }?: {
178
+ prisma?: PrismaClient;
179
+ }) => (request: NextRequest, props: {
180
+ params: Promise<{
181
+ assistantId: string;
182
+ }>;
183
+ }) => Promise<NextResponse<{
184
+ error: string;
185
+ }> | NextResponse<{
186
+ assistant: {
187
+ id: string;
188
+ storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
189
+ storageProviderAssistantId: string | null;
190
+ modelProviderId: string;
191
+ model: string;
192
+ name: string;
193
+ description: string;
194
+ instructions: string;
195
+ codeInterpreterEnabled: boolean;
196
+ fileSearchEnabled: boolean;
197
+ createdAt: string;
198
+ updatedAt: string;
199
+ avatar: {
200
+ type: import("@prisma/client").$Enums.AvatarType;
201
+ imageAvatar: {
202
+ url: string;
203
+ } | null;
204
+ iconAvatar: {
205
+ name: import("@prisma/client").$Enums.IconAvatarName;
206
+ } | null;
207
+ };
208
+ };
209
+ }>>;
87
210
  export declare const DELETE: (request: NextRequest, props: {
88
211
  params: Promise<{
89
212
  assistantId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/assistants/[assistantId]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAgB5D,eAAO,MAAM,GAAG,GACd,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFF,CAAA;AAED,eAAO,MAAM,KAAK,GAChB,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAmJF,CAAA;AAED,eAAO,MAAM,MAAM,GACjB,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDF,CAAA;AAED,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/assistants/[assistantId]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAUvB,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FF,CAAA;AAEH,eAAO,MAAM,GAAG,YAnGH,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FwB,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAsJF,CAAA;AAEH,eAAO,MAAM,KAAK,YA7JL,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAwJ4B,CAAA;AAEjC,eAAO,MAAM,WAAW,GACrB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDF,CAAA;AAEH,eAAO,MAAM,MAAM,YA/DN,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0D8B,CAAA;AAEnC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -2,13 +2,13 @@ import { NextResponse } from 'next/server';
2
2
  import { StorageProviderType, ApiKeyType, ToolType, } from '@prisma/client';
3
3
  import { cacheHeaders } from '../../../../lib/cache/cacheHeaders';
4
4
  import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../../lib/apiKeys/workspaceAccessWhere';
5
- import { prisma } from '../../../../lib/prisma';
5
+ import { prisma as defaultPrisma } from '../../../../lib/prisma';
6
6
  import { serializeAssistant } from '../../../../lib/assistants/serializeAssistant';
7
7
  import { serializeApiAssistant } from '../../../../lib/assistants/serializeApiAssistant';
8
8
  import { headers } from 'next/headers';
9
9
  import { z } from 'zod';
10
10
  import { getApiKey } from '../../../../lib/apiKeys/getApiKey';
11
- export const GET = async (request, props) => {
11
+ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
12
12
  const params = await props.params;
13
13
  const { assistantId } = params;
14
14
  const headersList = await headers();
@@ -17,6 +17,7 @@ export const GET = async (request, props) => {
17
17
  const privateApiKey = await getApiKey({
18
18
  authorization,
19
19
  type: ApiKeyType.PRIVATE,
20
+ prisma,
20
21
  });
21
22
  if (!privateApiKey) {
22
23
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -45,6 +46,7 @@ export const GET = async (request, props) => {
45
46
  }
46
47
  const workspaceAccessWhere = await getWorkspaceAccessWhere({
47
48
  publicApiKey: request.nextUrl.searchParams.get('publicApiKey'),
49
+ prisma,
48
50
  });
49
51
  if (!workspaceAccessWhere) {
50
52
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -73,7 +75,8 @@ export const GET = async (request, props) => {
73
75
  assistant: serializeAssistant({ assistant }),
74
76
  }, { headers: cacheHeaders });
75
77
  };
76
- export const PATCH = async (request, props) => {
78
+ export const GET = buildGET();
79
+ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
77
80
  const params = await props.params;
78
81
  const { assistantId } = params;
79
82
  const headersList = await headers();
@@ -84,6 +87,7 @@ export const PATCH = async (request, props) => {
84
87
  const privateApiKey = await getApiKey({
85
88
  authorization,
86
89
  type: ApiKeyType.PRIVATE,
90
+ prisma,
87
91
  });
88
92
  if (!privateApiKey) {
89
93
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -103,7 +107,8 @@ export const PATCH = async (request, props) => {
103
107
  .superRefine((data, ctx) => {
104
108
  if (!data.storageProviderType)
105
109
  return;
106
- if (data.storageProviderType === StorageProviderType.SUPERINTERFACE_CLOUD &&
110
+ if (data.storageProviderType ===
111
+ StorageProviderType.SUPERINTERFACE_CLOUD &&
107
112
  data.storageProviderAssistantId) {
108
113
  ctx.addIssue({
109
114
  code: z.ZodIssueCode.custom,
@@ -111,7 +116,8 @@ export const PATCH = async (request, props) => {
111
116
  path: ['storageProviderAssistantId'],
112
117
  });
113
118
  }
114
- if (data.storageProviderType !== StorageProviderType.SUPERINTERFACE_CLOUD &&
119
+ if (data.storageProviderType !==
120
+ StorageProviderType.SUPERINTERFACE_CLOUD &&
115
121
  !data.storageProviderAssistantId) {
116
122
  ctx.addIssue({
117
123
  code: z.ZodIssueCode.custom,
@@ -174,7 +180,8 @@ export const PATCH = async (request, props) => {
174
180
  assistant: serializeApiAssistant({ assistant }),
175
181
  }, { headers: cacheHeaders });
176
182
  };
177
- export const DELETE = async (request, props) => {
183
+ export const PATCH = buildPATCH();
184
+ export const buildDELETE = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
178
185
  const params = await props.params;
179
186
  const { assistantId } = params;
180
187
  const headersList = await headers();
@@ -185,6 +192,7 @@ export const DELETE = async (request, props) => {
185
192
  const privateApiKey = await getApiKey({
186
193
  authorization,
187
194
  type: ApiKeyType.PRIVATE,
195
+ prisma,
188
196
  });
189
197
  if (!privateApiKey) {
190
198
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -216,6 +224,7 @@ export const DELETE = async (request, props) => {
216
224
  assistant: serializeApiAssistant({ assistant }),
217
225
  }, { headers: cacheHeaders });
218
226
  };
227
+ export const DELETE = buildDELETE();
219
228
  export const OPTIONS = () => NextResponse.json({}, {
220
229
  headers: cacheHeaders,
221
230
  });
@@ -1,4 +1,34 @@
1
+ import { type PrismaClient } from '@prisma/client';
1
2
  import { NextResponse } from 'next/server';
3
+ export declare const buildGET: ({ prisma }?: {
4
+ prisma?: PrismaClient;
5
+ }) => () => Promise<NextResponse<{
6
+ error: string;
7
+ }> | NextResponse<{
8
+ assistants: {
9
+ id: string;
10
+ storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
11
+ storageProviderAssistantId: string | null;
12
+ modelProviderId: string;
13
+ model: string;
14
+ name: string;
15
+ description: string;
16
+ instructions: string;
17
+ codeInterpreterEnabled: boolean;
18
+ fileSearchEnabled: boolean;
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ avatar: {
22
+ type: import("@prisma/client").$Enums.AvatarType;
23
+ imageAvatar: {
24
+ url: string;
25
+ } | null;
26
+ iconAvatar: {
27
+ name: import("@prisma/client").$Enums.IconAvatarName;
28
+ } | null;
29
+ };
30
+ }[];
31
+ }>>;
2
32
  export declare const GET: () => Promise<NextResponse<{
3
33
  error: string;
4
34
  }> | NextResponse<{
@@ -26,6 +56,35 @@ export declare const GET: () => Promise<NextResponse<{
26
56
  };
27
57
  }[];
28
58
  }>>;
59
+ export declare const buildPOST: ({ prisma }?: {
60
+ prisma?: PrismaClient;
61
+ }) => (request: Request) => Promise<NextResponse<{
62
+ error: string;
63
+ }> | NextResponse<{
64
+ assistant: {
65
+ id: string;
66
+ storageProviderType: import("@prisma/client").$Enums.StorageProviderType;
67
+ storageProviderAssistantId: string | null;
68
+ modelProviderId: string;
69
+ model: string;
70
+ name: string;
71
+ description: string;
72
+ instructions: string;
73
+ codeInterpreterEnabled: boolean;
74
+ fileSearchEnabled: boolean;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ avatar: {
78
+ type: import("@prisma/client").$Enums.AvatarType;
79
+ imageAvatar: {
80
+ url: string;
81
+ } | null;
82
+ iconAvatar: {
83
+ name: import("@prisma/client").$Enums.IconAvatarName;
84
+ } | null;
85
+ };
86
+ };
87
+ }>>;
29
88
  export declare const POST: (request: Request) => Promise<NextResponse<{
30
89
  error: string;
31
90
  }> | NextResponse<{
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GA0Cf,CAAA;AAwCD,eAAO,MAAM,IAAI,GAAU,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAgG1C,CAAA;AAED,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GA4C1D,CAAA;AAEH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GAAa,CAAA;AAwC7B,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGtB,CAAA;AAEH,eAAO,MAAM,IAAI,YAnGC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGM,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import { headers } from 'next/headers';
2
- import { ApiKeyType, StorageProviderType, ToolType } from '@prisma/client';
2
+ import { ApiKeyType, StorageProviderType, ToolType, } from '@prisma/client';
3
3
  import { NextResponse } from 'next/server';
4
4
  import { z } from 'zod';
5
5
  import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
6
- import { prisma } from '../../../lib/prisma';
6
+ import { prisma as defaultPrisma } from '../../../lib/prisma';
7
7
  import { serializeApiAssistant } from '../../../lib/assistants/serializeApiAssistant';
8
8
  import { getApiKey } from '../../../lib/apiKeys/getApiKey';
9
- export const GET = async () => {
9
+ export const buildGET = ({ prisma = defaultPrisma } = {}) => async () => {
10
10
  const headersList = await headers();
11
11
  const authorization = headersList.get('authorization');
12
12
  if (!authorization) {
@@ -15,6 +15,7 @@ export const GET = async () => {
15
15
  const privateApiKey = await getApiKey({
16
16
  authorization,
17
17
  type: ApiKeyType.PRIVATE,
18
+ prisma,
18
19
  });
19
20
  if (!privateApiKey) {
20
21
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -37,6 +38,7 @@ export const GET = async () => {
37
38
  assistants: assistants.map((a) => serializeApiAssistant({ assistant: a })),
38
39
  }, { headers: cacheHeaders });
39
40
  };
41
+ export const GET = buildGET();
40
42
  const createAssistantSchema = z
41
43
  .object({
42
44
  storageProviderType: z.nativeEnum(StorageProviderType),
@@ -67,7 +69,7 @@ const createAssistantSchema = z
67
69
  });
68
70
  }
69
71
  });
70
- export const POST = async (request) => {
72
+ export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) => {
71
73
  const headersList = await headers();
72
74
  const authorization = headersList.get('authorization');
73
75
  if (!authorization) {
@@ -76,6 +78,7 @@ export const POST = async (request) => {
76
78
  const privateApiKey = await getApiKey({
77
79
  authorization,
78
80
  type: ApiKeyType.PRIVATE,
81
+ prisma,
79
82
  });
80
83
  if (!privateApiKey) {
81
84
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
@@ -137,6 +140,7 @@ export const POST = async (request) => {
137
140
  assistant: serializeApiAssistant({ assistant }),
138
141
  }, { headers: cacheHeaders });
139
142
  };
143
+ export const POST = buildPOST();
140
144
  export const OPTIONS = () => NextResponse.json({}, {
141
145
  headers: cacheHeaders,
142
146
  });
@@ -1,7 +1,8 @@
1
1
  import type { OpenAI } from 'openai';
2
- import type { Prisma } from '@prisma/client';
2
+ import { type Prisma, type PrismaClient } from '@prisma/client';
3
3
  import { type NextRequest, NextResponse } from 'next/server';
4
- export declare const buildGET: ({ purposeAssistantsResponse, }: {
4
+ export declare const buildGET: ({ prisma, purposeAssistantsResponse, }?: {
5
+ prisma?: PrismaClient;
5
6
  purposeAssistantsResponse?: ({ file, }: {
6
7
  file: OpenAI.Files.FileObject;
7
8
  workspaceAccessWhere: Prisma.WorkspaceWhereInput;
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/files/[fileId]/contents/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,gCAGE;IACD,yBAAyB,CAAC,EAAE,CAAC,EAC3B,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAA;QAC7B,oBAAoB,EAAE,MAAM,CAAC,mBAAmB,CAAA;KACjD,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAA;CAC3C,MAEC,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;CACH,mCA0GF,CAAA;AAEH,eAAO,MAAM,GAAG,YAjHH,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;CACH,mCA4G0B,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/files/[fileId]/contents/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,yCAIE;IACD,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,yBAAyB,CAAC,EAAE,CAAC,EAC3B,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAA;QAC7B,oBAAoB,EAAE,MAAM,CAAC,mBAAmB,CAAA;KACjD,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAA;CACtC,MAEJ,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QACd,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;CACH,mCA6GF,CAAA;AAEH,eAAO,MAAM,GAAG,YApHH,WAAW,SACb;IACL,MAAM,EAAE,OAAO,CAAC;QACd,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;CACH,mCA+G0B,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -3,9 +3,9 @@ import { NextResponse } from 'next/server';
3
3
  import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
4
4
  import { assistantClientAdapter } from '../../../../../lib/assistants/assistantClientAdapter';
5
5
  import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../../../lib/apiKeys/workspaceAccessWhere';
6
- import { prisma } from '../../../../../lib/prisma';
6
+ import { prisma as defaultPrisma } from '../../../../../lib/prisma';
7
7
  import { isOpenaiAssistantsStorageProvider } from '../../../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
8
- export const buildGET = ({ purposeAssistantsResponse = () => NextResponse.json({ error: 'No file source found' }, { status: 404 }), }) => async (request, props) => {
8
+ export const buildGET = ({ prisma = defaultPrisma, purposeAssistantsResponse = () => NextResponse.json({ error: 'No file source found' }, { status: 404 }), } = {}) => async (request, props) => {
9
9
  var _a, _b;
10
10
  const params = await props.params;
11
11
  const { fileId } = params;
@@ -17,7 +17,10 @@ export const buildGET = ({ purposeAssistantsResponse = () => NextResponse.json({
17
17
  if (!isString(publicApiKey)) {
18
18
  return NextResponse.json({ error: 'Invalid publicApiKey' }, { status: 400 });
19
19
  }
20
- const workspaceAccessWhere = await getWorkspaceAccessWhere({ publicApiKey });
20
+ const workspaceAccessWhere = await getWorkspaceAccessWhere({
21
+ publicApiKey,
22
+ prisma,
23
+ });
21
24
  if (!workspaceAccessWhere) {
22
25
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
23
26
  }
@@ -1,5 +1,15 @@
1
1
  import type OpenAI from 'openai';
2
+ import { type PrismaClient } from '@prisma/client';
2
3
  import { type NextRequest, NextResponse } from 'next/server';
4
+ export declare const buildPOST: ({ prisma }?: {
5
+ prisma?: PrismaClient;
6
+ }) => (request: NextRequest) => Promise<NextResponse<{
7
+ error: string;
8
+ }> | NextResponse<{
9
+ file: OpenAI.Files.FileObject & {
10
+ _request_id?: string | null;
11
+ };
12
+ }>>;
3
13
  export declare const POST: (request: NextRequest) => Promise<NextResponse<{
4
14
  error: string;
5
15
  }> | NextResponse<{
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/files/route.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,IAAI,GAAU,SAAS,WAAW;;;;;;GAkG9C,CAAA;AAED,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/files/route.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACvE,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;GA8G1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAhHC,WAAW;;;;;;GAgHE,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -4,9 +4,9 @@ import { NextResponse } from 'next/server';
4
4
  import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
5
5
  import { assistantClientAdapter } from '../../../lib/assistants/assistantClientAdapter';
6
6
  import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../lib/apiKeys/workspaceAccessWhere';
7
- import { prisma } from '../../../lib/prisma';
7
+ import { prisma as defaultPrisma } from '../../../lib/prisma';
8
8
  import { isOpenaiAssistantsStorageProvider } from '../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
9
- export const POST = async (request) => {
9
+ export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) => {
10
10
  var _a;
11
11
  const formData = await request.formData();
12
12
  const assistantId = formData.get('assistantId');
@@ -18,7 +18,10 @@ export const POST = async (request) => {
18
18
  return NextResponse.json({ error: 'Invalid publicApiKey' }, { status: 400 });
19
19
  }
20
20
  const file = formData.get('file');
21
- const workspaceAccessWhere = await getWorkspaceAccessWhere({ publicApiKey });
21
+ const workspaceAccessWhere = await getWorkspaceAccessWhere({
22
+ publicApiKey,
23
+ prisma,
24
+ });
22
25
  if (!workspaceAccessWhere) {
23
26
  return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
24
27
  }
@@ -81,6 +84,7 @@ export const POST = async (request) => {
81
84
  file: createFileResponse,
82
85
  }, { headers: cacheHeaders });
83
86
  };
87
+ export const POST = buildPOST();
84
88
  export const OPTIONS = () => NextResponse.json({}, {
85
89
  headers: cacheHeaders,
86
90
  });
@@ -1,7 +1,29 @@
1
1
  import { type NextRequest, NextResponse } from 'next/server';
2
2
  import OpenAI from 'openai';
3
+ import { type PrismaClient } from '@prisma/client';
3
4
  import type { Thread } from '@prisma/client';
4
5
  export declare const maxDuration = 800;
6
+ export declare const buildGET: ({ prisma }?: {
7
+ prisma?: PrismaClient;
8
+ }) => (request: NextRequest) => Promise<NextResponse<{
9
+ error: string;
10
+ }> | NextResponse<{
11
+ data: {
12
+ id: string;
13
+ role: "user" | "assistant";
14
+ created_at: number;
15
+ content: OpenAI.Beta.Threads.Messages.MessageContent[];
16
+ run_id: string;
17
+ assistant_id: string;
18
+ thread_id: string;
19
+ attachments: OpenAI.Beta.Threads.Messages.Message.Attachment[];
20
+ metadata: import("openai/resources/shared.mjs").Metadata;
21
+ runSteps: Pick<OpenAI.Beta.Threads.Runs.Steps.RunStep, "id" | "run_id" | "step_details" | "completed_at" | "cancelled_at" | "failed_at" | "status">[];
22
+ status: "in_progress" | "incomplete" | "completed";
23
+ }[];
24
+ hasNextPage: boolean;
25
+ lastId: null;
26
+ }> | NextResponse<import("@superinterface/react/types/index").MessagesPage>>;
5
27
  export declare const GET: (request: NextRequest) => Promise<NextResponse<{
6
28
  error: string;
7
29
  }> | NextResponse<{
@@ -21,7 +43,8 @@ export declare const GET: (request: NextRequest) => Promise<NextResponse<{
21
43
  hasNextPage: boolean;
22
44
  lastId: null;
23
45
  }> | NextResponse<import("@superinterface/react/types/index").MessagesPage>>;
24
- export declare const buildPOST: ({ onSuccessCreateThread, }: {
46
+ export declare const buildPOST: ({ prisma, onSuccessCreateThread, }?: {
47
+ prisma?: PrismaClient;
25
48
  onSuccessCreateThread?: ({ thread, }: {
26
49
  thread: Thread;
27
50
  }) => void | Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA2B5C,eAAO,MAAM,WAAW,MAAM,CAAA;AAE9B,eAAO,MAAM,GAAG,GAAU,SAAS,WAAW;;;;;;;;;;;;;;;;;;4EAmK7C,CAAA;AAED,eAAO,MAAM,SAAS,GACnB,4BAEE;IACD,qBAAqB,CAAC,EAAE,CAAC,EACvB,MAAM,GACP,EAAE;QACD,MAAM,EAAE,MAAM,CAAA;KACf,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B,MACM,SAAS,WAAW,sBA4e1B,CAAA;AAEH,eAAO,MAAM,IAAI,YA9eC,WAAW,sBA8eI,CAAA;AAEjC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA2B5C,eAAO,MAAM,WAAW,MAAM,CAAA;AAE9B,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;;;;;;4EAuK1B,CAAA;AAEH,eAAO,MAAM,GAAG,YAzKE,WAAW;;;;;;;;;;;;;;;;;;4EAyKA,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,qCAGE;IACD,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,qBAAqB,CAAC,EAAE,CAAC,EACvB,MAAM,GACP,EAAE;QACD,MAAM,EAAE,MAAM,CAAA;KACf,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtB,MACC,SAAS,WAAW,sBA4f1B,CAAA;AAEH,eAAO,MAAM,IAAI,YA9fC,WAAW,sBA8fI,CAAA;AAEjC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}