nsj-rest-lib2 0.0.24__tar.gz → 0.0.26__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 (41) hide show
  1. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/PKG-INFO +1 -1
  2. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/controller/dynamic_controller.py +39 -14
  3. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/service/entity_loader.py +6 -1
  4. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2.egg-info/PKG-INFO +1 -1
  5. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/setup.cfg +1 -1
  6. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/README.md +0 -0
  7. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/__init__.py +0 -0
  8. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/__init__.py +0 -0
  9. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/ai_compiler.py +0 -0
  10. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/compiler.py +0 -0
  11. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/compiler_structures.py +0 -0
  12. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/dto_compiler.py +0 -0
  13. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/__init__.py +0 -0
  14. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/ai_entity_edl.py +0 -0
  15. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/api_model.py +0 -0
  16. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/column_meta_model.py +0 -0
  17. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/entity_model.py +0 -0
  18. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/entity_model_base.py +0 -0
  19. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/entity_model_root.py +0 -0
  20. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/index_model.py +0 -0
  21. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/primitives.py +0 -0
  22. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/property_meta_model.py +0 -0
  23. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/repository_model.py +0 -0
  24. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/edl_model/trait_property_meta_model.py +0 -0
  25. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/entity_compiler.py +0 -0
  26. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/model.py +0 -0
  27. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/property_compiler.py +0 -0
  28. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/util/__init__.py +0 -0
  29. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/util/str_util.py +0 -0
  30. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/util/type_naming_util.py +0 -0
  31. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/compiler/util/type_util.py +0 -0
  32. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/controller/__init__.py +0 -0
  33. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/exception.py +0 -0
  34. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/redis_config.py +0 -0
  35. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/service/__init__.py +0 -0
  36. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2/settings.py +0 -0
  37. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2.egg-info/SOURCES.txt +0 -0
  38. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2.egg-info/dependency_links.txt +0 -0
  39. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2.egg-info/requires.txt +0 -0
  40. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/nsj_rest_lib2.egg-info/top_level.txt +0 -0
  41. {nsj_rest_lib2-0.0.24 → nsj_rest_lib2-0.0.26}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nsj_rest_lib2
3
- Version: 0.0.24
3
+ Version: 0.0.26
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
@@ -22,11 +22,12 @@ from nsj_rest_lib2.exception import MissingEntityConfigException
22
22
  from nsj_rest_lib2.service.entity_loader import EntityLoader
23
23
 
24
24
 
25
- def _get_tenant_grupo() -> tuple[str, str]:
25
+ def _get_query_args() -> tuple[str, str, bool]:
26
26
  # Tentando ler do query args
27
27
  query_args = request.args
28
28
  tenant = query_args.get("tenant")
29
29
  grupo_empresarial = query_args.get("grupo_empresarial")
30
+ force_reload = query_args.get("force_reload", "false").lower() == "true"
30
31
 
31
32
  # Tentando ler do corpo da requisição
32
33
  try:
@@ -40,7 +41,7 @@ def _get_tenant_grupo() -> tuple[str, str]:
40
41
  except:
41
42
  pass
42
43
 
43
- return (str(tenant), str(grupo_empresarial))
44
+ return (str(tenant), str(grupo_empresarial), force_reload)
44
45
 
45
46
 
46
47
  def _endpoint_name(func: Any, multidb: bool, root: str) -> str:
