@voyantjs/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 (60) hide show
  1. package/LICENSE +109 -0
  2. package/README.md +47 -0
  3. package/dist/booking-extension.d.ts +123 -0
  4. package/dist/booking-extension.d.ts.map +1 -0
  5. package/dist/booking-extension.js +86 -0
  6. package/dist/index.d.ts +14 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +29 -0
  9. package/dist/routes/accounts.d.ts +1203 -0
  10. package/dist/routes/accounts.d.ts.map +1 -0
  11. package/dist/routes/accounts.js +226 -0
  12. package/dist/routes/activities.d.ts +299 -0
  13. package/dist/routes/activities.d.ts.map +1 -0
  14. package/dist/routes/activities.js +61 -0
  15. package/dist/routes/custom-fields.d.ts +256 -0
  16. package/dist/routes/custom-fields.d.ts.map +1 -0
  17. package/dist/routes/custom-fields.js +46 -0
  18. package/dist/routes/index.d.ts +2671 -0
  19. package/dist/routes/index.d.ts.map +1 -0
  20. package/dist/routes/index.js +14 -0
  21. package/dist/routes/opportunities.d.ts +387 -0
  22. package/dist/routes/opportunities.d.ts.map +1 -0
  23. package/dist/routes/opportunities.js +69 -0
  24. package/dist/routes/pipelines.d.ts +292 -0
  25. package/dist/routes/pipelines.d.ts.map +1 -0
  26. package/dist/routes/pipelines.js +58 -0
  27. package/dist/routes/quotes.d.ts +283 -0
  28. package/dist/routes/quotes.d.ts.map +1 -0
  29. package/dist/routes/quotes.js +51 -0
  30. package/dist/schema.d.ts +3478 -0
  31. package/dist/schema.d.ts.map +1 -0
  32. package/dist/schema.js +515 -0
  33. package/dist/service/accounts.d.ts +982 -0
  34. package/dist/service/accounts.d.ts.map +1 -0
  35. package/dist/service/accounts.js +509 -0
  36. package/dist/service/activities.d.ts +486 -0
  37. package/dist/service/activities.d.ts.map +1 -0
  38. package/dist/service/activities.js +114 -0
  39. package/dist/service/custom-fields.d.ts +118 -0
  40. package/dist/service/custom-fields.d.ts.map +1 -0
  41. package/dist/service/custom-fields.js +88 -0
  42. package/dist/service/helpers.d.ts +22 -0
  43. package/dist/service/helpers.d.ts.map +1 -0
  44. package/dist/service/helpers.js +39 -0
  45. package/dist/service/index.d.ts +3329 -0
  46. package/dist/service/index.d.ts.map +1 -0
  47. package/dist/service/index.js +14 -0
  48. package/dist/service/opportunities.d.ts +822 -0
  49. package/dist/service/opportunities.d.ts.map +1 -0
  50. package/dist/service/opportunities.js +117 -0
  51. package/dist/service/pipelines.d.ts +113 -0
  52. package/dist/service/pipelines.d.ts.map +1 -0
  53. package/dist/service/pipelines.js +68 -0
  54. package/dist/service/quotes.d.ts +494 -0
  55. package/dist/service/quotes.d.ts.map +1 -0
  56. package/dist/service/quotes.js +69 -0
  57. package/dist/validation.d.ts +860 -0
  58. package/dist/validation.d.ts.map +1 -0
  59. package/dist/validation.js +315 -0
  60. package/package.json +56 -0
