ipulse-shared-core-ftredge 24.2.1__py3-none-any.whl → 25.1.1__py3-none-any.whl

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.

@@ -1 +1 @@
1
- # from .auth_firebase_token_validation import verify_firebase_token
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,10 +1,10 @@
1
1
  ipulse_shared_core_ftredge/__init__.py,sha256=-KbdF_YW8pgf7pVv9qh_cA1xrNm_B9zigHYDo7ZA4eU,42
2
2
  ipulse_shared_core_ftredge/cache/__init__.py,sha256=i2fPojmZiBwAoY5ovnnnME9USl4bi8MRPYkAgEfACfI,136
3
3
  ipulse_shared_core_ftredge/cache/shared_cache.py,sha256=BDJtkTsdfmVjKaUkbBXOhJ2Oib7Li0UCsPjWX7FLIPU,12940
4
- ipulse_shared_core_ftredge/dependencies/__init__.py,sha256=HGsR8HUguKTfjz_BorCILS4izX8CAjG-apE0kIPE0Yo,68
5
- ipulse_shared_core_ftredge/dependencies/auth_firebase_token_validation.py,sha256=S4A2oD1TyhBYGV13GjQbUFvW4d90NOHQ3foPetFiPcQ,3642
4
+ ipulse_shared_core_ftredge/dependencies/__init__.py,sha256=0QEG_lQjtnxErpEDRHN8Q7Qz5dE8brzhFnmbIHVyoak,66
5
+ ipulse_shared_core_ftredge/dependencies/auth_firebase_token_validation.py,sha256=3fHkjpcvywbWy_86iO_O1W75NiuTYMtP00LpA4ue-QU,3641
6
6
  ipulse_shared_core_ftredge/dependencies/auth_protected_router.py,sha256=em5D5tE7OkgZmuCtYCKuUAnIZCgRJhCF8Ye5QmtGWlk,1807
7
- ipulse_shared_core_ftredge/dependencies/authz_for_apis.py,sha256=t2hz1wAVxCT0lCDVf6gmcYeLuUCR7mIXYsThKg0cIlM,14992
7
+ ipulse_shared_core_ftredge/dependencies/authz_for_apis.py,sha256=C424mYk2jtmkzC8su4uRJU_svI-vSRgX4j2DaYYNJx4,14962
8
8
  ipulse_shared_core_ftredge/dependencies/firestore_client.py,sha256=VbTb121nsc9EZPd1RDEsHBLW5pIiVw6Wdo2JFL4afMg,714
9
9
  ipulse_shared_core_ftredge/exceptions/__init__.py,sha256=Cb_RsIie4DbT_NLwFVwjw4riDKsNNRQEuAvHvYa-Zco,1038
10
10
  ipulse_shared_core_ftredge/exceptions/base_exceptions.py,sha256=117YsiCbYLLBu_D0IffYFVSX2yh-pisALMtoSMwj6xI,5338
@@ -17,15 +17,15 @@ ipulse_shared_core_ftredge/models/catalog/subscriptionplan.py,sha256=WxKWzTmHJlv
17
17
  ipulse_shared_core_ftredge/models/catalog/usertype.py,sha256=E_qQCq7ytiFca6umaX_-_a6TuDh83YwSKtFKdeU4ErM,6584
18
18
  ipulse_shared_core_ftredge/models/user/__init__.py,sha256=1BKuWCvTTy6C5_vPPc0K3obRdpadiOVBzkFvKwzJ2vQ,215
19
19
  ipulse_shared_core_ftredge/models/user/user_permissions.py,sha256=3dK4idfS7tsIXzN-c5plcg3qO5GPMtxzUoGCeBfzCis,2281
20
- ipulse_shared_core_ftredge/models/user/user_subscription.py,sha256=83ncQUHUYF6S19KdZM7-nLEVjD4VPIO88ZRVkXeNnE8,13514
20
+ ipulse_shared_core_ftredge/models/user/user_subscription.py,sha256=66JYG-6a25nMTT9w25ZgOkB--MIOBDrqgp56If_9NSI,13546
21
21
  ipulse_shared_core_ftredge/models/user/userauth.py,sha256=GYtRxYsbxEh3eBink7qr_CjxWu5W46G3gUL9_2QLw6U,5724
22
22
  ipulse_shared_core_ftredge/models/user/userprofile.py,sha256=7VbE4qiKpDxZsNTk-IJKA32QxW0JOo8KWPkj8h9J2-Y,6945
23
- ipulse_shared_core_ftredge/models/user/userstatus.py,sha256=2e17SpcW9JXpQsbcgAJZJXlWYRKuqc4EKYowWKuMmGQ,18794
23
+ ipulse_shared_core_ftredge/models/user/userstatus.py,sha256=w6eWKfzZ1RP6u9wMrucXUV6XZpNcS-z8zEl8JNUt-o8,18798
24
24
  ipulse_shared_core_ftredge/monitoring/__init__.py,sha256=gUoJjT0wj-cQYnMWheWbh1mmRHmaeojmnBZTj7KPNus,61
25
25
  ipulse_shared_core_ftredge/monitoring/tracemon.py,sha256=Trku0qrwWvEcvKsBWiYokd_G3fcH-5uP2wRVgcgIz_k,11596
26
26
  ipulse_shared_core_ftredge/services/__init__.py,sha256=9AkMLCHNswhuNbQuJZaEVz4zt4F84PxfJLyU_bYk4Js,565
