langchain-trigger-server 0.2.6rc8__py3-none-any.whl → 0.2.8__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 langchain-trigger-server might be problematic. Click here for more details.
- {langchain_trigger_server-0.2.6rc8.dist-info → langchain_trigger_server-0.2.8.dist-info}/METADATA +4 -5
- langchain_trigger_server-0.2.8.dist-info/RECORD +15 -0
- langchain_triggers/__init__.py +8 -3
- langchain_triggers/app.py +351 -253
- langchain_triggers/auth/__init__.py +3 -4
- langchain_triggers/auth/slack_hmac.py +21 -26
- langchain_triggers/core.py +58 -27
- langchain_triggers/cron_manager.py +79 -56
- langchain_triggers/database/__init__.py +2 -2
- langchain_triggers/database/interface.py +55 -68
- langchain_triggers/database/supabase.py +217 -159
- langchain_triggers/decorators.py +52 -25
- langchain_triggers/triggers/__init__.py +1 -1
- langchain_triggers/triggers/cron_trigger.py +11 -11
- langchain_trigger_server-0.2.6rc8.dist-info/RECORD +0 -15
- {langchain_trigger_server-0.2.6rc8.dist-info → langchain_trigger_server-0.2.8.dist-info}/WHEEL +0 -0
|
@@ -1,152 +1,139 @@
|
|
|
1
1
|
"""Database interface for trigger operations."""
|
|
2
2
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class TriggerDatabaseInterface(ABC):
|
|
8
8
|
"""Abstract interface for trigger database operations."""
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# ========== Trigger Templates ==========
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
@abstractmethod
|
|
13
13
|
async def create_trigger_template(
|
|
14
|
-
self,
|
|
15
|
-
id: str,
|
|
14
|
+
self,
|
|
15
|
+
id: str,
|
|
16
16
|
provider: str,
|
|
17
|
-
name: str,
|
|
17
|
+
name: str,
|
|
18
18
|
description: str = None,
|
|
19
|
-
registration_schema:
|
|
20
|
-
) ->
|
|
19
|
+
registration_schema: dict = None,
|
|
20
|
+
) -> dict[str, Any] | None:
|
|
21
21
|
"""Create a new trigger template."""
|
|
22
22
|
pass
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
@abstractmethod
|
|
25
|
-
async def get_trigger_templates(self) ->
|
|
25
|
+
async def get_trigger_templates(self) -> list[dict[str, Any]]:
|
|
26
26
|
"""Get all available trigger templates."""
|
|
27
27
|
pass
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
@abstractmethod
|
|
30
|
-
async def get_trigger_template(self, id: str) ->
|
|
30
|
+
async def get_trigger_template(self, id: str) -> dict[str, Any] | None:
|
|
31
31
|
"""Get a specific trigger template by ID."""
|
|
32
32
|
pass
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
# ========== Trigger Registrations ==========
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
@abstractmethod
|
|
37
37
|
async def create_trigger_registration(
|
|
38
|
-
self,
|
|
39
|
-
|
|
40
|
-
template_id: str,
|
|
41
|
-
resource: Dict,
|
|
42
|
-
metadata: Dict = None
|
|
43
|
-
) -> Optional[Dict[str, Any]]:
|
|
38
|
+
self, user_id: str, template_id: str, resource: dict, metadata: dict = None
|
|
39
|
+
) -> dict[str, Any] | None:
|
|
44
40
|
"""Create a new trigger registration for a user."""
|
|
45
41
|
pass
|
|
46
|
-
|
|
42
|
+
|
|
47
43
|
@abstractmethod
|
|
48
|
-
async def get_user_trigger_registrations(
|
|
44
|
+
async def get_user_trigger_registrations(
|
|
45
|
+
self, user_id: str
|
|
46
|
+
) -> list[dict[str, Any]]:
|
|
49
47
|
"""Get all trigger registrations for a user."""
|
|
50
48
|
pass
|
|
51
|
-
|
|
49
|
+
|
|
52
50
|
@abstractmethod
|
|
53
|
-
async def get_user_trigger_registrations_with_agents(
|
|
51
|
+
async def get_user_trigger_registrations_with_agents(
|
|
52
|
+
self, user_id: str
|
|
53
|
+
) -> list[dict[str, Any]]:
|
|
54
54
|
"""Get all trigger registrations for a user with linked agents in a single query."""
|
|
55
55
|
pass
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
@abstractmethod
|
|
58
58
|
async def get_trigger_registration(
|
|
59
|
-
self,
|
|
60
|
-
|
|
61
|
-
user_id: str = None
|
|
62
|
-
) -> Optional[Dict[str, Any]]:
|
|
59
|
+
self, registration_id: str, user_id: str = None
|
|
60
|
+
) -> dict[str, Any] | None:
|
|
63
61
|
"""Get a specific trigger registration."""
|
|
64
62
|
pass
|
|
65
|
-
|
|
63
|
+
|
|
66
64
|
@abstractmethod
|
|
67
65
|
async def find_registration_by_resource(
|
|
68
|
-
self,
|
|
69
|
-
|
|
70
|
-
resource_data: Dict[str, Any]
|
|
71
|
-
) -> Optional[Dict[str, Any]]:
|
|
66
|
+
self, template_id: str, resource_data: dict[str, Any]
|
|
67
|
+
) -> dict[str, Any] | None:
|
|
72
68
|
"""Find trigger registration by matching resource data."""
|
|
73
69
|
pass
|
|
74
|
-
|
|
70
|
+
|
|
75
71
|
@abstractmethod
|
|
76
72
|
async def find_user_registration_by_resource(
|
|
77
|
-
self,
|
|
78
|
-
|
|
79
|
-
template_id: str,
|
|
80
|
-
resource_data: Dict[str, Any]
|
|
81
|
-
) -> Optional[Dict[str, Any]]:
|
|
73
|
+
self, user_id: str, template_id: str, resource_data: dict[str, Any]
|
|
74
|
+
) -> dict[str, Any] | None:
|
|
82
75
|
"""Find trigger registration by matching resource data for a specific user."""
|
|
83
76
|
pass
|
|
84
|
-
|
|
77
|
+
|
|
85
78
|
@abstractmethod
|
|
86
|
-
async def get_all_registrations(self, template_id: str) ->
|
|
79
|
+
async def get_all_registrations(self, template_id: str) -> list[dict[str, Any]]:
|
|
87
80
|
"""Get all registrations for a specific trigger template."""
|
|
88
81
|
pass
|
|
89
|
-
|
|
82
|
+
|
|
90
83
|
@abstractmethod
|
|
91
84
|
async def update_trigger_metadata(
|
|
92
|
-
self,
|
|
93
|
-
registration_id: str,
|
|
94
|
-
metadata_updates: Dict,
|
|
95
|
-
user_id: str = None
|
|
85
|
+
self, registration_id: str, metadata_updates: dict, user_id: str = None
|
|
96
86
|
) -> bool:
|
|
97
87
|
"""Update metadata for a trigger registration."""
|
|
98
88
|
pass
|
|
99
|
-
|
|
89
|
+
|
|
100
90
|
@abstractmethod
|
|
101
91
|
async def delete_trigger_registration(
|
|
102
|
-
self,
|
|
103
|
-
registration_id: str,
|
|
104
|
-
user_id: str = None
|
|
92
|
+
self, registration_id: str, user_id: str = None
|
|
105
93
|
) -> bool:
|
|
106
94
|
"""Delete a trigger registration."""
|
|
107
95
|
pass
|
|
108
|
-
|
|
96
|
+
|
|
109
97
|
# ========== Agent-Trigger Links ==========
|
|
110
|
-
|
|
98
|
+
|
|
111
99
|
@abstractmethod
|
|
112
100
|
async def link_agent_to_trigger(
|
|
113
101
|
self,
|
|
114
102
|
agent_id: str,
|
|
115
|
-
registration_id: str,
|
|
103
|
+
registration_id: str,
|
|
116
104
|
created_by: str,
|
|
117
|
-
field_selection:
|
|
105
|
+
field_selection: dict[str, bool] | None = None,
|
|
118
106
|
) -> bool:
|
|
119
107
|
"""Link an agent to a trigger registration with optional field selection."""
|
|
120
108
|
pass
|
|
121
|
-
|
|
109
|
+
|
|
122
110
|
@abstractmethod
|
|
123
111
|
async def unlink_agent_from_trigger(
|
|
124
|
-
self,
|
|
125
|
-
agent_id: str,
|
|
126
|
-
registration_id: str
|
|
112
|
+
self, agent_id: str, registration_id: str
|
|
127
113
|
) -> bool:
|
|
128
114
|
"""Unlink an agent from a trigger registration."""
|
|
129
115
|
pass
|
|
130
|
-
|
|
116
|
+
|
|
131
117
|
@abstractmethod
|
|
132
|
-
async def get_agents_for_trigger(
|
|
118
|
+
async def get_agents_for_trigger(
|
|
119
|
+
self, registration_id: str
|
|
120
|
+
) -> list[dict[str, Any]]:
|
|
133
121
|
"""Get all agent links for a trigger registration with field_selection."""
|
|
134
122
|
pass
|
|
135
|
-
|
|
123
|
+
|
|
136
124
|
@abstractmethod
|
|
137
|
-
async def get_triggers_for_agent(self, agent_id: str) ->
|
|
125
|
+
async def get_triggers_for_agent(self, agent_id: str) -> list[dict[str, Any]]:
|
|
138
126
|
"""Get all trigger registrations linked to an agent."""
|
|
139
127
|
pass
|
|
140
128
|
|
|
141
129
|
# ========== Helper Methods ==========
|
|
142
|
-
|
|
130
|
+
|
|
143
131
|
@abstractmethod
|
|
144
|
-
async def get_user_from_token(self, token: str) ->
|
|
132
|
+
async def get_user_from_token(self, token: str) -> str | None:
|
|
145
133
|
"""Extract user ID from authentication token."""
|
|
146
134
|
pass
|
|
147
|
-
|
|
135
|
+
|
|
148
136
|
@abstractmethod
|
|
149
|
-
async def get_user_by_email(self, email: str) ->
|
|
137
|
+
async def get_user_by_email(self, email: str) -> str | None:
|
|
150
138
|
"""Get user ID by email from trigger registrations."""
|
|
151
139
|
pass
|
|
152
|
-
|