@axova/shared 1.0.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 (112) hide show
  1. package/CONFIGURATION_GUIDE.md +1 -0
  2. package/README.md +384 -0
  3. package/SCHEMA_ORGANIZATION.md +209 -0
  4. package/dist/configs/index.d.ts +85 -0
  5. package/dist/configs/index.js +555 -0
  6. package/dist/events/kafka.d.ts +40 -0
  7. package/dist/events/kafka.js +311 -0
  8. package/dist/index.d.ts +13 -0
  9. package/dist/index.js +41 -0
  10. package/dist/interfaces/customer-events.d.ts +85 -0
  11. package/dist/interfaces/customer-events.js +2 -0
  12. package/dist/interfaces/inventory-events.d.ts +453 -0
  13. package/dist/interfaces/inventory-events.js +3 -0
  14. package/dist/interfaces/inventory-types.d.ts +894 -0
  15. package/dist/interfaces/inventory-types.js +3 -0
  16. package/dist/interfaces/order-events.d.ts +320 -0
  17. package/dist/interfaces/order-events.js +3 -0
  18. package/dist/lib/auditLogger.d.ts +162 -0
  19. package/dist/lib/auditLogger.js +626 -0
  20. package/dist/lib/authOrganization.d.ts +24 -0
  21. package/dist/lib/authOrganization.js +110 -0
  22. package/dist/lib/db.d.ts +6 -0
  23. package/dist/lib/db.js +88 -0
  24. package/dist/middleware/serviceAuth.d.ts +60 -0
  25. package/dist/middleware/serviceAuth.js +272 -0
  26. package/dist/middleware/storeOwnership.d.ts +15 -0
  27. package/dist/middleware/storeOwnership.js +156 -0
  28. package/dist/middleware/storeValidationMiddleware.d.ts +44 -0
  29. package/dist/middleware/storeValidationMiddleware.js +180 -0
  30. package/dist/middleware/userAuth.d.ts +27 -0
  31. package/dist/middleware/userAuth.js +218 -0
  32. package/dist/schemas/admin/admin-schema.d.ts +741 -0
  33. package/dist/schemas/admin/admin-schema.js +111 -0
  34. package/dist/schemas/ai-moderation/ai-moderation-schema.d.ts +648 -0
  35. package/dist/schemas/ai-moderation/ai-moderation-schema.js +88 -0
  36. package/dist/schemas/common/common-schemas.d.ts +436 -0
  37. package/dist/schemas/common/common-schemas.js +94 -0
  38. package/dist/schemas/compliance/compliance-schema.d.ts +3388 -0
  39. package/dist/schemas/compliance/compliance-schema.js +472 -0
  40. package/dist/schemas/compliance/kyc-schema.d.ts +2642 -0
  41. package/dist/schemas/compliance/kyc-schema.js +361 -0
  42. package/dist/schemas/customer/customer-schema.d.ts +2727 -0
  43. package/dist/schemas/customer/customer-schema.js +399 -0
  44. package/dist/schemas/index.d.ts +27 -0
  45. package/dist/schemas/index.js +138 -0
  46. package/dist/schemas/inventory/inventory-tables.d.ts +9476 -0
  47. package/dist/schemas/inventory/inventory-tables.js +1470 -0
  48. package/dist/schemas/inventory/lot-tables.d.ts +3281 -0
  49. package/dist/schemas/inventory/lot-tables.js +608 -0
  50. package/dist/schemas/order/order-schema.d.ts +5825 -0
  51. package/dist/schemas/order/order-schema.js +954 -0
  52. package/dist/schemas/product/discount-relations.d.ts +15 -0
  53. package/dist/schemas/product/discount-relations.js +34 -0
  54. package/dist/schemas/product/discount-schema.d.ts +1975 -0
  55. package/dist/schemas/product/discount-schema.js +297 -0
  56. package/dist/schemas/product/product-relations.d.ts +41 -0
  57. package/dist/schemas/product/product-relations.js +133 -0
  58. package/dist/schemas/product/product-schema.d.ts +4544 -0
  59. package/dist/schemas/product/product-schema.js +671 -0
  60. package/dist/schemas/store/store-audit-schema.d.ts +4135 -0
  61. package/dist/schemas/store/store-audit-schema.js +556 -0
  62. package/dist/schemas/store/store-schema.d.ts +3100 -0
  63. package/dist/schemas/store/store-schema.js +381 -0
  64. package/dist/schemas/store/store-settings-schema.d.ts +665 -0
  65. package/dist/schemas/store/store-settings-schema.js +141 -0
  66. package/dist/schemas/types.d.ts +50 -0
  67. package/dist/schemas/types.js +3 -0
  68. package/dist/types/events.d.ts +2396 -0
  69. package/dist/types/events.js +505 -0
  70. package/dist/utils/errorHandler.d.ts +12 -0
  71. package/dist/utils/errorHandler.js +36 -0
  72. package/dist/utils/subdomain.d.ts +6 -0
  73. package/dist/utils/subdomain.js +20 -0
  74. package/nul +8 -0
  75. package/package.json +43 -0
  76. package/src/configs/index.ts +654 -0
  77. package/src/events/kafka.ts +429 -0
  78. package/src/index.ts +26 -0
  79. package/src/interfaces/customer-events.ts +106 -0
  80. package/src/interfaces/inventory-events.ts +545 -0
  81. package/src/interfaces/inventory-types.ts +1004 -0
  82. package/src/interfaces/order-events.ts +381 -0
  83. package/src/lib/auditLogger.ts +1117 -0
  84. package/src/lib/authOrganization.ts +153 -0
  85. package/src/lib/db.ts +64 -0
  86. package/src/middleware/serviceAuth.ts +328 -0
  87. package/src/middleware/storeOwnership.ts +199 -0
  88. package/src/middleware/storeValidationMiddleware.ts +247 -0
  89. package/src/middleware/userAuth.ts +248 -0
  90. package/src/schemas/admin/admin-schema.ts +208 -0
  91. package/src/schemas/ai-moderation/ai-moderation-schema.ts +180 -0
  92. package/src/schemas/common/common-schemas.ts +108 -0
  93. package/src/schemas/compliance/compliance-schema.ts +927 -0
  94. package/src/schemas/compliance/kyc-schema.ts +649 -0
  95. package/src/schemas/customer/customer-schema.ts +576 -0
  96. package/src/schemas/index.ts +189 -0
  97. package/src/schemas/inventory/inventory-tables.ts +1927 -0
  98. package/src/schemas/inventory/lot-tables.ts +799 -0
  99. package/src/schemas/order/order-schema.ts +1400 -0
  100. package/src/schemas/product/discount-relations.ts +44 -0
  101. package/src/schemas/product/discount-schema.ts +464 -0
  102. package/src/schemas/product/product-relations.ts +187 -0
  103. package/src/schemas/product/product-schema.ts +955 -0
  104. package/src/schemas/store/ethiopian_business_api.md.resolved +212 -0
  105. package/src/schemas/store/store-audit-schema.ts +1257 -0
  106. package/src/schemas/store/store-schema.ts +661 -0
  107. package/src/schemas/store/store-settings-schema.ts +231 -0
  108. package/src/schemas/types.ts +67 -0
  109. package/src/types/events.ts +646 -0
  110. package/src/utils/errorHandler.ts +44 -0
  111. package/src/utils/subdomain.ts +19 -0
  112. package/tsconfig.json +21 -0
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moderationRules = exports.contentScans = void 0;
4
+ const cuid2_1 = require("@paralleldrive/cuid2");
5
+ const pg_core_1 = require("drizzle-orm/pg-core");
6
+ // Content Scans Table
7
+ exports.contentScans = (0, pg_core_1.pgTable)("content_scans", {
8
+ id: (0, pg_core_1.text)("id")
9
+ .primaryKey()
10
+ .$defaultFn(() => (0, cuid2_1.createId)()),
11
+ // Content Information
12
+ contentId: (0, pg_core_1.text)("content_id").notNull(),
13
+ contentType: (0, pg_core_1.varchar)("content_type", { length: 50 })
14
+ .notNull()
15
+ .$type(),
16
+ storeId: (0, pg_core_1.text)("store_id"),
17
+ userId: (0, pg_core_1.text)("user_id"),
18
+ // Scan Configuration
19
+ scanType: (0, pg_core_1.varchar)("scan_type", { length: 30 })
20
+ .$type()
21
+ .default("AUTOMATED"),
22
+ provider: (0, pg_core_1.varchar)("provider", { length: 30 })
23
+ .default("OPENAI")
24
+ .$type(),
25
+ // Content Data
26
+ originalContent: (0, pg_core_1.text)("original_content").notNull(),
27
+ processedContent: (0, pg_core_1.text)("processed_content"), // Cleaned/normalized content
28
+ contentHash: (0, pg_core_1.varchar)("content_hash", { length: 64 }), // SHA-256 for deduplication
29
+ // Scan Results
30
+ flagged: (0, pg_core_1.boolean)("flagged").notNull().default(false),
31
+ confidence: (0, pg_core_1.decimal)("confidence", { precision: 5, scale: 4 }), // 0-1
32
+ // OpenAI Moderation Categories
33
+ categories: (0, pg_core_1.jsonb)("categories").$type(),
34
+ categoryScores: (0, pg_core_1.jsonb)("category_scores").$type(),
35
+ // Custom Rules and Patterns
36
+ customViolations: (0, pg_core_1.jsonb)("custom_violations")
37
+ .$type()
38
+ .default([]),
39
+ // Status and Actions
40
+ status: (0, pg_core_1.varchar)("status", { length: 20 })
41
+ .notNull()
42
+ .default("COMPLETED")
43
+ .$type(),
44
+ actionTaken: (0, pg_core_1.varchar)("action_taken", { length: 30 }).$type(),
45
+ // Processing Metadata
46
+ processingTime: (0, pg_core_1.integer)("processing_time"), // milliseconds
47
+ cost: (0, pg_core_1.decimal)("cost", { precision: 8, scale: 6 }), // API cost in USD
48
+ createdAt: (0, pg_core_1.timestamp)("created_at", { withTimezone: true })
49
+ .defaultNow()
50
+ .notNull(),
51
+ }, (table) => ({
52
+ contentIdIndex: (0, pg_core_1.index)("idx_scans_content").on(table.contentId),
53
+ storeIdIndex: (0, pg_core_1.index)("idx_scans_store").on(table.storeId),
54
+ flaggedIndex: (0, pg_core_1.index)("idx_scans_flagged").on(table.flagged, table.confidence),
55
+ statusIndex: (0, pg_core_1.index)("idx_scans_status").on(table.status),
56
+ contentTypeIndex: (0, pg_core_1.index)("idx_scans_content_type").on(table.contentType),
57
+ hashIndex: (0, pg_core_1.index)("idx_scans_hash").on(table.contentHash),
58
+ }));
59
+ // Moderation Rules Table
60
+ exports.moderationRules = (0, pg_core_1.pgTable)("moderation_rules", {
61
+ id: (0, pg_core_1.text)("id")
62
+ .primaryKey()
63
+ .$defaultFn(() => (0, cuid2_1.createId)()),
64
+ name: (0, pg_core_1.varchar)("name", { length: 100 }).notNull(),
65
+ description: (0, pg_core_1.text)("description"),
66
+ ruleType: (0, pg_core_1.varchar)("rule_type", { length: 30 })
67
+ .notNull()
68
+ .$type(),
69
+ severity: (0, pg_core_1.varchar)("severity", { length: 20 })
70
+ .notNull()
71
+ .$type(),
72
+ // Rule Configuration
73
+ configuration: (0, pg_core_1.jsonb)("configuration").$type(),
74
+ // Targeting
75
+ contentTypes: (0, pg_core_1.jsonb)("content_types").$type().default([]),
76
+ storeTypes: (0, pg_core_1.jsonb)("store_types").$type().default([]),
77
+ isActive: (0, pg_core_1.boolean)("is_active").notNull().default(true),
78
+ createdAt: (0, pg_core_1.timestamp)("created_at", { withTimezone: true })
79
+ .defaultNow()
80
+ .notNull(),
81
+ updatedAt: (0, pg_core_1.timestamp)("updated_at", { withTimezone: true })
82
+ .defaultNow()
83
+ .notNull(),
84
+ }, (table) => ({
85
+ nameIndex: (0, pg_core_1.index)("idx_rules_name").on(table.name),
86
+ typeIndex: (0, pg_core_1.index)("idx_rules_type").on(table.ruleType),
87
+ activeIndex: (0, pg_core_1.index)("idx_rules_active").on(table.isActive),
88
+ }));
@@ -0,0 +1,436 @@
1
+ import { z } from "zod";
2
+ export declare const CuidSchema: z.ZodString;
3
+ export declare const GeoLocationSchema: z.ZodObject<{
4
+ lat: z.ZodNumber;
5
+ lng: z.ZodNumber;
6
+ address: z.ZodObject<{
7
+ line1: z.ZodString;
8
+ line2: z.ZodOptional<z.ZodString>;
9
+ city: z.ZodString;
10
+ state: z.ZodString;
11
+ postalCode: z.ZodString;
12
+ country: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ line1: string;
15
+ city: string;
16
+ state: string;
17
+ postalCode: string;
18
+ country: string;
19
+ line2?: string | undefined;
20
+ }, {
21
+ line1: string;
22
+ city: string;
23
+ state: string;
24
+ postalCode: string;
25
+ country: string;
26
+ line2?: string | undefined;
27
+ }>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ address: {
30
+ line1: string;
31
+ city: string;
32
+ state: string;
33
+ postalCode: string;
34
+ country: string;
35
+ line2?: string | undefined;
36
+ };
37
+ lat: number;
38
+ lng: number;
39
+ }, {
40
+ address: {
41
+ line1: string;
42
+ city: string;
43
+ state: string;
44
+ postalCode: string;
45
+ country: string;
46
+ line2?: string | undefined;
47
+ };
48
+ lat: number;
49
+ lng: number;
50
+ }>;
51
+ export declare const AuditTrailSchema: z.ZodObject<{
52
+ action: z.ZodString;
53
+ performedBy: z.ZodString;
54
+ performedAt: z.ZodDate;
55
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
56
+ ipAddress: z.ZodOptional<z.ZodString>;
57
+ userAgent: z.ZodOptional<z.ZodString>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ action: string;
60
+ performedBy: string;
61
+ performedAt: Date;
62
+ userAgent?: string | undefined;
63
+ ipAddress?: string | undefined;
64
+ details?: Record<string, any> | undefined;
65
+ }, {
66
+ action: string;
67
+ performedBy: string;
68
+ performedAt: Date;
69
+ userAgent?: string | undefined;
70
+ ipAddress?: string | undefined;
71
+ details?: Record<string, any> | undefined;
72
+ }>;
73
+ export declare const MoneySchema: z.ZodObject<{
74
+ amount: z.ZodNumber;
75
+ currency: z.ZodDefault<z.ZodString>;
76
+ }, "strip", z.ZodTypeAny, {
77
+ currency: string;
78
+ amount: number;
79
+ }, {
80
+ amount: number;
81
+ currency?: string | undefined;
82
+ }>;
83
+ export declare const ContactInfoSchema: z.ZodObject<{
84
+ name: z.ZodOptional<z.ZodString>;
85
+ phone: z.ZodOptional<z.ZodString>;
86
+ email: z.ZodOptional<z.ZodString>;
87
+ alternatePhone: z.ZodOptional<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ email?: string | undefined;
90
+ name?: string | undefined;
91
+ phone?: string | undefined;
92
+ alternatePhone?: string | undefined;
93
+ }, {
94
+ email?: string | undefined;
95
+ name?: string | undefined;
96
+ phone?: string | undefined;
97
+ alternatePhone?: string | undefined;
98
+ }>;
99
+ export declare const BusinessHoursSchema: z.ZodObject<{
100
+ timezone: z.ZodString;
101
+ monday: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
102
+ closed: z.ZodLiteral<true>;
103
+ open: z.ZodOptional<z.ZodString>;
104
+ close: z.ZodOptional<z.ZodString>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ closed: true;
107
+ close?: string | undefined;
108
+ open?: string | undefined;
109
+ }, {
110
+ closed: true;
111
+ close?: string | undefined;
112
+ open?: string | undefined;
113
+ }>, z.ZodObject<{
114
+ open: z.ZodString;
115
+ close: z.ZodString;
116
+ closed: z.ZodOptional<z.ZodLiteral<false>>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ close: string;
119
+ open: string;
120
+ closed?: false | undefined;
121
+ }, {
122
+ close: string;
123
+ open: string;
124
+ closed?: false | undefined;
125
+ }>]>>;
126
+ tuesday: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
127
+ closed: z.ZodLiteral<true>;
128
+ open: z.ZodOptional<z.ZodString>;
129
+ close: z.ZodOptional<z.ZodString>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ closed: true;
132
+ close?: string | undefined;
133
+ open?: string | undefined;
134
+ }, {
135
+ closed: true;
136
+ close?: string | undefined;
137
+ open?: string | undefined;
138
+ }>, z.ZodObject<{
139
+ open: z.ZodString;
140
+ close: z.ZodString;
141
+ closed: z.ZodOptional<z.ZodLiteral<false>>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ close: string;
144
+ open: string;
145
+ closed?: false | undefined;
146
+ }, {
147
+ close: string;
148
+ open: string;
149
+ closed?: false | undefined;
150
+ }>]>>;
151
+ wednesday: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
152
+ closed: z.ZodLiteral<true>;
153
+ open: z.ZodOptional<z.ZodString>;
154
+ close: z.ZodOptional<z.ZodString>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ closed: true;
157
+ close?: string | undefined;
158
+ open?: string | undefined;
159
+ }, {
160
+ closed: true;
161
+ close?: string | undefined;
162
+ open?: string | undefined;
163
+ }>, z.ZodObject<{
164
+ open: z.ZodString;
165
+ close: z.ZodString;
166
+ closed: z.ZodOptional<z.ZodLiteral<false>>;
167
+ }, "strip", z.ZodTypeAny, {
168
+ close: string;
169
+ open: string;
170
+ closed?: false | undefined;
171
+ }, {
172
+ close: string;
173
+ open: string;
174
+ closed?: false | undefined;
175
+ }>]>>;
176
+ thursday: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
177
+ closed: z.ZodLiteral<true>;
178
+ open: z.ZodOptional<z.ZodString>;
179
+ close: z.ZodOptional<z.ZodString>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ closed: true;
182
+ close?: string | undefined;
183
+ open?: string | undefined;
184
+ }, {
185
+ closed: true;
186
+ close?: string | undefined;
187
+ open?: string | undefined;
188
+ }>, z.ZodObject<{
189
+ open: z.ZodString;
190
+ close: z.ZodString;
191
+ closed: z.ZodOptional<z.ZodLiteral<false>>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ close: string;
194
+ open: string;
195
+ closed?: false | undefined;
196
+ }, {
197
+ close: string;
198
+ open: string;
199
+ closed?: false | undefined;
200
+ }>]>>;
201
+ friday: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
202
+ closed: z.ZodLiteral<true>;
203
+ open: z.ZodOptional<z.ZodString>;
204
+ close: z.ZodOptional<z.ZodString>;
205
+ }, "strip", z.ZodTypeAny, {
206
+ closed: true;
207
+ close?: string | undefined;
208
+ open?: string | undefined;
209
+ }, {
210
+ closed: true;
211
+ close?: string | undefined;
212
+ open?: string | undefined;
213
+ }>, z.ZodObject<{
214
+ open: z.ZodString;
215
+ close: z.ZodString;
216
+ closed: z.ZodOptional<z.ZodLiteral<false>>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ close: string;
219
+ open: string;
220
+ closed?: false | undefined;
221
+ }, {
222
+ close: string;
223
+ open: string;
224
+ closed?: false | undefined;
225
+ }>]>>;
226
+ saturday: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
227
+ closed: z.ZodLiteral<true>;
228
+ open: z.ZodOptional<z.ZodString>;
229
+ close: z.ZodOptional<z.ZodString>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ closed: true;
232
+ close?: string | undefined;
233
+ open?: string | undefined;
234
+ }, {
235
+ closed: true;
236
+ close?: string | undefined;
237
+ open?: string | undefined;
238
+ }>, z.ZodObject<{
239
+ open: z.ZodString;
240
+ close: z.ZodString;
241
+ closed: z.ZodOptional<z.ZodLiteral<false>>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ close: string;
244
+ open: string;
245
+ closed?: false | undefined;
246
+ }, {
247
+ close: string;
248
+ open: string;
249
+ closed?: false | undefined;
250
+ }>]>>;
251
+ sunday: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
252
+ closed: z.ZodLiteral<true>;
253
+ open: z.ZodOptional<z.ZodString>;
254
+ close: z.ZodOptional<z.ZodString>;
255
+ }, "strip", z.ZodTypeAny, {
256
+ closed: true;
257
+ close?: string | undefined;
258
+ open?: string | undefined;
259
+ }, {
260
+ closed: true;
261
+ close?: string | undefined;
262
+ open?: string | undefined;
263
+ }>, z.ZodObject<{
264
+ open: z.ZodString;
265
+ close: z.ZodString;
266
+ closed: z.ZodOptional<z.ZodLiteral<false>>;
267
+ }, "strip", z.ZodTypeAny, {
268
+ close: string;
269
+ open: string;
270
+ closed?: false | undefined;
271
+ }, {
272
+ close: string;
273
+ open: string;
274
+ closed?: false | undefined;
275
+ }>]>>;
276
+ holidays: z.ZodOptional<z.ZodArray<z.ZodObject<{
277
+ date: z.ZodString;
278
+ name: z.ZodString;
279
+ closed: z.ZodDefault<z.ZodBoolean>;
280
+ }, "strip", z.ZodTypeAny, {
281
+ date: string;
282
+ name: string;
283
+ closed: boolean;
284
+ }, {
285
+ date: string;
286
+ name: string;
287
+ closed?: boolean | undefined;
288
+ }>, "many">>;
289
+ }, "strip", z.ZodTypeAny, {
290
+ timezone: string;
291
+ monday?: {
292
+ closed: true;
293
+ close?: string | undefined;
294
+ open?: string | undefined;
295
+ } | {
296
+ close: string;
297
+ open: string;
298
+ closed?: false | undefined;
299
+ } | undefined;
300
+ tuesday?: {
301
+ closed: true;
302
+ close?: string | undefined;
303
+ open?: string | undefined;
304
+ } | {
305
+ close: string;
306
+ open: string;
307
+ closed?: false | undefined;
308
+ } | undefined;
309
+ wednesday?: {
310
+ closed: true;
311
+ close?: string | undefined;
312
+ open?: string | undefined;
313
+ } | {
314
+ close: string;
315
+ open: string;
316
+ closed?: false | undefined;
317
+ } | undefined;
318
+ thursday?: {
319
+ closed: true;
320
+ close?: string | undefined;
321
+ open?: string | undefined;
322
+ } | {
323
+ close: string;
324
+ open: string;
325
+ closed?: false | undefined;
326
+ } | undefined;
327
+ friday?: {
328
+ closed: true;
329
+ close?: string | undefined;
330
+ open?: string | undefined;
331
+ } | {
332
+ close: string;
333
+ open: string;
334
+ closed?: false | undefined;
335
+ } | undefined;
336
+ saturday?: {
337
+ closed: true;
338
+ close?: string | undefined;
339
+ open?: string | undefined;
340
+ } | {
341
+ close: string;
342
+ open: string;
343
+ closed?: false | undefined;
344
+ } | undefined;
345
+ sunday?: {
346
+ closed: true;
347
+ close?: string | undefined;
348
+ open?: string | undefined;
349
+ } | {
350
+ close: string;
351
+ open: string;
352
+ closed?: false | undefined;
353
+ } | undefined;
354
+ holidays?: {
355
+ date: string;
356
+ name: string;
357
+ closed: boolean;
358
+ }[] | undefined;
359
+ }, {
360
+ timezone: string;
361
+ monday?: {
362
+ closed: true;
363
+ close?: string | undefined;
364
+ open?: string | undefined;
365
+ } | {
366
+ close: string;
367
+ open: string;
368
+ closed?: false | undefined;
369
+ } | undefined;
370
+ tuesday?: {
371
+ closed: true;
372
+ close?: string | undefined;
373
+ open?: string | undefined;
374
+ } | {
375
+ close: string;
376
+ open: string;
377
+ closed?: false | undefined;
378
+ } | undefined;
379
+ wednesday?: {
380
+ closed: true;
381
+ close?: string | undefined;
382
+ open?: string | undefined;
383
+ } | {
384
+ close: string;
385
+ open: string;
386
+ closed?: false | undefined;
387
+ } | undefined;
388
+ thursday?: {
389
+ closed: true;
390
+ close?: string | undefined;
391
+ open?: string | undefined;
392
+ } | {
393
+ close: string;
394
+ open: string;
395
+ closed?: false | undefined;
396
+ } | undefined;
397
+ friday?: {
398
+ closed: true;
399
+ close?: string | undefined;
400
+ open?: string | undefined;
401
+ } | {
402
+ close: string;
403
+ open: string;
404
+ closed?: false | undefined;
405
+ } | undefined;
406
+ saturday?: {
407
+ closed: true;
408
+ close?: string | undefined;
409
+ open?: string | undefined;
410
+ } | {
411
+ close: string;
412
+ open: string;
413
+ closed?: false | undefined;
414
+ } | undefined;
415
+ sunday?: {
416
+ closed: true;
417
+ close?: string | undefined;
418
+ open?: string | undefined;
419
+ } | {
420
+ close: string;
421
+ open: string;
422
+ closed?: false | undefined;
423
+ } | undefined;
424
+ holidays?: {
425
+ date: string;
426
+ name: string;
427
+ closed?: boolean | undefined;
428
+ }[] | undefined;
429
+ }>;
430
+ export declare const CurrencyEnum: z.ZodEnum<["USD", "EUR", "GBP", "CAD", "AUD", "JPY", "CNY", "INR"]>;
431
+ export declare const TimezoneEnum: z.ZodEnum<["UTC", "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles", "Europe/London", "Europe/Paris", "Europe/Berlin", "Asia/Tokyo", "Asia/Shanghai", "Asia/Kolkata", "Australia/Sydney"]>;
432
+ export type GeoLocation = z.infer<typeof GeoLocationSchema>;
433
+ export type AuditTrail = z.infer<typeof AuditTrailSchema>;
434
+ export type Money = z.infer<typeof MoneySchema>;
435
+ export type ContactInfo = z.infer<typeof ContactInfoSchema>;
436
+ export type BusinessHours = z.infer<typeof BusinessHoursSchema>;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimezoneEnum = exports.CurrencyEnum = exports.BusinessHoursSchema = exports.ContactInfoSchema = exports.MoneySchema = exports.AuditTrailSchema = exports.GeoLocationSchema = exports.CuidSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // =====================================================
6
+ // SHARED COMMON SCHEMAS
7
+ // =====================================================
8
+ // CUID2 validation schema aligned with createId() from @paralleldrive/cuid2
9
+ exports.CuidSchema = zod_1.z.string().cuid2();
10
+ exports.GeoLocationSchema = zod_1.z.object({
11
+ lat: zod_1.z.number().min(-90).max(90),
12
+ lng: zod_1.z.number().min(-180).max(180),
13
+ address: zod_1.z.object({
14
+ line1: zod_1.z.string(),
15
+ line2: zod_1.z.string().optional(),
16
+ city: zod_1.z.string(),
17
+ state: zod_1.z.string(),
18
+ postalCode: zod_1.z.string(),
19
+ country: zod_1.z.string(),
20
+ }),
21
+ });
22
+ exports.AuditTrailSchema = zod_1.z.object({
23
+ action: zod_1.z.string(),
24
+ performedBy: zod_1.z.string(),
25
+ performedAt: zod_1.z.date(),
26
+ details: zod_1.z.record(zod_1.z.any()).optional(),
27
+ ipAddress: zod_1.z.string().optional(),
28
+ userAgent: zod_1.z.string().optional(),
29
+ });
30
+ exports.MoneySchema = zod_1.z.object({
31
+ amount: zod_1.z.number(),
32
+ currency: zod_1.z.string().length(3).default("USD"),
33
+ });
34
+ exports.ContactInfoSchema = zod_1.z.object({
35
+ name: zod_1.z.string().optional(),
36
+ phone: zod_1.z.string().optional(),
37
+ email: zod_1.z.string().email().optional(),
38
+ alternatePhone: zod_1.z.string().optional(),
39
+ });
40
+ // Allow days that are explicitly closed to omit open/close times
41
+ const DayHoursSchema = zod_1.z.union([
42
+ zod_1.z.object({
43
+ closed: zod_1.z.literal(true),
44
+ open: zod_1.z.string().optional(),
45
+ close: zod_1.z.string().optional(),
46
+ }),
47
+ zod_1.z.object({
48
+ open: zod_1.z.string(),
49
+ close: zod_1.z.string(),
50
+ closed: zod_1.z.literal(false).optional(),
51
+ }),
52
+ ]);
53
+ exports.BusinessHoursSchema = zod_1.z.object({
54
+ timezone: zod_1.z.string(),
55
+ monday: DayHoursSchema.optional(),
56
+ tuesday: DayHoursSchema.optional(),
57
+ wednesday: DayHoursSchema.optional(),
58
+ thursday: DayHoursSchema.optional(),
59
+ friday: DayHoursSchema.optional(),
60
+ saturday: DayHoursSchema.optional(),
61
+ sunday: DayHoursSchema.optional(),
62
+ holidays: zod_1.z
63
+ .array(zod_1.z.object({
64
+ date: zod_1.z.string(),
65
+ name: zod_1.z.string(),
66
+ closed: zod_1.z.boolean().default(true),
67
+ }))
68
+ .optional(),
69
+ });
70
+ // Common enum types
71
+ exports.CurrencyEnum = zod_1.z.enum([
72
+ "USD",
73
+ "EUR",
74
+ "GBP",
75
+ "CAD",
76
+ "AUD",
77
+ "JPY",
78
+ "CNY",
79
+ "INR",
80
+ ]);
81
+ exports.TimezoneEnum = zod_1.z.enum([
82
+ "UTC",
83
+ "America/New_York",
84
+ "America/Chicago",
85
+ "America/Denver",
86
+ "America/Los_Angeles",
87
+ "Europe/London",
88
+ "Europe/Paris",
89
+ "Europe/Berlin",
90
+ "Asia/Tokyo",
91
+ "Asia/Shanghai",
92
+ "Asia/Kolkata",
93
+ "Australia/Sydney",
94
+ ]);