@pubflow/core 0.2.0 → 0.3.1
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 +119 -0
- package/dist/index.d.ts +1 -0
- package/dist/types.d.ts +75 -14
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Changelog - @pubflow/core
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.3.1] - 2025-10-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Added `PubflowConfig` as type alias for `PubflowInstanceConfig` (backward compatibility)
|
|
9
|
+
- Added `validateOnStartup` field to `SessionConfig` interface (React Native support)
|
|
10
|
+
- Added alternative field names to `PaginationMeta` interface:
|
|
11
|
+
- `page` (alternative to `currentPage`)
|
|
12
|
+
- `limit` (alternative to `perPage`)
|
|
13
|
+
- `total` (alternative to `totalItems`)
|
|
14
|
+
- `hasMore` (React Native compatibility)
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- Made all `PaginationMeta` fields optional for maximum flexibility
|
|
18
|
+
- Updated documentation to reflect both naming conventions
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- Fixed TypeScript compilation errors in `@pubflow/react-native` package
|
|
22
|
+
- Fixed missing exports for React Native compatibility
|
|
23
|
+
|
|
24
|
+
## [0.3.0] - 2025-10-25
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **snake_case Support**: User interface now supports BOTH camelCase and snake_case formats
|
|
28
|
+
- Added snake_case alternatives for all user fields:
|
|
29
|
+
- `last_name` (alternative to `lastName`)
|
|
30
|
+
- `user_type` (alternative to `userType`)
|
|
31
|
+
- `user_name` (alternative to `userName`)
|
|
32
|
+
- `is_verified` (alternative to `isVerified`)
|
|
33
|
+
- `two_factor` (alternative to `twoFactor`)
|
|
34
|
+
- `created_at` (alternative to `createdAt`)
|
|
35
|
+
- `updated_at` (alternative to `updatedAt`)
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- Updated User interface documentation to indicate preferred format (snake_case)
|
|
39
|
+
- Package description updated to reflect snake_case support
|
|
40
|
+
|
|
41
|
+
### Migration Guide
|
|
42
|
+
This is a **backward compatible** change. No breaking changes.
|
|
43
|
+
|
|
44
|
+
**For existing applications:**
|
|
45
|
+
- Applications using camelCase will continue to work without changes
|
|
46
|
+
- Applications can now use snake_case format (recommended for new code)
|
|
47
|
+
- Both formats can coexist in the same application
|
|
48
|
+
|
|
49
|
+
**For new applications:**
|
|
50
|
+
- Use snake_case format for consistency with backend (multi-flowless)
|
|
51
|
+
- Example: `user.user_type` instead of `user.userType`
|
|
52
|
+
|
|
53
|
+
**Fallback pattern for maximum compatibility:**
|
|
54
|
+
```typescript
|
|
55
|
+
const userType = user.userType || user.user_type || '';
|
|
56
|
+
const lastName = user.lastName || user.last_name || '';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Why snake_case?
|
|
60
|
+
1. **Performance**: ~44% smaller response size (no dual format needed)
|
|
61
|
+
2. **Industry Standard**: Used by Stripe, GitHub, Google, Twilio
|
|
62
|
+
3. **Multi-language**: Native to Python, Go, Ruby, Rust
|
|
63
|
+
4. **Database Alignment**: Matches database column naming
|
|
64
|
+
5. **Consistency**: One format across the entire stack
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## [0.2.0] - 2025-XX-XX
|
|
69
|
+
|
|
70
|
+
### Added
|
|
71
|
+
- Initial release with camelCase support
|
|
72
|
+
- Core authentication functionality
|
|
73
|
+
- Session management
|
|
74
|
+
- Storage abstraction
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Migration from 0.2.0 to 0.3.0
|
|
79
|
+
|
|
80
|
+
### No Action Required
|
|
81
|
+
This is a **non-breaking change**. Your existing code will continue to work.
|
|
82
|
+
|
|
83
|
+
### Optional: Adopt snake_case
|
|
84
|
+
If you want to adopt the new snake_case format:
|
|
85
|
+
|
|
86
|
+
1. Update your code to use snake_case fields:
|
|
87
|
+
```typescript
|
|
88
|
+
// Before (still works)
|
|
89
|
+
const type = user.userType;
|
|
90
|
+
|
|
91
|
+
// After (recommended)
|
|
92
|
+
const type = user.user_type;
|
|
93
|
+
|
|
94
|
+
// Best (maximum compatibility)
|
|
95
|
+
const type = user.userType || user.user_type;
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
2. Update your package.json:
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"@pubflow/core": "^0.3.0"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
3. Run: `npm install` or `bun install`
|
|
108
|
+
|
|
109
|
+
### Testing
|
|
110
|
+
After updating, test your authentication flows:
|
|
111
|
+
- Login
|
|
112
|
+
- Session validation
|
|
113
|
+
- User profile access
|
|
114
|
+
- Dashboard routing (if based on user_type)
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
For more information, see: `static/general-docs/snake-case-migration-guide.md`
|
|
119
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './config';
|
|
|
12
12
|
export * from './schema/validator';
|
|
13
13
|
export * from './storage/adapter';
|
|
14
14
|
export type { User, SessionConfig, StorageConfig, PubflowInstanceConfig, PaginationMeta } from './types';
|
|
15
|
+
export type { PubflowInstanceConfig as PubflowConfig } from './types';
|
|
15
16
|
export type { LoginCredentials, LoginResult, SessionValidationResult, SessionRefreshResult, RegistrationData, RegistrationResult, PasswordResetRequestData, PasswordResetData, AuthResponse, SessionResponse, ValidationResponse, RefreshResponse } from './auth/types';
|
|
16
17
|
export { ApiClient } from './api/client';
|
|
17
18
|
export { AuthService } from './auth/service';
|
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
|
*
|
|
@@ -102,6 +135,10 @@ export interface SessionConfig {
|
|
|
102
135
|
* Whether to validate session automatically
|
|
103
136
|
*/
|
|
104
137
|
autoValidate?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Whether to validate session on startup (React Native)
|
|
140
|
+
*/
|
|
141
|
+
validateOnStartup?: boolean;
|
|
105
142
|
/**
|
|
106
143
|
* Session validation interval in milliseconds
|
|
107
144
|
*/
|
|
@@ -171,22 +208,46 @@ export interface PubflowInstanceConfig {
|
|
|
171
208
|
}
|
|
172
209
|
/**
|
|
173
210
|
* Pagination metadata
|
|
211
|
+
*
|
|
212
|
+
* @version 0.3.1 - Made all fields optional for maximum flexibility
|
|
213
|
+
*
|
|
214
|
+
* Supports multiple naming conventions:
|
|
215
|
+
* - Standard: currentPage, totalPages, totalItems, perPage
|
|
216
|
+
* - Alternative: page, limit, total, hasMore (React Native compatibility)
|
|
217
|
+
*
|
|
218
|
+
* At least one set of fields should be provided.
|
|
174
219
|
*/
|
|
175
220
|
export interface PaginationMeta {
|
|
176
221
|
/**
|
|
177
|
-
* Current page number
|
|
222
|
+
* Current page number (standard format)
|
|
223
|
+
*/
|
|
224
|
+
currentPage?: number;
|
|
225
|
+
/**
|
|
226
|
+
* Current page number (alternative format - React Native)
|
|
178
227
|
*/
|
|
179
|
-
|
|
228
|
+
page?: number;
|
|
180
229
|
/**
|
|
181
230
|
* Total number of pages
|
|
182
231
|
*/
|
|
183
|
-
totalPages
|
|
232
|
+
totalPages?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Total number of items (standard format)
|
|
235
|
+
*/
|
|
236
|
+
totalItems?: number;
|
|
237
|
+
/**
|
|
238
|
+
* Total number of items (alternative format - React Native)
|
|
239
|
+
*/
|
|
240
|
+
total?: number;
|
|
241
|
+
/**
|
|
242
|
+
* Number of items per page (standard format)
|
|
243
|
+
*/
|
|
244
|
+
perPage?: number;
|
|
184
245
|
/**
|
|
185
|
-
*
|
|
246
|
+
* Number of items per page (alternative format - React Native)
|
|
186
247
|
*/
|
|
187
|
-
|
|
248
|
+
limit?: number;
|
|
188
249
|
/**
|
|
189
|
-
*
|
|
250
|
+
* Whether there are more pages available (React Native)
|
|
190
251
|
*/
|
|
191
|
-
|
|
252
|
+
hasMore?: boolean;
|
|
192
253
|
}
|