@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
@@ -1,11 +1,30 @@
1
+ import { evaluateActionLedgerCapabilityAccess, ledgerSensitiveRead, } from "@voyantjs/action-ledger";
1
2
  import { parseJsonBody, parseQuery } from "@voyantjs/hono";
2
3
  import { encryptOptionalJsonEnvelope } from "@voyantjs/utils";
3
4
  import { eq } from "drizzle-orm";
4
5
  import { Hono } from "hono";
6
+ import { PERSON_DOCUMENT_REVEAL_ACTION_NAME, PERSON_DOCUMENT_REVEAL_ACTION_VERSION, PERSON_DOCUMENT_REVEAL_AUTHORIZATION_SOURCE, PERSON_DOCUMENT_REVEAL_CAPABILITY, PERSON_DOCUMENT_REVEAL_DECISION_POLICY, } from "../action-ledger-capabilities.js";
5
7
  import { CRM_ROUTE_RUNTIME_CONTAINER_KEY } from "../route-runtime.js";
6
8
  import { people } from "../schema.js";
7
9
  import { crmService } from "../service/index.js";
8
10
  import { insertPersonDocumentFromPlaintextSchema, insertPersonDocumentSchema, personDocumentListQuerySchema, updatePersonDocumentFromPlaintextSchema, updatePersonDocumentSchema, updatePersonProfilePiiSchema, } from "../validation.js";
11
+ function getCrmActionLedgerContext(c) {
12
+ return {
13
+ userId: c.get("userId") ?? null,
14
+ agentId: null,
15
+ workflowPrincipalId: null,
16
+ principalSubtype: null,
17
+ sessionId: c.get("sessionId") ?? null,
18
+ apiTokenId: c.get("apiTokenId") ?? c.get("apiKeyId") ?? null,
19
+ callerType: c.get("callerType") ?? null,
20
+ actor: c.get("actor") ?? null,
21
+ isInternalRequest: c.get("isInternalRequest") ?? false,
22
+ organizationId: c.get("organizationId") ?? null,
23
+ workflowRunId: null,
24
+ workflowStepId: null,
25
+ correlationId: c.req.header("x-correlation-id") ?? c.req.header("x-request-id") ?? null,
26
+ };
27
+ }
9
28
  const peopleKeyRef = { keyType: "people" };
10
29
  async function getCrmKms(c) {
11
30
  const runtime = c.var.container?.resolve(CRM_ROUTE_RUNTIME_CONTAINER_KEY);
@@ -157,4 +176,65 @@ export const personDocumentRoutes = new Hono()
157
176
  if (!row)
158
177
  return c.json({ error: "Document not found" }, 404);
159
178
  return c.json({ data: row });
179
+ })
180
+ /**
181
+ * Decrypts and returns the plaintext document number for a single
182
+ * person document. Gated by the `crm-pii:read` action-ledger
183
+ * capability; every successful reveal writes an action-ledger row
184
+ * tagged `crm.person_document.reveal` so disclosures are auditable.
185
+ * Returns 403 when the caller lacks the grant, 404 when the document
186
+ * doesn't exist, 503 when KMS isn't wired.
187
+ */
188
+ .get("/person-documents/:id/reveal", async (c) => {
189
+ const documentId = c.req.param("id");
190
+ const access = evaluateActionLedgerCapabilityAccess({
191
+ definition: PERSON_DOCUMENT_REVEAL_CAPABILITY,
192
+ actor: c.get("actor") ?? null,
193
+ callerType: c.get("callerType") ?? null,
194
+ scopes: c.get("scopes") ?? null,
195
+ isInternalRequest: c.get("isInternalRequest") ?? false,
196
+ });
197
+ if (!access.allowed) {
198
+ return c.json({ error: "Forbidden", reason: access.reason }, 403);
199
+ }
200
+ const kms = await getCrmKms(c);
201
+ if (!kms)
202
+ return kmsRequired(c);
203
+ const existing = await crmService.getPersonDocument(c.get("db"), documentId);
204
+ if (!existing)
205
+ return c.json({ error: "Document not found" }, 404);
206
+ let revealed;
207
+ try {
208
+ revealed = await ledgerSensitiveRead(c.get("db"), {
209
+ context: getCrmActionLedgerContext(c),
210
+ actionName: PERSON_DOCUMENT_REVEAL_ACTION_NAME,
211
+ actionVersion: PERSON_DOCUMENT_REVEAL_ACTION_VERSION,
212
+ status: "succeeded",
213
+ evaluatedRisk: access.evaluatedRisk ?? "high",
214
+ targetType: "person_document",
215
+ targetId: documentId,
216
+ routeOrToolName: "crm.person-documents.reveal",
217
+ capabilityId: PERSON_DOCUMENT_REVEAL_CAPABILITY.id,
218
+ capabilityVersion: PERSON_DOCUMENT_REVEAL_CAPABILITY.version,
219
+ authorizationSource: access.authorizationSource ?? PERSON_DOCUMENT_REVEAL_AUTHORIZATION_SOURCE,
220
+ reasonCode: "person_document_reveal",
221
+ disclosedFieldSet: ["number"],
222
+ disclosureSummary: "Person document number reveal",
223
+ decisionPolicy: PERSON_DOCUMENT_REVEAL_DECISION_POLICY,
224
+ }, async () => {
225
+ const result = await crmService.revealPersonDocumentNumber(c.get("db"), documentId, {
226
+ kms,
227
+ });
228
+ if (!result)
229
+ throw new Error("Document not found");
230
+ return result;
231
+ });
232
+ }
233
+ catch (error) {
234
+ if (error instanceof Error && error.message === "Document not found") {
235
+ return c.json({ error: "Document not found" }, 404);
236
+ }
237
+ throw error;
238
+ }
239
+ return c.json({ data: revealed });
160
240
  });
