@superinterface/server 1.0.19 → 1.0.20

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 (122) 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/index.html +1 -1
  9. package/.next/server/app/index.rsc +1 -1
  10. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
  11. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
  12. package/.next/server/chunks/[root-of-the-server]__228bff78._.js +2 -2
  13. package/.next/server/chunks/[root-of-the-server]__228bff78._.js.map +1 -1
  14. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
  15. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
  16. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
  17. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
  18. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
  19. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
  20. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
  21. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
  22. package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
  23. package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
  24. package/.next/server/chunks/[root-of-the-server]__3307123c._.js +2 -2
  25. package/.next/server/chunks/[root-of-the-server]__3307123c._.js.map +1 -1
  26. package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
  27. package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
  28. package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
  29. package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
  30. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
  31. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
  32. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js +2 -2
  33. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js.map +1 -1
  34. package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
  35. package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
  36. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
  37. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
  38. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
  39. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
  40. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
  41. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
  42. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
  43. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
  44. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js +2 -2
  45. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js.map +1 -1
  46. package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
  47. package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
  48. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
  49. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
  50. package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
  51. package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
  52. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
  53. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
  54. package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
  55. package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
  56. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js +2 -2
  57. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js.map +1 -1
  58. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
  59. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
  60. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js +2 -2
  61. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +1 -1
  62. package/.next/server/chunks/[root-of-the-server]__ff90af03._.js +2 -2
  63. package/.next/server/chunks/[root-of-the-server]__ff90af03._.js.map +1 -1
  64. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
  65. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
  66. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
  67. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
  68. package/.next/server/functions-config-manifest.json +2 -2
  69. package/.next/server/pages/404.html +1 -1
  70. package/.next/server/pages/500.html +1 -1
  71. package/.next/trace +1 -1
  72. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
  73. package/dist/app/api/api-keys/[apiKeyId]/route.js +4 -4
  74. package/dist/app/api/api-keys/route.d.ts.map +1 -1
  75. package/dist/app/api/api-keys/route.js +3 -3
  76. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
  77. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +4 -4
  78. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
  79. package/dist/app/api/assistants/[assistantId]/functions/route.js +3 -3
  80. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
  81. package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +3 -3
  82. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
  83. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +4 -4
  84. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
  85. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +3 -3
  86. package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
  87. package/dist/app/api/assistants/[assistantId]/route.js +4 -4
  88. package/dist/app/api/assistants/route.d.ts.map +1 -1
  89. package/dist/app/api/assistants/route.js +3 -3
  90. package/dist/app/api/files/[fileId]/contents/route.js +5 -5
  91. package/dist/app/api/files/route.d.ts.map +1 -1
  92. package/dist/app/api/files/route.js +4 -4
  93. package/dist/app/api/messages/route.d.ts.map +1 -1
  94. package/dist/app/api/messages/route.js +15 -11
  95. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
  96. package/dist/app/api/providers/[modelProviderId]/assistants/route.js +2 -2
  97. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
  98. package/dist/app/api/providers/[modelProviderId]/models/route.js +2 -2
  99. package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
  100. package/dist/app/api/providers/[modelProviderId]/route.js +4 -4
  101. package/dist/app/api/providers/route.d.ts.map +1 -1
  102. package/dist/app/api/providers/route.js +3 -3
  103. package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
  104. package/dist/app/api/tasks/[taskId]/route.js +4 -4
  105. package/dist/app/api/tasks/callback/route.js +6 -6
  106. package/dist/app/api/tasks/route.d.ts.map +1 -1
  107. package/dist/app/api/tasks/route.js +3 -3
  108. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
  109. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +2 -2
  110. package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
  111. package/dist/app/api/workspaces/[workspaceId]/route.js +3 -3
  112. package/dist/app/api/workspaces/route.d.ts.map +1 -1
  113. package/dist/app/api/workspaces/route.js +3 -3
  114. package/dist/lib/mcpServers/connectMcpServer.d.ts +1 -1
  115. package/dist/lib/prisma/index.d.ts +2 -0
  116. package/dist/lib/prisma/index.d.ts.map +1 -1
  117. package/dist/lib/prisma/index.js +16 -4
  118. package/dist/lib/threads/createThread/index.d.ts +3 -3
  119. package/package.json +1 -1
  120. /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → Ggpv5PXa7pPyxP1NXVbh6}/_buildManifest.js +0 -0
  121. /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → Ggpv5PXa7pPyxP1NXVbh6}/_clientMiddlewareManifest.json +0 -0
  122. /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → Ggpv5PXa7pPyxP1NXVbh6}/_ssgManifest.js +0 -0
