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