@danhachuel/thunderbolt 0.5.20 → 0.5.21
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.
|
@@ -27,10 +27,10 @@ def _payload(result: Mapping[str, Any]) -> Any:
|
|
|
27
27
|
|
|
28
28
|
def _items(value: Any) -> list[dict[str, Any]]:
|
|
29
29
|
if isinstance(value, Mapping):
|
|
30
|
-
for key in ("items", "designs", "results", "candidates"):
|
|
30
|
+
for key in ("items", "designs", "results", "candidates", "generated_designs"):
|
|
31
31
|
if isinstance(value.get(key), list):
|
|
32
32
|
return [dict(item) for item in value[key] if isinstance(item, Mapping)]
|
|
33
|
-
for key in ("data", "result", "response"):
|
|
33
|
+
for key in ("data", "result", "response", "job"):
|
|
34
34
|
if isinstance(value.get(key), (Mapping, list)):
|
|
35
35
|
nested = _items(value[key])
|
|
36
36
|
if nested:
|
|
@@ -57,6 +57,17 @@ def _first_named_id(value: Any, keys: tuple[str, ...]) -> str:
|
|
|
57
57
|
return ""
|
|
58
58
|
|
|
59
59
|
|
|
60
|
+
def _generation_job_id(value: Any) -> str:
|
|
61
|
+
if isinstance(value, Mapping):
|
|
62
|
+
job = value.get("job")
|
|
63
|
+
if isinstance(job, Mapping):
|
|
64
|
+
candidate = str(job.get("id") or "").strip()
|
|
65
|
+
if candidate:
|
|
66
|
+
return candidate
|
|
67
|
+
return _first_named_id(value, ("job_id", "jobId"))
|
|
68
|
+
return ""
|
|
69
|
+
|
|
70
|
+
|
|
60
71
|
def _design_id(value: Any) -> str:
|
|
61
72
|
"""Extract a Canva design identifier from REST/MCP result variants."""
|
|
62
73
|
if isinstance(value, Mapping):
|
|
@@ -202,7 +213,7 @@ def run_direct_canva_thumbnail(
|
|
|
202
213
|
),
|
|
203
214
|
"user_intent": "Create an editable YouTube thumbnail with text boxes and visual elements when searched designs are not editable.",
|
|
204
215
|
}))
|
|
205
|
-
job_id =
|
|
216
|
+
job_id = _generation_job_id(generated)
|
|
206
217
|
generated_candidates = _items(generated)
|
|
207
218
|
candidate_id = _first_named_id(generated_candidates[0] if generated_candidates else {}, ("candidate_id", "candidateId"))
|
|
208
219
|
if not job_id or not candidate_id:
|
package/package.json
CHANGED