@cranberry-money/shared-services 8.1.1 โ†’ 8.1.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @cranberry-money/shared-services v3.0.0
2
2
 
3
- **Functional Architecture Shared Services** with pure functions, dependency injection, and comprehensive TypeScript support for the MyPortfolio platform.
3
+ **Functional Architecture Shared Services** with pure functions, dependency injection, and comprehensive TypeScript support for the Blueberry platform.
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/%40cranberry-money%2Fshared-services.svg)](https://badge.fury.io/js/%40cranberry-money%2Fshared-services)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
@@ -541,7 +541,7 @@ MIT License - see the [LICENSE](LICENSE) file for details.
541
541
 
542
542
  ## ๐Ÿ™ Acknowledgments
543
543
 
544
- - Built for the MyPortfolio platform
544
+ - Built for the Blueberry platform
545
545
  - Inspired by functional programming principles
546
546
  - Designed for maximum type safety and developer experience
547
547
 
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Placeholder for package
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,2BAA2B"}
package/package.json CHANGED
@@ -1,59 +1,49 @@
1
1
  {
2
2
  "name": "@cranberry-money/shared-services",
3
- "version": "8.1.1",
4
- "description": "Functional architecture shared services with pure functions, dependency injection, and comprehensive TypeScript support for the MyPortfolio platform",
3
+ "version": "8.1.2",
4
+ "description": "Functional architecture shared services with pure functions, dependency injection, and comprehensive TypeScript support for the Blueberry platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.cjs"
11
+ "import": "./dist/index.js"
13
12
  }
14
13
  },
15
14
  "files": [
16
- "dist",
17
- "README.md",
18
- "CHANGELOG.md",
19
- "docs"
15
+ "dist"
20
16
  ],
21
17
  "scripts": {
22
- "build": "tsc",
23
- "clean": "rm -rf dist",
18
+ "build": "tsc --build",
19
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
20
+ "test": "jest --passWithNoTests",
21
+ "test:watch": "jest --watch",
22
+ "test:coverage": "jest --coverage",
24
23
  "typecheck": "tsc --noEmit",
25
24
  "dev": "tsc --watch",
26
25
  "lint": "eslint src",
27
26
  "lint:fix": "eslint src --fix",
28
27
  "format": "prettier --write 'src/**/*.{ts,tsx}'",
29
- "format:check": "prettier --check 'src/**/*.{ts,tsx}'"
28
+ "format:check": "prettier --check 'src/**/*.{ts,tsx}'",
29
+ "prepublishOnly": "npm run clean && npm run typecheck && npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "axios": "^1.7.0"
32
+ "axios": "^1.9.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "react": ">=18.0.0",
36
- "typescript": ">=4.5.0"
37
- },
38
- "peerDependenciesMeta": {
39
- "react": {
40
- "optional": false
41
- }
35
+ "typescript": ">=5.0.0"
42
36
  },
43
37
  "devDependencies": {
38
+ "@types/jest": "^30.0.0",
44
39
  "@types/node": "^20.0.0",
45
- "@types/react": "^18.0.0",
46
- "@typescript-eslint/eslint-plugin": "^6.0.0",
47
- "@typescript-eslint/parser": "^6.0.0",
48
- "eslint": "^8.0.0",
49
- "react": "^18.0.0",
50
- "tsx": "^4.0.0",
40
+ "jest": "^30.0.5",
41
+ "ts-jest": "^29.4.1",
51
42
  "typescript": "^5.0.0"
52
43
  },
53
44
  "keywords": [
54
45
  "functional-programming",
55
46
  "dependency-injection",
56
- "react",
57
47
  "typescript",
58
48
  "api-client",
59
49
  "authentication",
@@ -61,23 +51,10 @@
61
51
  "services",
62
52
  "pure-functions"
63
53
  ],
64
- "author": "MyPortfolio Team",
54
+ "author": "Blueberry Team",
65
55
  "license": "MIT",
66
56
  "publishConfig": {
67
57
  "access": "public",
68
58
  "registry": "https://registry.npmjs.org/"
69
- },
70
- "repository": {
71
- "type": "git",
72
- "url": "git+https://github.com/your-org/cranberry.git",
73
- "directory": "packages/shared-services"
74
- },
75
- "bugs": {
76
- "url": "https://github.com/your-org/cranberry/issues"
77
- },
78
- "homepage": "https://github.com/your-org/cranberry/tree/main/packages/shared-services#readme",
79
- "engines": {
80
- "node": ">=16.0.0",
81
- "npm": ">=8.0.0"
82
59
  }
83
60
  }
