@axova/shared 1.0.2 → 1.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.
Files changed (68) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +2 -0
  3. package/dist/lib/db.d.ts +34406 -1
  4. package/dist/lib/db.js +21 -1
  5. package/dist/middleware/storeOwnership.js +22 -3
  6. package/dist/middleware/storeValidationMiddleware.js +16 -39
  7. package/dist/schemas/admin/admin-schema.d.ts +2 -2
  8. package/dist/schemas/ai-moderation/ai-moderation-schema.d.ts +6 -6
  9. package/dist/schemas/common/common-schemas.d.ts +71 -71
  10. package/dist/schemas/compliance/compliance-schema.d.ts +20 -20
  11. package/dist/schemas/compliance/kyc-schema.d.ts +8 -8
  12. package/dist/schemas/customer/customer-schema.d.ts +18 -18
  13. package/dist/schemas/index.d.ts +28 -0
  14. package/dist/schemas/index.js +134 -3
  15. package/dist/schemas/inventory/inventory-tables.d.ts +188 -188
  16. package/dist/schemas/inventory/lot-tables.d.ts +102 -102
  17. package/dist/schemas/order/cart-schema.d.ts +2865 -0
  18. package/dist/schemas/order/cart-schema.js +396 -0
  19. package/dist/schemas/order/order-schema.d.ts +19 -19
  20. package/dist/schemas/order/order-schema.js +8 -2
  21. package/dist/schemas/product/discount-schema.d.ts +3 -3
  22. package/dist/schemas/product/product-schema.d.ts +3 -3
  23. package/dist/schemas/store/store-audit-schema.d.ts +20 -20
  24. package/dist/schemas/store/store-schema.d.ts +182 -2
  25. package/dist/schemas/store/store-schema.js +19 -0
  26. package/dist/schemas/store/storefront-config-schema.d.ts +434 -823
  27. package/dist/schemas/store/storefront-config-schema.js +35 -62
  28. package/dist/utils/subdomain.d.ts +1 -1
  29. package/dist/utils/subdomain.js +10 -15
  30. package/package.json +1 -1
  31. package/src/configs/index.ts +654 -654
  32. package/src/index.ts +26 -23
  33. package/src/interfaces/customer-events.ts +106 -106
  34. package/src/interfaces/inventory-events.ts +545 -545
  35. package/src/interfaces/inventory-types.ts +1004 -1004
  36. package/src/interfaces/order-events.ts +381 -381
  37. package/src/lib/auditLogger.ts +1117 -1117
  38. package/src/lib/authOrganization.ts +153 -153
  39. package/src/lib/db.ts +84 -64
  40. package/src/middleware/serviceAuth.ts +328 -328
  41. package/src/middleware/storeOwnership.ts +199 -181
  42. package/src/middleware/storeValidationMiddleware.ts +17 -50
  43. package/src/middleware/userAuth.ts +248 -248
  44. package/src/schemas/admin/admin-schema.ts +208 -208
  45. package/src/schemas/ai-moderation/ai-moderation-schema.ts +180 -180
  46. package/src/schemas/common/common-schemas.ts +108 -108
  47. package/src/schemas/compliance/compliance-schema.ts +927 -0
  48. package/src/schemas/compliance/kyc-schema.ts +649 -0
  49. package/src/schemas/customer/customer-schema.ts +576 -0
  50. package/src/schemas/index.ts +202 -3
  51. package/src/schemas/inventory/inventory-tables.ts +1927 -0
  52. package/src/schemas/inventory/lot-tables.ts +799 -0
  53. package/src/schemas/order/cart-schema.ts +652 -0
  54. package/src/schemas/order/order-schema.ts +1406 -0
  55. package/src/schemas/product/discount-relations.ts +44 -0
  56. package/src/schemas/product/discount-schema.ts +464 -0
  57. package/src/schemas/product/product-relations.ts +187 -0
  58. package/src/schemas/product/product-schema.ts +955 -0
  59. package/src/schemas/store/ethiopian_business_api.md.resolved +212 -0
  60. package/src/schemas/store/store-audit-schema.ts +1257 -0
  61. package/src/schemas/store/store-schema.ts +682 -0
  62. package/src/schemas/store/store-settings-schema.ts +231 -0
  63. package/src/schemas/store/storefront-config-schema.ts +382 -0
  64. package/src/schemas/types.ts +67 -67
  65. package/src/types/events.ts +646 -646
  66. package/src/utils/errorHandler.ts +44 -44
  67. package/src/utils/subdomain.ts +19 -23
  68. package/tsconfig.json +21 -21
