@braze/sanity-plugin-ai-translation 0.2.62 → 0.2.63
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/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1849,8 +1849,28 @@ const globalTransformRegistry = new TransformRegistry(), callGPT5 = async (apiKe
|
|
|
1849
1849
|
return;
|
|
1850
1850
|
}
|
|
1851
1851
|
if (node.attributes.type === "object") {
|
|
1852
|
-
|
|
1853
|
-
|
|
1852
|
+
const currentValue = get(doc, path);
|
|
1853
|
+
if (currentValue && typeof currentValue == "object" && !Array.isArray(currentValue)) {
|
|
1854
|
+
const currentValueObj = currentValue;
|
|
1855
|
+
for (const child of node.children)
|
|
1856
|
+
if (child.name) {
|
|
1857
|
+
const childValue = currentValueObj[child.name];
|
|
1858
|
+
if (/^\d+$/.test(child.name) && childValue === void 0) {
|
|
1859
|
+
devLog.warn("Skipping numeric child name in object field - field does not exist (likely parsing error)", {
|
|
1860
|
+
path: path.join("."),
|
|
1861
|
+
childName: child.name,
|
|
1862
|
+
availableKeys: Object.keys(currentValueObj),
|
|
1863
|
+
childType: child.attributes.type
|
|
1864
|
+
});
|
|
1865
|
+
continue;
|
|
1866
|
+
}
|
|
1867
|
+
applyFieldChanges(doc, [...path, child.name], child);
|
|
1868
|
+
}
|
|
1869
|
+
} else
|
|
1870
|
+
devLog.warn("Object field type but value is not an object", {
|
|
1871
|
+
path: path.join("."),
|
|
1872
|
+
actualType: Array.isArray(currentValue) ? "array" : typeof currentValue
|
|
1873
|
+
});
|
|
1854
1874
|
return;
|
|
1855
1875
|
}
|
|
1856
1876
|
if (node.children.some((c) => c.type === "block")) {
|