devcoffee-integration-event 1.0.0__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.
- devcoffee_integration_event-1.0.0.dist-info/METADATA +11 -0
- devcoffee_integration_event-1.0.0.dist-info/RECORD +11 -0
- devcoffee_integration_event-1.0.0.dist-info/WHEEL +4 -0
- devcoffee_integration_event-1.0.0.dist-info/entry_points.txt +4 -0
- tech/__init__.py +0 -0
- tech/devcoffee/__init__.py +0 -0
- tech/devcoffee/integration/__init__.py +0 -0
- tech/devcoffee/integration/events/__init__.py +1 -0
- tech/devcoffee/integration/events/base.py +23 -0
- tech/devcoffee/integration/events/token.py +49 -0
- tech/devcoffee/integration/events/user.py +58 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: devcoffee-integration-event
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: DevCoffee events data
|
|
5
|
+
Author-Email: Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Requires-Dist: pydantic>=2.12.5
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# devcoffee-integration-event
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
devcoffee_integration_event-1.0.0.dist-info/METADATA,sha256=iaMH6wao414luP6kIIeHLigb45gR0TIP4EoyyY3rimY,297
|
|
2
|
+
devcoffee_integration_event-1.0.0.dist-info/WHEEL,sha256=Wb0ASbVj8JvWHpOiIpPi7ucfIgJeCi__PzivviEAQFc,90
|
|
3
|
+
devcoffee_integration_event-1.0.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
tech/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
tech/devcoffee/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
tech/devcoffee/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
tech/devcoffee/integration/events/__init__.py,sha256=m4qMUkQZDNDmYzcruxxjni4Q8uyN0nSjeF7NAYqAchY,29
|
|
8
|
+
tech/devcoffee/integration/events/base.py,sha256=X29ZIiIwi2RifrXbGPvSho66HMkkBIJHBvlteYEfPs0,899
|
|
9
|
+
tech/devcoffee/integration/events/token.py,sha256=pTfZSOtUs27_ma2b0V-hrZwnHsMtpwlR6NgZu1VQxbo,1661
|
|
10
|
+
tech/devcoffee/integration/events/user.py,sha256=4u5a0KUnBD72cIoRthQR3Q85YYwucf6m2QDleGIOPto,1853
|
|
11
|
+
devcoffee_integration_event-1.0.0.dist-info/RECORD,,
|
tech/__init__.py
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .base import BaseEvent
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Any
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
__all__=[
|
|
8
|
+
"BaseEvent"
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
class BaseEvent(BaseModel):
|
|
12
|
+
event_id: UUID = Field(..., description="Unique identifier of the event (uuid)")
|
|
13
|
+
trace_id: UUID | None = Field(default=None, description="Trace identifier for distributed tracing (uuid)")
|
|
14
|
+
event_time: datetime = Field(..., description="When the token was issued")
|
|
15
|
+
event_name: str = Field(default="token.issued", description="The name of the event")
|
|
16
|
+
producer: str = Field(..., description="Service that produced the event")
|
|
17
|
+
data: dict[str, Any] = Field(..., description="Event payload data")
|
|
18
|
+
|
|
19
|
+
def __str__(self) -> str:
|
|
20
|
+
return f"{self.event_name} ({self.event_id})"
|
|
21
|
+
|
|
22
|
+
def __repr__(self):
|
|
23
|
+
return f"<{self.__class__.__name__} {self.event_name} {self.event_id}>"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from uuid import UUID
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
+
|
|
5
|
+
from .base import BaseEvent
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"IssuedTokenData",
|
|
9
|
+
"RevokedTokenData",
|
|
10
|
+
"TokenIssuedEvent",
|
|
11
|
+
"TokenRevokedEvent",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class IssuedTokenData(BaseModel):
|
|
16
|
+
token: str = Field(..., description="The issued token string.")
|
|
17
|
+
|
|
18
|
+
token_type: str = Field(
|
|
19
|
+
..., alias="tokenType", description="The type of the token issued (access_token, id_token)."
|
|
20
|
+
)
|
|
21
|
+
email: str = Field(..., description="The email of the user for whom the token was issued.")
|
|
22
|
+
user_id: UUID = Field(..., alias="userId", description="The unique identifier of the user.")
|
|
23
|
+
client_id: str = Field(
|
|
24
|
+
..., alias="clientId", description="The client identifier of the application that requested the token."
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class RevokedTokenData(BaseModel):
|
|
31
|
+
token: str = Field(..., description="The revoked token string.")
|
|
32
|
+
token_type: str = Field(
|
|
33
|
+
..., alias="tokenType", description="The type of the token revoked (access_token, id_token)."
|
|
34
|
+
)
|
|
35
|
+
email: str = Field(..., description="The email of the user for whom the token was revoked.")
|
|
36
|
+
user_id: UUID = Field(..., alias="userId", description="The unique identifier of the user.")
|
|
37
|
+
client_id: str = Field(
|
|
38
|
+
..., alias="clientId", description="The client identifier of the application that requested the token."
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class TokenIssuedEvent(BaseEvent):
|
|
45
|
+
data: IssuedTokenData
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class TokenRevokedEvent(BaseEvent):
|
|
49
|
+
data: RevokedTokenData
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from enum import StrEnum
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
+
|
|
7
|
+
from .base import BaseEvent
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"User",
|
|
11
|
+
"AuthenticationMethod",
|
|
12
|
+
"Authentication",
|
|
13
|
+
"Client",
|
|
14
|
+
"AuthenticationPayload",
|
|
15
|
+
"UserAuthenticationSucceededEvent",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class User(BaseModel):
|
|
20
|
+
id: UUID = Field(..., description="User's unique identifier (uuid)")
|
|
21
|
+
email: str = Field(..., description="User's email")
|
|
22
|
+
first_name: str = Field(..., alias="firstName", description="User's first name")
|
|
23
|
+
last_name: str = Field(..., alias="lastName", description="User's last name")
|
|
24
|
+
language: str | None = Field(default=None, description="User's language")
|
|
25
|
+
timezone: str | None = Field(default=None, description="User's timezone")
|
|
26
|
+
date_joined: datetime | None = Field(default=None, alias="dateJoined", description="User's joined date.")
|
|
27
|
+
|
|
28
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class AuthenticationMethod(StrEnum):
|
|
32
|
+
PASSWORD = "PASSWORD"
|
|
33
|
+
OIDC = "OIDC"
|
|
34
|
+
REMEMBER_TOKEN = "REMEMBER_TOKEN"
|
|
35
|
+
API_KEY = "API_KEY"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Authentication(BaseModel):
|
|
39
|
+
method: AuthenticationMethod
|
|
40
|
+
provider: str | None = Field(
|
|
41
|
+
default=None, description="OIDC provider that authenticated the user. e.g. google, github"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class Client(BaseModel):
|
|
46
|
+
ip: str | None = Field(default=None, description="IP address of the client")
|
|
47
|
+
user_agent: str | None = Field(default=None, description="User agent of the client")
|
|
48
|
+
device: str | None = Field(default=None, description="Device identifier of the client")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AuthenticationPayload(BaseModel):
|
|
52
|
+
user: User
|
|
53
|
+
authentication: Authentication
|
|
54
|
+
client: Client
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class UserAuthenticationSucceededEvent(BaseEvent):
|
|
58
|
+
data: AuthenticationPayload
|