UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 5.14 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","./_baseOrderBy-legacy-PsQY_Pvh.js"],(function(e,t){var n,a,r,o,i,s,u,d,c,l,p,f,y,g,v,w,D,b,h,m,T,_,S,N,x,I,O;function k(e={}){const t=D(),n=a((()=>{if(e.nodeType)return r(e.nodeType);const n=r(e.node);return n?t.getNodeType(n.type,n.typeVersion):null}));return{nodeType:n,isSubNodeType:a((()=>m(n.value))),isMultipleOutputsNodeType:a((()=>{const e=n.value?.outputs;return"string"!=typeof e&&(e??[]).length>1}))}}return e({n:k,t:function(e,t={}){const m=O(),E=v(),M=g(),R=p()??(E.workflowId?n(d(y(E.workflowId))):null),j=u(),L=o(),z=l(),J=s(),{getInputDataWithPinned:A}=f(),P=a((()=>E.workflowObject)),{isSubNodeType:U,isMultipleOutputsNodeType:V}=k({node:e}),$=a((()=>{const t=r(e);if(t&&R?.value)return c(R.value.pinData)[t.name]})),C=a((()=>!!r(e)&&void 0!==$.value)),W=a((()=>{const t=r(e);return!(!t||U.value||V.value||S.includes(t.type))}));function B(e){try{return JSON.parse(e),!0}catch(t){const n=L.baseText("runData.editOutputInvalid"),a=new RegExp(/JSON\.parse:|of the JSON data/,"g"),r=t.message.replace(a,"").trim(),o=/at position (\d+)/,i=t.message.match(o);if(t.message=r.charAt(0).toUpperCase()+r.slice(1),t.message=t.message.replace("Unexpected token ' in JSON",L.baseText("runData.editOutputInvalid.singleQuote")),i){const n=parseInt(i[1],10),a=(e.slice(0,n).match(/\n/g)||[]).length;t.message=t.message.replace(o,L.baseText("runData.editOutputInvalid.atPosition",{interpolate:{position:`${n}`}})),t.message=`${L.baseText("runData.editOutputInvalid.onLine",{interpolate:{line:`${a+1}`}})} ${t.message}`}return j.showError(t,n),!1}}function H(){return window.maxPinnedDataSize??12582912}function Q(t){const n=r(e);if(!n)return!1;"object"==typeof t&&(t=JSON.stringify(t));const{pinData:a,...o}=P.value,s=R?.value?.pinData??{},u=N(o,{replaceCircularRefs:!0}),d=w({...s,[n.name]:t});if(d>H())return j.showError(new Error(L.baseText("ndv.pinData.error.tooLarge.description",{interpolate:{size:b(d),limit:b(H())}})),L.baseText("ndv.pinData.error.tooLarge.title")),!1;const c=i(u)+d,l=T-_;return!(c>l&&(j.showError(new Error(L.baseText("ndv.pinData.error.tooLargeWorkflow.description",{interpolate:{size:b(c),limit:b(l)}})),L.baseText("ndv.pinData.error.tooLargeWorkflow.title")),1))}function Y({source:n}){const a=r(e),o=r(t.displayMode),s=r(t.runIndex),u={pinning_source:n,node_type:a?.type,push_ref:m.pushRef,data_size:i($.value),view:o,run_index:s,workflow_id:E.workflowId,node_id:a?.id};J.run("runData.onDataPinningSuccess",u),z.track("Ndv data pinning success",u)}function Z({errorType:n,source:a}){const o=r(e),s=r(t.displayMode),u=r(t.runIndex);z.track("Ndv data pinning failure",{pinning_source:a,node_type:o?.type,push_ref:m.pushRef,data_size:i($.value),view:s,run_index:u,error_type:n})}function q({source:n}){const a=r(e),o=r(t.runIndex);z.track("User unpinned ndv data",{node_type:a?.type,push_ref:m.pushRef,run_index:o,source:n,data_size:i($.value)})}return{data:$,hasData:C,isValidNodeType:W,canPinNode:function(t=!1,n){const a=r(e);if(null===a||S.includes(a.type))return!1;const o=D().getNodeType(a.type,a.typeVersion),i=A(a);if(!o||t&&0===i.length)return!1;const s=I(P.value,a,o).map((e=>"string"==typeof e?{type:e}:e)),u=s.filter((e=>e.type===x.Main&&"error"!==e.category));let d=!0;if(void 0!==n){const e=s[n];if(void 0===s[n])return!1;d=e.type===x.Main&&"error"!==e.category}return 1===u.length&&d},setData:function(t,n){const a=r(e);if(a){if("string"==typeof t){if(!B(t))throw Z({errorType:"invalid-json",source:n}),new Error("Invalid JSON");t=h(t)}if(!Q(t))throw Z({errorType:"data-too-large",source:n}),new Error("Data too large");if(R?.value){const e=a.name;(R.value.pinData[e]??[]).length>0&&E.nodeMetadata[e]&&(E.nodeMetadata[e].pinnedDataLastUpdatedAt=Date.now()),R.value.pinNodeData(e,t),M.markStateDirty()}Y({source:n})}},onSetDataSuccess:Y,onSetDataError:Z,unsetData:function(t){const n=r(e);n&&(q({source:t}),R?.value&&(R.value.unpinNodeData(n.name),E.nodeMetadata[n.name]&&(E.nodeMetadata[n.name].pinnedDataLastRemovedAt=Date.now()),M.markStateDirty()))},onUnsetData:q,isValidJSON:B,isValidSize:Q}}}),{setters:[function(e){n=e.Rt,a=e.S,r=e.Wt},function(e){o=e.bt},function(e){i=e.Ca,s=e.Dr,u=e.Tr,d=e.aa,c=e.ca,l=e.en,p=e.ia,f=e.lt,y=e.na,g=e.r,v=e.s,w=e.sa,D=e.w,b=e.wa},function(e){h=e.$a,m=e.Aa,T=e.Ac,_=e.Oc,S=e.Zn,N=e.eo,x=e.ho,e.kc,I=e.va},function(e){O=e.r}],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]="5d8fcd9b-4b8c-4fe1-9fa5-adc6561f86d0",e._sentryDebugIdIdentifier="sentry-dbid-5d8fcd9b-4b8c-4fe1-9fa5-adc6561f86d0")}catch(e){}var e,t}}})); //# sourceMappingURL=usePinnedData-legacy-CxgKkO-J.js.map