oplnk-python-utils 1.2.3__tar.gz → 1.2.4__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.
- {oplnk_python_utils-1.2.3/oplnk_python_utils.egg-info → oplnk_python_utils-1.2.4}/PKG-INFO +1 -1
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/__init__.py +1 -1
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/query/query_builder.py +34 -5
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4/oplnk_python_utils.egg-info}/PKG-INFO +1 -1
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/setup.py +1 -1
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/LICENSE +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/MANIFEST.in +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/README.md +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/cache/__init__.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/cache/cache_utils.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/core/__init__.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/core/data.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/core/parsing.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/core/serialization.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/query/__init__.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/reports/__init__.py +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/SOURCES.txt +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/dependency_links.txt +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/not-zip-safe +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/requires.txt +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/top_level.txt +0 -0
- {oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/setup.cfg +0 -0
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/query/query_builder.py
RENAMED
|
@@ -626,10 +626,11 @@ class QueryBuilder:
|
|
|
626
626
|
return {"$sort": sort_pipeline}
|
|
627
627
|
|
|
628
628
|
def build_fields_pipeline(
|
|
629
|
-
self, fields_params: List[str], populate_params: Optional[
|
|
629
|
+
self, fields_params: List[str], populate_params: Optional[Any] = None
|
|
630
630
|
) -> Dict[str, Any]:
|
|
631
631
|
"""
|
|
632
632
|
Build fields projection pipeline with support for dot notation and array notation.
|
|
633
|
+
Automatically includes aliases for populated fields when fields is specified.
|
|
633
634
|
"""
|
|
634
635
|
fields_pipeline = {}
|
|
635
636
|
|
|
@@ -648,15 +649,43 @@ class QueryBuilder:
|
|
|
648
649
|
|
|
649
650
|
# Process populate_params if provided
|
|
650
651
|
if populate_params:
|
|
651
|
-
|
|
652
|
+
# Convert to list if it's a dict
|
|
653
|
+
populate_list = (
|
|
654
|
+
populate_params
|
|
655
|
+
if isinstance(populate_params, list)
|
|
656
|
+
else list(populate_params.keys())
|
|
657
|
+
)
|
|
658
|
+
|
|
659
|
+
for field in populate_list:
|
|
652
660
|
try:
|
|
661
|
+
# Add the original field so sanitization can work
|
|
653
662
|
normalized_field = normalize_field_path(field)
|
|
654
663
|
if validate_field_path(normalized_field):
|
|
655
664
|
fields_pipeline[normalized_field] = 1
|
|
665
|
+
|
|
666
|
+
# Add the populated alias for audit fields
|
|
667
|
+
if field in RESERVED_AUDIT_FIELDS:
|
|
668
|
+
alias = RESERVED_AUDIT_FIELDS[field]["alias"]
|
|
669
|
+
normalized_alias = normalize_field_path(alias)
|
|
670
|
+
if validate_field_path(normalized_alias):
|
|
671
|
+
fields_pipeline[normalized_alias] = 1
|
|
656
672
|
else:
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
673
|
+
# For normal relations, find the alias and add it
|
|
674
|
+
for relation in self.relations:
|
|
675
|
+
relation_name = relation[1]
|
|
676
|
+
base_name = relation_name.replace("_ids", "").replace(
|
|
677
|
+
"_id", ""
|
|
678
|
+
)
|
|
679
|
+
if base_name == field:
|
|
680
|
+
# Use custom alias if provided (5th element)
|
|
681
|
+
if len(relation) > 4 and relation[4]:
|
|
682
|
+
alias = relation[4]
|
|
683
|
+
else:
|
|
684
|
+
alias = base_name
|
|
685
|
+
normalized_alias = normalize_field_path(alias)
|
|
686
|
+
if validate_field_path(normalized_alias):
|
|
687
|
+
fields_pipeline[normalized_alias] = 1
|
|
688
|
+
break
|
|
660
689
|
except Exception as e:
|
|
661
690
|
print(
|
|
662
691
|
f"Warning: Error processing populate field '{field}' in projection: {e}"
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="oplnk-python-utils",
|
|
5
|
-
version="1.2.
|
|
5
|
+
version="1.2.4",
|
|
6
6
|
author="OpenLink SpA",
|
|
7
7
|
author_email="contacto@openlink.cl",
|
|
8
8
|
description="Reusable utilities for caching, data manipulation, parsing, and MongoDB query building",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/cache/cache_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/core/serialization.py
RENAMED
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils/reports/__init__.py
RENAMED
|
File without changes
|
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/requires.txt
RENAMED
|
File without changes
|
{oplnk_python_utils-1.2.3 → oplnk_python_utils-1.2.4}/oplnk_python_utils.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|