@danhachuel/thunderbolt 0.7.5 → 0.7.6

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.
@@ -117,7 +117,17 @@ def _connected_account_id(client: Any, user_id: str, toolkit: str, selector: str
117
117
  try:
118
118
  response = client.connected_accounts.list(user_ids=[_require_user_id(user_id)], statuses=["ACTIVE"])
119
119
  raw = _safe_value(response)
120
- items = raw.get("items", []) if isinstance(raw, dict) else raw
120
+ if isinstance(raw, dict):
121
+ # Composio SDK versions expose the list either directly or under
122
+ # ``data``; accept both shapes so aliases are never sent as IDs.
123
+ items = raw.get("items")
124
+ if items is None:
125
+ data = raw.get("data")
126
+ items = data.get("items", data) if isinstance(data, dict) else data
127
+ if items is None:
128
+ items = raw.get("connected_accounts", [])
129
+ else:
130
+ items = raw
121
131
  if not isinstance(items, list):
122
132
  items = []
123
133
  matching_items = []
@@ -135,8 +145,15 @@ def _connected_account_id(client: Any, user_id: str, toolkit: str, selector: str
135
145
  for item in matching_items:
136
146
  candidates = [item.get("id"), item.get("nanoid"), item.get("alias"), item.get("name")]
137
147
  if any(str(candidate or "").strip().casefold() == wanted for candidate in candidates):
138
- return str(item.get("id") or item.get("nanoid") or value).strip()
139
- return value
148
+ technical_id = str(item.get("id") or item.get("nanoid") or "").strip()
149
+ if technical_id:
150
+ return technical_id
151
+ available = [str(item.get("alias") or item.get("name") or item.get("id") or "").strip() for item in matching_items]
152
+ available = [item for item in available if item]
153
+ suffix = f" Contas activas: {', '.join(available)}." if available else ""
154
+ raise ComposioUploadError(
155
+ f"A connected account `{value}` não foi encontrada para o toolkit {toolkit or 'seleccionado'}.{suffix}"
156
+ )
140
157
  if len(matching_items) == 1:
141
158
  item = matching_items[0]
142
159
  return str(item.get("id") or item.get("nanoid") or "").strip()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.7.05",
3
+ "version": "0.7.06",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",