@ebowwa/crm 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.
Files changed (187) hide show
  1. package/README.md +174 -0
  2. package/dist/cli/commands/activities.d.ts +11 -0
  3. package/dist/cli/commands/activities.d.ts.map +1 -0
  4. package/dist/cli/commands/activities.js +427 -0
  5. package/dist/cli/commands/activities.js.map +1 -0
  6. package/dist/cli/commands/contacts.d.ts +11 -0
  7. package/dist/cli/commands/contacts.d.ts.map +1 -0
  8. package/dist/cli/commands/contacts.js +458 -0
  9. package/dist/cli/commands/contacts.js.map +1 -0
  10. package/dist/cli/commands/deals.d.ts +11 -0
  11. package/dist/cli/commands/deals.d.ts.map +1 -0
  12. package/dist/cli/commands/deals.js +498 -0
  13. package/dist/cli/commands/deals.js.map +1 -0
  14. package/dist/cli/commands/media.d.ts +11 -0
  15. package/dist/cli/commands/media.d.ts.map +1 -0
  16. package/dist/cli/commands/media.js +417 -0
  17. package/dist/cli/commands/media.js.map +1 -0
  18. package/dist/cli/commands/search.d.ts +11 -0
  19. package/dist/cli/commands/search.d.ts.map +1 -0
  20. package/dist/cli/commands/search.js +346 -0
  21. package/dist/cli/commands/search.js.map +1 -0
  22. package/dist/cli/index.d.ts +13 -0
  23. package/dist/cli/index.d.ts.map +1 -0
  24. package/dist/cli/index.js +173 -0
  25. package/dist/cli/index.js.map +1 -0
  26. package/dist/cli/repl.d.ts +15 -0
  27. package/dist/cli/repl.d.ts.map +1 -0
  28. package/dist/cli/repl.js +318 -0
  29. package/dist/cli/repl.js.map +1 -0
  30. package/dist/cli/utils/config.d.ts +91 -0
  31. package/dist/cli/utils/config.d.ts.map +1 -0
  32. package/dist/cli/utils/config.js +212 -0
  33. package/dist/cli/utils/config.js.map +1 -0
  34. package/dist/cli/utils/output.d.ts +136 -0
  35. package/dist/cli/utils/output.d.ts.map +1 -0
  36. package/dist/cli/utils/output.js +323 -0
  37. package/dist/cli/utils/output.js.map +1 -0
  38. package/dist/cli/utils/prompt.d.ts +81 -0
  39. package/dist/cli/utils/prompt.d.ts.map +1 -0
  40. package/dist/cli/utils/prompt.js +341 -0
  41. package/dist/cli/utils/prompt.js.map +1 -0
  42. package/dist/cli.d.ts +3 -0
  43. package/dist/cli.d.ts.map +1 -0
  44. package/dist/cli.js +8 -0
  45. package/dist/cli.js.map +1 -0
  46. package/dist/core/index.d.ts +6 -0
  47. package/dist/core/index.d.ts.map +1 -0
  48. package/dist/core/index.js +32 -0
  49. package/dist/core/index.js.map +1 -0
  50. package/dist/core/schemas.d.ts +3050 -0
  51. package/dist/core/schemas.d.ts.map +1 -0
  52. package/dist/core/schemas.js +667 -0
  53. package/dist/core/schemas.js.map +1 -0
  54. package/dist/core/types.d.ts +597 -0
  55. package/dist/core/types.d.ts.map +1 -0
  56. package/dist/core/types.js +8 -0
  57. package/dist/core/types.js.map +1 -0
  58. package/dist/index.d.ts +7 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +8 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/mcp/index.d.ts +14 -0
  63. package/dist/mcp/index.d.ts.map +1 -0
  64. package/dist/mcp/index.js +11 -0
  65. package/dist/mcp/index.js.map +1 -0
  66. package/dist/mcp/server.d.ts +13 -0
  67. package/dist/mcp/server.d.ts.map +1 -0
  68. package/dist/mcp/server.js +18 -0
  69. package/dist/mcp/server.js.map +1 -0
  70. package/dist/mcp/storage/client.d.ts +109 -0
  71. package/dist/mcp/storage/client.d.ts.map +1 -0
  72. package/dist/mcp/storage/client.js +355 -0
  73. package/dist/mcp/storage/client.js.map +1 -0
  74. package/dist/mcp/storage/index.d.ts +7 -0
  75. package/dist/mcp/storage/index.d.ts.map +1 -0
  76. package/dist/mcp/storage/index.js +6 -0
  77. package/dist/mcp/storage/index.js.map +1 -0
  78. package/dist/mcp/storage/types.d.ts +44 -0
  79. package/dist/mcp/storage/types.d.ts.map +1 -0
  80. package/dist/mcp/storage/types.js +35 -0
  81. package/dist/mcp/storage/types.js.map +1 -0
  82. package/dist/mcp/tools/definitions.d.ts +16 -0
  83. package/dist/mcp/tools/definitions.d.ts.map +1 -0
  84. package/dist/mcp/tools/definitions.js +914 -0
  85. package/dist/mcp/tools/definitions.js.map +1 -0
  86. package/dist/mcp/tools/handlers.d.ts +50 -0
  87. package/dist/mcp/tools/handlers.d.ts.map +1 -0
  88. package/dist/mcp/tools/handlers.js +760 -0
  89. package/dist/mcp/tools/handlers.js.map +1 -0
  90. package/dist/mcp/tools/index.d.ts +7 -0
  91. package/dist/mcp/tools/index.d.ts.map +1 -0
  92. package/dist/mcp/tools/index.js +6 -0
  93. package/dist/mcp/tools/index.js.map +1 -0
  94. package/dist/mcp/tools/types.d.ts +314 -0
  95. package/dist/mcp/tools/types.d.ts.map +1 -0
  96. package/dist/mcp/tools/types.js +5 -0
  97. package/dist/mcp/tools/types.js.map +1 -0
  98. package/dist/mcp/transports/stdio.d.ts +27 -0
  99. package/dist/mcp/transports/stdio.d.ts.map +1 -0
  100. package/dist/mcp/transports/stdio.js +237 -0
  101. package/dist/mcp/transports/stdio.js.map +1 -0
  102. package/dist/telemetry/index.d.ts +58 -0
  103. package/dist/telemetry/index.d.ts.map +1 -0
  104. package/dist/telemetry/index.js +109 -0
  105. package/dist/telemetry/index.js.map +1 -0
  106. package/dist/telemetry/logger.d.ts +116 -0
  107. package/dist/telemetry/logger.d.ts.map +1 -0
  108. package/dist/telemetry/logger.js +256 -0
  109. package/dist/telemetry/logger.js.map +1 -0
  110. package/dist/telemetry/metrics.d.ts +115 -0
  111. package/dist/telemetry/metrics.d.ts.map +1 -0
  112. package/dist/telemetry/metrics.js +292 -0
  113. package/dist/telemetry/metrics.js.map +1 -0
  114. package/dist/telemetry/tracer.d.ts +227 -0
  115. package/dist/telemetry/tracer.d.ts.map +1 -0
  116. package/dist/telemetry/tracer.js +355 -0
  117. package/dist/telemetry/tracer.js.map +1 -0
  118. package/dist/web/app.d.ts +2 -0
  119. package/dist/web/app.d.ts.map +1 -0
  120. package/dist/web/app.js +115 -0
  121. package/dist/web/app.js.map +1 -0
  122. package/dist/web/components/ContactList.d.ts +3 -0
  123. package/dist/web/components/ContactList.d.ts.map +1 -0
  124. package/dist/web/components/ContactList.js +262 -0
  125. package/dist/web/components/ContactList.js.map +1 -0
  126. package/dist/web/components/Dashboard.d.ts +3 -0
  127. package/dist/web/components/Dashboard.d.ts.map +1 -0
  128. package/dist/web/components/Dashboard.js +158 -0
  129. package/dist/web/components/Dashboard.js.map +1 -0
  130. package/dist/web/components/DealPipeline.d.ts +3 -0
  131. package/dist/web/components/DealPipeline.d.ts.map +1 -0
  132. package/dist/web/components/DealPipeline.js +306 -0
  133. package/dist/web/components/DealPipeline.js.map +1 -0
  134. package/dist/web/index.d.ts +2 -0
  135. package/dist/web/index.d.ts.map +1 -0
  136. package/dist/web/index.js +269 -0
  137. package/dist/web/index.js.map +1 -0
  138. package/dist/web/types.d.ts +75 -0
  139. package/dist/web/types.d.ts.map +1 -0
  140. package/dist/web/types.js +3 -0
  141. package/dist/web/types.js.map +1 -0
  142. package/native/index.d.ts +571 -0
  143. package/native/index.js +687 -0
  144. package/package.json +105 -0
  145. package/src/cli/commands/activities.ts +543 -0
  146. package/src/cli/commands/contacts.ts +563 -0
  147. package/src/cli/commands/deals.ts +637 -0
  148. package/src/cli/commands/media.ts +521 -0
  149. package/src/cli/commands/search.ts +426 -0
  150. package/src/cli/index.ts +203 -0
  151. package/src/cli/repl.ts +379 -0
  152. package/src/cli/utils/config.ts +299 -0
  153. package/src/cli/utils/output.ts +386 -0
  154. package/src/cli/utils/prompt.ts +444 -0
  155. package/src/cli.ts +11 -0
  156. package/src/core/index.ts +184 -0
  157. package/src/core/schemas.ts +770 -0
  158. package/src/core/types.ts +969 -0
  159. package/src/index.ts +8 -0
  160. package/src/mcp/index.ts +17 -0
  161. package/src/mcp/server.ts +26 -0
  162. package/src/mcp/storage/client.ts +408 -0
  163. package/src/mcp/storage/index.ts +7 -0
  164. package/src/mcp/storage/types.ts +72 -0
  165. package/src/mcp/tools/definitions.ts +961 -0
  166. package/src/mcp/tools/handlers.ts +805 -0
  167. package/src/mcp/tools/index.ts +7 -0
  168. package/src/mcp/tools/types.ts +390 -0
  169. package/src/mcp/transports/stdio.ts +225 -0
  170. package/src/telemetry/index.ts +131 -0
  171. package/src/telemetry/logger.ts +318 -0
  172. package/src/telemetry/metrics.ts +393 -0
  173. package/src/telemetry/tracer.ts +487 -0
  174. package/src/web/api/activities.ts +41 -0
  175. package/src/web/api/contacts.ts +114 -0
  176. package/src/web/api/deals.ts +108 -0
  177. package/src/web/api/media.ts +98 -0
  178. package/src/web/app.tsx +143 -0
  179. package/src/web/components/ActivityFeed.tsx +195 -0
  180. package/src/web/components/ContactList.tsx +340 -0
  181. package/src/web/components/Dashboard.tsx +214 -0
  182. package/src/web/components/DealPipeline.tsx +405 -0
  183. package/src/web/components/MediaGallery.tsx +334 -0
  184. package/src/web/index.html +14 -0
  185. package/src/web/index.ts +326 -0
  186. package/src/web/styles/main.css +180 -0
  187. package/src/web/types.ts +311 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/core/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,sBAAsB;AACtB,eAAO,MAAM,UAAU,aAAoB,CAAC;AAE5C,sCAAsC;AACtC,eAAO,MAAM,eAAe,aAAwB,CAAC;AAErD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAU7D,CAAC;AAMF,eAAO,MAAM,qBAAqB,gDAA8C,CAAC;AAEjF,eAAO,MAAM,eAAe,0CAAwC,CAAC;AAErE,eAAO,MAAM,iBAAiB,6DAA2D,CAAC;AAE1F,eAAO,MAAM,oBAAoB,gFAO/B,CAAC;AAEH,eAAO,MAAM,qBAAqB,6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,eAAO,MAAM,kBAAkB,2CAAyC,CAAC;AAEzE,eAAO,MAAM,kBAAkB,6DAA2D,CAAC;AAE3F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY1B,CAAC;AAEH,eAAO,MAAM,yBAAyB,uGASpC,CAAC;AAEH,eAAO,MAAM,uBAAuB,8DAA4D,CAAC;AAEjG,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AAMH,eAAO,MAAM,wBAAwB,gKASnC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW/B,CAAC"}