@@ -82,7 +83,7 @@ def setup_dynamic_routes(
82
83
  entity_escopo = kwargs.pop("entity_escopo")
83
84
 
84
85
  # Lendo tenant e grupo_empresarial
85
- tenant, grupo_empresarial = _get_tenant_grupo()
86
+ tenant, grupo_empresarial, force_reload = _get_query_args()
86
87
 
87
88
  try:
88
89
  # Recuperando o código do DTO e Entity correspondente
@@ -94,7 +95,11 @@ def setup_dynamic_routes(
94
95
  api_expose,
95
96
  api_verbs,
96
97
  ) = entity_loader.load_entity_source(
97
- entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
98
+ entity_resource,
99
+ tenant,
100
+ grupo_empresarial,
101
+ escopo=entity_escopo,
102
+ force_reload=force_reload,
98
103
  )
99
104
 
100
105
  # Verificando se essa API deve ser exposta
@@ -132,7 +137,7 @@ def setup_dynamic_routes(
132
137
  entity_escopo = kwargs.pop("entity_escopo")
133
138
 
134
139
  # Lendo tenant e grupo_empresarial
135
- tenant, grupo_empresarial = _get_tenant_grupo()
140
+ tenant, grupo_empresarial, force_reload = _get_query_args()
136
141
 
137
142
  try:
138
143
  # Recuperando o código do DTO e Entity correspondente
@@ -144,7 +149,11 @@ def setup_dynamic_routes(
144
149
  api_expose,
145
150
  api_verbs,
146
151
  ) = entity_loader.load_entity_source(
147
- entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
152
+ entity_resource,
153
+ tenant,
154
+ grupo_empresarial,
155
+ escopo=entity_escopo,
156
+ force_reload=force_reload,
148
157
  )
149
158
 
150
159
  # Verificando se essa API deve ser exposta
@@ -181,7 +190,7 @@ def setup_dynamic_routes(
181
190
  entity_escopo = kwargs.pop("entity_escopo")
182
191
 
183
192
  # Lendo tenant e grupo_empresarial
184
- tenant, grupo_empresarial = _get_tenant_grupo()
193
+ tenant, grupo_empresarial, force_reload = _get_query_args()
185
194
 
186
195
  try:
187
196
  # Recuperando o código do DTO e Entity correspondente
@@ -193,7 +202,11 @@ def setup_dynamic_routes(
193
202
  api_expose,
194
203
  api_verbs,
195
204
  ) = entity_loader.load_entity_source(
196
- entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
205
+ entity_resource,
206
+ tenant,
207
+ grupo_empresarial,
208
+ escopo=entity_escopo,
209
+ force_reload=force_reload,
197
210
  )
198
211
 
199
212
  # Verificando se essa API deve ser exposta
@@ -230,7 +243,7 @@ def setup_dynamic_routes(
230
243
  entity_escopo = kwargs.pop("entity_escopo")
231
244
 
232
245
  # Lendo tenant e grupo_empresarial
233
- tenant, grupo_empresarial = _get_tenant_grupo()
246
+ tenant, grupo_empresarial, force_reload = _get_query_args()
234
247
 
235
248
  try:
236
249
  # Recuperando o código do DTO e Entity correspondente
@@ -242,7 +255,11 @@ def setup_dynamic_routes(
242
255
  api_expose,
243
256
  api_verbs,
244
257
  ) = entity_loader.load_entity_source(
245
- entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
258
+ entity_resource,
259
+ tenant,
260
+ grupo_empresarial,
261
+ escopo=entity_escopo,
262
+ force_reload=force_reload,
246
263
  )
247
264
 
248
265
  # Verificando se essa API deve ser exposta
@@ -279,7 +296,7 @@ def setup_dynamic_routes(
279
296
  entity_escopo = kwargs.pop("entity_escopo")
280
297
 
281
298
  # Lendo tenant e grupo_empresarial
282
- tenant, grupo_empresarial = _get_tenant_grupo()
299
+ tenant, grupo_empresarial, force_reload = _get_query_args()
283
300
 
284
301
  try:
285
302
  # Recuperando o código do DTO e Entity correspondente
@@ -291,7 +308,11 @@ def setup_dynamic_routes(
291
308
  api_expose,
292
309
  api_verbs,
293
310
  ) = entity_loader.load_entity_source(
294
- entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
311
+ entity_resource,
312
+ tenant,
313
+ grupo_empresarial,
314
+ escopo=entity_escopo,
315
+ force_reload=force_reload,
295
316
  )
296
317
 
297
318
  # Verificando se essa API deve ser exposta
@@ -328,7 +349,7 @@ def setup_dynamic_routes(
328
349
  entity_escopo = kwargs.pop("entity_escopo")
329
350
 
330
351
  # Lendo tenant e grupo_empresarial
331
- tenant, grupo_empresarial = _get_tenant_grupo()
352
+ tenant, grupo_empresarial, force_reload = _get_query_args()
332
353
 
333
354
  try:
334
355
  # Recuperando o código do DTO e Entity correspondente
@@ -340,7 +361,11 @@ def setup_dynamic_routes(
340
361
  api_expose,
341
362
  api_verbs,
342
363
  ) = entity_loader.load_entity_source(
343
- entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
364
+ entity_resource,
365
+ tenant,
366
+ grupo_empresarial,
367
+ escopo=entity_escopo,
368
+ force_reload=force_reload,
344
369
  )
345
370
 
346
371
  # Verificando se essa API deve ser exposta
@@ -47,6 +47,7 @@ class EntityLoader:
47
47
  tenant: str | None,
48
48
  grupo_empresarial: str | None,
49
49
  escopo: str = ESCOPO_RESTLIB2,
50
+ force_reload: bool = False,
50
51
  ) -> tuple[str, str, dict, bool, list[str]]:
51
52
  # Assumind o escopo default se necessário
52
53
  if not escopo:
@@ -89,13 +90,17 @@ class EntityLoader:
89
90
  str(rd.tenant),
90
91
  str(rd.grupo_empresarial),
91
92
  rd.entity_scope,
93
+ force_reload=force_reload,
92
94
  )
93
95
 
94
96
  # Se o tempo entre o carregamento e agora for maior do que MIN_TIME_SOURCE_REFRESH minutos,
95
97
  # verifica se precisa de refresh
96
98
  time_diff = datetime.datetime.now() - loaded_entity.loaded_at
97
99
 
98
- if time_diff.total_seconds() >= MIN_TIME_SOURCE_REFRESH * 60:
100
+ if (
101
+ time_diff.total_seconds() >= MIN_TIME_SOURCE_REFRESH * 60
102
+ or force_reload
103
+ ):
99
104
  # Renovando o tempo de refresh
100
105
  loaded_entity.loaded_at = datetime.datetime.now()
101
106
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nsj_rest_lib2
3
- Version: 0.0.24
3
+ Version: 0.0.26
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
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = nsj_rest_lib2
3
- version = 0.0.24
3
+ version = 0.0.26
4
4
  author = Nasajon Sistemas
5
5
  author_email = contact.dev@nasajon.com.br
6
6
  description = Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
File without changes