package/CHANGELOG.md DELETED
@@ -1,257 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [3.0.0] - 2025-08-15
9
-
10
- ### ๐ŸŽ‰ Major Features
11
-
12
- #### Pure Functional Architecture
13
-
14
- - **Complete migration** from mixed OOP/functional patterns to pure functional programming
15
- - **Explicit dependency injection** throughout the entire codebase
16
- - **Immutable state management** with functional state transitions
17
- - **Zero global mutable state** - all dependencies passed explicitly
18
-
19
- #### Service Factory Pattern
20
-
21
- - **Platform-specific service creation** with `createWebServiceFactory()` and `createMobileServiceFactory()`
22
- - **Type-safe service composition** with full TypeScript support
23
- - **Dependency injection** with explicit configuration and validation
24
- - **Modular architecture** allowing easy extension and testing
25
-
26
- #### Enhanced Authentication System
27
-
28
- - **React Context-based authentication** replacing class-based AuthManager
29
- - **Pure functional auth operations** (signin, signout, signup, token refresh)
30
- - **Platform-specific token storage** (web localStorage, mobile secure storage, in-memory for testing)
31
- - **Automatic token refresh** with error handling and fallback
32
- - **React hooks integration** (`useFunctionalAuthState`, `useFunctionalAuthActions`)
33
-
34
- #### Migration Framework
35
-
36
- - **Feature flag system** for gradual migration from v2.x to v3.0.0
37
- - **Performance benchmarking tools** to compare functional vs legacy implementations
38
- - **Migration validation utilities** to ensure readiness before switching
39
- - **Compatibility layers** for smooth transition during migration
40
- - **Domain-specific migration adapters** for reference data services
41
-
42
- ### ๐Ÿ’ฅ Breaking Changes
43
-
44
- #### Removed Global Singleton API Client
45
-
46
- ```typescript
47
- // โŒ REMOVED - Global singleton pattern
48
- import { webApiClient } from '@cranberry/shared-services';
49
- const data = await webApiClient.get('/api/data');
50
-
51
- // โœ… NEW - Factory pattern with dependency injection
52
- import { createWebServiceFactory } from '@cranberry/shared-services';
53
- const services = createWebServiceFactory('https://api.example.com');
54
- const apiClient = services.auth.createAuthDependencies().apiClient;
55
- const data = await apiClient.get('/api/data');
56
- ```
57
-
58
- #### Deprecated AuthManager Class
59
-
60
- ```typescript
61
- // โŒ DEPRECATED - Class-based authentication
62
- import { AuthManager } from '@cranberry/shared-services';
63
- const authManager = new AuthManager(config);
64
- const user = authManager.getCurrentUser();
65
-
66
- // โœ… NEW - React Context with functional hooks
67
- import { FunctionalAuthProvider, useFunctionalAuthState } from '@cranberry/shared-services';
68
- const AuthProvider = services.auth.createAuthProvider();
69
- // Use in React components with hooks
70
- const authState = useFunctionalAuthState();
71
- ```
72
-
73
- #### Changed Service Access Pattern
74
-
75
- ```typescript
76
- // โŒ OLD - Direct service imports
77
- import * as PortfoliosService from '@cranberry/shared-services';
78
- const portfolios = await PortfoliosService.getPortfolios();
79
-
80
- // โœ… NEW - Service factory pattern
81
- const services = createWebServiceFactory(apiUrl);
82
- const portfolios = await services.portfolio.getPortfolios();
83
- ```
84
-
85
- #### Updated Export Names for Clarity
86
-
87
- ```typescript
88
- // โŒ OLD - Potential naming conflicts
89
- import { AuthState, ApiClient, TokenStorage } from '@cranberry/shared-services';
90
-
91
- // โœ… NEW - Prefixed exports to avoid conflicts
92
- import { FunctionalAuthState, FunctionalApiClient, FunctionalTokenStorage } from '@cranberry/shared-services';
93
- ```
94
-
95
- #### Standardized Error Handling
96
-
97
- ```typescript
98
- // โŒ OLD - Inconsistent error formats
99
- catch (error) {
100
- const message = error.message || error.detail || 'Unknown error';
101
- }
102
-
103
- // โœ… NEW - Standardized API error handling
104
- import { isFunctionalApiError } from '@cranberry/shared-services';
105
- catch (error) {
106
- if (isFunctionalApiError(error)) {
107
- console.error(`API Error (${error.status}): ${error.message}`);
108
- if (error.details) console.error('Details:', error.details);
109
- }
110
- }
111
- ```
112
-
113
- ### โœจ New Features
114
-
115
- #### Feature Flag System
116
-
117
- - **Gradual migration support** with feature flags for each domain
118
- - **Environment-based configuration** (development, staging, production)
119
- - **Persistent storage** with automatic configuration loading
120
- - **Performance monitoring** integration during migration
121
- - **Rollback capabilities** for safe migration
122
-
123
- #### Migration Utilities
124
-
125
- - **Migration helpers** with compatibility layers between v2.x and v3.0.0
126
- - **Validation tools** to check migration readiness
127
- - **Progress tracking** with detailed metrics and reporting
128
- - **Performance comparison** tools for functional vs legacy implementations
129
-
130
- #### Reference Data Services
131
-
132
- - **Complete functional implementation** for countries, industries, sectors, stock exchanges
133
- - **Feature flag integration** for gradual migration
134
- - **Backward compatibility** during transition period
135
- - **Performance optimizations** with caching and filtering
136
-
137
- #### Platform-Specific Token Storage
138
-
139
- - **Web token storage** using localStorage with automatic cleanup
140
- - **Mobile secure storage** integration (Expo SecureStore, iOS Keychain, Android Keystore)
141
- - **In-memory storage** for testing environments
142
- - **Migration utilities** for converting from legacy token storage
143
-
144
- #### Performance Improvements
145
-
146
- - **10-15% faster API calls** due to reduced abstraction layers
147
- - **15-20% reduction in memory usage** through immutable state management
148
- - **5-10% smaller bundle size** by eliminating unnecessary OOP abstractions
149
- - **Built-in performance monitoring** with automatic benchmarking
150
-
151
- ### ๐Ÿ› Bug Fixes
152
-
153
- - **Fixed memory leaks** in global state management by eliminating mutable global state
154
- - **Fixed inconsistent error handling** across services with standardized error formats
155
- - **Fixed TypeScript strict mode compatibility** issues with improved type definitions
156
- - **Fixed race conditions** in authentication flow with pure functional state management
157
- - **Fixed token refresh edge cases** with proper error handling and fallback mechanisms
158
-
159
- ### ๐Ÿ“š Documentation
160
-
161
- #### Comprehensive Migration Guide
162
-
163
- - **Step-by-step migration instructions** from v2.x to v3.0.0
164
- - **Code examples** for all breaking changes
165
- - **Gradual migration strategy** with feature flag usage
166
- - **Rollback procedures** for emergency situations
167
- - **Performance validation** guidelines
168
-
169
- #### Integration Examples
170
-
171
- - **Blueberry dashboard integration** example with complete setup
172
- - **React Query integration** patterns and best practices
173
- - **Testing examples** for pure functions and React components
174
- - **Error handling** patterns and utilities
175
-
176
- #### API Documentation
177
-
178
- - **Complete TypeScript definitions** for all new APIs
179
- - **Usage examples** for every major feature
180
- - **Performance benchmarking** guides and tools
181
- - **Troubleshooting** guides for common migration issues
182
-
183
- ### ๐Ÿงช Testing
184
-
185
- - **100% test coverage** for all new functional components
186
- - **Migration validation tests** to ensure compatibility
187
- - **Performance regression tests** to maintain performance standards
188
- - **Integration test examples** for React components and hooks
189
- - **Pure function testing** utilities and patterns
190
-
191
- ### ๐Ÿ›  Developer Experience
192
-
193
- - **Improved TypeScript support** with strict mode compatibility
194
- - **Self-documenting pure functions** with explicit dependencies
195
- - **Better error messages** with detailed debugging information
196
- - **Comprehensive examples** for all use cases
197
- - **Migration tooling** for smooth transition
198
-
199
- ### ๐Ÿ“ฆ Dependencies
200
-
201
- #### Added
202
-
203
- - Enhanced TypeScript support (>=4.5.0)
204
- - React 18+ support for new context APIs
205
- - Improved axios integration for HTTP client
206
-
207
- #### Removed
208
-
209
- - Legacy OOP class dependencies
210
- - Global state management libraries
211
- - Unused abstraction layers
212
-
213
- ### ๐Ÿ”„ Migration Support
214
-
215
- #### Automatic Migration Tools
216
-
217
- - **Feature flag management** for gradual rollout
218
- - **Performance comparison** between old and new implementations
219
- - **Validation utilities** to check migration readiness
220
- - **Compatibility layers** to ease transition
221
-
222
- #### Support Timeline
223
-
224
- - **v3.0.x**: Active development and support
225
- - **v2.x**: Security fixes and critical bug fixes for 6 months
226
- - **v1.x**: End of life
227
-
228
- ---
229
-
230
- ## [2.x.x] - Previous Versions
231
-
232
- For changes in v2.x and earlier, please see the [legacy changelog](./CHANGELOG-v2.md).
233
-
234
- ---
235
-
236
- ## Migration Guide
237
-
238
- **Migrating from v2.x?**
239
-
240
- ๐Ÿ“– **[Complete Migration Guide](./docs/improvements/v3-migration-guide.md)** - Step-by-step instructions with examples
241
-
242
- ๐Ÿ”ง **[Migration Checklist](./docs/improvements/migration-checklist.md)** - Systematic approach to migration
243
-
244
- โšก **[Performance Guide](./docs/improvements/v3-release-preparation.md)** - Performance improvements and monitoring
245
-
246
- ๐Ÿš€ **[Quick Start](./README.md#quick-start)** - Get up and running with v3.0.0
247
-
248
- ## Support
249
-
250
- - **GitHub Issues**: [Report bugs and request features](https://github.com/your-org/cranberry/issues)
251
- - **Documentation**: [Complete documentation](./docs/)
252
- - **Examples**: [Integration examples](./src/integration/)
253
- - **Migration Help**: See migration guides above
254
-
255
- ---
256
-
257
- _This release represents a significant architectural advancement that improves code quality, performance, and developer experience across all applications using Cranberry shared services._