@elevasis/core 0.20.0 → 0.22.0
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/dist/index.d.ts +524 -6
- package/dist/index.js +417 -42
- package/dist/knowledge/index.d.ts +151 -1
- package/dist/organization-model/index.d.ts +524 -6
- package/dist/organization-model/index.js +417 -42
- package/dist/test-utils/index.d.ts +270 -1
- package/dist/test-utils/index.js +407 -41
- package/package.json +5 -5
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +501 -303
- package/src/auth/multi-tenancy/permissions.ts +20 -8
- package/src/business/README.md +2 -2
- package/src/business/acquisition/api-schemas.test.ts +198 -0
- package/src/business/acquisition/api-schemas.ts +250 -9
- package/src/business/acquisition/build-templates.test.ts +28 -0
- package/src/business/acquisition/build-templates.ts +20 -8
- package/src/business/acquisition/index.ts +12 -0
- package/src/business/acquisition/types.ts +6 -1
- package/src/business/clients/api-schemas.test.ts +115 -0
- package/src/business/clients/api-schemas.ts +158 -0
- package/src/business/clients/index.ts +1 -0
- package/src/business/deals/api-schemas.ts +8 -0
- package/src/business/index.ts +5 -2
- package/src/business/projects/types.ts +19 -0
- package/src/execution/engine/__tests__/fixtures/test-agents.ts +10 -8
- package/src/execution/engine/agent/core/__tests__/agent.test.ts +16 -12
- package/src/execution/engine/agent/core/__tests__/error-passthrough.test.ts +4 -3
- package/src/execution/engine/agent/core/types.ts +25 -15
- package/src/execution/engine/agent/index.ts +6 -4
- package/src/execution/engine/agent/reasoning/__tests__/request-builder.test.ts +24 -18
- package/src/execution/engine/index.ts +3 -0
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.test.ts +55 -0
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +107 -41
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.test.ts +48 -0
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.ts +99 -0
- package/src/execution/engine/tools/integration/server/adapters/apollo/index.ts +1 -0
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.test.ts +18 -0
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.ts +194 -0
- package/src/execution/engine/tools/integration/server/adapters/clickup/index.ts +7 -0
- package/src/execution/engine/workflow/types.ts +7 -0
- package/src/integrations/credentials/api-schemas.ts +21 -2
- package/src/integrations/credentials/schemas.ts +200 -164
- package/src/organization-model/README.md +10 -3
- package/src/organization-model/__tests__/defaults.test.ts +6 -0
- package/src/organization-model/__tests__/domains/resources.test.ts +188 -0
- package/src/organization-model/__tests__/domains/roles.test.ts +402 -347
- package/src/organization-model/__tests__/domains/systems.test.ts +193 -0
- package/src/organization-model/__tests__/knowledge.test.ts +39 -0
- package/src/organization-model/__tests__/prospecting-ssot.test.ts +7 -4
- package/src/organization-model/__tests__/resolve.test.ts +1 -1
- package/src/organization-model/defaults.ts +24 -3
- package/src/organization-model/domains/knowledge.ts +3 -2
- package/src/organization-model/domains/prospecting.ts +182 -25
- package/src/organization-model/domains/resources.ts +88 -0
- package/src/organization-model/domains/roles.ts +93 -55
- package/src/organization-model/domains/sales.ts +24 -3
- package/src/organization-model/domains/systems.ts +46 -0
- package/src/organization-model/icons.ts +1 -0
- package/src/organization-model/index.ts +2 -0
- package/src/organization-model/organization-model.mdx +33 -14
- package/src/organization-model/published.ts +52 -1
- package/src/organization-model/schema.ts +121 -0
- package/src/organization-model/types.ts +46 -1
- package/src/platform/api/types.ts +38 -35
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/registry/__tests__/resource-registry.test.ts +2051 -2005
- package/src/platform/registry/__tests__/validation.test.ts +1343 -1086
- package/src/platform/registry/index.ts +14 -0
- package/src/platform/registry/resource-registry.ts +40 -2
- package/src/platform/registry/serialization.ts +241 -202
- package/src/platform/registry/serialized-types.ts +1 -0
- package/src/platform/registry/types.ts +411 -361
- package/src/platform/registry/validation.ts +743 -513
- package/src/projects/api-schemas.ts +290 -267
- package/src/reference/_generated/contracts.md +501 -303
- package/src/reference/glossary.md +8 -3
- package/src/server.ts +2 -0
- package/src/supabase/database.types.ts +121 -0
|
@@ -1,268 +1,291 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { UuidSchema } from '../platform/utils/validation'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Project Management API Schemas
|
|
6
|
-
*
|
|
7
|
-
* Request/response validation for /api/external/projects surface.
|
|
8
|
-
* Used by both the API (external-routes.ts) and the CLI (packages/cli).
|
|
9
|
-
*
|
|
10
|
-
* Table mapping:
|
|
11
|
-
* prj_projects -> ProjectSchemas
|
|
12
|
-
* prj_milestones -> MilestoneSchemas
|
|
13
|
-
* prj_tasks -> TaskSchemas
|
|
14
|
-
* prj_notes -> NoteSchemas
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// Enum literals (must match DB CHECK constraints exactly)
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
export const ProjectKindSchema = z.enum(['client_engagement', 'internal', 'research', 'other'])
|
|
22
|
-
export const ProjectStatusSchema = z.enum(['active', 'on_track', 'at_risk', 'blocked', 'completed', 'paused'])
|
|
23
|
-
export const MilestoneStatusSchema = z.enum(['upcoming', 'in_progress', 'completed', 'overdue', 'blocked'])
|
|
24
|
-
export const TaskStatusSchema = z.enum([
|
|
25
|
-
'planned',
|
|
26
|
-
'in_progress',
|
|
27
|
-
'blocked',
|
|
28
|
-
'completed',
|
|
29
|
-
'cancelled',
|
|
30
|
-
'submitted',
|
|
31
|
-
'approved',
|
|
32
|
-
'rejected',
|
|
33
|
-
'revision_requested'
|
|
34
|
-
])
|
|
35
|
-
export const TaskTypeSchema = z.enum([
|
|
36
|
-
'documentation',
|
|
37
|
-
'code',
|
|
38
|
-
'report',
|
|
39
|
-
'design',
|
|
40
|
-
'refactor',
|
|
41
|
-
'feature',
|
|
42
|
-
'bug',
|
|
43
|
-
'research',
|
|
44
|
-
'other'
|
|
45
|
-
])
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { UuidSchema } from '../platform/utils/validation'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Project Management API Schemas
|
|
6
|
+
*
|
|
7
|
+
* Request/response validation for /api/external/projects surface.
|
|
8
|
+
* Used by both the API (external-routes.ts) and the CLI (packages/cli).
|
|
9
|
+
*
|
|
10
|
+
* Table mapping:
|
|
11
|
+
* prj_projects -> ProjectSchemas
|
|
12
|
+
* prj_milestones -> MilestoneSchemas
|
|
13
|
+
* prj_tasks -> TaskSchemas
|
|
14
|
+
* prj_notes -> NoteSchemas
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Enum literals (must match DB CHECK constraints exactly)
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
export const ProjectKindSchema = z.enum(['client_engagement', 'internal', 'research', 'other'])
|
|
22
|
+
export const ProjectStatusSchema = z.enum(['active', 'on_track', 'at_risk', 'blocked', 'completed', 'paused'])
|
|
23
|
+
export const MilestoneStatusSchema = z.enum(['upcoming', 'in_progress', 'completed', 'overdue', 'blocked'])
|
|
24
|
+
export const TaskStatusSchema = z.enum([
|
|
25
|
+
'planned',
|
|
26
|
+
'in_progress',
|
|
27
|
+
'blocked',
|
|
28
|
+
'completed',
|
|
29
|
+
'cancelled',
|
|
30
|
+
'submitted',
|
|
31
|
+
'approved',
|
|
32
|
+
'rejected',
|
|
33
|
+
'revision_requested'
|
|
34
|
+
])
|
|
35
|
+
export const TaskTypeSchema = z.enum([
|
|
36
|
+
'documentation',
|
|
37
|
+
'code',
|
|
38
|
+
'report',
|
|
39
|
+
'design',
|
|
40
|
+
'refactor',
|
|
41
|
+
'feature',
|
|
42
|
+
'bug',
|
|
43
|
+
'research',
|
|
44
|
+
'other'
|
|
45
|
+
])
|
|
46
46
|
export const NoteTypeSchema = z.enum(['call_note', 'status_update', 'issue', 'blocker', 'agent_learning'])
|
|
47
|
-
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
49
|
-
// Checklist item shape (JSONB array stored on prj_tasks)
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
|
|
52
|
-
export const ChecklistItemSchema = z.object({
|
|
53
|
-
id: z.string(),
|
|
54
|
-
label: z.string(),
|
|
55
|
-
completed: z.boolean()
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
export const ChecklistSchema = z.array(ChecklistItemSchema)
|
|
59
|
-
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
|
-
// resume_context shape (JSONB on prj_tasks, merged on PATCH .../resume-context)
|
|
62
|
-
// ---------------------------------------------------------------------------
|
|
63
|
-
|
|
64
|
-
export const ResumeContextSchema = z.record(z.string(), z.unknown())
|
|
65
|
-
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
// Projects
|
|
68
|
-
// ---------------------------------------------------------------------------
|
|
69
|
-
|
|
70
|
-
export const CreateProjectRequestSchema = z
|
|
71
|
-
.object({
|
|
72
|
-
name: z.string().trim().min(1).max(255),
|
|
73
|
-
kind: ProjectKindSchema,
|
|
74
|
-
status: ProjectStatusSchema.optional(),
|
|
75
|
-
description: z.string().nullable().optional(),
|
|
76
|
-
deal_id: UuidSchema.nullable().optional(),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
milestone_id: UuidSchema.optional(),
|
|
190
|
-
parent_task_id: UuidSchema.optional()
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
})
|
|
211
|
-
.strict()
|
|
212
|
-
|
|
213
|
-
export const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
export const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
//
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
47
|
+
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Checklist item shape (JSONB array stored on prj_tasks)
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
export const ChecklistItemSchema = z.object({
|
|
53
|
+
id: z.string(),
|
|
54
|
+
label: z.string(),
|
|
55
|
+
completed: z.boolean()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export const ChecklistSchema = z.array(ChecklistItemSchema)
|
|
59
|
+
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// resume_context shape (JSONB on prj_tasks, merged on PATCH .../resume-context)
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
export const ResumeContextSchema = z.record(z.string(), z.unknown())
|
|
65
|
+
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Projects
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
export const CreateProjectRequestSchema = z
|
|
71
|
+
.object({
|
|
72
|
+
name: z.string().trim().min(1).max(255),
|
|
73
|
+
kind: ProjectKindSchema,
|
|
74
|
+
status: ProjectStatusSchema.optional(),
|
|
75
|
+
description: z.string().nullable().optional(),
|
|
76
|
+
deal_id: UuidSchema.nullable().optional(),
|
|
77
|
+
client_id: UuidSchema.nullable().optional(),
|
|
78
|
+
client_company_id: UuidSchema.nullable().optional(),
|
|
79
|
+
start_date: z.string().nullable().optional(),
|
|
80
|
+
target_end_date: z.string().nullable().optional(),
|
|
81
|
+
contract_value: z.number().nullable().optional(),
|
|
82
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
83
|
+
})
|
|
84
|
+
.strict()
|
|
85
|
+
|
|
86
|
+
export const UpdateProjectRequestSchema = z
|
|
87
|
+
.object({
|
|
88
|
+
name: z.string().trim().min(1).max(255).optional(),
|
|
89
|
+
kind: ProjectKindSchema.optional(),
|
|
90
|
+
status: ProjectStatusSchema.optional(),
|
|
91
|
+
description: z.string().nullable().optional(),
|
|
92
|
+
deal_id: UuidSchema.nullable().optional(),
|
|
93
|
+
client_id: UuidSchema.nullable().optional(),
|
|
94
|
+
client_company_id: UuidSchema.nullable().optional(),
|
|
95
|
+
start_date: z.string().nullable().optional(),
|
|
96
|
+
target_end_date: z.string().nullable().optional(),
|
|
97
|
+
actual_end_date: z.string().nullable().optional(),
|
|
98
|
+
contract_value: z.number().nullable().optional(),
|
|
99
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
100
|
+
})
|
|
101
|
+
.strict()
|
|
102
|
+
.refine((data) => Object.keys(data).length > 0, { message: 'At least one field must be provided' })
|
|
103
|
+
|
|
104
|
+
export const GetProjectsQuerySchema = z
|
|
105
|
+
.object({
|
|
106
|
+
kind: ProjectKindSchema.optional(),
|
|
107
|
+
status: ProjectStatusSchema.optional(),
|
|
108
|
+
search: z.string().trim().min(1).max(255).optional(),
|
|
109
|
+
client_id: UuidSchema.optional()
|
|
110
|
+
})
|
|
111
|
+
.strict()
|
|
112
|
+
|
|
113
|
+
export const ProjectIdParamsSchema = z.object({ id: UuidSchema })
|
|
114
|
+
|
|
115
|
+
export const ProjectSourceDealRefSchema = z.object({
|
|
116
|
+
id: z.string(),
|
|
117
|
+
clientId: z.string().nullable().optional(),
|
|
118
|
+
contactEmail: z.string(),
|
|
119
|
+
stageKey: z.string().nullable(),
|
|
120
|
+
stateKey: z.string().nullable(),
|
|
121
|
+
sourceListId: z.string().nullable(),
|
|
122
|
+
updatedAt: z.string()
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
export const ProjectClientRefSchema = z.object({
|
|
126
|
+
id: z.string(),
|
|
127
|
+
name: z.string(),
|
|
128
|
+
status: z.string()
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// Milestones
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
export const CreateMilestoneRequestSchema = z
|
|
136
|
+
.object({
|
|
137
|
+
name: z.string().trim().min(1).max(255),
|
|
138
|
+
status: MilestoneStatusSchema.optional(),
|
|
139
|
+
description: z.string().nullable().optional(),
|
|
140
|
+
due_date: z.string().nullable().optional(),
|
|
141
|
+
sequence: z.number().int().min(0).optional(),
|
|
142
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
143
|
+
})
|
|
144
|
+
.strict()
|
|
145
|
+
|
|
146
|
+
export const UpdateMilestoneRequestSchema = z
|
|
147
|
+
.object({
|
|
148
|
+
name: z.string().trim().min(1).max(255).optional(),
|
|
149
|
+
status: MilestoneStatusSchema.optional(),
|
|
150
|
+
description: z.string().nullable().optional(),
|
|
151
|
+
due_date: z.string().nullable().optional(),
|
|
152
|
+
completed_at: z.string().nullable().optional(),
|
|
153
|
+
sequence: z.number().int().min(0).optional(),
|
|
154
|
+
checklist: ChecklistSchema.optional(),
|
|
155
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
156
|
+
})
|
|
157
|
+
.strict()
|
|
158
|
+
.refine((data) => Object.keys(data).length > 0, { message: 'At least one field must be provided' })
|
|
159
|
+
|
|
160
|
+
export const ProjectIdPathParamsSchema = z.object({ projectId: UuidSchema })
|
|
161
|
+
export const MilestoneIdParamsSchema = z.object({ id: UuidSchema })
|
|
162
|
+
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
// Tasks
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
|
|
167
|
+
export const CreateTaskRequestSchema = z
|
|
168
|
+
.object({
|
|
169
|
+
project_id: UuidSchema,
|
|
170
|
+
name: z.string().trim().min(1).max(255),
|
|
171
|
+
type: TaskTypeSchema.optional(),
|
|
172
|
+
status: TaskStatusSchema.optional(),
|
|
173
|
+
description: z.string().nullable().optional(),
|
|
174
|
+
milestone_id: UuidSchema.nullable().optional(),
|
|
175
|
+
parent_task_id: UuidSchema.nullable().optional(),
|
|
176
|
+
due_date: z.string().nullable().optional(),
|
|
177
|
+
checklist: ChecklistSchema.optional(),
|
|
178
|
+
resume_context: ResumeContextSchema.nullable().optional(),
|
|
179
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
180
|
+
})
|
|
181
|
+
.strict()
|
|
182
|
+
|
|
183
|
+
export const UpdateTaskRequestSchema = z
|
|
184
|
+
.object({
|
|
185
|
+
name: z.string().trim().min(1).max(255).optional(),
|
|
186
|
+
type: TaskTypeSchema.optional(),
|
|
187
|
+
status: TaskStatusSchema.optional(),
|
|
188
|
+
description: z.string().nullable().optional(),
|
|
189
|
+
milestone_id: UuidSchema.nullable().optional(),
|
|
190
|
+
parent_task_id: UuidSchema.nullable().optional(),
|
|
191
|
+
due_date: z.string().nullable().optional(),
|
|
192
|
+
completed_at: z.string().nullable().optional(),
|
|
193
|
+
checklist: ChecklistSchema.optional(),
|
|
194
|
+
resume_context: ResumeContextSchema.nullable().optional(),
|
|
195
|
+
file_url: z.string().nullable().optional(),
|
|
196
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
197
|
+
})
|
|
198
|
+
.strict()
|
|
199
|
+
.refine((data) => Object.keys(data).length > 0, { message: 'At least one field must be provided' })
|
|
200
|
+
|
|
201
|
+
export const MergeResumeContextRequestSchema = z
|
|
202
|
+
.record(z.string(), z.unknown())
|
|
203
|
+
.refine((data) => Object.keys(data).length > 0, { message: 'At least one field must be provided' })
|
|
204
|
+
|
|
205
|
+
export const GetTasksQuerySchema = z
|
|
206
|
+
.object({
|
|
207
|
+
status: TaskStatusSchema.optional(),
|
|
208
|
+
milestone_id: UuidSchema.optional(),
|
|
209
|
+
parent_task_id: UuidSchema.optional()
|
|
210
|
+
})
|
|
211
|
+
.strict()
|
|
212
|
+
|
|
213
|
+
export const TaskIdParamsSchema = z.object({ id: UuidSchema })
|
|
214
|
+
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
// Notes
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
|
|
219
|
+
export const CreateNoteRequestSchema = z
|
|
220
|
+
.object({
|
|
221
|
+
project_id: UuidSchema,
|
|
222
|
+
content: z.string().trim().min(1),
|
|
223
|
+
type: NoteTypeSchema.optional(),
|
|
224
|
+
summary: z.string().nullable().optional(),
|
|
225
|
+
task_id: UuidSchema.nullable().optional(),
|
|
226
|
+
milestone_id: UuidSchema.nullable().optional(),
|
|
227
|
+
occurred_at: z.string().optional(),
|
|
228
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
229
|
+
})
|
|
230
|
+
.strict()
|
|
231
|
+
|
|
232
|
+
export const UpdateNoteRequestSchema = z
|
|
233
|
+
.object({
|
|
234
|
+
content: z.string().trim().min(1).optional(),
|
|
235
|
+
type: NoteTypeSchema.optional(),
|
|
236
|
+
summary: z.string().nullable().optional(),
|
|
237
|
+
task_id: UuidSchema.nullable().optional(),
|
|
238
|
+
milestone_id: UuidSchema.nullable().optional(),
|
|
239
|
+
occurred_at: z.string().optional(),
|
|
240
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional()
|
|
241
|
+
})
|
|
242
|
+
.strict()
|
|
243
|
+
.refine((data) => Object.keys(data).length > 0, { message: 'At least one field must be provided' })
|
|
244
|
+
|
|
245
|
+
export const NoteIdParamsSchema = z.object({ id: UuidSchema })
|
|
246
|
+
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// Bundled export (mirrors CredentialSchemas pattern)
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
export const ProjectSchemas = {
|
|
252
|
+
// Projects
|
|
253
|
+
CreateProjectRequest: CreateProjectRequestSchema,
|
|
254
|
+
UpdateProjectRequest: UpdateProjectRequestSchema,
|
|
255
|
+
GetProjectsQuery: GetProjectsQuerySchema,
|
|
256
|
+
ProjectIdParams: ProjectIdParamsSchema,
|
|
257
|
+
ProjectSourceDealRef: ProjectSourceDealRefSchema,
|
|
258
|
+
ProjectClientRef: ProjectClientRefSchema,
|
|
259
|
+
|
|
260
|
+
// Milestones
|
|
261
|
+
CreateMilestoneRequest: CreateMilestoneRequestSchema,
|
|
262
|
+
UpdateMilestoneRequest: UpdateMilestoneRequestSchema,
|
|
263
|
+
ProjectIdPathParams: ProjectIdPathParamsSchema,
|
|
264
|
+
MilestoneIdParams: MilestoneIdParamsSchema,
|
|
265
|
+
|
|
266
|
+
// Tasks
|
|
267
|
+
CreateTaskRequest: CreateTaskRequestSchema,
|
|
268
|
+
UpdateTaskRequest: UpdateTaskRequestSchema,
|
|
269
|
+
MergeResumeContextRequest: MergeResumeContextRequestSchema,
|
|
270
|
+
GetTasksQuery: GetTasksQuerySchema,
|
|
271
|
+
TaskIdParams: TaskIdParamsSchema,
|
|
272
|
+
|
|
273
|
+
// Notes
|
|
274
|
+
CreateNoteRequest: CreateNoteRequestSchema,
|
|
275
|
+
UpdateNoteRequest: UpdateNoteRequestSchema,
|
|
276
|
+
NoteIdParams: NoteIdParamsSchema
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// ---------------------------------------------------------------------------
|
|
280
|
+
// Inferred types
|
|
281
|
+
// ---------------------------------------------------------------------------
|
|
282
|
+
|
|
283
|
+
export type ProjectKind = z.infer<typeof ProjectKindSchema>
|
|
284
|
+
export type ProjectStatus = z.infer<typeof ProjectStatusSchema>
|
|
285
|
+
export type MilestoneStatus = z.infer<typeof MilestoneStatusSchema>
|
|
286
|
+
export type TaskStatus = z.infer<typeof TaskStatusSchema>
|
|
287
|
+
export type TaskType = z.infer<typeof TaskTypeSchema>
|
|
288
|
+
export type NoteType = z.infer<typeof NoteTypeSchema>
|
|
289
|
+
export type ChecklistItem = z.infer<typeof ChecklistItemSchema>
|
|
290
|
+
export type ProjectSourceDealRef = z.infer<typeof ProjectSourceDealRefSchema>
|
|
291
|
+
export type ProjectClientRef = z.infer<typeof ProjectClientRefSchema>
|