@voyant-travel/relationships 0.119.2

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 (96) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +36 -0
  3. package/dist/action-ledger-capabilities.d.ts +20 -0
  4. package/dist/action-ledger-capabilities.d.ts.map +1 -0
  5. package/dist/action-ledger-capabilities.js +16 -0
  6. package/dist/events.d.ts +23 -0
  7. package/dist/events.d.ts.map +1 -0
  8. package/dist/events.js +9 -0
  9. package/dist/index.d.ts +32 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +49 -0
  12. package/dist/route-runtime.d.ts +21 -0
  13. package/dist/route-runtime.d.ts.map +1 -0
  14. package/dist/route-runtime.js +28 -0
  15. package/dist/routes/accounts.d.ts +1460 -0
  16. package/dist/routes/accounts.d.ts.map +1 -0
  17. package/dist/routes/accounts.js +274 -0
  18. package/dist/routes/activities.d.ts +299 -0
  19. package/dist/routes/activities.d.ts.map +1 -0
  20. package/dist/routes/activities.js +64 -0
  21. package/dist/routes/custom-fields.d.ts +256 -0
  22. package/dist/routes/custom-fields.d.ts.map +1 -0
  23. package/dist/routes/custom-fields.js +47 -0
  24. package/dist/routes/customer-signals.d.ts +281 -0
  25. package/dist/routes/customer-signals.d.ts.map +1 -0
  26. package/dist/routes/customer-signals.js +45 -0
  27. package/dist/routes/index.d.ts +2945 -0
  28. package/dist/routes/index.d.ts.map +1 -0
  29. package/dist/routes/index.js +14 -0
  30. package/dist/routes/person-documents.d.ts +519 -0
  31. package/dist/routes/person-documents.d.ts.map +1 -0
  32. package/dist/routes/person-documents.js +240 -0
  33. package/dist/routes/person-relationships.d.ts +189 -0
  34. package/dist/routes/person-relationships.d.ts.map +1 -0
  35. package/dist/routes/person-relationships.js +36 -0
  36. package/dist/schema-accounts.d.ts +2099 -0
  37. package/dist/schema-accounts.d.ts.map +1 -0
  38. package/dist/schema-accounts.js +312 -0
  39. package/dist/schema-activities.d.ts +821 -0
  40. package/dist/schema-activities.d.ts.map +1 -0
  41. package/dist/schema-activities.js +92 -0
  42. package/dist/schema-relations.d.ts +47 -0
  43. package/dist/schema-relations.d.ts.map +1 -0
  44. package/dist/schema-relations.js +70 -0
  45. package/dist/schema-shared.d.ts +10 -0
  46. package/dist/schema-shared.d.ts.map +1 -0
  47. package/dist/schema-shared.js +36 -0
  48. package/dist/schema-signals.d.ts +324 -0
  49. package/dist/schema-signals.d.ts.map +1 -0
  50. package/dist/schema-signals.js +80 -0
  51. package/dist/schema.d.ts +6 -0
  52. package/dist/schema.d.ts.map +1 -0
  53. package/dist/schema.js +5 -0
  54. package/dist/service/accounts-merge.d.ts +63 -0
  55. package/dist/service/accounts-merge.d.ts.map +1 -0
  56. package/dist/service/accounts-merge.js +382 -0
  57. package/dist/service/accounts-organizations.d.ts +97 -0
  58. package/dist/service/accounts-organizations.d.ts.map +1 -0
  59. package/dist/service/accounts-organizations.js +70 -0
  60. package/dist/service/accounts-people.d.ts +1315 -0
  61. package/dist/service/accounts-people.d.ts.map +1 -0
  62. package/dist/service/accounts-people.js +409 -0
  63. package/dist/service/accounts-resolve.d.ts +76 -0
  64. package/dist/service/accounts-resolve.d.ts.map +1 -0
  65. package/dist/service/accounts-resolve.js +103 -0
  66. package/dist/service/accounts-shared.d.ts +68 -0
  67. package/dist/service/accounts-shared.d.ts.map +1 -0
  68. package/dist/service/accounts-shared.js +149 -0
  69. package/dist/service/accounts.d.ts +1465 -0
  70. package/dist/service/accounts.d.ts.map +1 -0
  71. package/dist/service/accounts.js +13 -0
  72. package/dist/service/activities.d.ts +486 -0
  73. package/dist/service/activities.d.ts.map +1 -0
  74. package/dist/service/activities.js +114 -0
  75. package/dist/service/custom-fields.d.ts +118 -0
  76. package/dist/service/custom-fields.d.ts.map +1 -0
  77. package/dist/service/custom-fields.js +88 -0
  78. package/dist/service/customer-signals.d.ts +733 -0
  79. package/dist/service/customer-signals.d.ts.map +1 -0
  80. package/dist/service/customer-signals.js +112 -0
  81. package/dist/service/helpers.d.ts +22 -0
  82. package/dist/service/helpers.d.ts.map +1 -0
  83. package/dist/service/helpers.js +39 -0
  84. package/dist/service/index.d.ts +4434 -0
  85. package/dist/service/index.d.ts.map +1 -0
  86. package/dist/service/index.js +17 -0
  87. package/dist/service/person-documents.d.ts +1201 -0
  88. package/dist/service/person-documents.d.ts.map +1 -0
  89. package/dist/service/person-documents.js +240 -0
  90. package/dist/service/person-relationships.d.ts +502 -0
  91. package/dist/service/person-relationships.d.ts.map +1 -0
  92. package/dist/service/person-relationships.js +121 -0
  93. package/dist/validation.d.ts +3 -0
  94. package/dist/validation.d.ts.map +1 -0
  95. package/dist/validation.js +1 -0
  96. package/package.json +80 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-activities.d.ts","sourceRoot":"","sources":["../src/schema-activities.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBtB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBzB,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBhC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAUgB,MAAM;uBAAS,MAAM;;;;;;;;;;;;;;uBAArB,MAAM;uBAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASvE,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkC7B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA;AACrD,MAAM,MAAM,WAAW,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA;AACxD,MAAM,MAAM,YAAY,GAAG,OAAO,aAAa,CAAC,YAAY,CAAA;AAC5D,MAAM,MAAM,eAAe,GAAG,OAAO,aAAa,CAAC,YAAY,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA;AAC1E,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA;AAC7E,MAAM,MAAM,qBAAqB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AACjF,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA;AACpE,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA"}
