@superinterface/server 1.0.22 → 1.0.24
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/api/files/[fileId]/contents/route.js +3 -3
- package/.next/server/app/api/files/[fileId]/contents/route.js.nft.json +1 -1
- package/.next/server/app/api/files/route.js +3 -3
- package/.next/server/app/api/files/route.js.nft.json +1 -1
- package/.next/server/app/api/messages/route.js +6 -6
- package/.next/server/app/api/messages/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/callback/route.js +6 -7
- package/.next/server/app/api/tasks/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/threads/runs/submit-client-tool-outputs/route.js +1 -1
- package/.next/server/app/api/threads/runs/submit-client-tool-outputs/route.js.nft.json +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 +2 -2
- 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]__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]__29b43490._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__29b43490._.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 +2 -2
- package/.next/server/chunks/[root-of-the-server]__3307123c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__40ab45eb._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__40ab45eb._.js.map +1 -0
- 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 +2 -2
- package/.next/server/chunks/[root-of-the-server]__50c5f12c._.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]__676affb1._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__676affb1._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__72b72b9e._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__72b72b9e._.js.map +1 -0
- 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]__a878c913._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__a878c913._.js.map +1 -0
- 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]__dd176cb5._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__e7819e95._.js +2 -2
- 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 +2 -2
- package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__f845ef25._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__f845ef25._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__ff90af03._.js +2 -2
- 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/chunks/supercorp_superinterface_bebd2c96._.js +3 -3
- package/.next/server/chunks/supercorp_superinterface_bebd2c96._.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 +6 -51
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/route.js +10 -7
- package/dist/app/api/api-keys/route.d.ts +4 -26
- package/dist/app/api/api-keys/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/route.js +7 -5
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts +6 -168
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +10 -7
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts +4 -110
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/route.js +7 -5
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts +4 -36
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +7 -5
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts +6 -90
- 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 +10 -7
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts +4 -58
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +7 -5
- package/dist/app/api/assistants/[assistantId]/route.d.ts +6 -119
- package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/route.js +10 -7
- package/dist/app/api/assistants/route.d.ts +4 -56
- package/dist/app/api/assistants/route.d.ts.map +1 -1
- package/dist/app/api/assistants/route.js +7 -5
- package/dist/app/api/files/[fileId]/contents/route.d.ts +2 -6
- package/dist/app/api/files/[fileId]/contents/route.d.ts.map +1 -1
- package/dist/app/api/files/[fileId]/contents/route.js +4 -3
- package/dist/app/api/files/route.d.ts +2 -8
- package/dist/app/api/files/route.d.ts.map +1 -1
- package/dist/app/api/files/route.js +4 -3
- package/dist/app/api/messages/lib/initialMessagesResponse.d.ts.map +1 -1
- package/dist/app/api/messages/lib/initialMessagesResponse.js +2 -3
- package/dist/app/api/messages/route.d.ts +4 -22
- package/dist/app/api/messages/route.d.ts.map +1 -1
- package/dist/app/api/messages/route.js +7 -5
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts +2 -17
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/assistants/route.js +4 -3
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts +2 -12
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/models/route.js +4 -3
- package/dist/app/api/providers/[modelProviderId]/route.d.ts +6 -60
- package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/route.js +10 -7
- package/dist/app/api/providers/route.d.ts +4 -32
- package/dist/app/api/providers/route.d.ts.map +1 -1
- package/dist/app/api/providers/route.js +7 -5
- package/dist/app/api/tasks/[taskId]/route.d.ts +6 -57
- package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
- package/dist/app/api/tasks/[taskId]/route.js +10 -7
- package/dist/app/api/tasks/callback/route.d.ts.map +1 -1
- package/dist/app/api/tasks/callback/route.js +5 -5
- package/dist/app/api/tasks/route.d.ts +4 -30
- package/dist/app/api/tasks/route.d.ts.map +1 -1
- package/dist/app/api/tasks/route.js +7 -5
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts +2 -6
- 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 +6 -6
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts +4 -30
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/[workspaceId]/route.js +7 -5
- package/dist/app/api/workspaces/route.d.ts +4 -22
- package/dist/app/api/workspaces/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/route.js +7 -5
- package/dist/lib/functions/handleFunction/handleAssistant.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleAssistant.js +2 -3
- package/dist/lib/mcpServers/getToolCallMcpServer.d.ts.map +1 -1
- package/dist/lib/mcpServers/getToolCallMcpServer.js +5 -6
- package/dist/lib/prisma/index.d.ts +1 -0
- package/dist/lib/prisma/index.d.ts.map +1 -1
- package/dist/lib/prisma/index.js +12 -0
- package/dist/lib/tools/tools/index.d.ts.map +1 -1
- package/dist/lib/tools/tools/index.js +2 -3
- package/package.json +2 -3
- package/.next/server/chunks/[root-of-the-server]__19865527._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__19865527._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__3ba06f7c._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__3ba06f7c._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +0 -1
- package/dist/app/messages/lib/getWorkspaceId.d.ts +0 -6
- package/dist/app/messages/lib/getWorkspaceId.d.ts.map +0 -1
- package/dist/app/messages/lib/getWorkspaceId.js +0 -3
- package/dist/app/messages/lib/initialMessagesResponse.d.ts +0 -26
- package/dist/app/messages/lib/initialMessagesResponse.d.ts.map +0 -1
- package/dist/app/messages/lib/initialMessagesResponse.js +0 -59
- package/dist/app/messages/lib/serializeThread.d.ts +0 -18
- package/dist/app/messages/lib/serializeThread.d.ts.map +0 -1
- package/dist/app/messages/lib/serializeThread.js +0 -8
- package/dist/app/messages/route.d.ts +0 -31
- package/dist/app/messages/route.d.ts.map +0 -1
- package/dist/app/messages/route.js +0 -585
- package/dist/lib/prismaClient.d.ts +0 -5
- package/dist/lib/prismaClient.d.ts.map +0 -1
- package/dist/lib/prismaClient.js +0 -4
- /package/.next/static/{ImVeJObVDbb-MHLkfrFb1 → X1k4ISA6YteJsnJalPLxm}/_buildManifest.js +0 -0
- /package/.next/static/{ImVeJObVDbb-MHLkfrFb1 → X1k4ISA6YteJsnJalPLxm}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{ImVeJObVDbb-MHLkfrFb1 → X1k4ISA6YteJsnJalPLxm}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PrismaClient } from '@prisma/client';
|
|
2
2
|
import { NextResponse, type NextRequest } from 'next/server';
|
|
3
|
-
export declare const buildGET: ({ prisma }?: {
|
|
3
|
+
export declare const buildGET: ({ prisma: providedPrisma }?: {
|
|
4
4
|
prisma?: PrismaClient;
|
|
5
5
|
}) => (_request: NextRequest, props: {
|
|
6
6
|
params: Promise<{
|
|
@@ -13,16 +13,6 @@ export declare const buildGET: ({ prisma }?: {
|
|
|
13
13
|
id: string;
|
|
14
14
|
}[];
|
|
15
15
|
}>>;
|
|
16
|
-
export declare const GET:
|
|
17
|
-
params: Promise<{
|
|
18
|
-
modelProviderId: string;
|
|
19
|
-
}>;
|
|
20
|
-
}) => Promise<NextResponse<{
|
|
21
|
-
error: string;
|
|
22
|
-
}> | NextResponse<{
|
|
23
|
-
models: {
|
|
24
|
-
id: string;
|
|
25
|
-
}[];
|
|
26
|
-
}>>;
|
|
16
|
+
export declare const GET: ReturnType<typeof buildGET>;
|
|
27
17
|
export declare const OPTIONS: () => NextResponse<{}>;
|
|
28
18
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/providers/[modelProviderId]/models/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/providers/[modelProviderId]/models/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;GAkDF,CAAA;AAEH,eAAO,MAAM,GAAG,EACU,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,11 +2,12 @@ import { headers } from 'next/headers';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import {
|
|
5
|
+
import { resolvePrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { getModels } from '../../../../../lib/models/getModels';
|
|
8
8
|
import { serializeApiModel } from '../../../../../lib/models/serializeApiModel';
|
|
9
|
-
export const buildGET = ({ prisma
|
|
9
|
+
export const buildGET = ({ prisma: providedPrisma } = {}) => async (_request, props) => {
|
|
10
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
10
11
|
const { modelProviderId } = await props.params;
|
|
11
12
|
const headersList = await headers();
|
|
12
13
|
const authorization = headersList.get('authorization');
|
|
@@ -39,7 +40,7 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
39
40
|
})),
|
|
40
41
|
}, { headers: cacheHeaders });
|
|
41
42
|
};
|
|
42
|
-
export const GET = buildGET();
|
|
43
|
+
export const GET = ((...args) => buildGET()(...args));
|
|
43
44
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
44
45
|
headers: cacheHeaders,
|
|
45
46
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PrismaClient } from '@prisma/client';
|
|
2
2
|
import { NextResponse, type NextRequest } from 'next/server';
|
|
3
|
-
export declare const buildGET: ({ prisma }?: {
|
|
3
|
+
export declare const buildGET: ({ prisma: providedPrisma }?: {
|
|
4
4
|
prisma?: PrismaClient;
|
|
5
5
|
}) => (_request: NextRequest, props: {
|
|
6
6
|
params: Promise<{
|
|
@@ -21,26 +21,8 @@ export declare const buildGET: ({ prisma }?: {
|
|
|
21
21
|
updatedAt: string;
|
|
22
22
|
};
|
|
23
23
|
}>>;
|
|
24
|
-
export declare const GET:
|
|
25
|
-
|
|
26
|
-
modelProviderId: string;
|
|
27
|
-
}>;
|
|
28
|
-
}) => Promise<NextResponse<{
|
|
29
|
-
error: string;
|
|
30
|
-
}> | NextResponse<{
|
|
31
|
-
provider: {
|
|
32
|
-
id: string;
|
|
33
|
-
type: import("@prisma/client").$Enums.ModelProviderType;
|
|
34
|
-
name: string;
|
|
35
|
-
apiKey: string;
|
|
36
|
-
endpoint: string | null;
|
|
37
|
-
apiVersion: string | null;
|
|
38
|
-
workspaceId: string;
|
|
39
|
-
createdAt: string;
|
|
40
|
-
updatedAt: string;
|
|
41
|
-
};
|
|
42
|
-
}>>;
|
|
43
|
-
export declare const buildPATCH: ({ prisma }?: {
|
|
24
|
+
export declare const GET: ReturnType<typeof buildGET>;
|
|
25
|
+
export declare const buildPATCH: ({ prisma: providedPrisma }?: {
|
|
44
26
|
prisma?: PrismaClient;
|
|
45
27
|
}) => (request: NextRequest, props: {
|
|
46
28
|
params: Promise<{
|
|
@@ -61,26 +43,8 @@ export declare const buildPATCH: ({ prisma }?: {
|
|
|
61
43
|
updatedAt: string;
|
|
62
44
|
};
|
|
63
45
|
}>>;
|
|
64
|
-
export declare const PATCH:
|
|
65
|
-
|
|
66
|
-
modelProviderId: string;
|
|
67
|
-
}>;
|
|
68
|
-
}) => Promise<NextResponse<{
|
|
69
|
-
error: string;
|
|
70
|
-
}> | NextResponse<{
|
|
71
|
-
provider: {
|
|
72
|
-
id: string;
|
|
73
|
-
type: import("@prisma/client").$Enums.ModelProviderType;
|
|
74
|
-
name: string;
|
|
75
|
-
apiKey: string;
|
|
76
|
-
endpoint: string | null;
|
|
77
|
-
apiVersion: string | null;
|
|
78
|
-
workspaceId: string;
|
|
79
|
-
createdAt: string;
|
|
80
|
-
updatedAt: string;
|
|
81
|
-
};
|
|
82
|
-
}>>;
|
|
83
|
-
export declare const buildDELETE: ({ prisma }?: {
|
|
46
|
+
export declare const PATCH: ReturnType<typeof buildPATCH>;
|
|
47
|
+
export declare const buildDELETE: ({ prisma: providedPrisma }?: {
|
|
84
48
|
prisma?: PrismaClient;
|
|
85
49
|
}) => (_request: NextRequest, props: {
|
|
86
50
|
params: Promise<{
|
|
@@ -101,24 +65,6 @@ export declare const buildDELETE: ({ prisma }?: {
|
|
|
101
65
|
updatedAt: string;
|
|
102
66
|
};
|
|
103
67
|
}>>;
|
|
104
|
-
export declare const DELETE:
|
|
105
|
-
params: Promise<{
|
|
106
|
-
modelProviderId: string;
|
|
107
|
-
}>;
|
|
108
|
-
}) => Promise<NextResponse<{
|
|
109
|
-
error: string;
|
|
110
|
-
}> | NextResponse<{
|
|
111
|
-
provider: {
|
|
112
|
-
id: string;
|
|
113
|
-
type: import("@prisma/client").$Enums.ModelProviderType;
|
|
114
|
-
name: string;
|
|
115
|
-
apiKey: string;
|
|
116
|
-
endpoint: string | null;
|
|
117
|
-
apiVersion: string | null;
|
|
118
|
-
workspaceId: string;
|
|
119
|
-
createdAt: string;
|
|
120
|
-
updatedAt: string;
|
|
121
|
-
};
|
|
122
|
-
}>>;
|
|
68
|
+
export declare const DELETE: ReturnType<typeof buildDELETE>;
|
|
123
69
|
export declare const OPTIONS: () => NextResponse<{}>;
|
|
124
70
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/providers/[modelProviderId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,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/providers/[modelProviderId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,eAAO,MAAM,QAAQ,GAClB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GAgDF,CAAA;AAEH,eAAO,MAAM,GAAG,EACU,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,UAAU,GACpB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GAmFF,CAAA;AAEH,eAAO,MAAM,KAAK,EACU,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;AAEzD,eAAO,MAAM,WAAW,GACrB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IACL,MAAM,EAAE,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7C;;;;;;;;;;;;;;GA+DF,CAAA;AAEH,eAAO,MAAM,MAAM,EACU,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;AAE3D,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -3,11 +3,12 @@ import { ApiKeyType, ModelProviderType, } 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 {
|
|
6
|
+
import { resolvePrisma } from '../../../../lib/prisma';
|
|
7
7
|
import { serializeModelProvider } from '../../../../lib/modelProviders/serializeModelProvider';
|
|
8
8
|
import { getApiKey } from '../../../../lib/apiKeys/getApiKey';
|
|
9
9
|
import { validate } from 'uuid';
|
|
10
|
-
export const buildGET = ({ prisma
|
|
10
|
+
export const buildGET = ({ prisma: providedPrisma } = {}) => async (_request, props) => {
|
|
11
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
11
12
|
const { modelProviderId } = await props.params;
|
|
12
13
|
const headersList = await headers();
|
|
13
14
|
const authorization = headersList.get('authorization');
|
|
@@ -38,8 +39,9 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
38
39
|
provider: serializeModelProvider({ provider }),
|
|
39
40
|
}, { headers: cacheHeaders });
|
|
40
41
|
};
|
|
41
|
-
export const GET = buildGET();
|
|
42
|
-
export const buildPATCH = ({ prisma
|
|
42
|
+
export const GET = ((...args) => buildGET()(...args));
|
|
43
|
+
export const buildPATCH = ({ prisma: providedPrisma } = {}) => async (request, props) => {
|
|
44
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
43
45
|
const { modelProviderId } = await props.params;
|
|
44
46
|
const headersList = await headers();
|
|
45
47
|
const authorization = headersList.get('authorization');
|
|
@@ -88,8 +90,9 @@ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, p
|
|
|
88
90
|
provider: serializeModelProvider({ provider }),
|
|
89
91
|
}, { headers: cacheHeaders });
|
|
90
92
|
};
|
|
91
|
-
export const PATCH = buildPATCH();
|
|
92
|
-
export const buildDELETE = ({ prisma
|
|
93
|
+
export const PATCH = ((...args) => buildPATCH()(...args));
|
|
94
|
+
export const buildDELETE = ({ prisma: providedPrisma } = {}) => async (_request, props) => {
|
|
95
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
93
96
|
const { modelProviderId } = await props.params;
|
|
94
97
|
const headersList = await headers();
|
|
95
98
|
const authorization = headersList.get('authorization');
|
|
@@ -132,7 +135,7 @@ export const buildDELETE = ({ prisma = defaultPrisma } = {}) => async (_request,
|
|
|
132
135
|
provider: serializeModelProvider({ provider }),
|
|
133
136
|
}, { headers: cacheHeaders });
|
|
134
137
|
};
|
|
135
|
-
export const DELETE = buildDELETE();
|
|
138
|
+
export const DELETE = ((...args) => buildDELETE()(...args));
|
|
136
139
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
137
140
|
headers: cacheHeaders,
|
|
138
141
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PrismaClient } from '@prisma/client';
|
|
2
2
|
import { NextResponse, type NextRequest } from 'next/server';
|
|
3
|
-
export declare const buildGET: ({ prisma }?: {
|
|
3
|
+
export declare const buildGET: ({ prisma: providedPrisma }?: {
|
|
4
4
|
prisma?: PrismaClient;
|
|
5
5
|
}) => () => Promise<NextResponse<{
|
|
6
6
|
error: string;
|
|
@@ -17,22 +17,8 @@ export declare const buildGET: ({ prisma }?: {
|
|
|
17
17
|
updatedAt: string;
|
|
18
18
|
}[];
|
|
19
19
|
}>>;
|
|
20
|
-
export declare const GET:
|
|
21
|
-
|
|
22
|
-
}> | NextResponse<{
|
|
23
|
-
providers: {
|
|
24
|
-
id: string;
|
|
25
|
-
type: import("@prisma/client").$Enums.ModelProviderType;
|
|
26
|
-
name: string;
|
|
27
|
-
apiKey: string;
|
|
28
|
-
endpoint: string | null;
|
|
29
|
-
apiVersion: string | null;
|
|
30
|
-
workspaceId: string;
|
|
31
|
-
createdAt: string;
|
|
32
|
-
updatedAt: string;
|
|
33
|
-
}[];
|
|
34
|
-
}>>;
|
|
35
|
-
export declare const buildPOST: ({ prisma }?: {
|
|
20
|
+
export declare const GET: ReturnType<typeof buildGET>;
|
|
21
|
+
export declare const buildPOST: ({ prisma: providedPrisma }?: {
|
|
36
22
|
prisma?: PrismaClient;
|
|
37
23
|
}) => (request: NextRequest) => Promise<NextResponse<{
|
|
38
24
|
error: string;
|
|
@@ -49,20 +35,6 @@ export declare const buildPOST: ({ prisma }?: {
|
|
|
49
35
|
updatedAt: string;
|
|
50
36
|
};
|
|
51
37
|
}>>;
|
|
52
|
-
export declare const POST:
|
|
53
|
-
error: string;
|
|
54
|
-
}> | NextResponse<{
|
|
55
|
-
provider: {
|
|
56
|
-
id: string;
|
|
57
|
-
type: import("@prisma/client").$Enums.ModelProviderType;
|
|
58
|
-
name: string;
|
|
59
|
-
apiKey: string;
|
|
60
|
-
endpoint: string | null;
|
|
61
|
-
apiVersion: string | null;
|
|
62
|
-
workspaceId: string;
|
|
63
|
-
createdAt: string;
|
|
64
|
-
updatedAt: string;
|
|
65
|
-
};
|
|
66
|
-
}>>;
|
|
38
|
+
export declare const POST: ReturnType<typeof buildPOST>;
|
|
67
39
|
export declare const OPTIONS: () => NextResponse<{}>;
|
|
68
40
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/providers/route.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/providers/route.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAO5D,eAAO,MAAM,QAAQ,GAClB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO;;;;;;;;;;;;;;GAoC1D,CAAA;AAEH,eAAO,MAAM,GAAG,EACU,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,SAAS,GACnB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;;GA8D1B,CAAA;AAEH,eAAO,MAAM,IAAI,EACU,UAAU,CAAC,OAAO,SAAS,CAAC,CAAA;AAEvD,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -3,10 +3,11 @@ import { ApiKeyType, ModelProviderType, } 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 {
|
|
6
|
+
import { resolvePrisma } from '../../../lib/prisma';
|
|
7
7
|
import { serializeModelProvider } from '../../../lib/modelProviders/serializeModelProvider';
|
|
8
8
|
import { getApiKey } from '../../../lib/apiKeys/getApiKey';
|
|
9
|
-
export const buildGET = ({ prisma
|
|
9
|
+
export const buildGET = ({ prisma: providedPrisma } = {}) => async () => {
|
|
10
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
10
11
|
const headersList = await headers();
|
|
11
12
|
const authorization = headersList.get('authorization');
|
|
12
13
|
if (!authorization) {
|
|
@@ -29,8 +30,9 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async () => {
|
|
|
29
30
|
providers: providers.map((p) => serializeModelProvider({ provider: p })),
|
|
30
31
|
}, { headers: cacheHeaders });
|
|
31
32
|
};
|
|
32
|
-
export const GET = buildGET();
|
|
33
|
-
export const buildPOST = ({ prisma
|
|
33
|
+
export const GET = ((...args) => buildGET()(...args));
|
|
34
|
+
export const buildPOST = ({ prisma: providedPrisma } = {}) => async (request) => {
|
|
35
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
34
36
|
const headersList = await headers();
|
|
35
37
|
const authorization = headersList.get('authorization');
|
|
36
38
|
if (!authorization) {
|
|
@@ -72,7 +74,7 @@ export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
72
74
|
provider: serializeModelProvider({ provider }),
|
|
73
75
|
}, { headers: cacheHeaders });
|
|
74
76
|
};
|
|
75
|
-
export const POST = buildPOST();
|
|
77
|
+
export const POST = ((...args) => buildPOST()(...args));
|
|
76
78
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
77
79
|
headers: cacheHeaders,
|
|
78
80
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PrismaClient } from '@prisma/client';
|
|
2
2
|
import { NextResponse, type NextRequest } from 'next/server';
|
|
3
|
-
export declare const buildGET: ({ prisma }?: {
|
|
3
|
+
export declare const buildGET: ({ prisma: providedPrisma }?: {
|
|
4
4
|
prisma?: PrismaClient;
|
|
5
5
|
}) => (_request: NextRequest, props: {
|
|
6
6
|
params: Promise<{
|
|
@@ -20,25 +20,8 @@ export declare const buildGET: ({ prisma }?: {
|
|
|
20
20
|
updatedAt: string;
|
|
21
21
|
};
|
|
22
22
|
}>>;
|
|
23
|
-
export declare const GET:
|
|
24
|
-
|
|
25
|
-
taskId: string;
|
|
26
|
-
}>;
|
|
27
|
-
}) => Promise<NextResponse<{
|
|
28
|
-
error: string;
|
|
29
|
-
}> | NextResponse<{
|
|
30
|
-
task: {
|
|
31
|
-
id: string;
|
|
32
|
-
title: string;
|
|
33
|
-
message: string;
|
|
34
|
-
schedule: PrismaJson.TaskSchedule;
|
|
35
|
-
threadId: string;
|
|
36
|
-
key: string;
|
|
37
|
-
createdAt: string;
|
|
38
|
-
updatedAt: string;
|
|
39
|
-
};
|
|
40
|
-
}>>;
|
|
41
|
-
export declare const buildPATCH: ({ prisma }?: {
|
|
23
|
+
export declare const GET: ReturnType<typeof buildGET>;
|
|
24
|
+
export declare const buildPATCH: ({ prisma: providedPrisma }?: {
|
|
42
25
|
prisma?: PrismaClient;
|
|
43
26
|
}) => (request: NextRequest, props: {
|
|
44
27
|
params: Promise<{
|
|
@@ -58,25 +41,8 @@ export declare const buildPATCH: ({ prisma }?: {
|
|
|
58
41
|
updatedAt: string;
|
|
59
42
|
};
|
|
60
43
|
}>>;
|
|
61
|
-
export declare const PATCH:
|
|
62
|
-
|
|
63
|
-
taskId: string;
|
|
64
|
-
}>;
|
|
65
|
-
}) => Promise<NextResponse<{
|
|
66
|
-
error: string;
|
|
67
|
-
}> | NextResponse<{
|
|
68
|
-
task: {
|
|
69
|
-
id: string;
|
|
70
|
-
title: string;
|
|
71
|
-
message: string;
|
|
72
|
-
schedule: PrismaJson.TaskSchedule;
|
|
73
|
-
threadId: string;
|
|
74
|
-
key: string;
|
|
75
|
-
createdAt: string;
|
|
76
|
-
updatedAt: string;
|
|
77
|
-
};
|
|
78
|
-
}>>;
|
|
79
|
-
export declare const buildDELETE: ({ prisma }?: {
|
|
44
|
+
export declare const PATCH: ReturnType<typeof buildPATCH>;
|
|
45
|
+
export declare const buildDELETE: ({ prisma: providedPrisma }?: {
|
|
80
46
|
prisma?: PrismaClient;
|
|
81
47
|
}) => (_request: NextRequest, props: {
|
|
82
48
|
params: Promise<{
|
|
@@ -96,23 +62,6 @@ export declare const buildDELETE: ({ prisma }?: {
|
|
|
96
62
|
updatedAt: string;
|
|
97
63
|
};
|
|
98
64
|
}>>;
|
|
99
|
-
export declare const DELETE:
|
|
100
|
-
params: Promise<{
|
|
101
|
-
taskId: string;
|
|
102
|
-
}>;
|
|
103
|
-
}) => Promise<NextResponse<{
|
|
104
|
-
error: string;
|
|
105
|
-
}> | NextResponse<{
|
|
106
|
-
task: {
|
|
107
|
-
id: string;
|
|
108
|
-
title: string;
|
|
109
|
-
message: string;
|
|
110
|
-
schedule: PrismaJson.TaskSchedule;
|
|
111
|
-
threadId: string;
|
|
112
|
-
key: string;
|
|
113
|
-
createdAt: string;
|
|
114
|
-
updatedAt: string;
|
|
115
|
-
};
|
|
116
|
-
}>>;
|
|
65
|
+
export declare const DELETE: ReturnType<typeof buildDELETE>;
|
|
117
66
|
export declare const OPTIONS: () => NextResponse<{}>;
|
|
118
67
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/tasks/[taskId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAkB5D,eAAO,MAAM,QAAQ,GAClB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/tasks/[taskId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAkB5D,eAAO,MAAM,QAAQ,GAClB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GA+C/C,CAAA;AAEH,eAAO,MAAM,GAAG,EACU,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,UAAU,GACpB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GAkF/C,CAAA;AAEH,eAAO,MAAM,KAAK,EACU,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;AAEzD,eAAO,MAAM,WAAW,GACrB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;GAmD/C,CAAA;AAEH,eAAO,MAAM,MAAM,EACU,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;AAE3D,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { NextResponse } from 'next/server';
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { validate } from 'uuid';
|
|
6
6
|
import { cacheHeaders } from '../../../../lib/cache/cacheHeaders';
|
|
7
|
-
import {
|
|
7
|
+
import { resolvePrisma } from '../../../../lib/prisma';
|
|
8
8
|
import { serializeTask } from '../../../../lib/tasks/serializeTask';
|
|
9
9
|
import { validateSchedule } from '../../../../lib/tasks/validateSchedule';
|
|
10
10
|
import { getApiKey } from '../../../../lib/apiKeys/getApiKey';
|
|
@@ -16,7 +16,8 @@ const updateTaskSchema = z.object({
|
|
|
16
16
|
schedule: z.any().optional(),
|
|
17
17
|
key: z.string().optional(),
|
|
18
18
|
});
|
|
19
|
-
export const buildGET = ({ prisma
|
|
19
|
+
export const buildGET = ({ prisma: providedPrisma } = {}) => async (_request, props) => {
|
|
20
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
20
21
|
const { taskId } = await props.params;
|
|
21
22
|
const headersList = await headers();
|
|
22
23
|
const authorization = headersList.get('authorization');
|
|
@@ -48,8 +49,9 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, pr
|
|
|
48
49
|
}
|
|
49
50
|
return NextResponse.json({ task: serializeTask({ task }) }, { headers: cacheHeaders });
|
|
50
51
|
};
|
|
51
|
-
export const GET = buildGET();
|
|
52
|
-
export const buildPATCH = ({ prisma
|
|
52
|
+
export const GET = ((...args) => buildGET()(...args));
|
|
53
|
+
export const buildPATCH = ({ prisma: providedPrisma } = {}) => async (request, props) => {
|
|
54
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
53
55
|
const { taskId } = await props.params;
|
|
54
56
|
const headersList = await headers();
|
|
55
57
|
const authorization = headersList.get('authorization');
|
|
@@ -100,8 +102,9 @@ export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, p
|
|
|
100
102
|
await scheduleTask({ task, prisma });
|
|
101
103
|
return NextResponse.json({ task: serializeTask({ task }) }, { headers: cacheHeaders });
|
|
102
104
|
};
|
|
103
|
-
export const PATCH = buildPATCH();
|
|
104
|
-
export const buildDELETE = ({ prisma
|
|
105
|
+
export const PATCH = ((...args) => buildPATCH()(...args));
|
|
106
|
+
export const buildDELETE = ({ prisma: providedPrisma } = {}) => async (_request, props) => {
|
|
107
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
105
108
|
const { taskId } = await props.params;
|
|
106
109
|
const headersList = await headers();
|
|
107
110
|
const authorization = headersList.get('authorization');
|
|
@@ -135,7 +138,7 @@ export const buildDELETE = ({ prisma = defaultPrisma } = {}) => async (_request,
|
|
|
135
138
|
const task = await prisma.task.delete({ where: { id: existingTask.id } });
|
|
136
139
|
return NextResponse.json({ task: serializeTask({ task }) }, { headers: cacheHeaders });
|
|
137
140
|
};
|
|
138
|
-
export const DELETE = buildDELETE();
|
|
141
|
+
export const DELETE = ((...args) => buildDELETE()(...args));
|
|
139
142
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
140
143
|
headers: cacheHeaders,
|
|
141
144
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/tasks/callback/route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/tasks/callback/route.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,WAAW,MAAM,CAAA;AAgR9B,eAAO,MAAM,IAAI,2FAG0B,CAAA"}
|
|
@@ -2,21 +2,21 @@ 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 { resolvePrisma } 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';
|
|
9
9
|
import { handleToolCall } from '../../../../lib/toolCalls/handleToolCall';
|
|
10
10
|
import { createLog } from '../../../../lib/logs/createLog';
|
|
11
|
-
import { map } from 'p-iteration';
|
|
12
11
|
import { storageThreadId as getStorageThreadId } from '../../../../lib/threads/storageThreadId';
|
|
13
12
|
import { redis } from '../../../../lib/redis';
|
|
14
13
|
import { isOpenaiAssistantsStorageProvider } from '../../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
|
|
15
14
|
import { managedOpenaiThreadId } from '../../../../lib/threads/managedOpenaiThreadId';
|
|
16
15
|
import { serializeMetadata } from '../../../../lib/metadata/serializeMetadata';
|
|
17
16
|
export const maxDuration = 800;
|
|
18
|
-
const buildPostHandler = ({ prisma
|
|
17
|
+
const buildPostHandler = ({ prisma: providedPrisma } = {}) => async (request) => {
|
|
19
18
|
var _a, _b;
|
|
19
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
20
20
|
const { taskId } = await request.json();
|
|
21
21
|
const task = await prisma.task.findUnique({
|
|
22
22
|
where: { id: taskId },
|
|
@@ -228,11 +228,11 @@ const buildPostHandler = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
228
228
|
}
|
|
229
229
|
if (event.event === 'thread.run.requires_action' &&
|
|
230
230
|
((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.required_action) === null || _b === void 0 ? void 0 : _b.type) === 'submit_client_tool_outputs') {
|
|
231
|
-
await
|
|
231
|
+
await Promise.all(event.data.required_action.submit_client_tool_outputs.tool_calls.map(
|
|
232
232
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
233
233
|
async (toolCall) => {
|
|
234
234
|
await redis.set(`submit-client-tool-outputs:output:${toolCall.id}`, 'Client tools cannot be used during tasks', { ex: 60 * 60 * 24 * 7 });
|
|
235
|
-
});
|
|
235
|
+
}));
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
await scheduleTask({ task, prisma });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PrismaClient } from '@prisma/client';
|
|
2
2
|
import { NextResponse, type NextRequest } from 'next/server';
|
|
3
|
-
export declare const buildGET: ({ prisma }?: {
|
|
3
|
+
export declare const buildGET: ({ prisma: providedPrisma }?: {
|
|
4
4
|
prisma?: PrismaClient;
|
|
5
5
|
}) => (request: NextRequest) => Promise<NextResponse<{
|
|
6
6
|
error: string;
|
|
@@ -16,21 +16,8 @@ export declare const buildGET: ({ prisma }?: {
|
|
|
16
16
|
updatedAt: string;
|
|
17
17
|
}[];
|
|
18
18
|
}>>;
|
|
19
|
-
export declare const GET:
|
|
20
|
-
|
|
21
|
-
}> | NextResponse<{
|
|
22
|
-
tasks: {
|
|
23
|
-
id: string;
|
|
24
|
-
title: string;
|
|
25
|
-
message: string;
|
|
26
|
-
schedule: PrismaJson.TaskSchedule;
|
|
27
|
-
threadId: string;
|
|
28
|
-
key: string;
|
|
29
|
-
createdAt: string;
|
|
30
|
-
updatedAt: string;
|
|
31
|
-
}[];
|
|
32
|
-
}>>;
|
|
33
|
-
export declare const buildPOST: ({ prisma }?: {
|
|
19
|
+
export declare const GET: ReturnType<typeof buildGET>;
|
|
20
|
+
export declare const buildPOST: ({ prisma: providedPrisma }?: {
|
|
34
21
|
prisma?: PrismaClient;
|
|
35
22
|
}) => (request: NextRequest) => Promise<NextResponse<{
|
|
36
23
|
error: string;
|
|
@@ -46,19 +33,6 @@ export declare const buildPOST: ({ prisma }?: {
|
|
|
46
33
|
updatedAt: string;
|
|
47
34
|
};
|
|
48
35
|
}>>;
|
|
49
|
-
export declare const POST:
|
|
50
|
-
error: string;
|
|
51
|
-
}> | NextResponse<{
|
|
52
|
-
task: {
|
|
53
|
-
id: string;
|
|
54
|
-
title: string;
|
|
55
|
-
message: string;
|
|
56
|
-
schedule: PrismaJson.TaskSchedule;
|
|
57
|
-
threadId: string;
|
|
58
|
-
key: string;
|
|
59
|
-
createdAt: string;
|
|
60
|
-
updatedAt: string;
|
|
61
|
-
};
|
|
62
|
-
}>>;
|
|
36
|
+
export declare const POST: ReturnType<typeof buildPOST>;
|
|
63
37
|
export declare const OPTIONS: () => NextResponse<{}>;
|
|
64
38
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -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,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;GAqC1B,CAAA;AAEH,eAAO,MAAM,GAAG,EACU,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,SAAS,GACnB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;GAkE1B,CAAA;AAEH,eAAO,MAAM,IAAI,EACU,UAAU,CAAC,OAAO,SAAS,CAAC,CAAA;AAEvD,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -3,12 +3,13 @@ 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 { resolvePrisma } 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: providedPrisma } = {}) => async (request) => {
|
|
12
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
12
13
|
const headersList = await headers();
|
|
13
14
|
const authorization = headersList.get('authorization');
|
|
14
15
|
if (!authorization) {
|
|
@@ -31,9 +32,10 @@ export const buildGET = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
31
32
|
tasks: tasks.map((t) => serializeTask({ task: t })),
|
|
32
33
|
}, { headers: cacheHeaders });
|
|
33
34
|
};
|
|
34
|
-
export const GET = buildGET();
|
|
35
|
-
export const buildPOST = ({ prisma
|
|
35
|
+
export const GET = ((...args) => buildGET()(...args));
|
|
36
|
+
export const buildPOST = ({ prisma: providedPrisma } = {}) => async (request) => {
|
|
36
37
|
var _a;
|
|
38
|
+
const prisma = resolvePrisma(providedPrisma);
|
|
37
39
|
const headersList = await headers();
|
|
38
40
|
const authorization = headersList.get('authorization');
|
|
39
41
|
if (!authorization) {
|
|
@@ -82,7 +84,7 @@ export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request) =>
|
|
|
82
84
|
task: serializeTask({ task }),
|
|
83
85
|
}, { headers: cacheHeaders });
|
|
84
86
|
};
|
|
85
|
-
export const POST = buildPOST();
|
|
87
|
+
export const POST = ((...args) => buildPOST()(...args));
|
|
86
88
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
87
89
|
headers: cacheHeaders,
|
|
88
90
|
});
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import { type PrismaClient } from '@prisma/client';
|
|
3
|
-
export declare const buildPOST: ({ prisma }?: {
|
|
3
|
+
export declare const buildPOST: ({ prisma: providedPrisma }?: {
|
|
4
4
|
prisma?: PrismaClient;
|
|
5
5
|
}) => (request: NextRequest) => Promise<NextResponse<{
|
|
6
6
|
error: string;
|
|
7
7
|
}> | NextResponse<{
|
|
8
8
|
status: string;
|
|
9
9
|
}>>;
|
|
10
|
-
export declare const POST:
|
|
11
|
-
error: string;
|
|
12
|
-
}> | NextResponse<{
|
|
13
|
-
status: string;
|
|
14
|
-
}>>;
|
|
10
|
+
export declare const POST: ReturnType<typeof buildPOST>;
|
|
15
11
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -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;
|
|
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;AAGvD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlD,eAAO,MAAM,SAAS,GACnB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;GAiD1B,CAAA;AAEH,eAAO,MAAM,IAAI,EACU,UAAU,CAAC,OAAO,SAAS,CAAC,CAAA"}
|