@axova/shared 1.0.2 → 1.0.9

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 (66) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +2 -0
  3. package/dist/lib/db.d.ts +34226 -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 +8 -8
  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 +6 -6
  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 +104 -104
  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 +22 -22
  24. package/dist/schemas/store/storefront-config-schema.d.ts +434 -823
  25. package/dist/schemas/store/storefront-config-schema.js +35 -62
  26. package/dist/utils/subdomain.d.ts +1 -1
  27. package/dist/utils/subdomain.js +10 -15
  28. package/package.json +1 -1
  29. package/src/configs/index.ts +654 -654
  30. package/src/index.ts +26 -23
  31. package/src/interfaces/customer-events.ts +106 -106
  32. package/src/interfaces/inventory-events.ts +545 -545
  33. package/src/interfaces/inventory-types.ts +1004 -1004
  34. package/src/interfaces/order-events.ts +381 -381
  35. package/src/lib/auditLogger.ts +1117 -1117
  36. package/src/lib/authOrganization.ts +153 -153
  37. package/src/lib/db.ts +84 -64
  38. package/src/middleware/serviceAuth.ts +328 -328
  39. package/src/middleware/storeOwnership.ts +199 -181
  40. package/src/middleware/storeValidationMiddleware.ts +17 -50
  41. package/src/middleware/userAuth.ts +248 -248
  42. package/src/schemas/admin/admin-schema.ts +208 -208
  43. package/src/schemas/ai-moderation/ai-moderation-schema.ts +180 -180
  44. package/src/schemas/common/common-schemas.ts +108 -108
  45. package/src/schemas/compliance/compliance-schema.ts +927 -0
  46. package/src/schemas/compliance/kyc-schema.ts +649 -0
  47. package/src/schemas/customer/customer-schema.ts +576 -0
  48. package/src/schemas/index.ts +202 -3
  49. package/src/schemas/inventory/inventory-tables.ts +1927 -0
  50. package/src/schemas/inventory/lot-tables.ts +799 -0
  51. package/src/schemas/order/cart-schema.ts +652 -0
  52. package/src/schemas/order/order-schema.ts +1406 -0
  53. package/src/schemas/product/discount-relations.ts +44 -0
  54. package/src/schemas/product/discount-schema.ts +464 -0
  55. package/src/schemas/product/product-relations.ts +187 -0
  56. package/src/schemas/product/product-schema.ts +955 -0
  57. package/src/schemas/store/ethiopian_business_api.md.resolved +212 -0
  58. package/src/schemas/store/store-audit-schema.ts +1257 -0
  59. package/src/schemas/store/store-schema.ts +661 -0
  60. package/src/schemas/store/store-settings-schema.ts +231 -0
  61. package/src/schemas/store/storefront-config-schema.ts +382 -0
  62. package/src/schemas/types.ts +67 -67
  63. package/src/types/events.ts +646 -646
  64. package/src/utils/errorHandler.ts +44 -44
  65. package/src/utils/subdomain.ts +19 -23
  66. package/tsconfig.json +21 -21
@@ -1,67 +1,67 @@
1
- // Core types used across all schemas
2
-
3
- // Common result type for all operations
4
- export interface OperationResult<T = unknown> {
5
- success: boolean;
6
- data?: T;
7
- error?: string;
8
- metadata?: Record<string, unknown>;
9
- }
10
-
11
- // Paginated result wrapper
12
- export interface PaginatedResult<T> {
13
- items: T[];
14
- pagination: {
15
- page: number;
16
- limit: number;
17
- total: number;
18
- pages: number;
19
- hasNext: boolean;
20
- hasPrev: boolean;
21
- };
22
- }
23
-
24
- // Multi-tenancy context
25
- export interface TenantContext {
26
- tenantId: string;
27
- storeId: string;
28
- userId?: string;
29
- userRole?: string;
30
- }
31
-
32
- // User context for operations
33
- export interface UserContext {
34
- userId: string;
35
- userName: string;
36
- userRole: string;
37
- permissions: string[];
38
- tenantId: string;
39
- storeId: string;
40
- }
41
-
42
- // Base filter interface
43
- export interface BaseFilter {
44
- page?: number;
45
- limit?: number;
46
- sortBy?: string;
47
- sortOrder?: "asc" | "desc";
48
- search?: string;
49
- }
50
-
51
- // Date range filter
52
- export interface DateRangeFilter {
53
- startDate?: string;
54
- endDate?: string;
55
- }
56
-
57
- // Status filter
58
- export interface StatusFilter {
59
- status?: string | string[];
60
- }
61
-
62
- // Location filter
63
- export interface LocationFilter {
64
- locationId?: string;
65
- locationType?: "warehouse" | "pos";
66
- locationIds?: string[];
67
- }
1
+ // Core types used across all schemas
2
+
3
+ // Common result type for all operations
4
+ export interface OperationResult<T = unknown> {
5
+ success: boolean;
6
+ data?: T;
7
+ error?: string;
8
+ metadata?: Record<string, unknown>;
9
+ }
10
+
11
+ // Paginated result wrapper
12
+ export interface PaginatedResult<T> {
13
+ items: T[];
14
+ pagination: {
15
+ page: number;
16
+ limit: number;
17
+ total: number;
18
+ pages: number;
19
+ hasNext: boolean;
20
+ hasPrev: boolean;
21
+ };
22
+ }
23
+
24
+ // Multi-tenancy context
25
+ export interface TenantContext {
26
+ tenantId: string;
27
+ storeId: string;
28
+ userId?: string;
29
+ userRole?: string;
30
+ }
31
+
32
+ // User context for operations
33
+ export interface UserContext {
34
+ userId: string;
35
+ userName: string;
36
+ userRole: string;
37
+ permissions: string[];
38
+ tenantId: string;
39
+ storeId: string;
40
+ }
41
+
42
+ // Base filter interface
43
+ export interface BaseFilter {
44
+ page?: number;
45
+ limit?: number;
46
+ sortBy?: string;
47
+ sortOrder?: "asc" | "desc";
48
+ search?: string;
49
+ }
50
+
51
+ // Date range filter
52
+ export interface DateRangeFilter {
53
+ startDate?: string;
54
+ endDate?: string;
55
+ }
56
+
57
+ // Status filter
58
+ export interface StatusFilter {
59
+ status?: string | string[];
60
+ }
61
+
62
+ // Location filter
63
+ export interface LocationFilter {
64
+ locationId?: string;
65
+ locationType?: "warehouse" | "pos";
66
+ locationIds?: string[];
67
+ }