nsj-rest-lib2 0.0.23__tar.gz → 0.0.24__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.23 → nsj_rest_lib2-0.0.24}/PKG-INFO +1 -1
  2. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/controller/dynamic_controller.py +47 -8
  3. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/service/entity_loader.py +4 -0
  4. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2.egg-info/PKG-INFO +1 -1
  5. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/setup.cfg +1 -1
  6. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/README.md +0 -0
  7. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/__init__.py +0 -0
  8. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/__init__.py +0 -0
  9. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/ai_compiler.py +0 -0
  10. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/compiler.py +0 -0
  11. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/compiler_structures.py +0 -0
  12. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/dto_compiler.py +0 -0
  13. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/__init__.py +0 -0
  14. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/ai_entity_edl.py +0 -0
  15. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/api_model.py +0 -0
  16. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/column_meta_model.py +0 -0
  17. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/entity_model.py +0 -0
  18. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/entity_model_base.py +0 -0
  19. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/entity_model_root.py +0 -0
  20. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/index_model.py +0 -0
  21. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/primitives.py +0 -0
  22. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/property_meta_model.py +0 -0
  23. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/repository_model.py +0 -0
  24. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/edl_model/trait_property_meta_model.py +0 -0
  25. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/entity_compiler.py +0 -0
  26. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/model.py +0 -0
  27. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/property_compiler.py +0 -0
  28. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/util/__init__.py +0 -0
  29. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/util/str_util.py +0 -0
  30. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/util/type_naming_util.py +0 -0
  31. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/compiler/util/type_util.py +0 -0
  32. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/controller/__init__.py +0 -0
  33. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/exception.py +0 -0
  34. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/redis_config.py +0 -0
  35. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/service/__init__.py +0 -0
  36. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2/settings.py +0 -0
  37. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2.egg-info/SOURCES.txt +0 -0
  38. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2.egg-info/dependency_links.txt +0 -0
  39. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2.egg-info/requires.txt +0 -0
  40. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/nsj_rest_lib2.egg-info/top_level.txt +0 -0
  41. {nsj_rest_lib2-0.0.23 → nsj_rest_lib2-0.0.24}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nsj_rest_lib2
3
- Version: 0.0.23
3
+ Version: 0.0.24
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
@@ -53,10 +53,19 @@ def setup_dynamic_routes(
53
53
  multidb: bool = True,
54
54
  dynamic_root_path: str = "edl1",
55
55
  injector_factory: Any = None,
56
+ escopo_in_url: bool = False,
56
57
  ) -> None:
57
58
 
58
- COLLECTION_DYNAMIC_ROUTE = f"/{APP_NAME}/{dynamic_root_path}/<entity_resource>"
59
- ONE_DYNAMIC_ROUTE = f"/{APP_NAME}/{dynamic_root_path}/<entity_resource>/<id>"
59
+ if not escopo_in_url:
60
+ COLLECTION_DYNAMIC_ROUTE = f"/{APP_NAME}/{dynamic_root_path}/<entity_resource>"
61
+ ONE_DYNAMIC_ROUTE = f"/{APP_NAME}/{dynamic_root_path}/<entity_resource>/<id>"
62
+ else:
63
+ COLLECTION_DYNAMIC_ROUTE = (
64
+ f"/{APP_NAME}/{dynamic_root_path}/<entity_escopo>/<entity_resource>"
65
+ )
66
+ ONE_DYNAMIC_ROUTE = (
67
+ f"/{APP_NAME}/{dynamic_root_path}/<entity_escopo>/<entity_resource>/<id>"
68
+ )
60
69
 
61
70
  def list_dynamic_wrapper(injector_factory: Any, *args: Any, **kwargs: Any) -> Any:
62
71
 