@@ -0,0 +1,92 @@
1
+ import { typeId, typeIdRef } from "@voyant-travel/db/lib/typeid-column";
2
+ import { boolean, date, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
3
+ import { people } from "./schema-accounts.js";
4
+ import { activityLinkRoleEnum, activityStatusEnum, activityTypeEnum, customFieldTypeEnum, entityTypeEnum, } from "./schema-shared.js";
5
+ export const activities = pgTable("activities", {
6
+ id: typeId("activities"),
7
+ subject: text("subject").notNull(),
8
+ type: activityTypeEnum("type").notNull(),
9
+ ownerId: text("owner_id"),
10
+ status: activityStatusEnum("status").notNull().default("planned"),
11
+ dueAt: timestamp("due_at", { withTimezone: true }),
12
+ completedAt: timestamp("completed_at", { withTimezone: true }),
13
+ location: text("location"),
14
+ description: text("description"),
15
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
16
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
17
+ }, (table) => [
18
+ index("idx_activities_owner").on(table.ownerId),
19
+ index("idx_activities_status").on(table.status),
20
+ index("idx_activities_type").on(table.type),
21
+ index("idx_activities_owner_updated").on(table.ownerId, table.updatedAt),
22
+ index("idx_activities_status_updated").on(table.status, table.updatedAt),
23
+ index("idx_activities_type_updated").on(table.type, table.updatedAt),
24
+ ]);
25
+ export const activityLinks = pgTable("activity_links", {
26
+ id: typeId("activity_links"),
27
+ activityId: typeIdRef("activity_id")
28
+ .notNull()
29
+ .references(() => activities.id, { onDelete: "cascade" }),
30
+ entityType: entityTypeEnum("entity_type").notNull(),
31
+ entityId: text("entity_id").notNull(),
32
+ role: activityLinkRoleEnum("role").notNull().default("related"),
33
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
34
+ }, (table) => [
35
+ index("idx_activity_links_activity").on(table.activityId),
36
+ index("idx_activity_links_activity_role").on(table.activityId, table.role, table.createdAt),
37
+ index("idx_activity_links_entity").on(table.entityType, table.entityId),
38
+ ]);
39
+ export const activityParticipants = pgTable("activity_participants", {
40
+ id: typeId("activity_participants"),
41
+ activityId: typeIdRef("activity_id")
42
+ .notNull()
43
+ .references(() => activities.id, { onDelete: "cascade" }),
44
+ personId: typeIdRef("person_id")
45
+ .notNull()
46
+ .references(() => people.id, { onDelete: "cascade" }),
47
+ isPrimary: boolean("is_primary").notNull().default(false),
48
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
49
+ }, (table) => [
50
+ index("idx_activity_participants_activity").on(table.activityId),
51
+ index("idx_activity_participants_activity_primary").on(table.activityId, table.isPrimary, table.createdAt),
52
+ uniqueIndex("uidx_activity_participants_unique").on(table.activityId, table.personId),
53
+ ]);
54
+ export const customFieldDefinitions = pgTable("custom_field_definitions", {
55
+ id: typeId("custom_field_definitions"),
56
+ entityType: entityTypeEnum("entity_type").notNull(),
57
+ key: text("key").notNull(),
58
+ label: text("label").notNull(),
59
+ fieldType: customFieldTypeEnum("field_type").notNull(),
60
+ isRequired: boolean("is_required").notNull().default(false),
61
+ isSearchable: boolean("is_searchable").notNull().default(false),
62
+ options: jsonb("options").$type(),
63
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
64
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
65
+ }, (table) => [
66
+ index("idx_custom_field_definitions_entity").on(table.entityType),
67
+ index("idx_custom_field_definitions_entity_label").on(table.entityType, table.label),
68
+ uniqueIndex("uidx_custom_field_definitions_key").on(table.entityType, table.key),
69
+ ]);
70
+ export const customFieldValues = pgTable("custom_field_values", {
71
+ id: typeId("custom_field_values"),
72
+ definitionId: typeIdRef("definition_id")
73
+ .notNull()
74
+ .references(() => customFieldDefinitions.id, { onDelete: "cascade" }),
75
+ entityType: entityTypeEnum("entity_type").notNull(),
76
+ entityId: text("entity_id").notNull(),
77
+ textValue: text("text_value"),
78
+ numberValue: integer("number_value"),
79
+ dateValue: date("date_value"),
80
+ booleanValue: boolean("boolean_value"),
81
+ monetaryValueCents: integer("monetary_value_cents"),
82
+ currencyCode: text("currency_code"),
83
+ jsonValue: jsonb("json_value").$type(),
84
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
85
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
86
+ }, (table) => [
87
+ index("idx_custom_field_values_entity").on(table.entityType, table.entityId),
88
+ index("idx_custom_field_values_entity_type_updated").on(table.entityType, table.updatedAt),
89
+ index("idx_custom_field_values_entity_updated").on(table.entityType, table.entityId, table.updatedAt),
90
+ index("idx_custom_field_values_definition_updated").on(table.definitionId, table.updatedAt),
91
+ uniqueIndex("uidx_custom_field_values_unique").on(table.definitionId, table.entityType, table.entityId),
92
+ ]);
@@ -0,0 +1,47 @@
1
+ export declare const organizationsRelations: import("drizzle-orm").Relations<"organizations", {
2
+ people: import("drizzle-orm").Many<"people">;
3
+ notes: import("drizzle-orm").Many<"organization_notes">;
4
+ communications: import("drizzle-orm").Many<"communication_log">;
5
+ }>;
6
+ export declare const peopleRelations: import("drizzle-orm").Relations<"people", {
7
+ organization: import("drizzle-orm").One<"organizations", false>;
8
+ activityParticipants: import("drizzle-orm").Many<"activity_participants">;
9
+ notes: import("drizzle-orm").Many<"person_notes">;
10
+ communications: import("drizzle-orm").Many<"communication_log">;
11
+ segmentMemberships: import("drizzle-orm").Many<"segment_members">;
12
+ }>;
13
+ export declare const activitiesRelations: import("drizzle-orm").Relations<"activities", {
14
+ links: import("drizzle-orm").Many<"activity_links">;
15
+ participants: import("drizzle-orm").Many<"activity_participants">;
16
+ }>;
17
+ export declare const activityLinksRelations: import("drizzle-orm").Relations<"activity_links", {
18
+ activity: import("drizzle-orm").One<"activities", true>;
19
+ }>;
20
+ export declare const activityParticipantsRelations: import("drizzle-orm").Relations<"activity_participants", {
21
+ activity: import("drizzle-orm").One<"activities", true>;
22
+ person: import("drizzle-orm").One<"people", true>;
23
+ }>;
24
+ export declare const customFieldDefinitionsRelations: import("drizzle-orm").Relations<"custom_field_definitions", {
25
+ values: import("drizzle-orm").Many<"custom_field_values">;
26
+ }>;
27
+ export declare const customFieldValuesRelations: import("drizzle-orm").Relations<"custom_field_values", {
28
+ definition: import("drizzle-orm").One<"custom_field_definitions", true>;
29
+ }>;
30
+ export declare const personNotesRelations: import("drizzle-orm").Relations<"person_notes", {
31
+ person: import("drizzle-orm").One<"people", true>;
32
+ }>;
33
+ export declare const organizationNotesRelations: import("drizzle-orm").Relations<"organization_notes", {
34
+ organization: import("drizzle-orm").One<"organizations", true>;
35
+ }>;
36
+ export declare const communicationLogRelations: import("drizzle-orm").Relations<"communication_log", {
37
+ person: import("drizzle-orm").One<"people", true>;
38
+ organization: import("drizzle-orm").One<"organizations", false>;
39
+ }>;
40
+ export declare const segmentsRelations: import("drizzle-orm").Relations<"segments", {
41
+ members: import("drizzle-orm").Many<"segment_members">;
42
+ }>;
43
+ export declare const segmentMembersRelations: import("drizzle-orm").Relations<"segment_members", {
44
+ segment: import("drizzle-orm").One<"segments", true>;
45
+ person: import("drizzle-orm").One<"people", true>;
46
+ }>;
47
+ //# sourceMappingURL=schema-relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-relations.d.ts","sourceRoot":"","sources":["../src/schema-relations.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,sBAAsB;;;;EAIhC,CAAA;AAEH,eAAO,MAAM,eAAe;;;;;;EASzB,CAAA;AAEH,eAAO,MAAM,mBAAmB;;;EAG7B,CAAA;AAEH,eAAO,MAAM,sBAAsB;;EAKhC,CAAA;AAEH,eAAO,MAAM,6BAA6B;;;EASvC,CAAA;AAEH,eAAO,MAAM,+BAA+B;;EAEzC,CAAA;AAEH,eAAO,MAAM,0BAA0B;;EAKpC,CAAA;AAEH,eAAO,MAAM,oBAAoB;;EAE9B,CAAA;AAEH,eAAO,MAAM,0BAA0B;;EAKpC,CAAA;AAEH,eAAO,MAAM,yBAAyB;;;EAMnC,CAAA;AAEH,eAAO,MAAM,iBAAiB;;EAE3B,CAAA;AAEH,eAAO,MAAM,uBAAuB;;;EAGjC,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { relations } from "drizzle-orm";
2
+ import { communicationLog, organizationNotes, organizations, people, personNotes, segmentMembers, segments, } from "./schema-accounts.js";
3
+ import { activities, activityLinks, activityParticipants, customFieldDefinitions, customFieldValues, } from "./schema-activities.js";
4
+ export const organizationsRelations = relations(organizations, ({ many }) => ({
5
+ people: many(people),
6
+ notes: many(organizationNotes),
7
+ communications: many(communicationLog),
8
+ }));
9
+ export const peopleRelations = relations(people, ({ one, many }) => ({
10
+ organization: one(organizations, {
11
+ fields: [people.organizationId],
12
+ references: [organizations.id],
13
+ }),
14
+ activityParticipants: many(activityParticipants),
15
+ notes: many(personNotes),
16
+ communications: many(communicationLog),
17
+ segmentMemberships: many(segmentMembers),
18
+ }));
19
+ export const activitiesRelations = relations(activities, ({ many }) => ({
20
+ links: many(activityLinks),
21
+ participants: many(activityParticipants),
22
+ }));
23
+ export const activityLinksRelations = relations(activityLinks, ({ one }) => ({
24
+ activity: one(activities, {
25
+ fields: [activityLinks.activityId],
26
+ references: [activities.id],
27
+ }),
28
+ }));
29
+ export const activityParticipantsRelations = relations(activityParticipants, ({ one }) => ({
30
+ activity: one(activities, {
31
+ fields: [activityParticipants.activityId],
32
+ references: [activities.id],
33
+ }),
34
+ person: one(people, {
35
+ fields: [activityParticipants.personId],
36
+ references: [people.id],
37
+ }),
38
+ }));
39
+ export const customFieldDefinitionsRelations = relations(customFieldDefinitions, ({ many }) => ({
40
+ values: many(customFieldValues),
41
+ }));
42
+ export const customFieldValuesRelations = relations(customFieldValues, ({ one }) => ({
43
+ definition: one(customFieldDefinitions, {
44
+ fields: [customFieldValues.definitionId],
45
+ references: [customFieldDefinitions.id],
46
+ }),
47
+ }));
48
+ export const personNotesRelations = relations(personNotes, ({ one }) => ({
49
+ person: one(people, { fields: [personNotes.personId], references: [people.id] }),
50
+ }));
51
+ export const organizationNotesRelations = relations(organizationNotes, ({ one }) => ({
52
+ organization: one(organizations, {
53
+ fields: [organizationNotes.organizationId],
54
+ references: [organizations.id],
55
+ }),
56
+ }));
57
+ export const communicationLogRelations = relations(communicationLog, ({ one }) => ({
58
+ person: one(people, { fields: [communicationLog.personId], references: [people.id] }),
59
+ organization: one(organizations, {
60
+ fields: [communicationLog.organizationId],
61
+ references: [organizations.id],
62
+ }),
63
+ }));
64
+ export const segmentsRelations = relations(segments, ({ many }) => ({
65
+ members: many(segmentMembers),
66
+ }));
67
+ export const segmentMembersRelations = relations(segmentMembers, ({ one }) => ({
68
+ segment: one(segments, { fields: [segmentMembers.segmentId], references: [segments.id] }),
69
+ person: one(people, { fields: [segmentMembers.personId], references: [people.id] }),
70
+ }));
@@ -0,0 +1,10 @@
1
+ export declare const entityTypeEnum: import("drizzle-orm/pg-core").PgEnum<["organization", "person", "quote", "activity"]>;
2
+ export declare const relationTypeEnum: import("drizzle-orm/pg-core").PgEnum<["client", "partner", "supplier", "other"]>;
3
+ export declare const communicationChannelEnum: import("drizzle-orm/pg-core").PgEnum<["email", "phone", "whatsapp", "sms", "meeting", "other"]>;
4
+ export declare const communicationDirectionEnum: import("drizzle-orm/pg-core").PgEnum<["inbound", "outbound"]>;
5
+ export declare const recordStatusEnum: import("drizzle-orm/pg-core").PgEnum<["active", "inactive", "archived"]>;
6
+ export declare const activityTypeEnum: import("drizzle-orm/pg-core").PgEnum<["call", "email", "meeting", "task", "follow_up", "note"]>;
7
+ export declare const activityStatusEnum: import("drizzle-orm/pg-core").PgEnum<["planned", "done", "cancelled"]>;
8
+ export declare const activityLinkRoleEnum: import("drizzle-orm/pg-core").PgEnum<["primary", "related"]>;
9
+ export declare const customFieldTypeEnum: import("drizzle-orm/pg-core").PgEnum<["varchar", "text", "double", "monetary", "date", "boolean", "enum", "set", "json", "address", "phone"]>;
10
+ //# sourceMappingURL=schema-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-shared.d.ts","sourceRoot":"","sources":["../src/schema-shared.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,uFAAyE,CAAA;AAEpG,eAAO,MAAM,gBAAgB,kFAAsE,CAAA;AAEnG,eAAO,MAAM,wBAAwB,iGAOnC,CAAA;AAEF,eAAO,MAAM,0BAA0B,+DAA6D,CAAA;AAEpG,eAAO,MAAM,gBAAgB,0EAA8D,CAAA;AAE3F,eAAO,MAAM,gBAAgB,iGAO3B,CAAA;AAEF,eAAO,MAAM,kBAAkB,wEAA8D,CAAA;AAE7F,eAAO,MAAM,oBAAoB,8DAAuD,CAAA;AAExF,eAAO,MAAM,mBAAmB,+IAY9B,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { pgEnum } from "drizzle-orm/pg-core";
2
+ export const entityTypeEnum = pgEnum("entity_type", ["organization", "person", "quote", "activity"]);
3
+ export const relationTypeEnum = pgEnum("relation_type", ["client", "partner", "supplier", "other"]);
4
+ export const communicationChannelEnum = pgEnum("communication_channel", [
5
+ "email",
6
+ "phone",
7
+ "whatsapp",
8
+ "sms",
9
+ "meeting",
10
+ "other",
11
+ ]);
12
+ export const communicationDirectionEnum = pgEnum("communication_direction", ["inbound", "outbound"]);
13
+ export const recordStatusEnum = pgEnum("record_status", ["active", "inactive", "archived"]);
14
+ export const activityTypeEnum = pgEnum("activity_type", [
15
+ "call",
16
+ "email",
17
+ "meeting",
18
+ "task",
19
+ "follow_up",
20
+ "note",
21
+ ]);
22
+ export const activityStatusEnum = pgEnum("activity_status", ["planned", "done", "cancelled"]);
23
+ export const activityLinkRoleEnum = pgEnum("activity_link_role", ["primary", "related"]);
24
+ export const customFieldTypeEnum = pgEnum("custom_field_type", [
25
+ "varchar",
26
+ "text",
27
+ "double",
28
+ "monetary",
29
+ "date",
30
+ "boolean",
31
+ "enum",
32
+ "set",
33
+ "json",
34
+ "address",
35
+ "phone",
36
+ ]);
@@ -0,0 +1,324 @@
1
+ /**
2
+ * Customer signals — lighter than `quotes` (no deal value or
3
+ * stages), heavier than `segments` (lifecycle + assignment). Records
4
+ * "person X expressed interest in product/departure Y from source Z,
5
+ * status pending". The most common use cases:
6
+ *
7
+ * - Notify-availability ("ping me when this departure opens up")
8
+ * - Wishlist / saved trips
9
+ * - Inquiry captured by an operator (phone call, web form)
10
+ * - Request-offer pre-pipeline that may or may not become a booking
11
+ * - Abandoned-cart recovery
12
+ *
13
+ * Cross-module IDs (`productId`, `optionUnitId`, `resolvedBookingId`)
14
+ * are intentionally plain `text()` columns rather than FK references
15
+ * — voyant's project-wide rule is that cross-module FKs go through
16
+ * link tables or stay loose. The signal is owned by CRM; products
17
+ * and bookings reference its id, not the other way around.
18
+ */
19
+ export declare const customerSignalKindEnum: import("drizzle-orm/pg-core").PgEnum<["wishlist", "notify", "inquiry", "request_offer", "referral"]>;
20
+ export declare const customerSignalSourceEnum: import("drizzle-orm/pg-core").PgEnum<["form", "phone", "admin", "abandoned_cart", "website", "booking"]>;
21
+ export declare const customerSignalStatusEnum: import("drizzle-orm/pg-core").PgEnum<["new", "contacted", "qualified", "converted", "lost", "expired"]>;
22
+ export declare const customerSignals: import("drizzle-orm/pg-core").PgTableWithColumns<{
23
+ name: "customer_signals";
24
+ schema: undefined;
25
+ columns: {
26
+ id: import("drizzle-orm/pg-core").PgColumn<{
27
+ name: string;
28
+ tableName: "customer_signals";
29
+ dataType: "string";
30
+ columnType: "PgText";
31
+ data: string;
32
+ driverParam: string;
33
+ notNull: true;
34
+ hasDefault: true;
35
+ isPrimaryKey: true;
36
+ isAutoincrement: false;
37
+ hasRuntimeDefault: true;
38
+ enumValues: [string, ...string[]];
39
+ baseColumn: never;
40
+ identity: undefined;
41
+ generated: undefined;
42
+ }, {}, {}>;
43
+ personId: import("drizzle-orm/pg-core").PgColumn<{
44
+ name: string;
45
+ tableName: "customer_signals";
46
+ dataType: "string";
47
+ columnType: "PgText";
48
+ data: string;
49
+ driverParam: string;
50
+ notNull: true;
51
+ hasDefault: false;
52
+ isPrimaryKey: false;
53
+ isAutoincrement: false;
54
+ hasRuntimeDefault: false;
55
+ enumValues: [string, ...string[]];
56
+ baseColumn: never;
57
+ identity: undefined;
58
+ generated: undefined;
59
+ }, {}, {}>;
60
+ productId: import("drizzle-orm/pg-core").PgColumn<{
61
+ name: "product_id";
62
+ tableName: "customer_signals";
63
+ dataType: "string";
64
+ columnType: "PgText";
65
+ data: string;
66
+ driverParam: string;
67
+ notNull: false;
68
+ hasDefault: false;
69
+ isPrimaryKey: false;
70
+ isAutoincrement: false;
71
+ hasRuntimeDefault: false;
72
+ enumValues: [string, ...string[]];
73
+ baseColumn: never;
74
+ identity: undefined;
75
+ generated: undefined;
76
+ }, {}, {}>;
77
+ optionUnitId: import("drizzle-orm/pg-core").PgColumn<{
78
+ name: "option_unit_id";
79
+ tableName: "customer_signals";
80
+ dataType: "string";
81
+ columnType: "PgText";
82
+ data: string;
83
+ driverParam: string;
84
+ notNull: false;
85
+ hasDefault: false;
86
+ isPrimaryKey: false;
87
+ isAutoincrement: false;
88
+ hasRuntimeDefault: false;
89
+ enumValues: [string, ...string[]];
90
+ baseColumn: never;
91
+ identity: undefined;
92
+ generated: undefined;
93
+ }, {}, {}>;
94
+ kind: import("drizzle-orm/pg-core").PgColumn<{
95
+ name: "kind";
96
+ tableName: "customer_signals";
97
+ dataType: "string";
98
+ columnType: "PgEnumColumn";
99
+ data: "notify" | "wishlist" | "inquiry" | "request_offer" | "referral";
100
+ driverParam: string;
101
+ notNull: true;
102
+ hasDefault: false;
103
+ isPrimaryKey: false;
104
+ isAutoincrement: false;
105
+ hasRuntimeDefault: false;
106
+ enumValues: ["wishlist", "notify", "inquiry", "request_offer", "referral"];
107
+ baseColumn: never;
108
+ identity: undefined;
109
+ generated: undefined;
110
+ }, {}, {}>;
111
+ source: import("drizzle-orm/pg-core").PgColumn<{
112
+ name: "source";
113
+ tableName: "customer_signals";
114
+ dataType: "string";
115
+ columnType: "PgEnumColumn";
116
+ data: "admin" | "form" | "phone" | "abandoned_cart" | "website" | "booking";
117
+ driverParam: string;
118
+ notNull: true;
119
+ hasDefault: false;
120
+ isPrimaryKey: false;
121
+ isAutoincrement: false;
122
+ hasRuntimeDefault: false;
123
+ enumValues: ["form", "phone", "admin", "abandoned_cart", "website", "booking"];
124
+ baseColumn: never;
125
+ identity: undefined;
126
+ generated: undefined;
127
+ }, {}, {}>;
128
+ status: import("drizzle-orm/pg-core").PgColumn<{
129
+ name: "status";
130
+ tableName: "customer_signals";
131
+ dataType: "string";
132
+ columnType: "PgEnumColumn";
133
+ data: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
134
+ driverParam: string;
135
+ notNull: true;
136
+ hasDefault: true;
137
+ isPrimaryKey: false;
138
+ isAutoincrement: false;
139
+ hasRuntimeDefault: false;
140
+ enumValues: ["new", "contacted", "qualified", "converted", "lost", "expired"];
141
+ baseColumn: never;
142
+ identity: undefined;
143
+ generated: undefined;
144
+ }, {}, {}>;
145
+ priority: import("drizzle-orm/pg-core").PgColumn<{
146
+ name: "priority";
147
+ tableName: "customer_signals";
148
+ dataType: "string";
149
+ columnType: "PgText";
150
+ data: string;
151
+ driverParam: string;
152
+ notNull: true;
153
+ hasDefault: true;
154
+ isPrimaryKey: false;
155
+ isAutoincrement: false;
156
+ hasRuntimeDefault: false;
157
+ enumValues: [string, ...string[]];
158
+ baseColumn: never;
159
+ identity: undefined;
160
+ generated: undefined;
161
+ }, {}, {}>;
162
+ notes: import("drizzle-orm/pg-core").PgColumn<{
163
+ name: "notes";
164
+ tableName: "customer_signals";
165
+ dataType: "string";
166
+ columnType: "PgText";
167
+ data: string;
168
+ driverParam: string;
169
+ notNull: false;
170
+ hasDefault: false;
171
+ isPrimaryKey: false;
172
+ isAutoincrement: false;
173
+ hasRuntimeDefault: false;
174
+ enumValues: [string, ...string[]];
175
+ baseColumn: never;
176
+ identity: undefined;
177
+ generated: undefined;
178
+ }, {}, {}>;
179
+ tags: import("drizzle-orm/pg-core").PgColumn<{
180
+ name: "tags";
181
+ tableName: "customer_signals";
182
+ dataType: "json";
183
+ columnType: "PgJsonb";
184
+ data: string[];
185
+ driverParam: unknown;
186
+ notNull: true;
187
+ hasDefault: true;
188
+ isPrimaryKey: false;
189
+ isAutoincrement: false;
190
+ hasRuntimeDefault: false;
191
+ enumValues: undefined;
192
+ baseColumn: never;
193
+ identity: undefined;
194
+ generated: undefined;
195
+ }, {}, {
196
+ $type: string[];
197
+ }>;
198
+ assignedToUserId: import("drizzle-orm/pg-core").PgColumn<{
199
+ name: "assigned_to_user_id";
200
+ tableName: "customer_signals";
201
+ dataType: "string";
202
+ columnType: "PgText";
203
+ data: string;
204
+ driverParam: string;
205
+ notNull: false;
206
+ hasDefault: false;
207
+ isPrimaryKey: false;
208
+ isAutoincrement: false;
209
+ hasRuntimeDefault: false;
210
+ enumValues: [string, ...string[]];
211
+ baseColumn: never;
212
+ identity: undefined;
213
+ generated: undefined;
214
+ }, {}, {}>;
215
+ followUpAt: import("drizzle-orm/pg-core").PgColumn<{
216
+ name: "follow_up_at";
217
+ tableName: "customer_signals";
218
+ dataType: "date";
219
+ columnType: "PgTimestamp";
220
+ data: Date;
221
+ driverParam: string;
222
+ notNull: false;
223
+ hasDefault: false;
224
+ isPrimaryKey: false;
225
+ isAutoincrement: false;
226
+ hasRuntimeDefault: false;
227
+ enumValues: undefined;
228
+ baseColumn: never;
229
+ identity: undefined;
230
+ generated: undefined;
231
+ }, {}, {}>;
232
+ resolvedBookingId: import("drizzle-orm/pg-core").PgColumn<{
233
+ name: "resolved_booking_id";
234
+ tableName: "customer_signals";
235
+ dataType: "string";
236
+ columnType: "PgText";
237
+ data: string;
238
+ driverParam: string;
239
+ notNull: false;
240
+ hasDefault: false;
241
+ isPrimaryKey: false;
242
+ isAutoincrement: false;
243
+ hasRuntimeDefault: false;
244
+ enumValues: [string, ...string[]];
245
+ baseColumn: never;
246
+ identity: undefined;
247
+ generated: undefined;
248
+ }, {}, {}>;
249
+ sourceSubmissionId: import("drizzle-orm/pg-core").PgColumn<{
250
+ name: "source_submission_id";
251
+ tableName: "customer_signals";
252
+ dataType: "string";
253
+ columnType: "PgText";
254
+ data: string;
255
+ driverParam: string;
256
+ notNull: false;
257
+ hasDefault: false;
258
+ isPrimaryKey: false;
259
+ isAutoincrement: false;
260
+ hasRuntimeDefault: false;
261
+ enumValues: [string, ...string[]];
262
+ baseColumn: never;
263
+ identity: undefined;
264
+ generated: undefined;
265
+ }, {}, {}>;
266
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
267
+ name: "metadata";
268
+ tableName: "customer_signals";
269
+ dataType: "json";
270
+ columnType: "PgJsonb";
271
+ data: Record<string, unknown>;
272
+ driverParam: unknown;
273
+ notNull: false;
274
+ hasDefault: false;
275
+ isPrimaryKey: false;
276
+ isAutoincrement: false;
277
+ hasRuntimeDefault: false;
278
+ enumValues: undefined;
279
+ baseColumn: never;
280
+ identity: undefined;
281
+ generated: undefined;
282
+ }, {}, {
283
+ $type: Record<string, unknown>;
284
+ }>;
285
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
286
+ name: "created_at";
287
+ tableName: "customer_signals";
288
+ dataType: "date";
289
+ columnType: "PgTimestamp";
290
+ data: Date;
291
+ driverParam: string;
292
+ notNull: true;
293
+ hasDefault: true;
294
+ isPrimaryKey: false;
295
+ isAutoincrement: false;
296
+ hasRuntimeDefault: false;
297
+ enumValues: undefined;
298
+ baseColumn: never;
299
+ identity: undefined;
300
+ generated: undefined;
301
+ }, {}, {}>;
302
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
303
+ name: "updated_at";
304
+ tableName: "customer_signals";
305
+ dataType: "date";
306
+ columnType: "PgTimestamp";
307
+ data: Date;
308
+ driverParam: string;
309
+ notNull: true;
310
+ hasDefault: true;
311
+ isPrimaryKey: false;
312
+ isAutoincrement: false;
313
+ hasRuntimeDefault: false;
314
+ enumValues: undefined;
315
+ baseColumn: never;
316
+ identity: undefined;
317
+ generated: undefined;
318
+ }, {}, {}>;
319
+ };
320
+ dialect: "pg";
321
+ }>;
322
+ export type CustomerSignal = typeof customerSignals.$inferSelect;
323
+ export type NewCustomerSignal = typeof customerSignals.$inferInsert;
324
+ //# sourceMappingURL=schema-signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-signals.d.ts","sourceRoot":"","sources":["../src/schema-signals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,eAAO,MAAM,sBAAsB,sGAMjC,CAAA;AAEF,eAAO,MAAM,wBAAwB,0GAOnC,CAAA;AAEF,eAAO,MAAM,wBAAwB,yGAOnC,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2C3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,YAAY,CAAA;AAChE,MAAM,MAAM,iBAAiB,GAAG,OAAO,eAAe,CAAC,YAAY,CAAA"}