konecty-sdk-python 2.3.0__py3-none-any.whl → 2.3.1__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.
@@ -8,6 +8,7 @@ from .cross_module_query import (
8
8
  CrossModuleQuery,
9
9
  CrossModuleRelation,
10
10
  )
11
+ from .derived import Computed, DerivedExpression, DerivedOp, DerivedOperand
11
12
  from .kpi import KpiConfig, KpiOperation
12
13
  from .query_json import (
13
14
  AggregatorName,
@@ -27,10 +28,14 @@ __all__ = [
27
28
  "Aggregator",
28
29
  "AggregatorName",
29
30
  "AggregatorSpec",
31
+ "Computed",
30
32
  "ConditionValue",
31
33
  "CrossModuleQuery",
32
34
  "CrossModuleRelation",
33
35
  "DEFAULT_PRIMARY_LIMIT",
36
+ "DerivedExpression",
37
+ "DerivedOp",
38
+ "DerivedOperand",
34
39
  "ExplicitJoinCondition",
35
40
  "FilterMatch",
36
41
  "KpiConfig",
@@ -4,6 +4,8 @@ from typing import Any, Dict, List, Optional, Union
4
4
 
5
5
  from pydantic import BaseModel, Field
6
6
 
7
+ from .derived import DerivedExpression
8
+
7
9
  MAX_RELATIONS = 10
8
10
  MAX_NESTING_DEPTH = 2
9
11
  MAX_RELATION_LIMIT = 100_000
@@ -72,6 +74,9 @@ class CrossModuleQuery(BaseModel):
72
74
  )
73
75
  groupBy: List[str] = Field(default_factory=list, alias="groupBy")
74
76
  aggregators: Dict[str, Aggregator] = Field(default_factory=dict)
77
+ #: Campos derivados do documento primário (ADR-0025); o alias vale em filter, sort,
78
+ #: groupBy e aggregators[*].field.
79
+ computed: Optional[Dict[str, DerivedExpression]] = None
75
80
  includeTotal: bool = Field(default=True, alias="includeTotal")
76
81
  includeMeta: bool = Field(default=False, alias="includeMeta")
77
82
 
@@ -0,0 +1,39 @@
1
+ """Campo derivado (ADR-0025 no repo Konecty).
2
+
3
+ Campo numérico que o chamador declara numa consulta, calculado no servidor por uma
4
+ expressão sobre campos ``number``/``money`` do documento primário. Volta em todo
5
+ registro e vale em ``filter`` (operadores numéricos), ``sort`` e, na consulta
6
+ cross-module, em ``groupBy`` e ``aggregators[*].field``.
7
+
8
+ O SDK só modela e transporta: alias, aridade, limites (10 campos, profundidade 3,
9
+ 10 operandos) e permissão são decididos pelo servidor, que recusa com
10
+ ``DERIVED_FIELD_INVALID`` (forma) ou ``DERIVED_FIELD_UNAVAILABLE`` (permissão).
11
+ Mesma forma no SDK TypeScript: ``src/sdk/types/derived.ts``.
12
+ """
13
+
14
+ from typing import Dict, List, Literal, Union
15
+
16
+ from pydantic import BaseModel
17
+
18
+ DerivedOp = Literal["add", "subtract", "multiply", "coalesce"]
19
+
20
+
21
+ class DerivedExpression(BaseModel):
22
+ """Nó da expressão: ``{"op", "args"}``.
23
+
24
+ ``args``: ``str`` = campo do documento primário (``money`` sem sufixo lê
25
+ ``.value``), ``int``/``float`` = literal, ``DerivedExpression`` = nó aninhado.
26
+ ``add``/``subtract``/``multiply`` ≥ 2 args (``subtract`` da esquerda para a
27
+ direita); ``coalesce`` exatamente 2, o segundo literal.
28
+ """
29
+
30
+ op: DerivedOp
31
+ args: List[Union[str, int, float, "DerivedExpression"]]
32
+
33
+
34
+ DerivedExpression.model_rebuild()
35
+
36
+ DerivedOperand = Union[str, int, float, DerivedExpression]
37
+
38
+ #: ``computed`` de ``KonectyFindParams`` e de ``CrossModuleQuery``: alias → expressão.
39
+ Computed = Dict[str, DerivedExpression]
@@ -4,6 +4,8 @@ from typing import Any, Dict, List, Mapping, Optional, TypedDict, Union
4
4
 
5
5
  from pydantic import BaseModel, Field
6
6
 
7
+ from .feature_types.derived import DerivedExpression
8
+
7
9
 
8
10
  class FilterMatch(str, Enum):
9
11
  """Tipo de correspondência do filtro."""
@@ -289,3 +291,7 @@ class KonectyFindParams(BaseModel):
289
291
  limit: Optional[int] = None
290
292
  sort: Optional[List[SortOrder]] = None
291
293
  fields: Optional[List[Union[str, int]]] = None
294
+ #: Campos derivados (ADR-0025): ``{alias: DerivedExpression}``, calculados no servidor
295
+ #: e devolvidos em todo registro; o alias vale em ``filter`` e ``sort``. Vai na query
296
+ #: string como JSON, igual a ``filter``/``sort``. Ver ``feature_types/derived.py``.
297
+ computed: Optional[Dict[str, DerivedExpression]] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: konecty_sdk_python
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Konecty SDK Python
5
5
  Author-email: Leonardo Leal <leonardo.leal@konecty.com>, Derotino Silveira <derotino.silveira@konecty.com>
6
6
  License: MIT
@@ -7,14 +7,15 @@ KonectySdkPython/lib/__init__.py,sha256=Du8jLNfFG1bQuHX5u7pAhbyV9TjC7Ie9K1Xo1KSU
7
7
  KonectySdkPython/lib/client.py,sha256=cVofO8V6sn0ebpS33ru6As03a6lYWTXInzfXoSpjNaE,44543
8
8
  KonectySdkPython/lib/exceptions.py,sha256=rt6AeA2t-ipwx5yiere0lQFnSI5h5zuwgwMwBCKbsx4,11972
9
9
  KonectySdkPython/lib/file_manager.py,sha256=CLpOJWdA1tb2iq0qOIeRyEEIuACRq9tIo7Rls1YT2ig,9986
10
- KonectySdkPython/lib/filters.py,sha256=1JPNqxFDJKOr9zgdcaYtUHTWf3M_I7xNDGXif2Pvsyo,9677
10
+ KonectySdkPython/lib/filters.py,sha256=9jMiecXNjifh5LVXp4GMyWuF-3ob3ZjgsJHwRxMryb8,10060
11
11
  KonectySdkPython/lib/http.py,sha256=lHb1GFN9OBGgZcC9TkP57S-KqnmeHbOzizq72OvChgk,3571
12
12
  KonectySdkPython/lib/model.py,sha256=8ok1VzPGpXQklz2fJwjP8HT0aKOzhtE93BzcgfVw4zY,2846
13
13
  KonectySdkPython/lib/serialization.py,sha256=HxA2t7uPv-4aqkGHMUF8WgP1RcTg6RXsFmr-nUhtx7E,401
14
14
  KonectySdkPython/lib/settings.py,sha256=Xbv-KTVM-oxvj-hJQFv2-vbsv4R5aV4D3XWOSdpw6as,5245
15
15
  KonectySdkPython/lib/types.py,sha256=Gh8BgoMFug2ixXGs99d3MMFl_JlfRCUdGBLjLAtF_aE,12766
16
- KonectySdkPython/lib/feature_types/__init__.py,sha256=IooLjxKUkp-uuB8M295FCiKwwrvn7ijp180Q4Lv0Ees,1010
17
- KonectySdkPython/lib/feature_types/cross_module_query.py,sha256=kG21qBMgCWd2gE1MGRYMvIAQb9ocB-epiKtNJH5t-eQ,2439
16
+ KonectySdkPython/lib/feature_types/__init__.py,sha256=7xjvAdqHh-g2gk8AYw5lrtRvnjcXfjUmGJNYm9Jl8Ws,1166
17
+ KonectySdkPython/lib/feature_types/cross_module_query.py,sha256=G6EEd4_XaOXWg2irwVqlQO6ObPu9dYLMsXKS_HOXcdM,2667
18
+ KonectySdkPython/lib/feature_types/derived.py,sha256=BkhWPiY9XitpU1sf7svSGLZeVJu18A9FjIsbAvAJO4Q,1499
18
19
  KonectySdkPython/lib/feature_types/kpi.py,sha256=67RpwwwnzU8piIPRyFb6Kn0hqSRpT9RFbYqiRnvYkFk,626
19
20
  KonectySdkPython/lib/feature_types/query_json.py,sha256=yZgMPmkMdiBLm-dIrmU1AeZe5G9zQLwLtKUPMb7IOhU,8139
20
21
  KonectySdkPython/lib/services/__init__.py,sha256=fluQuxs6LnIZwcjYTuKNeXCFTKuNF3At3X19fIB68p8,121
@@ -31,7 +32,7 @@ KonectySdkPython/lib/services/pat.py,sha256=yelMEubMX4G5aB5-4h-QAYjeQrqJp48AsapM
31
32
  KonectySdkPython/lib/services/query.py,sha256=vCqbf0QdV8Blh8Hfsvq6Ne1-YFuC5siw1gVa7ZBGs_k,6605
32
33
  KonectySdkPython/lib/services/stream.py,sha256=1DMVxcg9Ymk2NgX0Qfvpjrr6vZJo5iFovPFT1NA3_CY,4737
33
34
  KonectySdkPython/lib/services/subscriptions.py,sha256=_Jq8jW7YkL_hwLNte1bWgrr4D2EMZUUSOXUgnRoGGK4,1022
34
- konecty_sdk_python-2.3.0.dist-info/METADATA,sha256=LXJNpbT3a-Q8rxVVXPlGguJH9MXjzUTMvpLbkWqXbAc,5442
35
- konecty_sdk_python-2.3.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
36
- konecty_sdk_python-2.3.0.dist-info/entry_points.txt,sha256=awf962DamFgy791G3PsJ354edBMLJg16Dqi-2Y1tb9s,58
37
- konecty_sdk_python-2.3.0.dist-info/RECORD,,
35
+ konecty_sdk_python-2.3.1.dist-info/METADATA,sha256=3fpxkAgFrzQCxrR_a-p2sYoYXJghsiIPz9ZciVG8Pcs,5442
36
+ konecty_sdk_python-2.3.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
37
+ konecty_sdk_python-2.3.1.dist-info/entry_points.txt,sha256=awf962DamFgy791G3PsJ354edBMLJg16Dqi-2Y1tb9s,58
38
+ konecty_sdk_python-2.3.1.dist-info/RECORD,,