@t4dhg/mcp-factorial 7.0.1 → 8.2.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.
Files changed (201) hide show
  1. package/README.md +321 -49
  2. package/dist/api/ats.d.ts +78 -0
  3. package/dist/api/ats.d.ts.map +1 -0
  4. package/dist/api/ats.js +173 -0
  5. package/dist/api/ats.js.map +1 -0
  6. package/dist/api/attendance.d.ts +27 -0
  7. package/dist/api/attendance.d.ts.map +1 -0
  8. package/dist/api/attendance.js +62 -0
  9. package/dist/api/attendance.js.map +1 -0
  10. package/dist/api/contracts.d.ts +40 -0
  11. package/dist/api/contracts.d.ts.map +1 -0
  12. package/dist/api/contracts.js +146 -0
  13. package/dist/api/contracts.js.map +1 -0
  14. package/dist/api/documents.d.ts +95 -0
  15. package/dist/api/documents.d.ts.map +1 -0
  16. package/dist/api/documents.js +265 -0
  17. package/dist/api/documents.js.map +1 -0
  18. package/dist/api/employees.d.ts +35 -0
  19. package/dist/api/employees.d.ts.map +1 -0
  20. package/dist/api/employees.js +116 -0
  21. package/dist/api/employees.js.map +1 -0
  22. package/dist/api/index.d.ts +22 -0
  23. package/dist/api/index.d.ts.map +1 -0
  24. package/dist/api/index.js +36 -0
  25. package/dist/api/index.js.map +1 -0
  26. package/dist/api/job-catalog.d.ts +21 -0
  27. package/dist/api/job-catalog.d.ts.map +1 -0
  28. package/dist/api/job-catalog.js +34 -0
  29. package/dist/api/job-catalog.js.map +1 -0
  30. package/dist/api/locations.d.ts +26 -0
  31. package/dist/api/locations.d.ts.map +1 -0
  32. package/dist/api/locations.js +59 -0
  33. package/dist/api/locations.js.map +1 -0
  34. package/dist/api/payroll.d.ts +30 -0
  35. package/dist/api/payroll.d.ts.map +1 -0
  36. package/dist/api/payroll.js +68 -0
  37. package/dist/api/payroll.js.map +1 -0
  38. package/dist/api/projects.d.ts +82 -0
  39. package/dist/api/projects.d.ts.map +1 -0
  40. package/dist/api/projects.js +193 -0
  41. package/dist/api/projects.js.map +1 -0
  42. package/dist/api/shared.d.ts +12 -0
  43. package/dist/api/shared.d.ts.map +1 -0
  44. package/dist/api/shared.js +17 -0
  45. package/dist/api/shared.js.map +1 -0
  46. package/dist/api/teams.d.ts +26 -0
  47. package/dist/api/teams.d.ts.map +1 -0
  48. package/dist/api/teams.js +59 -0
  49. package/dist/api/teams.js.map +1 -0
  50. package/dist/api/time-off.d.ts +47 -0
  51. package/dist/api/time-off.d.ts.map +1 -0
  52. package/dist/api/time-off.js +112 -0
  53. package/dist/api/time-off.js.map +1 -0
  54. package/dist/api/training.d.ts +62 -0
  55. package/dist/api/training.d.ts.map +1 -0
  56. package/dist/api/training.js +147 -0
  57. package/dist/api/training.js.map +1 -0
  58. package/dist/api/work-areas.d.ts +30 -0
  59. package/dist/api/work-areas.d.ts.map +1 -0
  60. package/dist/api/work-areas.js +71 -0
  61. package/dist/api/work-areas.js.map +1 -0
  62. package/dist/api.d.ts +3 -434
  63. package/dist/api.d.ts.map +1 -1
  64. package/dist/api.js +3 -1154
  65. package/dist/api.js.map +1 -1
  66. package/dist/audit.d.ts +8 -3
  67. package/dist/audit.d.ts.map +1 -1
  68. package/dist/audit.js +8 -3
  69. package/dist/audit.js.map +1 -1
  70. package/dist/index.d.ts +6 -13
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +6 -3701
  73. package/dist/index.js.map +1 -1
  74. package/dist/oauth.d.ts +63 -0
  75. package/dist/oauth.d.ts.map +1 -0
  76. package/dist/oauth.js +143 -0
  77. package/dist/oauth.js.map +1 -0
  78. package/dist/schemas/ats.d.ts +326 -0
  79. package/dist/schemas/ats.d.ts.map +1 -0
  80. package/dist/schemas/ats.js +121 -0
  81. package/dist/schemas/ats.js.map +1 -0
  82. package/dist/schemas/documents.d.ts +78 -0
  83. package/dist/schemas/documents.d.ts.map +1 -0
  84. package/dist/schemas/documents.js +34 -0
  85. package/dist/schemas/documents.js.map +1 -0
  86. package/dist/schemas/employees.d.ts +528 -0
  87. package/dist/schemas/employees.d.ts.map +1 -0
  88. package/dist/schemas/employees.js +206 -0
  89. package/dist/schemas/employees.js.map +1 -0
  90. package/dist/schemas/index.d.ts +18 -0
  91. package/dist/schemas/index.d.ts.map +1 -0
  92. package/dist/schemas/index.js +28 -0
  93. package/dist/schemas/index.js.map +1 -0
  94. package/dist/schemas/job-catalog.d.ts +57 -0
  95. package/dist/schemas/job-catalog.d.ts.map +1 -0
  96. package/dist/schemas/job-catalog.js +27 -0
  97. package/dist/schemas/job-catalog.js.map +1 -0
  98. package/dist/schemas/payroll.d.ts +98 -0
  99. package/dist/schemas/payroll.d.ts.map +1 -0
  100. package/dist/schemas/payroll.js +43 -0
  101. package/dist/schemas/payroll.js.map +1 -0
  102. package/dist/schemas/projects.d.ts +277 -0
  103. package/dist/schemas/projects.d.ts.map +1 -0
  104. package/dist/schemas/projects.js +114 -0
  105. package/dist/schemas/projects.js.map +1 -0
  106. package/dist/schemas/shared.d.ts +42 -0
  107. package/dist/schemas/shared.d.ts.map +1 -0
  108. package/dist/schemas/shared.js +65 -0
  109. package/dist/schemas/shared.js.map +1 -0
  110. package/dist/schemas/time-off.d.ts +286 -0
  111. package/dist/schemas/time-off.d.ts.map +1 -0
  112. package/dist/schemas/time-off.js +111 -0
  113. package/dist/schemas/time-off.js.map +1 -0
  114. package/dist/schemas/training.d.ts +223 -0
  115. package/dist/schemas/training.d.ts.map +1 -0
  116. package/dist/schemas/training.js +88 -0
  117. package/dist/schemas/training.js.map +1 -0
  118. package/dist/schemas/work-areas.d.ts +71 -0
  119. package/dist/schemas/work-areas.d.ts.map +1 -0
  120. package/dist/schemas/work-areas.js +30 -0
  121. package/dist/schemas/work-areas.js.map +1 -0
  122. package/dist/schemas.d.ts +4 -1879
  123. package/dist/schemas.d.ts.map +1 -1
  124. package/dist/schemas.js +4 -755
  125. package/dist/schemas.js.map +1 -1
  126. package/dist/tool-utils.d.ts +0 -14
  127. package/dist/tool-utils.d.ts.map +1 -1
  128. package/dist/tool-utils.js +5 -18
  129. package/dist/tool-utils.js.map +1 -1
  130. package/dist/tools/ats.d.ts +6 -0
  131. package/dist/tools/ats.d.ts.map +1 -0
  132. package/dist/tools/ats.js +206 -0
  133. package/dist/tools/ats.js.map +1 -0
  134. package/dist/tools/attendance.d.ts +6 -0
  135. package/dist/tools/attendance.d.ts.map +1 -0
  136. package/dist/tools/attendance.js +86 -0
  137. package/dist/tools/attendance.js.map +1 -0
  138. package/dist/tools/contracts.d.ts +6 -0
  139. package/dist/tools/contracts.d.ts.map +1 -0
  140. package/dist/tools/contracts.js +63 -0
  141. package/dist/tools/contracts.js.map +1 -0
  142. package/dist/tools/documents.d.ts +6 -0
  143. package/dist/tools/documents.d.ts.map +1 -0
  144. package/dist/tools/documents.js +135 -0
  145. package/dist/tools/documents.js.map +1 -0
  146. package/dist/tools/employees.d.ts +6 -0
  147. package/dist/tools/employees.d.ts.map +1 -0
  148. package/dist/tools/employees.js +125 -0
  149. package/dist/tools/employees.js.map +1 -0
  150. package/dist/tools/index.d.ts +17 -0
  151. package/dist/tools/index.d.ts.map +1 -0
  152. package/dist/tools/index.js +221 -0
  153. package/dist/tools/index.js.map +1 -0
  154. package/dist/tools/job-catalog.d.ts +6 -0
  155. package/dist/tools/job-catalog.d.ts.map +1 -0
  156. package/dist/tools/job-catalog.js +39 -0
  157. package/dist/tools/job-catalog.js.map +1 -0
  158. package/dist/tools/locations.d.ts +6 -0
  159. package/dist/tools/locations.d.ts.map +1 -0
  160. package/dist/tools/locations.js +93 -0
  161. package/dist/tools/locations.js.map +1 -0
  162. package/dist/tools/payroll.d.ts +6 -0
  163. package/dist/tools/payroll.d.ts.map +1 -0
  164. package/dist/tools/payroll.js +76 -0
  165. package/dist/tools/payroll.js.map +1 -0
  166. package/dist/tools/projects.d.ts +6 -0
  167. package/dist/tools/projects.d.ts.map +1 -0
  168. package/dist/tools/projects.js +203 -0
  169. package/dist/tools/projects.js.map +1 -0
  170. package/dist/tools/shared.d.ts +84 -0
  171. package/dist/tools/shared.d.ts.map +1 -0
  172. package/dist/tools/shared.js +164 -0
  173. package/dist/tools/shared.js.map +1 -0
  174. package/dist/tools/teams.d.ts +6 -0
  175. package/dist/tools/teams.d.ts.map +1 -0
  176. package/dist/tools/teams.js +81 -0
  177. package/dist/tools/teams.js.map +1 -0
  178. package/dist/tools/time-off.d.ts +6 -0
  179. package/dist/tools/time-off.d.ts.map +1 -0
  180. package/dist/tools/time-off.js +144 -0
  181. package/dist/tools/time-off.js.map +1 -0
  182. package/dist/tools/training.d.ts +6 -0
  183. package/dist/tools/training.d.ts.map +1 -0
  184. package/dist/tools/training.js +160 -0
  185. package/dist/tools/training.js.map +1 -0
  186. package/dist/tools/work-areas.d.ts +6 -0
  187. package/dist/tools/work-areas.d.ts.map +1 -0
  188. package/dist/tools/work-areas.js +85 -0
  189. package/dist/tools/work-areas.js.map +1 -0
  190. package/dist/types.d.ts +1 -1
  191. package/dist/types.d.ts.map +1 -1
  192. package/dist/utils.d.ts +35 -0
  193. package/dist/utils.d.ts.map +1 -1
  194. package/dist/utils.js +97 -0
  195. package/dist/utils.js.map +1 -1
  196. package/dist/write-safety.d.ts +229 -2
  197. package/dist/write-safety.d.ts.map +1 -1
  198. package/dist/write-safety.js +42 -3
  199. package/dist/write-safety.js.map +1 -1
  200. package/llms.txt +2 -2
  201. package/package.json +2 -2