@@ -2,7 +2,7 @@ import { NextResponse } from 'next/server';
2
2
  import { verifySignatureAppRouter } from '@upstash/qstash/nextjs';
3
3
  import { createMessageResponse } from '@superinterface/react/server';
4
4
  import { LogRequestMethod, LogRequestRoute, LogLevel, } from '@prisma/client';
5
- import { prisma as defaultPrisma } from '../../../../lib/prisma';
5
+ import { getPrisma } from '../../../../lib/prisma';
6
6
  import { assistantClientAdapter } from '../../../../lib/assistants/assistantClientAdapter';
7
7
  import { createRunOpts } from '../../../../lib/runs/createRunOpts';
8
8
  import { scheduleTask } from '../../../../lib/tasks/scheduleTask';
@@ -15,7 +15,7 @@ import { isOpenaiAssistantsStorageProvider } from '../../../../lib/storageProvid
15
15
  import { managedOpenaiThreadId } from '../../../../lib/threads/managedOpenaiThreadId';
16
16
  import { serializeMetadata } from '../../../../lib/metadata/serializeMetadata';
17
17
  export const maxDuration = 800;
18
- const buildPostHandler = ({ prisma = defaultPrisma } = {}) => async (request) => {
18
+ const buildPostHandler = ({ prisma = getPrisma() } = {}) => async (request) => {
19
19
  var _a, _b;
20
20
  const { taskId } = await request.json();
21
21
  const task = await prisma.task.findUnique({
@@ -81,7 +81,7 @@ const buildPostHandler = ({ prisma = defaultPrisma } = {}) => async (request) =>
81
81
  }
82
82
  const assistant = task.thread.assistant;
83
83
  const thread = task.thread;
84
- const client = assistantClientAdapter({ assistant, prisma });
84
+ const assistantClient = assistantClientAdapter({ assistant, prisma });
85
85
  let storageThreadId;
86
86
  try {
87
87
  storageThreadId = getStorageThreadId({
@@ -151,7 +151,7 @@ const buildPostHandler = ({ prisma = defaultPrisma } = {}) => async (request) =>
151
151
  return NextResponse.json({ error: 'Invalid thread configuration.' }, { status: 500 });
152
152
  }
153
153
  try {
154
- await client.beta.threads.messages.create(storageThreadId, {
154
+ await assistantClient.beta.threads.messages.create(storageThreadId, {
155
155
  role: 'user',
156
156
  content: task.message,
157
157
  metadata: serializeMetadata({
@@ -184,7 +184,7 @@ const buildPostHandler = ({ prisma = defaultPrisma } = {}) => async (request) =>
184
184
  }
185
185
  let createRunStream;
186
186
  try {
187
- createRunStream = await client.beta.threads.runs.create(storageThreadId, await createRunOpts({ assistant, thread, prisma }));
187
+ createRunStream = await assistantClient.beta.threads.runs.create(storageThreadId, await createRunOpts({ assistant, thread, prisma }));
188
188
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
189
189
  }
190
190
  catch (error) {
@@ -205,7 +205,7 @@ const buildPostHandler = ({ prisma = defaultPrisma } = {}) => async (request) =>
205
205
  return NextResponse.json({ error: 'Failed to create run stream' }, { status: 500 });
206
206
  }
207
207
  const messageResponse = createMessageResponse({
208
- client,
208
+ client: assistantClient,
209
209
  createRunStream,
210
210
  handleToolCall: handleToolCall({ assistant, thread, prisma }),
211
211
  });
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/tasks/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAS5D,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;GAoC1B,CAAA;AAEH,eAAO,MAAM,GAAG,YAtCE,WAAW;;;;;;;;;;;;;GAsCA,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;GAiE1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAnEC,WAAW;;;;;;;;;;;;;GAmEE,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/tasks/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAS5D,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAClD,SAAS,WAAW;;;;;;;;;;;;;GAoC1B,CAAA;AAEH,eAAO,MAAM,GAAG,YAtCE,WAAW;;;;;;;;;;;;;GAsCA,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAClD,SAAS,WAAW;;;;;;;;;;;;;GAiE1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAnEC,WAAW;;;;;;;;;;;;;GAmEE,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -3,12 +3,12 @@ import { ApiKeyType } from '@prisma/client';
3
3
  import { NextResponse } from 'next/server';
4
4
  import { createTaskSchema } from '../../../lib/tasks/schemas';
5
5
  import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
6
- import { prisma as defaultPrisma } from '../../../lib/prisma';
6
+ import { getPrisma } from '../../../lib/prisma';
7
7
  import { serializeTask } from '../../../lib/tasks/serializeTask';
8
8
  import { validateSchedule } from '../../../lib/tasks/validateSchedule';
9
9
  import { getApiKey } from '../../../lib/apiKeys/getApiKey';
10
10
  import { scheduleTask } from '../../../lib/tasks/scheduleTask';
11
- export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request) => {
11
+ export const buildGET = ({ prisma = getPrisma() } = {}) => async (request) => {
12
12
  const headersList = await headers();
13
13
  const authorization = headersList.get('authorization');
14
14
  if (!authorization) {
@@ -32,7 +32,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request) =>
32
32
  }, { headers: cacheHeaders });
33
33
  };
34
34
  export const GET = buildGET();
35
- export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) => {
35
+ export const buildPOST = ({ prisma = getPrisma() } = {}) => async (request) => {
36
36
  var _a;
37
37
  const headersList = await headers();
38
38
  const authorization = headersList.get('authorization');
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/threads/runs/submit-client-tool-outputs/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAIvD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlD,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;GAgD1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAlDC,WAAW;;;;GAkDE,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/threads/runs/submit-client-tool-outputs/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAIvD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlD,eAAO,MAAM,SAAS,GACnB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAClD,SAAS,WAAW;;;;GAgD1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAlDC,WAAW;;;;GAkDE,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { NextResponse } from 'next/server';
2
2
  import { map } from 'p-iteration';
3
3
  import { redis } from '../../../../../lib/redis';
4
- import { prisma as defaultPrisma } from '../../../../../lib/prisma';
4
+ import { getPrisma } from '../../../../../lib/prisma';
5
5
  import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../../../lib/apiKeys/workspaceAccessWhere';
6
- export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) => {
6
+ export const buildPOST = ({ prisma = getPrisma() } = {}) => async (request) => {
7
7
  const body = await request.json();
8
8
  const { assistantId, publicApiKey, toolOutputs } = body;
9
9
  const workspaceAccessWhere = await getWorkspaceAccessWhere({
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/workspaces/[workspaceId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;GAkDpD,CAAA;AAEH,eAAO,MAAM,GAAG,aArDF,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;GAoD1B,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,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M,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;GAwE4B,CAAA;AAEjC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -2,11 +2,11 @@ import { headers } from 'next/headers';
2
2
  import { NextResponse } from 'next/server';
3
3
  import { z } from 'zod';
4
4
  import { cacheHeaders } from '../../../../lib/cache/cacheHeaders';
5
- import { prisma as defaultPrisma } from '../../../../lib/prisma';
5
+ import { getPrisma } from '../../../../lib/prisma';
6
6
  import { validate } from 'uuid';
7
7
  import { getOrganizationApiKey } from '../../../../lib/organizationApiKeys/getOrganizationApiKey';
8
8
  import { serializeApiWorkspace } from '../../../../lib/workspaces/serializeApiWorkspace';
9
- export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
9
+ export const buildGET = ({ prisma = getPrisma() } = {}) => async (_request, props) => {
10
10
  const { workspaceId } = await props.params;
11
11
  const headersList = await headers();
12
12
  const authorization = headersList.get('authorization');
@@ -37,7 +37,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
37
37
  }, { headers: cacheHeaders });
38
38
  };
39
39
  export const GET = buildGET();
40
- export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
40
+ export const buildPATCH = ({ prisma = getPrisma() } = {}) => async (request, props) => {
41
41
  const { workspaceId } = await props.params;
42
42
  const headersList = await headers();
43
43
  const authorization = headersList.get('authorization');
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/workspaces/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,QAAA,MAAM,qBAAqB;;;;;;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AY,EACZ,MAAM,GACP,EAAE;QACD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;QACjD,YAAY,EAAE,YAAY,CAAA;QAC1B,MAAM,EAAE,YAAY,CAAA;KACrB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;CACpB,MACC,SAAS,WAAW;;;;;;;;;GAuD1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAzDC,WAAW;;;;;;;;;GAyDI,CAAA;AAEjC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -2,13 +2,13 @@ import { headers } from 'next/headers';
2
2
  import { NextResponse } from 'next/server';
3
3
  import { z } from 'zod';
4
4
  import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
5
- import { prisma as defaultPrisma } from '../../../lib/prisma';
5
+ import { getPrisma } from '../../../lib/prisma';
6
6
  import { serializeApiWorkspace } from '../../../lib/workspaces/serializeApiWorkspace';
7
7
  import { getOrganizationApiKey } from '../../../lib/organizationApiKeys/getOrganizationApiKey';
8
8
  const createWorkspaceSchema = z.object({
9
9
  name: z.string().optional(),
10
10
  });
11
- export const buildGET = ({ prisma = defaultPrisma } = {}) => async () => {
11
+ export const buildGET = ({ prisma = getPrisma() } = {}) => async () => {
12
12
  const headersList = await headers();
13
13
  const authorization = headersList.get('authorization');
14
14
  if (!authorization) {
@@ -31,7 +31,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async () => {
31
31
  }, { headers: cacheHeaders });
32
32
  };
33
33
  export const GET = buildGET();
34
- export const buildPOST = ({ prisma = defaultPrisma, createWorkspace = ({ parsedData, organization, prisma, }) => {
34
+ export const buildPOST = ({ prisma = getPrisma(), createWorkspace = ({ parsedData, organization, prisma, }) => {
35
35
  var _a;
36
36
  return prisma.workspace.create({
37
37
  data: {
@@ -13,7 +13,7 @@ export declare const getTransport: ({ mcpServer, thread, assistant, prisma, }: {
13
13
  thread: Thread;
14
14
  assistant: Assistant;
15
15
  prisma: PrismaClient;
16
- }) => StreamableHTTPClientTransport | SSEClientTransport;
16
+ }) => SSEClientTransport | StreamableHTTPClientTransport;
17
17
  export declare const connectMcpServer: ({ mcpServer, thread, assistant, prisma, }: {
18
18
  mcpServer: Prisma.McpServerGetPayload<{
19
19
  include: {
@@ -2,7 +2,9 @@ import { PrismaClient } from '@prisma/client';
2
2
  declare const prismaClientSingleton: () => PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
3
3
  declare global {
4
4
  var prisma: undefined | ReturnType<typeof prismaClientSingleton>;
5
+ var __superinterfaceServerPrisma: undefined | PrismaClient;
5
6
  }
7
+ export declare const getPrisma: () => PrismaClient;
6
8
  export declare const prisma: PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
7
9
  export {};
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/prisma/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,QAAA,MAAM,qBAAqB,sIAiB1B,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;CACjE;AAED,eAAO,MAAM,MAAM,gIAA+C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/prisma/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,QAAA,MAAM,qBAAqB,sIAiB1B,CAAA;AAID,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;IAChE,IAAI,4BAA4B,EAAE,SAAS,GAAG,YAAY,CAAA;CAC3D;AAED,eAAO,MAAM,SAAS,QAAO,YAgB5B,CAAA;AAED,eAAO,MAAM,MAAM,gIAAc,CAAA"}
@@ -1,4 +1,3 @@
1
- var _a;
2
1
  import { PrismaNeon } from '@prisma/adapter-neon';
3
2
  import { PrismaClient } from '@prisma/client';
4
3
  const prismaClientSingleton = () => {
@@ -16,6 +15,19 @@ const prismaClientSingleton = () => {
16
15
  },
17
16
  });
18
17
  };
19
- export const prisma = (_a = globalThis.prisma) !== null && _a !== void 0 ? _a : prismaClientSingleton();
20
- if (process.env.NODE_ENV !== 'production')
21
- globalThis.prisma = prisma;
18
+ const globalKey = '__superinterfaceServerPrisma';
19
+ export const getPrisma = () => {
20
+ const globalForPrisma = globalThis;
21
+ if (globalForPrisma[globalKey])
22
+ return globalForPrisma[globalKey];
23
+ if (globalForPrisma.prisma) {
24
+ globalForPrisma[globalKey] = globalForPrisma.prisma;
25
+ return globalForPrisma.prisma;
26
+ }
27
+ const client = prismaClientSingleton();
28
+ globalForPrisma[globalKey] = client;
29
+ if (!globalForPrisma.prisma)
30
+ globalForPrisma.prisma = client;
31
+ return client;
32
+ };
33
+ export const prisma = getPrisma();
@@ -16,12 +16,12 @@ export declare const createThread: ({ client, assistant, prisma, variables, }: {
16
16
  };
17
17
  } & {
18
18
  id: string;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ assistantId: string;
19
22
  openaiThreadId: string | null;
20
23
  openaiConversationId: string | null;
21
24
  azureOpenaiConversationId: string | null;
22
- assistantId: string;
23
25
  metadata: PrismaJson.ThreadMetadata | null;
24
- createdAt: Date;
25
- updatedAt: Date;
26
26
  }>;
27
27
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superinterface/server",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superinterface-server": "./bin/index.cjs"