@axova/shared 1.0.1 → 1.0.2

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 (31) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -2
  3. package/dist/middleware/storeOwnership.js +3 -22
  4. package/dist/middleware/storeValidationMiddleware.js +39 -16
  5. package/dist/schemas/admin/admin-schema.d.ts +2 -2
  6. package/dist/schemas/ai-moderation/ai-moderation-schema.d.ts +2 -2
  7. package/dist/schemas/index.d.ts +0 -28
  8. package/dist/schemas/index.js +3 -125
  9. package/dist/utils/subdomain.d.ts +1 -1
  10. package/dist/utils/subdomain.js +15 -10
  11. package/package.json +1 -1
  12. package/src/index.ts +0 -3
  13. package/src/middleware/storeOwnership.ts +3 -21
  14. package/src/middleware/storeValidationMiddleware.ts +50 -17
  15. package/src/schemas/index.ts +5 -194
  16. package/src/utils/subdomain.ts +15 -11
  17. package/src/schemas/compliance/compliance-schema.ts +0 -927
  18. package/src/schemas/compliance/kyc-schema.ts +0 -649
  19. package/src/schemas/customer/customer-schema.ts +0 -576
  20. package/src/schemas/inventory/inventory-tables.ts +0 -1927
  21. package/src/schemas/inventory/lot-tables.ts +0 -799
  22. package/src/schemas/order/order-schema.ts +0 -1400
  23. package/src/schemas/product/discount-relations.ts +0 -44
  24. package/src/schemas/product/discount-schema.ts +0 -464
  25. package/src/schemas/product/product-relations.ts +0 -187
  26. package/src/schemas/product/product-schema.ts +0 -955
  27. package/src/schemas/store/ethiopian_business_api.md.resolved +0 -212
  28. package/src/schemas/store/store-audit-schema.ts +0 -1257
  29. package/src/schemas/store/store-schema.ts +0 -661
  30. package/src/schemas/store/store-settings-schema.ts +0 -231
  31. package/src/schemas/store/storefront-config-schema.ts +0 -604
