ipulse-shared-core-ftredge 24.2.1__tar.gz → 25.1.1__tar.gz

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.

Potentially problematic release.


This version of ipulse-shared-core-ftredge might be problematic. Click here for more details.

Files changed (58) hide show
  1. {ipulse_shared_core_ftredge-24.2.1/src/ipulse_shared_core_ftredge.egg-info → ipulse_shared_core_ftredge-25.1.1}/PKG-INFO +1 -1
  2. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/setup.py +1 -1
  3. ipulse_shared_core_ftredge-25.1.1/src/ipulse_shared_core_ftredge/dependencies/__init__.py +1 -0
  4. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/dependencies/auth_firebase_token_validation.py +0 -1
  5. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/dependencies/authz_for_apis.py +5 -6
  6. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/user/user_subscription.py +7 -7
  7. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/user/userstatus.py +1 -1
  8. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/charging_processors.py +2 -2
  9. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/user_subscription_operations.py +1 -1
  10. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/userstatus_operations.py +1 -1
  11. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user_charging_service.py +1 -1
  12. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1/src/ipulse_shared_core_ftredge.egg-info}/PKG-INFO +1 -1
  13. ipulse_shared_core_ftredge-24.2.1/src/ipulse_shared_core_ftredge/dependencies/__init__.py +0 -1
  14. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/LICENCE +0 -0
  15. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/README.md +0 -0
  16. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/pyproject.toml +0 -0
  17. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/setup.cfg +0 -0
  18. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/__init__.py +0 -0
  19. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/cache/__init__.py +0 -0
  20. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/cache/shared_cache.py +0 -0
  21. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/dependencies/auth_protected_router.py +0 -0
  22. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/dependencies/firestore_client.py +0 -0
  23. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/exceptions/__init__.py +0 -0
  24. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/exceptions/base_exceptions.py +0 -0
  25. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/exceptions/user_exceptions.py +0 -0
  26. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/__init__.py +0 -0
  27. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/base_api_response.py +0 -0
  28. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/base_data_model.py +0 -0
  29. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/catalog/__init__.py +0 -0
  30. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/catalog/subscriptionplan.py +0 -0
  31. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/catalog/usertype.py +0 -0
  32. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/user/__init__.py +0 -0
  33. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/user/user_permissions.py +0 -0
  34. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/user/userauth.py +0 -0
  35. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/models/user/userprofile.py +0 -0
  36. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/monitoring/__init__.py +0 -0
  37. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/monitoring/tracemon.py +0 -0
  38. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/__init__.py +0 -0
  39. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/base/__init__.py +0 -0
  40. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/base/base_firestore_service.py +0 -0
  41. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/base/cache_aware_firestore_service.py +0 -0
  42. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/catalog/__init__.py +0 -0
  43. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/catalog/catalog_subscriptionplan_service.py +0 -0
  44. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/catalog/catalog_usertype_service.py +0 -0
  45. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/__init__.py +0 -0
  46. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/user_core_service.py +0 -0
  47. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/user_multistep_operations.py +0 -0
  48. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/user_permissions_operations.py +0 -0
  49. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/userauth_operations.py +0 -0
  50. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/services/user/userprofile_operations.py +0 -0
  51. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/utils/__init__.py +0 -0
  52. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/utils/custom_json_encoder.py +0 -0
  53. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge/utils/json_encoder.py +0 -0
  54. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt +0 -0
  55. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt +0 -0
  56. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge.egg-info/requires.txt +0 -0
  57. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/src/ipulse_shared_core_ftredge.egg-info/top_level.txt +0 -0
  58. {ipulse_shared_core_ftredge-24.2.1 → ipulse_shared_core_ftredge-25.1.1}/tests/test_shared_cache.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 24.2.1
3
+ Version: 25.1.1
4
4
  Summary: Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.
5
5
  Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
