@veloxts/core 0.6.31 → 0.6.52

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/CHANGELOG.md CHANGED
@@ -1,5 +1,131 @@
1
1
  # @veloxts/core
2
2
 
3
+ ## 0.6.52
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(mcp): smart CLI resolution with fallbacks
8
+
9
+ ## 0.6.51
10
+
11
+ ### Patch Changes
12
+
13
+ - fix(web): configure @vinxi/server-functions for RSC server actions
14
+
15
+ ## 0.6.50
16
+
17
+ ### Patch Changes
18
+
19
+ - lint fixed
20
+
21
+ ## 0.6.49
22
+
23
+ ### Patch Changes
24
+
25
+ - feat(create): add client import lint script for RSC templates
26
+
27
+ ## 0.6.48
28
+
29
+ ### Patch Changes
30
+
31
+ - fix(web): remove server-only guards incompatible with Vite SS
32
+
33
+ ## 0.6.47
34
+
35
+ ### Patch Changes
36
+
37
+ - fix(web): use /adapters for createH3ApiHandler to avoid server-only
38
+
39
+ ## 0.6.46
40
+
41
+ ### Patch Changes
42
+
43
+ - fix(web): remove transitive server-only import from main entry
44
+
45
+ ## 0.6.45
46
+
47
+ ### Patch Changes
48
+
49
+ - fix(web): remove server-only guard from main entry for Vinxi compat
50
+
51
+ ## 0.6.44
52
+
53
+ ### Patch Changes
54
+
55
+ - refactor(web): implement proper RSC server/client separation
56
+
57
+ ## 0.6.43
58
+
59
+ ### Patch Changes
60
+
61
+ - fix(web): exclude native modules from Vite dependency optimization
62
+
63
+ ## 0.6.42
64
+
65
+ ### Patch Changes
66
+
67
+ - fix(web): enable tsconfig path aliases for Vite/Vinxi + docs(web): add @public/@internal JSDoc annotations to server actions
68
+
69
+ ## 0.6.41
70
+
71
+ ### Patch Changes
72
+
73
+ - feat(web): add authAction helper for procedure bridge authentication
74
+
75
+ ## 0.6.40
76
+
77
+ ### Patch Changes
78
+
79
+ - feat(create): consolidate template styles with unified dark mode design
80
+
81
+ ## 0.6.39
82
+
83
+ ### Patch Changes
84
+
85
+ - fix RSC client hydration with split layout architecture
86
+
87
+ ## 0.6.38
88
+
89
+ ### Patch Changes
90
+
91
+ - fix client hydration for RSC templates
92
+
93
+ ## 0.6.37
94
+
95
+ ### Patch Changes
96
+
97
+ - feat(web): add validated() helper for secure server actions & add rsc-auth template with validated()
98
+
99
+ ## 0.6.36
100
+
101
+ ### Patch Changes
102
+
103
+ - Gap Remediation Plan
104
+
105
+ ## 0.6.35
106
+
107
+ ### Patch Changes
108
+
109
+ - proper auth template testing in verify-publis
110
+
111
+ ## 0.6.34
112
+
113
+ ### Patch Changes
114
+
115
+ - update PostgreSQL adapter for Prisma 7 API
116
+
117
+ ## 0.6.33
118
+
119
+ ### Patch Changes
120
+
121
+ - changed claude.md instruction, added prisma config
122
+
123
+ ## 0.6.32
124
+
125
+ ### Patch Changes
126
+
127
+ - Introducing new Ecosystem Expansion packages: cache, queue, mail, storage, scheduler, events. Do not use yet
128
+
3
129
  ## 0.6.31
4
130
 
5
131
  ### Patch Changes
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * Error Catalog - Centralized error definitions with fix suggestions
3
3
  *
4
- * Error codes follow the pattern: VELOX-XYYY
5
- * - X: Domain (1=Core, 2=Router, 3=Auth, 4=ORM, 5=Validation, 6=Client)
4
+ * Error codes follow the pattern: VELOX-XYYY or VELOX-XXYYY
5
+ * - X/XX: Domain (1=Core, 2=Router, 3=Auth, 4=ORM, 5=Validation, 6=Client,
6
+ * 7=Cache, 8=Queue, 9=Mail, 10=Storage, 11=Scheduler, 12=Events)
6
7
  * - YYY: Sequential number within domain
7
8
  *
9
+ * Note: Domains 1-9 use 4-digit codes (e.g., VELOX-1001)
10
+ * Domains 10+ use 5-digit codes (e.g., VELOX-10001)
11
+ *
8
12
  * @module errors/catalog
