nsj-rest-lib2 0.0.27__py3-none-any.whl → 0.0.30__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/dto_compiler.py +9 -3
- nsj_rest_lib2/compiler/edl_model/primitives.py +2 -0
- nsj_rest_lib2/compiler/entity_compiler.py +4 -0
- nsj_rest_lib2/compiler/property_compiler.py +32 -40
- {nsj_rest_lib2-0.0.27.dist-info → nsj_rest_lib2-0.0.30.dist-info}/METADATA +2 -2
- {nsj_rest_lib2-0.0.27.dist-info → nsj_rest_lib2-0.0.30.dist-info}/RECORD +8 -8
- {nsj_rest_lib2-0.0.27.dist-info → nsj_rest_lib2-0.0.30.dist-info}/WHEEL +0 -0
- {nsj_rest_lib2-0.0.27.dist-info → nsj_rest_lib2-0.0.30.dist-info}/top_level.txt +0 -0
|
@@ -41,6 +41,11 @@ class DTOCompiler:
|
|
|
41
41
|
imports = [
|
|
42
42
|
# import datetime
|
|
43
43
|
ast.Import(names=[ast.alias(name="datetime", asname=None)]),
|
|
44
|
+
# import dateutil
|
|
45
|
+
ast.ImportFrom(module="dateutil.relativedelta",
|
|
46
|
+
names=[ast.alias(name="relativedelta")],
|
|
47
|
+
level=0),
|
|
48
|
+
|
|
44
49
|
# import enum
|
|
45
50
|
ast.Import(names=[ast.alias(name="enum", asname=None)]),
|
|
46
51
|
# import uuid
|
|
@@ -81,10 +86,10 @@ class DTOCompiler:
|
|
|
81
86
|
names=[ast.alias(name="EntityRelationOwner", asname=None)],
|
|
82
87
|
level=0,
|
|
83
88
|
),
|
|
84
|
-
# from nsj_rest_lib.descriptor.dto_object_field import
|
|
89
|
+
# from nsj_rest_lib.descriptor.dto_object_field import DTOOneToOneField
|
|
85
90
|
ast.ImportFrom(
|
|
86
|
-
module="nsj_rest_lib.descriptor.
|
|
87
|
-
names=[ast.alias(name="
|
|
91
|
+
module="nsj_rest_lib.descriptor.dto_one_to_one_field",
|
|
92
|
+
names=[ast.alias(name="DTOOneToOneField", asname=None), ast.alias(name="OTORelationType", asname=None) ],
|
|
88
93
|
level=0,
|
|
89
94
|
),
|
|
90
95
|
# from nsj_rest_lib.descriptor import DTOAggregator
|
|
@@ -94,6 +99,7 @@ class DTOCompiler:
|
|
|
94
99
|
level=0,
|
|
95
100
|
),
|
|
96
101
|
]
|
|
102
|
+
|
|
97
103
|
|
|
98
104
|
for import_ in related_imports:
|
|
99
105
|
imports.append(
|
|
@@ -25,6 +25,7 @@ class PrimitiveTypes(enum.Enum):
|
|
|
25
25
|
EMAIL = "email"
|
|
26
26
|
DATE = "date"
|
|
27
27
|
DATETIME = "datetime"
|
|
28
|
+
DURATION = "duration"
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
PropertyType = Union[PrimitiveTypes, ExternalRefType, InternalRefType]
|
|
@@ -43,6 +44,7 @@ MAPPING_PRIMITIVE_TYPES_TO_PYTHON = {
|
|
|
43
44
|
PrimitiveTypes.EMAIL: "str",
|
|
44
45
|
PrimitiveTypes.DATE: "datetime.date",
|
|
45
46
|
PrimitiveTypes.DATETIME: "datetime.datetime",
|
|
47
|
+
PrimitiveTypes.DURATION: "relativedelta"
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
BasicTypes = int | bool | float | str
|
|
@@ -24,6 +24,10 @@ class EntityCompiler:
|
|
|
24
24
|
imports = [
|
|
25
25
|
# import datetime
|
|
26
26
|
ast.Import(names=[ast.alias(name="datetime", asname=None)]),
|
|
27
|
+
# import dateutil
|
|
28
|
+
ast.ImportFrom(module="dateutil.relativedelta",
|
|
29
|
+
names=[ast.alias(name="relativedelta")],
|
|
30
|
+
level=0),
|
|
27
31
|
# import uuid
|
|
28
32
|
ast.Import(names=[ast.alias(name="uuid", asname=None)]),
|
|
29
33
|
# from nsj_rest_lib.entity.entity_base import EntityBase
|
|
@@ -559,7 +559,7 @@ class EDLPropertyCompiler:
|
|
|
559
559
|
related_entity_class_name: str,
|
|
560
560
|
prop: PropertyMetaModel,
|
|
561
561
|
):
|
|
562
|
-
#
|
|
562
|
+
# Keywords for DTOOneToOneField
|
|
563
563
|
keywords = [
|
|
564
564
|
ast.keyword(
|
|
565
565
|
arg="entity_type",
|
|
@@ -615,32 +615,13 @@ class EDLPropertyCompiler:
|
|
|
615
615
|
if properties_structure.required and pkey in properties_structure.required:
|
|
616
616
|
keywords.append(ast.keyword(arg="not_null", value=ast.Constant(True)))
|
|
617
617
|
|
|
618
|
+
# 'resume' now belongs to the inner DTOField (matches desired format)
|
|
618
619
|
if (
|
|
619
620
|
properties_structure.main_properties
|
|
620
621
|
and pkey in properties_structure.main_properties
|
|
621
622
|
):
|
|
622
623
|
keywords.append(ast.keyword(arg="resume", value=ast.Constant(True)))
|
|
623
624
|
|
|
624
|
-
resume_fields = properties_structure.main_resume_fields.get(pkey)
|
|
625
|
-
if resume_fields:
|
|
626
|
-
keywords.append(
|
|
627
|
-
ast.keyword(
|
|
628
|
-
arg="resume_fields",
|
|
629
|
-
value=ast.List(
|
|
630
|
-
elts=[ast.Constant(value=field) for field in resume_fields],
|
|
631
|
-
ctx=ast.Load(),
|
|
632
|
-
),
|
|
633
|
-
)
|
|
634
|
-
)
|
|
635
|
-
|
|
636
|
-
if prop.validator:
|
|
637
|
-
keywords.append(
|
|
638
|
-
ast.keyword(
|
|
639
|
-
arg="validator",
|
|
640
|
-
value=ast.Name(prop.validator, ctx=ast.Load()),
|
|
641
|
-
)
|
|
642
|
-
)
|
|
643
|
-
|
|
644
625
|
# Resolvendo a coluna usada no relacionamento
|
|
645
626
|
if (
|
|
646
627
|
not properties_structure.entity_properties
|
|
@@ -659,13 +640,28 @@ class EDLPropertyCompiler:
|
|
|
659
640
|
if "/" in relation_column:
|
|
660
641
|
owner_relation = True
|
|
661
642
|
relation_column = relation_column.split("/")[-1]
|
|
643
|
+
|
|
662
644
|
|
|
663
|
-
#
|
|
664
|
-
|
|
665
|
-
|
|
645
|
+
if ('#' in str(properties_structure.properties[pkey].type)):
|
|
646
|
+
relationTypeAttr = 'COMPOSITION'
|
|
647
|
+
else:
|
|
648
|
+
relationTypeAttr = 'AGGREGATION'
|
|
649
|
+
|
|
650
|
+
keywords.append(
|
|
651
|
+
ast.keyword(
|
|
652
|
+
arg="relation_type",
|
|
653
|
+
value=ast.Attribute(
|
|
654
|
+
value=ast.Name(id="OTORelationType", ctx=ast.Load()),
|
|
655
|
+
attr=relationTypeAttr,
|
|
656
|
+
ctx=ast.Load(),
|
|
657
|
+
),
|
|
658
|
+
)
|
|
659
|
+
)
|
|
660
|
+
|
|
661
|
+
# Build the inner field descriptor with the entity column mapping
|
|
666
662
|
keywords.append(
|
|
667
663
|
ast.keyword(
|
|
668
|
-
arg="
|
|
664
|
+
arg="entity_field",
|
|
669
665
|
value=ast.Constant(value=relation_column),
|
|
670
666
|
)
|
|
671
667
|
)
|
|
@@ -682,22 +678,18 @@ class EDLPropertyCompiler:
|
|
|
682
678
|
)
|
|
683
679
|
)
|
|
684
680
|
else:
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
ast.
|
|
693
|
-
|
|
694
|
-
value=ast.Constant(value=relation_column),
|
|
695
|
-
),
|
|
696
|
-
],
|
|
681
|
+
# Dono da relação: informa explicitamente como SELF e garante o atributo na Entity
|
|
682
|
+
keywords.append(
|
|
683
|
+
ast.keyword(
|
|
684
|
+
arg="entity_relation_owner",
|
|
685
|
+
value=ast.Attribute(
|
|
686
|
+
value=ast.Name(id="EntityRelationOwner", ctx=ast.Load()),
|
|
687
|
+
attr="SELF",
|
|
688
|
+
ctx=ast.Load(),
|
|
689
|
+
),
|
|
697
690
|
)
|
|
698
691
|
)
|
|
699
|
-
|
|
700
|
-
# Adicionando propriedade, para o campo de relação, no Entity (quando for o dono da relação)
|
|
692
|
+
# Adicionando propriedade no Entity para a coluna de relação
|
|
701
693
|
ast_entity_attributes.append(
|
|
702
694
|
self._build_entity_property_ast(relation_column, PrimitiveTypes.UUID)
|
|
703
695
|
)
|
|
@@ -710,7 +702,7 @@ class EDLPropertyCompiler:
|
|
|
710
702
|
ctx=ast.Load(),
|
|
711
703
|
),
|
|
712
704
|
value=ast.Call(
|
|
713
|
-
func=ast.Name(id="
|
|
705
|
+
func=ast.Name(id="DTOOneToOneField", ctx=ast.Load()),
|
|
714
706
|
args=[],
|
|
715
707
|
keywords=keywords,
|
|
716
708
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nsj_rest_lib2
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.30
|
|
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
|
|
@@ -12,7 +12,7 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Requires-Python: >=3.4
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
-
Requires-Dist: nsj-rest-lib<
|
|
15
|
+
Requires-Dist: nsj-rest-lib<6.0.0,>=5.1.3
|
|
16
16
|
Requires-Dist: redis<7.0.0,>=6.4.0
|
|
17
17
|
Requires-Dist: nsj-multi-database-lib<3.0.0,>=2.0.1
|
|
18
18
|
Requires-Dist: pydantic<3.0.0,>=2.11.9
|
|
@@ -6,12 +6,12 @@ nsj_rest_lib2/compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
6
6
|
nsj_rest_lib2/compiler/ai_compiler.py,sha256=shAtN4T0ai_52qh15L3mK1QbeC6glHOR6C3J3gj14II,9029
|
|
7
7
|
nsj_rest_lib2/compiler/compiler.py,sha256=8avORndGTPOlQO3-s8PkC3fsfCLsUzBW4Qfq-UaueEE,30403
|
|
8
8
|
nsj_rest_lib2/compiler/compiler_structures.py,sha256=a_DF_nU4VgCt0sWJI03Ky6fPHvoIM0cjMkwQb_dYv6Q,1437
|
|
9
|
-
nsj_rest_lib2/compiler/dto_compiler.py,sha256=
|
|
10
|
-
nsj_rest_lib2/compiler/entity_compiler.py,sha256
|
|
9
|
+
nsj_rest_lib2/compiler/dto_compiler.py,sha256=Fs6VysuAjBgct7_Wc0sugvx7z9tfnlZcSrBu0l0Pyp0,7019
|
|
10
|
+
nsj_rest_lib2/compiler/entity_compiler.py,sha256=LeGEBxsjAmZZog2gh4vjUX1aFp9JSVgHHOdTkY0aH-s,6733
|
|
11
11
|
nsj_rest_lib2/compiler/function_compiler.py,sha256=t5e_NoDB0IckiIEuYLsvk2lPSwrcrjL91s4LTQkpRqA,18085
|
|
12
12
|
nsj_rest_lib2/compiler/function_model.py,sha256=iSKMlCSZDWlP_aTdlcbYQhsEAIMH-XbSJUU0-KNtLCs,2066
|
|
13
13
|
nsj_rest_lib2/compiler/model.py,sha256=8UxzTvcNgZQdLwC592o8ZMVPhG3AloBCg5q2V72Up8U,1688
|
|
14
|
-
nsj_rest_lib2/compiler/property_compiler.py,sha256=
|
|
14
|
+
nsj_rest_lib2/compiler/property_compiler.py,sha256=uoC5GoEP8EQ6kG1FmTJ08Y3nxy4tVopgh3dSy4pOrWQ,47463
|
|
15
15
|
nsj_rest_lib2/compiler/edl_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
nsj_rest_lib2/compiler/edl_model/ai_entity_edl.py,sha256=664QBDcOgVnyfwtUOXO1W7AKaZhueBG335x5DuogruY,7644
|
|
17
17
|
nsj_rest_lib2/compiler/edl_model/api_model.py,sha256=7RpZkUGROZmTBh2psgTG_b3e4xxjc3uBr1EYb-wiAkc,3810
|
|
@@ -20,7 +20,7 @@ nsj_rest_lib2/compiler/edl_model/entity_model.py,sha256=Yc6wvjsiwacmz796mZIU-i9h
|
|
|
20
20
|
nsj_rest_lib2/compiler/edl_model/entity_model_base.py,sha256=eRn0pirIPHvniqGpT0xE-mmgqz5RIVtqghxcnfxKNdQ,4345
|
|
21
21
|
nsj_rest_lib2/compiler/edl_model/entity_model_root.py,sha256=VinsxFlNyCaKKk37ZzcbmWaWgoUP2-dZBG61Ke7NvVs,231
|
|
22
22
|
nsj_rest_lib2/compiler/edl_model/index_model.py,sha256=cXWlu0hxtro5vvYoirkDW4R3PCnBW5oCCWjRJ6AX5zE,508
|
|
23
|
-
nsj_rest_lib2/compiler/edl_model/primitives.py,sha256=
|
|
23
|
+
nsj_rest_lib2/compiler/edl_model/primitives.py,sha256=vn4qVkISW6npOdvL-WWYMmZ1LZdhaUNKc91Spcxh7Kk,1684
|
|
24
24
|
nsj_rest_lib2/compiler/edl_model/property_meta_model.py,sha256=ciphkgdTtfPfLpeMQpcf3GXQ_qx7xl1tzgeUoJBjPBU,3871
|
|
25
25
|
nsj_rest_lib2/compiler/edl_model/repository_model.py,sha256=OmtUzSq2LKmM76VXefGrKwg8xtVFCutt3JNH2nv42qU,1821
|
|
26
26
|
nsj_rest_lib2/compiler/edl_model/trait_property_meta_model.py,sha256=NtMVZeOPu3LJwXI-8tCOLVuQiGua_0t7kL1h9gL7HuM,657
|
|
@@ -33,7 +33,7 @@ nsj_rest_lib2/controller/dynamic_controller.py,sha256=UJtlr0_A6bGJ1gD24oj3481tCb
|
|
|
33
33
|
nsj_rest_lib2/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
nsj_rest_lib2/service/entity_config_writer.py,sha256=DC8M4BYKfaOkNty1YFmAmWiNvENjvmiUqDKgsAV3eNc,4688
|
|
35
35
|
nsj_rest_lib2/service/entity_loader.py,sha256=I8Ua2CPCxxUovHJn8SSRz0bYfmdFqfWj-JQfNTBBypc,17842
|
|
36
|
-
nsj_rest_lib2-0.0.
|
|
37
|
-
nsj_rest_lib2-0.0.
|
|
38
|
-
nsj_rest_lib2-0.0.
|
|
39
|
-
nsj_rest_lib2-0.0.
|
|
36
|
+
nsj_rest_lib2-0.0.30.dist-info/METADATA,sha256=NWU_fMsjaCq6_K3Wk7KG2D56sQbX65zo6qqpl4T5xbo,1094
|
|
37
|
+
nsj_rest_lib2-0.0.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
38
|
+
nsj_rest_lib2-0.0.30.dist-info/top_level.txt,sha256=L6zh0EfH8_rur7OJ8_V-El-XEMf4qg3bkF8ADgqLVIA,14
|
|
39
|
+
nsj_rest_lib2-0.0.30.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|