@voyantjs/crm 0.62.3 → 0.63.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 (33) hide show
  1. package/dist/action-ledger-capabilities.d.ts +20 -0
  2. package/dist/action-ledger-capabilities.d.ts.map +1 -0
  3. package/dist/action-ledger-capabilities.js +16 -0
  4. package/dist/routes/accounts.d.ts +19 -19
  5. package/dist/routes/activities.d.ts +6 -6
  6. package/dist/routes/custom-fields.d.ts +7 -7
  7. package/dist/routes/customer-signals.d.ts +14 -14
  8. package/dist/routes/index.d.ts +112 -60
  9. package/dist/routes/index.d.ts.map +1 -1
  10. package/dist/routes/opportunities.d.ts +4 -4
  11. package/dist/routes/person-documents.d.ts +67 -7
  12. package/dist/routes/person-documents.d.ts.map +1 -1
  13. package/dist/routes/person-documents.js +80 -0
  14. package/dist/routes/person-relationships.d.ts +2 -2
  15. package/dist/routes/quotes.d.ts +2 -2
  16. package/dist/schema-activities.d.ts +4 -4
  17. package/dist/schema-signals.d.ts +2 -2
  18. package/dist/service/accounts-organizations.d.ts +3 -3
  19. package/dist/service/accounts-people.d.ts +10 -10
  20. package/dist/service/accounts.d.ts +13 -13
  21. package/dist/service/activities.d.ts +6 -6
  22. package/dist/service/custom-fields.d.ts +9 -9
  23. package/dist/service/customer-signals.d.ts +18 -18
  24. package/dist/service/index.d.ts +72 -65
  25. package/dist/service/index.d.ts.map +1 -1
  26. package/dist/service/opportunities.d.ts +4 -4
  27. package/dist/service/person-documents.d.ts +17 -4
  28. package/dist/service/person-documents.d.ts.map +1 -1
  29. package/dist/service/person-documents.js +16 -0
  30. package/dist/service/person-relationships.d.ts +3 -3
  31. package/dist/service/quotes.d.ts +2 -2
  32. package/dist/validation.d.ts +35 -35
  33. package/package.json +7 -6
@@ -68,6 +68,22 @@ export const personDocumentsService = {
68
68
  .limit(1);
69
69
  return row ?? null;
70
70
  },
71
+ /**
72
+ * Decrypts the `numberEncrypted` slot for a single document and
73
+ * returns the plaintext. Returns `null` when the document has no
74
+ * encrypted number on file. Caller is responsible for authorization
75
+ * and audit-logging; this is just the KMS unwrap.
76
+ */
77
+ async revealPersonDocumentNumber(db, documentId, options) {
78
+ const row = await personDocumentsService.getPersonDocument(db, documentId);
79
+ if (!row)
80
+ return null;
81
+ if (!row.numberEncrypted)
82
+ return { documentId, number: null };
83
+ const keyRef = options.keyRef ?? { keyType: "people" };
84
+ const decrypted = await decryptOptionalJsonEnvelope(options.kms, keyRef, row.numberEncrypted, personDocumentNumberPlaintextSchema);
85
+ return { documentId, number: decrypted?.number ?? null };
86
+ },
71
87
  /**
72
88
  * Returns the primary document of a given type for a person, or
73
89
  * `null` if no primary is set. Used by booking-traveler create to
@@ -218,7 +218,7 @@ export declare const personRelationshipsService: {
218
218
  identity: undefined;
219
219
  generated: undefined;
220
220
  }, {}, {}>;
221
- }, "single", Record<"person_relationships", "not-null">, false, "where" | "limit" | "orderBy" | "offset", {
221
+ }, "single", Record<"person_relationships", "not-null">, false, "where" | "orderBy" | "limit" | "offset", {
222
222
  id: string;
223
223
  fromPersonId: string;
224
224
  toPersonId: string;
@@ -438,7 +438,7 @@ export declare const personRelationshipsService: {
438
438
  identity: undefined;
439
439
  generated: undefined;
440
440
  }, {}, {}>;
441
- }>, "where" | "limit" | "orderBy" | "offset">;
441
+ }>, "where" | "orderBy" | "limit" | "offset">;
442
442
  getPersonRelationship(db: PostgresJsDatabase, id: string): Promise<{
443
443
  id: string;
444
444
  fromPersonId: string;
@@ -468,9 +468,9 @@ export declare const personRelationshipsService: {
468
468
  * propagates.
469
469
  */
