UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 4.74 kB
!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"n8n@2.16.1"}}catch(e){}}(),System.register(["./vue.runtime.esm-bundler-legacy-BW6xDdqj.js","./core-legacy-VD8c7QJ-.js","./users.store-legacy-azRUgFdP.js","./useRootStore-legacy-CC08el-l.js","./settings.store-legacy-I6rZOvfF.js"],(function(e,t){var n,a,r,o,d,i,s,c,l;async function u(e,t,n,a,r){const o=await s(e,"GET",`/projects/${t}/folders`,{...a?{filter:a}:{},...n||{},...r?{select:JSON.stringify(r)}:{}});return{data:o.data,count:o.count}}return{setters:[function(e){n=e.Ft},function(e){a=e.at},function(e){r=e.Ma,o=e._i},function(e){d=e.T,i=e.c,s=e.s,c=e.t},function(e){l=e.An}],execute:function(){try{t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},(f=(new t.Error).stack)&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[f]="c15ae46c-3c34-499c-b145-6250756f89ae",t._sentryDebugIdIdentifier="sentry-dbid-c15ae46c-3c34-499c-b145-6250756f89ae")}catch(t){}var t,f;e("t",d(l.FOLDERS,(()=>{const e=c(),t=a(),d=n(!1),l=n(0),f=n(null),p=n(null),h=n({}),y=e=>{e.forEach((e=>{h.value[e.id]||(h.value[e.id]={id:e.id,name:e.name,parentFolder:e.parentFolder})}))};async function w(t,n){const a=await async function(e,t,n){return await i(e,"GET",`/projects/${t}/folders/${n}/tree`)}(e.restApiContext,t,n);return y(g(a)),a}function g(e,t){let n=[];return e.forEach((e=>{if(n.push({id:e.id,name:e.name,parentFolder:t}),e.children&&e.children.length>0){const t=g(e.children,e.id);n=[...n,...t]}})),n}return{fetchTotalWorkflowsAndFoldersCount:async function(t,n){d.value=!1;const{count:a}=await r(e.restApiContext,{projectId:t,parentFolderId:n},{skip:0,take:1},!0);return l.value=a,d.value=!0,a},breadcrumbsCache:h,cacheFolders:y,getCachedFolder:e=>h.value[e],createFolder:async function(t,n,a){return await async function(e,t,n,a){return await i(e,"POST",`/projects/${t}/folders`,{name:n,parentFolderId:a})}(e.restApiContext,n,t,a)},getFolderPath:w,totalWorkflowCount:l,workflowsCountLoaded:d,deleteFolder:async function(t,n,a){await async function(e,t,n,a){return await i(e,"DELETE",`/projects/${t}/folders/${n}`,{transferToFolderId:a})}(e.restApiContext,t,n,a)},deleteFoldersFromCache:e=>{e.forEach((e=>{delete h.value[e]}))},renameFolder:async function(t,n,a){await async function(e,t,n,a){return await i(e,"PATCH",`/projects/${t}/folders/${n}`,{name:a})}(e.restApiContext,t,n,a)},fetchProjectFolders:async function(t){return await u(e.restApiContext,t)},fetchFoldersAvailableForMove:async function(t,n,a){let r=0,o=0,d=[];do{const{data:i,count:s}=await u(e.restApiContext,t,{skip:r,take:100,sortBy:"updatedAt:desc"},{excludeFolderIdAndDescendants:n,name:a?.name},["id","name","createdAt","updatedAt","project","tags","parentFolder","workflowCount","subFolderCount","path"]);d=d.concat(i.map((e=>({...e,resource:"folder"})))),o=s,r+=i.length}while(d.length<o&&r<o);return y(d.map((e=>({id:e.id,name:e.name,parentFolder:e.parentFolder?.id})))),d.sort(((e,t)=>{if(e.path.length!==t.path.length)return e.path.length-t.path.length;for(let n=0;n<e.path.length;n++){const a=e.path[n].localeCompare(t.path[n]);if(0!==a)return a}return 0})),d},moveFolder:async function(t,n,a){await async function(e,t,n,a){return await i(e,"PATCH",`/projects/${t}/folders/${n}`,{parentFolderId:a})}(e.restApiContext,t,n,a),delete h.value[n]},moveFolderToProject:async function(t,n,a,r,d){await o(e.restApiContext,t,n,a,r,d),delete h.value[n]},fetchFolderContent:async function(t,n){return await async function(e,t,n){return(await s(e,"GET",`/projects/${t}/folders/${n}/content`)).data}(e.restApiContext,t,n)},getHiddenBreadcrumbsItems:async function(e,n,a){const r=Date.now(),o=await w(e.id,n),d=t=>{const n=[{id:t.id,label:t.name,href:a?.addLinks?`/projects/${e.id}/folders/${t.id}/workflows`:void 0}];if(t.children?.length){const r=t.children.flatMap((t=>{const n=[{id:t.id,label:t.name,href:a?.addLinks?`/projects/${e.id}/folders/${t.id}/workflows`:void 0}];return t.children?.length&&n.push.apply(n,d(t).slice(1)),n}));n.push.apply(n,r)}return n};let i;i=0===o.length?[{id:e.id,label:e.name},{id:"-1",label:t.baseText("folders.breadcrumbs.noTruncated.message")}]:[{id:e.id,label:e.name},...o.flatMap(d)];const s=Date.now()-r,c=Math.max(0,300-s);return c>0&&await new Promise((e=>setTimeout(e,c))),i},draggedElement:f,activeDropTarget:p,fetchFolderUsedCredentials:async function(t,n){return await async function(e,t,n){return(await s(e,"GET",`/projects/${t}/folders/${n}/credentials`)).data}(e.restApiContext,t,n)}}})))}}})); //# sourceMappingURL=folders.store-legacy-DaxTE_NY.js.map