n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 5.13 kB
JavaScript
!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","./constants-legacy-2_ytuuS3.js","./useRootStore-legacy-CC08el-l.js"],(function(e,t){var n,a,r,o,i,s,u,d,c,l,p,f,y,g,v,w,D,h,m,b,T,S,_,N,I,x,k;function E(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((()=>S(n.value))),isMultipleOutputsNodeType:a((()=>{const e=n.value?.outputs;return"string"!=typeof e&&(e??[]).length>1}))}}return e({n:E,t:function(e,t={}){const S=k(),O=w(),R=g(),M=d()??(O.workflowId?n(y(v(O.workflowId))):null),j=s(),z=o(),L=p(),J=i(),{getInputDataWithPinned:P}=l(),U=a((()=>O.workflowObject)),{isSubNodeType:V,isMultipleOutputsNodeType:A}=E({node:e}),W=a((()=>{const t=r(e);if(t&&M?.value)return f(M.value.pinData)[t.name]})),$=a((()=>!!r(e)&&void 0!==W.value)),C=a((()=>{const t=r(e);return!(!t||V.value||A.value||m.includes(t.type))}));function B(e){try{return JSON.parse(e),!0}catch(t){const n=z.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",z.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,z.baseText("runData.editOutputInvalid.atPosition",{interpolate:{position:`${n}`}})),t.message=`${z.baseText("runData.editOutputInvalid.onLine",{interpolate:{line:`${a+1}`}})} ${t.message}`}return j.showError(t,n),!1}}function Q(){return window.maxPinnedDataSize??12582912}function Y(t){const n=r(e);if(!n)return!1;"object"==typeof t&&(t=JSON.stringify(t));const{pinData:a,...o}=U.value,i=M?.value?.pinData??{},s=x(o,{replaceCircularRefs:!0}),d=c({...i,[n.name]:t});if(d>Q())return j.showError(new Error(z.baseText("ndv.pinData.error.tooLarge.description",{interpolate:{size:u(d),limit:u(Q())}})),z.baseText("ndv.pinData.error.tooLarge.title")),!1;const l=h(s)+d,p=_-N;return!(l>p&&(j.showError(new Error(z.baseText("ndv.pinData.error.tooLargeWorkflow.description",{interpolate:{size:u(l),limit:u(p)}})),z.baseText("ndv.pinData.error.tooLargeWorkflow.title")),1))}function q({source:n}){const a=r(e),o=r(t.displayMode),i=r(t.runIndex),s={pinning_source:n,node_type:a?.type,push_ref:S.pushRef,data_size:h(W.value),view:o,run_index:i,workflow_id:O.workflowId,node_id:a?.id};J.run("runData.onDataPinningSuccess",s),L.track("Ndv data pinning success",s)}function F({errorType:n,source:a}){const o=r(e),i=r(t.displayMode),s=r(t.runIndex);L.track("Ndv data pinning failure",{pinning_source:a,node_type:o?.type,push_ref:S.pushRef,data_size:h(W.value),view:i,run_index:s,error_type:n})}function G({source:n}){const a=r(e),o=r(t.runIndex);L.track("User unpinned ndv data",{node_type:a?.type,push_ref:S.pushRef,run_index:o,source:n,data_size:h(W.value)})}return{data:W,hasData:$,isValidNodeType:C,canPinNode:function(t=!1,n){const a=r(e);if(null===a||m.includes(a.type))return!1;const o=D().getNodeType(a.type,a.typeVersion),i=P(a);if(!o||t&&0===i.length)return!1;const s=I(U.value,a,o).map((e=>"string"==typeof e?{type:e}:e)),u=s.filter((e=>e.type===T.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===T.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 F({errorType:"invalid-json",source:n}),new Error("Invalid JSON");t=b(t)}if(!Y(t))throw F({errorType:"data-too-large",source:n}),new Error("Data too large");if(M?.value){const e=a.name;(M.value.pinData[e]??[]).length>0&&O.nodeMetadata[e]&&(O.nodeMetadata[e].pinnedDataLastUpdatedAt=Date.now()),M.value.pinNodeData(e,t),R.markStateDirty()}q({source:n})}},onSetDataSuccess:q,onSetDataError:F,unsetData:function(t){const n=r(e);n&&(G({source:t}),M?.value&&(M.value.unpinNodeData(n.name),O.nodeMetadata[n.name]&&(O.nodeMetadata[n.name].pinnedDataLastRemovedAt=Date.now()),R.markStateDirty()))},onUnsetData:G,isValidJSON:B,isValidSize:Y}}}),{setters:[function(e){n=e.Rt,a=e.S,r=e.Wt},function(e){o=e.at},function(e){i=e.In,s=e.Pn,u=e.Ta,d=e.aa,c=e.ca,l=e.ct,p=e.fr,f=e.la,y=e.oa,g=e.r,v=e.ra,w=e.s,D=e.w,h=e.wa},function(e){m=e.Bn,b=e.Ra,T=e.eo,S=e.ha,_=e.hc,e.mc,N=e.pc,I=e.ra,x=e.za},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]="5aabc276-491c-4c6a-9789-acdc7582160a",e._sentryDebugIdIdentifier="sentry-dbid-5aabc276-491c-4c6a-9789-acdc7582160a")}catch(e){}var e,t}}}));
//# sourceMappingURL=usePinnedData-legacy-BfjAvFWp.js.map