470
470
  createPersonRelationship(db: PostgresJsDatabase, fromPersonId: string, data: CreatePersonRelationshipInput): Promise<{
471
- metadata: Record<string, unknown> | null;
472
471
  id: string;
473
472
  createdAt: Date;
473
+ metadata: Record<string, unknown> | null;
474
474
  updatedAt: Date;
475
475
  startDate: string | null;
476
476
  endDate: string | null;
@@ -42,9 +42,9 @@ export declare const quotesService: {
42
42
  } | null>;
43
43
  createQuote(db: PostgresJsDatabase, data: CreateQuoteInput): Promise<{
44
44
  id: string;
45
+ status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
45
46
  createdAt: Date;
46
47
  updatedAt: Date;
47
- status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
48
48
  currency: string;
49
49
  notes: string | null;
50
50
  opportunityId: string;
@@ -462,10 +462,10 @@ export declare const quotesService: {
462
462
  }>, "where" | "orderBy">;
463
463
  createQuoteLine(db: PostgresJsDatabase, quoteId: string, data: CreateQuoteLineInput): Promise<{
464
464
  id: string;
465
+ description: string;
465
466
  createdAt: Date;
466
467
  updatedAt: Date;
467
468
  currency: string;
468
- description: string;
469
469
  quoteId: string;
470
470
  productId: string | null;
471
471
  supplierServiceId: string | null;
@@ -52,8 +52,8 @@ export declare const activityTypeSchema: z.ZodEnum<{
52
52
  note: "note";
53
53
  }>;
54
54
  export declare const activityStatusSchema: z.ZodEnum<{
55
- done: "done";
56
55
  cancelled: "cancelled";
56
+ done: "done";
57
57
  planned: "planned";
58
58
  }>;
59
59
  export declare const participantRoleSchema: z.ZodEnum<{
@@ -70,8 +70,8 @@ export declare const activityLinkRoleSchema: z.ZodEnum<{
70
70
  export declare const customFieldTypeSchema: z.ZodEnum<{
71
71
  boolean: "boolean";
72
72
  json: "json";
73
- text: "text";
74
73
  date: "date";
74
+ text: "text";
75
75
  set: "set";
76
76
  enum: "enum";
77
77
  phone: "phone";
@@ -159,11 +159,11 @@ export declare const updateOrganizationSchema: z.ZodObject<{
159
159
  notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
160
160
  }, z.core.$strip>;
161
161
  export declare const organizationListSortFieldSchema: z.ZodEnum<{
162
- relation: "relation";
163
162
  name: "name";
163
+ status: "status";
164
164
  createdAt: "createdAt";
165
+ relation: "relation";
165
166
  updatedAt: "updatedAt";
166
- status: "status";
167
167
  industry: "industry";
168
168
  }>;
169
169
  export declare const organizationListSortDirSchema: z.ZodEnum<{
@@ -187,11 +187,11 @@ export declare const organizationListQuerySchema: z.ZodObject<{
187
187
  }>>;
188
188
  search: z.ZodOptional<z.ZodString>;
189
189
  sortBy: z.ZodDefault<z.ZodEnum<{
190
- relation: "relation";
191
190
  name: "name";
191
+ status: "status";
192
192
  createdAt: "createdAt";
193
+ relation: "relation";
193
194
  updatedAt: "updatedAt";
194
- status: "status";
195
195
  industry: "industry";
196
196
  }>>;
197
197
  sortDir: z.ZodDefault<z.ZodEnum<{
@@ -338,11 +338,11 @@ export declare const updatePersonSchema: z.ZodObject<{
338
338
  website: z.ZodOptional<z.ZodPipe<z.ZodUnion<[z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodLiteral<"">]>, z.ZodTransform<string | null, string | null | undefined>>>;
339
339
  }, z.core.$strip>;
340
340
  export declare const personListSortFieldSchema: z.ZodEnum<{
341
- relation: "relation";
342
341
  name: "name";
342
+ status: "status";
343
343
  createdAt: "createdAt";
344
+ relation: "relation";
344
345
  updatedAt: "updatedAt";
345
- status: "status";
346
346
  }>;
347
347
  export declare const personListSortDirSchema: z.ZodEnum<{
348
348
  asc: "asc";
@@ -366,11 +366,11 @@ export declare const personListQuerySchema: z.ZodObject<{
366
366
  }>>;
367
367
  search: z.ZodOptional<z.ZodString>;
368
368
  sortBy: z.ZodDefault<z.ZodEnum<{
369
- relation: "relation";
370
369
  name: "name";
370
+ status: "status";
371
371
  createdAt: "createdAt";
372
+ relation: "relation";
372
373
  updatedAt: "updatedAt";
373
- status: "status";
374
374
  }>>;
375
375
  sortDir: z.ZodDefault<z.ZodEnum<{
376
376
  asc: "asc";
@@ -671,8 +671,8 @@ export declare const activityCoreSchema: z.ZodObject<{
671
671
  }>;
672
672
  ownerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
673
673
  status: z.ZodDefault<z.ZodEnum<{
674
- done: "done";
675
674
  cancelled: "cancelled";
675
+ done: "done";
676
676
  planned: "planned";
677
677
  }>>;
678
678
  dueAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -692,8 +692,8 @@ export declare const insertActivitySchema: z.ZodObject<{
692
692
  }>;
693
693
  ownerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
694
694
  status: z.ZodDefault<z.ZodEnum<{
695
- done: "done";
696
695
  cancelled: "cancelled";
696
+ done: "done";
697
697
  planned: "planned";
698
698
  }>>;
699
699
  dueAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -713,8 +713,8 @@ export declare const updateActivitySchema: z.ZodObject<{
713
713
  }>>;
714
714
  ownerId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
715
715
  status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
716
- done: "done";
717
716
  cancelled: "cancelled";
717
+ done: "done";
718
718
  planned: "planned";
719
719
  }>>>;
720
720
  dueAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
@@ -727,8 +727,8 @@ export declare const activityListQuerySchema: z.ZodObject<{
727
727
  offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
728
728
  ownerId: z.ZodOptional<z.ZodString>;
729
729
  status: z.ZodOptional<z.ZodEnum<{
730
- done: "done";
731
730
  cancelled: "cancelled";
731
+ done: "done";
732
732
  planned: "planned";
733
733
  }>>;
734
734
  type: z.ZodOptional<z.ZodEnum<{
@@ -780,8 +780,8 @@ export declare const customFieldDefinitionCoreSchema: z.ZodObject<{
780
780
  fieldType: z.ZodEnum<{
781
781
  boolean: "boolean";
782
782
  json: "json";
783
- text: "text";
784
783
  date: "date";
784
+ text: "text";
785
785
  set: "set";
786
786
  enum: "enum";
787
787
  phone: "phone";
@@ -810,8 +810,8 @@ export declare const insertCustomFieldDefinitionSchema: z.ZodObject<{
810
810
  fieldType: z.ZodEnum<{
811
811
  boolean: "boolean";
812
812
  json: "json";
813
- text: "text";
814
813
  date: "date";
814
+ text: "text";
815
815
  set: "set";
816
816
  enum: "enum";
817
817
  phone: "phone";
@@ -840,8 +840,8 @@ export declare const updateCustomFieldDefinitionSchema: z.ZodObject<{
840
840
  fieldType: z.ZodOptional<z.ZodEnum<{
841
841
  boolean: "boolean";
842
842
  json: "json";
843
- text: "text";
844
843
  date: "date";
844
+ text: "text";
845
845
  set: "set";
846
846
  enum: "enum";
847
847
  phone: "phone";
@@ -1031,8 +1031,8 @@ export type PersonDocumentPlaintextInput = z.infer<typeof insertPersonDocumentFr
1031
1031
  export type PersonDocumentPlaintextUpdate = z.infer<typeof updatePersonDocumentFromPlaintextSchema>;
1032
1032
  export type UpdatePersonProfilePiiInput = z.infer<typeof updatePersonProfilePiiSchema>;
1033
1033
  export declare const customerSignalKindSchema: z.ZodEnum<{
1034
- wishlist: "wishlist";
1035
1034
  notify: "notify";
1035
+ wishlist: "wishlist";
1036
1036
  inquiry: "inquiry";
1037
1037
  request_offer: "request_offer";
1038
1038
  referral: "referral";
@@ -1046,17 +1046,17 @@ export declare const customerSignalSourceSchema: z.ZodEnum<{
1046
1046
  booking: "booking";
1047
1047
  }>;
1048
1048
  export declare const customerSignalStatusSchema: z.ZodEnum<{
1049
+ expired: "expired";
1049
1050
  new: "new";
1050
1051
  contacted: "contacted";
1051
1052
  qualified: "qualified";
1052
1053
  converted: "converted";
1053
1054
  lost: "lost";
1054
- expired: "expired";
1055
1055
  }>;
1056
1056
  export declare const customerSignalPrioritySchema: z.ZodEnum<{
1057
- normal: "normal";
1058
1057
  low: "low";
1059
1058
  high: "high";
1059
+ normal: "normal";
1060
1060
  urgent: "urgent";
1061
1061
  }>;
1062
1062
  export declare const insertCustomerSignalSchema: z.ZodObject<{
@@ -1064,8 +1064,8 @@ export declare const insertCustomerSignalSchema: z.ZodObject<{
1064
1064
  productId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1065
1065
  optionUnitId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1066
1066
  kind: z.ZodEnum<{
1067
- wishlist: "wishlist";
1068
1067
  notify: "notify";
1068
+ wishlist: "wishlist";
1069
1069
  inquiry: "inquiry";
1070
1070
  request_offer: "request_offer";
1071
1071
  referral: "referral";
@@ -1079,17 +1079,17 @@ export declare const insertCustomerSignalSchema: z.ZodObject<{
1079
1079
  booking: "booking";
1080
1080
  }>;
1081
1081
  status: z.ZodDefault<z.ZodEnum<{
1082
+ expired: "expired";
1082
1083
  new: "new";
1083
1084
  contacted: "contacted";
1084
1085
  qualified: "qualified";
1085
1086
  converted: "converted";
1086
1087
  lost: "lost";
1087
- expired: "expired";
1088
1088
  }>>;
1089
1089
  priority: z.ZodDefault<z.ZodEnum<{
1090
- normal: "normal";
1091
1090
  low: "low";
1092
1091
  high: "high";
1092
+ normal: "normal";
1093
1093
  urgent: "urgent";
1094
1094
  }>>;
1095
1095
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1101,6 +1101,14 @@ export declare const insertCustomerSignalSchema: z.ZodObject<{
1101
1101
  metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1102
1102
  }, z.core.$strip>;
1103
1103
  export declare const updateCustomerSignalSchema: z.ZodObject<{
1104
+ status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
1105
+ expired: "expired";
1106
+ new: "new";
1107
+ contacted: "contacted";
1108
+ qualified: "qualified";
1109
+ converted: "converted";
1110
+ lost: "lost";
1111
+ }>>>;
1104
1112
  source: z.ZodOptional<z.ZodEnum<{
1105
1113
  admin: "admin";
1106
1114
  form: "form";
@@ -1110,18 +1118,10 @@ export declare const updateCustomerSignalSchema: z.ZodObject<{
1110
1118
  booking: "booking";
1111
1119
  }>>;
1112
1120
  metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
1113
- status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
1114
- new: "new";
1115
- contacted: "contacted";
1116
- qualified: "qualified";
1117
- converted: "converted";
1118
- lost: "lost";
1119
- expired: "expired";
1120
- }>>>;
1121
1121
  notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
1122
1122
  kind: z.ZodOptional<z.ZodEnum<{
1123
- wishlist: "wishlist";
1124
1123
  notify: "notify";
1124
+ wishlist: "wishlist";
1125
1125
  inquiry: "inquiry";
1126
1126
  request_offer: "request_offer";
1127
1127
  referral: "referral";
@@ -1130,9 +1130,9 @@ export declare const updateCustomerSignalSchema: z.ZodObject<{
1130
1130
  productId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
1131
1131
  optionUnitId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
1132
1132
  priority: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
1133
- normal: "normal";
1134
1133
  low: "low";
1135
1134
  high: "high";
1135
+ normal: "normal";
1136
1136
  urgent: "urgent";
1137
1137
  }>>>;
1138
1138
  assignedToUserId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
@@ -1146,16 +1146,16 @@ export declare const customerSignalListQuerySchema: z.ZodObject<{
1146
1146
  personId: z.ZodOptional<z.ZodString>;
1147
1147
  assignedToUserId: z.ZodOptional<z.ZodString>;
1148
1148
  status: z.ZodOptional<z.ZodEnum<{
1149
+ expired: "expired";
1149
1150
  new: "new";
1150
1151
  contacted: "contacted";
1151
1152
  qualified: "qualified";
1152
1153
  converted: "converted";
1153
1154
  lost: "lost";
1154
- expired: "expired";
1155
1155
  }>>;
1156
1156
  kind: z.ZodOptional<z.ZodEnum<{
1157
- wishlist: "wishlist";
1158
1157
  notify: "notify";
1158
+ wishlist: "wishlist";
1159
1159
  inquiry: "inquiry";
1160
1160
  request_offer: "request_offer";
1161
1161
  referral: "referral";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/crm",
3
- "version": "0.62.3",
3
+ "version": "0.63.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,11 +39,12 @@
39
39
  "drizzle-orm": "^0.45.2",
40
40
  "hono": "^4.12.10",
41
41
  "zod": "^4.3.6",
42
- "@voyantjs/core": "0.62.3",
43
- "@voyantjs/db": "0.62.3",
44
- "@voyantjs/hono": "0.62.3",
45
- "@voyantjs/identity": "0.62.3",
46
- "@voyantjs/utils": "0.62.3"
42
+ "@voyantjs/action-ledger": "0.63.0",
43
+ "@voyantjs/core": "0.63.0",
44
+ "@voyantjs/db": "0.63.0",
45
+ "@voyantjs/hono": "0.63.0",
46
+ "@voyantjs/identity": "0.63.0",
47
+ "@voyantjs/utils": "0.63.0"
47
48
  },
48
49
  "devDependencies": {
49
50
  "typescript": "^6.0.2",