Skip to content

Commit 4b10027

Browse files
committed
[WEBSOCKET]: Channels
1 parent 94bb2d4 commit 4b10027

File tree

10 files changed

+622
-367
lines changed

10 files changed

+622
-367
lines changed

jac-cloud/jac_cloud/jaseci/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def lifespan(app: _FaststAPI) -> AsyncGenerator[None, _FaststAPI]:
6262
populate_yaml_specs(cls.__app__)
6363

6464
from .routers import healthz_router, sso_router, user_router
65-
from ..plugin.jaseci import walker_router, websocket_router
65+
from ..plugin.implementation import walker_router, websocket_router
6666

6767
for router in [
6868
healthz_router,

jac-cloud/jac_cloud/jaseci/dtos/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
UserResetPassword,
99
UserVerification,
1010
)
11+
from .websocket import (
12+
ChannelEvent,
13+
ConnectionEvent,
14+
UserEvent,
15+
WalkerEvent,
16+
WalkerEventData,
17+
WebSocketEvent,
18+
)
1119

1220

1321
__all__ = [
@@ -18,4 +26,10 @@
1826
"UserRequest",
1927
"UserResetPassword",
2028
"UserVerification",
29+
"ChannelEvent",
30+
"ConnectionEvent",
31+
"UserEvent",
32+
"WalkerEvent",
33+
"WalkerEventData",
34+
"WebSocketEvent",
2135
]
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""Jaseci SSO DTOs."""
2+
3+
from typing import Annotated, Any, Literal, Union
4+
5+
from pydantic import BaseModel, Field
6+
7+
8+
class ConnectionEvent(BaseModel):
9+
"""Connection Event Model."""
10+
11+
type: Literal["connection"]
12+
13+
14+
class WalkerEventData(BaseModel):
15+
"""Walker Event Data Model."""
16+
17+
walker: str
18+
node: str | None = None
19+
context: dict[str, Any]
20+
21+
22+
class WalkerEvent(BaseModel):
23+
"""Walker Event Model."""
24+
25+
type: Literal["walker"]
26+
data: WalkerEventData
27+
28+
29+
class UserEvent(BaseModel):
30+
"""Walker Event Model."""
31+
32+
type: Literal["user"]
33+
root_id: str
34+
data: dict
35+
36+
37+
class ChannelEvent(BaseModel):
38+
"""Walker Event Model."""
39+
40+
type: Literal["channel"]
41+
channel_id: str
42+
data: dict
43+
44+
45+
class WebSocketEvent(BaseModel):
46+
"""WebSocket Event."""
47+
48+
event: Annotated[
49+
Union[ConnectionEvent, WalkerEvent, UserEvent, ChannelEvent],
50+
Field(discriminator="type"),
51+
]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Jaseci Plugins."""
22

3-
from .jaseci import specs
3+
from .implementation import WEBSOCKET_MANAGER, specs
44

55

6-
__all__ = ["specs"]
6+
__all__ = ["WEBSOCKET_MANAGER", "specs"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Jaseci Plugin Implementations."""
2+
3+
from .api import specs, walker_router
4+
from .websocket import WEBSOCKET_MANAGER, websocket_router
5+
6+
__all__ = ["specs", "walker_router", "WEBSOCKET_MANAGER", "websocket_router"]

0 commit comments

Comments
 (0)