poelis-sdk 0.1.8__py3-none-any.whl → 0.1.9__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 poelis-sdk might be problematic. Click here for more details.

poelis_sdk/browser.py CHANGED
@@ -99,11 +99,11 @@ class _Node:
99
99
  if self._level != "item":
100
100
  self._props_cache = []
101
101
  return self._props_cache
102
- # Try direct properties(item_id: ...) first; fallback to searchProperties
102
+ # Try direct properties(itemId: ...) first; fallback to searchProperties
103
103
  q = (
104
104
  "query($iid: ID!) {\n"
105
- " properties(item_id: $iid) {\n"
106
- " __typename id name owner\n"
105
+ " properties(itemId: $iid) {\n"
106
+ " __typename\n"
107
107
  " ... on NumericProperty { integerPart exponent category }\n"
108
108
  " ... on TextProperty { value }\n"
109
109
  " ... on DateProperty { value }\n"
@@ -121,7 +121,7 @@ class _Node:
121
121
  q2 = (
122
122
  "query($iid: ID!, $limit: Int!, $offset: Int!) {\n"
123
123
  " searchProperties(q: \"*\", itemId: $iid, limit: $limit, offset: $offset) {\n"
124
- " hits { id name propertyType category textValue numericValue dateValue owner }\n"
124
+ " hits { id workspaceId productId itemId propertyType name category value owner }\n"
125
125
  " }\n"
126
126
  "}"
127
127
  )
@@ -139,9 +139,19 @@ class _Node:
139
139
  if self._level != "item":
140
140
  return out
141
141
  props = self.properties
142
- for pr in props:
143
- display = pr.get("name") or pr.get("id")
142
+ used_names: Dict[str, int] = {}
143
+ for i, pr in enumerate(props):
144
+ # Try to get name from various possible fields
145
+ display = pr.get("name") or pr.get("id") or pr.get("category") or f"property_{i}"
144
146
  safe = _safe_key(str(display))
147
+
148
+ # Handle duplicate names by adding a suffix
149
+ if safe in used_names:
150
+ used_names[safe] += 1
151
+ safe = f"{safe}_{used_names[safe]}"
152
+ else:
153
+ used_names[safe] = 0
154
+
145
155
  out[safe] = _PropWrapper(pr)
146
156
  return out
147
157
 
@@ -246,11 +256,23 @@ class _PropsNode:
246
256
  if self._children_cache:
247
257
  return
248
258
  props = self._item.properties
249
- for pr in props:
250
- display = pr.get("name") or pr.get("id")
259
+ used_names: Dict[str, int] = {}
260
+ names_list = []
261
+ for i, pr in enumerate(props):
262
+ # Try to get name from various possible fields
263
+ display = pr.get("name") or pr.get("id") or pr.get("category") or f"property_{i}"
251
264
  safe = _safe_key(str(display))
265
+
266
+ # Handle duplicate names by adding a suffix
267
+ if safe in used_names:
268
+ used_names[safe] += 1
269
+ safe = f"{safe}_{used_names[safe]}"
270
+ else:
271
+ used_names[safe] = 0
272
+
252
273
  self._children_cache[safe] = _PropWrapper(pr)
253
- self._names = [p.get("name") or p.get("id") for p in props]
274
+ names_list.append(display)
275
+ self._names = names_list
254
276
 
255
277
  def __dir__(self) -> List[str]: # pragma: no cover - notebook UX
256
278
  self._ensure_loaded()
poelis_sdk/items.py CHANGED
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  from typing import Generator, Any, Optional, Dict, List
4
4
 
5
5
  from ._transport import Transport
6
- from .org_validation import validate_item_organization, filter_by_organization
7
6
 
8
7
  """Items resource client."""
9
8
 
@@ -22,7 +21,7 @@ class ItemsClient:
22
21
 
23
22
  query = (
24
23
  "query($pid: ID!, $q: String, $limit: Int!, $offset: Int!) {\n"
25
- " items(productId: $pid, q: $q, limit: $limit, offset: $offset) { id name code description productId parentId owner orgId }\n"
24
+ " items(productId: $pid, q: $q, limit: $limit, offset: $offset) { id name code description productId parentId owner }\n"
26
25
  "}"
27
26
  )
28
27
  variables = {"pid": product_id, "q": q, "limit": int(limit), "offset": int(offset)}
@@ -34,11 +33,7 @@ class ItemsClient:
34
33
 
35
34
  items = payload.get("data", {}).get("items", [])
36
35
 
37
- # Client-side organization filtering as backup protection
38
- expected_org_id = self._t._org_id
39
- filtered_items = filter_by_organization(items, expected_org_id, "items")
40
-
41
- return filtered_items
36
+ return items
42
37
 
43
38
  def get(self, item_id: str) -> Dict[str, Any]:
44
39
  """Get a single item by id via GraphQL.
@@ -48,7 +43,7 @@ class ItemsClient:
48
43
 
49
44
  query = (
50
45
  "query($id: ID!) {\n"
51
- " item(id: $id) { id name code description productId parentId owner orgId }\n"
46
+ " item(id: $id) { id name code description productId parentId owner }\n"
52
47
  "}"
53
48
  )
54
49
  resp = self._t.graphql(query=query, variables={"id": item_id})
@@ -61,10 +56,6 @@ class ItemsClient:
61
56
  if item is None:
62
57
  raise RuntimeError(f"Item with id '{item_id}' not found")
63
58
 
64
- # Validate that the item belongs to the configured organization
65
- expected_org_id = self._t._org_id
66
- validate_item_organization(item, expected_org_id)
67
-
68
59
  return item
69
60
 
70
61
  def iter_all_by_product(self, *, product_id: str, q: Optional[str] = None, page_size: int = 100) -> Generator[dict, None, None]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: poelis-sdk
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Official Python SDK for Poelis
5
5
  Project-URL: Homepage, https://poelis.com
6
6
  Project-URL: Source, https://github.com/PoelisTechnologies/poelis-python-sdk
@@ -1,17 +1,17 @@
1
1
  poelis_sdk/__init__.py,sha256=vRKuvnMGtq2_6SYDPNpckSPYXTgMDD1vBAfZ1bXlHL0,924
2
2
  poelis_sdk/_transport.py,sha256=F5EX0EJFHJPAE638nKzlX5zLSU6FIMzMemqgh05_V6U,6061
3
3
  poelis_sdk/auth0.py,sha256=VDZHCv9YpsW55H-PLINKMq74UhevP6OWyBHQyEFIpvw,3163
4
- poelis_sdk/browser.py,sha256=i3j2G2eDCD8JPPtRnU-z_AOup0aBGIKisilVmJuqb-w,12645
4
+ poelis_sdk/browser.py,sha256=iPptz8PPLFhccUqgOAckdOeN2_zAo3htmN9QRYIV3uQ,13499
5
5
  poelis_sdk/client.py,sha256=10__5po-foX36ZCCduQmzdoh9NNS320kyaqztUNtPvo,3872
6
6
  poelis_sdk/exceptions.py,sha256=qX5kpAr8ozJUOW-CNhmspWVIE-bvUZT_PUnimYuBxNY,1101
7
- poelis_sdk/items.py,sha256=laRHVCaTkMmNQyXs6_IVrsyj6whMxSN8Qi6aPQ4dN00,3036
7
+ poelis_sdk/items.py,sha256=idPfcLZiCsiqkCq2kAytUrn4wO9lvA_bHB6ofzOd0y0,2557
8
8
  poelis_sdk/logging.py,sha256=zmg8Us-7qjDl0n_NfOSvDolLopy7Dc_hQ-pcrC63dY8,2442
9
9
  poelis_sdk/models.py,sha256=tpL7f66dsCobapKp3_rt-w6oiyYvWtoehLvCfjTDLl4,538
10
10
  poelis_sdk/org_validation.py,sha256=c4fB6ySTvcovWxG4F1wU_OBlP-FyuIaAUzCwqgJKzBE,5607
11
11
  poelis_sdk/products.py,sha256=bwV2mOPvBriy83F3BxWww1oSsyLZFQvh4XOiIE9fI1s,3240
12
12
  poelis_sdk/search.py,sha256=JYLz4yV3GZPlif05OqYK2xPoAD1b4XKTmriil4NHTOs,4095
13
13
  poelis_sdk/workspaces.py,sha256=hpmRl-Hswr4YDvObQdyVpegIYjUWno7A_BiVBz-AQGc,2383
14
- poelis_sdk-0.1.8.dist-info/METADATA,sha256=vTAHh3-5wdnTWEylMj8sUIx_nIpvuFZ5D7jv9rU8YN8,2813
15
- poelis_sdk-0.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- poelis_sdk-0.1.8.dist-info/licenses/LICENSE,sha256=EEmE_r8wk_pdXB8CWp1LG6sBOl7--hNSS2kV94cI6co,1075
17
- poelis_sdk-0.1.8.dist-info/RECORD,,
14
+ poelis_sdk-0.1.9.dist-info/METADATA,sha256=QixTMNvNvR8iB5YVf6Y21PVpsa5coYGZYbEUMAKU3Rw,2813
15
+ poelis_sdk-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ poelis_sdk-0.1.9.dist-info/licenses/LICENSE,sha256=EEmE_r8wk_pdXB8CWp1LG6sBOl7--hNSS2kV94cI6co,1075
17
+ poelis_sdk-0.1.9.dist-info/RECORD,,