mgraph-ai-service-cache-client 0.2.0__py3-none-any.whl → 0.4.0__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.

Potentially problematic release.


This version of mgraph-ai-service-cache-client might be problematic. Click here for more details.

@@ -31,16 +31,19 @@ class Service__Fast_API__Client__File__Store(Type_Safe):
31
31
  # Return response data
32
32
  return result.json if result.json else result.text
33
33
 
34
- def store__string__cache_key(self, namespace: str, strategy: Enum__Cache__Store__Strategy, cache_key: str, file_id: Optional[str] = None) -> Dict: # Auto-generated from endpoint post__store__string__cache_key
34
+ def store__string__cache_key(self, namespace: str ,
35
+ strategy : Enum__Cache__Store__Strategy ,
36
+ cache_key: str ,
37
+ body : str ,
38
+ file_id : str = ''
39
+ ) -> Dict: # Auto-generated from endpoint post__store__string__cache_key
35
40
  # Build path
36
- path = f"/{{namespace}}/{{strategy}}/store/string/{cache_key:path}"
37
- body = None
41
+ path = f"/{namespace}/{strategy}/store/string/{cache_key}?file_id={file_id}"
42
+ #body = None
38
43
  # Execute request
39
- result = self.requests.execute(
40
- method = "POST",
41
- path = path,
42
- body = body
43
- )
44
+ result = self.requests.execute(method = "POST",
45
+ path = path ,
46
+ body = body )
44
47
  # Return response data
45
48
  return result.json if result.json else result.text
46
49
 
@@ -61,16 +64,18 @@ class Service__Fast_API__Client__File__Store(Type_Safe):
61
64
  # Return response data
62
65
  return result.json if result.json else result.text
63
66
 
64
- def store__json__cache_key(self, namespace: str, strategy: Enum__Cache__Store__Strategy, cache_key: str, file_id: Optional[str] = None) -> Dict: # Auto-generated from endpoint post__store__json__cache_key
67
+ def store__json__cache_key(self, namespace: str,
68
+ strategy : Enum__Cache__Store__Strategy,
69
+ cache_key: str,
70
+ body : dict ,
71
+ file_id : str = '') -> Dict: # Auto-generated from endpoint post__store__json__cache_key
65
72
  # Build path
66
- path = f"/{{namespace}}/{{strategy}}/store/json/{cache_key:path}"
67
- body = None
73
+ path = f"/{namespace}/{strategy}/store/json/{cache_key}?file_id={file_id}"
74
+ #body = None
68
75
  # Execute request
69
- result = self.requests.execute(
70
- method = "POST",
71
- path = path,
72
- body = body
73
- )
76
+ result = self.requests.execute(method = "POST",
77
+ path = path,
78
+ body = body)
74
79
  # Return response data
75
80
  return result.json if result.json else result.text
76
81
 
@@ -90,10 +95,14 @@ class Service__Fast_API__Client__File__Store(Type_Safe):
90
95
  # Return response data
91
96
  return result.json if result.json else result.text
92
97
 
93
- def store__binary__cache_key(self, namespace: str, strategy: Enum__Cache__Store__Strategy, cache_key: str, file_id: Optional[str] = None) -> Dict: # Auto-generated from endpoint post__store__binary__cache_key
98
+ def store__binary__cache_key(self, namespace: str,
99
+ strategy: Enum__Cache__Store__Strategy,
100
+ cache_key: str,
101
+ body = bytes ,
102
+ file_id: str = '') -> Dict: # Auto-generated from endpoint post__store__binary__cache_key
94
103
  # Build path
95
- path = f"/{{namespace}}/{{strategy}}/store/binary/{cache_key:path}"
96
- body = None
104
+ path = f"/{namespace}/{strategy}/store/binary/{cache_key}?file_id={file_id}"
105
+ #body = None
97
106
  # Execute request
