@braze/sanity-plugin-ai-translation 0.2.24 → 0.2.25
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 +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1714,7 +1714,8 @@ const fetchTranslationPrompts = async ({
|
|
|
1714
1714
|
const refIds = refs.map((r) => getPublishedId(r.value)), translations = await client.fetch(
|
|
1715
1715
|
`*[_type == $translationMetadataSchemaType && array::intersects(translations[].value._ref, $refIds)] {
|
|
1716
1716
|
"sourceId": translations[_key == $sourceLanguage][0].value._ref,
|
|
1717
|
-
"targetId": translations[_key == $targetLanguage][0].value._ref
|
|
1717
|
+
"targetId": translations[_key == $targetLanguage][0].value._ref,
|
|
1718
|
+
"targetType": translations[_key == $sourceLanguage][0].value -> _type
|
|
1718
1719
|
}`,
|
|
1719
1720
|
{
|
|
1720
1721
|
translationMetadataSchemaType: TRANSLATION_METADATA_TYPE,
|
|
@@ -1729,7 +1730,11 @@ const fetchTranslationPrompts = async ({
|
|
|
1729
1730
|
let hasChanges = !1;
|
|
1730
1731
|
for (const ref of refs) {
|
|
1731
1732
|
const sourceId = getPublishedId(ref.value), newId = translationMap.get(sourceId);
|
|
1732
|
-
newId && (patch.set({ [pathToString(ref.path)]: getPublishedId(newId) }),
|
|
1733
|
+
newId && (patch.set({ [pathToString(ref.path)]: getPublishedId(newId) }), patch.set({
|
|
1734
|
+
[`${pathToString(ref.path.slice(0, -1))}._strengthenOnPublish`]: {
|
|
1735
|
+
type: translations.find((t) => t.targetId === getPublishedId(newId))?.targetType || void 0
|
|
1736
|
+
}
|
|
1737
|
+
}), hasChanges = !0);
|
|
1733
1738
|
}
|
|
1734
1739
|
hasChanges && (await patch.commit(), devLog.info("Updated references in batch", {
|
|
1735
1740
|
documentId,
|