6
6
  Author: Russlan Ramdowar
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  setup(
5
5
  name='ipulse_shared_core_ftredge',
6
- version='24.2.1',
6
+ version='25.1.1',
7
7
  package_dir={'': 'src'}, # Specify the source directory
8
8
  packages=find_packages(where='src'), # Look for packages in 'src'
9
9
  install_requires=[
@@ -0,0 +1 @@
1
+ from .auth_firebase_token_validation import verify_firebase_token
@@ -93,4 +93,3 @@ async def verify_firebase_token(
93
93
 
94
94
  # Type alias for dependency injection
95
95
  AuthUser = Annotated[UserAuth, Depends(verify_firebase_token)]
96
-
@@ -203,10 +203,9 @@ async def authorizeAPIRequest(
203
203
  )
204
204
 
205
205
  # Get usertype information from Firebase custom claims (primary source)
206
- custom_claims = firebase_user.get('custom_claims', {}) or firebase_user.get('claims', {})
207
- primary_usertype = custom_claims.get('primary_usertype')
208
- secondary_usertypes = custom_claims.get('secondary_usertypes', [])
209
- user_approval_status = custom_claims.get('user_approval_status', str(ApprovalStatus.UNKNOWN))
206
+ primary_usertype = firebase_user.get('primary_usertype')
207
+ secondary_usertypes = firebase_user.get('secondary_usertypes', [])
208
+ user_approval_status = firebase_user.get('user_approval_status', str(ApprovalStatus.UNKNOWN))
210
209
 
211
210
  # Determine if we need fresh status for permissions and credits
212
211
  force_fresh = _should_force_fresh_status(request)
@@ -217,6 +216,7 @@ async def authorizeAPIRequest(
217
216
  )
218
217
 
219
218
  # Perform comprehensive review and cleanup synchronously to ensure accurate auth data
219
+ logger.info(f"Comprehensive review for userstatus : {user_status_obj} during authz")
220
220
  if user_core_service:
221
221
  try:
222
222
  review_result = await user_core_service.review_and_clean_active_subscription_credits_and_permissions(
@@ -227,7 +227,7 @@ async def authorizeAPIRequest(
227
227
  clean_expired_permissions=True,
228
228
  review_credits=True
229
229
  )
230
-
230
+ logger.info(f"Review result for userstatus : {review_result} during authz")
231
231
  # Refresh user status after comprehensive review if any actions were taken
232
232
  if review_result.get('actions_taken'):
233
233
  logger.info(f"Auth middleware performed comprehensive review for user {user_uid}: {review_result['actions_taken']}")
@@ -268,7 +268,6 @@ async def authorizeAPIRequest(
268
268
  "uid": user_uid,
269
269
  "primary_usertype": primary_usertype,
270
270
  "secondary_usertypes": secondary_usertypes,
271
- "usertypes": [primary_usertype] + secondary_usertypes if primary_usertype else secondary_usertypes,
272
271
  "email_verified": firebase_user.get("email_verified", False),
273
272
  "user_approval_status": user_approval_status,
274
273
  "iam_permissions": valid_permissions,
@@ -56,7 +56,7 @@ class UserSubscription(BaseDataModel):
56
56
  )
57
57
 
58
58
  # Cycle duration fields
59
- cycle_start_date: datetime = Field(
59
+ cycle_start_datetime: datetime = Field(
60
60
  ..., # Required field, no default
61
61
  description="Subscription Cycle Start Date"
62
62
  )
@@ -163,7 +163,7 @@ class UserSubscription(BaseDataModel):
163
163
  @classmethod
164
164
  def auto_calculate_cycle_end_date(cls, data: Dict[str, Any]) -> Dict[str, Any]:
165
165
  """
166
- Auto-calculate cycle_end_datetime if not provided, based on cycle_start_date,
166
+ Auto-calculate cycle_end_datetime if not provided, based on cycle_start_datetime,
167
167
  validity_time_length, and validity_time_unit.
168
168
  """
169
169
  if not isinstance(data, dict):
@@ -176,19 +176,19 @@ class UserSubscription(BaseDataModel):
176
176
  (isinstance(data.get('cycle_end_datetime'), datetime) and
177
177
  abs((data['cycle_end_datetime'] - datetime.now(timezone.utc)).total_seconds()) < 5)):
178
178
 
179
- cycle_start_date = data.get('cycle_start_date')
179
+ cycle_start_datetime = data.get('cycle_start_datetime')
180
180
  validity_time_length = data.get('validity_time_length')
181
181
  validity_time_unit = data.get('validity_time_unit')
182
182
 
183
- if cycle_start_date and validity_time_length and validity_time_unit:
183
+ if cycle_start_datetime and validity_time_length and validity_time_unit:
184
184
  data['cycle_end_datetime'] = cls.calculate_cycle_end_date(
185
- cycle_start_date, validity_time_length, validity_time_unit
185
+ cycle_start_datetime, validity_time_length, validity_time_unit
186
186
  )
187
187
  else:
188
188
  raise ValueError(
189
189
  "Cannot create subscription without cycle_end_datetime. "
190
190
  "Either provide cycle_end_datetime directly or provide "
191
- "cycle_start_date, validity_time_length, and validity_time_unit for auto-calculation."
191
+ "cycle_start_datetime, validity_time_length, and validity_time_unit for auto-calculation."
192
192
  )
193
193
 
194
194
  return data
@@ -242,7 +242,7 @@ class UserSubscription(BaseDataModel):
242
242
  now = datetime.now(timezone.utc)
243
243
  return (
244
244
  self.status == SubscriptionStatus.ACTIVE and
245
- self.cycle_start_date <= now <= self.cycle_end_datetime_safe
245
+ self.cycle_start_datetime <= now <= self.cycle_end_datetime_safe
246
246
  )
247
247
 
248
248
  def is_expired(self) -> bool:
@@ -442,7 +442,7 @@ class UserStatus(BaseDataModel):
442
442
  return False
443
443
 
444
444
  now = datetime.now(timezone.utc)
445
- cycle_start = self.active_subscription.cycle_start_date
445
+ cycle_start = self.active_subscription.cycle_start_datetime
446
446
  update_frequency_hours = self.active_subscription.subscription_based_insight_credits_update_freq_h
447
447
 
448
448
  # Calculate when the next credit update should happen based on cycle start
@@ -91,7 +91,7 @@ class ChargingProcessor:
91
91
 
92
92
  # Verify credit service is available
93
93
  if not self.user_charging_service:
94
- self.logger.error("ChargingService not initialized.")
94
+ self.logger.error("UserChargingService not initialized.")
95
95
  return {
96
96
  'access_granted': False,
97
97
  'charge_successful': False,
@@ -268,7 +268,7 @@ class ChargingProcessor:
268
268
 
269
269
  # Verify credit service is available
270
270
  if not self.user_charging_service:
271
- self.logger.error("ChargingService not initialized for batch processing.")
271
+ self.logger.error("UserChargingService not initialized for batch processing.")
272
272
  return {
273
273
  'accessible_items': free_items,
274
274
  'charge_successful': False,
@@ -86,7 +86,7 @@ class UsersubscriptionOperations:
86
86
  plan_name=plan_name_enum,
87
87
  plan_version=plan.plan_version,
88
88
  plan_id=plan.id or f"{plan.plan_name}_{plan.plan_version}",
89
- cycle_start_date=start_date,
89
+ cycle_start_datetime=start_date,
90
90
  cycle_end_datetime=end_date,
91
91
  validity_time_length=plan.plan_validity_cycle_length,
92
92
  validity_time_unit=plan.plan_validity_cycle_unit,
@@ -361,7 +361,7 @@ class UserstatusOperations:
361
361
  # Create new subscription with updated cycle start date
362
362
  subscription_dict = subscription.model_dump()
363
363
  subscription_dict.update({
364
- 'cycle_start_date': new_cycle_start,
364
+ 'cycle_start_datetime': new_cycle_start,
365
365
  'cycle_end_datetime': None, # Let the model auto-calculate this
366
366
  'updated_at': now,
367
367
  'updated_by': f"UserstatusOperations.auto_renew:{updater_uid}"
@@ -37,7 +37,7 @@ class UserChargingService:
37
37
  self.timeout = firestore_timeout
38
38
 
39
39
  self.logger.info(
40
- f"ChargingService initialized using UserStatus constants. Collection: {self.users_status_collection_name}, "
40
+ f"UserChargingService initialized using UserStatus constants. Collection: {self.users_status_collection_name}, "
41
41
  f"Doc Prefix: {self.userstatus_doc_prefix}, Timeout: {self.timeout}s"
42
42
  )
43
43
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 24.2.1
3
+ Version: 25.1.1
4
4
  Summary: Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.
5
5
  Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
6
6
  Author: Russlan Ramdowar
@@ -1 +0,0 @@
1
- # from .auth_firebase_token_validation import verify_firebase_token