@an5/adapters 0.1.2 → 0.1.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@an5/adapters",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Standalone language adapters for AN5 ORM - TypeScript, Python, .NET query execution.",
5
5
  "license": "MIT",
6
6
  "main": "typescript/index.js",
@@ -26,6 +26,19 @@ class AdapterTableClient:
26
26
  def _nolock(self) -> str:
27
27
  return "" if self._dialect == DIALECT_POSTGRES else " WITH (NOLOCK)"
28
28
 
29
+ @property
30
+ def _fields(self) -> List[Dict]:
31
+ fields = model_fields.get(self._model, [])
32
+ if isinstance(fields, dict):
33
+ normalized = []
34
+ for name, value in fields.items():
35
+ if isinstance(value, dict):
36
+ normalized.append({"name": name, **value})
37
+ else:
38
+ normalized.append({"name": name, "type": value})
39
+ return normalized
40
+ return fields
41
+
29
42
  def _pagination(self, take: Optional[int], skip: int, order_sql: str) -> str:
30
43
  if take is None:
31
44
  return ""
@@ -64,8 +77,7 @@ class AdapterTableClient:
64
77
  return int(rows[0]["cnt"]) if rows else 0
65
78
 
66
79
  def create(self, data: Dict) -> Dict:
67
- fields = model_fields.get(self._model, [])
68
- id_field = next((f for f in fields if f.get("isId")), None)
80
+ id_field = next((f for f in self._fields if f.get("isId")), None)
69
81
  if id_field and id_field["name"] not in data:
70
82
  data = {**data, id_field["name"]: str(uuid.uuid4())}
71
83