9
13
  */
10
14
  /**
@@ -17,6 +21,12 @@ export declare const ERROR_DOMAINS: {
17
21
  readonly ORM: 4;
18
22
  readonly VALIDATION: 5;
19
23
  readonly CLIENT: 6;
24
+ readonly CACHE: 7;
25
+ readonly QUEUE: 8;
26
+ readonly MAIL: 9;
27
+ readonly STORAGE: 10;
28
+ readonly SCHEDULER: 11;
29
+ readonly EVENTS: 12;
20
30
  };
21
31
  export type ErrorDomain = keyof typeof ERROR_DOMAINS;
22
32
  /**
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * Error Catalog - Centralized error definitions with fix suggestions
3
3
  *
4
- * Error codes follow the pattern: VELOX-XYYY
5
- * - X: Domain (1=Core, 2=Router, 3=Auth, 4=ORM, 5=Validation, 6=Client)
4
+ * Error codes follow the pattern: VELOX-XYYY or VELOX-XXYYY
5
+ * - X/XX: Domain (1=Core, 2=Router, 3=Auth, 4=ORM, 5=Validation, 6=Client,
6
+ * 7=Cache, 8=Queue, 9=Mail, 10=Storage, 11=Scheduler, 12=Events)
6
7
  * - YYY: Sequential number within domain
7
8
  *
9
+ * Note: Domains 1-9 use 4-digit codes (e.g., VELOX-1001)
10
+ * Domains 10+ use 5-digit codes (e.g., VELOX-10001)
11
+ *
8
12
  * @module errors/catalog
9
13
  */
10
14
  // ============================================================================
@@ -20,6 +24,12 @@ export const ERROR_DOMAINS = {
20
24
  ORM: 4,
21
25
  VALIDATION: 5,
22
26
  CLIENT: 6,
27
+ CACHE: 7,
28
+ QUEUE: 8,
29
+ MAIL: 9,
30
+ STORAGE: 10,
31
+ SCHEDULER: 11,
32
+ EVENTS: 12,
23
33
  };
24
34
  // ============================================================================
25
35
  // Error Catalog Registry
@@ -483,6 +493,389 @@ const api = createClient({
483
493
  },
484
494
  docsUrl: 'https://veloxts.dev/errors/VELOX-6002',
485
495
  },
