ipulse-shared-core-ftredge 16.0.1__py3-none-any.whl → 18.0.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.

@@ -140,10 +140,12 @@ async def get_userstatus(
140
140
  snapshot = await get_with_strict_timeout(user_ref, timeout)
141
141
 
142
142
  if not snapshot.exists:
143
+ # Log at DEBUG level since this might be expected for new users
144
+ logger.debug(f"User status document not found for user {user_uid} (document: {userstatus_id})")
143
145
  raise ResourceNotFoundError(
144
- resource_type="authorization userstatus",
146
+ resource_type="authz_for_apis>userstatus",
145
147
  resource_id=userstatus_id,
146
- additional_info={"user_uid": user_uid}
148
+ additional_info={"user_uid": user_uid, "context": "authorization"}
147
149
  )
148
150
 
149
151
  status_data = snapshot.to_dict()
@@ -153,7 +155,10 @@ async def get_userstatus(
153
155
  userstatus_cache.set(user_uid, status_data)
154
156
  return status_data, cache_used
155
157
 
156
- except TimeoutError as e:
158
+ except ResourceNotFoundError:
159
+ # Re-raise ResourceNotFoundError as-is - don't wrap in ServiceError
160
+ raise
161
+ except (TimeoutError, FirestoreTimeoutError) as e:
157
162
  logger.error(f"Timeout while fetching user status for {user_uid}: {str(e)}")
158
163
  raise ServiceError(
159
164
  operation="fetching user status for authz",
@@ -166,8 +171,6 @@ async def get_userstatus(
166
171
  "timeout_seconds": timeout
167
172
  }
168
173
  )
169
- except ResourceNotFoundError:
170
- raise
171
174
  except Exception as e:
172
175
  logger.error(f"Error fetching user status for {user_uid}: {str(e)}")
173
176
  raise ServiceError(
@@ -4,7 +4,7 @@ from .user_status import UserStatus, IAMUnitRefAssignment
4
4
  from .user_profile_update import UserProfileUpdate
5
5
  from .user_auth import UserAuth
6
6
  from .organization_profile import OrganizationProfile
7
- from .base_api_response import BaseAPIResponse , CustomJSONResponse
7
+ from .base_api_response import BaseAPIResponse , CustomJSONResponse, CreditChargeableAPIResponse, UserCreditBalance, UpdatedUserCreditInfo
8
8
  from .base_data_model import BaseDataModel
9
9
 
10
10
 
@@ -11,6 +11,7 @@ T = TypeVar('T')
11
11
  class BaseAPIResponse(BaseModel, Generic[T]):
12
12
  model_config = ConfigDict(arbitrary_types_allowed=True)
13
13
  success: bool
14
+ chargeable: bool = False # Added chargeable attribute
14
15
  data: Optional[T] = None
15
16
  message: Optional[str] = None
16
17
  error: Optional[str] = None
@@ -19,6 +20,20 @@ class BaseAPIResponse(BaseModel, Generic[T]):
19
20
  "timestamp": dt.datetime.now(dt.timezone.utc).isoformat()
20
21
  }
21
22
 
23
+ class UserCreditBalance(BaseModel):
24
+ sbscrptn_based_insight_credits: float
25
+ extra_insight_credits: float
26
+
27
+ class UpdatedUserCreditInfo(BaseModel):
28
+ charge_attempted: bool
29
+ charge_successful: bool
30
+ cost_incurred: float
31
+ items_processed_for_charge: int
32
+ user_balance: UserCreditBalance
33
+
34
+ class CreditChargeableAPIResponse(BaseAPIResponse[T], Generic[T]):
35
+ updated_user_credit_info: Optional[UpdatedUserCreditInfo] = None
36
+
22
37
  class PaginatedAPIResponse(BaseAPIResponse, Generic[T]):
23
38
  total_count: int
24
39
  page: int
@@ -1,6 +1,7 @@
1
1
  from datetime import datetime, timezone
2
2
  from typing import Any
3
3
  from typing import ClassVar
4
+ from typing import Optional, Dict
4
5
  from pydantic import BaseModel, Field, ConfigDict, field_validator
5
6
  import dateutil.parser
6
7
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 16.0.1
3
+ Version: 18.0.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
@@ -13,7 +13,7 @@ Requires-Dist: pydantic[email]~=2.5
13
13
  Requires-Dist: python-dateutil~=2.8
14
14
  Requires-Dist: fastapi~=0.115.8
15
15
  Requires-Dist: pytest
16
- Requires-Dist: ipulse_shared_base_ftredge==6.5.1
16
+ Requires-Dist: ipulse_shared_base_ftredge==7.2.0
17
17
  Dynamic: author
18
18
  Dynamic: classifier
19
19
  Dynamic: home-page
@@ -4,11 +4,11 @@ ipulse_shared_core_ftredge/cache/shared_cache.py,sha256=NMHSQyHjhn11IB3cQjw7ctV1
4
4
  ipulse_shared_core_ftredge/dependencies/__init__.py,sha256=HGsR8HUguKTfjz_BorCILS4izX8CAjG-apE0kIPE0Yo,68
5
5
  ipulse_shared_core_ftredge/dependencies/auth_firebase_token_validation.py,sha256=EFWyhoVOI0tGYOWqN5St4JNIy4cMwpxeBhKdjOwEfbg,1888
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=Z2ISjyLM7p63YhCCkFAEtAv5ekjExIFM1m2UGUQCUrY,15512
7
+ ipulse_shared_core_ftredge/dependencies/authz_for_apis.py,sha256=6mJwk_xJILbnvPDfnxXyCebvP9TymvK0NaEDT8KBU-A,15826
8
8
  ipulse_shared_core_ftredge/dependencies/firestore_client.py,sha256=VbTb121nsc9EZPd1RDEsHBLW5pIiVw6Wdo2JFL4afMg,714
9
- ipulse_shared_core_ftredge/models/__init__.py,sha256=KACWEIj5IFfJE7L4k_csRORUSdD39zslkR3fFEzoKkc,385
10
- ipulse_shared_core_ftredge/models/base_api_response.py,sha256=WOHxtv_FEk5MKzXORgIsp-sKP4O5WJCgrJMI6tYph4U,1880
11
- ipulse_shared_core_ftredge/models/base_data_model.py,sha256=frvUDiKnjMGPXIQX_qdpNgGcm3SauCth6GiRuabmD5s,2509
9
+ ipulse_shared_core_ftredge/models/__init__.py,sha256=xGbDLElTRbUwcQaOTwz5Myxv5hAP2S3xSTMgO2hN-Ko,456
10
+ ipulse_shared_core_ftredge/models/base_api_response.py,sha256=OwuWI2PsMSLDkFt643u35ZhW5AHFEMMAGnGprmUO0fA,2380
11
+ ipulse_shared_core_ftredge/models/base_data_model.py,sha256=feG_K4i1xX_J_h9QrdxshmFvUsS1_hWR8BBoh0DRxoM,2543
12
12
  ipulse_shared_core_ftredge/models/organization_profile.py,sha256=OnjsSVcp_LSB65F9Tl9udwNgqMg7gjSpv38eArpVXPc,3668
13
13
  ipulse_shared_core_ftredge/models/subscription.py,sha256=bu6BtyDQ4jDkK3PLY97dZ_A3cmjzZahTkuaFOFybdxI,6892
14
14
  ipulse_shared_core_ftredge/models/user_auth.py,sha256=YgCeK0uJ-JOkPavwzogl4wGC3RpA8PVfl-5MPS4Kxhk,432
@@ -26,8 +26,8 @@ ipulse_shared_core_ftredge/services/servicemon.py,sha256=wWhsLwU1_07emaEyCNziZA1
26
26
  ipulse_shared_core_ftredge/utils/__init__.py,sha256=JnxUb8I2MRjJC7rBPXSrpwBIQDEOku5O9JsiTi3oun8,56
27
27
  ipulse_shared_core_ftredge/utils/custom_json_encoder.py,sha256=DblQLD0KOSNDyQ58wQRogBrShIXzPIZUw_oGOBATnJY,1366
28
28
  ipulse_shared_core_ftredge/utils/json_encoder.py,sha256=QkcaFneVv3-q-s__Dz4OiUWYnM6jgHDJrDMdPv09RCA,2093
29
- ipulse_shared_core_ftredge-16.0.1.dist-info/licenses/LICENCE,sha256=YBtYAXNqCCOo9Mr2hfkbSPAM9CeAr2j1VZBSwQTrNwE,1060
30
- ipulse_shared_core_ftredge-16.0.1.dist-info/METADATA,sha256=S-xWB7d9G8QAxCw3Y_p5-sxm3VLtQ15zjn1Y6fgSmos,803
31
- ipulse_shared_core_ftredge-16.0.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
32
- ipulse_shared_core_ftredge-16.0.1.dist-info/top_level.txt,sha256=8sgYrptpexkA_6_HyGvho26cVFH9kmtGvaK8tHbsGHk,27
33
- ipulse_shared_core_ftredge-16.0.1.dist-info/RECORD,,
29
+ ipulse_shared_core_ftredge-18.0.1.dist-info/licenses/LICENCE,sha256=YBtYAXNqCCOo9Mr2hfkbSPAM9CeAr2j1VZBSwQTrNwE,1060
30
+ ipulse_shared_core_ftredge-18.0.1.dist-info/METADATA,sha256=SXCSNUI23dl8PQes6lO-5wItHJowquYaqJr4eiWebtM,803
31
+ ipulse_shared_core_ftredge-18.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
+ ipulse_shared_core_ftredge-18.0.1.dist-info/top_level.txt,sha256=8sgYrptpexkA_6_HyGvho26cVFH9kmtGvaK8tHbsGHk,27
33
+ ipulse_shared_core_ftredge-18.0.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5