@pubflow/core 0.1.9 → 0.3.0
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 +100 -0
- package/dist/config/index.js +1 -1
- package/dist/types.d.ts +40 -7
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Changelog - @pubflow/core
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.3.0] - 2025-10-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **snake_case Support**: User interface now supports BOTH camelCase and snake_case formats
|
|
9
|
+
- Added snake_case alternatives for all user fields:
|
|
10
|
+
- `last_name` (alternative to `lastName`)
|
|
11
|
+
- `user_type` (alternative to `userType`)
|
|
12
|
+
- `user_name` (alternative to `userName`)
|
|
13
|
+
- `is_verified` (alternative to `isVerified`)
|
|
14
|
+
- `two_factor` (alternative to `twoFactor`)
|
|
15
|
+
- `created_at` (alternative to `createdAt`)
|
|
16
|
+
- `updated_at` (alternative to `updatedAt`)
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Updated User interface documentation to indicate preferred format (snake_case)
|
|
20
|
+
- Package description updated to reflect snake_case support
|
|
21
|
+
|
|
22
|
+
### Migration Guide
|
|
23
|
+
This is a **backward compatible** change. No breaking changes.
|
|
24
|
+
|
|
25
|
+
**For existing applications:**
|
|
26
|
+
- Applications using camelCase will continue to work without changes
|
|
27
|
+
- Applications can now use snake_case format (recommended for new code)
|
|
28
|
+
- Both formats can coexist in the same application
|
|
29
|
+
|
|
30
|
+
**For new applications:**
|
|
31
|
+
- Use snake_case format for consistency with backend (multi-flowless)
|
|
32
|
+
- Example: `user.user_type` instead of `user.userType`
|
|
33
|
+
|
|
34
|
+
**Fallback pattern for maximum compatibility:**
|
|
35
|
+
```typescript
|
|
36
|
+
const userType = user.userType || user.user_type || '';
|
|
37
|
+
const lastName = user.lastName || user.last_name || '';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Why snake_case?
|
|
41
|
+
1. **Performance**: ~44% smaller response size (no dual format needed)
|
|
42
|
+
2. **Industry Standard**: Used by Stripe, GitHub, Google, Twilio
|
|
43
|
+
3. **Multi-language**: Native to Python, Go, Ruby, Rust
|
|
44
|
+
4. **Database Alignment**: Matches database column naming
|
|
45
|
+
5. **Consistency**: One format across the entire stack
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## [0.2.0] - 2025-XX-XX
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- Initial release with camelCase support
|
|
53
|
+
- Core authentication functionality
|
|
54
|
+
- Session management
|
|
55
|
+
- Storage abstraction
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Migration from 0.2.0 to 0.3.0
|
|
60
|
+
|
|
61
|
+
### No Action Required
|
|
62
|
+
This is a **non-breaking change**. Your existing code will continue to work.
|
|
63
|
+
|
|
64
|
+
### Optional: Adopt snake_case
|
|
65
|
+
If you want to adopt the new snake_case format:
|
|
66
|
+
|
|
67
|
+
1. Update your code to use snake_case fields:
|
|
68
|
+
```typescript
|
|
69
|
+
// Before (still works)
|
|
70
|
+
const type = user.userType;
|
|
71
|
+
|
|
72
|
+
// After (recommended)
|
|
73
|
+
const type = user.user_type;
|
|
74
|
+
|
|
75
|
+
// Best (maximum compatibility)
|
|
76
|
+
const type = user.userType || user.user_type;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
2. Update your package.json:
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@pubflow/core": "^0.3.0"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
3. Run: `npm install` or `bun install`
|
|
89
|
+
|
|
90
|
+
### Testing
|
|
91
|
+
After updating, test your authentication flows:
|
|
92
|
+
- Login
|
|
93
|
+
- Session validation
|
|
94
|
+
- User profile access
|
|
95
|
+
- Dashboard routing (if based on user_type)
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
For more information, see: `static/general-docs/snake-case-migration-guide.md`
|
|
100
|
+
|
package/dist/config/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const defaultSessionConfig = {
|
|
|
16
16
|
basePath: '/auth',
|
|
17
17
|
loginEndpoint: '/login',
|
|
18
18
|
logoutEndpoint: '/logout',
|
|
19
|
-
validationEndpoint: '/
|
|
19
|
+
validationEndpoint: '/validation', // ✅ Corregido para coincidir con el backend
|
|
20
20
|
refreshEndpoint: '/refresh',
|
|
21
21
|
storageKey: 'session',
|
|
22
22
|
autoValidate: true,
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* User type - Extended to include all Flowless backend fields
|
|
6
|
+
*
|
|
7
|
+
* @version 0.3.0 - Added snake_case support for multi-flowless compatibility
|
|
8
|
+
*
|
|
9
|
+
* This interface supports BOTH camelCase and snake_case formats for backward compatibility.
|
|
10
|
+
* The backend (multi-flowless) sends snake_case by default, but this interface accepts both.
|
|
6
11
|
*/
|
|
7
12
|
export interface User {
|
|
8
13
|
/**
|
|
@@ -18,33 +23,53 @@ export interface User {
|
|
|
18
23
|
*/
|
|
19
24
|
name: string;
|
|
20
25
|
/**
|
|
21
|
-
* User last name
|
|
26
|
+
* User last name (camelCase format - legacy)
|
|
22
27
|
*/
|
|
23
28
|
lastName?: string;
|
|
24
29
|
/**
|
|
25
|
-
* User
|
|
30
|
+
* User last name (snake_case format - preferred)
|
|
31
|
+
*/
|
|
32
|
+
last_name?: string;
|
|
33
|
+
/**
|
|
34
|
+
* User type (camelCase format - legacy)
|
|
26
35
|
*/
|
|
27
36
|
userType: string;
|
|
37
|
+
/**
|
|
38
|
+
* User type (snake_case format - preferred)
|
|
39
|
+
*/
|
|
40
|
+
user_type?: string;
|
|
28
41
|
/**
|
|
29
42
|
* User profile picture URL
|
|
30
43
|
*/
|
|
31
44
|
picture?: string;
|
|
32
45
|
/**
|
|
33
|
-
* Username (
|
|
46
|
+
* Username (camelCase format - legacy)
|
|
34
47
|
*/
|
|
35
48
|
userName?: string;
|
|
36
49
|
/**
|
|
37
|
-
*
|
|
50
|
+
* Username (snake_case format - preferred)
|
|
51
|
+
*/
|
|
52
|
+
user_name?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Email verification status (camelCase format - legacy)
|
|
38
55
|
*/
|
|
39
56
|
isVerified?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Email verification status (snake_case format - preferred)
|
|
59
|
+
*/
|
|
60
|
+
is_verified?: boolean;
|
|
40
61
|
/**
|
|
41
62
|
* Phone number for SMS authentication
|
|
42
63
|
*/
|
|
43
64
|
phone?: string;
|
|
44
65
|
/**
|
|
45
|
-
* Two-factor authentication enabled
|
|
66
|
+
* Two-factor authentication enabled (camelCase format - legacy)
|
|
46
67
|
*/
|
|
47
68
|
twoFactor?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Two-factor authentication enabled (snake_case format - preferred)
|
|
71
|
+
*/
|
|
72
|
+
two_factor?: boolean;
|
|
48
73
|
/**
|
|
49
74
|
* User language preference (e.g., 'es', 'en', 'fr')
|
|
50
75
|
*/
|
|
@@ -54,13 +79,21 @@ export interface User {
|
|
|
54
79
|
*/
|
|
55
80
|
metadata?: string;
|
|
56
81
|
/**
|
|
57
|
-
* Account creation timestamp
|
|
82
|
+
* Account creation timestamp (camelCase format - legacy)
|
|
58
83
|
*/
|
|
59
84
|
createdAt?: string;
|
|
60
85
|
/**
|
|
61
|
-
*
|
|
86
|
+
* Account creation timestamp (snake_case format - preferred)
|
|
87
|
+
*/
|
|
88
|
+
created_at?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Last update timestamp (camelCase format - legacy)
|
|
62
91
|
*/
|
|
63
92
|
updatedAt?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Last update timestamp (snake_case format - preferred)
|
|
95
|
+
*/
|
|
96
|
+
updated_at?: string;
|
|
64
97
|
/**
|
|
65
98
|
* Additional user data for extensibility
|
|
66
99
|
*
|