nsj-rest-lib2 0.0.18__py3-none-any.whl → 0.0.19__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.
- nsj_rest_lib2/compiler/compiler.py +27 -1
- nsj_rest_lib2/compiler/compiler_structures.py +1 -0
- nsj_rest_lib2/compiler/property_compiler.py +24 -0
- {nsj_rest_lib2-0.0.18.dist-info → nsj_rest_lib2-0.0.19.dist-info}/METADATA +1 -1
- {nsj_rest_lib2-0.0.18.dist-info → nsj_rest_lib2-0.0.19.dist-info}/RECORD +7 -7
- {nsj_rest_lib2-0.0.18.dist-info → nsj_rest_lib2-0.0.19.dist-info}/WHEEL +0 -0
- {nsj_rest_lib2-0.0.18.dist-info → nsj_rest_lib2-0.0.19.dist-info}/top_level.txt +0 -0
|
@@ -290,7 +290,33 @@ class EDLCompiler:
|
|
|
290
290
|
# Populando com as propriedades da entidade atual
|
|
291
291
|
properties_structure.properties.update(entity_model.properties)
|
|
292
292
|
if entity_model.main_properties:
|
|
293
|
-
|
|
293
|
+
for main_property in entity_model.main_properties:
|
|
294
|
+
if not isinstance(main_property, str):
|
|
295
|
+
continue
|
|
296
|
+
|
|
297
|
+
if "/" in main_property:
|
|
298
|
+
path_parts = [part.strip() for part in main_property.split("/") if part]
|
|
299
|
+
if len(path_parts) < 2 or not path_parts[0]:
|
|
300
|
+
raise Exception(
|
|
301
|
+
f"Propriedade resumo inválida '{main_property}' na entidade '{entity_model.id}'."
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
relation_name = path_parts[0]
|
|
305
|
+
resume_path_parts = path_parts[1:]
|
|
306
|
+
resume_field = ".".join(resume_path_parts)
|
|
307
|
+
|
|
308
|
+
if relation_name not in properties_structure.main_properties:
|
|
309
|
+
properties_structure.main_properties.append(relation_name)
|
|
310
|
+
|
|
311
|
+
resume_fields = properties_structure.main_resume_fields.setdefault(
|
|
312
|
+
relation_name, []
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
if resume_field and resume_field not in resume_fields:
|
|
316
|
+
resume_fields.append(resume_field)
|
|
317
|
+
else:
|
|
318
|
+
if main_property not in properties_structure.main_properties:
|
|
319
|
+
properties_structure.main_properties.append(main_property)
|
|
294
320
|
if entity_model.required:
|
|
295
321
|
properties_structure.required.extend(entity_model.required)
|
|
296
322
|
if entity_model.partition_data:
|
|
@@ -18,6 +18,7 @@ class PropertiesCompilerStructure:
|
|
|
18
18
|
def __init__(self) -> None:
|
|
19
19
|
self.properties: dict[str, PropertyMetaModel] = {}
|
|
20
20
|
self.main_properties: list[str] = []
|
|
21
|
+
self.main_resume_fields: dict[str, list[str]] = {}
|
|
21
22
|
self.required: list[str] = []
|
|
22
23
|
self.partition_data: list[str] = []
|
|
23
24
|
self.search_properties: list[str] = []
|
|
@@ -670,6 +670,18 @@ class EDLPropertyCompiler:
|
|
|
670
670
|
)
|
|
671
671
|
)
|
|
672
672
|
|
|
673
|
+
resume_fields = properties_structure.main_resume_fields.get(pkey)
|
|
674
|
+
if resume_fields:
|
|
675
|
+
keywords.append(
|
|
676
|
+
ast.keyword(
|
|
677
|
+
arg="resume_fields",
|
|
678
|
+
value=ast.List(
|
|
679
|
+
elts=[ast.Constant(value=field) for field in resume_fields],
|
|
680
|
+
ctx=ast.Load(),
|
|
681
|
+
),
|
|
682
|
+
)
|
|
683
|
+
)
|
|
684
|
+
|
|
673
685
|
# Resolvendo a coluna usada no relacionamento
|
|
674
686
|
if (
|
|
675
687
|
not properties_structure.entity_properties
|
|
@@ -736,6 +748,18 @@ class EDLPropertyCompiler:
|
|
|
736
748
|
):
|
|
737
749
|
keywords.append(ast.keyword(arg="resume", value=ast.Constant(True)))
|
|
738
750
|
|
|
751
|
+
resume_fields = properties_structure.main_resume_fields.get(pkey)
|
|
752
|
+
if resume_fields:
|
|
753
|
+
keywords.append(
|
|
754
|
+
ast.keyword(
|
|
755
|
+
arg="resume_fields",
|
|
756
|
+
value=ast.List(
|
|
757
|
+
elts=[ast.Constant(value=field) for field in resume_fields],
|
|
758
|
+
ctx=ast.Load(),
|
|
759
|
+
),
|
|
760
|
+
)
|
|
761
|
+
)
|
|
762
|
+
|
|
739
763
|
if prop.validator:
|
|
740
764
|
keywords.append(
|
|
741
765
|
ast.keyword(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nsj_rest_lib2
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.19
|
|
4
4
|
Summary: Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
|
|
5
5
|
Home-page: https://github.com/Nasajon/nsj_rest_lib2
|
|
6
6
|
Author: Nasajon Sistemas
|
|
@@ -4,12 +4,12 @@ nsj_rest_lib2/redis_config.py,sha256=4KLcvYS3nJO7PMQgF6F9_j6r-TyqcS7TBbd3LEQuKDU
|
|
|
4
4
|
nsj_rest_lib2/settings.py,sha256=Hn_o1HZmievnYb8D1kNT2Nq-OEjxbyNjOiOpbnFsMwE,367
|
|
5
5
|
nsj_rest_lib2/compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
nsj_rest_lib2/compiler/ai_compiler.py,sha256=shAtN4T0ai_52qh15L3mK1QbeC6glHOR6C3J3gj14II,9029
|
|
7
|
-
nsj_rest_lib2/compiler/compiler.py,sha256=
|
|
8
|
-
nsj_rest_lib2/compiler/compiler_structures.py,sha256=
|
|
7
|
+
nsj_rest_lib2/compiler/compiler.py,sha256=dcvIpvM6MHF7EU8j0Kc-shCY0RTdHJOVcXDlpg54Pz4,19887
|
|
8
|
+
nsj_rest_lib2/compiler/compiler_structures.py,sha256=a_DF_nU4VgCt0sWJI03Ky6fPHvoIM0cjMkwQb_dYv6Q,1437
|
|
9
9
|
nsj_rest_lib2/compiler/dto_compiler.py,sha256=qK0LHmXAlY_snm6QncIO0S4GiRtHYgtd74xSodK8MQA,5670
|
|
10
10
|
nsj_rest_lib2/compiler/entity_compiler.py,sha256=A0fiLFF7dGXM2uH5cknmAX-cQ-9nu4Ubujp-m5NmgYE,4780
|
|
11
11
|
nsj_rest_lib2/compiler/model.py,sha256=QDBoM26qoZdiNcykl1nvXCrFDhg-6Q__QzVq6uY1QzE,1460
|
|
12
|
-
nsj_rest_lib2/compiler/property_compiler.py,sha256=
|
|
12
|
+
nsj_rest_lib2/compiler/property_compiler.py,sha256=IDsExPxHIJgiLC7SzunIbVWXc2Q2Y3rftje-T2N2XIc,41303
|
|
13
13
|
nsj_rest_lib2/compiler/edl_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
nsj_rest_lib2/compiler/edl_model/ai_entity_edl.py,sha256=664QBDcOgVnyfwtUOXO1W7AKaZhueBG335x5DuogruY,7644
|
|
15
15
|
nsj_rest_lib2/compiler/edl_model/api_model.py,sha256=pH0Uiq_64AGvkHqwY44TrulWWZXbi6M0EKJWUhSqKj0,837
|
|
@@ -30,7 +30,7 @@ nsj_rest_lib2/controller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
30
30
|
nsj_rest_lib2/controller/dynamic_controller.py,sha256=XMqxe1NW-NE5XwomXb4pSNdALQHpP74Hc26R4fnmXqg,15194
|
|
31
31
|
nsj_rest_lib2/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
nsj_rest_lib2/service/entity_loader.py,sha256=uB0xXih9Px2jSTMdZNIu6_3dngE37K7adKX03cYSRug,15660
|
|
33
|
-
nsj_rest_lib2-0.0.
|
|
34
|
-
nsj_rest_lib2-0.0.
|
|
35
|
-
nsj_rest_lib2-0.0.
|
|
36
|
-
nsj_rest_lib2-0.0.
|
|
33
|
+
nsj_rest_lib2-0.0.19.dist-info/METADATA,sha256=9puoL49BA0D2OLq6OyRbwTgfr7PE8jr8o78-80SrBK4,1585
|
|
34
|
+
nsj_rest_lib2-0.0.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
35
|
+
nsj_rest_lib2-0.0.19.dist-info/top_level.txt,sha256=L6zh0EfH8_rur7OJ8_V-El-XEMf4qg3bkF8ADgqLVIA,14
|
|
36
|
+
nsj_rest_lib2-0.0.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|