package/dist/schemas.js CHANGED
@@ -2,760 +2,9 @@
2
2
  * Zod schemas for runtime validation of API responses
3
3
  *
4
4
  * Catches API version mismatches and ensures type safety at runtime.
5
+ *
6
+ * This file re-exports all schemas from the modular src/schemas/ directory.
7
+ * All schemas are now organized by domain for better maintainability.
5
8
  */
6
- import { z } from 'zod';
7
- import { SchemaValidationError } from './errors.js';
8
- /**
9
- * Employee schema
10
- */
11
- export const EmployeeSchema = z.object({
12
- // Core identity
13
- id: z.number(),
14
- access_id: z.number().nullable().optional(),
15
- first_name: z.string().nullable(),
16
- last_name: z.string().nullable(),
17
- full_name: z.string().nullable(),
18
- preferred_name: z.string().nullable().optional(),
19
- birth_name: z.string().nullable().optional(),
20
- gender: z.string().nullable(),
21
- pronouns: z.string().nullable().optional(),
22
- // Identification
23
- identifier: z.string().nullable().optional(),
24
- identifier_type: z.string().nullable().optional(),
25
- identifier_expiration_date: z.string().nullable().optional(),
26
- social_security_number: z.string().nullable().optional(),
27
- // Contact
28
- email: z.string().nullable(),
29
- login_email: z.string().nullable().optional(),
30
- phone_number: z.string().nullable().optional(),
31
- personal_email: z.string().nullable().optional(),
32
- // Address
33
- address_line_1: z.string().nullable().optional(),
34
- address_line_2: z.string().nullable().optional(),
35
- postal_code: z.string().nullable().optional(),
36
- city: z.string().nullable().optional(),
37
- state: z.string().nullable().optional(),
38
- country: z.string().nullable().optional(),
39
- // Personal details
40
- birthday_on: z.string().nullable(),
41
- nationality: z.string().nullable(),
42
- country_of_birth: z.string().nullable().optional(),
43
- birthplace: z.string().nullable().optional(),
44
- age_number: z.number().nullable().optional(),
45
- disability_percentage_cents: z.number().nullable().optional(),
46
- // Banking
47
- bank_number: z.string().nullable().optional(),
48
- swift_bic: z.string().nullable().optional(),
49
- bank_number_format: z.string().nullable().optional(),
50
- // Organization
51
- company_id: z.number().nullable(),
52
- legal_entity_id: z.number().nullable(),
53
- location_id: z.number().nullable(),
54
- manager_id: z.number().nullable(),
55
- timeoff_manager_id: z.number().nullable(),
56
- company_identifier: z.string().nullable().optional(),
57
- // Employment status
58
- active: z.boolean().nullable().optional(),
59
- attendable: z.boolean().nullable().optional(),
60
- seniority_calculation_date: z.string().nullable().optional(),
61
- // Termination
62
- terminated_on: z.string().nullable(),
63
- is_terminating: z.boolean().nullable().optional(),
64
- termination_reason_type: z.string().nullable().optional(),
65
- termination_reason: z.string().nullable().optional(),
66
- termination_observations: z.string().nullable().optional(),
67
- termination_type_description: z.string().nullable().optional(),
68
- // Emergency contact
69
- contact_name: z.string().nullable().optional(),
70
- contact_number: z.string().nullable().optional(),
71
- // Timestamps
72
- created_at: z.string().nullable(),
73
- updated_at: z.string().nullable(),
74
- });
75
- /**
76
- * Team schema
77
- */
78
- export const TeamSchema = z.object({
79
- id: z.number(),
80
- name: z.string(),
81
- description: z.string().nullable(),
82
- company_id: z.number().nullable(),
83
- employee_ids: z.array(z.number()).default([]),
84
- lead_ids: z.array(z.number()).default([]),
85
- created_at: z.string().nullable(),
86
- updated_at: z.string().nullable(),
87
- });
88
- /**
89
- * Location schema
90
- */
91
- export const LocationSchema = z.object({
92
- id: z.number(),
93
- name: z.string(),
94
- country: z.string().nullable(),
95
- phone_number: z.string().nullable(),
96
- state: z.string().nullable(),
97
- city: z.string().nullable(),
98
- address_line_1: z.string().nullable(),
99
- address_line_2: z.string().nullable(),
100
- postal_code: z.string().nullable(),
101
- company_id: z.number().nullable(),
102
- created_at: z.string().nullable(),
103
- updated_at: z.string().nullable(),
104
- });
105
- /**
106
- * Contract schema
107
- */
108
- export const ContractSchema = z.object({
109
- id: z.number(),
110
- employee_id: z.number(),
111
- job_title: z.string().nullable(),
112
- effective_on: z.string().nullable(),
113
- created_at: z.string().nullable(),
114
- updated_at: z.string().nullable(),
115
- });
116
- /**
117
- * Leave schema
118
- */
119
- export const LeaveSchema = z.object({
120
- id: z.number(),
121
- employee_id: z.number(),
122
- leave_type_id: z.number(),
123
- start_on: z.string(),
124
- finish_on: z.string(),
125
- half_day: z.enum(['all_day', 'start', 'finish']).nullable(),
126
- status: z.enum(['pending', 'approved', 'declined']),
127
- description: z.string().nullable(),
128
- deleted_at: z.string().nullable(),
129
- duration_attributes: z
130
- .object({
131
- days: z.number(),
132
- hours: z.number(),
133
- })
134
- .nullable(),
135
- created_at: z.string().nullable(),
136
- updated_at: z.string().nullable(),
137
- });
138
- /**
139
- * Leave type schema
140
- */
141
- export const LeaveTypeSchema = z.object({
142
- id: z.number(),
143
- name: z.string(),
144
- code: z.string().nullable(),
145
- color: z.string().nullable(),
146
- description: z.string().nullable(),
147
- company_id: z.number().nullable(),
148
- created_at: z.string().nullable(),
149
- updated_at: z.string().nullable(),
150
- });
151
- /**
152
- * Allowance schema
153
- */
154
- export const AllowanceSchema = z.object({
155
- id: z.number(),
156
- employee_id: z.number(),
157
- leave_type_id: z.number(),
158
- policy_id: z.number().nullable(),
159
- balance_days: z.number(),
160
- consumed_days: z.number(),
161
- available_days: z.number(),
162
- valid_from: z.string().nullable(),
163
- valid_to: z.string().nullable(),
164
- created_at: z.string().nullable(),
165
- updated_at: z.string().nullable(),
166
- });
167
- /**
168
- * Shift schema
169
- */
170
- export const ShiftSchema = z.object({
171
- id: z.number(),
172
- employee_id: z.number(),
173
- clock_in: z.string(),
174
- clock_out: z.string().nullable(),
175
- worked_hours: z.number().nullable(),
176
- break_minutes: z.number().nullable(),
177
- location: z.string().nullable(),
178
- notes: z.string().nullable(),
179
- created_at: z.string().nullable(),
180
- updated_at: z.string().nullable(),
181
- });
182
- /**
183
- * Folder schema
184
- */
185
- export const FolderSchema = z.object({
186
- id: z.number(),
187
- name: z.string(),
188
- parent_id: z.number().nullable(),
189
- company_id: z.number().nullable(),
190
- created_at: z.string().nullable(),
191
- updated_at: z.string().nullable(),
192
- });
193
- /**
194
- * Document schema
195
- */
196
- export const DocumentSchema = z.object({
197
- id: z.number(),
198
- name: z.string().nullable(),
199
- folder_id: z.number().nullable(),
200
- employee_id: z.number().nullable(), // Employee the document belongs to
201
- author_id: z.number().nullable(),
202
- company_id: z.number().nullable(),
203
- public: z.boolean().default(false),
204
- space: z.string().nullable(),
205
- file_url: z.string().nullable(),
206
- mime_type: z.string().nullable(),
207
- size_bytes: z.number().nullable(),
208
- created_at: z.string().nullable(),
209
- updated_at: z.string().nullable(),
210
- });
211
- /**
212
- * Job role schema
213
- */
214
- export const JobRoleSchema = z.object({
215
- id: z.number(),
216
- name: z.string(),
217
- description: z.string().nullable(),
218
- company_id: z.number().nullable(),
219
- created_at: z.string().nullable(),
220
- updated_at: z.string().nullable(),
221
- });
222
- /**
223
- * Job level schema
224
- */
225
- export const JobLevelSchema = z.object({
226
- id: z.number(),
227
- name: z.string(),
228
- description: z.string().nullable(),
229
- company_id: z.number().nullable(),
230
- created_at: z.string().nullable(),
231
- updated_at: z.string().nullable(),
232
- });
233
- // ============================================================================
234
- // Write Input Schemas (for create/update operations)
235
- // ============================================================================
236
- /**
237
- * Date string pattern (YYYY-MM-DD)
238
- */
239
- const datePattern = /^\d{4}-\d{2}-\d{2}$/;
240
- const dateString = z.string().regex(datePattern, 'Date must be in YYYY-MM-DD format');
241
- /**
242
- * Employee create input schema
243
- */
244
- export const CreateEmployeeInputSchema = z.object({
245
- first_name: z.string().min(1).max(100),
246
- last_name: z.string().min(1).max(100),
247
- email: z.string().email(),
248
- birthday_on: dateString.optional(),
249
- hired_on: dateString.optional(),
250
- start_date: dateString.optional(),
251
- gender: z.enum(['male', 'female', 'other']).optional(),
252
- nationality: z.string().max(50).optional(),
253
- manager_id: z.number().positive().optional(),
254
- role: z.string().max(100).optional(),
255
- team_ids: z.array(z.number().positive()).optional(),
256
- location_id: z.number().positive().optional(),
257
- });
258
- /**
259
- * Employee update input schema (all fields optional)
260
- */
261
- export const UpdateEmployeeInputSchema = CreateEmployeeInputSchema.partial();
262
- /**
263
- * Employee termination input schema
264
- */
265
- export const TerminateEmployeeInputSchema = z.object({
266
- terminated_on: dateString,
267
- reason: z.string().max(500).optional(),
268
- });
269
- /**
270
- * Team create input schema
271
- */
272
- export const CreateTeamInputSchema = z.object({
273
- name: z.string().min(1).max(100),
274
- description: z.string().max(500).optional(),
275
- lead_ids: z.array(z.number().positive()).optional(),
276
- employee_ids: z.array(z.number().positive()).optional(),
277
- });
278
- /**
279
- * Team update input schema
280
- */
281
- export const UpdateTeamInputSchema = CreateTeamInputSchema.partial();
282
- /**
283
- * Location create input schema
284
- */
285
- export const CreateLocationInputSchema = z.object({
286
- name: z.string().min(1).max(100),
287
- country: z.string().max(50).optional(),
288
- state: z.string().max(50).optional(),
289
- city: z.string().max(50).optional(),
290
- address_line_1: z.string().max(200).optional(),
291
- address_line_2: z.string().max(200).optional(),
292
- postal_code: z.string().max(20).optional(),
293
- phone_number: z.string().max(30).optional(),
294
- });
295
- /**
296
- * Location update input schema
297
- */
298
- export const UpdateLocationInputSchema = CreateLocationInputSchema.partial();
299
- /**
300
- * Leave create input schema
301
- */
302
- export const CreateLeaveInputSchema = z.object({
303
- employee_id: z.number().positive(),
304
- leave_type_id: z.number().positive(),
305
- start_on: dateString,
306
- finish_on: dateString,
307
- half_day: z.enum(['all_day', 'start', 'finish']).optional(),
308
- description: z.string().max(500).optional(),
309
- });
310
- /**
311
- * Leave update input schema
312
- */
313
- export const UpdateLeaveInputSchema = CreateLeaveInputSchema.partial().omit({ employee_id: true });
314
- /**
315
- * Leave approval/rejection input schema
316
- */
317
- export const LeaveDecisionInputSchema = z.object({
318
- reason: z.string().max(500).optional(),
319
- });
320
- /**
321
- * Shift create input schema
322
- */
323
- export const CreateShiftInputSchema = z.object({
324
- employee_id: z.number().positive(),
325
- clock_in: z.string().datetime(),
326
- clock_out: z.string().datetime().optional(),
327
- break_minutes: z.number().min(0).max(480).optional(),
328
- location: z.string().max(200).optional(),
329
- notes: z.string().max(500).optional(),
330
- });
331
- /**
332
- * Shift update input schema
333
- */
334
- export const UpdateShiftInputSchema = CreateShiftInputSchema.partial().omit({ employee_id: true });
335
- // ============================================================================
336
- // New Entity Schemas (Projects, Training, ATS, Work Areas, Payroll)
337
- // ============================================================================
338
- /**
339
- * Project schema
340
- */
341
- export const ProjectSchema = z.object({
342
- id: z.number(),
343
- name: z.string(),
344
- code: z.string().nullable(),
345
- description: z.string().nullable(),
346
- status: z.enum(['active', 'inactive', 'archived']).nullable(),
347
- employees_assignment: z.enum(['manual', 'company']).nullable(),
348
- company_id: z.number().nullable(),
349
- created_at: z.string().nullable(),
350
- updated_at: z.string().nullable(),
351
- });
352
- /**
353
- * Project create input schema
354
- */
355
- export const CreateProjectInputSchema = z.object({
356
- name: z.string().min(1).max(100),
357
- code: z.string().max(20).optional(),
358
- description: z.string().max(500).optional(),
359
- employees_assignment: z.enum(['manual', 'company']).optional(),
360
- });
361
- /**
362
- * Project update input schema
363
- */
364
- export const UpdateProjectInputSchema = CreateProjectInputSchema.partial().extend({
365
- status: z.enum(['active', 'inactive', 'archived']).optional(),
366
- });
367
- /**
368
- * Project Task schema
369
- */
370
- export const ProjectTaskSchema = z.object({
371
- id: z.number(),
372
- name: z.string(),
373
- project_id: z.number(),
374
- subproject_id: z.number().nullable(),
375
- description: z.string().nullable(),
376
- completed: z.boolean().default(false),
377
- due_on: z.string().nullable(),
378
- due_status: z.string().nullable(),
379
- created_at: z.string().nullable(),
380
- updated_at: z.string().nullable(),
381
- });
382
- /**
383
- * Project Task create input schema
384
- */
385
- export const CreateProjectTaskInputSchema = z.object({
386
- name: z.string().min(1).max(100),
387
- project_id: z.number().positive(),
388
- description: z.string().max(500).optional(),
389
- due_on: dateString.optional(),
390
- });
391
- /**
392
- * Project Task update input schema
393
- */
394
- export const UpdateProjectTaskInputSchema = CreateProjectTaskInputSchema.partial()
395
- .omit({ project_id: true })
396
- .extend({
397
- completed: z.boolean().optional(),
398
- });
399
- /**
400
- * Project Worker schema
401
- */
402
- export const ProjectWorkerSchema = z.object({
403
- id: z.number(),
404
- project_id: z.number(),
405
- employee_id: z.number(),
406
- company_labor_cost_cents: z.number().nullable(),
407
- created_at: z.string().nullable(),
408
- updated_at: z.string().nullable(),
409
- });
410
- /**
411
- * Project Worker assign input schema
412
- */
413
- export const AssignProjectWorkerInputSchema = z.object({
414
- project_id: z.number().positive(),
415
- employee_id: z.number().positive(),
416
- });
417
- /**
418
- * Time Record schema
419
- */
420
- export const TimeRecordSchema = z.object({
421
- id: z.number(),
422
- project_worker_id: z.number(),
423
- subproject_id: z.number().nullable(),
424
- attendance_shift_id: z.number().nullable(),
425
- minutes: z.number(),
426
- date: z.string(),
427
- description: z.string().nullable(),
428
- created_at: z.string().nullable(),
429
- updated_at: z.string().nullable(),
430
- });
431
- /**
432
- * Time Record create input schema
433
- */
434
- export const CreateTimeRecordInputSchema = z.object({
435
- project_worker_id: z.number().positive(),
436
- date: dateString,
437
- minutes: z.number().min(1).max(1440),
438
- description: z.string().max(500).optional(),
439
- });
440
- /**
441
- * Time Record update input schema
442
- */
443
- export const UpdateTimeRecordInputSchema = CreateTimeRecordInputSchema.partial().omit({
444
- project_worker_id: true,
445
- });
446
- /**
447
- * Training schema
448
- */
449
- export const TrainingSchema = z.object({
450
- id: z.number(),
451
- name: z.string(),
452
- description: z.string().nullable(),
453
- category_id: z.number().nullable(),
454
- status: z.string().nullable(),
455
- subsidized: z.boolean().nullable(),
456
- total_training_indirect_cost: z.number().nullable(),
457
- total_training_salary_cost: z.number().nullable(),
458
- company_id: z.number().nullable(),
459
- created_at: z.string().nullable(),
460
- updated_at: z.string().nullable(),
461
- });
462
- /**
463
- * Training create input schema
464
- */
465
- export const CreateTrainingInputSchema = z.object({
466
- name: z.string().min(1).max(100),
467
- description: z.string().max(1000).optional(),
468
- category_id: z.number().positive().optional(),
469
- subsidized: z.boolean().optional(),
470
- });
471
- /**
472
- * Training update input schema
473
- */
474
- export const UpdateTrainingInputSchema = CreateTrainingInputSchema.partial();
475
- /**
476
- * Training Session schema
477
- */
478
- export const TrainingSessionSchema = z.object({
479
- id: z.number(),
480
- training_id: z.number(),
481
- name: z.string().nullable(),
482
- start_date: z.string().nullable(),
483
- end_date: z.string().nullable(),
484
- location: z.string().nullable(),
485
- max_attendees: z.number().nullable(),
486
- created_at: z.string().nullable(),
487
- updated_at: z.string().nullable(),
488
- });
489
- /**
490
- * Training Session create input schema
491
- */
492
- export const CreateTrainingSessionInputSchema = z.object({
493
- training_id: z.number().positive(),
494
- name: z.string().max(100).optional(),
495
- start_date: dateString.optional(),
496
- end_date: dateString.optional(),
497
- location: z.string().max(200).optional(),
498
- max_attendees: z.number().positive().optional(),
499
- });
500
- /**
501
- * Training Session update input schema
502
- */
503
- export const UpdateTrainingSessionInputSchema = CreateTrainingSessionInputSchema.partial().omit({
504
- training_id: true,
505
- });
506
- /**
507
- * Training Membership (Enrollment) schema
508
- */
509
- export const TrainingMembershipSchema = z.object({
510
- id: z.number(),
511
- training_id: z.number(),
512
- employee_id: z.number(),
513
- session_id: z.number().nullable(),
514
- status: z.string().nullable(),
515
- enrolled_at: z.string().nullable(),
516
- completed_at: z.string().nullable(),
517
- created_at: z.string().nullable(),
518
- updated_at: z.string().nullable(),
519
- });
520
- /**
521
- * Training enrollment input schema
522
- */
523
- export const EnrollTrainingInputSchema = z.object({
524
- training_id: z.number().positive(),
525
- employee_id: z.number().positive(),
526
- session_id: z.number().positive().optional(),
527
- });
528
- /**
529
- * Work Area schema
530
- */
531
- export const WorkAreaSchema = z.object({
532
- id: z.number(),
533
- name: z.string(),
534
- description: z.string().nullable(),
535
- location_id: z.number().nullable(),
536
- company_id: z.number().nullable(),
537
- archived: z.boolean().default(false),
538
- created_at: z.string().nullable(),
539
- updated_at: z.string().nullable(),
540
- });
541
- /**
542
- * Work Area create input schema
543
- */
544
- export const CreateWorkAreaInputSchema = z.object({
545
- name: z.string().min(1).max(100),
546
- description: z.string().max(500).optional(),
547
- location_id: z.number().positive().optional(),
548
- });
549
- /**
550
- * Work Area update input schema
551
- */
552
- export const UpdateWorkAreaInputSchema = CreateWorkAreaInputSchema.partial();
553
- /**
554
- * Job Posting schema
555
- */
556
- export const JobPostingSchema = z.object({
557
- id: z.number(),
558
- title: z.string(),
559
- description: z.string().nullable(),
560
- department: z.string().nullable(),
561
- location_id: z.number().nullable(),
562
- team_id: z.number().nullable(),
563
- status: z.enum(['draft', 'published', 'closed', 'archived']).nullable(),
564
- employment_type: z.string().nullable(),
565
- remote_status: z.string().nullable(),
566
- company_id: z.number().nullable(),
567
- published_at: z.string().nullable(),
568
- closed_at: z.string().nullable(),
569
- created_at: z.string().nullable(),
570
- updated_at: z.string().nullable(),
571
- });
572
- /**
573
- * Job Posting create input schema
574
- */
575
- export const CreateJobPostingInputSchema = z.object({
576
- title: z.string().min(1).max(200),
577
- description: z.string().max(5000).optional(),
578
- department: z.string().max(100).optional(),
579
- location_id: z.number().positive().optional(),
580
- team_id: z.number().positive().optional(),
581
- employment_type: z.string().max(50).optional(),
582
- remote_status: z.string().max(50).optional(),
583
- });
584
- /**
585
- * Job Posting update input schema
586
- */
587
- export const UpdateJobPostingInputSchema = CreateJobPostingInputSchema.partial().extend({
588
- status: z.enum(['draft', 'published', 'closed', 'archived']).optional(),
589
- });
590
- /**
591
- * Candidate schema
592
- */
593
- export const CandidateSchema = z.object({
594
- id: z.number(),
595
- first_name: z.string().nullable(),
596
- last_name: z.string().nullable(),
597
- full_name: z.string().nullable(),
598
- email: z.string().nullable(),
599
- phone: z.string().nullable(),
600
- source: z.string().nullable(),
601
- resume_url: z.string().nullable(),
602
- linkedin_url: z.string().nullable(),
603
- company_id: z.number().nullable(),
604
- created_at: z.string().nullable(),
605
- updated_at: z.string().nullable(),
606
- });
607
- /**
608
- * Candidate create input schema
609
- */
610
- export const CreateCandidateInputSchema = z.object({
611
- first_name: z.string().min(1).max(100),
612
- last_name: z.string().min(1).max(100),
613
- email: z.string().email().optional(),
614
- phone: z.string().max(30).optional(),
615
- source: z.string().max(100).optional(),
616
- linkedin_url: z.string().url().optional(),
617
- });
618
- /**
619
- * Candidate update input schema
620
- */
621
- export const UpdateCandidateInputSchema = CreateCandidateInputSchema.partial();
622
- /**
623
- * Application schema
624
- */
625
- export const ApplicationSchema = z.object({
626
- id: z.number(),
627
- job_posting_id: z.number(),
628
- candidate_id: z.number(),
629
- hiring_stage_id: z.number().nullable(),
630
- ats_application_phase_id: z.number().nullable(),
631
- status: z.string().nullable(),
632
- rating: z.number().nullable(),
633
- notes: z.string().nullable(),
634
- applied_at: z.string().nullable(),
635
- rejected_at: z.string().nullable(),
636
- hired_at: z.string().nullable(),
637
- created_at: z.string().nullable(),
638
- updated_at: z.string().nullable(),
639
- });
640
- /**
641
- * Application create input schema
642
- */
643
- export const CreateApplicationInputSchema = z.object({
644
- job_posting_id: z.number().positive(),
645
- candidate_id: z.number().positive(),
646
- notes: z.string().max(2000).optional(),
647
- });
648
- /**
649
- * Application update input schema
650
- */
651
- export const UpdateApplicationInputSchema = z.object({
652
- hiring_stage_id: z.number().positive().optional(),
653
- rating: z.number().min(0).max(5).optional(),
654
- notes: z.string().max(2000).optional(),
655
- });
656
- /**
657
- * Hiring Stage schema
658
- */
659
- export const HiringStageSchema = z.object({
660
- id: z.number(),
661
- name: z.string(),
662
- label: z.string().nullable(),
663
- ats_application_phase_id: z.number().nullable(),
664
- position: z.number().nullable(),
665
- company_id: z.number().nullable(),
666
- created_at: z.string().nullable(),
667
- updated_at: z.string().nullable(),
668
- });
669
- /**
670
- * Payroll Supplement schema
671
- */
672
- export const PayrollSupplementSchema = z.object({
673
- id: z.number(),
674
- employee_id: z.number(),
675
- supplement_type_id: z.number().nullable(),
676
- name: z.string().nullable(),
677
- amount_cents: z.number().nullable(),
678
- effective_on: z.string().nullable(),
679
- company_id: z.number().nullable(),
680
- created_at: z.string().nullable(),
681
- updated_at: z.string().nullable(),
682
- });
683
- /**
684
- * Tax Identifier schema
685
- */
686
- export const TaxIdentifierSchema = z.object({
687
- id: z.number(),
688
- employee_id: z.number(),
689
- identifier_type: z.string().nullable().optional(),
690
- identifier_value: z.string().nullable().optional(),
691
- country: z.string().nullable().optional(),
692
- created_at: z.string().nullable().optional(),
693
- updated_at: z.string().nullable().optional(),
694
- });
695
- /**
696
- * Family Situation schema
697
- */
698
- export const FamilySituationSchema = z.object({
699
- id: z.number(),
700
- employee_id: z.number(),
701
- marital_status: z.string().nullable(),
702
- number_of_dependents: z.number().nullable(),
703
- effective_on: z.string().nullable(),
704
- created_at: z.string().nullable(),
705
- updated_at: z.string().nullable(),
706
- });
707
- // ============================================================================
708
- // API Response Helpers
709
- // ============================================================================
710
- /**
711
- * API response wrapper schema
712
- */
713
- export function createApiResponseSchema(dataSchema) {
714
- return z.object({
715
- data: dataSchema,
716
- });
717
- }
718
- /**
719
- * API list response wrapper schema
720
- */
721
- export function createApiListResponseSchema(itemSchema) {
722
- return z.object({
723
- data: z.array(itemSchema),
724
- });
725
- }
726
- /**
727
- * Parse and validate data against a schema
728
- * @throws SchemaValidationError if validation fails
729
- */
730
- export function parseData(schemaName, schema, data) {
731
- const result = schema.safeParse(data);
732
- if (!result.success) {
733
- const issues = result.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join(', ');
734
- throw new SchemaValidationError(schemaName, issues, { data });
735
- }
736
- return result.data;
737
- }
738
- /**
739
- * Safely parse data without throwing (returns undefined on failure)
740
- */
741
- export function safeParseData(schema, data) {
742
- const result = schema.safeParse(data);
743
- return result.success ? result.data : undefined;
744
- }
745
- /**
746
- * Parse an array of items against a schema
747
- */
748
- export function parseArray(schemaName, itemSchema, data) {
749
- if (!Array.isArray(data)) {
750
- throw new SchemaValidationError(schemaName, 'Expected an array', { data });
751
- }
752
- return data.map((item, index) => {
753
- const result = itemSchema.safeParse(item);
754
- if (!result.success) {
755
- const issues = result.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join(', ');
756
- throw new SchemaValidationError(`${schemaName}[${index}]`, issues, { item });
757
- }
758
- return result.data;
759
- });
760
- }
9
+ export * from './schemas/index.js';
761
10
  //# sourceMappingURL=schemas.js.map