@@ -1,604 +0,0 @@
1
- import { createId } from "@paralleldrive/cuid2";
2
- import { relations } from "drizzle-orm";
3
- import {
4
- boolean,
5
- index,
6
- integer,
7
- jsonb,
8
- pgTable,
9
- text,
10
- timestamp,
11
- unique,
12
- varchar,
13
- } from "drizzle-orm/pg-core";
14
- import { stores } from "./store-schema";
15
-
16
- export const storefrontConfigs = pgTable(
17
- "storefront_configs",
18
- {
19
- id: text("id")
20
- .primaryKey()
21
- .$defaultFn(() => createId()),
22
- storeId: text("store_id")
23
- .notNull()
24
- .references(() => stores.id, { onDelete: "cascade" }),
25
-
26
- // Setup Status Tracking
27
- setupStatus: varchar("setup_status", { length: 30 })
28
- .notNull()
29
- .default("INCOMPLETE")
30
- .$type<
31
- | "INCOMPLETE"
32
- | "IN_PROGRESS"
33
- | "COMPLETED"
34
- | "NEEDS_REVIEW"
35
- | "PUBLISHED"
36
- >(),
37
-
38
- setupProgress: integer("setup_progress").notNull().default(0), // 0-100
39
- setupSteps: jsonb("setup_steps")
40
- .$type<{
41
- branding?: { completed: boolean; completedAt?: string };
42
- layout?: { completed: boolean; completedAt?: string };
43
- pages?: { completed: boolean; completedAt?: string };
44
- localization?: { completed: boolean; completedAt?: string };
45
- theme?: { completed: boolean; completedAt?: string };
46
- seo?: { completed: boolean; completedAt?: string };
47
- }>()
48
- .default({
49
- branding: { completed: false },
50
- layout: { completed: false },
51
- pages: { completed: false },
52
- localization: { completed: false },
53
- theme: { completed: false },
54
- seo: { completed: false },
55
- }),
56
-
57
- // Branding Configuration
58
- branding: jsonb("branding")
59
- .$type<{
60
- name: string;
61
- tagline?: string;
62
- description?: string;
63
- logo: {
64
- type: "image" | "text" | "both";
65
- text?: string;
66
- image?: string;
67
- imageWidth?: number;
68
- imageHeight?: number;
69
- showText?: boolean;
70
- alt?: string;
71
- };
72
- favicon?: string;
73
- colors: {
74
- primary: string;
75
- secondary: string;
76
- accent: string;
77
- background?: string;
78
- foreground?: string;
79
- muted?: string;
80
- mutedForeground?: string;
81
- border?: string;
82
- input?: string;
83
- ring?: string;
84
- success?: string;
85
- warning?: string;
86
- error?: string;
87
- info?: string;
88
- };
89
- typography: {
90
- headings: {
91
- family: string;
92
- weight: string;
93
- letterSpacing?: string;
94
- lineHeight?: string;
95
- };
96
- body: {
97
- family: string;
98
- weight: string;
99
- letterSpacing?: string;
100
- lineHeight?: string;
101
- };
102
- display?: {
103
- family: string;
104
- weight: string;
105
- letterSpacing?: string;
106
- lineHeight?: string;
107
- };
108
- mono?: {
109
- family: string;
110
- weight?: string;
111
- };
112
- };
113
- customCss?: string;
114
- customFonts?: Array<{
115
- name: string;
116
- url: string;
117
- format?: string;
118
- }>;
119
- }>()
120
- .notNull(),
121
-
122
- // Layout Configuration
123
- layout: jsonb("layout")
124
- .$type<{
125
- header: {
126
- announcement?: {
127
- enabled: boolean;
128
- text: string;
129
- link?: {
130
- text: string;
131
- url: string;
132
- };
133
- backgroundColor?: string;
134
- textColor?: string;
135
- dismissible?: boolean;
136
- };
137
- navigation: {
138
- mainMenu: Array<{
139
- id: string;
140
- label: string;
141
- url: string;
142
- icon?: string;
143
- badge?: string;
144
- children?: Array<{
145
- id: string;
146
- label: string;
147
- url: string;
148
- icon?: string;
149
- }>;
150
- }>;
151
- position?: "left" | "center" | "right";
152
- style?: "default" | "minimal" | "bold";
153
- sticky?: boolean;
154
- };
155
- features: {
156
- search: boolean;
157
- cart: boolean;
158
- wishlist: boolean;
159
- account: boolean;
160
- language: boolean;
161
- currency: boolean;
162
- compare?: boolean;
163
- notifications?: boolean;
164
- };
165
- style?: {
166
- transparent?: boolean;
167
- shadow?: boolean;
168
- border?: boolean;
169
- };
170
- };
171
- footer: {
172
- sections: Array<{
173
- id?: string;
174
- title: string;
175
- links: Array<{
176
- label: string;
177
- url: string;
178
- icon?: string;
179
- external?: boolean;
180
- }>;
181
- }>;
182
- social: Array<{
183
- platform: string;
184
- url: string;
185
- icon?: string;
186
- }>;
187
- payment: Array<{
188
- name: string;
189
- image: string;
190
- alt?: string;
191
- }>;
192
- newsletter?: {
193
- enabled: boolean;
194
- title: string;
195
- description: string;
196
- buttonText: string;
197
- placeholder?: string;
198
- };
199
- copyright?: {
200
- text: string;
201
- showYear: boolean;
202
- };
203
- trust?: {
204
- badges?: Array<{
205
- name: string;
206
- image: string;
207
- alt?: string;
208
- }>;
209
- certifications?: Array<{
210
- name: string;
211
- image: string;
212
- alt?: string;
213
- }>;
214
- };
215
- };
216
- sidebar?: {
217
- enabled: boolean;
218
- position: "left" | "right";
219
- widgets: Array<{
220
- id: string;
221
- type: string;
222
- title?: string;
223
- config?: Record<string, any>;
224
- }>;
225
- };
226
- }>()
227
- .notNull(),
228
-
229
- // Pages Configuration
230
- pages: jsonb("pages")
231
- .$type<{
232
- home: {
233
- hero: {
234
- enabled: boolean;
235
- type?:
236
- | "banner"
237
- | "slider"
238
- | "video"
239
- | "split"
240
- | "minimal"
241
- | "fullscreen";
242
- title: string;
243
- subtitle?: string;
244
- badge?: string;
245
- image?: {
246
- url: string;
247
- alt: string;
248
- position?: string;
249
- overlay?: boolean;
250
- };
251
- video?: {
252
- url: string;
253
- thumbnail?: string;
254
- autoplay?: boolean;
255
- };
256
- cta?: Array<{
257
- text: string;
258
- url: string;
259
- variant?: "primary" | "secondary" | "outline" | "ghost";
260
- icon?: string;
261
- }>;
262
- animation?: string;
263
- };
264
- features?: {
265
- enabled: boolean;
266
- title?: string;
267
- subtitle?: string;
268
- layout?: "grid" | "list" | "carousel";
269
- items: Array<{
270
- title: string;
271
- description: string;
272
- icon: string;
273
- link?: string;
274
- }>;
275
- };
276
- collections?: {
277
- enabled: boolean;
278
- title: string;
279
- subtitle?: string;
280
- layout?: "grid" | "masonry" | "carousel";
281
- items: Array<{
282
- id?: string;
283
- title: string;
284
- description?: string;
285
- stats?: string;
286
- image: {
287
- url: string;
288
- alt: string;
289
- };
290
- link: string;
291
- }>;
292
- };
293
- testimonials?: {
294
- enabled: boolean;
295
- title?: string;
296
- subtitle?: string;
297
- layout?: "carousel" | "grid" | "masonry";
298
- items: Array<{
299
- name: string;
300
- role?: string;
301
- avatar?: string;
302
- rating?: number;
303
- content: string;
304
- date?: string;
305
- }>;
306
- };
307
- instagram?: {
308
- enabled: boolean;
309
- title: string;
310
- subtitle?: string;
311
- username?: string;
312
- images: Array<{
313
- url: string;
314
- alt: string;
315
- link?: string;
316
- }>;
317
- };
318
- newsletter?: {
319
- enabled: boolean;
320
- title: string;
321
- description?: string;
322
- placeholder?: string;
323
- buttonText: string;
324
- image?: string;
325
- };
326
- customSections?: Array<{
327
- id: string;
328
- type: string;
329
- enabled: boolean;
330
- order: number;
331
- config: Record<string, any>;
332
- }>;
333
- };
334
- about?: {
335
- enabled: boolean;
336
- hero?: {
337
- title: string;
338
- subtitle?: string;
339
- image?: {
340
- url: string;
341
- alt: string;
342
- };
343
- };
344
- vision?: {
345
- title: string;
346
- content: string;
347
- };
348
- mission?: {
349
- title: string;
350
- content: string;
351
- };
352
- values?: Array<{
353
- title: string;
354
- description: string;
355
- icon?: string;
356
- }>;
357
- stats?: Array<{
358
- value: string;
359
- label: string;
360
- description?: string;
361
- }>;
362
- team?: {
363
- enabled: boolean;
364
- title?: string;
365
- members: Array<{
366
- name: string;
367
- role: string;
368
- bio?: string;
369
- avatar?: string;
370
- social?: Record<string, string>;
371
- }>;
372
- };
373
- };
374
- collections?: {
375
- enabled: boolean;
376
- header?: {
377
- title: string;
378
- subtitle?: string;
379
- };
380
- items: Array<{
381
- id: string;
382
- title: string;
383
- description: string;
384
- image: {
385
- url: string;
386
- alt: string;
387
- };
388
- products?: number;
389
- link?: string;
390
- }>;
391
- };
392
- contact?: {
393
- enabled: boolean;
394
- title?: string;
395
- subtitle?: string;
396
- showMap?: boolean;
397
- mapConfig?: {
398
- latitude: number;
399
- longitude: number;
400
- zoom?: number;
401
- };
402
- showForm?: boolean;
403
- contactInfo?: {
404
- address?: string;
405
- phone?: string;
406
- email?: string;
407
- hours?: string;
408
- };
409
- };
410
- customPages?: Array<{
411
- id: string;
412
- slug: string;
413
- title: string;
414
- enabled: boolean;
415
- layout: string;
416
- content: any;
417
- }>;
418
- }>()
419
- .notNull(),
420
-
421
- // Localization Configuration
422
- localization: jsonb("localization")
423
- .$type<{
424
- languages: Array<{
425
- code: string;
426
- name: string;
427
- flag: string;
428
- rtl?: boolean;
429
- enabled: boolean;
430
- }>;
431
- currencies: Array<{
432
- code: string;
433
- symbol: string;
434
- name: string;
435
- flag?: string;
436
- position?: "before" | "after";
437
- decimals?: number;
438
- enabled: boolean;
439
- }>;
440
- defaultLanguage: string;
441
- defaultCurrency: string;
442
- autoDetect?: boolean;
443
- translations?: Record<string, Record<string, string>>;
444
- }>()
445
- .notNull(),
446
-
447
- // Theme Configuration
448
- theme: jsonb("theme")
449
- .$type<{
450
- mode: "light" | "dark" | "auto";
451
- radius?: number;
452
- animations?: boolean;
453
- transitions?: boolean;
454
- effects?: {
455
- blur?: boolean;
456
- shadows?: boolean;
457
- gradients?: boolean;
458
- };
459
- spacing?: {
460
- scale?: number;
461
- container?: string;
462
- };
463
- customVariables?: Record<string, string>;
464
- }>()
465
- .default({
466
- mode: "light",
467
- radius: 8,
468
- animations: true,
469
- transitions: true,
470
- effects: {
471
- blur: true,
472
- shadows: true,
473
- gradients: true,
474
- },
475
- }),
476
-
477
- // SEO Configuration
478
- seo: jsonb("seo")
479
- .$type<{
480
- title?: string;
481
- description?: string;
482
- keywords?: string[];
483
- ogImage?: string;
484
- twitterCard?: "summary" | "summary_large_image" | "app" | "player";
485
- favicon?: string;
486
- appleTouchIcon?: string;
487
- robots?: {
488
- index: boolean;
489
- follow: boolean;
490
- noarchive?: boolean;
491
- noimageindex?: boolean;
492
- };
493
- verification?: {
494
- google?: string;
495
- bing?: string;
496
- yandex?: string;
497
- pinterest?: string;
498
- };
499
- structuredData?: Array<Record<string, any>>;
500
- }>()
501
- .default({}),
502
-
503
- // Text Limits and Validation
504
- textLimits: jsonb("text_limits")
505
- .$type<{
506
- homeHero?: {
507
- badgeTextMax?: number;
508
- titleMax?: number;
509
- subtitleMax?: number;
510
- newsletterPlaceholderMax?: number;
511
- newsletterButtonTextMax?: number;
512
- trustedByTextMax?: number;
513
- };
514
- features?: {
515
- titleMax?: number;
516
- descriptionMax?: number;
517
- };
518
- collections?: {
519
- titleMax?: number;
520
- descriptionMax?: number;
521
- statsMax?: number;
522
- };
523
- general?: {
524
- menuLabelMax?: number;
525
- buttonTextMax?: number;
526
- headingMax?: number;
527
- paragraphMax?: number;
528
- };
529
- }>()
530
- .default({
531
- homeHero: {
532
- badgeTextMax: 48,
533
- titleMax: 64,
534
- subtitleMax: 160,
535
- newsletterPlaceholderMax: 48,
536
- newsletterButtonTextMax: 24,
537
- trustedByTextMax: 48,
538
- },
539
- }),
540
-
541
- // Advanced Features
542
- features: jsonb("features")
543
- .$type<{
544
- enableCookieConsent?: boolean;
545
- enableLiveChat?: boolean;
546
- enablePWA?: boolean;
547
- enableAMP?: boolean;
548
- enableAcceleration?: boolean;
549
- enableAnalytics?: boolean;
550
- enableABTesting?: boolean;
551
- enablePersonalization?: boolean;
552
- customScripts?: Array<{
553
- name: string;
554
- location: "head" | "body" | "footer";
555
- script: string;
556
- async?: boolean;
557
- defer?: boolean;
558
- }>;
559
- integrations?: Record<string, any>;
560
- }>()
561
- .default({}),
562
-
563
- // Version Control
564
- version: integer("version").notNull().default(1),
565
- publishedVersion: integer("published_version"),
566
- isDraft: boolean("is_draft").notNull().default(true),
567
-
568
- // Metadata
569
- lastEditedBy: text("last_edited_by"),
570
- publishedAt: timestamp("published_at", { withTimezone: true }),
571
- publishedBy: text("published_by"),
572
-
573
- createdAt: timestamp("created_at", { withTimezone: true })
574
- .defaultNow()
575
- .notNull(),
576
- updatedAt: timestamp("updated_at", { withTimezone: true })
577
- .defaultNow()
578
- .notNull(),
579
- },
580
- (table) => ({
581
- storeIdIndex: index("idx_storefront_configs_store_id").on(table.storeId),
582
- storeIdUnique: unique("idx_storefront_configs_store_unique").on(
583
- table.storeId,
584
- ),
585
- setupStatusIndex: index("idx_storefront_configs_setup_status").on(
586
- table.setupStatus,
587
- ),
588
- setupProgressIndex: index("idx_storefront_configs_setup_progress").on(
589
- table.setupProgress,
590
- ),
591
- versionIndex: index("idx_storefront_configs_version").on(table.version),
592
- isDraftIndex: index("idx_storefront_configs_draft").on(table.isDraft),
593
- }),
594
- );
595
-
596
- export const storefrontConfigRelations = relations(
597
- storefrontConfigs,
598
- ({ one }) => ({
599
- store: one(stores, {
600
- fields: [storefrontConfigs.storeId],
601
- references: [stores.id],
602
- }),
603
- }),
604
- );