sanity-plugin-studio-smartling
5.0.75.0.8
dist/index.js~
dist/index.jsModified+3−1
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -121,9 +121,11 @@
getTranslationTask,
createTask: async (documentId, document, localeIds, secrets, workflowUid, callbackUrl) => {
if (!secrets?.project || !secrets?.secret || !secrets?.proxy) throw Error("The Smartling adapter requires a project ID, a secret key, and a proxy URL. Please check your secrets document in this dataset, per the plugin documentation.");
let accessToken = await authenticate(secrets), taskId = await findExistingJob(document.name, secrets, accessToken);
- return taskId ||= await createJob(document.name, secrets, localeIds, accessToken, documentId), await uploadFileToBatch(await createJobBatch(taskId, secrets, documentId, accessToken, localeIds, workflowUid), documentId, document, secrets, localeIds, accessToken, callbackUrl), getTranslationTask(documentId, secrets);
+ taskId ||= await createJob(document.name, secrets, localeIds, accessToken, documentId);
+ let batchUid = await createJobBatch(taskId, secrets, documentId, accessToken, localeIds, workflowUid);
+ return await uploadFileToBatch(batchUid, documentId, document, secrets, localeIds, accessToken, callbackUrl), getTranslationTask(documentId, secrets);
},
getTranslation: async (taskId, localeId, secrets) => {
if (!secrets?.project || !secrets?.secret || !secrets?.proxy) throw Error("The Smartling adapter requires a project ID, a secret key, and a proxy URL. Please check your secrets document in this dataset, per the plugin documentation.");
let { project, proxy } = secrets, url = `https://api.smartling.com/files-api/v2/projects/${project}/locales/${localeId}/file?fileUri=${taskId}&retrievalType=pending`, accessToken = await authenticate(secrets);