@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,189 @@
1
+ // Export the ACTUAL Drizzle table objects for database operations
2
+
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
+ export * from "./product/product-relations";
173
+ // Product Management Schemas
174
+ export * from "./product/product-schema";
175
+ export * from "./product/product-relations";
176
+ export * from "./product/discount-schema";
177
+ export * from "./product/discount-relations";
178
+ // Store Management
179
+ export * from "./store/store-schema";
180
+ export * from "./store/store-settings-schema";
181
+ export * from "./store/store-audit-schema";
182
+ export {
183
+ storeSettings,
184
+ marketRegions,
185
+ storeSettingsRelations,
186
+ marketRegionsRelations,
187
+ } from "./store/store-settings-schema";
188
+ // Types
189
+ export * from "./types";