@voyantjs/identity 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,406 @@
1
+ import { z } from "zod";
2
+ export declare const contactPointKindSchema: z.ZodEnum<{
3
+ email: "email";
4
+ phone: "phone";
5
+ mobile: "mobile";
6
+ whatsapp: "whatsapp";
7
+ website: "website";
8
+ sms: "sms";
9
+ fax: "fax";
10
+ social: "social";
11
+ other: "other";
12
+ }>;
13
+ export declare const addressLabelSchema: z.ZodEnum<{
14
+ other: "other";
15
+ primary: "primary";
16
+ billing: "billing";
17
+ shipping: "shipping";
18
+ mailing: "mailing";
19
+ meeting: "meeting";
20
+ service: "service";
21
+ legal: "legal";
22
+ }>;
23
+ export declare const namedContactRoleSchema: z.ZodEnum<{
24
+ other: "other";
25
+ primary: "primary";
26
+ legal: "legal";
27
+ general: "general";
28
+ reservations: "reservations";
29
+ operations: "operations";
30
+ front_desk: "front_desk";
31
+ sales: "sales";
32
+ emergency: "emergency";
33
+ accounting: "accounting";
34
+ }>;
35
+ export declare const insertContactPointSchema: z.ZodObject<{
36
+ entityType: z.ZodString;
37
+ entityId: z.ZodString;
38
+ kind: z.ZodEnum<{
39
+ email: "email";
40
+ phone: "phone";
41
+ mobile: "mobile";
42
+ whatsapp: "whatsapp";
43
+ website: "website";
44
+ sms: "sms";
45
+ fax: "fax";
46
+ social: "social";
47
+ other: "other";
48
+ }>;
49
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ value: z.ZodString;
51
+ normalizedValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
53
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
55
+ }, z.core.$strip>;
56
+ export declare const updateContactPointSchema: z.ZodObject<{
57
+ entityType: z.ZodOptional<z.ZodString>;
58
+ entityId: z.ZodOptional<z.ZodString>;
59
+ kind: z.ZodOptional<z.ZodEnum<{
60
+ email: "email";
61
+ phone: "phone";
62
+ mobile: "mobile";
63
+ whatsapp: "whatsapp";
64
+ website: "website";
65
+ sms: "sms";
66
+ fax: "fax";
67
+ social: "social";
68
+ other: "other";
69
+ }>>;
70
+ label: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
71
+ value: z.ZodOptional<z.ZodString>;
72
+ normalizedValue: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
73
+ isPrimary: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
74
+ notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
75
+ metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
76
+ }, z.core.$strip>;
77
+ export declare const insertContactPointForEntitySchema: z.ZodObject<{
78
+ value: z.ZodString;
79
+ kind: z.ZodEnum<{
80
+ email: "email";
81
+ phone: "phone";
82
+ mobile: "mobile";
83
+ whatsapp: "whatsapp";
84
+ website: "website";
85
+ sms: "sms";
86
+ fax: "fax";
87
+ social: "social";
88
+ other: "other";
89
+ }>;
90
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
+ normalizedValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
93
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
95
+ }, z.core.$strip>;
96
+ export declare const contactPointListQuerySchema: z.ZodObject<{
97
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
98
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
99
+ entityType: z.ZodOptional<z.ZodString>;
100
+ entityId: z.ZodOptional<z.ZodString>;
101
+ kind: z.ZodOptional<z.ZodEnum<{
102
+ email: "email";
103
+ phone: "phone";
104
+ mobile: "mobile";
105
+ whatsapp: "whatsapp";
106
+ website: "website";
107
+ sms: "sms";
108
+ fax: "fax";
109
+ social: "social";
110
+ other: "other";
111
+ }>>;
112
+ isPrimary: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
113
+ 0: "0";
114
+ 1: "1";
115
+ true: "true";
116
+ false: "false";
117
+ }>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
118
+ search: z.ZodOptional<z.ZodString>;
119
+ }, z.core.$strip>;
120
+ export declare const selectContactPointSchema: z.ZodObject<{
121
+ entityType: z.ZodString;
122
+ entityId: z.ZodString;
123
+ kind: z.ZodEnum<{
124
+ email: "email";
125
+ phone: "phone";
126
+ mobile: "mobile";
127
+ whatsapp: "whatsapp";
128
+ website: "website";
129
+ sms: "sms";
130
+ fax: "fax";
131
+ social: "social";
132
+ other: "other";
133
+ }>;
134
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ value: z.ZodString;
136
+ normalizedValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
137
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
138
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
140
+ id: z.ZodString;
141
+ createdAt: z.ZodCoercedDate<unknown>;
142
+ updatedAt: z.ZodCoercedDate<unknown>;
143
+ }, z.core.$strip>;
144
+ export type InsertContactPoint = z.infer<typeof insertContactPointSchema>;
145
+ export type UpdateContactPoint = z.infer<typeof updateContactPointSchema>;
146
+ export type InsertContactPointForEntity = z.infer<typeof insertContactPointForEntitySchema>;
147
+ export type SelectContactPoint = z.infer<typeof selectContactPointSchema>;
148
+ export declare const insertAddressSchema: z.ZodObject<{
149
+ entityType: z.ZodString;
150
+ entityId: z.ZodString;
151
+ label: z.ZodDefault<z.ZodEnum<{
152
+ other: "other";
153
+ primary: "primary";
154
+ billing: "billing";
155
+ shipping: "shipping";
156
+ mailing: "mailing";
157
+ meeting: "meeting";
158
+ service: "service";
159
+ legal: "legal";
160
+ }>>;
161
+ fullText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
162
+ line1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
163
+ line2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
165
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
166
+ postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
+ country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
168
+ latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
169
+ longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
170
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
172
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
174
+ }, z.core.$strip>;
175
+ export declare const updateAddressSchema: z.ZodObject<{
176
+ entityType: z.ZodOptional<z.ZodString>;
177
+ entityId: z.ZodOptional<z.ZodString>;
178
+ label: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
179
+ other: "other";
180
+ primary: "primary";
181
+ billing: "billing";
182
+ shipping: "shipping";
183
+ mailing: "mailing";
184
+ meeting: "meeting";
185
+ service: "service";
186
+ legal: "legal";
187
+ }>>>;
188
+ fullText: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
189
+ line1: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
190
+ line2: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
191
+ city: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
192
+ region: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
193
+ postalCode: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
194
+ country: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
195
+ latitude: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
196
+ longitude: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
197
+ timezone: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
198
+ isPrimary: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
199
+ notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
200
+ metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
201
+ }, z.core.$strip>;
202
+ export declare const insertAddressForEntitySchema: z.ZodObject<{
203
+ label: z.ZodDefault<z.ZodEnum<{
204
+ other: "other";
205
+ primary: "primary";
206
+ billing: "billing";
207
+ shipping: "shipping";
208
+ mailing: "mailing";
209
+ meeting: "meeting";
210
+ service: "service";
211
+ legal: "legal";
212
+ }>>;
213
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
214
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
215
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
216
+ fullText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
+ line1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
218
+ line2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
219
+ city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
220
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
221
+ postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
222
+ country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
223
+ latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
224
+ longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
225
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
226
+ }, z.core.$strip>;
227
+ export declare const addressListQuerySchema: z.ZodObject<{
228
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
229
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
230
+ entityType: z.ZodOptional<z.ZodString>;
231
+ entityId: z.ZodOptional<z.ZodString>;
232
+ label: z.ZodOptional<z.ZodEnum<{
233
+ other: "other";
234
+ primary: "primary";
235
+ billing: "billing";
236
+ shipping: "shipping";
237
+ mailing: "mailing";
238
+ meeting: "meeting";
239
+ service: "service";
240
+ legal: "legal";
241
+ }>>;
242
+ isPrimary: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
243
+ 0: "0";
244
+ 1: "1";
245
+ true: "true";
246
+ false: "false";
247
+ }>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
248
+ search: z.ZodOptional<z.ZodString>;
249
+ }, z.core.$strip>;
250
+ export declare const selectAddressSchema: z.ZodObject<{
251
+ entityType: z.ZodString;
252
+ entityId: z.ZodString;
253
+ label: z.ZodDefault<z.ZodEnum<{
254
+ other: "other";
255
+ primary: "primary";
256
+ billing: "billing";
257
+ shipping: "shipping";
258
+ mailing: "mailing";
259
+ meeting: "meeting";
260
+ service: "service";
261
+ legal: "legal";
262
+ }>>;
263
+ fullText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
264
+ line1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
265
+ line2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
266
+ city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
267
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
268
+ postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
270
+ latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
271
+ longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
272
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
273
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
274
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
275
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
276
+ id: z.ZodString;
277
+ createdAt: z.ZodCoercedDate<unknown>;
278
+ updatedAt: z.ZodCoercedDate<unknown>;
279
+ }, z.core.$strip>;
280
+ export type InsertAddress = z.infer<typeof insertAddressSchema>;
281
+ export type UpdateAddress = z.infer<typeof updateAddressSchema>;
282
+ export type InsertAddressForEntity = z.infer<typeof insertAddressForEntitySchema>;
283
+ export type SelectAddress = z.infer<typeof selectAddressSchema>;
284
+ export declare const insertNamedContactSchema: z.ZodObject<{
285
+ entityType: z.ZodString;
286
+ entityId: z.ZodString;
287
+ role: z.ZodDefault<z.ZodEnum<{
288
+ other: "other";
289
+ primary: "primary";
290
+ legal: "legal";
291
+ general: "general";
292
+ reservations: "reservations";
293
+ operations: "operations";
294
+ front_desk: "front_desk";
295
+ sales: "sales";
296
+ emergency: "emergency";
297
+ accounting: "accounting";
298
+ }>>;
299
+ name: z.ZodString;
300
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
301
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
302
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
303
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
304
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
306
+ }, z.core.$strip>;
307
+ export declare const updateNamedContactSchema: z.ZodObject<{
308
+ entityType: z.ZodOptional<z.ZodString>;
309
+ entityId: z.ZodOptional<z.ZodString>;
310
+ role: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
311
+ other: "other";
312
+ primary: "primary";
313
+ legal: "legal";
314
+ general: "general";
315
+ reservations: "reservations";
316
+ operations: "operations";
317
+ front_desk: "front_desk";
318
+ sales: "sales";
319
+ emergency: "emergency";
320
+ accounting: "accounting";
321
+ }>>>;
322
+ name: z.ZodOptional<z.ZodString>;
323
+ title: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
324
+ email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
325
+ phone: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
326
+ isPrimary: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
327
+ notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
328
+ metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
329
+ }, z.core.$strip>;
330
+ export declare const insertNamedContactForEntitySchema: z.ZodObject<{
331
+ name: z.ZodString;
332
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
333
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
335
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
337
+ role: z.ZodDefault<z.ZodEnum<{
338
+ other: "other";
339
+ primary: "primary";
340
+ legal: "legal";
341
+ general: "general";
342
+ reservations: "reservations";
343
+ operations: "operations";
344
+ front_desk: "front_desk";
345
+ sales: "sales";
346
+ emergency: "emergency";
347
+ accounting: "accounting";
348
+ }>>;
349
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
350
+ }, z.core.$strip>;
351
+ export declare const namedContactListQuerySchema: z.ZodObject<{
352
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
353
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
354
+ entityType: z.ZodOptional<z.ZodString>;
355
+ entityId: z.ZodOptional<z.ZodString>;
356
+ role: z.ZodOptional<z.ZodEnum<{
357
+ other: "other";
358
+ primary: "primary";
359
+ legal: "legal";
360
+ general: "general";
361
+ reservations: "reservations";
362
+ operations: "operations";
363
+ front_desk: "front_desk";
364
+ sales: "sales";
365
+ emergency: "emergency";
366
+ accounting: "accounting";
367
+ }>>;
368
+ isPrimary: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
369
+ 0: "0";
370
+ 1: "1";
371
+ true: "true";
372
+ false: "false";
373
+ }>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
374
+ search: z.ZodOptional<z.ZodString>;
375
+ }, z.core.$strip>;
376
+ export declare const selectNamedContactSchema: z.ZodObject<{
377
+ entityType: z.ZodString;
378
+ entityId: z.ZodString;
379
+ role: z.ZodDefault<z.ZodEnum<{
380
+ other: "other";
381
+ primary: "primary";
382
+ legal: "legal";
383
+ general: "general";
384
+ reservations: "reservations";
385
+ operations: "operations";
386
+ front_desk: "front_desk";
387
+ sales: "sales";
388
+ emergency: "emergency";
389
+ accounting: "accounting";
390
+ }>>;
391
+ name: z.ZodString;
392
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
393
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
394
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
395
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
396
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
397
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
398
+ id: z.ZodString;
399
+ createdAt: z.ZodCoercedDate<unknown>;
400
+ updatedAt: z.ZodCoercedDate<unknown>;
401
+ }, z.core.$strip>;
402
+ export type InsertNamedContact = z.infer<typeof insertNamedContactSchema>;
403
+ export type UpdateNamedContact = z.infer<typeof updateNamedContactSchema>;
404
+ export type InsertNamedContactForEntity = z.infer<typeof insertNamedContactForEntitySchema>;
405
+ export type SelectNamedContact = z.infer<typeof selectNamedContactSchema>;
406
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,sBAAsB;;;;;;;;;;EAUjC,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;EAS7B,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;EAWjC,CAAA;AAmDF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;iBAAyB,CAAA;AAC9D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;iBAAmC,CAAA;AACxE,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;iBAG5C,CAAA;AACF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;iBAMtC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;iBAInC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAC3F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoB,CAAA;AACpD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8B,CAAA;AAC9D,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;iBAGvC,CAAA;AACF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;iBAMjC,CAAA;AACF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACjF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;iBAAyB,CAAA;AAC9D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;iBAAmC,CAAA;AACxE,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;iBAG5C,CAAA;AACF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;iBAMtC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;iBAInC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAC3F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,135 @@
1
+ import { booleanQueryParam } from "@voyantjs/db/helpers";
2
+ import { typeIdSchema } from "@voyantjs/db/lib/typeid";
3
+ import { z } from "zod";
4
+ export const contactPointKindSchema = z.enum([
5
+ "email",
6
+ "phone",
7
+ "mobile",
8
+ "whatsapp",
9
+ "website",
10
+ "sms",
11
+ "fax",
12
+ "social",
13
+ "other",
14
+ ]);
15
+ export const addressLabelSchema = z.enum([
16
+ "primary",
17
+ "billing",
18
+ "shipping",
19
+ "mailing",
20
+ "meeting",
21
+ "service",
22
+ "legal",
23
+ "other",
24
+ ]);
25
+ export const namedContactRoleSchema = z.enum([
26
+ "general",
27
+ "primary",
28
+ "reservations",
29
+ "operations",
30
+ "front_desk",
31
+ "sales",
32
+ "emergency",
33
+ "accounting",
34
+ "legal",
35
+ "other",
36
+ ]);
37
+ const paginationSchema = z.object({
38
+ limit: z.coerce.number().int().min(1).max(200).default(50),
39
+ offset: z.coerce.number().int().min(0).default(0),
40
+ });
41
+ const contactPointCoreSchema = z.object({
42
+ entityType: z.string().min(1).max(100),
43
+ entityId: z.string().min(1).max(100),
44
+ kind: contactPointKindSchema,
45
+ label: z.string().max(100).nullable().optional(),
46
+ value: z.string().min(1).max(500),
47
+ normalizedValue: z.string().max(500).nullable().optional(),
48
+ isPrimary: z.boolean().default(false),
49
+ notes: z.string().nullable().optional(),
50
+ metadata: z.record(z.string(), z.unknown()).nullable().optional(),
51
+ });
52
+ const addressCoreSchema = z.object({
53
+ entityType: z.string().min(1).max(100),
54
+ entityId: z.string().min(1).max(100),
55
+ label: addressLabelSchema.default("other"),
56
+ fullText: z.string().nullable().optional(),
57
+ line1: z.string().nullable().optional(),
58
+ line2: z.string().nullable().optional(),
59
+ city: z.string().nullable().optional(),
60
+ region: z.string().nullable().optional(),
61
+ postalCode: z.string().nullable().optional(),
62
+ country: z.string().nullable().optional(),
63
+ latitude: z.number().nullable().optional(),
64
+ longitude: z.number().nullable().optional(),
65
+ timezone: z.string().max(100).nullable().optional(),
66
+ isPrimary: z.boolean().default(false),
67
+ notes: z.string().nullable().optional(),
68
+ metadata: z.record(z.string(), z.unknown()).nullable().optional(),
69
+ });
70
+ const namedContactCoreSchema = z.object({
71
+ entityType: z.string().min(1).max(100),
72
+ entityId: z.string().min(1).max(100),
73
+ role: namedContactRoleSchema.default("general"),
74
+ name: z.string().min(1).max(255),
75
+ title: z.string().max(255).nullable().optional(),
76
+ email: z.string().email().nullable().optional(),
77
+ phone: z.string().max(50).nullable().optional(),
78
+ isPrimary: z.boolean().default(false),
79
+ notes: z.string().nullable().optional(),
80
+ metadata: z.record(z.string(), z.unknown()).nullable().optional(),
81
+ });
82
+ export const insertContactPointSchema = contactPointCoreSchema;
83
+ export const updateContactPointSchema = contactPointCoreSchema.partial();
84
+ export const insertContactPointForEntitySchema = contactPointCoreSchema.omit({
85
+ entityType: true,
86
+ entityId: true,
87
+ });
88
+ export const contactPointListQuerySchema = paginationSchema.extend({
89
+ entityType: z.string().max(100).optional(),
90
+ entityId: z.string().max(100).optional(),
91
+ kind: contactPointKindSchema.optional(),
92
+ isPrimary: booleanQueryParam.optional(),
93
+ search: z.string().optional(),
94
+ });
95
+ export const selectContactPointSchema = contactPointCoreSchema.extend({
96
+ id: typeIdSchema("identity_contact_points"),
97
+ createdAt: z.coerce.date(),
98
+ updatedAt: z.coerce.date(),
99
+ });
100
+ export const insertAddressSchema = addressCoreSchema;
101
+ export const updateAddressSchema = addressCoreSchema.partial();
102
+ export const insertAddressForEntitySchema = addressCoreSchema.omit({
103
+ entityType: true,
104
+ entityId: true,
105
+ });
106
+ export const addressListQuerySchema = paginationSchema.extend({
107
+ entityType: z.string().max(100).optional(),
108
+ entityId: z.string().max(100).optional(),
109
+ label: addressLabelSchema.optional(),
110
+ isPrimary: booleanQueryParam.optional(),
111
+ search: z.string().optional(),
112
+ });
113
+ export const selectAddressSchema = addressCoreSchema.extend({
114
+ id: typeIdSchema("identity_addresses"),
115
+ createdAt: z.coerce.date(),
116
+ updatedAt: z.coerce.date(),
117
+ });
118
+ export const insertNamedContactSchema = namedContactCoreSchema;
119
+ export const updateNamedContactSchema = namedContactCoreSchema.partial();
120
+ export const insertNamedContactForEntitySchema = namedContactCoreSchema.omit({
121
+ entityType: true,
122
+ entityId: true,
123
+ });
124
+ export const namedContactListQuerySchema = paginationSchema.extend({
125
+ entityType: z.string().max(100).optional(),
126
+ entityId: z.string().max(100).optional(),
127
+ role: namedContactRoleSchema.optional(),
128
+ isPrimary: booleanQueryParam.optional(),
129
+ search: z.string().optional(),
130
+ });
131
+ export const selectNamedContactSchema = namedContactCoreSchema.extend({
132
+ id: typeIdSchema("identity_named_contacts"),
133
+ createdAt: z.coerce.date(),
134
+ updatedAt: z.coerce.date(),
135
+ });
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@voyantjs/identity",
3
+ "version": "0.1.0",
4
+ "license": "FSL-1.1-Apache-2.0",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./service": {
12
+ "types": "./dist/service.d.ts",
13
+ "import": "./dist/service.js"
14
+ },
15
+ "./schema": {
16
+ "types": "./dist/schema.d.ts",
17
+ "import": "./dist/schema.js"
18
+ },
19
+ "./validation": {
20
+ "types": "./dist/validation.d.ts",
21
+ "import": "./dist/validation.js"
22
+ },
23
+ "./routes": {
24
+ "types": "./dist/routes.d.ts",
25
+ "import": "./dist/routes.js"
26
+ }
27
+ },
28
+ "dependencies": {
29
+ "drizzle-orm": "^0.45.2",
30
+ "hono": "^4.12.10",
31
+ "zod": "^4.3.6",
32
+ "@voyantjs/core": "0.1.0",
33
+ "@voyantjs/hono": "0.1.0",
34
+ "@voyantjs/db": "0.1.0"
35
+ },
36
+ "devDependencies": {
37
+ "typescript": "^6.0.2",
38
+ "@voyantjs/voyant-typescript-config": "0.1.0"
39
+ },
40
+ "files": [
41
+ "dist"
42
+ ],
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "scripts": {
47
+ "typecheck": "tsc --noEmit",
48
+ "lint": "biome check src/",
49
+ "test": "vitest run",
50
+ "build": "tsc -p tsconfig.json",
51
+ "clean": "rm -rf dist"
52
+ },
53
+ "main": "./dist/index.js",
54
+ "types": "./dist/index.d.ts"
55
+ }