@upsales/schemas 0.1.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.mjs ADDED
@@ -0,0 +1,1421 @@
1
+ // src/shared.ts
2
+ import { z } from "zod";
3
+ var AddressTypeSchema = z.enum(["Mail", "Visit", "Invoice", "Delivery", "Other"]);
4
+ var AddressSchema = z.object({
5
+ zipcode: z.string().nullable(),
6
+ city: z.string().nullable(),
7
+ state: z.string().nullable(),
8
+ address: z.string().nullable(),
9
+ type: AddressTypeSchema,
10
+ country: z.string().nullable(),
11
+ latitude: z.number().nullable(),
12
+ longitude: z.number().nullable()
13
+ });
14
+ var IdNameSchema = z.object({
15
+ id: z.number().int(),
16
+ name: z.string()
17
+ });
18
+ var CategorySchema = z.object({
19
+ id: z.number().int(),
20
+ name: z.string().optional()
21
+ });
22
+ var CustomFieldSchema = z.object({
23
+ fieldId: z.number().int(),
24
+ value: z.unknown()
25
+ });
26
+ var QuotaSchema = z.object({
27
+ id: z.number().int(),
28
+ currency: z.string(),
29
+ currencyRate: z.number(),
30
+ period: z.string(),
31
+ quota: z.number(),
32
+ type: z.unknown(),
33
+ userId: z.number().int().nullable(),
34
+ periodType: z.enum(["yearly", "quarterly", "monthly"])
35
+ });
36
+
37
+ // src/client.ts
38
+ import { z as z2 } from "zod";
39
+ var ClientUserSchema = z2.object({
40
+ id: z2.number().int(),
41
+ name: z2.string(),
42
+ role: z2.string().optional(),
43
+ email: z2.string().optional()
44
+ });
45
+ var ConnectedClientSchema = z2.object({
46
+ id: z2.number().int(),
47
+ clientId: z2.number().int(),
48
+ relatedToClientId: z2.number().int(),
49
+ name: z2.string(),
50
+ description: z2.string(),
51
+ descriptionChildParent: z2.string()
52
+ });
53
+ var GrowthSchema = z2.object({
54
+ salesLast12Months: z2.number(),
55
+ cmLast12Months: z2.number(),
56
+ salesTrend12Months: z2.number(),
57
+ cmTrend12Months: z2.number(),
58
+ arrLast12Months: z2.number(),
59
+ mrrLast12Months: z2.number(),
60
+ arr: z2.number(),
61
+ arrTotal: z2.number(),
62
+ mrr: z2.number(),
63
+ arrOneYearAgo: z2.number(),
64
+ mrrOneYearAgo: z2.number(),
65
+ salesPercentOfTurnover: z2.number(),
66
+ arrPercentOfTurnover: z2.number(),
67
+ mrrPercentOfTurnover: z2.number(),
68
+ cmPercentOfTurnover: z2.number()
69
+ }).nullable();
70
+ var ClientSchema = z2.object({
71
+ // Identity
72
+ id: z2.number().int(),
73
+ name: z2.string().max(100),
74
+ // Contact info
75
+ phone: z2.string().max(30).nullable(),
76
+ phoneCountryCode: z2.string().max(2).nullable(),
77
+ fax: z2.string().max(30).nullable(),
78
+ webpage: z2.string().max(255).nullable(),
79
+ // Status
80
+ active: z2.union([z2.literal(0), z2.literal(1)]),
81
+ journeyStep: z2.string().max(100).nullable(),
82
+ score: z2.number().int(),
83
+ isExternal: z2.number().int(),
84
+ // Organization info
85
+ orgNo: z2.string().max(32).nullable(),
86
+ registrationDate: z2.string().nullable(),
87
+ status: z2.string().max(32).nullable(),
88
+ companyForm: z2.string().max(32).nullable(),
89
+ sniCode: z2.string().max(10).nullable(),
90
+ sicCode: z2.string().max(6).nullable(),
91
+ naicsCode: z2.string().max(6).nullable(),
92
+ ukSicCode: z2.string().max(5).nullable(),
93
+ naceCode: z2.string().max(6).nullable(),
94
+ cfar: z2.string().nullable(),
95
+ dunsNo: z2.string().max(10).nullable(),
96
+ currency: z2.string().max(3).nullable(),
97
+ // Financial
98
+ turnover: z2.number().nullable(),
99
+ profit: z2.number().nullable(),
100
+ noEmployees: z2.number().nullable(),
101
+ creditRating: z2.string().max(28).nullable(),
102
+ prospectingCreditRating: z2.string().max(8).nullable(),
103
+ prospectingNumericCreditRating: z2.number().nullable(),
104
+ probabilityOfDefault: z2.number().nullable(),
105
+ // Social
106
+ facebook: z2.string().max(256).nullable(),
107
+ twitter: z2.string().max(256).nullable(),
108
+ linkedin: z2.string().max(256).nullable(),
109
+ // Text fields
110
+ notes: z2.string().nullable(),
111
+ about: z2.string().nullable(),
112
+ // Dates
113
+ regDate: z2.string(),
114
+ deactivationDate: z2.string().nullable(),
115
+ deactivatedBy: z2.number().nullable(),
116
+ deactivationReason: z2.string().max(256).nullable(),
117
+ monitorChangeDate: z2.string().nullable(),
118
+ // Relations
119
+ parent: IdNameSchema.nullable(),
120
+ operationalAccount: IdNameSchema.nullable(),
121
+ users: z2.array(ClientUserSchema),
122
+ categories: z2.array(CategorySchema),
123
+ projects: z2.array(IdNameSchema),
124
+ addresses: z2.array(AddressSchema),
125
+ connectedClients: z2.array(ConnectedClientSchema),
126
+ custom: z2.array(CustomFieldSchema),
127
+ clientQuotas: z2.array(QuotaSchema),
128
+ // Prospecting
129
+ prospectingId: z2.string().nullable(),
130
+ autoMatchedProspectingId: z2.string().nullable(),
131
+ isMonitored: z2.boolean(),
132
+ excludedFromProspectingMonitor: z2.boolean(),
133
+ // Computed / read-only
134
+ regBy: z2.unknown(),
135
+ userEditable: z2.boolean(),
136
+ userRemovable: z2.boolean(),
137
+ growth: GrowthSchema.optional(),
138
+ priceListId: z2.number().nullable(),
139
+ // Activity tracking
140
+ hasActivity: z2.string().nullable().optional(),
141
+ hadActivity: z2.string().nullable().optional(),
142
+ hasAppointment: z2.string().nullable().optional(),
143
+ hadAppointment: z2.string().nullable().optional(),
144
+ hasOpportunity: z2.string().nullable().optional(),
145
+ hadOpportunity: z2.string().nullable().optional(),
146
+ hasOrder: z2.string().nullable().optional(),
147
+ hadOrder: z2.string().nullable().optional()
148
+ });
149
+ var CreateClientSchema = z2.object({
150
+ name: z2.string().min(1).max(100),
151
+ // Contact info
152
+ phone: z2.string().max(30).nullable().optional(),
153
+ phoneCountryCode: z2.string().max(2).nullable().optional(),
154
+ fax: z2.string().max(30).nullable().optional(),
155
+ webpage: z2.string().max(255).nullable().optional(),
156
+ // Status
157
+ active: z2.union([z2.literal(0), z2.literal(1)]).optional(),
158
+ journeyStep: z2.string().max(100).nullable().optional(),
159
+ // Organization
160
+ orgNo: z2.string().max(32).nullable().optional(),
161
+ registrationDate: z2.string().nullable().optional(),
162
+ status: z2.string().max(32).nullable().optional(),
163
+ companyForm: z2.string().max(32).nullable().optional(),
164
+ sniCode: z2.string().max(10).nullable().optional(),
165
+ sicCode: z2.string().max(6).nullable().optional(),
166
+ naicsCode: z2.string().max(6).nullable().optional(),
167
+ ukSicCode: z2.string().max(5).nullable().optional(),
168
+ naceCode: z2.string().max(6).nullable().optional(),
169
+ cfar: z2.string().nullable().optional(),
170
+ dunsNo: z2.string().max(10).nullable().optional(),
171
+ currency: z2.string().max(3).nullable().optional(),
172
+ // Financial
173
+ turnover: z2.number().nullable().optional(),
174
+ profit: z2.number().nullable().optional(),
175
+ noEmployees: z2.number().nullable().optional(),
176
+ creditRating: z2.string().max(28).nullable().optional(),
177
+ prospectingCreditRating: z2.string().max(8).nullable().optional(),
178
+ prospectingNumericCreditRating: z2.number().nullable().optional(),
179
+ // Social
180
+ facebook: z2.string().max(256).nullable().optional(),
181
+ twitter: z2.string().max(256).nullable().optional(),
182
+ linkedin: z2.string().max(256).nullable().optional(),
183
+ // Text
184
+ notes: z2.string().nullable().optional(),
185
+ about: z2.string().nullable().optional(),
186
+ // Relations
187
+ parent: IdNameSchema.nullable().optional(),
188
+ operationalAccount: IdNameSchema.nullable().optional(),
189
+ users: z2.array(z2.object({ id: z2.number().int() })).optional(),
190
+ categories: z2.array(CategorySchema).optional(),
191
+ projects: z2.array(z2.object({ id: z2.number().int() })).optional(),
192
+ addresses: z2.array(AddressSchema).optional(),
193
+ connectedClients: z2.array(ConnectedClientSchema.partial()).optional(),
194
+ custom: z2.array(CustomFieldSchema).optional(),
195
+ // Prospecting
196
+ prospectingId: z2.string().nullable().optional(),
197
+ autoMatchedProspectingId: z2.string().nullable().optional(),
198
+ excludedFromProspectingMonitor: z2.boolean().optional(),
199
+ // Deactivation
200
+ deactivationReason: z2.string().max(256).nullable().optional(),
201
+ deactivationDate: z2.string().nullable().optional(),
202
+ deactivatedBy: z2.number().nullable().optional(),
203
+ // Price list
204
+ priceListId: z2.number().nullable().optional()
205
+ });
206
+ var UpdateClientSchema = CreateClientSchema.partial().extend({
207
+ id: z2.number().int()
208
+ });
209
+
210
+ // src/contact.ts
211
+ import { z as z3 } from "zod";
212
+ var ContactClientSchema = z3.object({
213
+ id: z3.number().int(),
214
+ name: z3.string(),
215
+ journeyStep: z3.string().nullable().optional(),
216
+ phone: z3.string().nullable().optional(),
217
+ active: z3.union([z3.literal(0), z3.literal(1)]).optional()
218
+ });
219
+ var SalutationSchema = z3.object({
220
+ language: z3.string(),
221
+ tagId: z3.number().int(),
222
+ value: z3.string()
223
+ });
224
+ var TitleCategorySchema = z3.object({
225
+ tagId: z3.number().int(),
226
+ value: z3.string().optional()
227
+ });
228
+ var OptInSchema = z3.object({
229
+ id: z3.number().int(),
230
+ brandId: z3.number().int(),
231
+ title: z3.string(),
232
+ type: z3.string()
233
+ });
234
+ var OptOutSchema = z3.object({
235
+ title: z3.string()
236
+ });
237
+ var ContactSchema = z3.object({
238
+ // Identity
239
+ id: z3.number().int(),
240
+ name: z3.string().max(50),
241
+ firstName: z3.string().max(50).optional(),
242
+ lastName: z3.string().max(50).optional(),
243
+ // Contact info
244
+ email: z3.string().max(128),
245
+ phone: z3.string().max(30).nullable(),
246
+ phoneCountryCode: z3.string().max(2).nullable(),
247
+ cellPhone: z3.string().max(30).nullable(),
248
+ cellPhoneCountryCode: z3.string().max(2).nullable(),
249
+ linkedin: z3.string().max(256).nullable(),
250
+ // Professional
251
+ title: z3.string().max(128).nullable(),
252
+ salutation: SalutationSchema.nullable().optional(),
253
+ titleCategory: TitleCategorySchema.nullable().optional(),
254
+ // Status
255
+ active: z3.union([z3.literal(0), z3.literal(1)]),
256
+ journeyStep: z3.string().max(100).nullable(),
257
+ score: z3.number().int(),
258
+ isPriority: z3.boolean().optional(),
259
+ // Text
260
+ notes: z3.string().nullable(),
261
+ // Dates
262
+ regDate: z3.string(),
263
+ regBy: z3.unknown(),
264
+ unsubscribed: z3.string().nullable().optional(),
265
+ // Relations
266
+ client: ContactClientSchema,
267
+ categories: z3.array(CategorySchema),
268
+ projects: z3.array(IdNameSchema),
269
+ custom: z3.array(CustomFieldSchema),
270
+ connectedClients: z3.array(z3.unknown()).optional(),
271
+ // Consent
272
+ optins: z3.array(OptInSchema).optional(),
273
+ optOut: z3.array(OptOutSchema).optional(),
274
+ // Email
275
+ mailBounces: z3.array(z3.enum(["hard_bounce", "soft_bounce"])).optional(),
276
+ emailBounceReason: z3.string().optional(),
277
+ unsubscribedMailCampaign: z3.unknown().optional(),
278
+ // Computed / read-only
279
+ userEditable: z3.boolean(),
280
+ userRemovable: z3.boolean(),
281
+ importId: z3.number().nullable().optional(),
282
+ firstTouch: z3.unknown().optional(),
283
+ socialEvent: z3.unknown().optional(),
284
+ supportTickets: z3.object({
285
+ hasOpen: z3.boolean(),
286
+ hasClosed: z3.boolean()
287
+ }).optional(),
288
+ signals: z3.unknown().optional(),
289
+ // Activity tracking
290
+ hasActivity: z3.string().nullable().optional(),
291
+ hadActivity: z3.string().nullable().optional(),
292
+ hasAppointment: z3.string().nullable().optional(),
293
+ hadAppointment: z3.string().nullable().optional(),
294
+ hasOpportunity: z3.string().nullable().optional(),
295
+ hadOpportunity: z3.string().nullable().optional(),
296
+ hasOrder: z3.string().nullable().optional(),
297
+ hadOrder: z3.string().nullable().optional(),
298
+ hasMail: z3.boolean().optional(),
299
+ hasForm: z3.boolean().optional(),
300
+ hasVisit: z3.boolean().optional()
301
+ });
302
+ var CreateContactSchema = z3.object({
303
+ // Identity
304
+ name: z3.string().max(50).optional(),
305
+ firstName: z3.string().max(50).optional(),
306
+ lastName: z3.string().max(50).optional(),
307
+ // Contact info
308
+ email: z3.string().max(128).optional(),
309
+ phone: z3.string().max(30).nullable().optional(),
310
+ phoneCountryCode: z3.string().max(2).nullable().optional(),
311
+ cellPhone: z3.string().max(30).nullable().optional(),
312
+ cellPhoneCountryCode: z3.string().max(2).nullable().optional(),
313
+ linkedin: z3.string().max(256).nullable().optional(),
314
+ // Professional
315
+ title: z3.string().max(128).nullable().optional(),
316
+ salutation: z3.object({ tagId: z3.number().int() }).nullable().optional(),
317
+ titleCategory: z3.object({ tagId: z3.number().int() }).nullable().optional(),
318
+ // Status
319
+ active: z3.union([z3.literal(0), z3.literal(1)]).optional(),
320
+ journeyStep: z3.string().max(100).nullable().optional(),
321
+ isPriority: z3.boolean().optional(),
322
+ // Text
323
+ notes: z3.string().nullable().optional(),
324
+ // Relations — client is required
325
+ client: z3.object({ id: z3.number().int() }),
326
+ categories: z3.array(z3.object({ id: z3.number().int() })).optional(),
327
+ projects: z3.array(z3.object({ id: z3.number().int() })).optional(),
328
+ custom: z3.array(CustomFieldSchema).optional(),
329
+ optins: z3.array(z3.object({ id: z3.number().int() })).optional(),
330
+ // Other
331
+ firstTouch: z3.unknown().optional(),
332
+ ssn: z3.string().max(32).nullable().optional()
333
+ });
334
+ var UpdateContactSchema = CreateContactSchema.partial().extend({
335
+ id: z3.number().int()
336
+ });
337
+
338
+ // src/order.ts
339
+ import { z as z4 } from "zod";
340
+ var OrderStageSchema = z4.object({
341
+ id: z4.number().int(),
342
+ name: z4.string().optional(),
343
+ probability: z4.number().optional()
344
+ });
345
+ var OrderRowSchema = z4.object({
346
+ id: z4.number().int().optional(),
347
+ quantity: z4.number(),
348
+ price: z4.number(),
349
+ discount: z4.number(),
350
+ listPrice: z4.number(),
351
+ purchaseCost: z4.number(),
352
+ productId: z4.number().int(),
353
+ tierQuantity: z4.number(),
354
+ sortId: z4.number().int(),
355
+ bundleFixedPrice: z4.boolean().optional(),
356
+ bundleRows: z4.array(
357
+ z4.object({
358
+ id: z4.number().int().optional(),
359
+ listPrice: z4.number(),
360
+ price: z4.number(),
361
+ quantity: z4.number(),
362
+ tierQuantity: z4.number(),
363
+ purchaseCost: z4.number(),
364
+ sortId: z4.number().int().optional(),
365
+ productId: z4.number().int(),
366
+ discount: z4.number().optional(),
367
+ discountPercent: z4.number().optional()
368
+ })
369
+ ).optional(),
370
+ custom: z4.array(CustomFieldSchema).optional(),
371
+ product: z4.object({
372
+ id: z4.number().int(),
373
+ name: z4.string()
374
+ }).optional()
375
+ });
376
+ var OrderClientSchema = z4.object({
377
+ id: z4.number().int(),
378
+ name: z4.string(),
379
+ orgNo: z4.string().nullable().optional(),
380
+ journeyStep: z4.string().nullable().optional(),
381
+ priceListId: z4.number().nullable().optional(),
382
+ operationalAccount: IdNameSchema.nullable().optional()
383
+ });
384
+ var OrderContactSchema = z4.object({
385
+ id: z4.number().int(),
386
+ name: z4.string(),
387
+ firstName: z4.string().optional(),
388
+ lastName: z4.string().optional()
389
+ });
390
+ var RisksSchema = z4.object({
391
+ closingDateChangedOccured: z4.string().nullable(),
392
+ companySizeOccured: z4.string().nullable(),
393
+ daysInStageOccured: z4.string().nullable(),
394
+ noAppointmentsOccured: z4.string().nullable(),
395
+ noNextStepOccured: z4.string().nullable(),
396
+ noRecentContactOccured: z4.string().nullable(),
397
+ noStakeholderInvolvedOccured: z4.string().nullable(),
398
+ notAnsweringCallsOccured: z4.string().nullable(),
399
+ orderValueChangedOccured: z4.string().nullable(),
400
+ orderValueOccured: z4.string().nullable(),
401
+ postponedAppointmentsOccured: z4.string().nullable()
402
+ });
403
+ var UserSalesStatisticsSchema = z4.object({
404
+ mostCommonAppointmentsPerOrder: z4.number().nullable(),
405
+ mostCommonStakeholder: z4.string(),
406
+ avgSalesCycleLength: z4.number().nullable()
407
+ }).nullable();
408
+ var ProjectPlanOptionSchema = z4.object({
409
+ projectPlanTemplateId: z4.number().int(),
410
+ notes: z4.string(),
411
+ startDate: z4.string().nullable(),
412
+ endDate: z4.string().nullable(),
413
+ userId: z4.number().int().nullable()
414
+ });
415
+ var OrderSchema = z4.object({
416
+ // Identity
417
+ id: z4.number().int(),
418
+ description: z4.string().max(130),
419
+ // Dates
420
+ date: z4.string(),
421
+ closeDate: z4.string().nullable(),
422
+ regDate: z4.string(),
423
+ confirmedDate: z4.string().nullable().optional(),
424
+ // Relations
425
+ client: OrderClientSchema,
426
+ contact: OrderContactSchema.nullable().optional(),
427
+ project: IdNameSchema.nullable().optional(),
428
+ user: z4.unknown(),
429
+ clientConnection: IdNameSchema.nullable().optional(),
430
+ agreement: z4.object({ id: z4.number().int(), description: z4.string().optional() }).nullable().optional(),
431
+ salesCoach: z4.array(z4.unknown()).optional(),
432
+ checklist: z4.array(z4.unknown()).optional(),
433
+ // Stage & probability
434
+ stage: OrderStageSchema,
435
+ probability: z4.number().int(),
436
+ // Values
437
+ value: z4.number(),
438
+ annualValue: z4.number(),
439
+ annualValueInMasterCurrency: z4.number(),
440
+ monthlyValue: z4.number().optional(),
441
+ monthlyValueInMasterCurrency: z4.number().optional(),
442
+ oneOffValue: z4.number().optional(),
443
+ oneOffValueInMasterCurrency: z4.number().optional(),
444
+ valueInMasterCurrency: z4.number(),
445
+ contributionMargin: z4.number(),
446
+ contributionMarginLocalCurrency: z4.number(),
447
+ purchaseCost: z4.number().optional(),
448
+ // Weighted values
449
+ weightedValue: z4.number(),
450
+ weightedValueInMasterCurrency: z4.number(),
451
+ weightedAnnualValue: z4.number(),
452
+ weightedAnnualValueInMasterCurrency: z4.number(),
453
+ weightedMonthlyValue: z4.number(),
454
+ weightedMonthlyValueInMasterCurrency: z4.number(),
455
+ weightedOneOffValue: z4.number(),
456
+ weightedOneOffValueInMasterCurrency: z4.number(),
457
+ weightedContributionMargin: z4.number(),
458
+ weightedContributionMarginLocalCurrency: z4.number(),
459
+ // Currency
460
+ currency: z4.string().max(3).nullable(),
461
+ currencyRate: z4.number(),
462
+ // Order details
463
+ recurringInterval: z4.number().optional(),
464
+ locked: z4.union([z4.literal(0), z4.literal(1)]),
465
+ notes: z4.string().nullable(),
466
+ orderRow: z4.array(OrderRowSchema),
467
+ custom: z4.array(CustomFieldSchema),
468
+ // BANT
469
+ confirmedBudget: z4.number().nullable().optional(),
470
+ confirmedSolution: z4.boolean().nullable().optional(),
471
+ // Loss/competition
472
+ lostReason: z4.number().nullable().optional(),
473
+ competitorId: z4.number().nullable().optional(),
474
+ competitor: z4.unknown().optional(),
475
+ // Source & marketing
476
+ source: z4.unknown().optional(),
477
+ marketingContribution: z4.number().nullable().optional(),
478
+ // Stakeholders
479
+ stakeholders: z4.array(z4.unknown()).optional(),
480
+ titleCategories: z4.array(z4.unknown()).optional(),
481
+ // Statistics & risks
482
+ noCompletedAppointments: z4.number().int(),
483
+ noPostponedAppointments: z4.number().int(),
484
+ noTimesCallsNotAnswered: z4.number().int(),
485
+ noTimesClosingDateChanged: z4.number().int(),
486
+ noTimesOrderValueChanged: z4.number().int(),
487
+ risks: RisksSchema.optional(),
488
+ userSalesStatistics: UserSalesStatisticsSchema.optional(),
489
+ // Computed / read-only
490
+ regBy: z4.unknown(),
491
+ userEditable: z4.boolean(),
492
+ userRemovable: z4.boolean(),
493
+ agreementId: z4.number().nullable().optional(),
494
+ periodization: z4.unknown().optional(),
495
+ lastIntegrationStatus: z4.array(z4.unknown()).optional(),
496
+ priceListId: z4.number().optional(),
497
+ invoiceRelatedClient: z4.unknown().optional(),
498
+ projectPlanOptions: z4.array(ProjectPlanOptionSchema).optional()
499
+ });
500
+ var CreateOrderSchema = z4.object({
501
+ description: z4.string().max(130).optional(),
502
+ // Dates
503
+ date: z4.string(),
504
+ closeDate: z4.string().nullable().optional(),
505
+ regDate: z4.string().optional(),
506
+ confirmedDate: z4.string().nullable().optional(),
507
+ // Relations — required
508
+ client: z4.object({ id: z4.number().int() }),
509
+ user: z4.object({ id: z4.number().int() }),
510
+ stage: z4.object({ id: z4.number().int() }),
511
+ orderRow: z4.array(OrderRowSchema).min(1),
512
+ // Relations — optional
513
+ contact: z4.object({ id: z4.number().int() }).nullable().optional(),
514
+ project: z4.object({ id: z4.number().int() }).nullable().optional(),
515
+ clientConnection: z4.object({ id: z4.number().int() }).nullable().optional(),
516
+ salesCoach: z4.object({ id: z4.number().int() }).nullable().optional(),
517
+ // Values
518
+ probability: z4.number().int().optional(),
519
+ recurringInterval: z4.number().optional(),
520
+ currency: z4.string().max(3).nullable().optional(),
521
+ currencyRate: z4.number().optional(),
522
+ locked: z4.union([z4.literal(0), z4.literal(1)]).optional(),
523
+ // Text
524
+ notes: z4.string().nullable().optional(),
525
+ // Custom fields
526
+ custom: z4.array(CustomFieldSchema).optional(),
527
+ stakeholders: z4.array(z4.unknown()).optional(),
528
+ titleCategories: z4.array(z4.unknown()).optional(),
529
+ // BANT
530
+ confirmedBudget: z4.number().nullable().optional(),
531
+ confirmedSolution: z4.boolean().nullable().optional(),
532
+ // Loss
533
+ lostReason: z4.number().nullable().optional(),
534
+ competitorId: z4.number().nullable().optional(),
535
+ competitor: z4.unknown().optional(),
536
+ // Source
537
+ source: z4.unknown().optional(),
538
+ marketingContribution: z4.number().nullable().optional(),
539
+ // Checklist
540
+ checklist: z4.array(z4.unknown()).optional(),
541
+ // Price list & project plan
542
+ priceListId: z4.number().optional(),
543
+ invoiceRelatedClient: z4.unknown().optional(),
544
+ projectPlanOptions: z4.array(ProjectPlanOptionSchema).optional()
545
+ });
546
+ var UpdateOrderSchema = CreateOrderSchema.partial().extend({
547
+ id: z4.number().int()
548
+ });
549
+
550
+ // src/activity.ts
551
+ import { z as z5 } from "zod";
552
+ var ActivityContactSchema = z5.object({
553
+ id: z5.number().int(),
554
+ name: z5.string(),
555
+ cellPhone: z5.string().nullable().optional(),
556
+ email: z5.string().optional(),
557
+ phone: z5.string().nullable().optional(),
558
+ journeyStep: z5.string().nullable().optional(),
559
+ active: z5.union([z5.literal(0), z5.literal(1)]).optional()
560
+ });
561
+ var ActivityUserSchema = z5.object({
562
+ id: z5.number().int(),
563
+ name: z5.string(),
564
+ email: z5.string().optional(),
565
+ role: z5.string().optional()
566
+ });
567
+ var ActivityClientSchema = z5.object({
568
+ id: z5.number().int(),
569
+ name: z5.string(),
570
+ phone: z5.string().nullable().optional(),
571
+ journeyStep: z5.string().nullable().optional()
572
+ });
573
+ var ActivityOpportunitySchema = z5.object({
574
+ id: z5.number().int(),
575
+ description: z5.string().optional(),
576
+ orderValue: z5.number().optional(),
577
+ currency: z5.string().optional(),
578
+ probability: z5.number().optional()
579
+ });
580
+ var OutcomeSchema = z5.union([
581
+ z5.string(),
582
+ z5.object({
583
+ type: z5.string().nullable().optional(),
584
+ outcome: z5.string().nullable().optional(),
585
+ user: z5.object({ id: z5.number().int(), name: z5.string() }).optional(),
586
+ date: z5.string().optional(),
587
+ commentId: z5.string().nullable().optional()
588
+ })
589
+ ]);
590
+ var SourceSchema = z5.object({
591
+ type: z5.string(),
592
+ id: z5.number().int()
593
+ });
594
+ var ActivitySchema = z5.object({
595
+ // Identity
596
+ id: z5.number().int(),
597
+ description: z5.string().max(100),
598
+ isAppointment: z5.union([z5.literal(0), z5.literal(1)]),
599
+ // Dates & time
600
+ date: z5.string().nullable(),
601
+ time: z5.string().nullable(),
602
+ closeDate: z5.string().nullable().optional(),
603
+ closeTime: z5.string().nullable().optional(),
604
+ regDate: z5.string().optional(),
605
+ // Text
606
+ notes: z5.string().nullable(),
607
+ aiNotes: z5.string().nullable().optional(),
608
+ aiNotesEn: z5.string().nullable().optional(),
609
+ // Relations
610
+ client: ActivityClientSchema.nullable(),
611
+ contacts: z5.array(ActivityContactSchema),
612
+ users: z5.array(ActivityUserSchema),
613
+ activityType: IdNameSchema,
614
+ project: IdNameSchema.nullable().optional(),
615
+ projectPlan: z5.unknown().nullable().optional(),
616
+ opportunity: ActivityOpportunitySchema.nullable().optional(),
617
+ clientRelation: IdNameSchema.nullable().optional(),
618
+ // Parent references
619
+ parentActivityId: z5.number().int().nullable(),
620
+ parentAppointmentId: z5.number().int().nullable(),
621
+ ticketId: z5.number().int().nullable().optional(),
622
+ agreementId: z5.number().int().nullable().optional(),
623
+ // Priority & outcome
624
+ priority: z5.union([z5.literal(0), z5.literal(1), z5.literal(2), z5.literal(3)]),
625
+ outcomes: z5.array(z5.unknown()).optional(),
626
+ lastOutcome: OutcomeSchema.nullable().optional(),
627
+ // Custom fields
628
+ custom: z5.array(CustomFieldSchema),
629
+ // Call list
630
+ callList: z5.unknown().nullable().optional(),
631
+ callListId: z5.number().int().nullable().optional(),
632
+ // Source
633
+ source: SourceSchema.nullable().optional(),
634
+ // Phone calls
635
+ phoneCalls: z5.array(z5.unknown()).optional(),
636
+ // Computed / read-only
637
+ regBy: z5.unknown(),
638
+ modDate: z5.string().optional(),
639
+ userEditable: z5.boolean(),
640
+ userRemovable: z5.boolean()
641
+ });
642
+ var CreateActivitySchema = z5.object({
643
+ description: z5.string().max(100).optional(),
644
+ // Dates & time
645
+ date: z5.string().nullable().optional(),
646
+ time: z5.string().nullable().optional(),
647
+ closeDate: z5.string().nullable().optional(),
648
+ // Text
649
+ notes: z5.string().nullable().optional(),
650
+ aiNotes: z5.string().nullable().optional(),
651
+ aiNotesEn: z5.string().nullable().optional(),
652
+ // Relations — required
653
+ users: z5.object({ id: z5.number().int() }),
654
+ activityType: z5.object({ id: z5.number().int() }),
655
+ // Relations — optional
656
+ client: z5.object({ id: z5.number().int() }).nullable().optional(),
657
+ contacts: z5.object({ id: z5.number().int() }).nullable().optional(),
658
+ project: z5.object({ id: z5.number().int() }).nullable().optional(),
659
+ projectPlan: z5.object({ id: z5.number().int() }).nullable().optional(),
660
+ opportunity: z5.object({ id: z5.number().int() }).nullable().optional(),
661
+ clientRelation: z5.object({ id: z5.number().int() }).nullable().optional(),
662
+ callList: z5.object({ id: z5.number().int() }).nullable().optional(),
663
+ taskTemplate: z5.object({ id: z5.number().int() }).nullable().optional(),
664
+ // Parent references
665
+ parentActivityId: z5.number().int().nullable().optional(),
666
+ parentAppointmentId: z5.number().int().nullable().optional(),
667
+ ticketId: z5.number().int().nullable().optional(),
668
+ agreementId: z5.number().int().nullable().optional(),
669
+ // Priority & outcome
670
+ priority: z5.union([z5.literal(0), z5.literal(1), z5.literal(2), z5.literal(3)]).optional(),
671
+ outcome: z5.string().nullable().optional(),
672
+ outcomeType: z5.string().nullable().optional(),
673
+ outcomeExtra: z5.string().nullable().optional(),
674
+ outcomeCommentId: z5.number().int().nullable().optional(),
675
+ // Custom fields
676
+ custom: z5.array(CustomFieldSchema).optional(),
677
+ // Source
678
+ sourceType: z5.string().nullable().optional(),
679
+ sourceId: z5.number().int().nullable().optional(),
680
+ // Other
681
+ doNotRemind: z5.boolean().optional(),
682
+ callListId: z5.number().int().nullable().optional()
683
+ });
684
+ var UpdateActivitySchema = CreateActivitySchema.partial().extend({
685
+ id: z5.number().int()
686
+ });
687
+
688
+ // src/appointment.ts
689
+ import { z as z6 } from "zod";
690
+ var AppointmentClientSchema = z6.object({
691
+ id: z6.number().int(),
692
+ name: z6.string(),
693
+ phone: z6.string().nullable().optional()
694
+ });
695
+ var AppointmentContactSchema = z6.object({
696
+ id: z6.number().int(),
697
+ name: z6.string(),
698
+ cellPhone: z6.string().nullable().optional(),
699
+ phone: z6.string().nullable().optional()
700
+ });
701
+ var AppointmentUserSchema = z6.object({
702
+ id: z6.number().int(),
703
+ name: z6.string()
704
+ });
705
+ var AppointmentSchema = z6.object({
706
+ // Identity
707
+ id: z6.number().int(),
708
+ description: z6.string().max(100),
709
+ isAppointment: z6.union([z6.literal(0), z6.literal(1)]),
710
+ // Dates
711
+ date: z6.string(),
712
+ endDate: z6.string(),
713
+ regDate: z6.string().optional(),
714
+ // Location & meeting
715
+ location: z6.string().nullable().optional(),
716
+ weblinkUrl: z6.string().nullable().optional(),
717
+ includeWeblink: z6.union([z6.literal(0), z6.literal(1)]).optional(),
718
+ private: z6.union([z6.literal(0), z6.literal(1)]),
719
+ isExternalHost: z6.union([z6.literal(0), z6.literal(1)]).optional(),
720
+ // Text
721
+ notes: z6.string().nullable(),
722
+ aiNotes: z6.string().nullable().optional(),
723
+ aiNotesEn: z6.string().nullable().optional(),
724
+ agenda: z6.string().nullable().optional(),
725
+ // Relations
726
+ client: AppointmentClientSchema.nullable(),
727
+ users: z6.array(AppointmentUserSchema),
728
+ contacts: z6.array(AppointmentContactSchema),
729
+ activityType: IdNameSchema,
730
+ project: IdNameSchema.nullable().optional(),
731
+ projectPlan: IdNameSchema.nullable().optional(),
732
+ opportunity: z6.unknown().nullable().optional(),
733
+ clientConnection: IdNameSchema.nullable().optional(),
734
+ // External calendar
735
+ externalCalendarId: z6.string().nullable().optional(),
736
+ seriesMasterId: z6.string().nullable().optional(),
737
+ uniqueExternalId: z6.string().nullable().optional(),
738
+ hostHasCalendarIntegration: z6.boolean().optional(),
739
+ bookedRooms: z6.unknown().nullable().optional(),
740
+ emailAttendees: z6.array(z6.unknown()).optional(),
741
+ // Outcome
742
+ outcome: z6.unknown().nullable().optional(),
743
+ outcomeType: z6.string().nullable().optional(),
744
+ outcomeAction: z6.string().nullable().optional(),
745
+ outcomeExtra: z6.string().nullable().optional(),
746
+ outcomeCommentId: z6.number().int().nullable().optional(),
747
+ // Source
748
+ source: z6.unknown().nullable().optional(),
749
+ // Custom fields
750
+ custom: z6.array(CustomFieldSchema),
751
+ // Computed / read-only
752
+ regBy: z6.unknown(),
753
+ modDate: z6.string().optional(),
754
+ userEditable: z6.boolean(),
755
+ userRemovable: z6.boolean()
756
+ });
757
+ var CreateAppointmentSchema = z6.object({
758
+ description: z6.string().max(100).optional(),
759
+ // Dates — required
760
+ date: z6.string(),
761
+ endDate: z6.string(),
762
+ // Location & meeting
763
+ location: z6.string().nullable().optional(),
764
+ weblinkUrl: z6.string().nullable().optional(),
765
+ includeWeblink: z6.boolean().optional(),
766
+ private: z6.boolean().optional(),
767
+ isExternalHost: z6.boolean().optional(),
768
+ // Text
769
+ notes: z6.string().nullable().optional(),
770
+ aiNotes: z6.string().nullable().optional(),
771
+ aiNotesEn: z6.string().nullable().optional(),
772
+ agenda: z6.string().nullable().optional(),
773
+ // Relations — required
774
+ activityType: z6.object({ id: z6.number().int() }),
775
+ // Relations — optional
776
+ client: z6.object({ id: z6.number().int() }).nullable().optional(),
777
+ users: z6.array(z6.object({ id: z6.number().int() })).optional(),
778
+ contacts: z6.array(z6.object({ id: z6.number().int() })).optional(),
779
+ project: z6.object({ id: z6.number().int() }).nullable().optional(),
780
+ projectPlan: z6.object({ id: z6.number().int() }).nullable().optional(),
781
+ opportunity: z6.object({ id: z6.number().int() }).nullable().optional(),
782
+ clientConnection: z6.object({ id: z6.number().int() }).nullable().optional(),
783
+ // External calendar
784
+ externalCalendarId: z6.string().nullable().optional(),
785
+ seriesMasterId: z6.string().nullable().optional(),
786
+ uniqueExternalId: z6.string().nullable().optional(),
787
+ isAgendaDirty: z6.boolean().optional(),
788
+ bookedRooms: z6.unknown().nullable().optional(),
789
+ emailAttendees: z6.array(z6.unknown()).optional(),
790
+ // Outcome
791
+ outcome: z6.string().nullable().optional(),
792
+ outcomeType: z6.string().nullable().optional(),
793
+ outcomeAction: z6.string().nullable().optional(),
794
+ outcomeExtra: z6.string().nullable().optional(),
795
+ outcomeCommentId: z6.number().int().nullable().optional(),
796
+ // Custom fields
797
+ custom: z6.array(CustomFieldSchema).optional(),
798
+ // Source
799
+ sourceType: z6.string().nullable().optional(),
800
+ sourceId: z6.number().int().nullable().optional()
801
+ });
802
+ var UpdateAppointmentSchema = CreateAppointmentSchema.partial().extend({
803
+ id: z6.number().int()
804
+ });
805
+
806
+ // src/agreement.ts
807
+ import { z as z7 } from "zod";
808
+ var AgreementMetadataSchema = z7.object({
809
+ activeVersionId: z7.number().int().nullable(),
810
+ versionNo: z7.number().int(),
811
+ agreementDescription: z7.string(),
812
+ agreementStartdate: z7.string(),
813
+ agreementEnddate: z7.string().nullable(),
814
+ agreementInvoiceStartdate: z7.string(),
815
+ agreementInitialInvoiceStartdate: z7.string(),
816
+ agreementRenewalDate: z7.string(),
817
+ agreementRenewalDateReal: z7.string().nullable(),
818
+ agreementNextOrderDate: z7.string(),
819
+ agreementIntervalType: z7.number().int(),
820
+ agreementIntervalPeriod: z7.number().int(),
821
+ agreementOrderCreationTime: z7.number().int(),
822
+ custom: z7.array(CustomFieldSchema).optional(),
823
+ orderSequenceNr: z7.number().int(),
824
+ latestOrderId: z7.number().int(),
825
+ latestOrderCreationDate: z7.string(),
826
+ agreementNotes: z7.string(),
827
+ periodLength: z7.number().int(),
828
+ willCreateMoreOrders: z7.boolean(),
829
+ temporaryNextOrderDate: z7.string().nullable().optional(),
830
+ noticeDate: z7.string().nullable(),
831
+ noticePeriod: z7.number().int()
832
+ });
833
+ var AgreementClientSchema = z7.object({
834
+ id: z7.number().int(),
835
+ name: z7.string(),
836
+ journeyStep: z7.string().nullable().optional(),
837
+ priceListId: z7.number().nullable().optional(),
838
+ operationalAccount: IdNameSchema.nullable().optional()
839
+ });
840
+ var AgreementSchema = z7.object({
841
+ id: z7.number().int(),
842
+ description: z7.string(),
843
+ notes: z7.string().nullable(),
844
+ agreementGroupId: z7.number().int().nullable(),
845
+ // Values
846
+ value: z7.number(),
847
+ valueInMasterCurrency: z7.number(),
848
+ yearlyValue: z7.number().nullable(),
849
+ yearlyValueInMasterCurrency: z7.number(),
850
+ contributionMargin: z7.number(),
851
+ contributionMarginInAgreementCurrency: z7.number(),
852
+ yearlyContributionMargin: z7.number().nullable(),
853
+ yearlyContributionMarginInAgreementCurrency: z7.number(),
854
+ purchaseCost: z7.number(),
855
+ currency: z7.string().max(3),
856
+ currencyRate: z7.number(),
857
+ // Hierarchy
858
+ isParent: z7.boolean(),
859
+ parentId: z7.number().int().nullable(),
860
+ children: z7.array(z7.unknown()).optional(),
861
+ // Relations
862
+ client: AgreementClientSchema,
863
+ contact: z7.object({ id: z7.number().int(), name: z7.string() }).nullable(),
864
+ user: z7.unknown(),
865
+ project: IdNameSchema.nullable(),
866
+ stage: IdNameSchema,
867
+ clientConnection: IdNameSchema.nullable(),
868
+ orderRow: z7.array(z7.unknown()),
869
+ custom: z7.array(CustomFieldSchema),
870
+ metadata: AgreementMetadataSchema,
871
+ // Dates
872
+ regDate: z7.string(),
873
+ modDate: z7.string().optional(),
874
+ latestIndexIncreaseDate: z7.string().nullable().optional(),
875
+ // Config
876
+ priceListId: z7.number().optional(),
877
+ invoiceRelatedClient: z7.boolean().optional(),
878
+ indexIncreaseId: z7.number().int().nullable().optional(),
879
+ latestIndexIncreaseId: z7.number().int().nullable().optional(),
880
+ // Computed
881
+ regBy: z7.unknown(),
882
+ userEditable: z7.boolean(),
883
+ userRemovable: z7.boolean()
884
+ });
885
+ var CreateAgreementSchema = z7.object({
886
+ description: z7.string(),
887
+ notes: z7.string().nullable().optional(),
888
+ // Relations — required
889
+ client: z7.object({ id: z7.number().int() }),
890
+ user: z7.object({ id: z7.number().int() }),
891
+ stage: z7.object({ id: z7.number().int() }),
892
+ orderRow: z7.array(z7.unknown()).min(1),
893
+ // Relations — optional
894
+ contact: z7.object({ id: z7.number().int() }).nullable().optional(),
895
+ project: z7.object({ id: z7.number().int() }).nullable().optional(),
896
+ clientConnection: z7.object({ id: z7.number().int() }).nullable().optional(),
897
+ // Values
898
+ currency: z7.string().max(3).optional(),
899
+ currencyRate: z7.number().optional(),
900
+ metadata: z7.unknown().optional(),
901
+ custom: z7.array(CustomFieldSchema).optional(),
902
+ children: z7.array(z7.unknown()).optional(),
903
+ // Config
904
+ priceListId: z7.number().optional(),
905
+ invoiceRelatedClient: z7.unknown().optional(),
906
+ agreementGroupId: z7.number().int().nullable().optional(),
907
+ date: z7.string().optional(),
908
+ locked: z7.boolean().optional(),
909
+ createdFromOrderId: z7.number().int().optional(),
910
+ createDiffOrder: z7.boolean().optional(),
911
+ diffOrderNote: z7.string().optional(),
912
+ notify: z7.boolean().optional(),
913
+ arrUser: z7.unknown().optional(),
914
+ forceNewVersion: z7.boolean().optional(),
915
+ isIndexIncrease: z7.boolean().optional()
916
+ });
917
+ var UpdateAgreementSchema = CreateAgreementSchema.partial().extend({
918
+ id: z7.number().int()
919
+ });
920
+
921
+ // src/product.ts
922
+ import { z as z8 } from "zod";
923
+ var TierSchema = z8.object({
924
+ start: z8.number(),
925
+ end: z8.number(),
926
+ isTotalPrice: z8.boolean(),
927
+ currencies: z8.array(z8.object({ currency: z8.string(), value: z8.number() })),
928
+ priceListId: z8.number().optional(),
929
+ maxDiscount: z8.number().nullable().optional()
930
+ });
931
+ var ProductCurrencySchema = z8.object({
932
+ currency: z8.string(),
933
+ price: z8.number(),
934
+ purchaseCost: z8.number(),
935
+ priceListId: z8.number().optional(),
936
+ maxDiscount: z8.number().nullable().optional()
937
+ });
938
+ var BundleComponentSchema = z8.object({
939
+ id: z8.number().int().optional(),
940
+ quantity: z8.number(),
941
+ tierQuantity: z8.number(),
942
+ productId: z8.number().int(),
943
+ adjustable: z8.boolean().optional(),
944
+ bundleRowPrice: z8.number().optional(),
945
+ bundleRowCost: z8.number().optional(),
946
+ price: z8.number().optional(),
947
+ purchaseCost: z8.number().optional()
948
+ });
949
+ var ProductSchema = z8.object({
950
+ id: z8.number().int(),
951
+ name: z8.string(),
952
+ listPrice: z8.number(),
953
+ active: z8.union([z8.literal(0), z8.literal(1)]),
954
+ category: IdNameSchema.nullable().optional(),
955
+ sortId: z8.number().int(),
956
+ recurringInterval: z8.number().nullable(),
957
+ isMultiCurrency: z8.union([z8.literal(0), z8.literal(1)]),
958
+ isRecurring: z8.union([z8.literal(0), z8.literal(1)]),
959
+ purchaseCost: z8.number(),
960
+ articleNo: z8.string().nullable(),
961
+ importId: z8.number().nullable().optional(),
962
+ description: z8.string().nullable(),
963
+ // Multi-currency & tiers
964
+ currencies: z8.array(ProductCurrencySchema),
965
+ tiers: z8.array(TierSchema),
966
+ // Bundle
967
+ bundle: z8.array(BundleComponentSchema),
968
+ bundlePriceAdjustment: z8.number().nullable().optional(),
969
+ bundlePriceAdjustmentType: z8.unknown().optional(),
970
+ bundleFixedPrice: z8.boolean(),
971
+ bundleEditable: z8.boolean(),
972
+ // Relations
973
+ roles: z8.array(IdNameSchema),
974
+ custom: z8.array(CustomFieldSchema),
975
+ projectPlanTemplate: z8.object({ id: z8.number().int(), name: z8.string(), active: z8.boolean().optional() }).nullable().optional(),
976
+ // Computed
977
+ userEditable: z8.boolean(),
978
+ userRemovable: z8.boolean(),
979
+ userUsable: z8.boolean().optional()
980
+ });
981
+ var CreateProductSchema = z8.object({
982
+ name: z8.string(),
983
+ listPrice: z8.number().optional(),
984
+ active: z8.union([z8.literal(0), z8.literal(1)]).optional(),
985
+ category: z8.object({ id: z8.number().int() }).nullable().optional(),
986
+ sortId: z8.number().int().optional(),
987
+ recurringInterval: z8.number().nullable().optional(),
988
+ isMultiCurrency: z8.boolean().optional(),
989
+ isRecurring: z8.boolean().optional(),
990
+ purchaseCost: z8.number().optional(),
991
+ articleNo: z8.string().nullable().optional(),
992
+ description: z8.string().nullable().optional(),
993
+ currencies: z8.array(ProductCurrencySchema).optional(),
994
+ tiers: z8.array(TierSchema).optional(),
995
+ bundle: z8.array(BundleComponentSchema).optional(),
996
+ bundlePriceAdjustment: z8.number().nullable().optional(),
997
+ bundlePriceAdjustmentType: z8.unknown().optional(),
998
+ bundleFixedPrice: z8.boolean().optional(),
999
+ bundleEditable: z8.boolean().optional(),
1000
+ roles: z8.array(z8.object({ id: z8.number().int() })).optional(),
1001
+ custom: z8.array(CustomFieldSchema).optional(),
1002
+ projectPlanTemplate: z8.object({ id: z8.number().int() }).nullable().optional()
1003
+ });
1004
+ var UpdateProductSchema = CreateProductSchema.partial().extend({
1005
+ id: z8.number().int()
1006
+ });
1007
+
1008
+ // src/user.ts
1009
+ import { z as z9 } from "zod";
1010
+ var UserSchema = z9.object({
1011
+ id: z9.number().int(),
1012
+ name: z9.string(),
1013
+ email: z9.string(),
1014
+ active: z9.union([z9.literal(0), z9.literal(1)]),
1015
+ administrator: z9.union([z9.literal(0), z9.literal(1)]),
1016
+ teamLeader: z9.union([z9.literal(0), z9.literal(1)]),
1017
+ ghost: z9.union([z9.literal(0), z9.literal(1)]),
1018
+ free: z9.union([z9.literal(0), z9.literal(1)]),
1019
+ role: IdNameSchema.nullable(),
1020
+ regDate: z9.string().optional(),
1021
+ // Contact info
1022
+ userTitle: z9.string().nullable(),
1023
+ userAddress: z9.string().nullable(),
1024
+ userZipCode: z9.string().nullable(),
1025
+ userState: z9.string().nullable(),
1026
+ userPhone: z9.string().nullable(),
1027
+ userCellPhone: z9.string().nullable(),
1028
+ // Permissions
1029
+ export: z9.union([z9.literal(0), z9.literal(1)]),
1030
+ billingAdmin: z9.union([z9.literal(0), z9.literal(1)]),
1031
+ crm: z9.union([z9.literal(0), z9.literal(1)]),
1032
+ support: z9.union([z9.literal(0), z9.literal(1)]),
1033
+ service: z9.union([z9.literal(0), z9.literal(1)]),
1034
+ supportAdmin: z9.union([z9.literal(0), z9.literal(1)]),
1035
+ projectAdmin: z9.union([z9.literal(0), z9.literal(1)]),
1036
+ // Other
1037
+ custom: z9.array(CustomFieldSchema),
1038
+ celebrationVideoUrl: z9.string().nullable().optional(),
1039
+ userEditable: z9.boolean(),
1040
+ userRemovable: z9.boolean()
1041
+ });
1042
+ var CreateUserSchema = z9.object({
1043
+ name: z9.string(),
1044
+ email: z9.string(),
1045
+ active: z9.union([z9.literal(0), z9.literal(1)]).optional(),
1046
+ administrator: z9.boolean().optional(),
1047
+ teamLeader: z9.boolean().optional(),
1048
+ ghost: z9.boolean().optional(),
1049
+ free: z9.boolean().optional(),
1050
+ role: z9.object({ id: z9.number().int() }).nullable().optional(),
1051
+ userTitle: z9.string().nullable().optional(),
1052
+ userAddress: z9.string().nullable().optional(),
1053
+ userZipCode: z9.string().nullable().optional(),
1054
+ userState: z9.string().nullable().optional(),
1055
+ userPhone: z9.string().nullable().optional(),
1056
+ userCellPhone: z9.string().nullable().optional(),
1057
+ export: z9.boolean().optional(),
1058
+ billingAdmin: z9.boolean().optional(),
1059
+ crm: z9.boolean().optional(),
1060
+ support: z9.boolean().optional(),
1061
+ service: z9.boolean().optional(),
1062
+ supportAdmin: z9.boolean().optional(),
1063
+ projectAdmin: z9.boolean().optional(),
1064
+ custom: z9.array(CustomFieldSchema).optional(),
1065
+ celebrationVideoUrl: z9.string().nullable().optional()
1066
+ });
1067
+ var UpdateUserSchema = CreateUserSchema.partial().extend({
1068
+ id: z9.number().int()
1069
+ });
1070
+
1071
+ // src/opportunity.ts
1072
+ var OpportunitySchema = OrderSchema;
1073
+ var CreateOpportunitySchema = CreateOrderSchema;
1074
+ var UpdateOpportunitySchema = UpdateOrderSchema;
1075
+
1076
+ // src/ticket.ts
1077
+ import { z as z10 } from "zod";
1078
+ var TicketStatusSchema = z10.object({
1079
+ id: z10.number().int(),
1080
+ name: z10.string().optional(),
1081
+ closed: z10.boolean().optional()
1082
+ });
1083
+ var TicketTypeSchema = z10.object({
1084
+ id: z10.number().int(),
1085
+ name: z10.string(),
1086
+ isDefault: z10.boolean().optional()
1087
+ });
1088
+ var TicketContactSchema = z10.object({
1089
+ id: z10.number().int(),
1090
+ name: z10.string(),
1091
+ email: z10.string().optional(),
1092
+ phone: z10.string().nullable().optional(),
1093
+ cellPhone: z10.string().nullable().optional(),
1094
+ title: z10.string().nullable().optional()
1095
+ });
1096
+ var TicketInvolvedSchema = z10.object({
1097
+ type: z10.enum(["TO", "CC"]),
1098
+ email: z10.string(),
1099
+ contact: TicketContactSchema.nullable()
1100
+ });
1101
+ var ExternalContactSchema = z10.object({
1102
+ id: z10.number().int(),
1103
+ title: z10.string(),
1104
+ client: z10.object({ id: z10.number().int(), name: z10.string() }).nullable(),
1105
+ involved: z10.array(TicketInvolvedSchema),
1106
+ regDate: z10.string(),
1107
+ regBy: z10.object({ id: z10.number().int(), name: z10.string() }),
1108
+ lastUpdated: z10.string()
1109
+ });
1110
+ var TicketSchema = z10.object({
1111
+ id: z10.number().int(),
1112
+ title: z10.string(),
1113
+ description: z10.string(),
1114
+ emailUsed: z10.string().nullable(),
1115
+ // Status & type
1116
+ status: TicketStatusSchema,
1117
+ type: TicketTypeSchema,
1118
+ priority: z10.number().int(),
1119
+ isPending: z10.boolean(),
1120
+ isArchived: z10.boolean(),
1121
+ isRead: z10.boolean(),
1122
+ isMultiMatch: z10.boolean(),
1123
+ // Dates
1124
+ regDate: z10.string(),
1125
+ modDate: z10.string(),
1126
+ resolveDate: z10.string().nullable(),
1127
+ lastUpdated: z10.string(),
1128
+ snoozeDate: z10.string().nullable(),
1129
+ // Relations
1130
+ client: z10.object({ id: z10.number().int(), name: z10.string() }).nullable(),
1131
+ contact: TicketContactSchema.nullable(),
1132
+ user: z10.object({ id: z10.number().int(), name: z10.string(), email: z10.string().optional() }).nullable().optional(),
1133
+ involved: z10.array(TicketInvolvedSchema),
1134
+ externalContacts: z10.array(ExternalContactSchema),
1135
+ // Linked entities
1136
+ activity: z10.unknown().nullable().optional(),
1137
+ appointment: z10.unknown().nullable().optional(),
1138
+ opportunity: z10.unknown().nullable().optional(),
1139
+ agreement: z10.unknown().nullable().optional(),
1140
+ projectPlan: z10.unknown().nullable().optional(),
1141
+ relatedTicket: z10.unknown().nullable().optional(),
1142
+ // Custom & computed
1143
+ custom: z10.array(CustomFieldSchema),
1144
+ regBy: z10.object({ id: z10.number().int(), name: z10.string() }),
1145
+ modBy: z10.number().int(),
1146
+ unreadComments: z10.number().int(),
1147
+ source: z10.unknown().nullable(),
1148
+ mergedWithId: z10.number().int().optional(),
1149
+ mergedTickets: z10.array(z10.unknown()).optional(),
1150
+ directlyMergedTicketIds: z10.array(z10.number().int()).optional()
1151
+ });
1152
+ var CreateTicketSchema = z10.object({
1153
+ title: z10.string(),
1154
+ description: z10.string().optional(),
1155
+ status: z10.object({ id: z10.number().int() }).optional(),
1156
+ type: z10.object({ id: z10.number().int() }).optional(),
1157
+ priority: z10.number().int().optional(),
1158
+ client: z10.object({ id: z10.number().int() }).nullable().optional(),
1159
+ contact: z10.object({ id: z10.number().int() }).nullable().optional(),
1160
+ user: z10.object({ id: z10.number().int() }).nullable().optional(),
1161
+ involved: z10.array(z10.object({ type: z10.enum(["TO", "CC"]), email: z10.string() })).optional(),
1162
+ custom: z10.array(CustomFieldSchema).optional(),
1163
+ snoozeDate: z10.string().nullable().optional()
1164
+ });
1165
+ var UpdateTicketSchema = CreateTicketSchema.partial().extend({
1166
+ id: z10.number().int()
1167
+ });
1168
+
1169
+ // src/projectPlan.ts
1170
+ import { z as z11 } from "zod";
1171
+ var ProjectPlanSchema = z11.object({
1172
+ id: z11.number().int(),
1173
+ name: z11.string(),
1174
+ // Dates
1175
+ startDate: z11.string().nullable(),
1176
+ endDate: z11.string().nullable(),
1177
+ startTime: z11.string().nullable(),
1178
+ endTime: z11.string().nullable(),
1179
+ regDate: z11.string(),
1180
+ modDate: z11.string(),
1181
+ // Text
1182
+ notes: z11.string(),
1183
+ location: z11.string().nullable(),
1184
+ locationLatitude: z11.number().nullable(),
1185
+ locationLongitude: z11.number().nullable(),
1186
+ // Config
1187
+ projectPlanStage: IdNameSchema,
1188
+ projectPlanPriority: IdNameSchema,
1189
+ projectPlanStatus: IdNameSchema,
1190
+ projectPlanType: z11.object({
1191
+ id: z11.number().int(),
1192
+ name: z11.string(),
1193
+ isDefault: z11.boolean().optional(),
1194
+ category: z11.enum(["PROJECT", "SERVICE"]).optional()
1195
+ }),
1196
+ projectPlanTemplate: z11.object({
1197
+ id: z11.number().int(),
1198
+ name: z11.string(),
1199
+ offsetEndDate: z11.boolean().optional()
1200
+ }).nullable(),
1201
+ // Tasks
1202
+ finishedTasks: z11.number().int(),
1203
+ openTasks: z11.number().int(),
1204
+ // Relations
1205
+ user: z11.object({ id: z11.number().int(), name: z11.string(), email: z11.string().optional() }).nullable(),
1206
+ client: z11.object({ id: z11.number().int(), name: z11.string() }),
1207
+ contact: IdNameSchema.nullable(),
1208
+ order: z11.object({ id: z11.number().int(), description: z11.string().optional() }).nullable(),
1209
+ custom: z11.array(CustomFieldSchema),
1210
+ productLists: z11.array(z11.unknown()),
1211
+ productListOrders: z11.array(z11.unknown()),
1212
+ // Linked entities
1213
+ activityId: z11.number().int().optional(),
1214
+ appointmentId: z11.number().int().optional(),
1215
+ ticketId: z11.number().int().optional(),
1216
+ createdFromTicketId: z11.number().int().optional(),
1217
+ agreementId: z11.number().int().optional(),
1218
+ relatedOrderId: z11.number().int().optional(),
1219
+ // Computed
1220
+ regBy: IdNameSchema,
1221
+ modBy: IdNameSchema
1222
+ });
1223
+ var CreateProjectPlanSchema = z11.object({
1224
+ name: z11.string(),
1225
+ startDate: z11.string().nullable().optional(),
1226
+ endDate: z11.string().nullable().optional(),
1227
+ startTime: z11.string().nullable().optional(),
1228
+ endTime: z11.string().nullable().optional(),
1229
+ notes: z11.string().optional(),
1230
+ location: z11.string().nullable().optional(),
1231
+ // Config
1232
+ projectPlanStage: z11.object({ id: z11.number().int() }).optional(),
1233
+ projectPlanPriority: z11.object({ id: z11.number().int() }).optional(),
1234
+ projectPlanStatus: z11.object({ id: z11.number().int() }).optional(),
1235
+ projectPlanType: z11.object({ id: z11.number().int() }).optional(),
1236
+ projectPlanTemplate: z11.object({ id: z11.number().int() }).nullable().optional(),
1237
+ // Relations
1238
+ user: z11.object({ id: z11.number().int() }).nullable().optional(),
1239
+ client: z11.object({ id: z11.number().int() }),
1240
+ contact: z11.object({ id: z11.number().int() }).nullable().optional(),
1241
+ order: z11.object({ id: z11.number().int() }).nullable().optional(),
1242
+ custom: z11.array(CustomFieldSchema).optional(),
1243
+ productLists: z11.array(z11.unknown()).optional(),
1244
+ // Linked entities
1245
+ ticketId: z11.number().int().optional(),
1246
+ agreementId: z11.number().int().optional()
1247
+ });
1248
+ var UpdateProjectPlanSchema = CreateProjectPlanSchema.partial().extend({
1249
+ id: z11.number().int()
1250
+ });
1251
+
1252
+ // src/socialEvent.ts
1253
+ import { z as z12 } from "zod";
1254
+ var SocialEventSchema = z12.object({
1255
+ id: z12.number().int(),
1256
+ name: z12.string(),
1257
+ internalName: z12.string(),
1258
+ location: z12.string().nullable(),
1259
+ date: z12.string(),
1260
+ endDate: z12.string(),
1261
+ draft: z12.boolean(),
1262
+ canceled: z12.boolean(),
1263
+ cancelDate: z12.string().nullable(),
1264
+ tickets: z12.number().int(),
1265
+ userEditable: z12.boolean(),
1266
+ userRemovable: z12.boolean()
1267
+ });
1268
+ var CreateSocialEventSchema = z12.object({
1269
+ name: z12.string(),
1270
+ internalName: z12.string().optional(),
1271
+ location: z12.string().nullable().optional(),
1272
+ date: z12.string(),
1273
+ endDate: z12.string(),
1274
+ draft: z12.boolean().optional(),
1275
+ tickets: z12.number().int().optional()
1276
+ });
1277
+ var UpdateSocialEventSchema = CreateSocialEventSchema.partial().extend({
1278
+ id: z12.number().int()
1279
+ });
1280
+
1281
+ // src/mail.ts
1282
+ import { z as z13 } from "zod";
1283
+ var MailRecipientSchema = z13.object({
1284
+ type: z13.enum(["contact", "user", "other"]),
1285
+ name: z13.string().optional(),
1286
+ email: z13.string(),
1287
+ id: z13.number().int().optional(),
1288
+ client: z13.object({ id: z13.number().int() }).optional(),
1289
+ title: z13.string().optional()
1290
+ });
1291
+ var MailRecipientsSchema = z13.object({
1292
+ to: z13.array(MailRecipientSchema),
1293
+ cc: z13.array(MailRecipientSchema),
1294
+ bcc: z13.array(MailRecipientSchema)
1295
+ });
1296
+ var AttachmentSchema = z13.object({
1297
+ value: z13.string(),
1298
+ filename: z13.string(),
1299
+ type: z13.string(),
1300
+ isProp: z13.boolean().optional(),
1301
+ url: z13.string().optional()
1302
+ });
1303
+ var MailEventSchema = z13.object({
1304
+ id: z13.number().int().optional(),
1305
+ value: z13.string(),
1306
+ type: z13.string(),
1307
+ date: z13.string()
1308
+ });
1309
+ var MailSchema = z13.object({
1310
+ id: z13.number().int(),
1311
+ subject: z13.string(),
1312
+ body: z13.string(),
1313
+ from: z13.string(),
1314
+ fromName: z13.string(),
1315
+ to: z13.string(),
1316
+ date: z13.string(),
1317
+ type: z13.string(),
1318
+ // Recipients
1319
+ recipients: MailRecipientsSchema.optional(),
1320
+ cc: z13.array(z13.string()),
1321
+ bcc: z13.array(z13.string()),
1322
+ // Attachments & events
1323
+ attachments: z13.array(AttachmentSchema),
1324
+ events: z13.array(MailEventSchema),
1325
+ // Relations
1326
+ client: z13.object({ id: z13.number().int(), name: z13.string(), journeyStep: z13.string().nullable().optional() }),
1327
+ contact: z13.object({ id: z13.number().int(), name: z13.string(), email: z13.string().optional() }).optional(),
1328
+ contacts: z13.array(z13.object({ id: z13.number().int(), name: z13.string(), email: z13.string().optional() })).optional(),
1329
+ users: z13.array(z13.object({ id: z13.number().int(), name: z13.string(), email: z13.string().optional() })),
1330
+ opportunity: z13.unknown().optional(),
1331
+ activity: z13.unknown().optional(),
1332
+ appointment: z13.unknown().optional(),
1333
+ project: z13.unknown().nullable(),
1334
+ // Thread
1335
+ threadId: z13.string(),
1336
+ internetMessageId: z13.string(),
1337
+ mailThreadId: z13.number().int().optional(),
1338
+ mailsInThreadCount: z13.number().int().optional(),
1339
+ thread: z13.object({ id: z13.number().int() }).optional(),
1340
+ // Tracking
1341
+ lastClickDate: z13.string().optional(),
1342
+ lastEventDate: z13.string().optional(),
1343
+ lastReadDate: z13.string().optional(),
1344
+ // Other
1345
+ groupMailId: z13.number().int(),
1346
+ jobId: z13.number().int(),
1347
+ mailBodySnapshotId: z13.number().int(),
1348
+ isMap: z13.number().int(),
1349
+ externalMailId: z13.unknown(),
1350
+ errorCause: z13.unknown(),
1351
+ modDate: z13.string(),
1352
+ email: z13.string().optional(),
1353
+ template: z13.unknown().nullable(),
1354
+ tags: z13.unknown().nullable(),
1355
+ // Computed
1356
+ userEditable: z13.boolean(),
1357
+ userRemovable: z13.unknown()
1358
+ });
1359
+ var CreateMailSchema = z13.object({
1360
+ subject: z13.string(),
1361
+ body: z13.string(),
1362
+ from: z13.string(),
1363
+ to: z13.string().optional(),
1364
+ recipients: MailRecipientsSchema.optional(),
1365
+ attachments: z13.array(AttachmentSchema).optional(),
1366
+ client: z13.object({ id: z13.number().int() }).optional(),
1367
+ contact: z13.object({ id: z13.number().int() }).optional(),
1368
+ opportunity: z13.object({ id: z13.number().int() }).nullable().optional(),
1369
+ activity: z13.object({ id: z13.number().int() }).nullable().optional(),
1370
+ appointment: z13.object({ id: z13.number().int() }).nullable().optional()
1371
+ });
1372
+ var UpdateMailSchema = CreateMailSchema.partial().extend({
1373
+ id: z13.number().int()
1374
+ });
1375
+ export {
1376
+ ActivitySchema,
1377
+ AddressSchema,
1378
+ AddressTypeSchema,
1379
+ AgreementSchema,
1380
+ AppointmentSchema,
1381
+ CategorySchema,
1382
+ ClientSchema,
1383
+ ContactSchema,
1384
+ CreateActivitySchema,
1385
+ CreateAgreementSchema,
1386
+ CreateAppointmentSchema,
1387
+ CreateClientSchema,
1388
+ CreateContactSchema,
1389
+ CreateMailSchema,
1390
+ CreateOpportunitySchema,
1391
+ CreateOrderSchema,
1392
+ CreateProductSchema,
1393
+ CreateProjectPlanSchema,
1394
+ CreateSocialEventSchema,
1395
+ CreateTicketSchema,
1396
+ CreateUserSchema,
1397
+ CustomFieldSchema,
1398
+ IdNameSchema,
1399
+ MailSchema,
1400
+ OpportunitySchema,
1401
+ OrderSchema,
1402
+ ProductSchema,
1403
+ ProjectPlanSchema,
1404
+ QuotaSchema,
1405
+ SocialEventSchema,
1406
+ TicketSchema,
1407
+ UpdateActivitySchema,
1408
+ UpdateAgreementSchema,
1409
+ UpdateAppointmentSchema,
1410
+ UpdateClientSchema,
1411
+ UpdateContactSchema,
1412
+ UpdateMailSchema,
1413
+ UpdateOpportunitySchema,
1414
+ UpdateOrderSchema,
1415
+ UpdateProductSchema,
1416
+ UpdateProjectPlanSchema,
1417
+ UpdateSocialEventSchema,
1418
+ UpdateTicketSchema,
1419
+ UpdateUserSchema,
1420
+ UserSchema
1421
+ };