Skip to content

Commit 8188696

Browse files
committed
Revert "Upgrade Vercel SDK v4 -> v5 (#1565)"
This reverts commit b051601.
1 parent b051601 commit 8188696

File tree

338 files changed

+3571
-3860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

338 files changed

+3571
-3860
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ apps/web/scripts-dist
5959

6060
# File uploads in development
6161
apps/web/uploads
62-
apps/web/storage
6362
apps/web/public/uploads
64-
apps/web/public/files
63+
apps/web/public/storage
6564
uploads
6665
storage
6766

AGENTS.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,41 +60,23 @@
6060

6161
### Action Layer (`apps/web/src/actions/`)
6262

63-
- Server actions use `authProcedure` pattern
63+
- Server actions use `authProcedure.createServerAction()` pattern
6464
- Input validation with Zod schemas
6565
- Actions fetch model instances using repositories before calling services
6666
- **Admin-only actions**: Place under `actions/admin/` directory for backoffice functionality
6767
- Example pattern:
6868

6969
```typescript
7070
export const updateApiKeyAction = authProcedure
71-
.inputSchema(z.object({ id: z.number(), name: z.string() }))
72-
.action(async ({ parsedInput, ctx }) => {
71+
.createServerAction()
72+
.input(z.object({ id: z.number(), name: z.string() }))
73+
.handler(async ({ input, ctx }) => {
7374
const repo = new Repository(ctx.workspace.id)
74-
const model = await repo.find(parsedInput.id).then((r) => r.unwrap())
75-
return updateService(model, { name: parsedInput.name }).then((r) =>
76-
r.unwrap(),
77-
)
75+
const model = await repo.find(input.id).then((r) => r.unwrap())
76+
return updateService(model, { name: input.name }).then((r) => r.unwrap())
7877
})
7978
```
8079

81-
- For writing an action with a different scope. Let's say withing projects:
82-
83-
```typescript
84-
import { withProject, withProjectSchema } from '../../procedures'
85-
export const updateProjectAction = withProject
86-
.inputSchema(withProjectSchema.extend({ id: z.number(), name: z.string() }))
87-
.action(async ({ parsedInput, ctx }) => {
88-
const repo = new ProjectRepository(ctx.workspace.id)
89-
const model = await repo.find(parsedInput.id).then((r) => r.unwrap())
90-
return updateProjectService(model, { name: parsedInput.name }).then((r) =>
91-
r.unwrap(),
92-
)
93-
})
94-
```
95-
96-
`withProject` procedure inherits from `authProcedure` and adds project validation.
97-
9880
### Store Layer (`apps/web/src/stores/`)
9981

10082
- Use SWR for data fetching with custom hooks

apps/gateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@hono/node-server": "1.13.2",
1818
"@hono/swagger-ui": "0.4.1",
19-
"@hono/zod-openapi": "1.1.1",
19+
"@hono/zod-openapi": "0.16.4",
2020
"@latitude-data/constants": "workspace:^",
2121
"@latitude-data/core": "workspace:^",
2222
"@latitude-data/env": "workspace:^",

