apexdevkit 1.17.17__tar.gz → 1.18.1__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.
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/PKG-INFO +1 -1
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/router.py +49 -34
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/pyproject.toml +1 -1
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/LICENSE +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/README.md +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/error.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/request.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/mongo.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/mssql.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/sql.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/server.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.17.17 → apexdevkit-1.18.1}/apexdevkit/value.py +0 -0
|
@@ -39,6 +39,8 @@ class RestfulRouter:
|
|
|
39
39
|
name: RestfulName = field(init=False)
|
|
40
40
|
fields: SchemaFields = field(init=False)
|
|
41
41
|
|
|
42
|
+
dependency: Dependency | None = None
|
|
43
|
+
|
|
42
44
|
@cached_property
|
|
43
45
|
def schema(self) -> RestfulSchema:
|
|
44
46
|
return RestfulSchema(name=self.name, fields=self.fields)
|
|
@@ -70,15 +72,20 @@ class RestfulRouter:
|
|
|
70
72
|
|
|
71
73
|
return self
|
|
72
74
|
|
|
75
|
+
def with_dependency(self, value: Dependency) -> Self:
|
|
76
|
+
self.dependency = value
|
|
77
|
+
|
|
78
|
+
return self
|
|
79
|
+
|
|
73
80
|
def with_create_one_endpoint(
|
|
74
81
|
self,
|
|
75
|
-
dependency: Dependency,
|
|
82
|
+
dependency: Dependency | None = None,
|
|
76
83
|
is_documented: bool = True,
|
|
77
84
|
) -> Self:
|
|
78
85
|
self.router.add_api_route(
|
|
79
86
|
"",
|
|
80
87
|
self.resource.create_one(
|
|
81
|
-
Service=
|
|
88
|
+
Service=self._resolve(dependency),
|
|
82
89
|
Item=Annotated[
|
|
83
90
|
RawItem,
|
|
84
91
|
Depends(self.schema.for_create_one()),
|
|
@@ -96,13 +103,13 @@ class RestfulRouter:
|
|
|
96
103
|
|
|
97
104
|
def with_create_many_endpoint(
|
|
98
105
|
self,
|
|
99
|
-
dependency: Dependency,
|
|
106
|
+
dependency: Dependency | None = None,
|
|
100
107
|
is_documented: bool = True,
|
|
101
108
|
) -> Self:
|
|
102
109
|
self.router.add_api_route(
|
|
103
110
|
"/batch",
|
|
104
111
|
self.resource.create_many(
|
|
105
|
-
Service=
|
|
112
|
+
Service=self._resolve(dependency),
|
|
106
113
|
Collection=Annotated[
|
|
107
114
|
RawCollection,
|
|
108
115
|
Depends(self.schema.for_create_many()),
|
|
@@ -120,13 +127,13 @@ class RestfulRouter:
|
|
|
120
127
|
|
|
121
128
|
def with_read_one_endpoint(
|
|
122
129
|
self,
|
|
123
|
-
dependency: Dependency,
|
|
130
|
+
dependency: Dependency | None = None,
|
|
124
131
|
is_documented: bool = True,
|
|
125
132
|
) -> Self:
|
|
126
133
|
self.router.add_api_route(
|
|
127
134
|
self.item_path,
|
|
128
135
|
self.resource.read_one(
|
|
129
|
-
Service=
|
|
136
|
+
Service=self._resolve(dependency),
|
|
130
137
|
ItemId=Annotated[
|
|
131
138
|
str,
|
|
132
139
|
Path(alias=self.id_alias),
|
|
@@ -144,14 +151,14 @@ class RestfulRouter:
|
|
|
144
151
|
|
|
145
152
|
def with_read_many_endpoint(
|
|
146
153
|
self,
|
|
147
|
-
dependency: Dependency,
|
|
148
154
|
query: FluentDict[Any],
|
|
155
|
+
dependency: Dependency | None = None,
|
|
149
156
|
is_documented: bool = True,
|
|
150
157
|
) -> Self:
|
|
151
158
|
self.router.add_api_route(
|
|
152
159
|
"",
|
|
153
160
|
self.resource.read_many(
|
|
154
|
-
Service=
|
|
161
|
+
Service=self._resolve(dependency),
|
|
155
162
|
QueryParams=Annotated[
|
|
156
163
|
Schema(self.name).optional_schema_for("ReadMany", query), Query()
|
|
157
164
|
],
|
|
@@ -167,11 +174,13 @@ class RestfulRouter:
|
|
|
167
174
|
return self
|
|
168
175
|
|
|
169
176
|
def with_filter_endpoint(
|
|
170
|
-
self,
|
|
177
|
+
self,
|
|
178
|
+
dependency: Dependency | None = None,
|
|
179
|
+
is_documented: bool = True,
|
|
171
180
|
) -> Self:
|
|
172
181
|
self.router.add_api_route(
|
|
173
182
|
"/filter",
|
|
174
|
-
self.resource.filter_with(Service=
|
|
183
|
+
self.resource.filter_with(Service=self._resolve(dependency)),
|
|
175
184
|
methods=["POST"],
|
|
176
185
|
status_code=200,
|
|
177
186
|
responses={},
|
|
@@ -184,14 +193,12 @@ class RestfulRouter:
|
|
|
184
193
|
|
|
185
194
|
def with_read_all_endpoint(
|
|
186
195
|
self,
|
|
187
|
-
dependency: Dependency,
|
|
196
|
+
dependency: Dependency | None = None,
|
|
188
197
|
is_documented: bool = True,
|
|
189
198
|
) -> Self:
|
|
190
199
|
self.router.add_api_route(
|
|
191
200
|
"",
|
|
192
|
-
self.resource.read_all(
|
|
193
|
-
Service=dependency.as_dependable(),
|
|
194
|
-
),
|
|
201
|
+
self.resource.read_all(Service=self._resolve(dependency)),
|
|
195
202
|
methods=["GET"],
|
|
196
203
|
status_code=200,
|
|
197
204
|
responses={},
|
|
@@ -203,11 +210,13 @@ class RestfulRouter:
|
|
|
203
210
|
return self
|
|
204
211
|
|
|
205
212
|
def with_aggregate_endpoint(
|
|
206
|
-
self,
|
|
213
|
+
self,
|
|
214
|
+
dependency: Dependency | None = None,
|
|
215
|
+
is_documented: bool = True,
|
|
207
216
|
) -> Self:
|
|
208
217
|
self.router.add_api_route(
|
|
209
218
|
"/aggregate",
|
|
210
|
-
self.resource.aggregate_with(Service=
|
|
219
|
+
self.resource.aggregate_with(Service=self._resolve(dependency)),
|
|
211
220
|
methods=["POST"],
|
|
212
221
|
status_code=200,
|
|
213
222
|
responses={},
|
|
@@ -220,13 +229,13 @@ class RestfulRouter:
|
|
|
220
229
|
|
|
221
230
|
def with_update_one_endpoint(
|
|
222
231
|
self,
|
|
223
|
-
dependency: Dependency,
|
|
232
|
+
dependency: Dependency | None = None,
|
|
224
233
|
is_documented: bool = True,
|
|
225
234
|
) -> Self:
|
|
226
235
|
self.router.add_api_route(
|
|
227
236
|
self.item_path,
|
|
228
237
|
self.resource.update_one(
|
|
229
|
-
Service=
|
|
238
|
+
Service=self._resolve(dependency),
|
|
230
239
|
ItemId=Annotated[
|
|
231
240
|
str,
|
|
232
241
|
Path(alias=self.id_alias),
|
|
@@ -248,13 +257,13 @@ class RestfulRouter:
|
|
|
248
257
|
|
|
249
258
|
def with_update_many_endpoint(
|
|
250
259
|
self,
|
|
251
|
-
dependency: Dependency,
|
|
260
|
+
dependency: Dependency | None = None,
|
|
252
261
|
is_documented: bool = True,
|
|
253
262
|
) -> Self:
|
|
254
263
|
self.router.add_api_route(
|
|
255
264
|
"",
|
|
256
265
|
self.resource.update_many(
|
|
257
|
-
Service=
|
|
266
|
+
Service=self._resolve(dependency),
|
|
258
267
|
Collection=Annotated[
|
|
259
268
|
RawCollection,
|
|
260
269
|
Depends(self.schema.for_update_many()),
|
|
@@ -272,13 +281,13 @@ class RestfulRouter:
|
|
|
272
281
|
|
|
273
282
|
def with_replace_one_endpoint(
|
|
274
283
|
self,
|
|
275
|
-
dependency: Dependency,
|
|
284
|
+
dependency: Dependency | None = None,
|
|
276
285
|
is_documented: bool = True,
|
|
277
286
|
) -> Self:
|
|
278
287
|
self.router.add_api_route(
|
|
279
288
|
"",
|
|
280
289
|
self.resource.replace_one(
|
|
281
|
-
Service=
|
|
290
|
+
Service=self._resolve(dependency),
|
|
282
291
|
Item=Annotated[
|
|
283
292
|
RawItem,
|
|
284
293
|
Depends(self.schema.for_replace_one()),
|
|
@@ -296,13 +305,13 @@ class RestfulRouter:
|
|
|
296
305
|
|
|
297
306
|
def with_replace_many_endpoint(
|
|
298
307
|
self,
|
|
299
|
-
dependency: Dependency,
|
|
308
|
+
dependency: Dependency | None = None,
|
|
300
309
|
is_documented: bool = True,
|
|
301
310
|
) -> Self:
|
|
302
311
|
self.router.add_api_route(
|
|
303
312
|
"/batch",
|
|
304
313
|
self.resource.replace_many(
|
|
305
|
-
Service=
|
|
314
|
+
Service=self._resolve(dependency),
|
|
306
315
|
Collection=Annotated[
|
|
307
316
|
RawCollection,
|
|
308
317
|
Depends(self.schema.for_replace_many()),
|
|
@@ -320,13 +329,13 @@ class RestfulRouter:
|
|
|
320
329
|
|
|
321
330
|
def with_delete_one_endpoint(
|
|
322
331
|
self,
|
|
323
|
-
dependency: Dependency,
|
|
332
|
+
dependency: Dependency | None = None,
|
|
324
333
|
is_documented: bool = True,
|
|
325
334
|
) -> Self:
|
|
326
335
|
self.router.add_api_route(
|
|
327
336
|
self.item_path,
|
|
328
337
|
self.resource.delete_one(
|
|
329
|
-
Service=
|
|
338
|
+
Service=self._resolve(dependency),
|
|
330
339
|
ItemId=Annotated[
|
|
331
340
|
str,
|
|
332
341
|
Path(alias=self.id_alias),
|
|
@@ -348,16 +357,22 @@ class RestfulRouter:
|
|
|
348
357
|
|
|
349
358
|
return self
|
|
350
359
|
|
|
351
|
-
def default(self
|
|
360
|
+
def default(self) -> Self:
|
|
352
361
|
return (
|
|
353
|
-
self.with_create_one_endpoint(
|
|
354
|
-
.with_create_many_endpoint(
|
|
355
|
-
.with_read_one_endpoint(
|
|
356
|
-
.with_read_all_endpoint(
|
|
357
|
-
.with_update_one_endpoint(
|
|
358
|
-
.with_update_many_endpoint(
|
|
359
|
-
.with_delete_one_endpoint(
|
|
362
|
+
self.with_create_one_endpoint()
|
|
363
|
+
.with_create_many_endpoint()
|
|
364
|
+
.with_read_one_endpoint()
|
|
365
|
+
.with_read_all_endpoint()
|
|
366
|
+
.with_update_one_endpoint()
|
|
367
|
+
.with_update_many_endpoint()
|
|
368
|
+
.with_delete_one_endpoint()
|
|
360
369
|
)
|
|
361
370
|
|
|
362
371
|
def build(self) -> APIRouter:
|
|
363
372
|
return self.router
|
|
373
|
+
|
|
374
|
+
def _resolve(self, dependency: Dependency | None) -> type[RestfulService]:
|
|
375
|
+
resolved = dependency or self.dependency
|
|
376
|
+
assert resolved, "One of default or endpoint dependency must be specified"
|
|
377
|
+
|
|
378
|
+
return resolved.as_dependable()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|