abs-utils 0.2.3__tar.gz → 0.2.4__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.
Files changed (20) hide show
  1. {abs_utils-0.2.3 → abs_utils-0.2.4}/PKG-INFO +2 -1
  2. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/azure_service_bus/event_decorator.py +1 -4
  3. abs_utils-0.2.4/abs_utils/schemas/libs/__init__.py +1 -0
  4. abs_utils-0.2.4/abs_utils/socket_io/__init__.py +3 -0
  5. abs_utils-0.2.4/abs_utils/socket_io/server.py +21 -0
  6. {abs_utils-0.2.3 → abs_utils-0.2.4}/pyproject.toml +2 -1
  7. {abs_utils-0.2.3 → abs_utils-0.2.4}/README.md +0 -0
  8. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/azure_service_bus/__init__.py +0 -0
  9. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/azure_service_bus/azure_service_bus.py +0 -0
  10. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/constants/__init__.py +0 -0
  11. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/constants/endpoint_constants.py +0 -0
  12. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/constants/event_constants.py +0 -0
  13. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/logger/__init__.py +0 -0
  14. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/logger/logger.py +0 -0
  15. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/schemas/__init__.py +0 -0
  16. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/schemas/fields_schema/__init__.py +0 -0
  17. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/schemas/fields_schema/common_schema.py +0 -0
  18. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/schemas/fields_schema/field_schema.py +0 -0
  19. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/schemas/libs/extend_enum.py +0 -0
  20. {abs_utils-0.2.3 → abs_utils-0.2.4}/abs_utils/schemas/libs/make_optional.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: abs-utils
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: AutoBridge Systems Utility Library
5
5
  Author: AutoBridgeSystems
6
6
  Author-email: info@autobridgesystems.com
@@ -12,6 +12,7 @@ Requires-Dist: aiohttp (>=3.11.18,<4.0.0)
12
12
  Requires-Dist: azure-identity (>=1.22.0,<2.0.0)
13
13
  Requires-Dist: azure-servicebus (>=7.14.2,<8.0.0)
14
14
  Requires-Dist: fastapi[standard] (>=0.115.12,<0.116.0)
15
+ Requires-Dist: python-socketio (>=5.13.0,<6.0.0)
15
16
  Description-Content-Type: text/markdown
16
17
 
17
18
  # Utils Package
@@ -4,7 +4,7 @@ from typing import Any, Callable
4
4
  from .azure_service_bus import AzureServiceBus
5
5
  from uuid import uuid4
6
6
  import json
7
- from ..constants import ON_RECORD_UPDATION
7
+
8
8
  def azure_event_decorator(event_type: str):
9
9
  """
10
10
  A decorator that sends a message to Azure Service Bus after the function execution.
@@ -44,9 +44,6 @@ def azure_event_decorator(event_type: str):
44
44
 
45
45
  # Execute the original function
46
46
  result = await func(*args, **kwargs)
47
-
48
- if event_type != ON_RECORD_UPDATION:
49
- data = result
50
47
 
51
48
  event_payload = {
52
49
  "event_id": str(uuid4()),
@@ -0,0 +1 @@
1
+ from .make_optional import *
@@ -0,0 +1,3 @@
1
+ from .server import SocketIOService
2
+
3
+ __all__ = ["SocketIOService"]
@@ -0,0 +1,21 @@
1
+ import socketio
2
+ from fastapi import FastAPI
3
+ from typing import Callable, Dict, Any
4
+ from functools import wraps
5
+ import asyncio
6
+
7
+
8
+ class SocketIOService:
9
+ def __init__(self, cors_origins: str = "*"):
10
+ self.sio = socketio.AsyncServer(async_mode="asgi", cors_allowed_origins=cors_origins)
11
+
12
+ def bind_app(self, fastapi_app: FastAPI):
13
+ return socketio.ASGIApp(self.sio, other_asgi_app=fastapi_app)
14
+
15
+ async def emit_to_sid(self, sid: str, event: str, data: Dict[str, Any]):
16
+ """Emit directly to a specific client."""
17
+ await self.sio.emit(event, data, to=sid)
18
+
19
+ async def emit_broadcast(self, event: str, data: Dict[str, Any]):
20
+ """Emit to all clients."""
21
+ await self.sio.emit(event, data)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "abs-utils"
3
- version = "0.2.3"
3
+ version = "0.2.4"
4
4
  description = "AutoBridge Systems Utility Library"
5
5
  authors = [
6
6
  {name = "AutoBridgeSystems", email = "info@autobridgesystems.com"}
@@ -13,6 +13,7 @@ dependencies = [
13
13
  "aiohttp (>=3.11.18,<4.0.0)",
14
14
  "fastapi[standard] (>=0.115.12,<0.116.0)",
15
15
  "abs-exception-core (>=0.1.2,<0.2.0)",
16
+ "python-socketio (>=5.13.0,<6.0.0)",
16
17
  ]
17
18
 
18
19
  [build-system]
File without changes