apps/gateway/src/openApi/schemas/ai.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export const languageModelUsageSchema = z.object({
1515
export const toolCallSchema = z.object({
1616
id: z.string(),
1717
name: z.string(),
18-
arguments: z.record(z.string(), z.any()),
18+
arguments: z.record(z.any()),
1919
})
2020

21-
export const configSchema = z.record(z.string(), z.any())
22-
export const providerLogSchema = z.record(z.string(), z.any())
21+
export const configSchema = z.object({}).passthrough()
22+
export const providerLogSchema = z.object({}).passthrough()
2323
export const chainStepResponseSchema = z.discriminatedUnion('streamType', [
2424
z.object({
2525
streamType: z.literal('text'),
@@ -58,7 +58,7 @@ export const chainEventDtoResponseSchema = z.discriminatedUnion('streamType', [
5858
export const legacyChainEventDtoSchema = z.discriminatedUnion('event', [
5959
z.object({
6060
event: z.literal(StreamEventTypes.Provider),
61-
data: z.record(z.string(), z.any()),
61+
data: z.object({}).passthrough(),
6262
}),
6363
z.object({
6464
event: z.literal(StreamEventTypes.Latitude),
@@ -79,7 +79,7 @@ export const legacyChainEventDtoSchema = z.discriminatedUnion('event', [
7979
type: z.literal(LegacyChainEventTypes.Complete),
8080
config: configSchema,
8181
messages: z.array(messageSchema).optional(),
82-
object: z.record(z.string(), z.any()).optional(),
82+
object: z.object({}).passthrough().optional(),
8383
response: chainEventDtoResponseSchema,
8484
uuid: z.string().optional(),
8585
}),
@@ -106,8 +106,8 @@ export const ProjectSchema = z.object({
106106
id: z.number(),
107107
name: z.string(),
108108
workspaceId: z.number(),
109-
createdAt: z.iso.datetime(),
110-
updatedAt: z.iso.datetime(),
111-
lastEditedAt: z.iso.datetime().optional(),
112-
deletedAt: z.iso.datetime().nullable().optional(),
109+
createdAt: z.string().datetime(),
110+
updatedAt: z.string().datetime(),
111+
lastEditedAt: z.string().datetime().optional(),
112+
deletedAt: z.string().datetime().nullable().optional(),
113113
})

apps/gateway/src/openApi/schemas/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { LogSources } from '@latitude-data/core/browser'
44
export const internalInfoSchema = z.object({
55
__internal: z
66
.object({
7-
source: z.enum(LogSources).optional(),
7+
source: z.nativeEnum(LogSources).optional(),
88
})
99
.optional(),
1010
})

apps/gateway/src/presenters/documentPresenter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export const documentPresenterSchema = z.object({
1616
path: z.string(),
1717
content: z.string(),
1818
contentHash: z.string().optional(),
19-
config: z.record(z.string(), z.any()),
20-
parameters: z.record(z.string(), z.object({ type: z.enum(ParameterType) })),
21-
provider: z.enum(Providers).optional(),
19+
config: z.object({}).passthrough(),
20+
parameters: z.record(z.object({ type: z.nativeEnum(ParameterType) })),
21+
provider: z.nativeEnum(Providers).optional(),
2222
})
2323
type Parameters = z.infer<typeof documentPresenterSchema>['parameters']
2424

apps/gateway/src/routes/api/v1/run/run.route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const runRoute = createRoute({
2020
schema: internalInfoSchema.extend({
2121
path: z.string(),
2222
customIdentifier: z.string().optional(),
23-
parameters: z.record(z.string(), z.any()).optional().default({}),
23+
parameters: z.record(z.any()).optional().default({}),
2424
}),
2525
},
2626
},

apps/gateway/src/routes/api/v2/documents/run/run.route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const runRoute = createRoute({
2222
path: z.string(),
2323
stream: z.boolean().default(false),
2424
customIdentifier: z.string().optional(),
25-
parameters: z.record(z.string(), z.any()).optional().default({}),
25+
parameters: z.record(z.any()).optional().default({}),
2626
}),
2727
},
2828
},

apps/gateway/src/routes/api/v3/conversations/chat/chat.handler.test.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,7 @@ const step: ChainStepResponse<'text'> = {
7777
streamType: 'text',
7878
text: 'fake-response-text',
7979
reasoning: undefined,
80-
usage: {
81-
inputTokens: 4,
82-
outputTokens: 6,
83-
promptTokens: 4,
84-
completionTokens: 6,
85-
totalTokens: 10,
86-
reasoningTokens: 0,
87-
cachedInputTokens: 0,
88-
},
80+
usage: { promptTokens: 4, completionTokens: 6, totalTokens: 10 },
8981
toolCalls: [],
9082
documentLogUuid: 'fake-document-log-uuid',
9183
providerLog: {

apps/gateway/src/routes/api/v3/projects/versions/create/createCommit.route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export const CommitSchema = z.object({
1111
authorName: z.string().nullable(),
1212
authorEmail: z.string().nullable(),
1313
authorId: z.number().nullable(),
14-
createdAt: z.iso.datetime(),
15-
updatedAt: z.iso.datetime(),
14+
createdAt: z.string().datetime(),
15+
updatedAt: z.string().datetime(),
1616
status: z.string(),
1717
parentCommitUuid: z.string().nullable(),
1818
})

0 commit comments

Comments
 (0)