496
+ // ==========================================================================
497
+ // CACHE ERRORS (7XXX)
498
+ // ==========================================================================
499
+ 'VELOX-7001': {
500
+ code: 'VELOX-7001',
501
+ title: 'Cache Driver Not Found',
502
+ description: 'The specified cache driver is not available or not installed.',
503
+ statusCode: 500,
504
+ fix: {
505
+ suggestion: 'Install the required cache driver dependencies.',
506
+ example: `# For Redis cache
507
+ pnpm add ioredis
508
+
509
+ # Configure the cache
510
+ app.register(cachePlugin({
511
+ driver: 'redis',
512
+ config: { url: process.env.REDIS_URL },
513
+ }));`,
514
+ },
515
+ docsUrl: 'https://veloxts.dev/errors/VELOX-7001',
516
+ },
517
+ 'VELOX-7002': {
518
+ code: 'VELOX-7002',
519
+ title: 'Redis Connection Failed',
520
+ description: 'Could not establish a connection to the Redis server.',
521
+ statusCode: 503,
522
+ fix: {
523
+ suggestion: 'Verify REDIS_URL is correct and the Redis server is running.',
524
+ example: `# Check your .env file
525
+ REDIS_URL="redis://localhost:6379"
526
+
527
+ # Or with authentication
528
+ REDIS_URL="redis://:password@localhost:6379"
529
+
530
+ # Start Redis with Docker
531
+ docker run -d -p 6379:6379 redis:7-alpine`,
532
+ },
533
+ docsUrl: 'https://veloxts.dev/errors/VELOX-7002',
534
+ },
535
+ 'VELOX-7003': {
536
+ code: 'VELOX-7003',
537
+ title: 'Cache Key Too Long',
538
+ description: 'The cache key exceeds the maximum allowed length.',
539
+ statusCode: 400,
540
+ fix: {
541
+ suggestion: 'Use shorter cache keys or hash long keys.',
542
+ example: `import { createHash } from 'crypto';
543
+
544
+ // Hash long keys
545
+ function cacheKey(data: string): string {
546
+ if (data.length > 200) {
547
+ return createHash('sha256').update(data).digest('hex');
548
+ }
549
+ return data;
550
+ }`,
551
+ },
552
+ docsUrl: 'https://veloxts.dev/errors/VELOX-7003',
553
+ },
554
+ // ==========================================================================
555
+ // QUEUE ERRORS (8XXX)
556
+ // ==========================================================================
557
+ 'VELOX-8001': {
558
+ code: 'VELOX-8001',
559
+ title: 'Queue Connection Failed',
560
+ description: 'Could not connect to the queue backend (Redis/BullMQ).',
561
+ statusCode: 503,
562
+ fix: {
563
+ suggestion: 'Verify Redis is running and REDIS_URL is configured.',
564
+ example: `# Check your .env file
565
+ REDIS_URL="redis://localhost:6379"
566
+
567
+ # Start Redis
568
+ docker run -d -p 6379:6379 redis:7-alpine
569
+
570
+ # Configure queue
571
+ app.register(queuePlugin({
572
+ driver: 'bullmq',
573
+ config: { connection: { url: process.env.REDIS_URL } },
574
+ }));`,
575
+ },
576
+ docsUrl: 'https://veloxts.dev/errors/VELOX-8001',
577
+ },
578
+ 'VELOX-8002': {
579
+ code: 'VELOX-8002',
580
+ title: 'Job Handler Not Found',
581
+ description: 'No handler is registered for the dispatched job type.',
582
+ statusCode: 500,
583
+ fix: {
584
+ suggestion: 'Register the job handler before dispatching.',
585
+ example: `// Define the job
586
+ export const sendEmail = defineJob({
587
+ name: 'email.send',
588
+ schema: z.object({ to: z.string().email() }),
589
+ handler: async ({ data }) => {
590
+ await mailer.send(data.to, 'Hello!');
591
+ },
592
+ });
593
+
594
+ // Register with queue
595
+ queue.registerJob(sendEmail);
596
+
597
+ // Now you can dispatch
598
+ await dispatch(sendEmail, { to: 'user@example.com' });`,
599
+ },
600
+ docsUrl: 'https://veloxts.dev/errors/VELOX-8002',
601
+ },
602
+ 'VELOX-8003': {
603
+ code: 'VELOX-8003',
604
+ title: 'Job Execution Failed',
605
+ description: 'A job failed to execute after all retry attempts.',
606
+ statusCode: 500,
607
+ fix: {
608
+ suggestion: 'Check the job logs for error details. Consider adding error handling.',
609
+ example: `export const processOrder = defineJob({
610
+ name: 'order.process',
611
+ schema: OrderSchema,
612
+ retries: 3,
613
+ backoff: { type: 'exponential', delay: 1000 },
614
+ handler: async ({ data }) => {
615
+ try {
616
+ await processOrderLogic(data);
617
+ } catch (error) {
618
+ // Log and rethrow for retry
619
+ console.error('Order processing failed:', error);
620
+ throw error;
621
+ }
622
+ },
623
+ });`,
624
+ },
625
+ docsUrl: 'https://veloxts.dev/errors/VELOX-8003',
626
+ },
627
+ // ==========================================================================
628
+ // MAIL ERRORS (9XXX)
629
+ // ==========================================================================
630
+ 'VELOX-9001': {
631
+ code: 'VELOX-9001',
632
+ title: 'SMTP Connection Failed',
633
+ description: 'Could not connect to the SMTP mail server.',
634
+ statusCode: 503,
635
+ fix: {
636
+ suggestion: 'Verify your SMTP configuration and server availability.',
637
+ example: `# Check your .env file
638
+ SMTP_HOST="smtp.example.com"
639
+ SMTP_PORT="587"
640
+ SMTP_USER="your-user"
641
+ SMTP_PASS="your-password"
642
+
643
+ # Configure mail
644
+ app.register(mailPlugin({
645
+ driver: 'smtp',
646
+ config: {
647
+ host: process.env.SMTP_HOST,
648
+ port: parseInt(process.env.SMTP_PORT),
649
+ auth: {
650
+ user: process.env.SMTP_USER,
651
+ pass: process.env.SMTP_PASS,
652
+ },
653
+ },
654
+ }));`,
655
+ },
656
+ docsUrl: 'https://veloxts.dev/errors/VELOX-9001',
657
+ },
658
+ 'VELOX-9002': {
659
+ code: 'VELOX-9002',
660
+ title: 'Mail Send Failed',
661
+ description: 'The email could not be sent due to a delivery error.',
662
+ statusCode: 500,
663
+ fix: {
664
+ suggestion: 'Check the recipient address, email content, and server logs.',
665
+ example: `try {
666
+ await mail.send({
667
+ to: 'user@example.com',
668
+ subject: 'Hello',
669
+ html: '<p>Welcome!</p>',
670
+ });
671
+ } catch (error) {
672
+ if (error.code === 'VELOX-9002') {
673
+ // Log the original error for debugging
674
+ console.error('Mail delivery failed:', error.cause);
675
+ }
676
+ }`,
677
+ },
678
+ docsUrl: 'https://veloxts.dev/errors/VELOX-9002',
679
+ },
680
+ 'VELOX-9003': {
681
+ code: 'VELOX-9003',
682
+ title: 'Invalid Email Address',
683
+ description: 'One or more email addresses in the message are invalid.',
684
+ statusCode: 400,
685
+ fix: {
686
+ suggestion: 'Validate email addresses before sending.',
687
+ example: `import { z } from 'zod';
688
+
689
+ const emailSchema = z.string().email();
690
+
691
+ // Validate before sending
692
+ const result = emailSchema.safeParse(recipientEmail);
693
+ if (!result.success) {
694
+ throw new Error('Invalid email address');
695
+ }`,
696
+ },
697
+ docsUrl: 'https://veloxts.dev/errors/VELOX-9003',
698
+ },
699
+ // ==========================================================================
700
+ // STORAGE ERRORS (10XXX)
701
+ // ==========================================================================
702
+ 'VELOX-10001': {
703
+ code: 'VELOX-10001',
704
+ title: 'Storage Driver Not Found',
705
+ description: 'The specified storage driver is not available or not installed.',
706
+ statusCode: 500,
707
+ fix: {
708
+ suggestion: 'Install the required storage driver dependencies.',
709
+ example: `# For S3 storage
710
+ pnpm add @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
711
+
712
+ # Configure storage
713
+ app.register(storagePlugin({
714
+ driver: 's3',
715
+ config: {
716
+ bucket: 'my-bucket',
717
+ region: 'us-east-1',
718
+ },
719
+ }));`,
720
+ },
721
+ docsUrl: 'https://veloxts.dev/errors/VELOX-10001',
722
+ },
723
+ 'VELOX-10002': {
724
+ code: 'VELOX-10002',
725
+ title: 'File Not Found',
726
+ description: 'The requested file does not exist in storage.',
727
+ statusCode: 404,
728
+ fix: {
729
+ suggestion: 'Verify the file path is correct and the file has been uploaded.',
730
+ example: `// Check if file exists before reading
731
+ if (await storage.exists('path/to/file.pdf')) {
732
+ const content = await storage.get('path/to/file.pdf');
733
+ } else {
734
+ console.log('File not found');
735
+ }`,
736
+ },
737
+ docsUrl: 'https://veloxts.dev/errors/VELOX-10002',
738
+ },
739
+ 'VELOX-10003': {
740
+ code: 'VELOX-10003',
741
+ title: 'Storage Permission Denied',
742
+ description: 'Access to the file or bucket was denied due to permissions.',
743
+ statusCode: 403,
744
+ fix: {
745
+ suggestion: 'Check your storage credentials and bucket/directory permissions.',
746
+ example: `# For S3, verify IAM permissions include:
747
+ # - s3:GetObject
748
+ # - s3:PutObject
749
+ # - s3:DeleteObject
750
+ # - s3:ListBucket
751
+
752
+ # For local storage, check directory permissions
753
+ chmod 755 ./storage`,
754
+ },
755
+ docsUrl: 'https://veloxts.dev/errors/VELOX-10003',
756
+ },
757
+ 'VELOX-10004': {
758
+ code: 'VELOX-10004',
759
+ title: 'S3 Connection Failed',
760
+ description: 'Could not connect to the S3-compatible storage service.',
761
+ statusCode: 503,
762
+ fix: {
763
+ suggestion: 'Verify your S3 credentials and endpoint configuration.',
764
+ example: `# Check your .env file
765
+ AWS_ACCESS_KEY_ID="your-access-key"
766
+ AWS_SECRET_ACCESS_KEY="your-secret-key"
767
+ AWS_REGION="us-east-1"
768
+ S3_BUCKET="your-bucket"
769
+
770
+ # For S3-compatible services (R2, MinIO)
771
+ S3_ENDPOINT="https://your-endpoint.com"`,
772
+ },
773
+ docsUrl: 'https://veloxts.dev/errors/VELOX-10004',
774
+ },
775
+ // ==========================================================================
776
+ // SCHEDULER ERRORS (11XXX)
777
+ // ==========================================================================
778
+ 'VELOX-11001': {
779
+ code: 'VELOX-11001',
780
+ title: 'Task Already Registered',
781
+ description: 'A scheduled task with the same name is already registered.',
782
+ statusCode: 500,
783
+ fix: {
784
+ suggestion: 'Use unique names for each scheduled task.',
785
+ example: `// Each task must have a unique name
786
+ const schedule = defineSchedule([
787
+ task('cleanup-sessions', async () => { ... }).daily().build(),
788
+ task('cleanup-tokens', async () => { ... }).daily().build(), // Different name
789
+ ]);`,
790
+ },
791
+ docsUrl: 'https://veloxts.dev/errors/VELOX-11001',
792
+ },
793
+ 'VELOX-11002': {
794
+ code: 'VELOX-11002',
795
+ title: 'Invalid Cron Expression',
796
+ description: 'The provided cron expression is malformed or invalid.',
797
+ statusCode: 400,
798
+ fix: {
799
+ suggestion: 'Use a valid cron expression or the fluent scheduling API.',
800
+ example: `// Fluent API (recommended)
801
+ task('my-task', handler)
802
+ .daily()
803
+ .at('03:00')
804
+ .build();
805
+
806
+ // Or valid cron expression
807
+ task('my-task', handler)
808
+ .cron('0 3 * * *') // Every day at 3:00 AM
809
+ .build();
810
+
811
+ // Cron format: minute hour day-of-month month day-of-week`,
812
+ },
813
+ docsUrl: 'https://veloxts.dev/errors/VELOX-11002',
814
+ },
815
+ // ==========================================================================
816
+ // EVENTS ERRORS (12XXX)
817
+ // ==========================================================================
818
+ 'VELOX-12001': {
819
+ code: 'VELOX-12001',
820
+ title: 'WebSocket Connection Failed',
821
+ description: 'Could not establish a WebSocket connection.',
822
+ statusCode: 503,
823
+ fix: {
824
+ suggestion: 'Verify the WebSocket endpoint is correct and the server is running.',
825
+ example: `// Client-side connection
826
+ const socket = new WebSocket('ws://localhost:3000/ws');
827
+
828
+ socket.onopen = () => console.log('Connected');
829
+ socket.onerror = (error) => console.error('Connection failed:', error);
830
+
831
+ // Ensure server is configured
832
+ app.register(eventsPlugin({
833
+ driver: 'ws',
834
+ path: '/ws',
835
+ }));`,
836
+ },
837
+ docsUrl: 'https://veloxts.dev/errors/VELOX-12001',
838
+ },
839
+ 'VELOX-12002': {
840
+ code: 'VELOX-12002',
841
+ title: 'Channel Authorization Failed',
842
+ description: 'The user is not authorized to subscribe to this channel.',
843
+ statusCode: 403,
844
+ fix: {
845
+ suggestion: 'Implement channel authorization or use public channels.',
846
+ example: `// Private channel authorization
847
+ app.register(eventsPlugin({
848
+ driver: 'ws',
849
+ authorize: async (channel, user) => {
850
+ // Private channels start with 'private-'
851
+ if (channel.startsWith('private-user.')) {
852
+ const userId = channel.replace('private-user.', '');
853
+ return user?.id === userId;
854
+ }
855
+ return true; // Public channels
856
+ },
857
+ }));`,
858
+ },
859
+ docsUrl: 'https://veloxts.dev/errors/VELOX-12002',
860
+ },
861
+ 'VELOX-12003': {
862
+ code: 'VELOX-12003',
863
+ title: 'Redis Pub/Sub Failed',
864
+ description: 'Could not publish or subscribe to Redis channels.',
865
+ statusCode: 503,
866
+ fix: {
867
+ suggestion: 'Verify Redis is running and configured for the events plugin.',
868
+ example: `# Check Redis connection
869
+ REDIS_URL="redis://localhost:6379"
870
+
871
+ # Configure events with Redis for horizontal scaling
872
+ app.register(eventsPlugin({
873
+ driver: 'ws',
874
+ redis: process.env.REDIS_URL, // Enables pub/sub across instances
875
+ }));`,
876
+ },
877
+ docsUrl: 'https://veloxts.dev/errors/VELOX-12003',
878
+ },
486
879
  };
487
880
  // ============================================================================
488
881
  // Catalog Access Functions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/core",
3
- "version": "0.6.31",
3
+ "version": "0.6.52",
4
4
  "description": "Fastify wrapper, DI container, and plugin system for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",