@@ -0,0 +1,982 @@
1
+ import type { insertAddressSchema, insertContactPointSchema, updateAddressSchema, updateContactPointSchema } from "@voyantjs/identity/validation";
2
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
+ import type { z } from "zod";
4
+ import type { communicationListQuerySchema, insertCommunicationLogSchema, insertOrganizationNoteSchema, insertOrganizationSchema, insertPersonNoteSchema, insertPersonSchema, insertSegmentSchema, organizationListQuerySchema, personListQuerySchema, updateOrganizationSchema, updatePersonSchema } from "../validation.js";
5
+ type OrganizationListQuery = z.infer<typeof organizationListQuerySchema>;
6
+ type CreateOrganizationInput = z.infer<typeof insertOrganizationSchema>;
7
+ type UpdateOrganizationInput = z.infer<typeof updateOrganizationSchema>;
8
+ type PersonListQuery = z.infer<typeof personListQuerySchema>;
9
+ type CreatePersonInput = z.infer<typeof insertPersonSchema>;
10
+ type UpdatePersonInput = z.infer<typeof updatePersonSchema>;
11
+ type CreateContactPointInput = z.infer<typeof insertContactPointSchema>;
12
+ type UpdateContactPointInput = z.infer<typeof updateContactPointSchema>;
13
+ type CreateAddressInput = z.infer<typeof insertAddressSchema>;
14
+ type UpdateAddressInput = z.infer<typeof updateAddressSchema>;
15
+ type CreatePersonNoteInput = z.infer<typeof insertPersonNoteSchema>;
16
+ type CreateOrganizationNoteInput = z.infer<typeof insertOrganizationNoteSchema>;
17
+ type CreateCommunicationLogInput = z.infer<typeof insertCommunicationLogSchema>;
18
+ type CommunicationListQuery = z.infer<typeof communicationListQuerySchema>;
19
+ type CreateSegmentInput = z.infer<typeof insertSegmentSchema>;
20
+ type PersonHydratedFields = {
21
+ email: string | null;
22
+ phone: string | null;
23
+ website: string | null;
24
+ address: string | null;
25
+ city: string | null;
26
+ country: string | null;
27
+ };
28
+ export declare const accountsService: {
29
+ listOrganizations(db: PostgresJsDatabase, query: OrganizationListQuery): Promise<{
30
+ data: {
31
+ id: string;
32
+ name: string;
33
+ legalName: string | null;
34
+ website: string | null;
35
+ industry: string | null;
36
+ relation: "partner" | "supplier" | "other" | "client" | null;
37
+ ownerId: string | null;
38
+ defaultCurrency: string | null;
39
+ preferredLanguage: string | null;
40
+ paymentTerms: number | null;
41
+ status: "active" | "inactive" | "archived";
42
+ source: string | null;
43
+ sourceRef: string | null;
44
+ tags: string[];
45
+ notes: string | null;
46
+ createdAt: Date;
47
+ updatedAt: Date;
48
+ archivedAt: Date | null;
49
+ }[];
50
+ total: number;
51
+ limit: number;
52
+ offset: number;
53
+ }>;
54
+ getOrganizationById(db: PostgresJsDatabase, id: string): Promise<{
55
+ id: string;
56
+ name: string;
57
+ legalName: string | null;
58
+ website: string | null;
59
+ industry: string | null;
60
+ relation: "partner" | "supplier" | "other" | "client" | null;
61
+ ownerId: string | null;
62
+ defaultCurrency: string | null;
63
+ preferredLanguage: string | null;
64
+ paymentTerms: number | null;
65
+ status: "active" | "inactive" | "archived";
66
+ source: string | null;
67
+ sourceRef: string | null;
68
+ tags: string[];
69
+ notes: string | null;
70
+ createdAt: Date;
71
+ updatedAt: Date;
72
+ archivedAt: Date | null;
73
+ } | null>;
74
+ createOrganization(db: PostgresJsDatabase, data: CreateOrganizationInput): Promise<{
75
+ relation: "partner" | "supplier" | "other" | "client" | null;
76
+ name: string;
77
+ createdAt: Date;
78
+ updatedAt: Date;
79
+ website: string | null;
80
+ notes: string | null;
81
+ id: string;
82
+ legalName: string | null;
83
+ industry: string | null;
84
+ ownerId: string | null;
85
+ defaultCurrency: string | null;
86
+ preferredLanguage: string | null;
87
+ paymentTerms: number | null;
88
+ status: "active" | "inactive" | "archived";
89
+ source: string | null;
90
+ sourceRef: string | null;
91
+ tags: string[];
92
+ archivedAt: Date | null;
93
+ } | undefined>;
94
+ updateOrganization(db: PostgresJsDatabase, id: string, data: UpdateOrganizationInput): Promise<{
95
+ id: string;
96
+ name: string;
97
+ legalName: string | null;
98
+ website: string | null;
99
+ industry: string | null;
100
+ relation: "partner" | "supplier" | "other" | "client" | null;
101
+ ownerId: string | null;
102
+ defaultCurrency: string | null;
103
+ preferredLanguage: string | null;
104
+ paymentTerms: number | null;
105
+ status: "active" | "inactive" | "archived";
106
+ source: string | null;
107
+ sourceRef: string | null;
108
+ tags: string[];
109
+ notes: string | null;
110
+ createdAt: Date;
111
+ updatedAt: Date;
112
+ archivedAt: Date | null;
113
+ } | null>;
114
+ deleteOrganization(db: PostgresJsDatabase, id: string): Promise<{
115
+ id: string;
116
+ } | null>;
117
+ listPeople(db: PostgresJsDatabase, query: PersonListQuery): Promise<{
118
+ data: ({
119
+ id: string;
120
+ organizationId: string | null;
121
+ firstName: string;
122
+ lastName: string;
123
+ jobTitle: string | null;
124
+ relation: "partner" | "supplier" | "other" | "client" | null;
125
+ preferredLanguage: string | null;
126
+ preferredCurrency: string | null;
127
+ ownerId: string | null;
128
+ status: "active" | "inactive" | "archived";
129
+ source: string | null;
130
+ sourceRef: string | null;
131
+ tags: string[];
132
+ birthday: string | null;
133
+ notes: string | null;
134
+ createdAt: Date;
135
+ updatedAt: Date;
136
+ archivedAt: Date | null;
137
+ } & PersonHydratedFields)[];
138
+ total: number;
139
+ limit: number;
140
+ offset: number;
141
+ }>;
142
+ getPersonById(db: PostgresJsDatabase, id: string): Promise<({
143
+ id: string;
144
+ organizationId: string | null;
145
+ firstName: string;
146
+ lastName: string;
147
+ jobTitle: string | null;
148
+ relation: "partner" | "supplier" | "other" | "client" | null;
149
+ preferredLanguage: string | null;
150
+ preferredCurrency: string | null;
151
+ ownerId: string | null;
152
+ status: "active" | "inactive" | "archived";
153
+ source: string | null;
154
+ sourceRef: string | null;
155
+ tags: string[];
156
+ birthday: string | null;
157
+ notes: string | null;
158
+ createdAt: Date;
159
+ updatedAt: Date;
160
+ archivedAt: Date | null;
161
+ } & PersonHydratedFields) | null>;
162
+ createPerson(db: PostgresJsDatabase, data: CreatePersonInput): Promise<({
163
+ id: string;
164
+ organizationId: string | null;
165
+ firstName: string;
166
+ lastName: string;
167
+ jobTitle: string | null;
168
+ relation: "partner" | "supplier" | "other" | "client" | null;
169
+ preferredLanguage: string | null;
170
+ preferredCurrency: string | null;
171
+ ownerId: string | null;
172
+ status: "active" | "inactive" | "archived";
173
+ source: string | null;
174
+ sourceRef: string | null;
175
+ tags: string[];
176
+ birthday: string | null;
177
+ notes: string | null;
178
+ createdAt: Date;
179
+ updatedAt: Date;
180
+ archivedAt: Date | null;
181
+ } & PersonHydratedFields) | null>;
182
+ updatePerson(db: PostgresJsDatabase, id: string, data: UpdatePersonInput): Promise<({
183
+ id: string;
184
+ organizationId: string | null;
185
+ firstName: string;
186
+ lastName: string;
187
+ jobTitle: string | null;
188
+ relation: "partner" | "supplier" | "other" | "client" | null;
189
+ preferredLanguage: string | null;
190
+ preferredCurrency: string | null;
191
+ ownerId: string | null;
192
+ status: "active" | "inactive" | "archived";
193
+ source: string | null;
194
+ sourceRef: string | null;
195
+ tags: string[];
196
+ birthday: string | null;
197
+ notes: string | null;
198
+ createdAt: Date;
199
+ updatedAt: Date;
200
+ archivedAt: Date | null;
201
+ } & PersonHydratedFields) | null>;
202
+ deletePerson(db: PostgresJsDatabase, id: string): Promise<{
203
+ id: string;
204
+ } | null>;
205
+ listContactMethods(db: PostgresJsDatabase, entityType: "organization" | "person", entityId: string): Promise<{
206
+ id: string;
207
+ entityType: string;
208
+ entityId: string;
209
+ kind: "email" | "phone" | "mobile" | "whatsapp" | "website" | "sms" | "fax" | "social" | "other";
210
+ label: string | null;
211
+ value: string;
212
+ normalizedValue: string | null;
213
+ isPrimary: boolean;
214
+ notes: string | null;
215
+ metadata: Record<string, unknown> | null;
216
+ createdAt: Date;
217
+ updatedAt: Date;
218
+ }[]>;
219
+ createContactMethod(db: PostgresJsDatabase, entityType: "organization" | "person", entityId: string, data: CreateContactPointInput): Promise<{
220
+ value: string;
221
+ createdAt: Date;
222
+ updatedAt: Date;
223
+ kind: "email" | "phone" | "mobile" | "whatsapp" | "website" | "sms" | "fax" | "social" | "other";
224
+ entityType: string;
225
+ entityId: string;
226
+ label: string | null;
227
+ normalizedValue: string | null;
228
+ isPrimary: boolean;
229
+ notes: string | null;
230
+ metadata: Record<string, unknown> | null;
231
+ id: string;
232
+ } | null>;
233
+ updateContactMethod(db: PostgresJsDatabase, id: string, data: UpdateContactPointInput): Promise<{
234
+ id: string;
235
+ entityType: string;
236
+ entityId: string;
237
+ kind: "email" | "phone" | "mobile" | "whatsapp" | "website" | "sms" | "fax" | "social" | "other";
238
+ label: string | null;
239
+ value: string;
240
+ normalizedValue: string | null;
241
+ isPrimary: boolean;
242
+ notes: string | null;
243
+ metadata: Record<string, unknown> | null;
244
+ createdAt: Date;
245
+ updatedAt: Date;
246
+ } | null>;
247
+ deleteContactMethod(db: PostgresJsDatabase, id: string): Promise<{
248
+ id: string;
249
+ } | null>;
250
+ listAddresses(db: PostgresJsDatabase, entityType: "organization" | "person", entityId: string): Promise<{
251
+ id: string;
252
+ entityType: string;
253
+ entityId: string;
254
+ label: "primary" | "other" | "billing" | "shipping" | "mailing" | "meeting" | "service" | "legal";
255
+ fullText: string | null;
256
+ line1: string | null;
257
+ line2: string | null;
258
+ city: string | null;
259
+ region: string | null;
260
+ postalCode: string | null;
261
+ country: string | null;
262
+ latitude: number | null;
263
+ longitude: number | null;
264
+ timezone: string | null;
265
+ isPrimary: boolean;
266
+ notes: string | null;
267
+ metadata: Record<string, unknown> | null;
268
+ createdAt: Date;
269
+ updatedAt: Date;
270
+ }[]>;
271
+ createAddress(db: PostgresJsDatabase, entityType: "organization" | "person", entityId: string, data: CreateAddressInput): Promise<{
272
+ createdAt: Date;
273
+ updatedAt: Date;
274
+ entityType: string;
275
+ entityId: string;
276
+ label: "primary" | "other" | "billing" | "shipping" | "mailing" | "meeting" | "service" | "legal";
277
+ isPrimary: boolean;
278
+ notes: string | null;
279
+ metadata: Record<string, unknown> | null;
280
+ fullText: string | null;
281
+ line1: string | null;
282
+ line2: string | null;
283
+ city: string | null;
284
+ region: string | null;
285
+ postalCode: string | null;
286
+ country: string | null;
287
+ latitude: number | null;
288
+ longitude: number | null;
289
+ timezone: string | null;
290
+ id: string;
291
+ } | null>;
292
+ updateAddress(db: PostgresJsDatabase, id: string, data: UpdateAddressInput): Promise<{
293
+ id: string;
294
+ entityType: string;
295
+ entityId: string;
296
+ label: "primary" | "other" | "billing" | "shipping" | "mailing" | "meeting" | "service" | "legal";
297
+ fullText: string | null;
298
+ line1: string | null;
299
+ line2: string | null;
300
+ city: string | null;
301
+ region: string | null;
302
+ postalCode: string | null;
303
+ country: string | null;
304
+ latitude: number | null;
305
+ longitude: number | null;
306
+ timezone: string | null;
307
+ isPrimary: boolean;
308
+ notes: string | null;
309
+ metadata: Record<string, unknown> | null;
310
+ createdAt: Date;
311
+ updatedAt: Date;
312
+ } | null>;
313
+ deleteAddress(db: PostgresJsDatabase, id: string): Promise<{
314
+ id: string;
315
+ } | null>;
316
+ listPersonNotes(db: PostgresJsDatabase, personId: string): Omit<import("drizzle-orm/pg-core").PgSelectBase<"person_notes", {
317
+ id: import("drizzle-orm/pg-core").PgColumn<{
318
+ name: string;
319
+ tableName: "person_notes";
320
+ dataType: "string";
321
+ columnType: "PgText";
322
+ data: string;
323
+ driverParam: string;
324
+ notNull: true;
325
+ hasDefault: true;
326
+ isPrimaryKey: true;
327
+ isAutoincrement: false;
328
+ hasRuntimeDefault: true;
329
+ enumValues: [string, ...string[]];
330
+ baseColumn: never;
331
+ identity: undefined;
332
+ generated: undefined;
333
+ }, {}, {}>;
334
+ personId: import("drizzle-orm/pg-core").PgColumn<{
335
+ name: string;
336
+ tableName: "person_notes";
337
+ dataType: "string";
338
+ columnType: "PgText";
339
+ data: string;
340
+ driverParam: string;
341
+ notNull: true;
342
+ hasDefault: false;
343
+ isPrimaryKey: false;
344
+ isAutoincrement: false;
345
+ hasRuntimeDefault: false;
346
+ enumValues: [string, ...string[]];
347
+ baseColumn: never;
348
+ identity: undefined;
349
+ generated: undefined;
350
+ }, {}, {}>;
351
+ authorId: import("drizzle-orm/pg-core").PgColumn<{
352
+ name: "author_id";
353
+ tableName: "person_notes";
354
+ dataType: "string";
355
+ columnType: "PgText";
356
+ data: string;
357
+ driverParam: string;
358
+ notNull: true;
359
+ hasDefault: false;
360
+ isPrimaryKey: false;
361
+ isAutoincrement: false;
362
+ hasRuntimeDefault: false;
363
+ enumValues: [string, ...string[]];
364
+ baseColumn: never;
365
+ identity: undefined;
366
+ generated: undefined;
367
+ }, {}, {}>;
368
+ content: import("drizzle-orm/pg-core").PgColumn<{
369
+ name: "content";
370
+ tableName: "person_notes";
371
+ dataType: "string";
372
+ columnType: "PgText";
373
+ data: string;
374
+ driverParam: string;
375
+ notNull: true;
376
+ hasDefault: false;
377
+ isPrimaryKey: false;
378
+ isAutoincrement: false;
379
+ hasRuntimeDefault: false;
380
+ enumValues: [string, ...string[]];
381
+ baseColumn: never;
382
+ identity: undefined;
383
+ generated: undefined;
384
+ }, {}, {}>;
385
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
386
+ name: "created_at";
387
+ tableName: "person_notes";
388
+ dataType: "date";
389
+ columnType: "PgTimestamp";
390
+ data: Date;
391
+ driverParam: string;
392
+ notNull: true;
393
+ hasDefault: true;
394
+ isPrimaryKey: false;
395
+ isAutoincrement: false;
396
+ hasRuntimeDefault: false;
397
+ enumValues: undefined;
398
+ baseColumn: never;
399
+ identity: undefined;
400
+ generated: undefined;
401
+ }, {}, {}>;
402
+ }, "single", Record<"person_notes", "not-null">, false, "where" | "orderBy", {
403
+ id: string;
404
+ personId: string;
405
+ authorId: string;
406
+ content: string;
407
+ createdAt: Date;
408
+ }[], {
409
+ id: import("drizzle-orm/pg-core").PgColumn<{
410
+ name: string;
411
+ tableName: "person_notes";
412
+ dataType: "string";
413
+ columnType: "PgText";
414
+ data: string;
415
+ driverParam: string;
416
+ notNull: true;
417
+ hasDefault: true;
418
+ isPrimaryKey: true;
419
+ isAutoincrement: false;
420
+ hasRuntimeDefault: true;
421
+ enumValues: [string, ...string[]];
422
+ baseColumn: never;
423
+ identity: undefined;
424
+ generated: undefined;
425
+ }, {}, {}>;
426
+ personId: import("drizzle-orm/pg-core").PgColumn<{
427
+ name: string;
428
+ tableName: "person_notes";
429
+ dataType: "string";
430
+ columnType: "PgText";
431
+ data: string;
432
+ driverParam: string;
433
+ notNull: true;
434
+ hasDefault: false;
435
+ isPrimaryKey: false;
436
+ isAutoincrement: false;
437
+ hasRuntimeDefault: false;
438
+ enumValues: [string, ...string[]];
439
+ baseColumn: never;
440
+ identity: undefined;
441
+ generated: undefined;
442
+ }, {}, {}>;
443
+ authorId: import("drizzle-orm/pg-core").PgColumn<{
444
+ name: "author_id";
445
+ tableName: "person_notes";
446
+ dataType: "string";
447
+ columnType: "PgText";
448
+ data: string;
449
+ driverParam: string;
450
+ notNull: true;
451
+ hasDefault: false;
452
+ isPrimaryKey: false;
453
+ isAutoincrement: false;
454
+ hasRuntimeDefault: false;
455
+ enumValues: [string, ...string[]];
456
+ baseColumn: never;
457
+ identity: undefined;
458
+ generated: undefined;
459
+ }, {}, {}>;
460
+ content: import("drizzle-orm/pg-core").PgColumn<{
461
+ name: "content";
462
+ tableName: "person_notes";
463
+ dataType: "string";
464
+ columnType: "PgText";
465
+ data: string;
466
+ driverParam: string;
467
+ notNull: true;
468
+ hasDefault: false;
469
+ isPrimaryKey: false;
470
+ isAutoincrement: false;
471
+ hasRuntimeDefault: false;
472
+ enumValues: [string, ...string[]];
473
+ baseColumn: never;
474
+ identity: undefined;
475
+ generated: undefined;
476
+ }, {}, {}>;
477
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
478
+ name: "created_at";
479
+ tableName: "person_notes";
480
+ dataType: "date";
481
+ columnType: "PgTimestamp";
482
+ data: Date;
483
+ driverParam: string;
484
+ notNull: true;
485
+ hasDefault: true;
486
+ isPrimaryKey: false;
487
+ isAutoincrement: false;
488
+ hasRuntimeDefault: false;
489
+ enumValues: undefined;
490
+ baseColumn: never;
491
+ identity: undefined;
492
+ generated: undefined;
493
+ }, {}, {}>;
494
+ }>, "where" | "orderBy">;
495
+ createPersonNote(db: PostgresJsDatabase, personId: string, userId: string, data: CreatePersonNoteInput): Promise<{
496
+ createdAt: Date;
497
+ id: string;
498
+ personId: string;
499
+ authorId: string;
500
+ content: string;
501
+ } | null | undefined>;
502
+ listOrganizationNotes(db: PostgresJsDatabase, organizationId: string): Omit<import("drizzle-orm/pg-core").PgSelectBase<"organization_notes", {
503
+ id: import("drizzle-orm/pg-core").PgColumn<{
504
+ name: string;
505
+ tableName: "organization_notes";
506
+ dataType: "string";
507
+ columnType: "PgText";
508
+ data: string;
509
+ driverParam: string;
510
+ notNull: true;
511
+ hasDefault: true;
512
+ isPrimaryKey: true;
513
+ isAutoincrement: false;
514
+ hasRuntimeDefault: true;
515
+ enumValues: [string, ...string[]];
516
+ baseColumn: never;
517
+ identity: undefined;
518
+ generated: undefined;
519
+ }, {}, {}>;
520
+ organizationId: import("drizzle-orm/pg-core").PgColumn<{
521
+ name: string;
522
+ tableName: "organization_notes";
523
+ dataType: "string";
524
+ columnType: "PgText";
525
+ data: string;
526
+ driverParam: string;
527
+ notNull: true;
528
+ hasDefault: false;
529
+ isPrimaryKey: false;
530
+ isAutoincrement: false;
531
+ hasRuntimeDefault: false;
532
+ enumValues: [string, ...string[]];
533
+ baseColumn: never;
534
+ identity: undefined;
535
+ generated: undefined;
536
+ }, {}, {}>;
537
+ authorId: import("drizzle-orm/pg-core").PgColumn<{
538
+ name: "author_id";
539
+ tableName: "organization_notes";
540
+ dataType: "string";
541
+ columnType: "PgText";
542
+ data: string;
543
+ driverParam: string;
544
+ notNull: true;
545
+ hasDefault: false;
546
+ isPrimaryKey: false;
547
+ isAutoincrement: false;
548
+ hasRuntimeDefault: false;
549
+ enumValues: [string, ...string[]];
550
+ baseColumn: never;
551
+ identity: undefined;
552
+ generated: undefined;
553
+ }, {}, {}>;
554
+ content: import("drizzle-orm/pg-core").PgColumn<{
555
+ name: "content";
556
+ tableName: "organization_notes";
557
+ dataType: "string";
558
+ columnType: "PgText";
559
+ data: string;
560
+ driverParam: string;
561
+ notNull: true;
562
+ hasDefault: false;
563
+ isPrimaryKey: false;
564
+ isAutoincrement: false;
565
+ hasRuntimeDefault: false;
566
+ enumValues: [string, ...string[]];
567
+ baseColumn: never;
568
+ identity: undefined;
569
+ generated: undefined;
570
+ }, {}, {}>;
571
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
572
+ name: "created_at";
573
+ tableName: "organization_notes";
574
+ dataType: "date";
575
+ columnType: "PgTimestamp";
576
+ data: Date;
577
+ driverParam: string;
578
+ notNull: true;
579
+ hasDefault: true;
580
+ isPrimaryKey: false;
581
+ isAutoincrement: false;
582
+ hasRuntimeDefault: false;
583
+ enumValues: undefined;
584
+ baseColumn: never;
585
+ identity: undefined;
586
+ generated: undefined;
587
+ }, {}, {}>;
588
+ }, "single", Record<"organization_notes", "not-null">, false, "where" | "orderBy", {
589
+ id: string;
590
+ organizationId: string;
591
+ authorId: string;
592
+ content: string;
593
+ createdAt: Date;
594
+ }[], {
595
+ id: import("drizzle-orm/pg-core").PgColumn<{
596
+ name: string;
597
+ tableName: "organization_notes";
598
+ dataType: "string";
599
+ columnType: "PgText";
600
+ data: string;
601
+ driverParam: string;
602
+ notNull: true;
603
+ hasDefault: true;
604
+ isPrimaryKey: true;
605
+ isAutoincrement: false;
606
+ hasRuntimeDefault: true;
607
+ enumValues: [string, ...string[]];
608
+ baseColumn: never;
609
+ identity: undefined;
610
+ generated: undefined;
611
+ }, {}, {}>;
612
+ organizationId: import("drizzle-orm/pg-core").PgColumn<{
613
+ name: string;
614
+ tableName: "organization_notes";
615
+ dataType: "string";
616
+ columnType: "PgText";
617
+ data: string;
618
+ driverParam: string;
619
+ notNull: true;
620
+ hasDefault: false;
621
+ isPrimaryKey: false;
622
+ isAutoincrement: false;
623
+ hasRuntimeDefault: false;
624
+ enumValues: [string, ...string[]];
625
+ baseColumn: never;
626
+ identity: undefined;
627
+ generated: undefined;
628
+ }, {}, {}>;
629
+ authorId: import("drizzle-orm/pg-core").PgColumn<{
630
+ name: "author_id";
631
+ tableName: "organization_notes";
632
+ dataType: "string";
633
+ columnType: "PgText";
634
+ data: string;
635
+ driverParam: string;
636
+ notNull: true;
637
+ hasDefault: false;
638
+ isPrimaryKey: false;
639
+ isAutoincrement: false;
640
+ hasRuntimeDefault: false;
641
+ enumValues: [string, ...string[]];
642
+ baseColumn: never;
643
+ identity: undefined;
644
+ generated: undefined;
645
+ }, {}, {}>;
646
+ content: import("drizzle-orm/pg-core").PgColumn<{
647
+ name: "content";
648
+ tableName: "organization_notes";
649
+ dataType: "string";
650
+ columnType: "PgText";
651
+ data: string;
652
+ driverParam: string;
653
+ notNull: true;
654
+ hasDefault: false;
655
+ isPrimaryKey: false;
656
+ isAutoincrement: false;
657
+ hasRuntimeDefault: false;
658
+ enumValues: [string, ...string[]];
659
+ baseColumn: never;
660
+ identity: undefined;
661
+ generated: undefined;
662
+ }, {}, {}>;
663
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
664
+ name: "created_at";
665
+ tableName: "organization_notes";
666
+ dataType: "date";
667
+ columnType: "PgTimestamp";
668
+ data: Date;
669
+ driverParam: string;
670
+ notNull: true;
671
+ hasDefault: true;
672
+ isPrimaryKey: false;
673
+ isAutoincrement: false;
674
+ hasRuntimeDefault: false;
675
+ enumValues: undefined;
676
+ baseColumn: never;
677
+ identity: undefined;
678
+ generated: undefined;
679
+ }, {}, {}>;
680
+ }>, "where" | "orderBy">;
681
+ createOrganizationNote(db: PostgresJsDatabase, organizationId: string, userId: string, data: CreateOrganizationNoteInput): Promise<{
682
+ createdAt: Date;
683
+ id: string;
684
+ organizationId: string;
685
+ authorId: string;
686
+ content: string;
687
+ } | null | undefined>;
688
+ updatePersonNote(db: PostgresJsDatabase, id: string, content: string): Promise<{
689
+ id: string;
690
+ personId: string;
691
+ authorId: string;
692
+ content: string;
693
+ createdAt: Date;
694
+ } | null>;
695
+ deletePersonNote(db: PostgresJsDatabase, id: string): Promise<{
696
+ createdAt: Date;
697
+ id: string;
698
+ personId: string;
699
+ authorId: string;
700
+ content: string;
701
+ } | null>;
702
+ updateOrganizationNote(db: PostgresJsDatabase, id: string, content: string): Promise<{
703
+ id: string;
704
+ organizationId: string;
705
+ authorId: string;
706
+ content: string;
707
+ createdAt: Date;
708
+ } | null>;
709
+ deleteOrganizationNote(db: PostgresJsDatabase, id: string): Promise<{
710
+ createdAt: Date;
711
+ id: string;
712
+ organizationId: string;
713
+ authorId: string;
714
+ content: string;
715
+ } | null>;
716
+ listCommunications(db: PostgresJsDatabase, personId: string, query: CommunicationListQuery): Promise<{
717
+ id: string;
718
+ personId: string;
719
+ organizationId: string | null;
720
+ channel: "email" | "phone" | "whatsapp" | "sms" | "other" | "meeting";
721
+ direction: "inbound" | "outbound";
722
+ subject: string | null;
723
+ content: string | null;
724
+ sentAt: Date | null;
725
+ createdAt: Date;
726
+ }[]>;
727
+ createCommunication(db: PostgresJsDatabase, personId: string, data: CreateCommunicationLogInput): Promise<{
728
+ createdAt: Date;
729
+ id: string;
730
+ organizationId: string | null;
731
+ personId: string;
732
+ subject: string | null;
733
+ content: string | null;
734
+ channel: "email" | "phone" | "whatsapp" | "sms" | "other" | "meeting";
735
+ direction: "inbound" | "outbound";
736
+ sentAt: Date | null;
737
+ } | null | undefined>;
738
+ listSegments(db: PostgresJsDatabase): Omit<import("drizzle-orm/pg-core").PgSelectBase<"segments", {
739
+ id: import("drizzle-orm/pg-core").PgColumn<{
740
+ name: string;
741
+ tableName: "segments";
742
+ dataType: "string";
743
+ columnType: "PgText";
744
+ data: string;
745
+ driverParam: string;
746
+ notNull: true;
747
+ hasDefault: true;
748
+ isPrimaryKey: true;
749
+ isAutoincrement: false;
750
+ hasRuntimeDefault: true;
751
+ enumValues: [string, ...string[]];
752
+ baseColumn: never;
753
+ identity: undefined;
754
+ generated: undefined;
755
+ }, {}, {}>;
756
+ name: import("drizzle-orm/pg-core").PgColumn<{
757
+ name: "name";
758
+ tableName: "segments";
759
+ dataType: "string";
760
+ columnType: "PgText";
761
+ data: string;
762
+ driverParam: string;
763
+ notNull: true;
764
+ hasDefault: false;
765
+ isPrimaryKey: false;
766
+ isAutoincrement: false;
767
+ hasRuntimeDefault: false;
768
+ enumValues: [string, ...string[]];
769
+ baseColumn: never;
770
+ identity: undefined;
771
+ generated: undefined;
772
+ }, {}, {}>;
773
+ description: import("drizzle-orm/pg-core").PgColumn<{
774
+ name: "description";
775
+ tableName: "segments";
776
+ dataType: "string";
777
+ columnType: "PgText";
778
+ data: string;
779
+ driverParam: string;
780
+ notNull: false;
781
+ hasDefault: false;
782
+ isPrimaryKey: false;
783
+ isAutoincrement: false;
784
+ hasRuntimeDefault: false;
785
+ enumValues: [string, ...string[]];
786
+ baseColumn: never;
787
+ identity: undefined;
788
+ generated: undefined;
789
+ }, {}, {}>;
790
+ conditions: import("drizzle-orm/pg-core").PgColumn<{
791
+ name: "conditions";
792
+ tableName: "segments";
793
+ dataType: "json";
794
+ columnType: "PgJsonb";
795
+ data: Record<string, unknown>;
796
+ driverParam: unknown;
797
+ notNull: false;
798
+ hasDefault: false;
799
+ isPrimaryKey: false;
800
+ isAutoincrement: false;
801
+ hasRuntimeDefault: false;
802
+ enumValues: undefined;
803
+ baseColumn: never;
804
+ identity: undefined;
805
+ generated: undefined;
806
+ }, {}, {
807
+ $type: Record<string, unknown>;
808
+ }>;
809
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
810
+ name: "created_at";
811
+ tableName: "segments";
812
+ dataType: "date";
813
+ columnType: "PgTimestamp";
814
+ data: Date;
815
+ driverParam: string;
816
+ notNull: true;
817
+ hasDefault: true;
818
+ isPrimaryKey: false;
819
+ isAutoincrement: false;
820
+ hasRuntimeDefault: false;
821
+ enumValues: undefined;
822
+ baseColumn: never;
823
+ identity: undefined;
824
+ generated: undefined;
825
+ }, {}, {}>;
826
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
827
+ name: "updated_at";
828
+ tableName: "segments";
829
+ dataType: "date";
830
+ columnType: "PgTimestamp";
831
+ data: Date;
832
+ driverParam: string;
833
+ notNull: true;
834
+ hasDefault: true;
835
+ isPrimaryKey: false;
836
+ isAutoincrement: false;
837
+ hasRuntimeDefault: false;
838
+ enumValues: undefined;
839
+ baseColumn: never;
840
+ identity: undefined;
841
+ generated: undefined;
842
+ }, {}, {}>;
843
+ }, "single", Record<"segments", "not-null">, false, "orderBy", {
844
+ id: string;
845
+ name: string;
846
+ description: string | null;
847
+ conditions: Record<string, unknown> | null;
848
+ createdAt: Date;
849
+ updatedAt: Date;
850
+ }[], {
851
+ id: import("drizzle-orm/pg-core").PgColumn<{
852
+ name: string;
853
+ tableName: "segments";
854
+ dataType: "string";
855
+ columnType: "PgText";
856
+ data: string;
857
+ driverParam: string;
858
+ notNull: true;
859
+ hasDefault: true;
860
+ isPrimaryKey: true;
861
+ isAutoincrement: false;
862
+ hasRuntimeDefault: true;
863
+ enumValues: [string, ...string[]];
864
+ baseColumn: never;
865
+ identity: undefined;
866
+ generated: undefined;
867
+ }, {}, {}>;
868
+ name: import("drizzle-orm/pg-core").PgColumn<{
869
+ name: "name";
870
+ tableName: "segments";
871
+ dataType: "string";
872
+ columnType: "PgText";
873
+ data: string;
874
+ driverParam: string;
875
+ notNull: true;
876
+ hasDefault: false;
877
+ isPrimaryKey: false;
878
+ isAutoincrement: false;
879
+ hasRuntimeDefault: false;
880
+ enumValues: [string, ...string[]];
881
+ baseColumn: never;
882
+ identity: undefined;
883
+ generated: undefined;
884
+ }, {}, {}>;
885
+ description: import("drizzle-orm/pg-core").PgColumn<{
886
+ name: "description";
887
+ tableName: "segments";
888
+ dataType: "string";
889
+ columnType: "PgText";
890
+ data: string;
891
+ driverParam: string;
892
+ notNull: false;
893
+ hasDefault: false;
894
+ isPrimaryKey: false;
895
+ isAutoincrement: false;
896
+ hasRuntimeDefault: false;
897
+ enumValues: [string, ...string[]];
898
+ baseColumn: never;
899
+ identity: undefined;
900
+ generated: undefined;
901
+ }, {}, {}>;
902
+ conditions: import("drizzle-orm/pg-core").PgColumn<{
903
+ name: "conditions";
904
+ tableName: "segments";
905
+ dataType: "json";
906
+ columnType: "PgJsonb";
907
+ data: Record<string, unknown>;
908
+ driverParam: unknown;
909
+ notNull: false;
910
+ hasDefault: false;
911
+ isPrimaryKey: false;
912
+ isAutoincrement: false;
913
+ hasRuntimeDefault: false;
914
+ enumValues: undefined;
915
+ baseColumn: never;
916
+ identity: undefined;
917
+ generated: undefined;
918
+ }, {}, {
919
+ $type: Record<string, unknown>;
920
+ }>;
921
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
922
+ name: "created_at";
923
+ tableName: "segments";
924
+ dataType: "date";
925
+ columnType: "PgTimestamp";
926
+ data: Date;
927
+ driverParam: string;
928
+ notNull: true;
929
+ hasDefault: true;
930
+ isPrimaryKey: false;
931
+ isAutoincrement: false;
932
+ hasRuntimeDefault: false;
933
+ enumValues: undefined;
934
+ baseColumn: never;
935
+ identity: undefined;
936
+ generated: undefined;
937
+ }, {}, {}>;
938
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
939
+ name: "updated_at";
940
+ tableName: "segments";
941
+ dataType: "date";
942
+ columnType: "PgTimestamp";
943
+ data: Date;
944
+ driverParam: string;
945
+ notNull: true;
946
+ hasDefault: true;
947
+ isPrimaryKey: false;
948
+ isAutoincrement: false;
949
+ hasRuntimeDefault: false;
950
+ enumValues: undefined;
951
+ baseColumn: never;
952
+ identity: undefined;
953
+ generated: undefined;
954
+ }, {}, {}>;
955
+ }>, "orderBy">;
956
+ createSegment(db: PostgresJsDatabase, data: CreateSegmentInput): Promise<{
957
+ name: string;
958
+ createdAt: Date;
959
+ updatedAt: Date;
960
+ description: string | null;
961
+ id: string;
962
+ conditions: Record<string, unknown> | null;
963
+ } | undefined>;
964
+ deleteSegment(db: PostgresJsDatabase, segmentId: string): Promise<{
965
+ id: string;
966
+ } | null>;
967
+ exportPeopleCsv(db: PostgresJsDatabase): Promise<string>;
968
+ importPeopleCsv(db: PostgresJsDatabase, csvText: string): Promise<{
969
+ error: "CSV must have a header row and at least one data row";
970
+ imported?: undefined;
971
+ errors?: undefined;
972
+ } | {
973
+ imported: number;
974
+ errors: {
975
+ row: number;
976
+ error: string;
977
+ }[];
978
+ error?: undefined;
979
+ }>;
980
+ };
981
+ export {};
982
+ //# sourceMappingURL=accounts.d.ts.map