UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 3.57 kB
!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"n8n@2.13.4"}}catch(e){}}(),System.register(["./vue.runtime.esm-bundler-legacy-IafOlCW8.js","./_MapCache-legacy-DwgdC8YO.js","./users.store-legacy-OKuN0qAC.js","./constants-legacy-DNCca_FT.js","./collaboration.store-legacy-Cbihou7P.js"],(function(e,t){var o,r,n,i,s,a,c,l,u,d,w,f,v,k;return e("t",(function(){const e=o(!1),t=w(),p=i(),y=d(),h=c(),b=s(),g=r(),I=k(),m=e=>{try{const{errorCode:t,hint:o}=e;if(409===t){const e=JSON.parse(o??"");if(Array.isArray(e)&&e.length>0&&Object.hasOwn(e[0],"trigger"))return e}return null}catch{return null}};return{updatingWorkflowActivation:e,publishWorkflow:async(o,r,i)=>{e.value=!0,I.requestWriteAccess();const s=!!p.getWorkflowById(o).activeVersion;if(!s){const e={workflow_id:o,is_active:!0,previous_status:!1,ndv_input:!1};n().run("workflowActivate.updateWorkflowActivation",e)}const c=a(l(o));try{const a=o===t.workflowId?c.checksum:void 0,l=await t.publishWorkflow(o,{versionId:r,name:i?.name,description:i?.description,expectedChecksum:a});if(!l.activeVersion||!l.checksum)throw new Error("Failed to publish workflow");return t.setWorkflowActive(o,l.activeVersion,!0),c.setActiveState({activeVersionId:l.activeVersion.versionId,activeVersion:l.activeVersion}),o===t.workflowId&&(t.setWorkflowVersionData({versionId:l.versionId,name:t.versionData?.name??null,description:t.versionData?.description??null}),l.checksum&&c.setChecksum(l.checksum)),n().run("workflow.published",{workflowId:o,versionId:l.activeVersion.versionId}),s||"true"===u("N8N_HIDE_ACTIVATION_ALERT").value||y.openModal(v),{success:!0}}catch(d){return(e=>null!==m(e))(d)?(await(async e=>{const{trigger:t,conflict:o}=m(e)?.pop()||{};let r=o?.workflowId;try{o?.workflowId&&(r=(await p.fetchWorkflow(o?.workflowId)).name)}catch{}y.openModalWithData({name:f,data:{triggerType:t?.type,workflowName:r,...o}})})(d),{success:!1,errorHandled:!0}):(b.showError(d,g.baseText("workflowActivator.showError.title",{interpolate:{newStateName:"published"}})+":"),d.meta?.validationError||(t.setWorkflowInactive(o),c.setActiveState({activeVersionId:null,activeVersion:null})),{success:!1})}finally{e.value=!1}},unpublishWorkflowFromHistory:async o=>{e.value=!0,I.requestWriteAccess();const r={workflow_id:o,is_active:!1,previous_status:!!p.getWorkflowById(o).activeVersion,ndv_input:!1};h.track("User set workflow active status",r),n().run("workflowActivate.updateWorkflowActivation",r);const i=a(l(o));try{const r=o===t.workflowId?i.checksum:void 0;return await t.deactivateWorkflow(o,r),i.setActiveState({activeVersionId:null,activeVersion:null}),n().run("workflow.unpublished",{workflowId:o}),!0}catch(s){return b.showError(s,g.baseText("workflowActivator.showError.title",{interpolate:{newStateName:"deactivated"}})+":"),!1}finally{e.value=!1}}}})),{setters:[function(e){o=e.Ft},function(e){r=e.bt},function(e){n=e.Dr,i=e.Gr,s=e.Tr,a=e.aa,c=e.en,l=e.na,u=e.qr,d=e.r,w=e.s},function(e){f=e.Us,v=e.Ws,e.nc},function(e){k=e.t}],execute:function(){try{e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},(t=(new e.Error).stack)&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d229e19d-9274-4b45-bbd0-d16a786a9817",e._sentryDebugIdIdentifier="sentry-dbid-d229e19d-9274-4b45-bbd0-d16a786a9817")}catch(e){}var e,t}}})); //# sourceMappingURL=useWorkflowActivate-legacy-Br2Wp4oy.js.map