27
- ipulse_shared_core_ftredge/services/charging_processors.py,sha256=9Re24dyXdjKYbqwx6uNLu3JBzIaw87TAV7Oe__M1QnA,16308
28
- ipulse_shared_core_ftredge/services/user_charging_service.py,sha256=C3wMfgBXOz4RM1RLc7up2_pIPAnZv8ZYu-lLrkofTmc,14625
27
+ ipulse_shared_core_ftredge/services/charging_processors.py,sha256=fug6Hr5JbkhV3TXNyHrN0U3hOYmD1frCpSXVu6CynXQ,16316
28
+ ipulse_shared_core_ftredge/services/user_charging_service.py,sha256=wlQDURVRWAv8g_StQ9Ybbn2G_OWw6gYD47yWWk9Bd9A,14629
29
29
  ipulse_shared_core_ftredge/services/base/__init__.py,sha256=zhyrHQMM0cLJr4spk2b6VsgJXuWBy7hUBzhrq_Seg9k,389
30
30
  ipulse_shared_core_ftredge/services/base/base_firestore_service.py,sha256=leZFwxb1ruheypqudpKnuNtRQXtO4KNeoJk6ZACozHc,19512
31
31
  ipulse_shared_core_ftredge/services/base/cache_aware_firestore_service.py,sha256=ya5Asff9BQodYnJVAw6M_Pm8WtVRPpEK7izFlZ2MyjA,10016
@@ -36,15 +36,15 @@ ipulse_shared_core_ftredge/services/user/__init__.py,sha256=jmkD5XzAmaD8QV2UsgB5
36
36
  ipulse_shared_core_ftredge/services/user/user_core_service.py,sha256=rJF4ZDk1ANz-gk7wEEXBbgjaqS4r1Vdo8yC00fQDytQ,28324
37
37
  ipulse_shared_core_ftredge/services/user/user_multistep_operations.py,sha256=UlSNs_8ORuESfsxHljIdcaD6H8DDEXSU0CzJAr99T5M,39765
38
38
  ipulse_shared_core_ftredge/services/user/user_permissions_operations.py,sha256=FByszIWo-qooLVXFTw0tGLWksIJEqHUPc_ZGwue0_pM,15753
39
- ipulse_shared_core_ftredge/services/user/user_subscription_operations.py,sha256=z98EO67wHlnDj1V7JK14yq6yaIoTVcX5X5v4-taZFHw,21651
39
+ ipulse_shared_core_ftredge/services/user/user_subscription_operations.py,sha256=P-Sif2tXXC6ifKZCEpkOLXP4kf1-kKH0tfo13XcRIqk,21655
40
40
  ipulse_shared_core_ftredge/services/user/userauth_operations.py,sha256=QY_ueDei4EeXl_EZLlhN13PF6k_qsPjlnP0dnv2m7KI,36246
41
41
  ipulse_shared_core_ftredge/services/user/userprofile_operations.py,sha256=_qyIEAQYCTV-subgP-5naMs_26apCpauomE6qmCCVWs,7333
42
- ipulse_shared_core_ftredge/services/user/userstatus_operations.py,sha256=sW4Q-aMG1mjKvqVKK5AA93-G57FPBCkxO7rPfCkhBd8,22726
42
+ ipulse_shared_core_ftredge/services/user/userstatus_operations.py,sha256=Om9d94cM4uOdTmCNXECU0hFtsUZ-o-OLMEiLAG74YUQ,22730
43
43
  ipulse_shared_core_ftredge/utils/__init__.py,sha256=JnxUb8I2MRjJC7rBPXSrpwBIQDEOku5O9JsiTi3oun8,56
44
44
  ipulse_shared_core_ftredge/utils/custom_json_encoder.py,sha256=DblQLD0KOSNDyQ58wQRogBrShIXzPIZUw_oGOBATnJY,1366
45
45
  ipulse_shared_core_ftredge/utils/json_encoder.py,sha256=QkcaFneVv3-q-s__Dz4OiUWYnM6jgHDJrDMdPv09RCA,2093
46
- ipulse_shared_core_ftredge-24.2.1.dist-info/licenses/LICENCE,sha256=YBtYAXNqCCOo9Mr2hfkbSPAM9CeAr2j1VZBSwQTrNwE,1060
47
- ipulse_shared_core_ftredge-24.2.1.dist-info/METADATA,sha256=s6gP3vKGPYEeqDsalsdncmzYcekSPxVHS9vVt7nCqSg,782
48
- ipulse_shared_core_ftredge-24.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
- ipulse_shared_core_ftredge-24.2.1.dist-info/top_level.txt,sha256=8sgYrptpexkA_6_HyGvho26cVFH9kmtGvaK8tHbsGHk,27
50
- ipulse_shared_core_ftredge-24.2.1.dist-info/RECORD,,
46
+ ipulse_shared_core_ftredge-25.1.1.dist-info/licenses/LICENCE,sha256=YBtYAXNqCCOo9Mr2hfkbSPAM9CeAr2j1VZBSwQTrNwE,1060
47
+ ipulse_shared_core_ftredge-25.1.1.dist-info/METADATA,sha256=RQwjz526aJVLHzF5_ggRv_8WK2cJfpzEVkIs71E7hpk,782
48
+ ipulse_shared_core_ftredge-25.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
+ ipulse_shared_core_ftredge-25.1.1.dist-info/top_level.txt,sha256=8sgYrptpexkA_6_HyGvho26cVFH9kmtGvaK8tHbsGHk,27
50
+ ipulse_shared_core_ftredge-25.1.1.dist-info/RECORD,,