@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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/lib/db.d.ts +34406 -1
- package/dist/lib/db.js +21 -1
- package/dist/middleware/storeOwnership.js +22 -3
- package/dist/middleware/storeValidationMiddleware.js +16 -39
- package/dist/schemas/admin/admin-schema.d.ts +2 -2
- package/dist/schemas/ai-moderation/ai-moderation-schema.d.ts +6 -6
- package/dist/schemas/common/common-schemas.d.ts +71 -71
- package/dist/schemas/compliance/compliance-schema.d.ts +20 -20
- package/dist/schemas/compliance/kyc-schema.d.ts +8 -8
- package/dist/schemas/customer/customer-schema.d.ts +18 -18
- package/dist/schemas/index.d.ts +28 -0
- package/dist/schemas/index.js +134 -3
- package/dist/schemas/inventory/inventory-tables.d.ts +188 -188
- package/dist/schemas/inventory/lot-tables.d.ts +102 -102
- package/dist/schemas/order/cart-schema.d.ts +2865 -0
- package/dist/schemas/order/cart-schema.js +396 -0
- package/dist/schemas/order/order-schema.d.ts +19 -19
- package/dist/schemas/order/order-schema.js +8 -2
- package/dist/schemas/product/discount-schema.d.ts +3 -3
- package/dist/schemas/product/product-schema.d.ts +3 -3
- package/dist/schemas/store/store-audit-schema.d.ts +20 -20
- package/dist/schemas/store/store-schema.d.ts +182 -2
- package/dist/schemas/store/store-schema.js +19 -0
- package/dist/schemas/store/storefront-config-schema.d.ts +434 -823
- package/dist/schemas/store/storefront-config-schema.js +35 -62
- package/dist/utils/subdomain.d.ts +1 -1
- package/dist/utils/subdomain.js +10 -15
- package/package.json +1 -1
- package/src/configs/index.ts +654 -654
- package/src/index.ts +26 -23
- package/src/interfaces/customer-events.ts +106 -106
- package/src/interfaces/inventory-events.ts +545 -545
- package/src/interfaces/inventory-types.ts +1004 -1004
- package/src/interfaces/order-events.ts +381 -381
- package/src/lib/auditLogger.ts +1117 -1117
- package/src/lib/authOrganization.ts +153 -153
- package/src/lib/db.ts +84 -64
- package/src/middleware/serviceAuth.ts +328 -328
- package/src/middleware/storeOwnership.ts +199 -181
- package/src/middleware/storeValidationMiddleware.ts +17 -50
- package/src/middleware/userAuth.ts +248 -248
- package/src/schemas/admin/admin-schema.ts +208 -208
- package/src/schemas/ai-moderation/ai-moderation-schema.ts +180 -180
- package/src/schemas/common/common-schemas.ts +108 -108
- package/src/schemas/compliance/compliance-schema.ts +927 -0
- package/src/schemas/compliance/kyc-schema.ts +649 -0
- package/src/schemas/customer/customer-schema.ts +576 -0
- package/src/schemas/index.ts +202 -3
- package/src/schemas/inventory/inventory-tables.ts +1927 -0
- package/src/schemas/inventory/lot-tables.ts +799 -0
- package/src/schemas/order/cart-schema.ts +652 -0
- package/src/schemas/order/order-schema.ts +1406 -0
- package/src/schemas/product/discount-relations.ts +44 -0
- package/src/schemas/product/discount-schema.ts +464 -0
- package/src/schemas/product/product-relations.ts +187 -0
- package/src/schemas/product/product-schema.ts +955 -0
- package/src/schemas/store/ethiopian_business_api.md.resolved +212 -0
- package/src/schemas/store/store-audit-schema.ts +1257 -0
- package/src/schemas/store/store-schema.ts +682 -0
- package/src/schemas/store/store-settings-schema.ts +231 -0
- package/src/schemas/store/storefront-config-schema.ts +382 -0
- package/src/schemas/types.ts +67 -67
- package/src/types/events.ts +646 -646
- package/src/utils/errorHandler.ts +44 -44
- package/src/utils/subdomain.ts +19 -23
- package/tsconfig.json +21 -21
package/src/index.ts
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
// Database
|
|
2
|
-
|
|
3
|
-
// Service Configuration Profiles
|
|
4
|
-
export * from "./configs";
|
|
5
|
-
// Kafka Events and Utilities
|
|
6
|
-
export * from "./events/kafka";
|
|
7
|
-
// Audit Logging
|
|
8
|
-
export * from "./lib/auditLogger";
|
|
9
|
-
// Auth Organization
|
|
10
|
-
export * from "./lib/authOrganization";
|
|
11
|
-
export { db, pool } from "./lib/db";
|
|
12
|
-
// Service Authentication
|
|
13
|
-
export * from "./middleware/serviceAuth";
|
|
14
|
-
export * from "./middleware/storeOwnership";
|
|
15
|
-
export * from "./middleware/storeValidationMiddleware";
|
|
16
|
-
export * from "./middleware/userAuth";
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
export * from "./
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
export * from "./
|
|
23
|
-
|
|
1
|
+
// Database
|
|
2
|
+
|
|
3
|
+
// Service Configuration Profiles
|
|
4
|
+
export * from "./configs";
|
|
5
|
+
// Kafka Events and Utilities
|
|
6
|
+
export * from "./events/kafka";
|
|
7
|
+
// Audit Logging
|
|
8
|
+
export * from "./lib/auditLogger";
|
|
9
|
+
// Auth Organization
|
|
10
|
+
export * from "./lib/authOrganization";
|
|
11
|
+
export { db, pool } from "./lib/db";
|
|
12
|
+
// Service Authentication
|
|
13
|
+
export * from "./middleware/serviceAuth";
|
|
14
|
+
export * from "./middleware/storeOwnership";
|
|
15
|
+
export * from "./middleware/storeValidationMiddleware";
|
|
16
|
+
export * from "./middleware/userAuth";
|
|
17
|
+
|
|
18
|
+
// Schemas - Organized by Service
|
|
19
|
+
export * from "./schemas";
|
|
20
|
+
|
|
21
|
+
// Types and Interfaces
|
|
22
|
+
export * from "./types/events";
|
|
23
|
+
|
|
24
|
+
// Utilities
|
|
25
|
+
export * from "./utils/errorHandler";
|
|
26
|
+
export * from "./utils/subdomain";
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
// Customer Service Events Configuration
|
|
2
|
-
export interface CustomerServiceConfig {
|
|
3
|
-
serviceName: string;
|
|
4
|
-
version: string;
|
|
5
|
-
events: CustomerServiceEvents;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface CustomerServiceEvents {
|
|
9
|
-
CUSTOMER_CREATED: "customer.created";
|
|
10
|
-
CUSTOMER_UPDATED: "customer.updated";
|
|
11
|
-
CUSTOMER_DELETED: "customer.deleted";
|
|
12
|
-
CUSTOMER_VISIT_CREATED: "customer.visit.created";
|
|
13
|
-
CUSTOMER_INTERACTION_CREATED: "customer.interaction.created";
|
|
14
|
-
CUSTOMER_NOTE_CREATED: "customer.note.created";
|
|
15
|
-
CUSTOMER_SUPPORT_TICKET_CREATED: "customer.support.ticket.created";
|
|
16
|
-
CUSTOMER_REVIEW_SUBMITTED: "customer.review.submitted";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Customer Service Event Types
|
|
20
|
-
export type CustomerEventType =
|
|
21
|
-
| "customer.created"
|
|
22
|
-
| "customer.updated"
|
|
23
|
-
| "customer.deleted"
|
|
24
|
-
| "customer.visit.created"
|
|
25
|
-
| "customer.interaction.created"
|
|
26
|
-
| "customer.note.created"
|
|
27
|
-
| "customer.support.ticket.created"
|
|
28
|
-
| "customer.review.submitted";
|
|
29
|
-
|
|
30
|
-
// Customer Event Payloads
|
|
31
|
-
export interface CustomerCreatedEvent {
|
|
32
|
-
customerId: string;
|
|
33
|
-
userId: string;
|
|
34
|
-
email: string;
|
|
35
|
-
firstName: string;
|
|
36
|
-
lastName: string;
|
|
37
|
-
customerType: string;
|
|
38
|
-
registrationSource: string;
|
|
39
|
-
storeLocationId?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface CustomerUpdatedEvent {
|
|
43
|
-
customerId: string;
|
|
44
|
-
userId: string;
|
|
45
|
-
changes: Record<string, unknown>;
|
|
46
|
-
previousValues: Record<string, unknown>;
|
|
47
|
-
registrationSourceChanged: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface CustomerDeletedEvent {
|
|
51
|
-
customerId: string;
|
|
52
|
-
userId: string;
|
|
53
|
-
email: string;
|
|
54
|
-
customerType: string;
|
|
55
|
-
registrationSource: string;
|
|
56
|
-
totalSpent: string;
|
|
57
|
-
totalOrders: number;
|
|
58
|
-
totalVisits: number;
|
|
59
|
-
totalInteractions: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface CustomerVisitCreatedEvent {
|
|
63
|
-
visitId: string;
|
|
64
|
-
customerId: string;
|
|
65
|
-
visitType: string;
|
|
66
|
-
storeLocationId?: string;
|
|
67
|
-
outcome?: string;
|
|
68
|
-
duration?: number;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface CustomerInteractionCreatedEvent {
|
|
72
|
-
interactionId: string;
|
|
73
|
-
customerId: string;
|
|
74
|
-
interactionType: string;
|
|
75
|
-
targetType?: string;
|
|
76
|
-
targetId?: string;
|
|
77
|
-
outcome?: string;
|
|
78
|
-
staffId?: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface CustomerNoteCreatedEvent {
|
|
82
|
-
noteId: string;
|
|
83
|
-
customerId: string;
|
|
84
|
-
noteType: string;
|
|
85
|
-
priority: string;
|
|
86
|
-
isAlert: boolean;
|
|
87
|
-
createdBy: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface CustomerSupportTicketCreatedEvent {
|
|
91
|
-
ticketId: string;
|
|
92
|
-
ticketNumber: string;
|
|
93
|
-
customerId: string;
|
|
94
|
-
subject: string;
|
|
95
|
-
category: string;
|
|
96
|
-
priority: string;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface CustomerReviewSubmittedEvent {
|
|
100
|
-
reviewId: string;
|
|
101
|
-
customerId: string;
|
|
102
|
-
targetType: string;
|
|
103
|
-
targetId: string;
|
|
104
|
-
rating: number;
|
|
105
|
-
isVerifiedPurchase: boolean;
|
|
106
|
-
}
|
|
1
|
+
// Customer Service Events Configuration
|
|
2
|
+
export interface CustomerServiceConfig {
|
|
3
|
+
serviceName: string;
|
|
4
|
+
version: string;
|
|
5
|
+
events: CustomerServiceEvents;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CustomerServiceEvents {
|
|
9
|
+
CUSTOMER_CREATED: "customer.created";
|
|
10
|
+
CUSTOMER_UPDATED: "customer.updated";
|
|
11
|
+
CUSTOMER_DELETED: "customer.deleted";
|
|
12
|
+
CUSTOMER_VISIT_CREATED: "customer.visit.created";
|
|
13
|
+
CUSTOMER_INTERACTION_CREATED: "customer.interaction.created";
|
|
14
|
+
CUSTOMER_NOTE_CREATED: "customer.note.created";
|
|
15
|
+
CUSTOMER_SUPPORT_TICKET_CREATED: "customer.support.ticket.created";
|
|
16
|
+
CUSTOMER_REVIEW_SUBMITTED: "customer.review.submitted";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Customer Service Event Types
|
|
20
|
+
export type CustomerEventType =
|
|
21
|
+
| "customer.created"
|
|
22
|
+
| "customer.updated"
|
|
23
|
+
| "customer.deleted"
|
|
24
|
+
| "customer.visit.created"
|
|
25
|
+
| "customer.interaction.created"
|
|
26
|
+
| "customer.note.created"
|
|
27
|
+
| "customer.support.ticket.created"
|
|
28
|
+
| "customer.review.submitted";
|
|
29
|
+
|
|
30
|
+
// Customer Event Payloads
|
|
31
|
+
export interface CustomerCreatedEvent {
|
|
32
|
+
customerId: string;
|
|
33
|
+
userId: string;
|
|
34
|
+
email: string;
|
|
35
|
+
firstName: string;
|
|
36
|
+
lastName: string;
|
|
37
|
+
customerType: string;
|
|
38
|
+
registrationSource: string;
|
|
39
|
+
storeLocationId?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CustomerUpdatedEvent {
|
|
43
|
+
customerId: string;
|
|
44
|
+
userId: string;
|
|
45
|
+
changes: Record<string, unknown>;
|
|
46
|
+
previousValues: Record<string, unknown>;
|
|
47
|
+
registrationSourceChanged: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface CustomerDeletedEvent {
|
|
51
|
+
customerId: string;
|
|
52
|
+
userId: string;
|
|
53
|
+
email: string;
|
|
54
|
+
customerType: string;
|
|
55
|
+
registrationSource: string;
|
|
56
|
+
totalSpent: string;
|
|
57
|
+
totalOrders: number;
|
|
58
|
+
totalVisits: number;
|
|
59
|
+
totalInteractions: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface CustomerVisitCreatedEvent {
|
|
63
|
+
visitId: string;
|
|
64
|
+
customerId: string;
|
|
65
|
+
visitType: string;
|
|
66
|
+
storeLocationId?: string;
|
|
67
|
+
outcome?: string;
|
|
68
|
+
duration?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface CustomerInteractionCreatedEvent {
|
|
72
|
+
interactionId: string;
|
|
73
|
+
customerId: string;
|
|
74
|
+
interactionType: string;
|
|
75
|
+
targetType?: string;
|
|
76
|
+
targetId?: string;
|
|
77
|
+
outcome?: string;
|
|
78
|
+
staffId?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface CustomerNoteCreatedEvent {
|
|
82
|
+
noteId: string;
|
|
83
|
+
customerId: string;
|
|
84
|
+
noteType: string;
|
|
85
|
+
priority: string;
|
|
86
|
+
isAlert: boolean;
|
|
87
|
+
createdBy: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface CustomerSupportTicketCreatedEvent {
|
|
91
|
+
ticketId: string;
|
|
92
|
+
ticketNumber: string;
|
|
93
|
+
customerId: string;
|
|
94
|
+
subject: string;
|
|
95
|
+
category: string;
|
|
96
|
+
priority: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface CustomerReviewSubmittedEvent {
|
|
100
|
+
reviewId: string;
|
|
101
|
+
customerId: string;
|
|
102
|
+
targetType: string;
|
|
103
|
+
targetId: string;
|
|
104
|
+
rating: number;
|
|
105
|
+
isVerifiedPurchase: boolean;
|
|
106
|
+
}
|