@@ -0,0 +1,667 @@
1
+ /**
2
+ * Zod Validation Schemas for CRM System
3
+ *
4
+ * Provides runtime validation for all CRM types.
5
+ * Import and use schemas to validate data at boundaries.
6
+ */
7
+ import { z } from 'zod';
8
+ // ============================================================================
9
+ // Base Schemas
10
+ // ============================================================================
11
+ /** UUID validation */
12
+ export const uuidSchema = z.string().uuid();
13
+ /** Timestamp validation (ISO 8601) */
14
+ export const timestampSchema = z.string().datetime();
15
+ /** Metadata schema for flexible key-value objects */
16
+ export const metadataSchema = z.record(z.string(), z.union([
17
+ z.string(),
18
+ z.number(),
19
+ z.boolean(),
20
+ z.null(),
21
+ z.lazy(() => metadataSchema),
22
+ z.array(z.lazy(() => metadataSchema)),
23
+ ]));
24
+ // ============================================================================
25
+ // Contact Schemas
26
+ // ============================================================================
27
+ export const phoneNumberTypeSchema = z.enum(['mobile', 'home', 'work', 'other']);
28
+ export const emailTypeSchema = z.enum(['personal', 'work', 'other']);
29
+ export const addressTypeSchema = z.enum(['home', 'work', 'billing', 'shipping', 'other']);
30
+ export const socialPlatformSchema = z.enum([
31
+ 'linkedin',
32
+ 'twitter',
33
+ 'facebook',
34
+ 'instagram',
35
+ 'github',
36
+ 'other',
37
+ ]);
38
+ export const customFieldTypeSchema = z.enum(['string', 'number', 'boolean', 'date', 'select', 'multiselect']);
39
+ export const contactSourceSchema = z.enum([
40
+ 'organic',
41
+ 'referral',
42
+ 'advertisement',
43
+ 'social_media',
44
+ 'email_campaign',
45
+ 'website',
46
+ 'event',
47
+ 'cold_outreach',
48
+ 'partner',
49
+ 'other',
50
+ ]);
51
+ export const contactStatusSchema = z.enum([
52
+ 'lead',
53
+ 'prospect',
54
+ 'qualified',
55
+ 'customer',
56
+ 'churned',
57
+ 'archived',
58
+ ]);
59
+ export const phoneNumberSchema = z.object({
60
+ number: z.string().min(1).max(50),
61
+ type: phoneNumberTypeSchema,
62
+ primary: z.boolean().default(false),
63
+ });
64
+ export const emailSchema = z.object({
65
+ email: z.string().email(),
66
+ type: emailTypeSchema,
67
+ primary: z.boolean().default(false),
68
+ });
69
+ export const addressSchema = z.object({
70
+ street: z.string().min(1).max(500),
71
+ city: z.string().min(1).max(100),
72
+ state: z.string().min(1).max(100),
73
+ postalCode: z.string().min(1).max(20),
74
+ country: z.string().min(2).max(100),
75
+ type: addressTypeSchema,
76
+ });
77
+ export const socialProfileSchema = z.object({
78
+ platform: socialPlatformSchema,
79
+ handle: z.string().min(1).max(100),
80
+ url: z.string().url().optional(),
81
+ });
82
+ export const customFieldSchema = z.object({
83
+ key: z.string().min(1).max(100),
84
+ value: z.union([z.string(), z.number(), z.boolean(), z.coerce.date(), z.null()]),
85
+ type: customFieldTypeSchema,
86
+ });
87
+ export const contactSchema = z.object({
88
+ id: uuidSchema,
89
+ name: z.string().min(1).max(500),
90
+ firstName: z.string().min(1).max(100).optional(),
91
+ lastName: z.string().min(1).max(100).optional(),
92
+ emails: z.array(emailSchema).default([]),
93
+ phones: z.array(phoneNumberSchema).default([]),
94
+ addresses: z.array(addressSchema).default([]),
95
+ company: z.string().max(200).optional(),
96
+ title: z.string().max(200).optional(),
97
+ department: z.string().max(100).optional(),
98
+ socialProfiles: z.array(socialProfileSchema).default([]),
99
+ website: z.string().url().optional(),
100
+ tags: z.array(z.string().max(100)).default([]),
101
+ customFields: z.array(customFieldSchema).default([]),
102
+ source: contactSourceSchema.optional(),
103
+ status: contactStatusSchema.default('lead'),
104
+ ownerId: uuidSchema.optional(),
105
+ avatar: z.string().optional(),
106
+ preferredContact: z.enum(['email', 'phone', 'sms', 'none']).optional(),
107
+ language: z.string().max(10).optional(),
108
+ timezone: z.string().max(100).optional(),
109
+ preferences: z.string().max(2000).optional(),
110
+ leadScore: z.number().int().min(0).max(100).optional(),
111
+ doNotContact: z.boolean().default(false),
112
+ lastContactedAt: timestampSchema.optional(),
113
+ nextFollowUpAt: timestampSchema.optional(),
114
+ createdAt: timestampSchema,
115
+ updatedAt: timestampSchema,
116
+ });
117
+ // Contact creation schema (without id, timestamps)
118
+ export const createContactSchema = contactSchema.omit({
119
+ id: true,
120
+ createdAt: true,
121
+ updatedAt: true,
122
+ });
123
+ // Contact update schema (partial, with required id)
124
+ export const updateContactSchema = contactSchema.partial().required({ id: true });
125
+ // ============================================================================
126
+ // Deal Schemas
127
+ // ============================================================================
128
+ export const dealStageSchema = z.enum([
129
+ 'prospecting',
130
+ 'qualification',
131
+ 'needs_analysis',
132
+ 'proposal',
133
+ 'negotiation',
134
+ 'closed_won',
135
+ 'closed_lost',
136
+ ]);
137
+ export const dealPrioritySchema = z.enum(['low', 'medium', 'high', 'urgent']);
138
+ export const currencySchema = z.enum([
139
+ 'USD',
140
+ 'EUR',
141
+ 'GBP',
142
+ 'CAD',
143
+ 'AUD',
144
+ 'JPY',
145
+ 'CNY',
146
+ 'INR',
147
+ 'BRL',
148
+ 'MXN',
149
+ ]);
150
+ export const discountTypeSchema = z.enum(['percentage', 'fixed']);
151
+ export const dealLineItemSchema = z.object({
152
+ id: uuidSchema,
153
+ name: z.string().min(1).max(200),
154
+ description: z.string().max(1000).optional(),
155
+ quantity: z.number().int().positive(),
156
+ unitPrice: z.number().nonnegative(),
157
+ discount: z.number().nonnegative().optional(),
158
+ discountType: discountTypeSchema.optional(),
159
+ total: z.number().nonnegative(),
160
+ });
161
+ export const competitorSchema = z.object({
162
+ name: z.string().min(1).max(200),
163
+ strengths: z.array(z.string()).optional(),
164
+ weaknesses: z.array(z.string()).optional(),
165
+ notes: z.string().max(2000).optional(),
166
+ });
167
+ export const dealSchema = z.object({
168
+ id: uuidSchema,
169
+ title: z.string().min(1).max(500),
170
+ contactId: uuidSchema,
171
+ companyId: uuidSchema.optional(),
172
+ value: z.number().nonnegative(),
173
+ currency: currencySchema.default('USD'),
174
+ stage: dealStageSchema.default('prospecting'),
175
+ probability: z.number().int().min(0).max(100).default(0),
176
+ expectedClose: timestampSchema,
177
+ actualClose: timestampSchema.optional(),
178
+ priority: dealPrioritySchema.default('medium'),
179
+ lineItems: z.array(dealLineItemSchema).default([]),
180
+ discount: z.number().nonnegative().optional(),
181
+ discountType: discountTypeSchema.optional(),
182
+ totalValue: z.number().nonnegative(),
183
+ notes: z.string().max(10000).default(''),
184
+ tags: z.array(z.string().max(100)).default([]),
185
+ competitors: z.array(competitorSchema).default([]),
186
+ lossReason: z.string().max(1000).optional(),
187
+ nextSteps: z.array(z.string()).optional(),
188
+ ownerId: uuidSchema.optional(),
189
+ source: z.string().max(200).optional(),
190
+ customFields: z.array(customFieldSchema).default([]),
191
+ lastActivityAt: timestampSchema.optional(),
192
+ createdAt: timestampSchema,
193
+ updatedAt: timestampSchema,
194
+ });
195
+ export const createDealSchema = dealSchema.omit({
196
+ id: true,
197
+ createdAt: true,
198
+ updatedAt: true,
199
+ });
200
+ export const updateDealSchema = dealSchema.partial().required({ id: true });
201
+ // ============================================================================
202
+ // Activity Schemas
203
+ // ============================================================================
204
+ export const activityTypeSchema = z.enum([
205
+ 'call',
206
+ 'email',
207
+ 'meeting',
208
+ 'task',
209
+ 'note',
210
+ 'sms',
211
+ 'video_call',
212
+ 'demo',
213
+ 'proposal_sent',
214
+ 'contract_sent',
215
+ 'follow_up',
216
+ 'social_media',
217
+ 'event',
218
+ 'other',
219
+ ]);
220
+ export const callOutcomeSchema = z.enum([
221
+ 'connected',
222
+ 'voicemail',
223
+ 'no_answer',
224
+ 'busy',
225
+ 'wrong_number',
226
+ 'disconnected',
227
+ ]);
228
+ export const meetingOutcomeSchema = z.enum([
229
+ 'completed',
230
+ 'rescheduled',
231
+ 'cancelled',
232
+ 'no_show',
233
+ ]);
234
+ export const emailStatusSchema = z.enum([
235
+ 'sent',
236
+ 'delivered',
237
+ 'opened',
238
+ 'clicked',
239
+ 'replied',
240
+ 'bounced',
241
+ 'unsubscribed',
242
+ ]);
243
+ export const taskStatusSchema = z.enum([
244
+ 'pending',
245
+ 'in_progress',
246
+ 'completed',
247
+ 'cancelled',
248
+ ]);
249
+ export const taskPrioritySchema = z.enum(['low', 'medium', 'high']);
250
+ export const callDirectionSchema = z.enum(['inbound', 'outbound']);
251
+ export const callMetadataSchema = z.object({
252
+ outcome: callOutcomeSchema,
253
+ recording: z.string().optional(),
254
+ transcription: z.string().optional(),
255
+ fromNumber: z.string().max(50).optional(),
256
+ toNumber: z.string().max(50).optional(),
257
+ direction: callDirectionSchema,
258
+ });
259
+ export const meetingMetadataSchema = z.object({
260
+ outcome: meetingOutcomeSchema,
261
+ location: z.string().max(500).optional(),
262
+ meetingUrl: z.string().url().optional(),
263
+ calendarEventId: z.string().optional(),
264
+ attendees: z.array(z.string()).optional(),
265
+ recording: z.string().optional(),
266
+ notes: z.string().max(10000).optional(),
267
+ });
268
+ export const emailMetadataSchema = z.object({
269
+ status: emailStatusSchema,
270
+ subject: z.string().min(1).max(500),
271
+ from: z.string().email(),
272
+ to: z.array(z.string().email()).min(1),
273
+ cc: z.array(z.string().email()).optional(),
274
+ bcc: z.array(z.string().email()).optional(),
275
+ templateId: z.string().optional(),
276
+ trackingOpens: z.boolean().default(true),
277
+ trackingClicks: z.boolean().default(true),
278
+ });
279
+ export const checklistItemSchema = z.object({
280
+ item: z.string().min(1).max(500),
281
+ completed: z.boolean().default(false),
282
+ });
283
+ export const taskMetadataSchema = z.object({
284
+ status: taskStatusSchema,
285
+ dueDate: timestampSchema.optional(),
286
+ reminderAt: timestampSchema.optional(),
287
+ priority: taskPrioritySchema,
288
+ assigneeId: uuidSchema.optional(),
289
+ checklist: z.array(checklistItemSchema).optional(),
290
+ });
291
+ // Discriminated union for activity metadata
292
+ export const activityMetadataSchema = z.discriminatedUnion('type', [
293
+ z.object({ type: z.literal('call'), ...callMetadataSchema.shape }),
294
+ z.object({ type: z.literal('meeting'), ...meetingMetadataSchema.shape }),
295
+ z.object({ type: z.literal('email'), ...emailMetadataSchema.shape }),
296
+ z.object({ type: z.literal('task'), ...taskMetadataSchema.shape }),
297
+ ]).or(metadataSchema);
298
+ export const activitySchema = z.object({
299
+ id: uuidSchema,
300
+ contactId: uuidSchema.optional(),
301
+ dealId: uuidSchema.optional(),
302
+ type: activityTypeSchema,
303
+ title: z.string().min(1).max(500),
304
+ description: z.string().max(10000).default(''),
305
+ timestamp: timestampSchema,
306
+ duration: z.number().int().nonnegative().optional(),
307
+ metadata: metadataSchema,
308
+ createdBy: uuidSchema.optional(),
309
+ tags: z.array(z.string().max(100)).default([]),
310
+ customFields: z.array(customFieldSchema).default([]),
311
+ createdAt: timestampSchema,
312
+ updatedAt: timestampSchema,
313
+ });
314
+ export const createActivitySchema = activitySchema.omit({
315
+ id: true,
316
+ createdAt: true,
317
+ updatedAt: true,
318
+ });
319
+ export const updateActivitySchema = activitySchema.partial().required({ id: true });
320
+ // ============================================================================
321
+ // Media Schemas
322
+ // ============================================================================
323
+ export const mediaTypeSchema = z.enum([
324
+ 'image',
325
+ 'video',
326
+ 'audio',
327
+ 'document',
328
+ 'spreadsheet',
329
+ 'presentation',
330
+ 'pdf',
331
+ 'archive',
332
+ 'other',
333
+ ]);
334
+ export const mimeTypeSchema = z.string().max(200);
335
+ export const mediaEntityTypeSchema = z.enum([
336
+ 'contact',
337
+ 'deal',
338
+ 'activity',
339
+ 'note',
340
+ 'company',
341
+ ]);
342
+ export const imageMetadataSchema = z.object({
343
+ width: z.number().int().positive().optional(),
344
+ height: z.number().int().positive().optional(),
345
+ orientation: z.enum(['landscape', 'portrait', 'square']).optional(),
346
+ colorSpace: z.string().max(50).optional(),
347
+ hasAlpha: z.boolean().optional(),
348
+ });
349
+ export const videoMetadataSchema = z.object({
350
+ width: z.number().int().positive().optional(),
351
+ height: z.number().int().positive().optional(),
352
+ duration: z.number().nonnegative().optional(),
353
+ frameRate: z.number().positive().optional(),
354
+ codec: z.string().max(50).optional(),
355
+ bitrate: z.number().nonnegative().optional(),
356
+ hasAudio: z.boolean().optional(),
357
+ });
358
+ export const audioMetadataSchema = z.object({
359
+ duration: z.number().nonnegative().optional(),
360
+ sampleRate: z.number().positive().optional(),
361
+ channels: z.number().int().positive().optional(),
362
+ bitrate: z.number().nonnegative().optional(),
363
+ codec: z.string().max(50).optional(),
364
+ });
365
+ export const documentMetadataSchema = z.object({
366
+ pageCount: z.number().int().positive().optional(),
367
+ author: z.string().max(200).optional(),
368
+ title: z.string().max(500).optional(),
369
+ subject: z.string().max(500).optional(),
370
+ keywords: z.array(z.string()).optional(),
371
+ createdAt: timestampSchema.optional(),
372
+ modifiedAt: timestampSchema.optional(),
373
+ });
374
+ export const mediaSchema = z.object({
375
+ id: uuidSchema,
376
+ entityType: mediaEntityTypeSchema,
377
+ entityId: uuidSchema,
378
+ type: mediaTypeSchema,
379
+ filename: z.string().min(1).max(500),
380
+ mimeType: mimeTypeSchema,
381
+ size: z.number().int().nonnegative(),
382
+ url: z.string().min(1).max(2000),
383
+ thumbnailUrl: z.string().max(2000).optional(),
384
+ metadata: metadataSchema,
385
+ altText: z.string().max(500).optional(),
386
+ caption: z.string().max(1000).optional(),
387
+ isPublic: z.boolean().default(false),
388
+ downloadCount: z.number().int().nonnegative().default(0),
389
+ uploadedBy: uuidSchema.optional(),
390
+ expiresAt: timestampSchema.optional(),
391
+ createdAt: timestampSchema,
392
+ });
393
+ export const createMediaSchema = mediaSchema.omit({
394
+ id: true,
395
+ createdAt: true,
396
+ downloadCount: true,
397
+ });
398
+ export const updateMediaSchema = mediaSchema.partial().required({ id: true });
399
+ // ============================================================================
400
+ // Note Schemas
401
+ // ============================================================================
402
+ export const noteVisibilitySchema = z.enum(['private', 'team', 'public']);
403
+ export const noteFormatSchema = z.enum(['plain', 'markdown', 'html']);
404
+ export const noteSchema = z.object({
405
+ id: uuidSchema,
406
+ contactId: uuidSchema.optional(),
407
+ dealId: uuidSchema.optional(),
408
+ activityId: uuidSchema.optional(),
409
+ content: z.string().min(1).max(100000),
410
+ format: noteFormatSchema.default('markdown'),
411
+ title: z.string().max(500).optional(),
412
+ visibility: noteVisibilitySchema.default('team'),
413
+ createdBy: uuidSchema.optional(),
414
+ pinned: z.boolean().default(false),
415
+ tags: z.array(z.string().max(100)).default([]),
416
+ mediaIds: z.array(uuidSchema).default([]),
417
+ createdAt: timestampSchema,
418
+ updatedAt: timestampSchema,
419
+ });
420
+ export const createNoteSchema = noteSchema.omit({
421
+ id: true,
422
+ createdAt: true,
423
+ updatedAt: true,
424
+ });
425
+ export const updateNoteSchema = noteSchema.partial().required({ id: true });
426
+ // ============================================================================
427
+ // Tag Schemas
428
+ // ============================================================================
429
+ export const tagCategorySchema = z.enum([
430
+ 'general',
431
+ 'industry',
432
+ 'source',
433
+ 'status',
434
+ 'priority',
435
+ 'product',
436
+ 'region',
437
+ 'custom',
438
+ ]);
439
+ export const tagSchema = z.object({
440
+ id: uuidSchema,
441
+ name: z.string().min(1).max(100).regex(/^[a-z0-9-]+$/, 'Tag name must be lowercase alphanumeric with hyphens'),
442
+ label: z.string().min(1).max(100),
443
+ color: z.string().max(20).regex(/^#?[0-9a-fA-F]{3,6}$|^[a-zA-Z]+$/, 'Invalid color format'),
444
+ category: tagCategorySchema.default('general'),
445
+ description: z.string().max(500).optional(),
446
+ icon: z.string().max(50).optional(),
447
+ usageCount: z.number().int().nonnegative().default(0),
448
+ parentId: uuidSchema.optional(),
449
+ createdAt: timestampSchema,
450
+ updatedAt: timestampSchema,
451
+ });
452
+ export const createTagSchema = tagSchema.omit({
453
+ id: true,
454
+ usageCount: true,
455
+ createdAt: true,
456
+ updatedAt: true,
457
+ });
458
+ export const updateTagSchema = tagSchema.partial().required({ id: true });
459
+ // ============================================================================
460
+ // Company Schemas
461
+ // ============================================================================
462
+ export const companySizeSchema = z.enum([
463
+ 'sole_proprietor',
464
+ 'startup',
465
+ 'small',
466
+ 'medium',
467
+ 'large',
468
+ 'enterprise',
469
+ ]);
470
+ export const industrySchema = z.enum([
471
+ 'technology',
472
+ 'finance',
473
+ 'healthcare',
474
+ 'education',
475
+ 'retail',
476
+ 'manufacturing',
477
+ 'consulting',
478
+ 'marketing',
479
+ 'legal',
480
+ 'real_estate',
481
+ 'construction',
482
+ 'transportation',
483
+ 'hospitality',
484
+ 'energy',
485
+ 'telecommunications',
486
+ 'government',
487
+ 'non_profit',
488
+ 'other',
489
+ ]);
490
+ export const companySchema = z.object({
491
+ id: uuidSchema,
492
+ name: z.string().min(1).max(200),
493
+ website: z.string().url().optional(),
494
+ industry: industrySchema.optional(),
495
+ size: companySizeSchema.optional(),
496
+ employeeCount: z.number().int().nonnegative().optional(),
497
+ annualRevenue: z.number().nonnegative().optional(),
498
+ currency: currencySchema.optional(),
499
+ address: addressSchema.optional(),
500
+ phone: z.string().max(50).optional(),
501
+ emailDomain: z.string().max(200).optional(),
502
+ linkedInUrl: z.string().url().optional(),
503
+ tags: z.array(z.string().max(100)).default([]),
504
+ customFields: z.array(customFieldSchema).default([]),
505
+ ownerId: uuidSchema.optional(),
506
+ notes: z.string().max(10000).optional(),
507
+ createdAt: timestampSchema,
508
+ updatedAt: timestampSchema,
509
+ });
510
+ export const createCompanySchema = companySchema.omit({
511
+ id: true,
512
+ createdAt: true,
513
+ updatedAt: true,
514
+ });
515
+ export const updateCompanySchema = companySchema.partial().required({ id: true });
516
+ // ============================================================================
517
+ // Pipeline Schemas
518
+ // ============================================================================
519
+ export const pipelineStageSchema = z.object({
520
+ id: uuidSchema,
521
+ name: z.string().min(1).max(100),
522
+ order: z.number().int().nonnegative(),
523
+ probability: z.number().int().min(0).max(100),
524
+ color: z.string().max(20),
525
+ description: z.string().max(500).optional(),
526
+ });
527
+ export const pipelineSchema = z.object({
528
+ id: uuidSchema,
529
+ name: z.string().min(1).max(200),
530
+ description: z.string().max(1000).optional(),
531
+ stages: z.array(pipelineStageSchema).min(1),
532
+ isDefault: z.boolean().default(false),
533
+ createdAt: timestampSchema,
534
+ updatedAt: timestampSchema,
535
+ });
536
+ // ============================================================================
537
+ // Filter Schemas
538
+ // ============================================================================
539
+ export const sortDirectionSchema = z.enum(['asc', 'desc']);
540
+ export const paginationSchema = z.object({
541
+ page: z.number().int().positive().default(1),
542
+ limit: z.number().int().min(1).max(100).default(20),
543
+ offset: z.number().int().nonnegative().optional(),
544
+ });
545
+ export const dateRangeSchema = z.object({
546
+ start: timestampSchema,
547
+ end: timestampSchema,
548
+ }).refine((data) => new Date(data.start) <= new Date(data.end), { message: 'Start date must be before or equal to end date' });
549
+ export const contactFilterSchema = z.object({
550
+ search: z.string().max(500).optional(),
551
+ status: z.array(contactStatusSchema).optional(),
552
+ tags: z.array(z.string()).optional(),
553
+ source: z.array(contactSourceSchema).optional(),
554
+ ownerId: uuidSchema.optional(),
555
+ companyId: uuidSchema.optional(),
556
+ createdAt: dateRangeSchema.optional(),
557
+ updatedAt: dateRangeSchema.optional(),
558
+ lastContactedAt: dateRangeSchema.optional(),
559
+ nextFollowUpAt: dateRangeSchema.optional(),
560
+ hasEmail: z.boolean().optional(),
561
+ hasPhone: z.boolean().optional(),
562
+ leadScoreMin: z.number().int().min(0).max(100).optional(),
563
+ leadScoreMax: z.number().int().min(0).max(100).optional(),
564
+ doNotContact: z.boolean().optional(),
565
+ });
566
+ export const dealFilterSchema = z.object({
567
+ search: z.string().max(500).optional(),
568
+ contactId: uuidSchema.optional(),
569
+ companyId: uuidSchema.optional(),
570
+ stage: z.array(dealStageSchema).optional(),
571
+ priority: z.array(dealPrioritySchema).optional(),
572
+ ownerId: uuidSchema.optional(),
573
+ tags: z.array(z.string()).optional(),
574
+ createdAt: dateRangeSchema.optional(),
575
+ updatedAt: dateRangeSchema.optional(),
576
+ expectedClose: dateRangeSchema.optional(),
577
+ valueMin: z.number().nonnegative().optional(),
578
+ valueMax: z.number().nonnegative().optional(),
579
+ probabilityMin: z.number().int().min(0).max(100).optional(),
580
+ probabilityMax: z.number().int().min(0).max(100).optional(),
581
+ });
582
+ export const activityFilterSchema = z.object({
583
+ contactId: uuidSchema.optional(),
584
+ dealId: uuidSchema.optional(),
585
+ type: z.array(activityTypeSchema).optional(),
586
+ createdBy: uuidSchema.optional(),
587
+ timestamp: dateRangeSchema.optional(),
588
+ tags: z.array(z.string()).optional(),
589
+ });
590
+ // ============================================================================
591
+ // Paginated Response Schema
592
+ // ============================================================================
593
+ export function paginatedResponseSchema(itemSchema) {
594
+ return z.object({
595
+ data: z.array(itemSchema),
596
+ total: z.number().int().nonnegative(),
597
+ page: z.number().int().positive(),
598
+ limit: z.number().int().positive(),
599
+ totalPages: z.number().int().nonnegative(),
600
+ hasMore: z.boolean(),
601
+ });
602
+ }
603
+ // ============================================================================
604
+ // Export & Integration Schemas
605
+ // ============================================================================
606
+ export const exportFormatSchema = z.enum(['csv', 'xlsx', 'json', 'pdf']);
607
+ export const exportStatusSchema = z.enum(['pending', 'processing', 'completed', 'failed']);
608
+ export const exportJobSchema = z.object({
609
+ id: uuidSchema,
610
+ entityType: z.enum(['contacts', 'deals', 'activities', 'notes']),
611
+ format: exportFormatSchema,
612
+ status: exportStatusSchema,
613
+ filters: z.record(z.unknown()).optional(),
614
+ fields: z.array(z.string()).optional(),
615
+ downloadUrl: z.string().url().optional(),
616
+ error: z.string().optional(),
617
+ createdAt: timestampSchema,
618
+ completedAt: timestampSchema.optional(),
619
+ createdBy: uuidSchema,
620
+ });
621
+ export const integrationProviderSchema = z.enum([
622
+ 'google',
623
+ 'microsoft',
624
+ 'slack',
625
+ 'mailchimp',
626
+ 'hubspot',
627
+ 'salesforce',
628
+ 'zapier',
629
+ 'custom',
630
+ ]);
631
+ export const integrationStatusSchema = z.enum(['connected', 'disconnected', 'error', 'pending']);
632
+ export const integrationSchema = z.object({
633
+ id: uuidSchema,
634
+ provider: integrationProviderSchema,
635
+ name: z.string().min(1).max(200),
636
+ status: integrationStatusSchema,
637
+ configuredAt: timestampSchema,
638
+ lastSyncAt: timestampSchema.optional(),
639
+ settings: metadataSchema,
640
+ error: z.string().optional(),
641
+ });
642
+ // ============================================================================
643
+ // Telemetry Schemas
644
+ // ============================================================================
645
+ export const telemetryEventTypeSchema = z.enum([
646
+ 'entity_created',
647
+ 'entity_updated',
648
+ 'entity_deleted',
649
+ 'entity_viewed',
650
+ 'search_performed',
651
+ 'export_created',
652
+ 'integration_sync',
653
+ 'error_occurred',
654
+ ]);
655
+ export const telemetryEventSchema = z.object({
656
+ id: uuidSchema,
657
+ type: telemetryEventTypeSchema,
658
+ entityType: z.string().max(100).optional(),
659
+ entityId: uuidSchema.optional(),
660
+ userId: uuidSchema.optional(),
661
+ timestamp: timestampSchema,
662
+ properties: metadataSchema,
663
+ duration: z.number().nonnegative().optional(),
664
+ success: z.boolean(),
665
+ errorMessage: z.string().optional(),
666
+ });
667
+ //# sourceMappingURL=schemas.js.map