varco-fastapi 0.1.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.
- varco_fastapi/__init__.py +315 -0
- varco_fastapi/app.py +632 -0
- varco_fastapi/auth/__init__.py +64 -0
- varco_fastapi/auth/client_auth.py +340 -0
- varco_fastapi/auth/server_auth.py +613 -0
- varco_fastapi/auth/trust_store.py +209 -0
- varco_fastapi/client/__init__.py +69 -0
- varco_fastapi/client/base.py +924 -0
- varco_fastapi/client/configurator.py +374 -0
- varco_fastapi/client/handle.py +313 -0
- varco_fastapi/client/middleware.py +646 -0
- varco_fastapi/client/protocol.py +150 -0
- varco_fastapi/client/sync.py +314 -0
- varco_fastapi/context.py +476 -0
- varco_fastapi/di.py +523 -0
- varco_fastapi/exceptions.py +149 -0
- varco_fastapi/job/__init__.py +36 -0
- varco_fastapi/job/poller.py +239 -0
- varco_fastapi/job/response.py +191 -0
- varco_fastapi/job/runner.py +879 -0
- varco_fastapi/job/store.py +196 -0
- varco_fastapi/lifespan.py +192 -0
- varco_fastapi/middleware/__init__.py +50 -0
- varco_fastapi/middleware/cors.py +212 -0
- varco_fastapi/middleware/error.py +180 -0
- varco_fastapi/middleware/logging.py +138 -0
- varco_fastapi/middleware/request_context.py +173 -0
- varco_fastapi/middleware/session.py +150 -0
- varco_fastapi/middleware/tracing.py +184 -0
- varco_fastapi/py.typed +0 -0
- varco_fastapi/router/__init__.py +0 -0
- varco_fastapi/router/base.py +1245 -0
- varco_fastapi/router/crud.py +483 -0
- varco_fastapi/router/endpoint.py +439 -0
- varco_fastapi/router/health.py +273 -0
- varco_fastapi/router/introspection.py +413 -0
- varco_fastapi/router/mcp.py +685 -0
- varco_fastapi/router/mixins.py +473 -0
- varco_fastapi/router/pagination.py +134 -0
- varco_fastapi/router/presets.py +234 -0
- varco_fastapi/router/skill.py +747 -0
- varco_fastapi/validation.py +326 -0
- varco_fastapi-0.1.0.dist-info/METADATA +35 -0
- varco_fastapi-0.1.0.dist-info/RECORD +45 -0
- varco_fastapi-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"""
|
|
2
|
+
varco_fastapi — FastAPI adapter for the varco framework.
|
|
3
|
+
|
|
4
|
+
Public surface::
|
|
5
|
+
|
|
6
|
+
# Router layer
|
|
7
|
+
from varco_fastapi import (
|
|
8
|
+
VarcoRouter,
|
|
9
|
+
RouterMixin,
|
|
10
|
+
AllRouteMixin,
|
|
11
|
+
CRUDRouter,
|
|
12
|
+
ReadOnlyRouter,
|
|
13
|
+
WriteRouter,
|
|
14
|
+
NoDeleteRouter,
|
|
15
|
+
CreateMixin, ReadMixin, UpdateMixin, PatchMixin, DeleteMixin, ListMixin,
|
|
16
|
+
HttpQueryParams,
|
|
17
|
+
AsyncModeParams,
|
|
18
|
+
HealthRouter,
|
|
19
|
+
route, ws_route, sse_route,
|
|
20
|
+
introspect_routes,
|
|
21
|
+
ResolvedRoute,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Auth layer
|
|
25
|
+
from varco_fastapi import (
|
|
26
|
+
AbstractServerAuth,
|
|
27
|
+
JwtBearerAuth,
|
|
28
|
+
ApiKeyAuth,
|
|
29
|
+
PassthroughAuth,
|
|
30
|
+
AnonymousAuth,
|
|
31
|
+
WebSocketAuth,
|
|
32
|
+
AbstractClientAuth,
|
|
33
|
+
JwtClientAuth,
|
|
34
|
+
TrustStore,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# Middleware
|
|
38
|
+
from varco_fastapi import (
|
|
39
|
+
ErrorMiddleware,
|
|
40
|
+
RequestContextMiddleware,
|
|
41
|
+
RequestLoggingMiddleware,
|
|
42
|
+
TracingMiddleware,
|
|
43
|
+
CORSConfig,
|
|
44
|
+
install_cors,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Job layer
|
|
48
|
+
from varco_fastapi import (
|
|
49
|
+
InMemoryJobStore,
|
|
50
|
+
JobRunner,
|
|
51
|
+
JobPoller,
|
|
52
|
+
JobAcceptedResponse,
|
|
53
|
+
JobStatusResponse,
|
|
54
|
+
JobProgressEvent,
|
|
55
|
+
job_progress,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Client layer
|
|
59
|
+
from varco_fastapi import (
|
|
60
|
+
AsyncVarcoClient,
|
|
61
|
+
VarcoClient,
|
|
62
|
+
ClientProfile,
|
|
63
|
+
ClientConfigurator,
|
|
64
|
+
ClientProtocol,
|
|
65
|
+
SyncVarcoClient,
|
|
66
|
+
JobHandle,
|
|
67
|
+
JobFailedError,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# DI
|
|
71
|
+
from varco_fastapi import VarcoFastAPIModule, bind_clients
|
|
72
|
+
|
|
73
|
+
# Context
|
|
74
|
+
from varco_fastapi import (
|
|
75
|
+
auth_context_var,
|
|
76
|
+
request_token_var,
|
|
77
|
+
get_auth_context,
|
|
78
|
+
get_auth_context_or_none,
|
|
79
|
+
)
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
from __future__ import annotations
|
|
83
|
+
|
|
84
|
+
# ── Context ───────────────────────────────────────────────────────────────────
|
|
85
|
+
from varco_fastapi.context import (
|
|
86
|
+
JwtContext,
|
|
87
|
+
RequestContext,
|
|
88
|
+
auth_context_var,
|
|
89
|
+
get_auth_context,
|
|
90
|
+
get_auth_context_or_none,
|
|
91
|
+
get_jwt_context,
|
|
92
|
+
get_request_context,
|
|
93
|
+
get_request_id,
|
|
94
|
+
get_request_token,
|
|
95
|
+
request_id_var,
|
|
96
|
+
request_token_var,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# ── Auth — server side ────────────────────────────────────────────────────────
|
|
100
|
+
from varco_fastapi.auth.server_auth import (
|
|
101
|
+
AbstractServerAuth,
|
|
102
|
+
AnonymousAuth,
|
|
103
|
+
ApiKeyAuth,
|
|
104
|
+
JwtBearerAuth,
|
|
105
|
+
PassthroughAuth,
|
|
106
|
+
WebSocketAuth,
|
|
107
|
+
)
|
|
108
|
+
from varco_fastapi.auth.client_auth import (
|
|
109
|
+
AbstractClientAuth,
|
|
110
|
+
JwtClientAuth,
|
|
111
|
+
)
|
|
112
|
+
from varco_fastapi.auth.trust_store import TrustStore
|
|
113
|
+
|
|
114
|
+
# ── Middleware ────────────────────────────────────────────────────────────────
|
|
115
|
+
from varco_fastapi.middleware.error import ErrorMiddleware
|
|
116
|
+
from varco_fastapi.middleware.request_context import RequestContextMiddleware
|
|
117
|
+
from varco_fastapi.middleware.logging import RequestLoggingMiddleware
|
|
118
|
+
from varco_fastapi.middleware.tracing import TracingMiddleware
|
|
119
|
+
from varco_fastapi.middleware.cors import CORSConfig, install_cors
|
|
120
|
+
|
|
121
|
+
# ── Router layer ──────────────────────────────────────────────────────────────
|
|
122
|
+
from varco_fastapi.router.base import (
|
|
123
|
+
AsyncModeParams,
|
|
124
|
+
HttpQueryParams,
|
|
125
|
+
RouterMixin,
|
|
126
|
+
VarcoRouter,
|
|
127
|
+
)
|
|
128
|
+
from varco_fastapi.router.crud import VarcoCRUDRouter
|
|
129
|
+
from varco_fastapi.router.mixins import (
|
|
130
|
+
CreateMixin,
|
|
131
|
+
DeleteMixin,
|
|
132
|
+
ListMixin,
|
|
133
|
+
PatchMixin,
|
|
134
|
+
ReadMixin,
|
|
135
|
+
UpdateMixin,
|
|
136
|
+
)
|
|
137
|
+
from varco_fastapi.router.presets import (
|
|
138
|
+
AllRouteMixin,
|
|
139
|
+
CRUDRouter,
|
|
140
|
+
NoDeleteRouter,
|
|
141
|
+
ReadOnlyRouter,
|
|
142
|
+
WriteRouter,
|
|
143
|
+
)
|
|
144
|
+
from varco_fastapi.router.endpoint import route, ws_route, sse_route
|
|
145
|
+
from varco_fastapi.router.health import HealthRouter
|
|
146
|
+
from varco_fastapi.router.introspection import ResolvedRoute, introspect_routes
|
|
147
|
+
from varco_fastapi.router.pagination import (
|
|
148
|
+
PagedReadDTO,
|
|
149
|
+
add_pagination_headers,
|
|
150
|
+
paged_response,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# ── Job layer ─────────────────────────────────────────────────────────────────
|
|
154
|
+
from varco_fastapi.job import (
|
|
155
|
+
InMemoryJobStore,
|
|
156
|
+
JobAcceptedResponse,
|
|
157
|
+
JobPoller,
|
|
158
|
+
JobProgressEvent,
|
|
159
|
+
JobRunner,
|
|
160
|
+
JobStatusResponse,
|
|
161
|
+
job_progress,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
# ── Client layer ──────────────────────────────────────────────────────────────
|
|
165
|
+
from varco_fastapi.client import (
|
|
166
|
+
AbstractClientMiddleware,
|
|
167
|
+
AsyncVarcoClient,
|
|
168
|
+
AuthForwardMiddleware,
|
|
169
|
+
ClientConfigurator,
|
|
170
|
+
ClientProfile,
|
|
171
|
+
ClientProtocol,
|
|
172
|
+
CorrelationIdMiddleware,
|
|
173
|
+
HeadersMiddleware,
|
|
174
|
+
JobFailedError,
|
|
175
|
+
JobHandle,
|
|
176
|
+
JwtMiddleware,
|
|
177
|
+
LoggingMiddleware,
|
|
178
|
+
OTelClientMiddleware,
|
|
179
|
+
PreparedRequest,
|
|
180
|
+
RetryMiddleware,
|
|
181
|
+
SyncVarcoClient,
|
|
182
|
+
TimeoutMiddleware,
|
|
183
|
+
VarcoClient,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
|
187
|
+
from varco_fastapi.lifespan import VarcoLifespan
|
|
188
|
+
|
|
189
|
+
# ── Exceptions ────────────────────────────────────────────────────────────────
|
|
190
|
+
from varco_fastapi.exceptions import add_exception_handlers
|
|
191
|
+
|
|
192
|
+
# ── DI ────────────────────────────────────────────────────────────────────────
|
|
193
|
+
from varco_fastapi.di import VarcoFastAPIModule, bind_clients
|
|
194
|
+
|
|
195
|
+
# ── App factory ───────────────────────────────────────────────────────────────
|
|
196
|
+
from varco_fastapi.app import create_varco_app
|
|
197
|
+
|
|
198
|
+
# ── Validation ────────────────────────────────────────────────────────────────
|
|
199
|
+
from varco_fastapi.validation import (
|
|
200
|
+
ConfigurationError,
|
|
201
|
+
validate_router_class,
|
|
202
|
+
validate_container_bindings,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
# ── MCP adapter ───────────────────────────────────────────────────────────────
|
|
206
|
+
from varco_fastapi.router.mcp import MCPAdapter, MCPToolDefinition, bind_mcp_adapter
|
|
207
|
+
|
|
208
|
+
# ── Skill / A2A adapter ───────────────────────────────────────────────────────
|
|
209
|
+
from varco_fastapi.router.skill import SkillAdapter, SkillDefinition, bind_skill_adapter
|
|
210
|
+
|
|
211
|
+
__all__ = [
|
|
212
|
+
# Context
|
|
213
|
+
"RequestContext",
|
|
214
|
+
"JwtContext",
|
|
215
|
+
"get_request_context",
|
|
216
|
+
"get_jwt_context",
|
|
217
|
+
"auth_context_var",
|
|
218
|
+
"request_token_var",
|
|
219
|
+
"request_id_var",
|
|
220
|
+
"get_auth_context",
|
|
221
|
+
"get_auth_context_or_none",
|
|
222
|
+
"get_request_token",
|
|
223
|
+
"get_request_id",
|
|
224
|
+
# Auth
|
|
225
|
+
"AbstractServerAuth",
|
|
226
|
+
"JwtBearerAuth",
|
|
227
|
+
"ApiKeyAuth",
|
|
228
|
+
"PassthroughAuth",
|
|
229
|
+
"AnonymousAuth",
|
|
230
|
+
"WebSocketAuth",
|
|
231
|
+
"AbstractClientAuth",
|
|
232
|
+
"JwtClientAuth",
|
|
233
|
+
"TrustStore",
|
|
234
|
+
# Middleware
|
|
235
|
+
"ErrorMiddleware",
|
|
236
|
+
"RequestContextMiddleware",
|
|
237
|
+
"RequestLoggingMiddleware",
|
|
238
|
+
"TracingMiddleware",
|
|
239
|
+
"CORSConfig",
|
|
240
|
+
"install_cors",
|
|
241
|
+
# Router
|
|
242
|
+
"VarcoRouter",
|
|
243
|
+
"VarcoCRUDRouter",
|
|
244
|
+
"RouterMixin",
|
|
245
|
+
"AllRouteMixin",
|
|
246
|
+
"CRUDRouter",
|
|
247
|
+
"ReadOnlyRouter",
|
|
248
|
+
"WriteRouter",
|
|
249
|
+
"NoDeleteRouter",
|
|
250
|
+
"CreateMixin",
|
|
251
|
+
"ReadMixin",
|
|
252
|
+
"UpdateMixin",
|
|
253
|
+
"PatchMixin",
|
|
254
|
+
"DeleteMixin",
|
|
255
|
+
"ListMixin",
|
|
256
|
+
"HttpQueryParams",
|
|
257
|
+
"AsyncModeParams",
|
|
258
|
+
"HealthRouter",
|
|
259
|
+
"route",
|
|
260
|
+
"ws_route",
|
|
261
|
+
"sse_route",
|
|
262
|
+
"ResolvedRoute",
|
|
263
|
+
"introspect_routes",
|
|
264
|
+
"PagedReadDTO",
|
|
265
|
+
"paged_response",
|
|
266
|
+
"add_pagination_headers",
|
|
267
|
+
# Job
|
|
268
|
+
"InMemoryJobStore",
|
|
269
|
+
"JobRunner",
|
|
270
|
+
"JobPoller",
|
|
271
|
+
"JobAcceptedResponse",
|
|
272
|
+
"JobStatusResponse",
|
|
273
|
+
"JobProgressEvent",
|
|
274
|
+
"job_progress",
|
|
275
|
+
# Client
|
|
276
|
+
"AsyncVarcoClient",
|
|
277
|
+
"VarcoClient",
|
|
278
|
+
"ClientProfile",
|
|
279
|
+
"ClientConfigurator",
|
|
280
|
+
"ClientProtocol",
|
|
281
|
+
"SyncVarcoClient",
|
|
282
|
+
"JobHandle",
|
|
283
|
+
"JobFailedError",
|
|
284
|
+
"PreparedRequest",
|
|
285
|
+
"AbstractClientMiddleware",
|
|
286
|
+
"HeadersMiddleware",
|
|
287
|
+
"CorrelationIdMiddleware",
|
|
288
|
+
"AuthForwardMiddleware",
|
|
289
|
+
"JwtMiddleware",
|
|
290
|
+
"RetryMiddleware",
|
|
291
|
+
"LoggingMiddleware",
|
|
292
|
+
"TimeoutMiddleware",
|
|
293
|
+
"OTelClientMiddleware",
|
|
294
|
+
# Lifecycle
|
|
295
|
+
"VarcoLifespan",
|
|
296
|
+
# Exceptions
|
|
297
|
+
"add_exception_handlers",
|
|
298
|
+
# DI
|
|
299
|
+
"VarcoFastAPIModule",
|
|
300
|
+
"bind_clients",
|
|
301
|
+
# App factory
|
|
302
|
+
"create_varco_app",
|
|
303
|
+
# Validation
|
|
304
|
+
"ConfigurationError",
|
|
305
|
+
"validate_router_class",
|
|
306
|
+
"validate_container_bindings",
|
|
307
|
+
# MCP adapter
|
|
308
|
+
"MCPAdapter",
|
|
309
|
+
"MCPToolDefinition",
|
|
310
|
+
"bind_mcp_adapter",
|
|
311
|
+
# Skill / A2A adapter
|
|
312
|
+
"SkillAdapter",
|
|
313
|
+
"SkillDefinition",
|
|
314
|
+
"bind_skill_adapter",
|
|
315
|
+
]
|