@superinterface/server 1.0.19 → 1.0.21
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_btwyo7 +1 -1
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__228bff78._.js +10 -10
- package/.next/server/chunks/[root-of-the-server]__228bff78._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__3307123c._.js +10 -10
- package/.next/server/chunks/[root-of-the-server]__3307123c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js +10 -10
- package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js +10 -10
- package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__e7819e95._.js +10 -10
- package/.next/server/chunks/[root-of-the-server]__e7819e95._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js +10 -10
- package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__ff90af03._.js +10 -10
- package/.next/server/chunks/[root-of-the-server]__ff90af03._.js.map +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
- package/.next/server/functions-config-manifest.json +2 -2
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/trace +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/route.js +4 -4
- package/dist/app/api/api-keys/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/route.js +3 -3
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +4 -4
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/route.js +3 -3
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +3 -3
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +4 -4
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +3 -3
- package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/route.js +4 -4
- package/dist/app/api/assistants/route.d.ts.map +1 -1
- package/dist/app/api/assistants/route.js +3 -3
- package/dist/app/api/files/[fileId]/contents/route.js +5 -5
- package/dist/app/api/files/route.d.ts.map +1 -1
- package/dist/app/api/files/route.js +4 -4
- package/dist/app/api/messages/route.d.ts.map +1 -1
- package/dist/app/api/messages/route.js +15 -11
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/assistants/route.js +2 -2
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/models/route.js +2 -2
- package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/route.js +4 -4
- package/dist/app/api/providers/route.d.ts.map +1 -1
- package/dist/app/api/providers/route.js +3 -3
- package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
- package/dist/app/api/tasks/[taskId]/route.js +4 -4
- package/dist/app/api/tasks/callback/route.js +6 -6
- package/dist/app/api/tasks/route.d.ts.map +1 -1
- package/dist/app/api/tasks/route.js +3 -3
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +2 -2
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/[workspaceId]/route.js +3 -3
- package/dist/app/api/workspaces/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/route.js +3 -3
- package/dist/lib/mcpServers/connectMcpServer.d.ts +1 -1
- package/dist/lib/prisma/index.d.ts +2 -1
- package/dist/lib/prisma/index.d.ts.map +1 -1
- package/dist/lib/prisma/index.js +42 -4
- package/dist/lib/threads/createThread/index.d.ts +3 -3
- package/package.json +1 -1
- /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → F76hCvc-i5ZvQskAGNyuc}/_buildManifest.js +0 -0
- /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → F76hCvc-i5ZvQskAGNyuc}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → F76hCvc-i5ZvQskAGNyuc}/_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 {
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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 {
|
|
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 =
|
|
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 =
|
|
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,
|
|
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 {
|
|
4
|
+
import { getPrisma } from '../../../../../lib/prisma';
|
|
5
5
|
import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../../../lib/apiKeys/workspaceAccessWhere';
|
|
6
|
-
export const buildPOST = ({ prisma =
|
|
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,
|
|
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,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;GAkDF,CAAA;AAEH,eAAO,MAAM,GAAG,aAvDF,WAAW,SACd;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;GAoDwB,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEvD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzC;;;;;;;;;GAsEF,CAAA;AAEH,eAAO,MAAM,KAAK,YA3EL,WAAW,SACb;IACL,MAAM,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 {
|
|
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 =
|
|
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 =
|
|
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;;;;;;EAEzB,CAAA;AAEF,eAAO,MAAM,QAAQ,GAClB,
|
|
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;;;;;;EAEzB,CAAA;AAEF,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO;;;;;;;;;GAsCxD,CAAA;AAEH,eAAO,MAAM,GAAG;;;;;;;;;GAAa,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,+BAiBE;IACD,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,eAAe,CAAC,EAAE,CAAC,EACjB,UAAU,EACV,YAAY,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 {
|
|
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 =
|
|
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 =
|
|
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
|
-
}) =>
|
|
16
|
+
}) => SSEClientTransport | StreamableHTTPClientTransport;
|
|
17
17
|
export declare const connectMcpServer: ({ mcpServer, thread, assistant, prisma, }: {
|
|
18
18
|
mcpServer: Prisma.McpServerGetPayload<{
|
|
19
19
|
include: {
|
|
@@ -3,6 +3,7 @@ declare const prismaClientSingleton: () => PrismaClient<import("@prisma/client")
|
|
|
3
3
|
declare global {
|
|
4
4
|
var prisma: undefined | ReturnType<typeof prismaClientSingleton>;
|
|
5
5
|
}
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const getPrisma: () => PrismaClient;
|
|
7
|
+
export declare const prisma: PrismaClient;
|
|
7
8
|
export {};
|
|
8
9
|
//# 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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/prisma/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAS7C,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,SAAS,QAAO,YAc5B,CAAA;AAQD,eAAO,MAAM,MAAM,EAsBb,YAAY,CAAA"}
|
package/dist/lib/prisma/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import { PrismaNeon } from '@prisma/adapter-neon';
|
|
3
2
|
import { PrismaClient } from '@prisma/client';
|
|
3
|
+
const prismaGlobalKey = Symbol.for('superinterface.server.prisma');
|
|
4
4
|
const prismaClientSingleton = () => {
|
|
5
5
|
const connectionString = `${process.env.DATABASE_URL}`;
|
|
6
6
|
if (process.env.NODE_ENV === 'test') {
|
|
@@ -16,6 +16,44 @@ const prismaClientSingleton = () => {
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
-
export const
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export const getPrisma = () => {
|
|
20
|
+
const globalForPrisma = globalThis;
|
|
21
|
+
if (globalForPrisma[prismaGlobalKey])
|
|
22
|
+
return globalForPrisma[prismaGlobalKey];
|
|
23
|
+
if (globalForPrisma.prisma) {
|
|
24
|
+
globalForPrisma[prismaGlobalKey] = globalForPrisma.prisma;
|
|
25
|
+
return globalForPrisma.prisma;
|
|
26
|
+
}
|
|
27
|
+
const client = prismaClientSingleton();
|
|
28
|
+
globalForPrisma[prismaGlobalKey] = client;
|
|
29
|
+
if (!globalForPrisma.prisma)
|
|
30
|
+
globalForPrisma.prisma = client;
|
|
31
|
+
return client;
|
|
32
|
+
};
|
|
33
|
+
const getClient = () => {
|
|
34
|
+
return getPrisma();
|
|
35
|
+
};
|
|
36
|
+
let prismaInstance;
|
|
37
|
+
export const prisma = new Proxy({}, {
|
|
38
|
+
get(_target, prop, receiver) {
|
|
39
|
+
const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
|
|
40
|
+
const value = Reflect.get(client, prop, receiver);
|
|
41
|
+
return typeof value === 'function' ? value.bind(client) : value;
|
|
42
|
+
},
|
|
43
|
+
set(_target, prop, value, receiver) {
|
|
44
|
+
const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
|
|
45
|
+
return Reflect.set(client, prop, value, receiver);
|
|
46
|
+
},
|
|
47
|
+
has(_target, prop) {
|
|
48
|
+
const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
|
|
49
|
+
return Reflect.has(client, prop);
|
|
50
|
+
},
|
|
51
|
+
ownKeys() {
|
|
52
|
+
const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
|
|
53
|
+
return Reflect.ownKeys(client);
|
|
54
|
+
},
|
|
55
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
56
|
+
const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
|
|
57
|
+
return Reflect.getOwnPropertyDescriptor(client, prop);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -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
|
File without changes
|
/package/.next/static/{rEvucoSBXJWMKfLWTgPF2 → F76hCvc-i5ZvQskAGNyuc}/_clientMiddlewareManifest.json
RENAMED
|
File without changes
|
|
File without changes
|