@axova/shared 1.0.9 → 1.1.1
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/lib/db.d.ts +198 -18
- package/dist/schemas/ai-moderation/ai-moderation-schema.d.ts +2 -2
- package/dist/schemas/compliance/compliance-schema.d.ts +2 -2
- package/dist/schemas/compliance/kyc-schema.d.ts +4 -4
- package/dist/schemas/inventory/inventory-tables.d.ts +6 -6
- package/dist/schemas/inventory/lot-tables.d.ts +10 -10
- package/dist/schemas/order/cart-schema.d.ts +3 -3
- package/dist/schemas/order/order-schema.d.ts +1 -1
- package/dist/schemas/product/discount-schema.d.ts +1 -1
- package/dist/schemas/store/store-audit-schema.d.ts +6 -6
- package/dist/schemas/store/store-schema.d.ts +182 -2
- package/dist/schemas/store/store-schema.js +19 -0
- package/dist/types/events.d.ts +181 -1
- package/dist/types/events.js +37 -1
- package/package.json +2 -2
- package/src/schemas/store/store-schema.ts +21 -0
- package/src/types/events.ts +45 -0
|
@@ -1580,7 +1580,7 @@ export declare const storeAuditLogs: import("drizzle-orm/pg-core").PgTableWithCo
|
|
|
1580
1580
|
tableName: "store_audit_logs";
|
|
1581
1581
|
dataType: "string";
|
|
1582
1582
|
columnType: "PgVarchar";
|
|
1583
|
-
data: "
|
|
1583
|
+
data: "FAILED" | "IN_PROGRESS" | "INITIATED" | "COMPLETED" | "CANCELLED" | "SUSPENDED";
|
|
1584
1584
|
driverParam: string;
|
|
1585
1585
|
notNull: false;
|
|
1586
1586
|
hasDefault: false;
|
|
@@ -1593,7 +1593,7 @@ export declare const storeAuditLogs: import("drizzle-orm/pg-core").PgTableWithCo
|
|
|
1593
1593
|
generated: undefined;
|
|
1594
1594
|
}, {}, {
|
|
1595
1595
|
length: 30;
|
|
1596
|
-
$type: "
|
|
1596
|
+
$type: "FAILED" | "IN_PROGRESS" | "INITIATED" | "COMPLETED" | "CANCELLED" | "SUSPENDED";
|
|
1597
1597
|
}>;
|
|
1598
1598
|
parentEventId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1599
1599
|
name: "parent_event_id";
|
|
@@ -1757,7 +1757,7 @@ export declare const storeAuditLogs: import("drizzle-orm/pg-core").PgTableWithCo
|
|
|
1757
1757
|
tableName: "store_audit_logs";
|
|
1758
1758
|
dataType: "string";
|
|
1759
1759
|
columnType: "PgVarchar";
|
|
1760
|
-
data: "PENDING" | "
|
|
1760
|
+
data: "PENDING" | "FAILED" | "PARTIAL" | "SYNCED" | "CONFLICT";
|
|
1761
1761
|
driverParam: string;
|
|
1762
1762
|
notNull: false;
|
|
1763
1763
|
hasDefault: false;
|
|
@@ -1770,7 +1770,7 @@ export declare const storeAuditLogs: import("drizzle-orm/pg-core").PgTableWithCo
|
|
|
1770
1770
|
generated: undefined;
|
|
1771
1771
|
}, {}, {
|
|
1772
1772
|
length: 20;
|
|
1773
|
-
$type: "PENDING" | "
|
|
1773
|
+
$type: "PENDING" | "FAILED" | "PARTIAL" | "SYNCED" | "CONFLICT";
|
|
1774
1774
|
}>;
|
|
1775
1775
|
alertLevel: import("drizzle-orm/pg-core").PgColumn<{
|
|
1776
1776
|
name: "alert_level";
|
|
@@ -3368,7 +3368,7 @@ export declare const storeAuditTrails: import("drizzle-orm/pg-core").PgTableWith
|
|
|
3368
3368
|
tableName: "store_audit_trails";
|
|
3369
3369
|
dataType: "string";
|
|
3370
3370
|
columnType: "PgVarchar";
|
|
3371
|
-
data: "PENDING" | "
|
|
3371
|
+
data: "PENDING" | "FAILED" | "COMPLETED" | "CANCELLED" | "SUSPENDED" | "ACTIVE" | "ARCHIVED";
|
|
3372
3372
|
driverParam: string;
|
|
3373
3373
|
notNull: true;
|
|
3374
3374
|
hasDefault: true;
|
|
@@ -3381,7 +3381,7 @@ export declare const storeAuditTrails: import("drizzle-orm/pg-core").PgTableWith
|
|
|
3381
3381
|
generated: undefined;
|
|
3382
3382
|
}, {}, {
|
|
3383
3383
|
length: 20;
|
|
3384
|
-
$type: "PENDING" | "
|
|
3384
|
+
$type: "PENDING" | "FAILED" | "COMPLETED" | "CANCELLED" | "SUSPENDED" | "ACTIVE" | "ARCHIVED";
|
|
3385
3385
|
}>;
|
|
3386
3386
|
startedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
3387
3387
|
name: "started_at";
|
|
@@ -341,6 +341,186 @@ export declare const stores: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
341
341
|
}, {}, {
|
|
342
342
|
$type: string[];
|
|
343
343
|
}>;
|
|
344
|
+
tinVerificationStatus: import("drizzle-orm/pg-core").PgColumn<{
|
|
345
|
+
name: "tin_verification_status";
|
|
346
|
+
tableName: "stores";
|
|
347
|
+
dataType: "string";
|
|
348
|
+
columnType: "PgVarchar";
|
|
349
|
+
data: "UNVERIFIED" | "PENDING" | "VERIFIED" | "FAILED" | "EXPIRED";
|
|
350
|
+
driverParam: string;
|
|
351
|
+
notNull: false;
|
|
352
|
+
hasDefault: true;
|
|
353
|
+
isPrimaryKey: false;
|
|
354
|
+
isAutoincrement: false;
|
|
355
|
+
hasRuntimeDefault: false;
|
|
356
|
+
enumValues: [string, ...string[]];
|
|
357
|
+
baseColumn: never;
|
|
358
|
+
identity: undefined;
|
|
359
|
+
generated: undefined;
|
|
360
|
+
}, {}, {
|
|
361
|
+
length: 30;
|
|
362
|
+
$type: "UNVERIFIED" | "PENDING" | "VERIFIED" | "FAILED" | "EXPIRED";
|
|
363
|
+
}>;
|
|
364
|
+
tinVerifiedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
365
|
+
name: "tin_verified_at";
|
|
366
|
+
tableName: "stores";
|
|
367
|
+
dataType: "date";
|
|
368
|
+
columnType: "PgTimestamp";
|
|
369
|
+
data: Date;
|
|
370
|
+
driverParam: string;
|
|
371
|
+
notNull: false;
|
|
372
|
+
hasDefault: false;
|
|
373
|
+
isPrimaryKey: false;
|
|
374
|
+
isAutoincrement: false;
|
|
375
|
+
hasRuntimeDefault: false;
|
|
376
|
+
enumValues: undefined;
|
|
377
|
+
baseColumn: never;
|
|
378
|
+
identity: undefined;
|
|
379
|
+
generated: undefined;
|
|
380
|
+
}, {}, {}>;
|
|
381
|
+
tinVerifiedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
382
|
+
name: "tin_verified_by";
|
|
383
|
+
tableName: "stores";
|
|
384
|
+
dataType: "string";
|
|
385
|
+
columnType: "PgText";
|
|
386
|
+
data: string;
|
|
387
|
+
driverParam: string;
|
|
388
|
+
notNull: false;
|
|
389
|
+
hasDefault: false;
|
|
390
|
+
isPrimaryKey: false;
|
|
391
|
+
isAutoincrement: false;
|
|
392
|
+
hasRuntimeDefault: false;
|
|
393
|
+
enumValues: [string, ...string[]];
|
|
394
|
+
baseColumn: never;
|
|
395
|
+
identity: undefined;
|
|
396
|
+
generated: undefined;
|
|
397
|
+
}, {}, {}>;
|
|
398
|
+
tinVerificationData: import("drizzle-orm/pg-core").PgColumn<{
|
|
399
|
+
name: "tin_verification_data";
|
|
400
|
+
tableName: "stores";
|
|
401
|
+
dataType: "json";
|
|
402
|
+
columnType: "PgJsonb";
|
|
403
|
+
data: Record<string, unknown>;
|
|
404
|
+
driverParam: unknown;
|
|
405
|
+
notNull: false;
|
|
406
|
+
hasDefault: true;
|
|
407
|
+
isPrimaryKey: false;
|
|
408
|
+
isAutoincrement: false;
|
|
409
|
+
hasRuntimeDefault: false;
|
|
410
|
+
enumValues: undefined;
|
|
411
|
+
baseColumn: never;
|
|
412
|
+
identity: undefined;
|
|
413
|
+
generated: undefined;
|
|
414
|
+
}, {}, {
|
|
415
|
+
$type: Record<string, unknown>;
|
|
416
|
+
}>;
|
|
417
|
+
tinVerificationErrors: import("drizzle-orm/pg-core").PgColumn<{
|
|
418
|
+
name: "tin_verification_errors";
|
|
419
|
+
tableName: "stores";
|
|
420
|
+
dataType: "json";
|
|
421
|
+
columnType: "PgJsonb";
|
|
422
|
+
data: string[];
|
|
423
|
+
driverParam: unknown;
|
|
424
|
+
notNull: false;
|
|
425
|
+
hasDefault: true;
|
|
426
|
+
isPrimaryKey: false;
|
|
427
|
+
isAutoincrement: false;
|
|
428
|
+
hasRuntimeDefault: false;
|
|
429
|
+
enumValues: undefined;
|
|
430
|
+
baseColumn: never;
|
|
431
|
+
identity: undefined;
|
|
432
|
+
generated: undefined;
|
|
433
|
+
}, {}, {
|
|
434
|
+
$type: string[];
|
|
435
|
+
}>;
|
|
436
|
+
tinLastChecked: import("drizzle-orm/pg-core").PgColumn<{
|
|
437
|
+
name: "tin_last_checked";
|
|
438
|
+
tableName: "stores";
|
|
439
|
+
dataType: "date";
|
|
440
|
+
columnType: "PgTimestamp";
|
|
441
|
+
data: Date;
|
|
442
|
+
driverParam: string;
|
|
443
|
+
notNull: false;
|
|
444
|
+
hasDefault: false;
|
|
445
|
+
isPrimaryKey: false;
|
|
446
|
+
isAutoincrement: false;
|
|
447
|
+
hasRuntimeDefault: false;
|
|
448
|
+
enumValues: undefined;
|
|
449
|
+
baseColumn: never;
|
|
450
|
+
identity: undefined;
|
|
451
|
+
generated: undefined;
|
|
452
|
+
}, {}, {}>;
|
|
453
|
+
businessTypeChangedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
454
|
+
name: "business_type_changed_at";
|
|
455
|
+
tableName: "stores";
|
|
456
|
+
dataType: "date";
|
|
457
|
+
columnType: "PgTimestamp";
|
|
458
|
+
data: Date;
|
|
459
|
+
driverParam: string;
|
|
460
|
+
notNull: false;
|
|
461
|
+
hasDefault: false;
|
|
462
|
+
isPrimaryKey: false;
|
|
463
|
+
isAutoincrement: false;
|
|
464
|
+
hasRuntimeDefault: false;
|
|
465
|
+
enumValues: undefined;
|
|
466
|
+
baseColumn: never;
|
|
467
|
+
identity: undefined;
|
|
468
|
+
generated: undefined;
|
|
469
|
+
}, {}, {}>;
|
|
470
|
+
businessTypeChangedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
471
|
+
name: "business_type_changed_by";
|
|
472
|
+
tableName: "stores";
|
|
473
|
+
dataType: "string";
|
|
474
|
+
columnType: "PgText";
|
|
475
|
+
data: string;
|
|
476
|
+
driverParam: string;
|
|
477
|
+
notNull: false;
|
|
478
|
+
hasDefault: false;
|
|
479
|
+
isPrimaryKey: false;
|
|
480
|
+
isAutoincrement: false;
|
|
481
|
+
hasRuntimeDefault: false;
|
|
482
|
+
enumValues: [string, ...string[]];
|
|
483
|
+
baseColumn: never;
|
|
484
|
+
identity: undefined;
|
|
485
|
+
generated: undefined;
|
|
486
|
+
}, {}, {}>;
|
|
487
|
+
businessTypeChangeReason: import("drizzle-orm/pg-core").PgColumn<{
|
|
488
|
+
name: "business_type_change_reason";
|
|
489
|
+
tableName: "stores";
|
|
490
|
+
dataType: "string";
|
|
491
|
+
columnType: "PgText";
|
|
492
|
+
data: string;
|
|
493
|
+
driverParam: string;
|
|
494
|
+
notNull: false;
|
|
495
|
+
hasDefault: false;
|
|
496
|
+
isPrimaryKey: false;
|
|
497
|
+
isAutoincrement: false;
|
|
498
|
+
hasRuntimeDefault: false;
|
|
499
|
+
enumValues: [string, ...string[]];
|
|
500
|
+
baseColumn: never;
|
|
501
|
+
identity: undefined;
|
|
502
|
+
generated: undefined;
|
|
503
|
+
}, {}, {}>;
|
|
504
|
+
previousBusinessType: import("drizzle-orm/pg-core").PgColumn<{
|
|
505
|
+
name: "previous_business_type";
|
|
506
|
+
tableName: "stores";
|
|
507
|
+
dataType: "string";
|
|
508
|
+
columnType: "PgVarchar";
|
|
509
|
+
data: "starter" | "business_owner";
|
|
510
|
+
driverParam: string;
|
|
511
|
+
notNull: false;
|
|
512
|
+
hasDefault: false;
|
|
513
|
+
isPrimaryKey: false;
|
|
514
|
+
isAutoincrement: false;
|
|
515
|
+
hasRuntimeDefault: false;
|
|
516
|
+
enumValues: [string, ...string[]];
|
|
517
|
+
baseColumn: never;
|
|
518
|
+
identity: undefined;
|
|
519
|
+
generated: undefined;
|
|
520
|
+
}, {}, {
|
|
521
|
+
length: 20;
|
|
522
|
+
$type: "starter" | "business_owner";
|
|
523
|
+
}>;
|
|
344
524
|
attributes: import("drizzle-orm/pg-core").PgColumn<{
|
|
345
525
|
name: "attributes";
|
|
346
526
|
tableName: "stores";
|
|
@@ -1006,7 +1186,7 @@ export declare const storeBusinessDetails: import("drizzle-orm/pg-core").PgTable
|
|
|
1006
1186
|
tableName: "store_business_details";
|
|
1007
1187
|
dataType: "string";
|
|
1008
1188
|
columnType: "PgVarchar";
|
|
1009
|
-
data: "REJECTED" | "PENDING" | "
|
|
1189
|
+
data: "REJECTED" | "PENDING" | "VERIFIED" | "IN_PROGRESS" | "REQUIRES_UPDATE";
|
|
1010
1190
|
driverParam: string;
|
|
1011
1191
|
notNull: true;
|
|
1012
1192
|
hasDefault: true;
|
|
@@ -1019,7 +1199,7 @@ export declare const storeBusinessDetails: import("drizzle-orm/pg-core").PgTable
|
|
|
1019
1199
|
generated: undefined;
|
|
1020
1200
|
}, {}, {
|
|
1021
1201
|
length: 30;
|
|
1022
|
-
$type: "REJECTED" | "PENDING" | "
|
|
1202
|
+
$type: "REJECTED" | "PENDING" | "VERIFIED" | "IN_PROGRESS" | "REQUIRES_UPDATE";
|
|
1023
1203
|
}>;
|
|
1024
1204
|
verificationDocuments: import("drizzle-orm/pg-core").PgColumn<{
|
|
1025
1205
|
name: "verification_documents";
|
|
@@ -37,6 +37,25 @@ exports.stores = (0, pg_core_1.pgTable)("stores", {
|
|
|
37
37
|
woreda: (0, pg_core_1.varchar)("woreda", { length: 100 }),
|
|
38
38
|
houseNumber: (0, pg_core_1.varchar)("house_number", { length: 50 }),
|
|
39
39
|
tradeNames: (0, pg_core_1.jsonb)("trade_names").$type().default([]),
|
|
40
|
+
// TIN Verification Status Tracking
|
|
41
|
+
tinVerificationStatus: (0, pg_core_1.varchar)("tin_verification_status", { length: 30 })
|
|
42
|
+
.$type()
|
|
43
|
+
.default("UNVERIFIED"),
|
|
44
|
+
tinVerifiedAt: (0, pg_core_1.timestamp)("tin_verified_at", { withTimezone: true }),
|
|
45
|
+
tinVerifiedBy: (0, pg_core_1.text)("tin_verified_by"),
|
|
46
|
+
tinVerificationData: (0, pg_core_1.jsonb)("tin_verification_data")
|
|
47
|
+
.$type()
|
|
48
|
+
.default({}),
|
|
49
|
+
tinVerificationErrors: (0, pg_core_1.jsonb)("tin_verification_errors")
|
|
50
|
+
.$type()
|
|
51
|
+
.default([]),
|
|
52
|
+
tinLastChecked: (0, pg_core_1.timestamp)("tin_last_checked", { withTimezone: true }),
|
|
53
|
+
// Business Type Change Tracking
|
|
54
|
+
businessTypeChangedAt: (0, pg_core_1.timestamp)("business_type_changed_at", { withTimezone: true }),
|
|
55
|
+
businessTypeChangedBy: (0, pg_core_1.text)("business_type_changed_by"),
|
|
56
|
+
businessTypeChangeReason: (0, pg_core_1.text)("business_type_change_reason"),
|
|
57
|
+
previousBusinessType: (0, pg_core_1.varchar)("previous_business_type", { length: 20 })
|
|
58
|
+
.$type(),
|
|
40
59
|
// Store Additional Details
|
|
41
60
|
attributes: (0, pg_core_1.jsonb)("attributes")
|
|
42
61
|
.$type()
|
package/dist/types/events.d.ts
CHANGED
|
@@ -131,6 +131,180 @@ export declare const StoreUpdatedEventSchema: z.ZodObject<{
|
|
|
131
131
|
};
|
|
132
132
|
version?: string | undefined;
|
|
133
133
|
}>;
|
|
134
|
+
export declare const StoreTinUpdatedEventSchema: z.ZodObject<{
|
|
135
|
+
id: z.ZodString;
|
|
136
|
+
timestamp: z.ZodString;
|
|
137
|
+
source: z.ZodString;
|
|
138
|
+
version: z.ZodDefault<z.ZodString>;
|
|
139
|
+
} & {
|
|
140
|
+
type: z.ZodLiteral<"store.tin.updated">;
|
|
141
|
+
data: z.ZodObject<{
|
|
142
|
+
storeId: z.ZodString;
|
|
143
|
+
tinNumber: z.ZodString;
|
|
144
|
+
businessType: z.ZodOptional<z.ZodString>;
|
|
145
|
+
verificationStatus: z.ZodString;
|
|
146
|
+
userId: z.ZodString;
|
|
147
|
+
timestamp: z.ZodString;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
timestamp: string;
|
|
150
|
+
storeId: string;
|
|
151
|
+
userId: string;
|
|
152
|
+
tinNumber: string;
|
|
153
|
+
verificationStatus: string;
|
|
154
|
+
businessType?: string | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
timestamp: string;
|
|
157
|
+
storeId: string;
|
|
158
|
+
userId: string;
|
|
159
|
+
tinNumber: string;
|
|
160
|
+
verificationStatus: string;
|
|
161
|
+
businessType?: string | undefined;
|
|
162
|
+
}>;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
id: string;
|
|
165
|
+
timestamp: string;
|
|
166
|
+
source: string;
|
|
167
|
+
version: string;
|
|
168
|
+
type: "store.tin.updated";
|
|
169
|
+
data: {
|
|
170
|
+
timestamp: string;
|
|
171
|
+
storeId: string;
|
|
172
|
+
userId: string;
|
|
173
|
+
tinNumber: string;
|
|
174
|
+
verificationStatus: string;
|
|
175
|
+
businessType?: string | undefined;
|
|
176
|
+
};
|
|
177
|
+
}, {
|
|
178
|
+
id: string;
|
|
179
|
+
timestamp: string;
|
|
180
|
+
source: string;
|
|
181
|
+
type: "store.tin.updated";
|
|
182
|
+
data: {
|
|
183
|
+
timestamp: string;
|
|
184
|
+
storeId: string;
|
|
185
|
+
userId: string;
|
|
186
|
+
tinNumber: string;
|
|
187
|
+
verificationStatus: string;
|
|
188
|
+
businessType?: string | undefined;
|
|
189
|
+
};
|
|
190
|
+
version?: string | undefined;
|
|
191
|
+
}>;
|
|
192
|
+
export declare const StoreTinReverifiedEventSchema: z.ZodObject<{
|
|
193
|
+
id: z.ZodString;
|
|
194
|
+
timestamp: z.ZodString;
|
|
195
|
+
source: z.ZodString;
|
|
196
|
+
version: z.ZodDefault<z.ZodString>;
|
|
197
|
+
} & {
|
|
198
|
+
type: z.ZodLiteral<"store.tin.reverified">;
|
|
199
|
+
data: z.ZodObject<{
|
|
200
|
+
storeId: z.ZodString;
|
|
201
|
+
tinNumber: z.ZodString;
|
|
202
|
+
previousStatus: z.ZodString;
|
|
203
|
+
newStatus: z.ZodString;
|
|
204
|
+
userId: z.ZodString;
|
|
205
|
+
timestamp: z.ZodString;
|
|
206
|
+
}, "strip", z.ZodTypeAny, {
|
|
207
|
+
timestamp: string;
|
|
208
|
+
storeId: string;
|
|
209
|
+
userId: string;
|
|
210
|
+
tinNumber: string;
|
|
211
|
+
previousStatus: string;
|
|
212
|
+
newStatus: string;
|
|
213
|
+
}, {
|
|
214
|
+
timestamp: string;
|
|
215
|
+
storeId: string;
|
|
216
|
+
userId: string;
|
|
217
|
+
tinNumber: string;
|
|
218
|
+
previousStatus: string;
|
|
219
|
+
newStatus: string;
|
|
220
|
+
}>;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
id: string;
|
|
223
|
+
timestamp: string;
|
|
224
|
+
source: string;
|
|
225
|
+
version: string;
|
|
226
|
+
type: "store.tin.reverified";
|
|
227
|
+
data: {
|
|
228
|
+
timestamp: string;
|
|
229
|
+
storeId: string;
|
|
230
|
+
userId: string;
|
|
231
|
+
tinNumber: string;
|
|
232
|
+
previousStatus: string;
|
|
233
|
+
newStatus: string;
|
|
234
|
+
};
|
|
235
|
+
}, {
|
|
236
|
+
id: string;
|
|
237
|
+
timestamp: string;
|
|
238
|
+
source: string;
|
|
239
|
+
type: "store.tin.reverified";
|
|
240
|
+
data: {
|
|
241
|
+
timestamp: string;
|
|
242
|
+
storeId: string;
|
|
243
|
+
userId: string;
|
|
244
|
+
tinNumber: string;
|
|
245
|
+
previousStatus: string;
|
|
246
|
+
newStatus: string;
|
|
247
|
+
};
|
|
248
|
+
version?: string | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
export declare const StoreBusinessTypeChangedEventSchema: z.ZodObject<{
|
|
251
|
+
id: z.ZodString;
|
|
252
|
+
timestamp: z.ZodString;
|
|
253
|
+
source: z.ZodString;
|
|
254
|
+
version: z.ZodDefault<z.ZodString>;
|
|
255
|
+
} & {
|
|
256
|
+
type: z.ZodLiteral<"store.businessType.changed">;
|
|
257
|
+
data: z.ZodObject<{
|
|
258
|
+
storeId: z.ZodString;
|
|
259
|
+
previousType: z.ZodString;
|
|
260
|
+
newType: z.ZodString;
|
|
261
|
+
userId: z.ZodString;
|
|
262
|
+
timestamp: z.ZodString;
|
|
263
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
timestamp: string;
|
|
266
|
+
storeId: string;
|
|
267
|
+
userId: string;
|
|
268
|
+
previousType: string;
|
|
269
|
+
newType: string;
|
|
270
|
+
reason?: string | undefined;
|
|
271
|
+
}, {
|
|
272
|
+
timestamp: string;
|
|
273
|
+
storeId: string;
|
|
274
|
+
userId: string;
|
|
275
|
+
previousType: string;
|
|
276
|
+
newType: string;
|
|
277
|
+
reason?: string | undefined;
|
|
278
|
+
}>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
id: string;
|
|
281
|
+
timestamp: string;
|
|
282
|
+
source: string;
|
|
283
|
+
version: string;
|
|
284
|
+
type: "store.businessType.changed";
|
|
285
|
+
data: {
|
|
286
|
+
timestamp: string;
|
|
287
|
+
storeId: string;
|
|
288
|
+
userId: string;
|
|
289
|
+
previousType: string;
|
|
290
|
+
newType: string;
|
|
291
|
+
reason?: string | undefined;
|
|
292
|
+
};
|
|
293
|
+
}, {
|
|
294
|
+
id: string;
|
|
295
|
+
timestamp: string;
|
|
296
|
+
source: string;
|
|
297
|
+
type: "store.businessType.changed";
|
|
298
|
+
data: {
|
|
299
|
+
timestamp: string;
|
|
300
|
+
storeId: string;
|
|
301
|
+
userId: string;
|
|
302
|
+
previousType: string;
|
|
303
|
+
newType: string;
|
|
304
|
+
reason?: string | undefined;
|
|
305
|
+
};
|
|
306
|
+
version?: string | undefined;
|
|
307
|
+
}>;
|
|
134
308
|
export declare const ComplianceViolationDetectedEventSchema: z.ZodObject<{
|
|
135
309
|
id: z.ZodString;
|
|
136
310
|
timestamp: z.ZodString;
|
|
@@ -559,6 +733,9 @@ export declare const AppealReviewedEventSchema: z.ZodObject<{
|
|
|
559
733
|
}>;
|
|
560
734
|
export type StoreCreatedEvent = z.infer<typeof StoreCreatedEventSchema>;
|
|
561
735
|
export type StoreUpdatedEvent = z.infer<typeof StoreUpdatedEventSchema>;
|
|
736
|
+
export type StoreTinUpdatedEvent = z.infer<typeof StoreTinUpdatedEventSchema>;
|
|
737
|
+
export type StoreTinReverifiedEvent = z.infer<typeof StoreTinReverifiedEventSchema>;
|
|
738
|
+
export type StoreBusinessTypeChangedEvent = z.infer<typeof StoreBusinessTypeChangedEventSchema>;
|
|
562
739
|
export type ComplianceViolationDetectedEvent = z.infer<typeof ComplianceViolationDetectedEventSchema>;
|
|
563
740
|
export type StoreSuspendedEvent = z.infer<typeof StoreSuspendedEventSchema>;
|
|
564
741
|
export type StoreUnbannedEvent = z.infer<typeof StoreUnbannedEventSchema>;
|
|
@@ -2361,10 +2538,13 @@ export type CustomerInteractionCreatedEvent = z.infer<typeof CustomerInteraction
|
|
|
2361
2538
|
export type CustomerNoteCreatedEvent = z.infer<typeof CustomerNoteCreatedEventSchema>;
|
|
2362
2539
|
export type CustomerSupportTicketCreatedEvent = z.infer<typeof CustomerSupportTicketCreatedEventSchema>;
|
|
2363
2540
|
export type CustomerReviewSubmittedEvent = z.infer<typeof CustomerReviewSubmittedEventSchema>;
|
|
2364
|
-
export type AxovaEvent = StoreCreatedEvent | StoreUpdatedEvent | ComplianceViolationDetectedEvent | StoreSuspendedEvent | StoreUnbannedEvent | NotificationSendEvent | AuditLoggedEvent | AppealSubmittedEvent | AppealReviewedEvent | OrderCreatedEvent | OrderUpdatedEvent | OrderStatusChangedEvent | OrderPaymentProcessedEvent | OrderShippedEvent | OrderDeliveredEvent | OrderCancelledEvent | OrderRefundedEvent | OrderNoteAddedEvent | OrderItemAddedEvent | OrderItemRemovedEvent | OrderDiscountAppliedEvent | SubscriptionOrderCreatedEvent | SubscriptionRenewedEvent | SubscriptionCancelledEvent | OrderReturnRequestedEvent | OrderRefundProcessedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | CustomerDeletedEvent | CustomerVisitCreatedEvent | CustomerInteractionCreatedEvent | CustomerNoteCreatedEvent | CustomerSupportTicketCreatedEvent | CustomerReviewSubmittedEvent;
|
|
2541
|
+
export type AxovaEvent = StoreCreatedEvent | StoreUpdatedEvent | StoreTinUpdatedEvent | StoreTinReverifiedEvent | StoreBusinessTypeChangedEvent | ComplianceViolationDetectedEvent | StoreSuspendedEvent | StoreUnbannedEvent | NotificationSendEvent | AuditLoggedEvent | AppealSubmittedEvent | AppealReviewedEvent | OrderCreatedEvent | OrderUpdatedEvent | OrderStatusChangedEvent | OrderPaymentProcessedEvent | OrderShippedEvent | OrderDeliveredEvent | OrderCancelledEvent | OrderRefundedEvent | OrderNoteAddedEvent | OrderItemAddedEvent | OrderItemRemovedEvent | OrderDiscountAppliedEvent | SubscriptionOrderCreatedEvent | SubscriptionRenewedEvent | SubscriptionCancelledEvent | OrderReturnRequestedEvent | OrderRefundProcessedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | CustomerDeletedEvent | CustomerVisitCreatedEvent | CustomerInteractionCreatedEvent | CustomerNoteCreatedEvent | CustomerSupportTicketCreatedEvent | CustomerReviewSubmittedEvent;
|
|
2365
2542
|
export declare const KAFKA_TOPICS: {
|
|
2366
2543
|
readonly STORE_CREATED: "store.created";
|
|
2367
2544
|
readonly STORE_UPDATED: "store.updated";
|
|
2545
|
+
readonly STORE_TIN_UPDATED: "store.tin.updated";
|
|
2546
|
+
readonly STORE_TIN_REVERIFIED: "store.tin.reverified";
|
|
2547
|
+
readonly STORE_BUSINESS_TYPE_CHANGED: "store.businessType.changed";
|
|
2368
2548
|
readonly COMPLIANCE_VIOLATION_DETECTED: "compliance.violation.detected";
|
|
2369
2549
|
readonly STORE_SUSPENDED: "store.suspended";
|
|
2370
2550
|
readonly STORE_UNBANNED: "store.unbanned";
|
package/dist/types/events.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KAFKA_TOPICS = exports.OrderRefundProcessedEventSchema = exports.OrderReturnRequestedEventSchema = exports.SubscriptionCancelledEventSchema = exports.SubscriptionRenewedEventSchema = exports.SubscriptionOrderCreatedEventSchema = exports.OrderDiscountAppliedEventSchema = exports.OrderItemRemovedEventSchema = exports.OrderItemAddedEventSchema = exports.OrderNoteAddedEventSchema = exports.OrderRefundedEventSchema = exports.OrderCancelledEventSchema = exports.OrderDeliveredEventSchema = exports.OrderShippedEventSchema = exports.OrderPaymentProcessedEventSchema = exports.OrderStatusChangedEventSchema = exports.OrderUpdatedEventSchema = exports.OrderCreatedEventSchema = exports.CustomerReviewSubmittedEventSchema = exports.CustomerSupportTicketCreatedEventSchema = exports.CustomerNoteCreatedEventSchema = exports.CustomerInteractionCreatedEventSchema = exports.CustomerVisitCreatedEventSchema = exports.CustomerDeletedEventSchema = exports.CustomerUpdatedEventSchema = exports.CustomerCreatedEventSchema = exports.AppealReviewedEventSchema = exports.AppealSubmittedEventSchema = exports.AuditLoggedEventSchema = exports.NotificationSendEventSchema = exports.StoreUnbannedEventSchema = exports.StoreSuspendedEventSchema = exports.ComplianceViolationDetectedEventSchema = exports.StoreUpdatedEventSchema = exports.StoreCreatedEventSchema = exports.BaseEventSchema = void 0;
|
|
3
|
+
exports.KAFKA_TOPICS = exports.OrderRefundProcessedEventSchema = exports.OrderReturnRequestedEventSchema = exports.SubscriptionCancelledEventSchema = exports.SubscriptionRenewedEventSchema = exports.SubscriptionOrderCreatedEventSchema = exports.OrderDiscountAppliedEventSchema = exports.OrderItemRemovedEventSchema = exports.OrderItemAddedEventSchema = exports.OrderNoteAddedEventSchema = exports.OrderRefundedEventSchema = exports.OrderCancelledEventSchema = exports.OrderDeliveredEventSchema = exports.OrderShippedEventSchema = exports.OrderPaymentProcessedEventSchema = exports.OrderStatusChangedEventSchema = exports.OrderUpdatedEventSchema = exports.OrderCreatedEventSchema = exports.CustomerReviewSubmittedEventSchema = exports.CustomerSupportTicketCreatedEventSchema = exports.CustomerNoteCreatedEventSchema = exports.CustomerInteractionCreatedEventSchema = exports.CustomerVisitCreatedEventSchema = exports.CustomerDeletedEventSchema = exports.CustomerUpdatedEventSchema = exports.CustomerCreatedEventSchema = exports.AppealReviewedEventSchema = exports.AppealSubmittedEventSchema = exports.AuditLoggedEventSchema = exports.NotificationSendEventSchema = exports.StoreUnbannedEventSchema = exports.StoreSuspendedEventSchema = exports.ComplianceViolationDetectedEventSchema = exports.StoreBusinessTypeChangedEventSchema = exports.StoreTinReverifiedEventSchema = exports.StoreTinUpdatedEventSchema = exports.StoreUpdatedEventSchema = exports.StoreCreatedEventSchema = exports.BaseEventSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
// Base event schema
|
|
6
6
|
exports.BaseEventSchema = zod_1.z.object({
|
|
@@ -32,6 +32,39 @@ exports.StoreUpdatedEventSchema = exports.BaseEventSchema.extend({
|
|
|
32
32
|
previousValues: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
33
33
|
}),
|
|
34
34
|
});
|
|
35
|
+
exports.StoreTinUpdatedEventSchema = exports.BaseEventSchema.extend({
|
|
36
|
+
type: zod_1.z.literal("store.tin.updated"),
|
|
37
|
+
data: zod_1.z.object({
|
|
38
|
+
storeId: zod_1.z.string(),
|
|
39
|
+
tinNumber: zod_1.z.string(),
|
|
40
|
+
businessType: zod_1.z.string().optional(),
|
|
41
|
+
verificationStatus: zod_1.z.string(),
|
|
42
|
+
userId: zod_1.z.string(),
|
|
43
|
+
timestamp: zod_1.z.string(),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
exports.StoreTinReverifiedEventSchema = exports.BaseEventSchema.extend({
|
|
47
|
+
type: zod_1.z.literal("store.tin.reverified"),
|
|
48
|
+
data: zod_1.z.object({
|
|
49
|
+
storeId: zod_1.z.string(),
|
|
50
|
+
tinNumber: zod_1.z.string(),
|
|
51
|
+
previousStatus: zod_1.z.string(),
|
|
52
|
+
newStatus: zod_1.z.string(),
|
|
53
|
+
userId: zod_1.z.string(),
|
|
54
|
+
timestamp: zod_1.z.string(),
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
exports.StoreBusinessTypeChangedEventSchema = exports.BaseEventSchema.extend({
|
|
58
|
+
type: zod_1.z.literal("store.businessType.changed"),
|
|
59
|
+
data: zod_1.z.object({
|
|
60
|
+
storeId: zod_1.z.string(),
|
|
61
|
+
previousType: zod_1.z.string(),
|
|
62
|
+
newType: zod_1.z.string(),
|
|
63
|
+
userId: zod_1.z.string(),
|
|
64
|
+
timestamp: zod_1.z.string(),
|
|
65
|
+
reason: zod_1.z.string().optional(),
|
|
66
|
+
}),
|
|
67
|
+
});
|
|
35
68
|
// Compliance Events
|
|
36
69
|
exports.ComplianceViolationDetectedEventSchema = exports.BaseEventSchema.extend({
|
|
37
70
|
type: zod_1.z.literal("compliance.violation.detected"),
|
|
@@ -473,6 +506,9 @@ exports.OrderRefundProcessedEventSchema = exports.BaseEventSchema.extend({
|
|
|
473
506
|
exports.KAFKA_TOPICS = {
|
|
474
507
|
STORE_CREATED: "store.created",
|
|
475
508
|
STORE_UPDATED: "store.updated",
|
|
509
|
+
STORE_TIN_UPDATED: "store.tin.updated",
|
|
510
|
+
STORE_TIN_REVERIFIED: "store.tin.reverified",
|
|
511
|
+
STORE_BUSINESS_TYPE_CHANGED: "store.businessType.changed",
|
|
476
512
|
COMPLIANCE_VIOLATION_DETECTED: "compliance.violation.detected",
|
|
477
513
|
STORE_SUSPENDED: "store.suspended",
|
|
478
514
|
STORE_UNBANNED: "store.unbanned",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axova/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Shared utilities, models, and libraries for Axova platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "^5.3.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"fastify": "^5
|
|
40
|
+
"fastify": "^4 || ^5",
|
|
41
41
|
"drizzle-orm": "^0.39.3"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -53,6 +53,27 @@ export const stores = pgTable(
|
|
|
53
53
|
houseNumber: varchar("house_number", { length: 50 }),
|
|
54
54
|
tradeNames: jsonb("trade_names").$type<string[]>().default([]),
|
|
55
55
|
|
|
56
|
+
// TIN Verification Status Tracking
|
|
57
|
+
tinVerificationStatus: varchar("tin_verification_status", { length: 30 })
|
|
58
|
+
.$type<"UNVERIFIED" | "PENDING" | "VERIFIED" | "FAILED" | "EXPIRED">()
|
|
59
|
+
.default("UNVERIFIED"),
|
|
60
|
+
tinVerifiedAt: timestamp("tin_verified_at", { withTimezone: true }),
|
|
61
|
+
tinVerifiedBy: text("tin_verified_by"),
|
|
62
|
+
tinVerificationData: jsonb("tin_verification_data")
|
|
63
|
+
.$type<Record<string, unknown>>()
|
|
64
|
+
.default({}),
|
|
65
|
+
tinVerificationErrors: jsonb("tin_verification_errors")
|
|
66
|
+
.$type<string[]>()
|
|
67
|
+
.default([]),
|
|
68
|
+
tinLastChecked: timestamp("tin_last_checked", { withTimezone: true }),
|
|
69
|
+
|
|
70
|
+
// Business Type Change Tracking
|
|
71
|
+
businessTypeChangedAt: timestamp("business_type_changed_at", { withTimezone: true }),
|
|
72
|
+
businessTypeChangedBy: text("business_type_changed_by"),
|
|
73
|
+
businessTypeChangeReason: text("business_type_change_reason"),
|
|
74
|
+
previousBusinessType: varchar("previous_business_type", { length: 20 })
|
|
75
|
+
.$type<"starter" | "business_owner">(),
|
|
76
|
+
|
|
56
77
|
// Store Additional Details
|
|
57
78
|
attributes: jsonb("attributes")
|
|
58
79
|
.$type<Record<string, unknown>>()
|
package/src/types/events.ts
CHANGED
|
@@ -33,6 +33,42 @@ export const StoreUpdatedEventSchema = BaseEventSchema.extend({
|
|
|
33
33
|
}),
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
export const StoreTinUpdatedEventSchema = BaseEventSchema.extend({
|
|
37
|
+
type: z.literal("store.tin.updated"),
|
|
38
|
+
data: z.object({
|
|
39
|
+
storeId: z.string(),
|
|
40
|
+
tinNumber: z.string(),
|
|
41
|
+
businessType: z.string().optional(),
|
|
42
|
+
verificationStatus: z.string(),
|
|
43
|
+
userId: z.string(),
|
|
44
|
+
timestamp: z.string(),
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const StoreTinReverifiedEventSchema = BaseEventSchema.extend({
|
|
49
|
+
type: z.literal("store.tin.reverified"),
|
|
50
|
+
data: z.object({
|
|
51
|
+
storeId: z.string(),
|
|
52
|
+
tinNumber: z.string(),
|
|
53
|
+
previousStatus: z.string(),
|
|
54
|
+
newStatus: z.string(),
|
|
55
|
+
userId: z.string(),
|
|
56
|
+
timestamp: z.string(),
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const StoreBusinessTypeChangedEventSchema = BaseEventSchema.extend({
|
|
61
|
+
type: z.literal("store.businessType.changed"),
|
|
62
|
+
data: z.object({
|
|
63
|
+
storeId: z.string(),
|
|
64
|
+
previousType: z.string(),
|
|
65
|
+
newType: z.string(),
|
|
66
|
+
userId: z.string(),
|
|
67
|
+
timestamp: z.string(),
|
|
68
|
+
reason: z.string().optional(),
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
|
|
36
72
|
// Compliance Events
|
|
37
73
|
export const ComplianceViolationDetectedEventSchema = BaseEventSchema.extend({
|
|
38
74
|
type: z.literal("compliance.violation.detected"),
|
|
@@ -137,6 +173,9 @@ export const AppealReviewedEventSchema = BaseEventSchema.extend({
|
|
|
137
173
|
// Type exports
|
|
138
174
|
export type StoreCreatedEvent = z.infer<typeof StoreCreatedEventSchema>;
|
|
139
175
|
export type StoreUpdatedEvent = z.infer<typeof StoreUpdatedEventSchema>;
|
|
176
|
+
export type StoreTinUpdatedEvent = z.infer<typeof StoreTinUpdatedEventSchema>;
|
|
177
|
+
export type StoreTinReverifiedEvent = z.infer<typeof StoreTinReverifiedEventSchema>;
|
|
178
|
+
export type StoreBusinessTypeChangedEvent = z.infer<typeof StoreBusinessTypeChangedEventSchema>;
|
|
140
179
|
export type ComplianceViolationDetectedEvent = z.infer<
|
|
141
180
|
typeof ComplianceViolationDetectedEventSchema
|
|
142
181
|
>;
|
|
@@ -575,6 +614,9 @@ export type CustomerReviewSubmittedEvent = z.infer<
|
|
|
575
614
|
export type AxovaEvent =
|
|
576
615
|
| StoreCreatedEvent
|
|
577
616
|
| StoreUpdatedEvent
|
|
617
|
+
| StoreTinUpdatedEvent
|
|
618
|
+
| StoreTinReverifiedEvent
|
|
619
|
+
| StoreBusinessTypeChangedEvent
|
|
578
620
|
| ComplianceViolationDetectedEvent
|
|
579
621
|
| StoreSuspendedEvent
|
|
580
622
|
| StoreUnbannedEvent
|
|
@@ -612,6 +654,9 @@ export type AxovaEvent =
|
|
|
612
654
|
export const KAFKA_TOPICS = {
|
|
613
655
|
STORE_CREATED: "store.created",
|
|
614
656
|
STORE_UPDATED: "store.updated",
|
|
657
|
+
STORE_TIN_UPDATED: "store.tin.updated",
|
|
658
|
+
STORE_TIN_REVERIFIED: "store.tin.reverified",
|
|
659
|
+
STORE_BUSINESS_TYPE_CHANGED: "store.businessType.changed",
|
|
615
660
|
COMPLIANCE_VIOLATION_DETECTED: "compliance.violation.detected",
|
|
616
661
|
STORE_SUSPENDED: "store.suspended",
|
|
617
662
|
STORE_UNBANNED: "store.unbanned",
|