vasuzex 2.1.2 → 2.1.4
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/.ai-memory/LOGGER_STRICT_POLICY.md +201 -0
- package/.ai-memory/neastore-feature-mapping.md +1114 -0
- package/bin/create-vasuzex.js +5 -2
- package/examples/runtime-config-examples.js +309 -0
- package/framework/Config/DatabaseConfigService.js +348 -0
- package/framework/Config/DatabaseConfigServiceProvider.js +69 -0
- package/framework/Console/Commands/generate-app.js +97 -4
- package/framework/Console/Commands/generate-media-server.js +2 -1
- package/framework/Console/Commands/utils/mediaServerTemplates.js +3 -2
- package/framework/Console/Commands/utils/webStructure.js +30 -21
- package/framework/Console/config/generator.config.js +3 -3
- package/framework/Console/plopfile.js +0 -8
- package/framework/Console/templates/api/app.js.hbs +5 -4
- package/framework/Console/templates/api/server.js.hbs +8 -2
- package/framework/Database/DatabaseServiceProvider.js +1 -1
- package/framework/Database/Model.js +9 -0
- package/framework/Exceptions/index.js +2 -1
- package/framework/Foundation/BaseApp.js +19 -0
- package/framework/Foundation/BaseService.js +95 -0
- package/framework/Foundation/Container.js +18 -3
- package/framework/Foundation/Providers/index.js +0 -1
- package/framework/Foundation/ServiceProvider.js +42 -0
- package/framework/Http/asyncHandler.js +26 -0
- package/framework/Http/index.js +1 -0
- package/framework/Services/Log/LogManager.js +26 -5
- package/framework/Services/Log/LogServiceProvider.js +48 -0
- package/framework/Services/Log/index.js +1 -0
- package/framework/Services/Mail/MailServiceProvider.js +36 -0
- package/framework/Services/Mail/index.js +1 -0
- package/framework/Services/Media/MediaServiceProvider.js +2 -2
- package/framework/Services/Payment/PaymentServiceProvider.js +35 -0
- package/framework/Services/Payment/index.js +1 -0
- package/framework/Services/Security/SecurityService.js +253 -0
- package/framework/Services/Security/SecurityServiceProvider.js +33 -0
- package/framework/Services/Security/index.js +9 -0
- package/framework/Services/Storage/StorageManager.js +7 -1
- package/framework/Services/Storage/StorageServiceProvider.js +36 -0
- package/framework/Services/Storage/index.js +1 -0
- package/framework/Services/Upload/UploadManager.js +179 -0
- package/framework/Services/index.js +1 -0
- package/framework/Support/Facades/Security.js +14 -0
- package/framework/Support/Facades/index.js +1 -0
- package/framework/Support/Helpers/index.js +1 -0
- package/framework/Support/Helpers/utilities.js +348 -0
- package/framework/index.js +2 -0
- package/frontend/client/Config/ConfigLoader.js +52 -10
- package/frontend/client/Http/ApiHelpers.js +99 -0
- package/frontend/client/Http/index.js +1 -0
- package/frontend/client/index.js +1 -1
- package/frontend/client/package.json +14 -66
- package/frontend/client/package.json.backup +41 -0
- package/frontend/react-ui/components/Avatars/GradientAvatar.jsx +255 -0
- package/frontend/react-ui/components/Avatars/index.js +66 -0
- package/frontend/react-ui/components/BreadCrumb/BreadCrumb.jsx +69 -0
- package/frontend/react-ui/components/BreadCrumb/index.js +2 -0
- package/frontend/react-ui/components/DataTable/ActionDefaults.jsx +171 -0
- package/frontend/react-ui/components/DataTable/DataTable.jsx +202 -328
- package/frontend/react-ui/components/DataTable/Filters.jsx +69 -56
- package/frontend/react-ui/components/DataTable/Pagination.jsx +59 -140
- package/frontend/react-ui/components/DataTable/TableActions.jsx +11 -20
- package/frontend/react-ui/components/DataTable/TableBody.jsx +168 -168
- package/frontend/react-ui/components/DataTable/TableHeader.jsx +93 -96
- package/frontend/react-ui/components/DataTable/TableState.jsx +33 -0
- package/frontend/react-ui/components/DataTable/index.js +10 -8
- package/frontend/react-ui/components/ImageLightbox/ImageLightbox.jsx +118 -0
- package/frontend/react-ui/components/ImageLightbox/index.js +1 -0
- package/frontend/react-ui/components/OrderTimeline/OrderTimeline.jsx +269 -0
- package/frontend/react-ui/components/OrderTimeline/index.js +1 -0
- package/frontend/react-ui/components/ReadMore/ReadMore.jsx +34 -0
- package/frontend/react-ui/components/ReadMore/index.js +1 -0
- package/frontend/react-ui/components/Switch/Switch.jsx +34 -0
- package/frontend/react-ui/components/Switch/index.js +1 -0
- package/frontend/react-ui/hooks/useAppConfig.js +58 -4
- package/frontend/react-ui/hooks/useLocalStorage.js +1 -1
- package/frontend/react-ui/hooks/useValidationErrors.js +1 -1
- package/frontend/react-ui/index.js +10 -0
- package/frontend/react-ui/package.json +17 -108
- package/frontend/react-ui/providers/ApiClientProvider.jsx +1 -1
- package/frontend/react-ui/providers/AppConfigProvider.jsx +212 -20
- package/frontend/react-ui/utils/formatters.js +193 -0
- package/frontend/react-ui/utils/index.js +30 -0
- package/frontend/react-ui/utils/logger.js +62 -0
- package/frontend/react-ui/utils/storage.js +90 -0
- package/frontend/react-ui/utils/swal.js +134 -0
- package/frontend/react-ui/utils/validation.js +207 -0
- package/package.json +6 -2
- package/framework/Foundation/Providers/LogServiceProvider.js +0 -33
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# 🚨 STRICT LOGGING POLICY - MANDATORY
|
|
2
|
+
|
|
3
|
+
## ❌ FORBIDDEN - NEVER USE THESE
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
// ❌ STRICTLY FORBIDDEN - DO NOT USE!
|
|
7
|
+
console.log()
|
|
8
|
+
console.warn()
|
|
9
|
+
console.error()
|
|
10
|
+
console.info()
|
|
11
|
+
console.debug()
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**VIOLATION OF THIS RULE WILL BE REJECTED IMMEDIATELY!**
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ✅ CORRECT LOGGING METHODS
|
|
19
|
+
|
|
20
|
+
### Backend (API) - Use Vasuzex Log Facade
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
import { Log } from 'vasuzex';
|
|
24
|
+
|
|
25
|
+
// Info logging
|
|
26
|
+
Log.info('User logged in', { userId: user.id });
|
|
27
|
+
|
|
28
|
+
// Warning logging
|
|
29
|
+
Log.warning('Rate limit approaching', { ip: req.ip, count: 95 });
|
|
30
|
+
|
|
31
|
+
// Error logging
|
|
32
|
+
Log.error('Database connection failed', { error: err.message });
|
|
33
|
+
|
|
34
|
+
// Debug logging (development only)
|
|
35
|
+
Log.debug('Processing order', { orderId: 123, items: 5 });
|
|
36
|
+
|
|
37
|
+
// Critical errors
|
|
38
|
+
Log.critical('Payment gateway down', { gateway: 'razorpay' });
|
|
39
|
+
|
|
40
|
+
// Alerts (requires immediate action)
|
|
41
|
+
Log.alert('Disk space critical', { available: '5%' });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Frontend (Web) - Use Custom Logger Utility
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
import { logger } from '@/utils/logger';
|
|
48
|
+
|
|
49
|
+
// Info logging (development only)
|
|
50
|
+
logger.info('Config loaded', { apiUrl, mediaUrl });
|
|
51
|
+
|
|
52
|
+
// Warning logging
|
|
53
|
+
logger.warning('API rate limit warning', { remaining: 10 });
|
|
54
|
+
|
|
55
|
+
// Error logging (always logged)
|
|
56
|
+
logger.error('Failed to fetch data', error);
|
|
57
|
+
|
|
58
|
+
// Debug logging (development only)
|
|
59
|
+
logger.debug('Component mounted', { props });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 📁 Logger Implementation
|
|
65
|
+
|
|
66
|
+
### Backend: Vasuzex Log Facade
|
|
67
|
+
|
|
68
|
+
**Location:** `vasuzex-v2/framework/Support/Facades/Log.js`
|
|
69
|
+
|
|
70
|
+
**Methods:**
|
|
71
|
+
- `Log.emergency()` - System unusable
|
|
72
|
+
- `Log.alert()` - Immediate action required
|
|
73
|
+
- `Log.critical()` - Critical conditions
|
|
74
|
+
- `Log.error()` - Runtime errors
|
|
75
|
+
- `Log.warning()` - Exceptional but not errors
|
|
76
|
+
- `Log.notice()` - Normal but significant
|
|
77
|
+
- `Log.info()` - Interesting events
|
|
78
|
+
- `Log.debug()` - Debug information
|
|
79
|
+
|
|
80
|
+
**Configuration:** `config/logging.cjs`
|
|
81
|
+
|
|
82
|
+
### Frontend: Custom Logger Utility
|
|
83
|
+
|
|
84
|
+
**Location:** `apps/customer/web/src/utils/logger.js`
|
|
85
|
+
|
|
86
|
+
**Features:**
|
|
87
|
+
- Automatic timestamp
|
|
88
|
+
- Context serialization
|
|
89
|
+
- Development-only info/debug logs
|
|
90
|
+
- Always-on error logs
|
|
91
|
+
- Prefix: `[Neastore]`
|
|
92
|
+
|
|
93
|
+
**Methods:**
|
|
94
|
+
- `logger.info(message, context)` - Development only
|
|
95
|
+
- `logger.warning(message, context)` - Development/Test
|
|
96
|
+
- `logger.error(message, error)` - Always logged
|
|
97
|
+
- `logger.debug(message, data)` - Development only
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🔍 Examples
|
|
102
|
+
|
|
103
|
+
### ✅ CORRECT
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
// Backend
|
|
107
|
+
import { Log } from 'vasuzex';
|
|
108
|
+
|
|
109
|
+
async function sendOTP(phone) {
|
|
110
|
+
Log.info(`OTP sent to ${phone}`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function processPayment(orderId) {
|
|
114
|
+
try {
|
|
115
|
+
// ... payment logic
|
|
116
|
+
Log.info('Payment processed', { orderId, amount });
|
|
117
|
+
} catch (error) {
|
|
118
|
+
Log.error('Payment failed', { orderId, error: error.message });
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Frontend
|
|
124
|
+
import { logger } from '@/utils/logger';
|
|
125
|
+
|
|
126
|
+
function LoginForm() {
|
|
127
|
+
const handleLogin = async () => {
|
|
128
|
+
try {
|
|
129
|
+
logger.debug('Login attempt', { phone });
|
|
130
|
+
const result = await authService.login(phone);
|
|
131
|
+
logger.info('Login successful');
|
|
132
|
+
} catch (error) {
|
|
133
|
+
logger.error('Login failed', error);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### ❌ WRONG
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
// ❌ NEVER DO THIS!
|
|
143
|
+
console.log('User logged in');
|
|
144
|
+
console.error('Failed to process');
|
|
145
|
+
console.warn('Rate limit warning');
|
|
146
|
+
|
|
147
|
+
// ❌ NEVER DO THIS IN PRODUCTION CODE!
|
|
148
|
+
if (isDevelopment) {
|
|
149
|
+
console.log('Debug info'); // Still wrong! Use logger
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 📋 Migration Checklist
|
|
156
|
+
|
|
157
|
+
When adding new code:
|
|
158
|
+
|
|
159
|
+
- [ ] Import `Log` from `vasuzex` (backend)
|
|
160
|
+
- [ ] Import `logger` from `@/utils/logger` (frontend)
|
|
161
|
+
- [ ] NO direct console.* calls anywhere
|
|
162
|
+
- [ ] Use appropriate log level (info/warning/error/debug)
|
|
163
|
+
- [ ] Include context objects for debugging
|
|
164
|
+
- [ ] Test logging in development mode
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 🔧 Current Status
|
|
169
|
+
|
|
170
|
+
### Backend Files Using Log Facade ✅
|
|
171
|
+
|
|
172
|
+
- `apps/customer/api/src/services/AuthService.js`
|
|
173
|
+
- `apps/customer/api/src/services/OrderModificationService.js`
|
|
174
|
+
|
|
175
|
+
### Frontend Files Using Logger ✅
|
|
176
|
+
|
|
177
|
+
- `apps/customer/web/src/hooks/useAuth.js`
|
|
178
|
+
- `apps/customer/web/src/components/auth/LoginForm.jsx`
|
|
179
|
+
- `apps/customer/web/src/App.jsx`
|
|
180
|
+
- `apps/customer/web/src/lib/AppConfigProvider.jsx`
|
|
181
|
+
|
|
182
|
+
### Cleaned Files (No Logging) ✅
|
|
183
|
+
|
|
184
|
+
- `apps/customer/web/src/main.jsx`
|
|
185
|
+
- `apps/customer/web/src/lib/api-client.js`
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## ⚠️ REMEMBER
|
|
190
|
+
|
|
191
|
+
**NEVER write `console.log`, `console.warn`, or `console.error` in any file!**
|
|
192
|
+
|
|
193
|
+
**ALWAYS use:**
|
|
194
|
+
- Backend: `Log.info()`, `Log.error()`, `Log.warning()`, `Log.debug()`
|
|
195
|
+
- Frontend: `logger.info()`, `logger.error()`, `logger.warning()`, `logger.debug()`
|
|
196
|
+
|
|
197
|
+
**This is not a suggestion - it's a strict requirement!**
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
Last Updated: 2025-12-10
|