@@ -56,11 +56,11 @@ export declare const personRelationshipRoutes: import("hono/hono-base").HonoBase
56
56
  };
57
57
  output: {
58
58
  data: {
59
+ id: string;
60
+ createdAt: string;
59
61
  metadata: {
60
62
  [x: string]: import("hono/utils/types").JSONValue;
61
63
  } | null;
62
- id: string;
63
- createdAt: string;
64
64
  updatedAt: string;
65
65
  startDate: string | null;
66
66
  endDate: string | null;
@@ -39,9 +39,9 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
39
39
  output: {
40
40
  data: {
41
41
  id: string;
42
+ status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
42
43
  createdAt: string;
43
44
  updatedAt: string;
44
- status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
45
45
  currency: string;
46
46
  notes: string | null;
47
47
  opportunityId: string;
@@ -198,10 +198,10 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
198
198
  output: {
199
199
  data: {
200
200
  id: string;
201
+ description: string;
201
202
  createdAt: string;
202
203
  updatedAt: string;
203
204
  currency: string;
204
- description: string;
205
205
  quoteId: string;
206
206
  productId: string | null;
207
207
  supplierServiceId: string | null;
@@ -75,7 +75,7 @@ export declare const activities: import("drizzle-orm/pg-core").PgTableWithColumn
75
75
  tableName: "activities";
76
76
  dataType: "string";
77
77
  columnType: "PgEnumColumn";
78
- data: "done" | "cancelled" | "planned";
78
+ data: "cancelled" | "done" | "planned";
79
79
  driverParam: string;
80
80
  notNull: true;
81
81
  hasDefault: true;
@@ -470,7 +470,7 @@ export declare const customFieldDefinitions: import("drizzle-orm/pg-core").PgTab
470
470
  tableName: "custom_field_definitions";
471
471
  dataType: "string";
472
472
  columnType: "PgEnumColumn";
473
- data: "boolean" | "json" | "text" | "date" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
473
+ data: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
474
474
  driverParam: string;
475
475
  notNull: true;
476
476
  hasDefault: false;
@@ -757,7 +757,7 @@ export declare const customFieldValues: import("drizzle-orm/pg-core").PgTableWit
757
757
  tableName: "custom_field_values";
758
758
  dataType: "json";
759
759
  columnType: "PgJsonb";
760
- data: Record<string, unknown> | string[] | null;
760
+ data: string[] | Record<string, unknown> | null;
761
761
  driverParam: unknown;
762
762
  notNull: false;
763
763
  hasDefault: false;
@@ -769,7 +769,7 @@ export declare const customFieldValues: import("drizzle-orm/pg-core").PgTableWit
769
769
  identity: undefined;
770
770
  generated: undefined;
771
771
  }, {}, {
772
- $type: Record<string, unknown> | string[] | null;
772
+ $type: string[] | Record<string, unknown> | null;
773
773
  }>;
774
774
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
775
775
  name: "created_at";
@@ -96,7 +96,7 @@ export declare const customerSignals: import("drizzle-orm/pg-core").PgTableWithC
96
96
  tableName: "customer_signals";
97
97
  dataType: "string";
98
98
  columnType: "PgEnumColumn";
99
- data: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
99
+ data: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
100
100
  driverParam: string;
101
101
  notNull: true;
102
102
  hasDefault: false;
@@ -130,7 +130,7 @@ export declare const customerSignals: import("drizzle-orm/pg-core").PgTableWithC
130
130
  tableName: "customer_signals";
131
131
  dataType: "string";
132
132
  columnType: "PgEnumColumn";
133
- data: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
133
+ data: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
134
134
  driverParam: string;
135
135
  notNull: true;
136
136
  hasDefault: true;
@@ -49,13 +49,13 @@ export declare const organizationAccountsService: {
49
49
  archivedAt: Date | null;
50
50
  } | null>;
51
51
  createOrganization(db: PostgresJsDatabase, data: CreateOrganizationInput): Promise<{
52
- source: string | null;
53
- relation: "partner" | "supplier" | "other" | "client" | null;
54
52
  name: string;
55
53
  id: string;
54
+ status: "active" | "inactive" | "archived";
56
55
  createdAt: Date;
56
+ source: string | null;
57
+ relation: "partner" | "supplier" | "other" | "client" | null;
57
58
  updatedAt: Date;
58
- status: "active" | "inactive" | "archived";
59
59
  notes: string | null;
60
60
  website: string | null;
61
61
  legalName: string | null;
@@ -161,10 +161,10 @@ export declare const peopleAccountsService: {
161
161
  updatedAt: Date;
162
162
  }[]>;
163
163
  createContactMethod(db: PostgresJsDatabase, entityType: "organization" | "person", entityId: string, data: CreateContactPointInput): Promise<{
164
- value: string;
165
- metadata: Record<string, unknown> | null;
166
164
  id: string;
167
165
  createdAt: Date;
166
+ value: string;
167
+ metadata: Record<string, unknown> | null;
168
168
  updatedAt: Date;
169
169
  notes: string | null;
170
170
  kind: "email" | "other" | "phone" | "website" | "mobile" | "whatsapp" | "sms" | "fax" | "social";
@@ -195,7 +195,7 @@ export declare const peopleAccountsService: {
195
195
  id: string;
196
196
  entityType: string;
197
197
  entityId: string;
198
- label: "service" | "primary" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
198
+ label: "primary" | "service" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
199
199
  fullText: string | null;
200
200
  line1: string | null;
201
201
  line2: string | null;
@@ -213,16 +213,16 @@ export declare const peopleAccountsService: {
213
213
  updatedAt: Date;
214
214
  }[]>;
215
215
  createAddress(db: PostgresJsDatabase, entityType: "organization" | "person", entityId: string, data: CreateAddressInput): Promise<{
216
- metadata: Record<string, unknown> | null;
217
216
  id: string;
218
217
  createdAt: Date;
218
+ metadata: Record<string, unknown> | null;
219
219
  updatedAt: Date;
220
220
  notes: string | null;
221
221
  timezone: string | null;
222
222
  region: string | null;
223
223
  entityType: string;
224
224
  entityId: string;
225
- label: "service" | "primary" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
225
+ label: "primary" | "service" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
226
226
  isPrimary: boolean;
227
227
  fullText: string | null;
228
228
  line1: string | null;
@@ -237,7 +237,7 @@ export declare const peopleAccountsService: {
237
237
  id: string;
238
238
  entityType: string;
239
239
  entityId: string;
240
- label: "service" | "primary" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
240
+ label: "primary" | "service" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
241
241
  fullText: string | null;
242
242
  line1: string | null;
243
243
  line2: string | null;
@@ -624,8 +624,8 @@ export declare const peopleAccountsService: {
624
624
  }>, "where" | "orderBy">;
625
625
  createOrganizationNote(db: PostgresJsDatabase, organizationId: string, userId: string, data: CreateOrganizationNoteInput): Promise<{
626
626
  id: string;
627
- createdAt: Date;
628
627
  organizationId: string;
628
+ createdAt: Date;
629
629
  authorId: string;
630
630
  content: string;
631
631
  } | null | undefined>;
@@ -1042,8 +1042,8 @@ export declare const peopleAccountsService: {
1042
1042
  } | null>;
1043
1043
  deleteOrganizationNote(db: PostgresJsDatabase, id: string): Promise<{
1044
1044
  id: string;
1045
- createdAt: Date;
1046
1045
  organizationId: string;
1046
+ createdAt: Date;
1047
1047
  authorId: string;
1048
1048
  content: string;
1049
1049
  } | null>;
@@ -1060,8 +1060,8 @@ export declare const peopleAccountsService: {
1060
1060
  }[]>;
1061
1061
  createCommunication(db: PostgresJsDatabase, personId: string, data: CreateCommunicationLogInput): Promise<{
1062
1062
  id: string;
1063
- createdAt: Date;
1064
1063
  organizationId: string | null;
1064
+ createdAt: Date;
1065
1065
  personId: string;
1066
1066
  content: string | null;
1067
1067
  channel: "email" | "other" | "phone" | "whatsapp" | "sms" | "meeting";
@@ -1290,9 +1290,9 @@ export declare const peopleAccountsService: {
1290
1290
  createSegment(db: PostgresJsDatabase, data: CreateSegmentInput): Promise<{
1291
1291
  name: string;
1292
1292
  id: string;
1293
+ description: string | null;
1293
1294
  createdAt: Date;
1294
1295
  updatedAt: Date;
1295
- description: string | null;
1296
1296
  conditions: Record<string, unknown> | null;
1297
1297
  } | undefined>;
1298
1298
  deleteSegment(db: PostgresJsDatabase, segmentId: string): Promise<{
@@ -161,10 +161,10 @@ export declare const accountsService: {
161
161
  updatedAt: Date;
162
162
  }[]>;
163
163
  createContactMethod(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, entityType: "organization" | "person", entityId: string, data: import("./accounts-shared.js").CreateContactPointInput): Promise<{
164
- value: string;
165
- metadata: Record<string, unknown> | null;
166
164
  id: string;
167
165
  createdAt: Date;
166
+ value: string;
167
+ metadata: Record<string, unknown> | null;
168
168
  updatedAt: Date;
169
169
  notes: string | null;
170
170
  kind: "email" | "other" | "phone" | "website" | "mobile" | "whatsapp" | "sms" | "fax" | "social";
@@ -195,7 +195,7 @@ export declare const accountsService: {
195
195
  id: string;
196
196
  entityType: string;
197
197
  entityId: string;
198
- label: "service" | "primary" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
198
+ label: "primary" | "service" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
199
199
  fullText: string | null;
200
200
  line1: string | null;
201
201
  line2: string | null;
@@ -213,16 +213,16 @@ export declare const accountsService: {
213
213
  updatedAt: Date;
214
214
  }[]>;
215
215
  createAddress(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, entityType: "organization" | "person", entityId: string, data: import("./accounts-shared.js").CreateAddressInput): Promise<{
216
- metadata: Record<string, unknown> | null;
217
216
  id: string;
218
217
  createdAt: Date;
218
+ metadata: Record<string, unknown> | null;
219
219
  updatedAt: Date;
220
220
  notes: string | null;
221
221
  timezone: string | null;
222
222
  region: string | null;
223
223
  entityType: string;
224
224
  entityId: string;
225
- label: "service" | "primary" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
225
+ label: "primary" | "service" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
226
226
  isPrimary: boolean;
227
227
  fullText: string | null;
228
228
  line1: string | null;
@@ -237,7 +237,7 @@ export declare const accountsService: {
237
237
  id: string;
238
238
  entityType: string;
239
239
  entityId: string;
240
- label: "service" | "primary" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
240
+ label: "primary" | "service" | "other" | "legal" | "billing" | "shipping" | "mailing" | "meeting";
241
241
  fullText: string | null;
242
242
  line1: string | null;
243
243
  line2: string | null;
@@ -624,8 +624,8 @@ export declare const accountsService: {
624
624
  }>, "where" | "orderBy">;
625
625
  createOrganizationNote(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, organizationId: string, userId: string, data: import("./accounts-shared.js").CreateOrganizationNoteInput): Promise<{
626
626
  id: string;
627
- createdAt: Date;
628
627
  organizationId: string;
628
+ createdAt: Date;
629
629
  authorId: string;
630
630
  content: string;
631
631
  } | null | undefined>;
@@ -1042,8 +1042,8 @@ export declare const accountsService: {
1042
1042
  } | null>;
1043
1043
  deleteOrganizationNote(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, id: string): Promise<{
1044
1044
  id: string;
1045
- createdAt: Date;
1046
1045
  organizationId: string;
1046
+ createdAt: Date;
1047
1047
  authorId: string;
1048
1048
  content: string;
1049
1049
  } | null>;
@@ -1060,8 +1060,8 @@ export declare const accountsService: {
1060
1060
  }[]>;
1061
1061
  createCommunication(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, personId: string, data: import("./accounts-shared.js").CreateCommunicationLogInput): Promise<{
1062
1062
  id: string;
1063
- createdAt: Date;
1064
1063
  organizationId: string | null;
1064
+ createdAt: Date;
1065
1065
  personId: string;
1066
1066
  content: string | null;
1067
1067
  channel: "email" | "other" | "phone" | "whatsapp" | "sms" | "meeting";
@@ -1290,9 +1290,9 @@ export declare const accountsService: {
1290
1290
  createSegment(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, data: import("./accounts-shared.js").CreateSegmentInput): Promise<{
1291
1291
  name: string;
1292
1292
  id: string;
1293
+ description: string | null;
1293
1294
  createdAt: Date;
1294
1295
  updatedAt: Date;
1295
- description: string | null;
1296
1296
  conditions: Record<string, unknown> | null;
1297
1297
  } | undefined>;
1298
1298
  deleteSegment(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, segmentId: string): Promise<{
@@ -1359,13 +1359,13 @@ export declare const accountsService: {
1359
1359
  archivedAt: Date | null;
1360
1360
  } | null>;
1361
1361
  createOrganization(db: import("drizzle-orm/postgres-js").PostgresJsDatabase, data: import("./accounts-shared.js").CreateOrganizationInput): Promise<{
1362
- source: string | null;
1363
- relation: "partner" | "supplier" | "other" | "client" | null;
1364
1362
  name: string;
1365
1363
  id: string;
1364
+ status: "active" | "inactive" | "archived";
1366
1365
  createdAt: Date;
1366
+ source: string | null;
1367
+ relation: "partner" | "supplier" | "other" | "client" | null;
1367
1368
  updatedAt: Date;
1368
- status: "active" | "inactive" | "archived";
1369
1369
  notes: string | null;
1370
1370
  website: string | null;
1371
1371
  legalName: string | null;
@@ -13,7 +13,7 @@ export declare const activitiesService: {
13
13
  subject: string;
14
14
  type: "email" | "meeting" | "call" | "task" | "follow_up" | "note";
15
15
  ownerId: string | null;
16
- status: "done" | "cancelled" | "planned";
16
+ status: "cancelled" | "done" | "planned";
17
17
  dueAt: Date | null;
18
18
  completedAt: Date | null;
19
19
  location: string | null;
@@ -30,7 +30,7 @@ export declare const activitiesService: {
30
30
  subject: string;
31
31
  type: "email" | "meeting" | "call" | "task" | "follow_up" | "note";
32
32
  ownerId: string | null;
33
- status: "done" | "cancelled" | "planned";
33
+ status: "cancelled" | "done" | "planned";
34
34
  dueAt: Date | null;
35
35
  completedAt: Date | null;
36
36
  location: string | null;
@@ -39,12 +39,12 @@ export declare const activitiesService: {
39
39
  updatedAt: Date;
40
40
  } | null>;
41
41
  createActivity(db: PostgresJsDatabase, data: CreateActivityInput): Promise<{
42
+ type: "email" | "meeting" | "call" | "task" | "follow_up" | "note";
42
43
  id: string;
44
+ description: string | null;
45
+ status: "cancelled" | "done" | "planned";
43
46
  createdAt: Date;
44
47
  updatedAt: Date;
45
- status: "done" | "cancelled" | "planned";
46
- type: "email" | "meeting" | "call" | "task" | "follow_up" | "note";
47
- description: string | null;
48
48
  ownerId: string | null;
49
49
  subject: string;
50
50
  dueAt: Date | null;
@@ -56,7 +56,7 @@ export declare const activitiesService: {
56
56
  subject: string;
57
57
  type: "email" | "meeting" | "call" | "task" | "follow_up" | "note";
58
58
  ownerId: string | null;
59
- status: "done" | "cancelled" | "planned";
59
+ status: "cancelled" | "done" | "planned";
60
60
  dueAt: Date | null;
61
61
  completedAt: Date | null;
62
62
  location: string | null;
@@ -13,7 +13,7 @@ export declare const customFieldsService: {
13
13
  entityType: "organization" | "person" | "opportunity" | "quote" | "activity";
14
14
  key: string;
15
15
  label: string;
16
- fieldType: "boolean" | "json" | "text" | "date" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
16
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
17
17
  isRequired: boolean;
18
18
  isSearchable: boolean;
19
19
  options: {
@@ -32,7 +32,7 @@ export declare const customFieldsService: {
32
32
  entityType: "organization" | "person" | "opportunity" | "quote" | "activity";
33
33
  key: string;
34
34
  label: string;
35
- fieldType: "boolean" | "json" | "text" | "date" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
35
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
36
36
  isRequired: boolean;
37
37
  isSearchable: boolean;
38
38
  options: {
@@ -43,17 +43,17 @@ export declare const customFieldsService: {
43
43
  updatedAt: Date;
44
44
  } | null>;
45
45
  createCustomFieldDefinition(db: PostgresJsDatabase, data: CreateCustomFieldDefinitionInput): Promise<{
46
- key: string;
47
46
  id: string;
48
- createdAt: Date;
49
- updatedAt: Date;
50
47
  options: {
51
48
  label: string;
52
49
  value: string;
53
50
  }[] | null;
51
+ createdAt: Date;
52
+ key: string;
53
+ updatedAt: Date;
54
54
  entityType: "organization" | "person" | "opportunity" | "quote" | "activity";
55
55
  label: string;
56
- fieldType: "boolean" | "json" | "text" | "date" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
56
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
57
57
  isRequired: boolean;
58
58
  isSearchable: boolean;
59
59
  } | undefined>;
@@ -62,7 +62,7 @@ export declare const customFieldsService: {
62
62
  entityType: "organization" | "person" | "opportunity" | "quote" | "activity";
63
63
  key: string;
64
64
  label: string;
65
- fieldType: "boolean" | "json" | "text" | "date" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
65
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
66
66
  isRequired: boolean;
67
67
  isSearchable: boolean;
68
68
  options: {
@@ -87,7 +87,7 @@ export declare const customFieldsService: {
87
87
  booleanValue: boolean | null;
88
88
  monetaryValueCents: number | null;
89
89
  currencyCode: string | null;
90
- jsonValue: Record<string, unknown> | string[] | null;
90
+ jsonValue: string[] | Record<string, unknown> | null;
91
91
  createdAt: Date;
92
92
  updatedAt: Date;
93
93
  }[];
@@ -108,7 +108,7 @@ export declare const customFieldsService: {
108
108
  booleanValue: boolean | null;
109
109
  monetaryValueCents: number | null;
110
110
  currencyCode: string | null;
111
- jsonValue: Record<string, unknown> | string[] | null;
111
+ jsonValue: string[] | Record<string, unknown> | null;
112
112
  } | undefined>;
113
113
  deleteCustomFieldValue(db: PostgresJsDatabase, id: string): Promise<{
114
114
  id: string;
@@ -15,9 +15,9 @@ export declare const customerSignalsService: {
15
15
  personId: string;
16
16
  productId: string | null;
17
17
  optionUnitId: string | null;
18
- kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
18
+ kind: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
19
19
  source: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
20
- status: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
20
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
21
21
  priority: string;
22
22
  notes: string | null;
23
23
  tags: string[];
@@ -112,7 +112,7 @@ export declare const customerSignalsService: {
112
112
  tableName: "customer_signals";
113
113
  dataType: "string";
114
114
  columnType: "PgEnumColumn";
115
- data: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
115
+ data: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
116
116
  driverParam: string;
117
117
  notNull: true;
118
118
  hasDefault: false;
@@ -146,7 +146,7 @@ export declare const customerSignalsService: {
146
146
  tableName: "customer_signals";
147
147
  dataType: "string";
148
148
  columnType: "PgEnumColumn";
149
- data: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
149
+ data: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
150
150
  driverParam: string;
151
151
  notNull: true;
152
152
  hasDefault: true;
@@ -337,9 +337,9 @@ export declare const customerSignalsService: {
337
337
  personId: string;
338
338
  productId: string | null;
339
339
  optionUnitId: string | null;
340
- kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
340
+ kind: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
341
341
  source: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
342
- status: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
342
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
343
343
  priority: string;
344
344
  notes: string | null;
345
345
  tags: string[];
@@ -424,7 +424,7 @@ export declare const customerSignalsService: {
424
424
  tableName: "customer_signals";
425
425
  dataType: "string";
426
426
  columnType: "PgEnumColumn";
427
- data: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
427
+ data: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
428
428
  driverParam: string;
429
429
  notNull: true;
430
430
  hasDefault: false;
@@ -458,7 +458,7 @@ export declare const customerSignalsService: {
458
458
  tableName: "customer_signals";
459
459
  dataType: "string";
460
460
  columnType: "PgEnumColumn";
461
- data: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
461
+ data: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
462
462
  driverParam: string;
463
463
  notNull: true;
464
464
  hasDefault: true;
@@ -650,9 +650,9 @@ export declare const customerSignalsService: {
650
650
  personId: string;
651
651
  productId: string | null;
652
652
  optionUnitId: string | null;
653
- kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
653
+ kind: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
654
654
  source: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
655
- status: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
655
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
656
656
  priority: string;
657
657
  notes: string | null;
658
658
  tags: string[];
@@ -665,14 +665,14 @@ export declare const customerSignalsService: {
665
665
  updatedAt: Date;
666
666
  } | null>;
667
667
  createCustomerSignal(db: PostgresJsDatabase, data: CreateCustomerSignalInput): Promise<{
668
- source: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
669
- metadata: Record<string, unknown> | null;
670
668
  id: string;
669
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
671
670
  createdAt: Date;
671
+ source: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
672
+ metadata: Record<string, unknown> | null;
672
673
  updatedAt: Date;
673
- status: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
674
674
  notes: string | null;
675
- kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
675
+ kind: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
676
676
  tags: string[];
677
677
  personId: string;
678
678
  productId: string | null;
@@ -688,9 +688,9 @@ export declare const customerSignalsService: {
688
688
  personId: string;
689
689
  productId: string | null;
690
690
  optionUnitId: string | null;
691
- kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
691
+ kind: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
692
692
  source: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
693
- status: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
693
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
694
694
  priority: string;
695
695
  notes: string | null;
696
696
  tags: string[];
@@ -715,9 +715,9 @@ export declare const customerSignalsService: {
715
715
  personId: string;
716
716
  productId: string | null;
717
717
  optionUnitId: string | null;
718
- kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
718
+ kind: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
719
719
  source: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
720
- status: "new" | "contacted" | "qualified" | "converted" | "lost" | "expired";
720
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
721
721
  priority: string;
722
722
  notes: string | null;
723
723
  tags: string[];