forked from Lilly-Protocol/lily-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagents.schema.ts
More file actions
47 lines (39 loc) · 1.1 KB
/
Copy pathagents.schema.ts
File metadata and controls
47 lines (39 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { z } from "zod";
export const capabilityEnum = z.enum([
"wallet-provisioning",
"usdc-payments",
"settlement",
"payments",
"marketplace-purchases",
"rebalance",
"liquidity-monitoring",
"wallet",
"monitoring",
"test",
"testing",
]);
export type Capability = z.infer<typeof capabilityEnum>;
const capabilityValue = z.string().trim().toLowerCase().pipe(capabilityEnum);
export const createAgentSchema = z
.object({
name: z.string().trim().min(2).max(80),
description: z.string().trim().min(10).max(280),
capabilities: z
.array(capabilityValue)
.min(1)
.max(10)
.transform((caps) => [...new Set(caps)]),
})
.strict();
export const patchAgentSchema = z
.object({
status: z.enum(["active", "paused"]).optional(),
})
.refine((data) => data.status !== undefined, {
message: "At least one field must be provided",
});
export type CreateAgentSchema = z.output<typeof createAgentSchema>;
export const agentStatusSchema = z.object({
status: z.enum(["active", "paused"]),
});
export type AgentStatusSchema = z.output<typeof agentStatusSchema>;