@@ -1,5 +1,204 @@
1
- // Schemas have been moved to individual services
2
- // Each service now maintains its own schemas in their src/[service-name]-schema folder
1
+ // Export the ACTUAL Drizzle table objects for database operations
3
2
 
4
- // Common types used across services
3
+ // Export event and Kafka functionality
4
+ export {
5
+ type AxovaKafkaConfig,
6
+ createKafkaInstance,
7
+ getKafkaConfigFromEnv,
8
+ getKafkaInstance,
9
+ } from "../events/kafka";
10
+ // Export customer events and configuration
11
+ export {
12
+ CustomerServiceConfig,
13
+ CustomerServiceEvents,
14
+ } from "../interfaces/customer-events";
15
+
16
+ // Export inventory events and configuration
17
+ export { ServiceConfig, ServiceEvents } from "../interfaces/inventory-events";
18
+ // Export inventory-specific types
19
+ export type {
20
+ ABCClassification,
21
+ AIRecommendation,
22
+ // Automation types
23
+ AutomationRule,
24
+ AutomationRuleFilter,
25
+ BatchFilter,
26
+ // Batch tracking types
27
+ BatchInfo,
28
+ CountItemRequest,
29
+ CreateAutomationRuleRequest,
30
+ CreateBatchRequest,
31
+ CreateCycleCountRequest,
32
+ CreateInventoryItemRequest,
33
+ CreatePOSLocationRequest,
34
+ CreateWarehouseRequest,
35
+ // Cycle count types
36
+ CycleCount,
37
+ CycleCountFilter,
38
+ CycleCountItem,
39
+ DashboardMetrics,
40
+ ExpiryReport,
41
+ ForecastData,
42
+ InventoryFilter,
43
+ InventoryInsight,
44
+ // Core types
45
+ InventoryItem,
46
+ InventoryOverview,
47
+ // Insights and analytics types
48
+ InventorySnapshot,
49
+ LowStockAlert,
50
+ // Common operation types
51
+ OperationResult,
52
+ PaginatedResult,
53
+ POSLocation,
54
+ QuantityUpdate,
55
+ ReorderRecommendation,
56
+ StockMovementReport,
57
+ StockValuation,
58
+ TenantContext,
59
+ TransferFilter,
60
+ TransferItem,
61
+ // Transfer types
62
+ TransferRequest,
63
+ UpdateInventoryItemRequest,
64
+ UserContext,
65
+ VelocityAnalysis,
66
+ Warehouse,
67
+ } from "../interfaces/inventory-types";
68
+ export * from "../types/events";
69
+ // Admin Management
70
+ export * from "./admin/admin-schema";
71
+ // AI Moderation
72
+ export * from "./ai-moderation/ai-moderation-schema";
73
+ // Common Schemas
74
+ export * from "./common/common-schemas";
75
+ // Compliance Schemas
76
+ export * from "./compliance/compliance-schema";
77
+ export * from "./compliance/kyc-schema";
78
+ export {
79
+ storeKyc,
80
+ kycVerificationHistory,
81
+ kycDocuments,
82
+ kycAnalytics,
83
+ kycWebhooksLog,
84
+ } from "./compliance/kyc-schema";
85
+ // Customer Management Schemas
86
+ export * from "./customer/customer-schema";
87
+ // Customer Schema Exports
88
+ export {
89
+ customerAddresses,
90
+ customerInteractionHistory,
91
+ customerNotes,
92
+ customerPreferences,
93
+ customerReviews,
94
+ customerSupportTickets,
95
+ customers,
96
+ customerVisitHistory,
97
+ } from "./customer/customer-schema";
98
+ // Core Inventory tables and co-located schemas
99
+ export * from "./inventory/inventory-tables";
100
+ export {
101
+ inventory,
102
+ inventoryMovements,
103
+ inventoryTransferItems,
104
+ inventoryTransfers,
105
+ posLocations,
106
+ productSuppliers,
107
+ purchaseOrderItems,
108
+ purchaseOrders,
109
+ qualityControls,
110
+ qualityTemplates,
111
+ supplierQualityRatings,
112
+ suppliers,
113
+ warehouses,
114
+ } from "./inventory/inventory-tables";
115
+
116
+ // Lot & Batch Management schemas
117
+ export {
118
+ alertSeverityEnum,
119
+ alertStatusEnum,
120
+ alertTypeEnum,
121
+ inventoryLotAlerts,
122
+ inventoryLotMerges,
123
+ inventoryLotMovements,
124
+ inventoryLots,
125
+ inventoryLotSplits,
126
+ lotMovementTypeEnum,
127
+ lotStatusEnum,
128
+ // Zod Schemas for Lot Operations
129
+ LotSchema,
130
+ InitializeProductInventorySchema,
131
+ CreateLotSchema,
132
+ ReserveLotQuantitySchema,
133
+ ReleaseLotReservationSchema,
134
+ AdjustLotQuantitySchema,
135
+ TransferLotSchema,
136
+ MergeLotsSchema,
137
+ SplitLotSchema,
138
+ GetLotsQuerySchema,
139
+ GetAvailableLotsSchema,
140
+ LotAnalyticsSchema,
141
+ } from "./inventory/lot-tables";
142
+
143
+ // Order schemas
144
+ export {
145
+ addressTypeEnum,
146
+ discountTypeEnum,
147
+ fulfillmentStatusEnum,
148
+ orderAddresses,
149
+ orderAddressesRelations,
150
+ orderDiscounts,
151
+ orderDiscountsRelations,
152
+ orderFulfillments,
153
+ orderFulfillmentsRelations,
154
+ orderHistory,
155
+ orderHistoryRelations,
156
+ orderItems,
157
+ orderItemsRelations,
158
+ orderNotes,
159
+ orderNotesRelations,
160
+ orderPayments,
161
+ orderPaymentsRelations,
162
+ orderPriorityEnum,
163
+ orderStatusEnum,
164
+ orders,
165
+ ordersRelations,
166
+ // Enums
167
+ orderTypeEnum,
168
+ paymentMethodEnum,
169
+ paymentStatusEnum,
170
+ refundReasonEnum,
171
+ } from "./order/order-schema";
172
+
173
+ // Cart schemas
174
+ export {
175
+ cartActivityLog,
176
+ cartActivityLogRelations,
177
+ cartAddresses,
178
+ cartAddressesRelations,
179
+ cartItems,
180
+ cartItemsRelations,
181
+ cartStatusEnum,
182
+ cartTypeEnum,
183
+ shoppingCarts,
184
+ shoppingCartsRelations,
185
+ } from "./order/cart-schema";
186
+ export * from "./product/product-relations";
187
+ // Product Management Schemas
188
+ export * from "./product/product-schema";
189
+ export * from "./product/product-relations";
190
+ export * from "./product/discount-schema";
191
+ export * from "./product/discount-relations";
192
+ // Store Management
193
+ export * from "./store/store-schema";
194
+ export * from "./store/store-settings-schema";
195
+ export * from "./store/store-audit-schema";
196
+ export * from "./store/storefront-config-schema";
197
+ export {
198
+ storeSettings,
199
+ marketRegions,
200
+ storeSettingsRelations,
201
+ marketRegionsRelations,
202
+ } from "./store/store-settings-schema";
203
+ // Types
5
204
  export * from "./types";