nsj-rest-lib2 0.0.11__tar.gz → 0.0.13__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.
Files changed (40) hide show
  1. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/PKG-INFO +1 -1
  2. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/compiler.py +6 -1
  3. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/dto_compiler.py +28 -1
  4. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/column_meta_model.py +1 -1
  5. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/trait_property_meta_model.py +6 -0
  6. nsj_rest_lib2-0.0.13/nsj_rest_lib2/compiler/property_compiler.py +899 -0
  7. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/service/entity_loader.py +14 -7
  8. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2.egg-info/PKG-INFO +1 -1
  9. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/setup.cfg +1 -1
  10. nsj_rest_lib2-0.0.11/nsj_rest_lib2/compiler/property_compiler.py +0 -534
  11. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/README.md +0 -0
  12. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/__init__.py +0 -0
  13. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/__init__.py +0 -0
  14. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/ai_compiler.py +0 -0
  15. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/compiler_structures.py +0 -0
  16. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/__init__.py +0 -0
  17. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/ai_entity_edl.py +0 -0
  18. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/api_model.py +0 -0
  19. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/entity_model.py +0 -0
  20. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/index_model.py +0 -0
  21. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/primitives.py +0 -0
  22. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/property_meta_model.py +0 -0
  23. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/edl_model/repository_model.py +0 -0
  24. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/entity_compiler.py +0 -0
  25. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/model.py +0 -0
  26. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/util/__init__.py +0 -0
  27. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/util/str_util.py +0 -0
  28. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/util/type_naming_util.py +0 -0
  29. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/compiler/util/type_util.py +0 -0
  30. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/controller/__init__.py +0 -0
  31. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/controller/dynamic_controller.py +0 -0
  32. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/exception.py +0 -0
  33. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/redis_config.py +0 -0
  34. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/service/__init__.py +0 -0
  35. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2/settings.py +0 -0
  36. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2.egg-info/SOURCES.txt +0 -0
  37. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2.egg-info/dependency_links.txt +0 -0
  38. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2.egg-info/requires.txt +0 -0
  39. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/nsj_rest_lib2.egg-info/top_level.txt +0 -0
  40. {nsj_rest_lib2-0.0.11 → nsj_rest_lib2-0.0.13}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nsj_rest_lib2
3
- Version: 0.0.11
3
+ Version: 0.0.13
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
@@ -105,6 +105,7 @@ class EDLCompiler:
105
105
  enum_classes,
106
106
  related_imports,
107
107
  relations_dependencies,
108
+ fixed_filters,
108
109
  ) = self._properties_compiler.compile(
109
110
  properties_structure,
110
111
  map_unique_by_property,
@@ -114,7 +115,11 @@ class EDLCompiler:
114
115
 
115
116
  # Gerando o código do DTO
116
117
  dto_class_name, code_dto = self._dto_compiler.compile(
117
- entity_model, ast_dto_attributes, enum_classes, related_imports
118
+ entity_model,
119
+ ast_dto_attributes,
120
+ enum_classes,
121
+ related_imports,
122
+ fixed_filters,
118
123
  )
119
124
 
120
125
  # Gerando o código da Entity
@@ -3,6 +3,7 @@ import ast
3
3
  import black
4
4
 
5
5
  from nsj_rest_lib2.compiler.edl_model.entity_model import EntityModel
6
+ from nsj_rest_lib2.compiler.edl_model.primitives import BasicTypes
6
7
  from nsj_rest_lib2.compiler.util.str_util import CompilerStrUtil
7
8
  from nsj_rest_lib2.compiler.util.type_naming_util import compile_dto_class_name
8
9
 
@@ -17,6 +18,7 @@ class DTOCompiler:
17
18
  ast_dto_attributes: list[ast.stmt],
18
19
  enum_classes: list[ast.stmt],
19
20
  related_imports: list[tuple[str, str, str]],
21
+ fixed_filters: list[tuple[str, BasicTypes]],
20
22
  ) -> tuple[str, str]:
21
23
  """
22
24
  Compila o código do DTO a partir do AST e retorna o código compilado.
@@ -71,6 +73,18 @@ class DTOCompiler:
71
73
  names=[ast.alias(name="DTOBase", asname=None)],
72
74
  level=0,
73
75
  ),
76
+ # from nsj_rest_lib.descriptor.dto_left_join_field import EntityRelationOwner
77
+ ast.ImportFrom(
78
+ module="nsj_rest_lib.descriptor.dto_left_join_field",
79
+ names=[ast.alias(name="EntityRelationOwner", asname=None)],
80
+ level=0,
81
+ ),
82
+ # from nsj_rest_lib.descriptor.dto_object_field import DTOObjectField
83
+ ast.ImportFrom(
84
+ module="nsj_rest_lib.descriptor.dto_object_field",
85
+ names=[ast.alias(name="DTOObjectField", asname=None)],
86
+ level=0,
87
+ ),
74
88
  ]
75
89
 
76
90
  for import_ in related_imports:
@@ -89,6 +103,19 @@ class DTOCompiler:
89
103
  )
90
104
  )
91
105
 
106
+ # Keywords para tipos usados em fixed_filters
107
+ keywords_decorator_dto = []
108
+ for fixed_filter in fixed_filters:
109
+ keywords_decorator_dto.append(
110
+ ast.keyword(
111
+ arg="fixed_filters",
112
+ value=ast.Dict(
113
+ keys=[ast.Constant(value=fixed_filter[0])],
114
+ values=[ast.Constant(value=fixed_filter[1])],
115
+ ),
116
+ )
117
+ )
118
+
92
119
  # Criando o ast da classe
93
120
  class_name = compile_dto_class_name(entity_model.id)
94
121
  ast_class = ast.ClassDef(
@@ -99,7 +126,7 @@ class DTOCompiler:
99
126
  ast.Call(
100
127
  func=ast.Name(id="DTO", ctx=ast.Load()),
101
128
  args=[],
102
- keywords=[],
129
+ keywords=keywords_decorator_dto,
103
130
  )
104
131
  ],
105
132
  body=ast_dto_attributes,
@@ -1,5 +1,5 @@
1
1
  from pydantic import BaseModel, Field, model_validator
2
- from typing import List, Optional, Literal
2
+ from typing import Optional
3
3
 
4
4
 
5
5
  class ColumnMetaModel(BaseModel):
@@ -1,6 +1,8 @@
1
+ from typing import List, Optional
1
2
  from pydantic import BaseModel, Field
2
3
 
3
4
  from nsj_rest_lib2.compiler.edl_model.primitives import BasicTypes, PropertyType
5
+ from nsj_rest_lib2.compiler.edl_model.property_meta_model import DomainConfigModel
4
6
 
5
7
 
6
8
  class TraitPropertyMetaModel(BaseModel):
@@ -8,3 +10,7 @@ class TraitPropertyMetaModel(BaseModel):
8
10
  value: BasicTypes = Field(
9
11
  ..., description="Valor fixo da propriedade de condicionamento do trait."
10
12
  )
13
+ domain_config: Optional[List[DomainConfigModel]] = Field(
14
+ None,
15
+ description="Lista de valores permitidos.",
16
+ )