express-project-builder 1.0.18 → 1.0.19
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/README.md +65 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -527,3 +527,68 @@ export const Product_Controllers = {
|
|
|
527
527
|
get_All_Products,
|
|
528
528
|
};
|
|
529
529
|
```
|
|
530
|
+
|
|
531
|
+
- /src/utils/**commonUtils.ts** <br/> Comprehensive utility functions for common tasks including OTP generation, phone/email validation, ID generation, and data formatting.
|
|
532
|
+
|
|
533
|
+
```typescript
|
|
534
|
+
// In your service file or any file
|
|
535
|
+
import {
|
|
536
|
+
generateOTP,
|
|
537
|
+
check_Input_isPhone_Or_isEmail,
|
|
538
|
+
generateTransactionId,
|
|
539
|
+
formatPhoneNumber,
|
|
540
|
+
maskSensitiveInfo,
|
|
541
|
+
isValidEmail,
|
|
542
|
+
isValidPhone,
|
|
543
|
+
generateRandomString,
|
|
544
|
+
generateRandomBarcodeId,
|
|
545
|
+
createToken,
|
|
546
|
+
verifyToken,
|
|
547
|
+
} from "../../utils/commonUtils";
|
|
548
|
+
|
|
549
|
+
// Generate a 6-digit OTP
|
|
550
|
+
const otp = generateOTP(6); // Returns: "123456"
|
|
551
|
+
|
|
552
|
+
// Check if input is phone or email
|
|
553
|
+
const inputInfo = check_Input_isPhone_Or_isEmail(payload.credentials);
|
|
554
|
+
// Returns: { type: 'email', value: 'example@example.com' } or
|
|
555
|
+
// Returns: { type: 'phone', value: '01712345678' }
|
|
556
|
+
|
|
557
|
+
// Generate a unique transaction ID
|
|
558
|
+
const transactionId = generateTransactionId(12); // Returns: "1A2B3C4D5E6F"
|
|
559
|
+
|
|
560
|
+
// Format phone number
|
|
561
|
+
const formattedPhone = formatPhoneNumber(payload.phone, "international");
|
|
562
|
+
// Returns: "+8801712345678"
|
|
563
|
+
|
|
564
|
+
// Mask sensitive information
|
|
565
|
+
const maskedEmail = maskSensitiveInfo(payload.email, "email");
|
|
566
|
+
// Returns: "use***@example.com"
|
|
567
|
+
|
|
568
|
+
// Validate email format
|
|
569
|
+
const isEmailValid = isValidEmail(payload.email); // Returns: true
|
|
570
|
+
|
|
571
|
+
// Validate phone format
|
|
572
|
+
const isPhoneValid = isValidPhone(payload.phone); // Returns: true
|
|
573
|
+
|
|
574
|
+
// Generate random string
|
|
575
|
+
const randomString = generateRandomString(10, {
|
|
576
|
+
includeUppercase: true,
|
|
577
|
+
includeLowercase: true,
|
|
578
|
+
includeNumbers: true,
|
|
579
|
+
includeSymbols: false,
|
|
580
|
+
}); // Returns: "Ab3D7fG9H2"
|
|
581
|
+
|
|
582
|
+
// Generate random barcode ID
|
|
583
|
+
const barcodeId = generateRandomBarcodeId(); // Returns: "153.04.55.022"
|
|
584
|
+
|
|
585
|
+
// JWT operations (if auth is enabled)
|
|
586
|
+
const token = createToken(
|
|
587
|
+
{ user_id: "123", role: "admin" },
|
|
588
|
+
"your-secret-key",
|
|
589
|
+
"1d"
|
|
590
|
+
); // Returns JWT token
|
|
591
|
+
|
|
592
|
+
const decoded = verifyToken(token, "your-secret-key");
|
|
593
|
+
// Returns: { userId: "123", role: "admin", iat: ..., exp: ... }
|
|
594
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-project-builder",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "A powerful and professional Express.js project generator CLI that instantly scaffolds a production-ready backend with TypeScript, modular architecture, and built-in support for MongoDB (Mongoose) or PostgreSQL (Prisma). Includes authentication, error handling, rate limiting, file upload, caching, and utility functions—so you can focus on building features instead of boilerplate. Perfect for kickstarting your next Express.js API project with best practices and modern tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/bin/index.js",
|