@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,256 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ type Env = {
3
+ Variables: {
4
+ db: PostgresJsDatabase;
5
+ userId?: string;
6
+ };
7
+ };
8
+ export declare const customFieldRoutes: import("hono/hono-base").HonoBase<Env, {
9
+ "/custom-fields": {
10
+ $get: {
11
+ input: {};
12
+ output: {
13
+ data: {
14
+ id: string;
15
+ entityType: "person" | "organization" | "quote" | "activity";
16
+ key: string;
17
+ label: string;
18
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
19
+ isRequired: boolean;
20
+ isSearchable: boolean;
21
+ options: {
22
+ label: string;
23
+ value: string;
24
+ }[] | null;
25
+ createdAt: string;
26
+ updatedAt: string;
27
+ }[];
28
+ total: number;
29
+ limit: number;
30
+ offset: number;
31
+ };
32
+ outputFormat: "json";
33
+ status: import("hono/utils/http-status").ContentfulStatusCode;
34
+ };
35
+ };
36
+ } & {
37
+ "/custom-fields": {
38
+ $post: {
39
+ input: {};
40
+ output: {
41
+ data: {
42
+ id: string;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ entityType: "person" | "organization" | "quote" | "activity";
46
+ label: string;
47
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
48
+ key: string;
49
+ isRequired: boolean;
50
+ isSearchable: boolean;
51
+ options: {
52
+ label: string;
53
+ value: string;
54
+ }[] | null;
55
+ } | undefined;
56
+ };
57
+ outputFormat: "json";
58
+ status: 201;
59
+ };
60
+ };
61
+ } & {
62
+ "/custom-fields/:id": {
63
+ $get: {
64
+ input: {
65
+ param: {
66
+ id: string;
67
+ };
68
+ };
69
+ output: {
70
+ error: string;
71
+ };
72
+ outputFormat: "json";
73
+ status: 404;
74
+ } | {
75
+ input: {
76
+ param: {
77
+ id: string;
78
+ };
79
+ };
80
+ output: {
81
+ data: {
82
+ id: string;
83
+ entityType: "person" | "organization" | "quote" | "activity";
84
+ key: string;
85
+ label: string;
86
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
87
+ isRequired: boolean;
88
+ isSearchable: boolean;
89
+ options: {
90
+ label: string;
91
+ value: string;
92
+ }[] | null;
93
+ createdAt: string;
94
+ updatedAt: string;
95
+ };
96
+ };
97
+ outputFormat: "json";
98
+ status: import("hono/utils/http-status").ContentfulStatusCode;
99
+ };
100
+ };
101
+ } & {
102
+ "/custom-fields/:id": {
103
+ $patch: {
104
+ input: {
105
+ param: {
106
+ id: string;
107
+ };
108
+ };
109
+ output: {
110
+ error: string;
111
+ };
112
+ outputFormat: "json";
113
+ status: 404;
114
+ } | {
115
+ input: {
116
+ param: {
117
+ id: string;
118
+ };
119
+ };
120
+ output: {
121
+ data: {
122
+ id: string;
123
+ entityType: "person" | "organization" | "quote" | "activity";
124
+ key: string;
125
+ label: string;
126
+ fieldType: "boolean" | "json" | "date" | "text" | "set" | "enum" | "phone" | "varchar" | "double" | "monetary" | "address";
127
+ isRequired: boolean;
128
+ isSearchable: boolean;
129
+ options: {
130
+ label: string;
131
+ value: string;
132
+ }[] | null;
133
+ createdAt: string;
134
+ updatedAt: string;
135
+ };
136
+ };
137
+ outputFormat: "json";
138
+ status: import("hono/utils/http-status").ContentfulStatusCode;
139
+ };
140
+ };
141
+ } & {
142
+ "/custom-fields/:id": {
143
+ $delete: {
144
+ input: {
145
+ param: {
146
+ id: string;
147
+ };
148
+ };
149
+ output: {
150
+ error: string;
151
+ };
152
+ outputFormat: "json";
153
+ status: 404;
154
+ } | {
155
+ input: {
156
+ param: {
157
+ id: string;
158
+ };
159
+ };
160
+ output: {
161
+ success: true;
162
+ };
163
+ outputFormat: "json";
164
+ status: import("hono/utils/http-status").ContentfulStatusCode;
165
+ };
166
+ };
167
+ } & {
168
+ "/custom-field-values": {
169
+ $get: {
170
+ input: {};
171
+ output: {
172
+ data: {
173
+ id: string;
174
+ definitionId: string;
175
+ entityType: "person" | "organization" | "quote" | "activity";
176
+ entityId: string;
177
+ textValue: string | null;
178
+ numberValue: number | null;
179
+ dateValue: string | null;
180
+ booleanValue: boolean | null;
181
+ monetaryValueCents: number | null;
182
+ currencyCode: string | null;
183
+ jsonValue: string[] | {
184
+ [x: string]: import("hono/utils/types").JSONValue;
185
+ } | null;
186
+ createdAt: string;
187
+ updatedAt: string;
188
+ }[];
189
+ total: number;
190
+ limit: number;
191
+ offset: number;
192
+ };
193
+ outputFormat: "json";
194
+ status: import("hono/utils/http-status").ContentfulStatusCode;
195
+ };
196
+ };
197
+ } & {
198
+ "/custom-fields/:id/value": {
199
+ $put: {
200
+ input: {
201
+ param: {
202
+ id: string;
203
+ };
204
+ };
205
+ output: {
206
+ data: {
207
+ id: string;
208
+ createdAt: string;
209
+ updatedAt: string;
210
+ entityType: "person" | "organization" | "quote" | "activity";
211
+ entityId: string;
212
+ definitionId: string;
213
+ textValue: string | null;
214
+ numberValue: number | null;
215
+ dateValue: string | null;
216
+ booleanValue: boolean | null;
217
+ monetaryValueCents: number | null;
218
+ currencyCode: string | null;
219
+ jsonValue: string[] | {
220
+ [x: string]: import("hono/utils/types").JSONValue;
221
+ } | null;
222
+ } | undefined;
223
+ };
224
+ outputFormat: "json";
225
+ status: 200;
226
+ };
227
+ };
228
+ } & {
229
+ "/custom-field-values/:id": {
230
+ $delete: {
231
+ input: {
232
+ param: {
233
+ id: string;
234
+ };
235
+ };
236
+ output: {
237
+ error: string;
238
+ };
239
+ outputFormat: "json";
240
+ status: 404;
241
+ } | {
242
+ input: {
243
+ param: {
244
+ id: string;
245
+ };
246
+ };
247
+ output: {
248
+ success: true;
249
+ };
250
+ outputFormat: "json";
251
+ status: import("hono/utils/http-status").ContentfulStatusCode;
252
+ };
253
+ };
254
+ }, "/", "/custom-field-values/:id">;
255
+ export {};
256
+ //# sourceMappingURL=custom-fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-fields.d.ts","sourceRoot":"","sources":["../../src/routes/custom-fields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAYjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCA6D1B,CAAA"}
@@ -0,0 +1,47 @@
1
+ import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
2
+ import { Hono } from "hono";
3
+ import { relationshipsService } from "../service/index.js";
4
+ import { customFieldDefinitionListQuerySchema, customFieldValueListQuerySchema, insertCustomFieldDefinitionSchema, updateCustomFieldDefinitionSchema, upsertCustomFieldValueSchema, } from "../validation.js";
5
+ export const customFieldRoutes = new Hono()
6
+ .get("/custom-fields", async (c) => {
7
+ const query = await parseQuery(c, customFieldDefinitionListQuerySchema);
8
+ return c.json(await relationshipsService.listCustomFieldDefinitions(c.get("db"), query));
9
+ })
10
+ .post("/custom-fields", async (c) => {
11
+ return c.json({
12
+ data: await relationshipsService.createCustomFieldDefinition(c.get("db"), await parseJsonBody(c, insertCustomFieldDefinitionSchema)),
13
+ }, 201);
14
+ })
15
+ .get("/custom-fields/:id", async (c) => {
16
+ const row = await relationshipsService.getCustomFieldDefinitionById(c.get("db"), c.req.param("id"));
17
+ if (!row)
18
+ return c.json({ error: "Custom field not found" }, 404);
19
+ return c.json({ data: row });
20
+ })
21
+ .patch("/custom-fields/:id", async (c) => {
22
+ const row = await relationshipsService.updateCustomFieldDefinition(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateCustomFieldDefinitionSchema));
23
+ if (!row)
24
+ return c.json({ error: "Custom field not found" }, 404);
25
+ return c.json({ data: row });
26
+ })
27
+ .delete("/custom-fields/:id", async (c) => {
28
+ const row = await relationshipsService.deleteCustomFieldDefinition(c.get("db"), c.req.param("id"));
29
+ if (!row)
30
+ return c.json({ error: "Custom field not found" }, 404);
31
+ return c.json({ success: true });
32
+ })
33
+ .get("/custom-field-values", async (c) => {
34
+ const query = await parseQuery(c, customFieldValueListQuerySchema);
35
+ return c.json(await relationshipsService.listCustomFieldValues(c.get("db"), query));
36
+ })
37
+ .put("/custom-fields/:id/value", async (c) => {
38
+ return c.json({
39
+ data: await relationshipsService.upsertCustomFieldValue(c.get("db"), c.req.param("id"), await parseJsonBody(c, upsertCustomFieldValueSchema)),
40
+ }, 200);
41
+ })
42
+ .delete("/custom-field-values/:id", async (c) => {
43
+ const row = await relationshipsService.deleteCustomFieldValue(c.get("db"), c.req.param("id"));
44
+ if (!row)
45
+ return c.json({ error: "Custom field value not found" }, 404);
46
+ return c.json({ success: true });
47
+ });
@@ -0,0 +1,281 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ type Env = {
3
+ Variables: {
4
+ db: PostgresJsDatabase;
5
+ userId?: string;
6
+ };
7
+ };
8
+ export declare const customerSignalRoutes: import("hono/hono-base").HonoBase<Env, {
9
+ "/customer-signals": {
10
+ $get: {
11
+ input: {};
12
+ output: {
13
+ data: {
14
+ id: string;
15
+ personId: string;
16
+ productId: string | null;
17
+ optionUnitId: string | null;
18
+ kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
19
+ source: "website" | "phone" | "form" | "admin" | "abandoned_cart" | "booking";
20
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
21
+ priority: string;
22
+ notes: string | null;
23
+ tags: string[];
24
+ assignedToUserId: string | null;
25
+ followUpAt: string | null;
26
+ resolvedBookingId: string | null;
27
+ sourceSubmissionId: string | null;
28
+ metadata: {
29
+ [x: string]: import("hono/utils/types").JSONValue;
30
+ } | null;
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ }[];
34
+ total: number;
35
+ limit: number;
36
+ offset: number;
37
+ };
38
+ outputFormat: "json";
39
+ status: import("hono/utils/http-status").ContentfulStatusCode;
40
+ };
41
+ };
42
+ } & {
43
+ "/customer-signals": {
44
+ $post: {
45
+ input: {};
46
+ output: {
47
+ error: string;
48
+ };
49
+ outputFormat: "json";
50
+ status: 404;
51
+ } | {
52
+ input: {};
53
+ output: {
54
+ data: {
55
+ id: string;
56
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
57
+ createdAt: string;
58
+ updatedAt: string;
59
+ source: "website" | "phone" | "form" | "admin" | "abandoned_cart" | "booking";
60
+ tags: string[];
61
+ notes: string | null;
62
+ kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
63
+ metadata: {
64
+ [x: string]: import("hono/utils/types").JSONValue;
65
+ } | null;
66
+ personId: string;
67
+ assignedToUserId: string | null;
68
+ productId: string | null;
69
+ optionUnitId: string | null;
70
+ priority: string;
71
+ followUpAt: string | null;
72
+ resolvedBookingId: string | null;
73
+ sourceSubmissionId: string | null;
74
+ };
75
+ };
76
+ outputFormat: "json";
77
+ status: 201;
78
+ };
79
+ };
80
+ } & {
81
+ "/customer-signals/:id": {
82
+ $get: {
83
+ input: {
84
+ param: {
85
+ id: string;
86
+ };
87
+ };
88
+ output: {
89
+ error: string;
90
+ };
91
+ outputFormat: "json";
92
+ status: 404;
93
+ } | {
94
+ input: {
95
+ param: {
96
+ id: string;
97
+ };
98
+ };
99
+ output: {
100
+ data: {
101
+ id: string;
102
+ personId: string;
103
+ productId: string | null;
104
+ optionUnitId: string | null;
105
+ kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
106
+ source: "website" | "phone" | "form" | "admin" | "abandoned_cart" | "booking";
107
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
108
+ priority: string;
109
+ notes: string | null;
110
+ tags: string[];
111
+ assignedToUserId: string | null;
112
+ followUpAt: string | null;
113
+ resolvedBookingId: string | null;
114
+ sourceSubmissionId: string | null;
115
+ metadata: {
116
+ [x: string]: import("hono/utils/types").JSONValue;
117
+ } | null;
118
+ createdAt: string;
119
+ updatedAt: string;
120
+ };
121
+ };
122
+ outputFormat: "json";
123
+ status: import("hono/utils/http-status").ContentfulStatusCode;
124
+ };
125
+ };
126
+ } & {
127
+ "/customer-signals/:id": {
128
+ $patch: {
129
+ input: {
130
+ param: {
131
+ id: string;
132
+ };
133
+ };
134
+ output: {
135
+ error: string;
136
+ };
137
+ outputFormat: "json";
138
+ status: 404;
139
+ } | {
140
+ input: {
141
+ param: {
142
+ id: string;
143
+ };
144
+ };
145
+ output: {
146
+ data: {
147
+ id: string;
148
+ personId: string;
149
+ productId: string | null;
150
+ optionUnitId: string | null;
151
+ kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
152
+ source: "website" | "phone" | "form" | "admin" | "abandoned_cart" | "booking";
153
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
154
+ priority: string;
155
+ notes: string | null;
156
+ tags: string[];
157
+ assignedToUserId: string | null;
158
+ followUpAt: string | null;
159
+ resolvedBookingId: string | null;
160
+ sourceSubmissionId: string | null;
161
+ metadata: {
162
+ [x: string]: import("hono/utils/types").JSONValue;
163
+ } | null;
164
+ createdAt: string;
165
+ updatedAt: string;
166
+ };
167
+ };
168
+ outputFormat: "json";
169
+ status: import("hono/utils/http-status").ContentfulStatusCode;
170
+ };
171
+ };
172
+ } & {
173
+ "/customer-signals/:id": {
174
+ $delete: {
175
+ input: {
176
+ param: {
177
+ id: string;
178
+ };
179
+ };
180
+ output: {
181
+ error: string;
182
+ };
183
+ outputFormat: "json";
184
+ status: 404;
185
+ } | {
186
+ input: {
187
+ param: {
188
+ id: string;
189
+ };
190
+ };
191
+ output: {
192
+ success: true;
193
+ };
194
+ outputFormat: "json";
195
+ status: import("hono/utils/http-status").ContentfulStatusCode;
196
+ };
197
+ };
198
+ } & {
199
+ "/customer-signals/:id/resolve": {
200
+ $post: {
201
+ input: {
202
+ param: {
203
+ id: string;
204
+ };
205
+ };
206
+ output: {
207
+ error: string;
208
+ };
209
+ outputFormat: "json";
210
+ status: 404;
211
+ } | {
212
+ input: {
213
+ param: {
214
+ id: string;
215
+ };
216
+ };
217
+ output: {
218
+ data: {
219
+ id: string;
220
+ personId: string;
221
+ productId: string | null;
222
+ optionUnitId: string | null;
223
+ kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
224
+ source: "website" | "phone" | "form" | "admin" | "abandoned_cart" | "booking";
225
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
226
+ priority: string;
227
+ notes: string | null;
228
+ tags: string[];
229
+ assignedToUserId: string | null;
230
+ followUpAt: string | null;
231
+ resolvedBookingId: string | null;
232
+ sourceSubmissionId: string | null;
233
+ metadata: {
234
+ [x: string]: import("hono/utils/types").JSONValue;
235
+ } | null;
236
+ createdAt: string;
237
+ updatedAt: string;
238
+ };
239
+ };
240
+ outputFormat: "json";
241
+ status: import("hono/utils/http-status").ContentfulStatusCode;
242
+ };
243
+ };
244
+ } & {
245
+ "/people/:id/signals": {
246
+ $get: {
247
+ input: {
248
+ param: {
249
+ id: string;
250
+ };
251
+ };
252
+ output: {
253
+ data: {
254
+ id: string;
255
+ personId: string;
256
+ productId: string | null;
257
+ optionUnitId: string | null;
258
+ kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
259
+ source: "website" | "phone" | "form" | "admin" | "abandoned_cart" | "booking";
260
+ status: "expired" | "new" | "contacted" | "qualified" | "converted" | "lost";
261
+ priority: string;
262
+ notes: string | null;
263
+ tags: string[];
264
+ assignedToUserId: string | null;
265
+ followUpAt: string | null;
266
+ resolvedBookingId: string | null;
267
+ sourceSubmissionId: string | null;
268
+ metadata: {
269
+ [x: string]: import("hono/utils/types").JSONValue;
270
+ } | null;
271
+ createdAt: string;
272
+ updatedAt: string;
273
+ }[];
274
+ };
275
+ outputFormat: "json";
276
+ status: import("hono/utils/http-status").ContentfulStatusCode;
277
+ };
278
+ };
279
+ }, "/", "/people/:id/signals">;
280
+ export {};
281
+ //# sourceMappingURL=customer-signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-signals.d.ts","sourceRoot":"","sources":["../../src/routes/customer-signals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA8C7B,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
2
+ import { Hono } from "hono";
3
+ import { relationshipsService } from "../service/index.js";
4
+ import { customerSignalListQuerySchema, insertCustomerSignalSchema, resolveCustomerSignalSchema, updateCustomerSignalSchema, } from "../validation.js";
5
+ export const customerSignalRoutes = new Hono()
6
+ .get("/customer-signals", async (c) => {
7
+ const query = parseQuery(c, customerSignalListQuerySchema);
8
+ return c.json(await relationshipsService.listCustomerSignals(c.get("db"), query));
9
+ })
10
+ .post("/customer-signals", async (c) => {
11
+ const row = await relationshipsService.createCustomerSignal(c.get("db"), await parseJsonBody(c, insertCustomerSignalSchema));
12
+ if (!row)
13
+ return c.json({ error: "Person not found" }, 404);
14
+ return c.json({ data: row }, 201);
15
+ })
16
+ .get("/customer-signals/:id", async (c) => {
17
+ const row = await relationshipsService.getCustomerSignal(c.get("db"), c.req.param("id"));
18
+ if (!row)
19
+ return c.json({ error: "Signal not found" }, 404);
20
+ return c.json({ data: row });
21
+ })
22
+ .patch("/customer-signals/:id", async (c) => {
23
+ const row = await relationshipsService.updateCustomerSignal(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateCustomerSignalSchema));
24
+ if (!row)
25
+ return c.json({ error: "Signal not found" }, 404);
26
+ return c.json({ data: row });
27
+ })
28
+ .delete("/customer-signals/:id", async (c) => {
29
+ const row = await relationshipsService.deleteCustomerSignal(c.get("db"), c.req.param("id"));
30
+ if (!row)
31
+ return c.json({ error: "Signal not found" }, 404);
32
+ return c.json({ success: true });
33
+ })
34
+ .post("/customer-signals/:id/resolve", async (c) => {
35
+ const body = await parseJsonBody(c, resolveCustomerSignalSchema);
36
+ const row = await relationshipsService.resolveCustomerSignalToBooking(c.get("db"), c.req.param("id"), body.bookingId);
37
+ if (!row)
38
+ return c.json({ error: "Signal not found" }, 404);
39
+ return c.json({ data: row });
40
+ })
41
+ .get("/people/:id/signals", async (c) => {
42
+ return c.json({
43
+ data: await relationshipsService.listSignalsForPerson(c.get("db"), c.req.param("id")),
44
+ });
45
+ });