98
107
  result = self.requests.execute(
99
108
  method = "POST",
@@ -0,0 +1,25 @@
1
+ import re
2
+ from osbot_utils.type_safe.primitives.core.Safe_Str import Safe_Str
3
+
4
+ TYPE_SAFE_STR__FIELD_PATH__REGEX = re.compile(r'[^a-zA-Z0-9_\-.]') # Allow dots for nesting
5
+ TYPE_SAFE_STR__FIELD_PATH__MAX_LENGTH = 256 # Longer to support deep nesting
6
+
7
+ class Safe_Str__Json__Field_Path(Safe_Str):
8
+ regex = TYPE_SAFE_STR__FIELD_PATH__REGEX
9
+ max_length = TYPE_SAFE_STR__FIELD_PATH__MAX_LENGTH
10
+ trim_whitespace = True
11
+
12
+ def __new__(cls, value: str = None):
13
+ if value:
14
+ if '..' in value: # Don't allow consecutive dots
15
+ raise ValueError(f"Field path cannot contain consecutive dots: '{value}'")
16
+
17
+ if value.startswith('.') or value.endswith('.'): # Don't allow leading/trailing dots
18
+ raise ValueError(f"Field path cannot start or end with a dot: '{value}'")
19
+
20
+ segments = value.split('.') # Each segment should be non-empty after splitting
21
+ for segment in segments:
22
+ if not segment:
23
+ raise ValueError(f"Field path has empty segment: '{value}'")
24
+
25
+ return Safe_Str.__new__(cls, value)
@@ -4,8 +4,9 @@ from osbot_utils.type_safe.primitives.domains.identifiers.Random_Guid
4
4
  from osbot_utils.type_safe.primitives.domains.identifiers.safe_str.Safe_Str__Id import Safe_Str__Id
5
5
  from osbot_utils.type_safe.primitives.domains.identifiers.safe_int.Timestamp_Now import Timestamp_Now
6
6
  from osbot_utils.type_safe.primitives.domains.cryptography.safe_str.Safe_Str__Cache_Hash import Safe_Str__Cache_Hash
7
- from mgraph_ai_service_cache_client.schemas.cache.enums.Enum__Cache__File_Type import Enum__Cache__File_Type
8
- from mgraph_ai_service_cache_client.schemas.cache.enums.Enum__Cache__Store__Strategy import Enum__Cache__Store__Strategy
7
+ from mgraph_ai_service_cache_client.schemas.cache.enums.Enum__Cache__File_Type import Enum__Cache__File_Type
8
+ from mgraph_ai_service_cache_client.schemas.cache.enums.Enum__Cache__Store__Strategy import Enum__Cache__Store__Strategy
9
+ from mgraph_ai_service_cache_client.schemas.cache.safe_str.Safe_Str__Json__Field_Path import Safe_Str__Json__Field_Path
9
10
 
10
11
 
11
12
  class Schema__Cache__Store__Metadata(Type_Safe): # Metadata for stored cache entries
@@ -14,7 +15,9 @@ class Schema__Cache__Store__Metadata(Type_Safe):
14
15
  cache_id : Random_Guid = None # Cache entry ID
15
16
  content_encoding : Safe_Str__Id = None # Optional encoding
16
17
  file_id : Safe_Str__Id = None # File ID used for storage
18
+ file_type : Enum__Cache__File_Type = None # Type: 'json' or 'binary'
19
+ json_field_path : Safe_Str__Json__Field_Path = None # Field Path used to calculate the hash of a Json object
20
+ namespace : Safe_Str__Id = None # Namespace
17
21
  stored_at : Timestamp_Now = None # When stored
18
22
  strategy : Enum__Cache__Store__Strategy = None # Storage strategy used
19
- namespace : Safe_Str__Id = None # Namespace
20
- file_type : Enum__Cache__File_Type = None # Type: 'json' or 'binary'
23
+
@@ -1,23 +1,25 @@
1
- from typing import Union, Dict, List
1
+ from typing import Union, Dict
2
2
  from osbot_utils.type_safe.Type_Safe import Type_Safe
3
3
  from osbot_utils.type_safe.primitives.domains.cryptography.safe_str.Safe_Str__Cache_Hash import Safe_Str__Cache_Hash
4
4
  from osbot_utils.type_safe.primitives.domains.files.safe_str.Safe_Str__File__Path import Safe_Str__File__Path
5
5
  from osbot_utils.type_safe.primitives.domains.identifiers.Random_Guid import Random_Guid
6
6
  from osbot_utils.type_safe.primitives.domains.identifiers.safe_int.Timestamp_Now import Timestamp_Now
7
7
  from osbot_utils.type_safe.primitives.domains.identifiers.safe_str.Safe_Str__Id import Safe_Str__Id
8
- from mgraph_ai_service_cache_client.schemas.cache.enums.Enum__Cache__Store__Strategy import Enum__Cache__Store__Strategy
9
- from mgraph_ai_service_cache_client.schemas.cache.file.Schema__Cache__File__Paths import Schema__Cache__File__Paths
10
- from mgraph_ai_service_cache_client.schemas.cache.store.Schema__Cache__Store__Metadata import Schema__Cache__Store__Metadata
11
- from mgraph_ai_service_cache_client.schemas.cache.store.Schema__Cache__Store__Paths import Schema__Cache__Store__Paths
8
+ from mgraph_ai_service_cache_client.schemas.cache.enums.Enum__Cache__Store__Strategy import Enum__Cache__Store__Strategy
9
+ from mgraph_ai_service_cache_client.schemas.cache.file.Schema__Cache__File__Paths import Schema__Cache__File__Paths
10
+ from mgraph_ai_service_cache_client.schemas.cache.safe_str.Safe_Str__Json__Field_Path import Safe_Str__Json__Field_Path
11
+ from mgraph_ai_service_cache_client.schemas.cache.store.Schema__Cache__Store__Metadata import Schema__Cache__Store__Metadata
12
+ from mgraph_ai_service_cache_client.schemas.cache.store.Schema__Cache__Store__Paths import Schema__Cache__Store__Paths
12
13
  from mgraph_ai_service_cache.service.cache.Cache__Handler import Cache__Handler
13
14
 
14
15
 
15
- class Schema__Store__Context(Type_Safe): # Context object to pass data between store operations
16
+ class Schema__Store__Context(Type_Safe): # Context object to pass data between store operations
16
17
  storage_data : Union[str, Dict, bytes] # Data to be stored (string, dict, or bytes)
17
18
  cache_hash : Safe_Str__Cache_Hash = None # Hash of the data or cache key
18
19
  cache_id : Random_Guid = None # Unique ID for this cache entry
19
20
  cache_key : Safe_Str__File__Path = None # Optional semantic cache key
20
21
  file_id : Safe_Str__Id = None # Optional file ID (defaults to cache_id)
22
+ json_field_path : Safe_Str__Json__Field_Path = None # Field Path used to calculate the hash of a Json object
21
23
  namespace : Safe_Str__Id = None # Namespace for isolation
22
24
  strategy : Enum__Cache__Store__Strategy = None # Storage strategy to use
23
25
  content_encoding : Safe_Str__Id = None # Optional encoding (e.g., 'gzip')
@@ -1 +1 @@
1
- v0.2.0
1
+ v0.4.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mgraph_ai_service_cache__client
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: MGraph-AI__Service__Cache__Client
5
5
  Home-page: https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client
6
6
  License: Apache 2.0
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
 
18
18
  # MGraph AI Service Cache Client
19
19
 
20
- [![Current Release](https://img.shields.io/badge/release-v0.2.0-blue)](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/releases)
20
+ [![Current Release](https://img.shields.io/badge/release-v0.4.0-blue)](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/releases)
21
21
  [![Python](https://img.shields.io/badge/python-3.12-blue)](https://www.python.org/downloads/)
22
22
  [![FastAPI](https://img.shields.io/badge/FastAPI-0.116.1-009688)](https://fastapi.tiangolo.com/)
23
23
  [![AWS Lambda](https://img.shields.io/badge/AWS-Lambda-orange)](https://aws.amazon.com/lambda/)
@@ -22,7 +22,7 @@ mgraph_ai_service_cache_client/client_contract/info/Service__Fast_API__Client__I
22
22
  mgraph_ai_service_cache_client/client_contract/namespace/Service__Fast_API__Client__Namespace.py,sha256=RbYDhi7MpCPQj2JZS4VaJ4Rn-90sx4na9ZVpt5z-p_I,2477
23
23
  mgraph_ai_service_cache_client/client_contract/retrieve/Service__Fast_API__Client__File__Retrieve.py,sha256=OjPNZ_i1d8iwqhWromodLxBknXee2gF9TLh1BKvOgLg,10010
24
24
  mgraph_ai_service_cache_client/client_contract/server/Service__Fast_API__Client__Server.py,sha256=o6hD0utM9n48BLW0I1mVdGcCIyODywKm4dnTlfL6uXE,1797
25
- mgraph_ai_service_cache_client/client_contract/store/Service__Fast_API__Client__File__Store.py,sha256=fDUYs_zXSlT6rbbVixmZj2PYQKpuvQKaQ7_oyrwlbY8,6725
25
+ mgraph_ai_service_cache_client/client_contract/store/Service__Fast_API__Client__File__Store.py,sha256=tRuwGYdNNe9XrX9ZKU1F_KlT0nCVxyCIvjpM7cgGmqk,7421
26
26
  mgraph_ai_service_cache_client/client_contract/zip/Service__Fast_API__Client__Zip.py,sha256=vDlvGIk_p0TIrDq0ElWN4r2ijD2oExWWTdrZawwKOdM,7456
27
27
  mgraph_ai_service_cache_client/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  mgraph_ai_service_cache_client/schemas/cache/Schema__Cache__Binary__Reference.py,sha256=7k4etDRNSXwOzf5KLYC9Ygo5vor8yx_fmc5sJCLF0Dk,1766
@@ -52,11 +52,13 @@ mgraph_ai_service_cache_client/schemas/cache/enums/__init__.py,sha256=47DEQpj8HB
52
52
  mgraph_ai_service_cache_client/schemas/cache/file/Schema__Cache__File__Paths.py,sha256=8MuRXyOtcWMcJ1z9SFesB5-vgoACDxkEpgeeR3S5tFU,506
53
53
  mgraph_ai_service_cache_client/schemas/cache/file/Schema__Cache__File__Refs.py,sha256=3k2tJPeHcK0dyoBs2HNev-dVAQG4fKPpxMFMff5WImQ,1901
54
54
  mgraph_ai_service_cache_client/schemas/cache/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ mgraph_ai_service_cache_client/schemas/cache/safe_str/Safe_Str__Json__Field_Path.py,sha256=NZZ-6oHgRInqyTIUicrxlz0NZbvcWhEZGTxgK-KvFW0,1325
56
+ mgraph_ai_service_cache_client/schemas/cache/safe_str/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
57
  mgraph_ai_service_cache_client/schemas/cache/store/Schema__Cache__Hash__Entry.py,sha256=TZ_X4ZGB0aqhaH7Hrts8raV-q1fJogUheVy_qLrQQo0,514
56
58
  mgraph_ai_service_cache_client/schemas/cache/store/Schema__Cache__Hash__Reference.py,sha256=vCoduQezCOJnS9OUPfmHU2IZa4U9qDJPPqo7RsrFlIE,1040
57
- mgraph_ai_service_cache_client/schemas/cache/store/Schema__Cache__Store__Metadata.py,sha256=P4HufeteFtiPVdOmVWiNDhuiDNRDVMnpe5nRoyo48iE,2070
59
+ mgraph_ai_service_cache_client/schemas/cache/store/Schema__Cache__Store__Metadata.py,sha256=dKEI87QOmj8sUmi0m95jMaYOsJPhO1eVloc-5CGn_Sw,2331
58
60
  mgraph_ai_service_cache_client/schemas/cache/store/Schema__Cache__Store__Paths.py,sha256=oH1CewYuyShdkzKpCoaUQH3qMvwju7Gp7dD04Hf6YWo,666
59
- mgraph_ai_service_cache_client/schemas/cache/store/Schema__Store__Context.py,sha256=JuzMqATcAjZbjyem7EbZzRNQuW2CY0hasjqE3za9Lbg,3454
61
+ mgraph_ai_service_cache_client/schemas/cache/store/Schema__Store__Context.py,sha256=coCKBJw-oINPx0bwvwclrLIaYWeFBWGW3c35Tsq_rjc,3778
60
62
  mgraph_ai_service_cache_client/schemas/cache/store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
63
  mgraph_ai_service_cache_client/schemas/cache/zip/Schema__Cache__Zip__Batch__Request.py,sha256=a1AfQbZF9ByA6GD3TpGpYQS7TbhwAWzPFgDkeDqClKY,1497
62
64
  mgraph_ai_service_cache_client/schemas/cache/zip/Schema__Cache__Zip__Batch__Response.py,sha256=ibuddxNLSUEespCdwfeBJeJjX16VvqgqH_ZjY8K6g0Q,2723
@@ -93,8 +95,8 @@ mgraph_ai_service_cache_client/schemas/errors/Schema__Cache__Error__Unsupported_
93
95
  mgraph_ai_service_cache_client/schemas/errors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
96
  mgraph_ai_service_cache_client/utils/Version.py,sha256=-iKgWjUzrm9eGMdLFsvKPuxZFckmfNE5Y5bw6vSydhY,797
95
97
  mgraph_ai_service_cache_client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
- mgraph_ai_service_cache_client/version,sha256=-zFmPoQ9UG8sK7N1uxJbjpnoaSSC2QPn_c9arR9fcrI,7
97
- mgraph_ai_service_cache_client-0.2.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
98
- mgraph_ai_service_cache_client-0.2.0.dist-info/METADATA,sha256=NLZX0FmMfcce_xFsuG6-pyA4Fjf6dts1Jp4NTRqk_p4,9885
99
- mgraph_ai_service_cache_client-0.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
100
- mgraph_ai_service_cache_client-0.2.0.dist-info/RECORD,,
98
+ mgraph_ai_service_cache_client/version,sha256=zBGyinqIPmH_DS6p1sYeDvoOFlX6a5F143lEW-yMHFU,7
99
+ mgraph_ai_service_cache_client-0.4.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
100
+ mgraph_ai_service_cache_client-0.4.0.dist-info/METADATA,sha256=1P6ETXSvtggu-hFes0NU09wA1nRIbL3Ah9GwgDkFZFg,9885
101
+ mgraph_ai_service_cache_client-0.4.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
102
+ mgraph_ai_service_cache_client-0.4.0.dist-info/RECORD,,