apexdevkit 1.20.3__tar.gz → 1.20.4__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.20.3 → apexdevkit-1.20.4}/PKG-INFO +1 -1
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/__init__.py +2 -2
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/builder.py +8 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/dependable.py +2 -29
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/router.py +0 -9
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/service.py +2 -22
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/pyproject.toml +1 -1
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/LICENSE +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/README.md +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/error.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/request.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/id.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/mongo.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/mssql.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/sql.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/server.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.20.3 → apexdevkit-1.20.4}/apexdevkit/value.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from apexdevkit.fastapi.builder import FastApiBuilder, RestfulServiceBuilder
|
|
2
2
|
from apexdevkit.fastapi.dependable import inject
|
|
3
|
-
from apexdevkit.fastapi.service import
|
|
3
|
+
from apexdevkit.fastapi.service import RestfulRepository
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
6
|
"FastApiBuilder",
|
|
7
7
|
"RestfulServiceBuilder",
|
|
8
8
|
"inject",
|
|
9
|
-
"
|
|
9
|
+
"RestfulRepository",
|
|
10
10
|
]
|
|
@@ -76,3 +76,11 @@ class RestfulServiceBuilder(ABC):
|
|
|
76
76
|
@abstractmethod
|
|
77
77
|
def build(self) -> RestfulService: # pragma: no cover
|
|
78
78
|
pass
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@dataclass
|
|
82
|
+
class PreBuilt(RestfulServiceBuilder): # pragma: no cover
|
|
83
|
+
service: RestfulService
|
|
84
|
+
|
|
85
|
+
def build(self) -> RestfulService:
|
|
86
|
+
return self.service
|
|
@@ -4,7 +4,6 @@ from typing import Annotated, Any, Callable, Protocol
|
|
|
4
4
|
from fastapi import Depends, Path
|
|
5
5
|
from fastapi.requests import Request
|
|
6
6
|
|
|
7
|
-
from apexdevkit.annotation import deprecated
|
|
8
7
|
from apexdevkit.error import ApiError, DoesNotExistError
|
|
9
8
|
from apexdevkit.fastapi import RestfulServiceBuilder
|
|
10
9
|
from apexdevkit.fastapi.name import RestfulName
|
|
@@ -72,17 +71,6 @@ class UserDependency:
|
|
|
72
71
|
return Annotated[RestfulServiceBuilder, Depends(_)]
|
|
73
72
|
|
|
74
73
|
|
|
75
|
-
@dataclass(frozen=True)
|
|
76
|
-
class InfraDependency:
|
|
77
|
-
infra: RestfulServiceBuilder
|
|
78
|
-
|
|
79
|
-
def as_dependable(self) -> type[RestfulServiceBuilder]:
|
|
80
|
-
def _() -> RestfulServiceBuilder:
|
|
81
|
-
return self.infra
|
|
82
|
-
|
|
83
|
-
return Annotated[RestfulServiceBuilder, Depends(_)]
|
|
84
|
-
|
|
85
|
-
|
|
86
74
|
_BuilderCallable = Callable[..., RestfulServiceBuilder]
|
|
87
75
|
|
|
88
76
|
|
|
@@ -99,32 +87,17 @@ class BuilderCallableDependency:
|
|
|
99
87
|
|
|
100
88
|
@dataclass(frozen=True)
|
|
101
89
|
class DependableBuilder:
|
|
102
|
-
dependency: _Dependency
|
|
90
|
+
dependency: _Dependency
|
|
103
91
|
|
|
104
92
|
@classmethod
|
|
105
93
|
def from_callable(cls, value: _BuilderCallable) -> "DependableBuilder":
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
@deprecated(
|
|
109
|
-
"""
|
|
110
|
-
DependableBuilder().from_infra() is deprecated,
|
|
111
|
-
use DependencyBuilder.from_callable() instead
|
|
112
|
-
"""
|
|
113
|
-
)
|
|
114
|
-
def from_infra(self, value: RestfulServiceBuilder) -> "DependableBuilder":
|
|
115
|
-
return DependableBuilder(InfraDependency(value))
|
|
94
|
+
return cls(BuilderCallableDependency(value))
|
|
116
95
|
|
|
117
96
|
def with_parent(self, value: RestfulName) -> "DependableBuilder":
|
|
118
|
-
if self.dependency is None:
|
|
119
|
-
raise RuntimeError("RestfulServiceBuilder type not set")
|
|
120
97
|
return DependableBuilder(ParentDependency(value, self.dependency))
|
|
121
98
|
|
|
122
99
|
def with_user(self, extract_user: Callable[..., Any]) -> "DependableBuilder":
|
|
123
|
-
if self.dependency is None:
|
|
124
|
-
raise RuntimeError("RestfulServiceBuilder type not set")
|
|
125
100
|
return DependableBuilder(UserDependency(extract_user, self.dependency))
|
|
126
101
|
|
|
127
102
|
def as_dependable(self) -> type[RestfulService]:
|
|
128
|
-
if self.dependency is None:
|
|
129
|
-
raise RuntimeError("RestfulServiceBuilder type not set")
|
|
130
103
|
return ServiceDependency(self.dependency).as_dependable()
|
|
@@ -6,7 +6,6 @@ from typing import Annotated, Any, Protocol, Self, TypeVar
|
|
|
6
6
|
from fastapi import APIRouter, Depends, Path, Query
|
|
7
7
|
from fastapi.responses import JSONResponse
|
|
8
8
|
|
|
9
|
-
from apexdevkit.fastapi.builder import RestfulServiceBuilder
|
|
10
9
|
from apexdevkit.fastapi.name import RestfulName
|
|
11
10
|
from apexdevkit.fastapi.resource import RestfulResource, SummaryResponse
|
|
12
11
|
from apexdevkit.fastapi.response import RestfulResponse
|
|
@@ -24,14 +23,6 @@ class Dependency(Protocol): # pragma: no cover
|
|
|
24
23
|
pass
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
@dataclass
|
|
28
|
-
class PreBuiltRestfulService(RestfulServiceBuilder): # pragma: no cover
|
|
29
|
-
service: RestfulService
|
|
30
|
-
|
|
31
|
-
def build(self) -> RestfulService:
|
|
32
|
-
return self.service
|
|
33
|
-
|
|
34
|
-
|
|
35
26
|
@dataclass
|
|
36
27
|
class RestfulRouter:
|
|
37
28
|
router: APIRouter = field(default_factory=APIRouter)
|
|
@@ -63,30 +63,10 @@ ItemT = TypeVar("ItemT")
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
@dataclass(frozen=True)
|
|
66
|
-
class
|
|
67
|
-
|
|
68
|
-
repository: Repository[ItemT] | None = None
|
|
69
|
-
|
|
70
|
-
def with_formatter(
|
|
71
|
-
self, formatter: Formatter[Mapping[str, Any], ItemT]
|
|
72
|
-
) -> RestfulRepositoryBuilder[ItemT]:
|
|
73
|
-
return RestfulRepositoryBuilder[ItemT](formatter, self.repository)
|
|
74
|
-
|
|
75
|
-
def with_repository(
|
|
76
|
-
self, repository: Repository[ItemT]
|
|
77
|
-
) -> RestfulRepositoryBuilder[ItemT]:
|
|
78
|
-
return RestfulRepositoryBuilder[ItemT](self.formatter, repository)
|
|
79
|
-
|
|
80
|
-
def build(self) -> RestfulService:
|
|
81
|
-
if self.formatter is None or self.repository is None:
|
|
82
|
-
raise RuntimeError("Formatter or repository not provided.")
|
|
83
|
-
return _RestfulRepository(self.formatter, self.repository)
|
|
84
|
-
|
|
66
|
+
class RestfulRepository(RestfulService, Generic[ItemT]):
|
|
67
|
+
repository: Repository[ItemT]
|
|
85
68
|
|
|
86
|
-
@dataclass(frozen=True)
|
|
87
|
-
class _RestfulRepository(RestfulService, Generic[ItemT]):
|
|
88
69
|
formatter: Formatter[Mapping[str, Any], ItemT]
|
|
89
|
-
repository: Repository[ItemT]
|
|
90
70
|
|
|
91
71
|
def create_one(self, item: RawItem) -> RawItem:
|
|
92
72
|
return self.formatter.dump(self.repository.create(self.formatter.load(item)))
|
|
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
|