@@ -67,6 +76,11 @@ def setup_dynamic_routes(
67
76
  return (format_json_error(msg), 400, {**DEFAULT_RESP_HEADERS})
68
77
  entity_resource = kwargs.pop("entity_resource")
69
78
 
79
+ # Verificando se o identificador do escopo foi passado na URL
80
+ entity_escopo = ""
81
+ if "entity_escopo" in kwargs:
82
+ entity_escopo = kwargs.pop("entity_escopo")
83
+
70
84
  # Lendo tenant e grupo_empresarial
71
85
  tenant, grupo_empresarial = _get_tenant_grupo()
72
86
 
@@ -80,7 +94,7 @@ def setup_dynamic_routes(
80
94
  api_expose,
81
95
  api_verbs,
82
96
  ) = entity_loader.load_entity_source(
83
- entity_resource, tenant, grupo_empresarial
97
+ entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
84
98
  )
85
99
 
86
100
  # Verificando se essa API deve ser exposta
@@ -112,6 +126,11 @@ def setup_dynamic_routes(
112
126
  return (format_json_error(msg), 400, {**DEFAULT_RESP_HEADERS})
113
127
  entity_resource = kwargs.pop("entity_resource")
114
128
 
129
+ # Verificando se o identificador do escopo foi passado na URL
130
+ entity_escopo = ""
131
+ if "entity_escopo" in kwargs:
132
+ entity_escopo = kwargs.pop("entity_escopo")
133
+
115
134
  # Lendo tenant e grupo_empresarial
116
135
  tenant, grupo_empresarial = _get_tenant_grupo()
117
136
 
@@ -125,7 +144,7 @@ def setup_dynamic_routes(
125
144
  api_expose,
126
145
  api_verbs,
127
146
  ) = entity_loader.load_entity_source(
128
- entity_resource, tenant, grupo_empresarial
147
+ entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
129
148
  )
130
149
 
131
150
  # Verificando se essa API deve ser exposta
@@ -156,6 +175,11 @@ def setup_dynamic_routes(
156
175
  return (format_json_error(msg), 400, {**DEFAULT_RESP_HEADERS})
157
176
  entity_resource = kwargs.pop("entity_resource")
158
177
 
178
+ # Verificando se o identificador do escopo foi passado na URL
179
+ entity_escopo = ""
180
+ if "entity_escopo" in kwargs:
181
+ entity_escopo = kwargs.pop("entity_escopo")
182
+
159
183
  # Lendo tenant e grupo_empresarial
160
184
  tenant, grupo_empresarial = _get_tenant_grupo()
161
185
 
@@ -169,7 +193,7 @@ def setup_dynamic_routes(
169
193
  api_expose,
170
194
  api_verbs,
171
195
  ) = entity_loader.load_entity_source(
172
- entity_resource, tenant, grupo_empresarial
196
+ entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
173
197
  )
174
198
 
175
199
  # Verificando se essa API deve ser exposta
@@ -200,6 +224,11 @@ def setup_dynamic_routes(
200
224
  return (format_json_error(msg), 400, {**DEFAULT_RESP_HEADERS})
201
225
  entity_resource = kwargs.pop("entity_resource")
202
226
 
227
+ # Verificando se o identificador do escopo foi passado na URL
228
+ entity_escopo = ""
229
+ if "entity_escopo" in kwargs:
230
+ entity_escopo = kwargs.pop("entity_escopo")
231
+
203
232
  # Lendo tenant e grupo_empresarial
204
233
  tenant, grupo_empresarial = _get_tenant_grupo()
205
234
 
@@ -213,7 +242,7 @@ def setup_dynamic_routes(
213
242
  api_expose,
214
243
  api_verbs,
215
244
  ) = entity_loader.load_entity_source(
216
- entity_resource, tenant, grupo_empresarial
245
+ entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
217
246
  )
218
247
 
219
248
  # Verificando se essa API deve ser exposta
@@ -244,6 +273,11 @@ def setup_dynamic_routes(
244
273
  return (format_json_error(msg), 400, {**DEFAULT_RESP_HEADERS})
245
274
  entity_resource = kwargs.pop("entity_resource")
246
275
 
276
+ # Verificando se o identificador do escopo foi passado na URL
277
+ entity_escopo = ""
278
+ if "entity_escopo" in kwargs:
279
+ entity_escopo = kwargs.pop("entity_escopo")
280
+
247
281
  # Lendo tenant e grupo_empresarial
248
282
  tenant, grupo_empresarial = _get_tenant_grupo()
249
283
 
@@ -257,7 +291,7 @@ def setup_dynamic_routes(
257
291
  api_expose,
258
292
  api_verbs,
259
293
  ) = entity_loader.load_entity_source(
260
- entity_resource, tenant, grupo_empresarial
294
+ entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
261
295
  )
262
296
 
263
297
  # Verificando se essa API deve ser exposta
@@ -288,6 +322,11 @@ def setup_dynamic_routes(
288
322
  return (format_json_error(msg), 400, {**DEFAULT_RESP_HEADERS})
289
323
  entity_resource = kwargs.pop("entity_resource")
290
324
 
325
+ # Verificando se o identificador do escopo foi passado na URL
326
+ entity_escopo = ""
327
+ if "entity_escopo" in kwargs:
328
+ entity_escopo = kwargs.pop("entity_escopo")
329
+
291
330
  # Lendo tenant e grupo_empresarial
292
331
  tenant, grupo_empresarial = _get_tenant_grupo()
293
332
 
@@ -301,7 +340,7 @@ def setup_dynamic_routes(
301
340
  api_expose,
302
341
  api_verbs,
303
342
  ) = entity_loader.load_entity_source(
304
- entity_resource, tenant, grupo_empresarial
343
+ entity_resource, tenant, grupo_empresarial, escopo=entity_escopo
305
344
  )
306
345
 
307
346
  # Verificando se essa API deve ser exposta
@@ -48,6 +48,10 @@ class EntityLoader:
48
48
  grupo_empresarial: str | None,
49
49
  escopo: str = ESCOPO_RESTLIB2,
50
50
  ) -> tuple[str, str, dict, bool, list[str]]:
51
+ # Assumind o escopo default se necessário
52
+ if not escopo:
53
+ escopo = ESCOPO_RESTLIB2
54
+
51
55
  # Montando as chaves dos namespaces
52
56
  grupo_key, tenant_key, default_key = compile_namespace_keys(
53
57
  tenant, grupo_empresarial
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nsj_rest_lib2
3
- Version: 0.0.23
3
+ Version: 0.0.24
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.23
3
+ version = 0.0.24
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