maleo-schemas 0.0.7__tar.gz → 0.0.9__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.
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/PKG-INFO +2 -3
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/maleo_schemas.egg-info/PKG-INFO +2 -3
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/maleo_schemas.egg-info/requires.txt +1 -2
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/pyproject.toml +2 -3
- maleo_schemas-0.0.9/src/operation/request.py +471 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/operation/resource.py +3 -0
- maleo_schemas-0.0.7/src/operation/request.py +0 -128
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/LICENSE +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/README.md +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/maleo_schemas.egg-info/SOURCES.txt +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/maleo_schemas.egg-info/dependency_links.txt +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/maleo_schemas.egg-info/top_level.txt +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/setup.cfg +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/__init__.py +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/operation/__init__.py +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/operation/action.py +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/operation/base.py +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/operation/system.py +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/request.py +0 -0
- {maleo_schemas-0.0.7 → maleo_schemas-0.0.9}/src/response.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: maleo-schemas
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.9
|
4
4
|
Summary: Schemas package for MaleoSuite
|
5
5
|
Author-email: Agra Bima Yuda <agra@nexmedis.com>
|
6
6
|
License: Proprietary
|
@@ -14,7 +14,6 @@ Requires-Dist: cachetools>=5.5.2
|
|
14
14
|
Requires-Dist: certifi>=2025.8.3
|
15
15
|
Requires-Dist: cffi>=1.17.1
|
16
16
|
Requires-Dist: cfgv>=3.4.0
|
17
|
-
Requires-Dist: charset-normalizer>=3.4.3
|
18
17
|
Requires-Dist: click>=8.2.1
|
19
18
|
Requires-Dist: cryptography>=45.0.7
|
20
19
|
Requires-Dist: distlib>=0.4.0
|
@@ -38,7 +37,7 @@ Requires-Dist: identify>=2.6.13
|
|
38
37
|
Requires-Dist: idna>=3.10
|
39
38
|
Requires-Dist: importlib_metadata>=8.7.0
|
40
39
|
Requires-Dist: maleo-constants>=0.0.5
|
41
|
-
Requires-Dist: maleo-dtos>=0.0.
|
40
|
+
Requires-Dist: maleo-dtos>=0.0.6
|
42
41
|
Requires-Dist: maleo-enums>=0.0.6
|
43
42
|
Requires-Dist: maleo-logging>=0.0.4
|
44
43
|
Requires-Dist: maleo-mixins>=0.0.11
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: maleo-schemas
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.9
|
4
4
|
Summary: Schemas package for MaleoSuite
|
5
5
|
Author-email: Agra Bima Yuda <agra@nexmedis.com>
|
6
6
|
License: Proprietary
|
@@ -14,7 +14,6 @@ Requires-Dist: cachetools>=5.5.2
|
|
14
14
|
Requires-Dist: certifi>=2025.8.3
|
15
15
|
Requires-Dist: cffi>=1.17.1
|
16
16
|
Requires-Dist: cfgv>=3.4.0
|
17
|
-
Requires-Dist: charset-normalizer>=3.4.3
|
18
17
|
Requires-Dist: click>=8.2.1
|
19
18
|
Requires-Dist: cryptography>=45.0.7
|
20
19
|
Requires-Dist: distlib>=0.4.0
|
@@ -38,7 +37,7 @@ Requires-Dist: identify>=2.6.13
|
|
38
37
|
Requires-Dist: idna>=3.10
|
39
38
|
Requires-Dist: importlib_metadata>=8.7.0
|
40
39
|
Requires-Dist: maleo-constants>=0.0.5
|
41
|
-
Requires-Dist: maleo-dtos>=0.0.
|
40
|
+
Requires-Dist: maleo-dtos>=0.0.6
|
42
41
|
Requires-Dist: maleo-enums>=0.0.6
|
43
42
|
Requires-Dist: maleo-logging>=0.0.4
|
44
43
|
Requires-Dist: maleo-mixins>=0.0.11
|
@@ -5,7 +5,6 @@ cachetools>=5.5.2
|
|
5
5
|
certifi>=2025.8.3
|
6
6
|
cffi>=1.17.1
|
7
7
|
cfgv>=3.4.0
|
8
|
-
charset-normalizer>=3.4.3
|
9
8
|
click>=8.2.1
|
10
9
|
cryptography>=45.0.7
|
11
10
|
distlib>=0.4.0
|
@@ -29,7 +28,7 @@ identify>=2.6.13
|
|
29
28
|
idna>=3.10
|
30
29
|
importlib_metadata>=8.7.0
|
31
30
|
maleo-constants>=0.0.5
|
32
|
-
maleo-dtos>=0.0.
|
31
|
+
maleo-dtos>=0.0.6
|
33
32
|
maleo-enums>=0.0.6
|
34
33
|
maleo-logging>=0.0.4
|
35
34
|
maleo-mixins>=0.0.11
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "maleo-schemas"
|
7
|
-
version = "0.0.
|
7
|
+
version = "0.0.9"
|
8
8
|
description = "Schemas package for MaleoSuite"
|
9
9
|
authors = [
|
10
10
|
{ name = "Agra Bima Yuda", email = "agra@nexmedis.com" }
|
@@ -20,7 +20,6 @@ dependencies = [
|
|
20
20
|
"certifi>=2025.8.3",
|
21
21
|
"cffi>=1.17.1",
|
22
22
|
"cfgv>=3.4.0",
|
23
|
-
"charset-normalizer>=3.4.3",
|
24
23
|
"click>=8.2.1",
|
25
24
|
"cryptography>=45.0.7",
|
26
25
|
"distlib>=0.4.0",
|
@@ -44,7 +43,7 @@ dependencies = [
|
|
44
43
|
"idna>=3.10",
|
45
44
|
"importlib_metadata>=8.7.0",
|
46
45
|
"maleo-constants>=0.0.5",
|
47
|
-
"maleo-dtos>=0.0.
|
46
|
+
"maleo-dtos>=0.0.6",
|
48
47
|
"maleo-enums>=0.0.6",
|
49
48
|
"maleo-logging>=0.0.4",
|
50
49
|
"maleo-mixins>=0.0.11",
|
@@ -0,0 +1,471 @@
|
|
1
|
+
from typing import Generic, Literal, Optional, Union, overload
|
2
|
+
from uuid import UUID
|
3
|
+
from maleo.dtos.authentication import AuthenticationT
|
4
|
+
from maleo.dtos.error import GenericErrorT, ErrorT
|
5
|
+
from maleo.dtos.contexts.operation import OperationContext
|
6
|
+
from maleo.dtos.contexts.request import RequestContext
|
7
|
+
from maleo.dtos.contexts.response import ResponseContext
|
8
|
+
from maleo.dtos.contexts.service import ServiceContext
|
9
|
+
from maleo.enums.operation import (
|
10
|
+
OperationType,
|
11
|
+
ResourceOperationType,
|
12
|
+
ResourceOperationCreateType,
|
13
|
+
ResourceOperationUpdateType,
|
14
|
+
ResourceOperationDataUpdateType,
|
15
|
+
ResourceOperationStatusUpdateType,
|
16
|
+
)
|
17
|
+
from maleo.mixins.general import SuccessT
|
18
|
+
from maleo.mixins.timestamp import OperationTimestamp
|
19
|
+
from ..response import ResponseT, ErrorResponseT, SuccessResponseT
|
20
|
+
from .base import BaseOperation
|
21
|
+
from .resource import (
|
22
|
+
CreateResourceOperationAction,
|
23
|
+
ReadResourceOperationAction,
|
24
|
+
UpdateResourceOperationAction,
|
25
|
+
DeleteResourceOperationAction,
|
26
|
+
AllResourceOperationAction,
|
27
|
+
ResourceOperationActionT,
|
28
|
+
generate_resource_operation_action,
|
29
|
+
)
|
30
|
+
|
31
|
+
|
32
|
+
class RequestOperation(
|
33
|
+
BaseOperation[
|
34
|
+
None,
|
35
|
+
SuccessT,
|
36
|
+
GenericErrorT,
|
37
|
+
Optional[RequestContext],
|
38
|
+
AuthenticationT,
|
39
|
+
ResourceOperationActionT,
|
40
|
+
Optional[ResponseContext],
|
41
|
+
ResponseT,
|
42
|
+
],
|
43
|
+
Generic[
|
44
|
+
SuccessT,
|
45
|
+
GenericErrorT,
|
46
|
+
AuthenticationT,
|
47
|
+
ResourceOperationActionT,
|
48
|
+
ResponseT,
|
49
|
+
],
|
50
|
+
):
|
51
|
+
type: OperationType = OperationType.REQUEST
|
52
|
+
resource: None = None
|
53
|
+
|
54
|
+
|
55
|
+
class FailedRequestOperation(
|
56
|
+
RequestOperation[
|
57
|
+
Literal[False],
|
58
|
+
ErrorT,
|
59
|
+
AuthenticationT,
|
60
|
+
ResourceOperationActionT,
|
61
|
+
ErrorResponseT,
|
62
|
+
],
|
63
|
+
Generic[
|
64
|
+
ErrorT,
|
65
|
+
AuthenticationT,
|
66
|
+
ResourceOperationActionT,
|
67
|
+
ErrorResponseT,
|
68
|
+
],
|
69
|
+
):
|
70
|
+
success: Literal[False] = False
|
71
|
+
summary: str = "Failed processing request"
|
72
|
+
|
73
|
+
|
74
|
+
class CreateFailedRequestOperation(
|
75
|
+
FailedRequestOperation[
|
76
|
+
ErrorT, AuthenticationT, CreateResourceOperationAction, ErrorResponseT
|
77
|
+
],
|
78
|
+
Generic[ErrorT, AuthenticationT, ErrorResponseT],
|
79
|
+
):
|
80
|
+
pass
|
81
|
+
|
82
|
+
|
83
|
+
class ReadFailedRequestOperation(
|
84
|
+
FailedRequestOperation[
|
85
|
+
ErrorT, AuthenticationT, ReadResourceOperationAction, ErrorResponseT
|
86
|
+
],
|
87
|
+
Generic[ErrorT, AuthenticationT, ErrorResponseT],
|
88
|
+
):
|
89
|
+
pass
|
90
|
+
|
91
|
+
|
92
|
+
class UpdateFailedRequestOperation(
|
93
|
+
FailedRequestOperation[
|
94
|
+
ErrorT, AuthenticationT, UpdateResourceOperationAction, ErrorResponseT
|
95
|
+
],
|
96
|
+
Generic[ErrorT, AuthenticationT, ErrorResponseT],
|
97
|
+
):
|
98
|
+
pass
|
99
|
+
|
100
|
+
|
101
|
+
class DeleteFailedRequestOperation(
|
102
|
+
FailedRequestOperation[
|
103
|
+
ErrorT, AuthenticationT, DeleteResourceOperationAction, ErrorResponseT
|
104
|
+
],
|
105
|
+
Generic[ErrorT, AuthenticationT, ErrorResponseT],
|
106
|
+
):
|
107
|
+
pass
|
108
|
+
|
109
|
+
|
110
|
+
@overload
|
111
|
+
def generate_failed_request_operation(
|
112
|
+
action: CreateResourceOperationAction,
|
113
|
+
*,
|
114
|
+
service_context: ServiceContext,
|
115
|
+
id: UUID,
|
116
|
+
context: OperationContext,
|
117
|
+
timestamp: OperationTimestamp,
|
118
|
+
summary: str,
|
119
|
+
error: ErrorT,
|
120
|
+
request_context: RequestContext,
|
121
|
+
authentication: AuthenticationT,
|
122
|
+
response_context: ResponseContext,
|
123
|
+
response: ErrorResponseT,
|
124
|
+
) -> CreateFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
125
|
+
@overload
|
126
|
+
def generate_failed_request_operation(
|
127
|
+
action: ReadResourceOperationAction,
|
128
|
+
*,
|
129
|
+
service_context: ServiceContext,
|
130
|
+
id: UUID,
|
131
|
+
context: OperationContext,
|
132
|
+
timestamp: OperationTimestamp,
|
133
|
+
summary: str,
|
134
|
+
error: ErrorT,
|
135
|
+
request_context: RequestContext,
|
136
|
+
authentication: AuthenticationT,
|
137
|
+
response_context: ResponseContext,
|
138
|
+
response: ErrorResponseT,
|
139
|
+
) -> ReadFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
140
|
+
@overload
|
141
|
+
def generate_failed_request_operation(
|
142
|
+
action: UpdateResourceOperationAction,
|
143
|
+
*,
|
144
|
+
service_context: ServiceContext,
|
145
|
+
id: UUID,
|
146
|
+
context: OperationContext,
|
147
|
+
timestamp: OperationTimestamp,
|
148
|
+
summary: str,
|
149
|
+
error: ErrorT,
|
150
|
+
request_context: RequestContext,
|
151
|
+
authentication: AuthenticationT,
|
152
|
+
response_context: ResponseContext,
|
153
|
+
response: ErrorResponseT,
|
154
|
+
) -> UpdateFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
155
|
+
@overload
|
156
|
+
def generate_failed_request_operation(
|
157
|
+
action: DeleteResourceOperationAction,
|
158
|
+
*,
|
159
|
+
service_context: ServiceContext,
|
160
|
+
id: UUID,
|
161
|
+
context: OperationContext,
|
162
|
+
timestamp: OperationTimestamp,
|
163
|
+
summary: str,
|
164
|
+
error: ErrorT,
|
165
|
+
request_context: RequestContext,
|
166
|
+
authentication: AuthenticationT,
|
167
|
+
response_context: ResponseContext,
|
168
|
+
response: ErrorResponseT,
|
169
|
+
) -> DeleteFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
170
|
+
@overload
|
171
|
+
def generate_failed_request_operation(
|
172
|
+
*,
|
173
|
+
type: Literal[ResourceOperationType.CREATE],
|
174
|
+
create_type: Optional[ResourceOperationCreateType] = ...,
|
175
|
+
service_context: ServiceContext,
|
176
|
+
id: UUID,
|
177
|
+
context: OperationContext,
|
178
|
+
timestamp: OperationTimestamp,
|
179
|
+
summary: str,
|
180
|
+
error: ErrorT,
|
181
|
+
request_context: RequestContext,
|
182
|
+
authentication: AuthenticationT,
|
183
|
+
response_context: ResponseContext,
|
184
|
+
response: ErrorResponseT,
|
185
|
+
) -> CreateFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
186
|
+
@overload
|
187
|
+
def generate_failed_request_operation(
|
188
|
+
*,
|
189
|
+
type: Literal[ResourceOperationType.READ],
|
190
|
+
service_context: ServiceContext,
|
191
|
+
id: UUID,
|
192
|
+
context: OperationContext,
|
193
|
+
timestamp: OperationTimestamp,
|
194
|
+
summary: str,
|
195
|
+
error: ErrorT,
|
196
|
+
request_context: RequestContext,
|
197
|
+
authentication: AuthenticationT,
|
198
|
+
response_context: ResponseContext,
|
199
|
+
response: ErrorResponseT,
|
200
|
+
) -> ReadFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
201
|
+
@overload
|
202
|
+
def generate_failed_request_operation(
|
203
|
+
*,
|
204
|
+
type: Literal[ResourceOperationType.UPDATE],
|
205
|
+
update_type: Optional[ResourceOperationUpdateType] = ...,
|
206
|
+
data_update_type: Optional[ResourceOperationDataUpdateType] = ...,
|
207
|
+
status_update_type: Optional[ResourceOperationStatusUpdateType] = ...,
|
208
|
+
service_context: ServiceContext,
|
209
|
+
id: UUID,
|
210
|
+
context: OperationContext,
|
211
|
+
timestamp: OperationTimestamp,
|
212
|
+
summary: str,
|
213
|
+
error: ErrorT,
|
214
|
+
request_context: RequestContext,
|
215
|
+
authentication: AuthenticationT,
|
216
|
+
response_context: ResponseContext,
|
217
|
+
response: ErrorResponseT,
|
218
|
+
) -> UpdateFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
219
|
+
@overload
|
220
|
+
def generate_failed_request_operation(
|
221
|
+
*,
|
222
|
+
type: Literal[ResourceOperationType.DELETE],
|
223
|
+
service_context: ServiceContext,
|
224
|
+
id: UUID,
|
225
|
+
context: OperationContext,
|
226
|
+
timestamp: OperationTimestamp,
|
227
|
+
summary: str,
|
228
|
+
error: ErrorT,
|
229
|
+
request_context: RequestContext,
|
230
|
+
authentication: AuthenticationT,
|
231
|
+
response_context: ResponseContext,
|
232
|
+
response: ErrorResponseT,
|
233
|
+
) -> DeleteFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT]: ...
|
234
|
+
def generate_failed_request_operation(
|
235
|
+
action: Optional[AllResourceOperationAction] = None,
|
236
|
+
*,
|
237
|
+
type: Optional[ResourceOperationType] = None,
|
238
|
+
create_type: Optional[ResourceOperationCreateType] = None,
|
239
|
+
update_type: Optional[ResourceOperationUpdateType] = None,
|
240
|
+
data_update_type: Optional[ResourceOperationDataUpdateType] = None,
|
241
|
+
status_update_type: Optional[ResourceOperationStatusUpdateType] = None,
|
242
|
+
service_context: ServiceContext,
|
243
|
+
id: UUID,
|
244
|
+
context: OperationContext,
|
245
|
+
timestamp: OperationTimestamp,
|
246
|
+
summary: str,
|
247
|
+
error: ErrorT,
|
248
|
+
request_context: RequestContext,
|
249
|
+
authentication: AuthenticationT,
|
250
|
+
response_context: ResponseContext,
|
251
|
+
response: ErrorResponseT,
|
252
|
+
) -> Union[
|
253
|
+
CreateFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT],
|
254
|
+
ReadFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT],
|
255
|
+
UpdateFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT],
|
256
|
+
DeleteFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT],
|
257
|
+
]:
|
258
|
+
if (action is None and type is None) or (action is not None and type is not None):
|
259
|
+
raise ValueError("Only either 'action' or 'type' must be given")
|
260
|
+
|
261
|
+
if action is not None:
|
262
|
+
if not isinstance(
|
263
|
+
action,
|
264
|
+
(
|
265
|
+
CreateResourceOperationAction,
|
266
|
+
ReadResourceOperationAction,
|
267
|
+
UpdateResourceOperationAction,
|
268
|
+
DeleteResourceOperationAction,
|
269
|
+
),
|
270
|
+
):
|
271
|
+
raise ValueError(f"Invalid 'action' type: '{type(action)}'")
|
272
|
+
|
273
|
+
if isinstance(action, CreateResourceOperationAction):
|
274
|
+
return CreateFailedRequestOperation[
|
275
|
+
ErrorT, AuthenticationT, ErrorResponseT
|
276
|
+
](
|
277
|
+
service_context=service_context,
|
278
|
+
id=id,
|
279
|
+
context=context,
|
280
|
+
timestamp=timestamp,
|
281
|
+
summary=summary,
|
282
|
+
error=error,
|
283
|
+
request_context=request_context,
|
284
|
+
authentication=authentication,
|
285
|
+
action=action,
|
286
|
+
response_context=response_context,
|
287
|
+
response=response,
|
288
|
+
)
|
289
|
+
elif isinstance(action, ReadResourceOperationAction):
|
290
|
+
return ReadFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT](
|
291
|
+
service_context=service_context,
|
292
|
+
id=id,
|
293
|
+
context=context,
|
294
|
+
timestamp=timestamp,
|
295
|
+
summary=summary,
|
296
|
+
error=error,
|
297
|
+
request_context=request_context,
|
298
|
+
authentication=authentication,
|
299
|
+
action=action,
|
300
|
+
response_context=response_context,
|
301
|
+
response=response,
|
302
|
+
)
|
303
|
+
elif isinstance(action, UpdateResourceOperationAction):
|
304
|
+
return UpdateFailedRequestOperation[
|
305
|
+
ErrorT, AuthenticationT, ErrorResponseT
|
306
|
+
](
|
307
|
+
service_context=service_context,
|
308
|
+
id=id,
|
309
|
+
context=context,
|
310
|
+
timestamp=timestamp,
|
311
|
+
summary=summary,
|
312
|
+
error=error,
|
313
|
+
request_context=request_context,
|
314
|
+
authentication=authentication,
|
315
|
+
action=action,
|
316
|
+
response_context=response_context,
|
317
|
+
response=response,
|
318
|
+
)
|
319
|
+
elif isinstance(action, DeleteResourceOperationAction):
|
320
|
+
return DeleteFailedRequestOperation[
|
321
|
+
ErrorT, AuthenticationT, ErrorResponseT
|
322
|
+
](
|
323
|
+
service_context=service_context,
|
324
|
+
id=id,
|
325
|
+
context=context,
|
326
|
+
timestamp=timestamp,
|
327
|
+
summary=summary,
|
328
|
+
error=error,
|
329
|
+
request_context=request_context,
|
330
|
+
authentication=authentication,
|
331
|
+
action=action,
|
332
|
+
response_context=response_context,
|
333
|
+
response=response,
|
334
|
+
)
|
335
|
+
|
336
|
+
elif type is not None:
|
337
|
+
if not isinstance(type, ResourceOperationType):
|
338
|
+
raise ValueError(f"Unsupported `type`: {type}")
|
339
|
+
|
340
|
+
if type is ResourceOperationType.CREATE:
|
341
|
+
action = generate_resource_operation_action(
|
342
|
+
type=type, create_type=create_type
|
343
|
+
)
|
344
|
+
return CreateFailedRequestOperation[
|
345
|
+
ErrorT, AuthenticationT, ErrorResponseT
|
346
|
+
](
|
347
|
+
service_context=service_context,
|
348
|
+
id=id,
|
349
|
+
context=context,
|
350
|
+
timestamp=timestamp,
|
351
|
+
summary=summary,
|
352
|
+
error=error,
|
353
|
+
request_context=request_context,
|
354
|
+
authentication=authentication,
|
355
|
+
action=action,
|
356
|
+
response_context=response_context,
|
357
|
+
response=response,
|
358
|
+
)
|
359
|
+
elif type is ResourceOperationType.READ:
|
360
|
+
action = generate_resource_operation_action(type=type)
|
361
|
+
return ReadFailedRequestOperation[ErrorT, AuthenticationT, ErrorResponseT](
|
362
|
+
service_context=service_context,
|
363
|
+
id=id,
|
364
|
+
context=context,
|
365
|
+
timestamp=timestamp,
|
366
|
+
summary=summary,
|
367
|
+
error=error,
|
368
|
+
request_context=request_context,
|
369
|
+
authentication=authentication,
|
370
|
+
action=action,
|
371
|
+
response_context=response_context,
|
372
|
+
response=response,
|
373
|
+
)
|
374
|
+
elif type is ResourceOperationType.UPDATE:
|
375
|
+
action = generate_resource_operation_action(
|
376
|
+
type=type,
|
377
|
+
update_type=update_type,
|
378
|
+
data_update_type=data_update_type,
|
379
|
+
status_update_type=status_update_type,
|
380
|
+
)
|
381
|
+
return UpdateFailedRequestOperation[
|
382
|
+
ErrorT, AuthenticationT, ErrorResponseT
|
383
|
+
](
|
384
|
+
service_context=service_context,
|
385
|
+
id=id,
|
386
|
+
context=context,
|
387
|
+
timestamp=timestamp,
|
388
|
+
summary=summary,
|
389
|
+
error=error,
|
390
|
+
request_context=request_context,
|
391
|
+
authentication=authentication,
|
392
|
+
action=action,
|
393
|
+
response_context=response_context,
|
394
|
+
response=response,
|
395
|
+
)
|
396
|
+
elif type is ResourceOperationType.DELETE:
|
397
|
+
action = generate_resource_operation_action(type=type)
|
398
|
+
return DeleteFailedRequestOperation[
|
399
|
+
ErrorT, AuthenticationT, ErrorResponseT
|
400
|
+
](
|
401
|
+
service_context=service_context,
|
402
|
+
id=id,
|
403
|
+
context=context,
|
404
|
+
timestamp=timestamp,
|
405
|
+
summary=summary,
|
406
|
+
error=error,
|
407
|
+
request_context=request_context,
|
408
|
+
authentication=authentication,
|
409
|
+
action=action,
|
410
|
+
response_context=response_context,
|
411
|
+
response=response,
|
412
|
+
)
|
413
|
+
else:
|
414
|
+
# This should never happen due to initial validation,
|
415
|
+
# but type checker needs to see all paths covered
|
416
|
+
raise ValueError("Neither 'action' nor 'type' provided")
|
417
|
+
|
418
|
+
|
419
|
+
class SuccessfulRequestOperation(
|
420
|
+
RequestOperation[
|
421
|
+
Literal[True],
|
422
|
+
None,
|
423
|
+
AuthenticationT,
|
424
|
+
ResourceOperationActionT,
|
425
|
+
SuccessResponseT,
|
426
|
+
],
|
427
|
+
Generic[
|
428
|
+
AuthenticationT,
|
429
|
+
ResourceOperationActionT,
|
430
|
+
SuccessResponseT,
|
431
|
+
],
|
432
|
+
):
|
433
|
+
success: Literal[True] = True
|
434
|
+
error: None = None
|
435
|
+
summary: str = "Successfully processed request"
|
436
|
+
|
437
|
+
|
438
|
+
class CreateSuccessfulRequestOperation(
|
439
|
+
SuccessfulRequestOperation[
|
440
|
+
AuthenticationT, CreateResourceOperationAction, SuccessResponseT
|
441
|
+
],
|
442
|
+
Generic[AuthenticationT, SuccessResponseT],
|
443
|
+
):
|
444
|
+
pass
|
445
|
+
|
446
|
+
|
447
|
+
class ReadSuccessfulRequestOperation(
|
448
|
+
SuccessfulRequestOperation[
|
449
|
+
AuthenticationT, ReadResourceOperationAction, SuccessResponseT
|
450
|
+
],
|
451
|
+
Generic[AuthenticationT, SuccessResponseT],
|
452
|
+
):
|
453
|
+
pass
|
454
|
+
|
455
|
+
|
456
|
+
class UpdateSuccessfulRequestOperation(
|
457
|
+
SuccessfulRequestOperation[
|
458
|
+
AuthenticationT, UpdateResourceOperationAction, SuccessResponseT
|
459
|
+
],
|
460
|
+
Generic[AuthenticationT, SuccessResponseT],
|
461
|
+
):
|
462
|
+
pass
|
463
|
+
|
464
|
+
|
465
|
+
class DeleteSuccessfulRequestOperation(
|
466
|
+
SuccessfulRequestOperation[
|
467
|
+
AuthenticationT, DeleteResourceOperationAction, SuccessResponseT
|
468
|
+
],
|
469
|
+
Generic[AuthenticationT, SuccessResponseT],
|
470
|
+
):
|
471
|
+
pass
|
@@ -494,6 +494,7 @@ def generate_failed_resource_operation(
|
|
494
494
|
*,
|
495
495
|
type: Literal[ResourceOperationType.UPDATE],
|
496
496
|
update_type: Optional[ResourceOperationUpdateType] = ...,
|
497
|
+
data_update_type: Optional[ResourceOperationDataUpdateType] = ...,
|
497
498
|
status_update_type: Optional[ResourceOperationStatusUpdateType] = ...,
|
498
499
|
service_context: ServiceContext,
|
499
500
|
id: UUID,
|
@@ -527,6 +528,7 @@ def generate_failed_resource_operation(
|
|
527
528
|
type: Optional[ResourceOperationType] = None,
|
528
529
|
create_type: Optional[ResourceOperationCreateType] = None,
|
529
530
|
update_type: Optional[ResourceOperationUpdateType] = None,
|
531
|
+
data_update_type: Optional[ResourceOperationDataUpdateType] = None,
|
530
532
|
status_update_type: Optional[ResourceOperationStatusUpdateType] = None,
|
531
533
|
service_context: ServiceContext,
|
532
534
|
id: UUID,
|
@@ -664,6 +666,7 @@ def generate_failed_resource_operation(
|
|
664
666
|
action = generate_resource_operation_action(
|
665
667
|
type=type,
|
666
668
|
update_type=update_type,
|
669
|
+
data_update_type=data_update_type,
|
667
670
|
status_update_type=status_update_type,
|
668
671
|
)
|
669
672
|
return UpdateFailedResourceOperation[
|
@@ -1,128 +0,0 @@
|
|
1
|
-
from typing import Generic, Literal
|
2
|
-
from maleo.enums.operation import OperationType
|
3
|
-
from maleo.mixins.general import SuccessT
|
4
|
-
from maleo.dtos.authentication import AuthenticationT, OptionalAuthentication
|
5
|
-
from maleo.dtos.error import GenericErrorT, ErrorT
|
6
|
-
from maleo.dtos.contexts.request import RequestContext
|
7
|
-
from maleo.dtos.contexts.response import ResponseContext
|
8
|
-
from ..response import ResponseT, ErrorResponseT, SuccessResponseT
|
9
|
-
from .base import BaseOperation
|
10
|
-
from .resource import (
|
11
|
-
CreateResourceOperationAction,
|
12
|
-
ReadResourceOperationAction,
|
13
|
-
UpdateResourceOperationAction,
|
14
|
-
DeleteResourceOperationAction,
|
15
|
-
ResourceOperationActionT,
|
16
|
-
)
|
17
|
-
|
18
|
-
|
19
|
-
class RequestOperation(
|
20
|
-
BaseOperation[
|
21
|
-
None,
|
22
|
-
SuccessT,
|
23
|
-
GenericErrorT,
|
24
|
-
RequestContext,
|
25
|
-
OptionalAuthentication,
|
26
|
-
ResourceOperationActionT,
|
27
|
-
ResponseContext,
|
28
|
-
ResponseT,
|
29
|
-
],
|
30
|
-
Generic[
|
31
|
-
SuccessT,
|
32
|
-
GenericErrorT,
|
33
|
-
ResourceOperationActionT,
|
34
|
-
ResponseT,
|
35
|
-
],
|
36
|
-
):
|
37
|
-
type: OperationType = OperationType.REQUEST
|
38
|
-
resource: None = None
|
39
|
-
|
40
|
-
|
41
|
-
class FailedRequestOperation(
|
42
|
-
RequestOperation[
|
43
|
-
Literal[False],
|
44
|
-
ErrorT,
|
45
|
-
ResourceOperationActionT,
|
46
|
-
ErrorResponseT,
|
47
|
-
],
|
48
|
-
Generic[
|
49
|
-
ErrorT,
|
50
|
-
ResourceOperationActionT,
|
51
|
-
ErrorResponseT,
|
52
|
-
],
|
53
|
-
):
|
54
|
-
success: Literal[False] = False
|
55
|
-
summary: str = "Failed processing request"
|
56
|
-
|
57
|
-
|
58
|
-
class CreateFailedRequestOperation(
|
59
|
-
FailedRequestOperation[ErrorT, CreateResourceOperationAction, ErrorResponseT],
|
60
|
-
Generic[ErrorT, ErrorResponseT],
|
61
|
-
):
|
62
|
-
pass
|
63
|
-
|
64
|
-
|
65
|
-
class ReadFailedRequestOperation(
|
66
|
-
FailedRequestOperation[ErrorT, CreateResourceOperationAction, ErrorResponseT],
|
67
|
-
Generic[ErrorT, ErrorResponseT],
|
68
|
-
):
|
69
|
-
pass
|
70
|
-
|
71
|
-
|
72
|
-
class UpdateFailedRequestOperation(
|
73
|
-
FailedRequestOperation[ErrorT, UpdateResourceOperationAction, ErrorResponseT],
|
74
|
-
Generic[ErrorT, AuthenticationT, ErrorResponseT],
|
75
|
-
):
|
76
|
-
pass
|
77
|
-
|
78
|
-
|
79
|
-
class DeleteFailedRequestOperation(
|
80
|
-
FailedRequestOperation[ErrorT, DeleteResourceOperationAction, ErrorResponseT],
|
81
|
-
Generic[ErrorT, AuthenticationT, ErrorResponseT],
|
82
|
-
):
|
83
|
-
pass
|
84
|
-
|
85
|
-
|
86
|
-
class SuccessfulRequestOperation(
|
87
|
-
RequestOperation[
|
88
|
-
Literal[True],
|
89
|
-
None,
|
90
|
-
ResourceOperationActionT,
|
91
|
-
SuccessResponseT,
|
92
|
-
],
|
93
|
-
Generic[
|
94
|
-
ResourceOperationActionT,
|
95
|
-
SuccessResponseT,
|
96
|
-
],
|
97
|
-
):
|
98
|
-
success: Literal[True] = True
|
99
|
-
error: None = None
|
100
|
-
summary: str = "Successfully processed request"
|
101
|
-
|
102
|
-
|
103
|
-
class CreateSuccessfulRequestOperation(
|
104
|
-
SuccessfulRequestOperation[CreateResourceOperationAction, SuccessResponseT],
|
105
|
-
Generic[AuthenticationT, SuccessResponseT],
|
106
|
-
):
|
107
|
-
pass
|
108
|
-
|
109
|
-
|
110
|
-
class ReadSuccessfulRequestOperation(
|
111
|
-
SuccessfulRequestOperation[ReadResourceOperationAction, SuccessResponseT],
|
112
|
-
Generic[AuthenticationT, SuccessResponseT],
|
113
|
-
):
|
114
|
-
pass
|
115
|
-
|
116
|
-
|
117
|
-
class UpdateSuccessfulRequestOperation(
|
118
|
-
SuccessfulRequestOperation[UpdateResourceOperationAction, SuccessResponseT],
|
119
|
-
Generic[AuthenticationT, SuccessResponseT],
|
120
|
-
):
|
121
|
-
pass
|
122
|
-
|
123
|
-
|
124
|
-
class DeleteSuccessfulRequestOperation(
|
125
|
-
SuccessfulRequestOperation[DeleteResourceOperationAction, SuccessResponseT],
|
126
|
-
Generic[AuthenticationT, SuccessResponseT],
|
127
|
-
):
|
128
|
-
pass
|
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
|