@motiadev/plugin-endpoint 0.11.1-beta.156-960492 → 0.11.1-beta.156-491458

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -79,7 +79,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
79
79
  monaco.config({ paths: { vs: '...' } })
80
80
 
81
81
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
82
- `},Il=Hb(Yb)(Cf),Kb={config:Vb},Zb=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(a){return r.reduceRight(function(i,o){return o(i)},a)}};function Of(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],Of(e[r],t[r]))}),Al(Al({},e),t)}var Xb={type:"cancelation",msg:"operation is manually canceled"};function mt(e){var t=!1,r=new Promise(function(n,a){e.then(function(i){return t?a(Xb):n(i)}),e.catch(a)});return r.cancel=function(){return t=!0},r}var Jb=Gb.create({config:$b,isInitialized:!1,resolve:null,reject:null,monaco:null}),xf=Ab(Jb,2),qe=xf[0],nt=xf[1];function Qb(e){var t=Kb.config(e),r=t.monaco,n=Tb(t,["monaco"]);nt(function(a){return{config:Of(a.config,n),monaco:r}})}function eh(){var e=qe(function(t){var r=t.monaco,n=t.isInitialized,a=t.resolve;return{monaco:r,isInitialized:n,resolve:a}});if(!e.isInitialized){if(nt({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),mt(bt);if(window.monaco&&window.monaco.editor)return Lf(window.monaco),e.resolve(window.monaco),mt(bt);Zb(th,nh)(ah)}return mt(bt)}function th(e){return document.body.appendChild(e)}function rh(e){var t=document.createElement("script");return e&&(t.src=e),t}function nh(e){var t=qe(function(n){var a=n.config,i=n.reject;return{config:a,reject:i}}),r=rh("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function ah(){var e=qe(function(r){var n=r.config,a=r.resolve,i=r.reject;return{config:n,resolve:a,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){Lf(r),e.resolve(r)},function(r){e.reject(r)})}function Lf(e){qe().monaco||nt({monaco:e})}function ih(){return qe(function(e){var t=e.monaco;return t})}var bt=new Promise(function(e,t){return nt({resolve:e,reject:t})}),Qe={config:Qb,init:eh,__getMonacoInstance:ih},oh={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ht=oh,sh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},lh=sh;function uh({children:e}){return _.createElement("div",{style:lh.container},e)}var ch=uh,dh=ch;function ph({width:e,height:t,isEditorReady:r,loading:n,_ref:a,className:i,wrapperProps:o}){return _.createElement("section",{style:{...ht.wrapper,width:e,height:t},...o},!r&&_.createElement(dh,null,n),_.createElement("div",{ref:a,style:{...ht.fullWidth,...!r&&ht.hide},className:i}))}var gh=ph,Df=_.memo(gh);function fh(e){_.useEffect(e,[])}var ks=fh;function mh(e,t,r=!0){let n=_.useRef(!0);_.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var re=mh;function Fe(){}function we(e,t,r,n){return bh(e,n)||hh(e,t,r,n)}function bh(e,t){return e.editor.getModel(Mf(e,t))}function hh(e,t,r,n){return e.editor.createModel(t,r,n?Mf(e,n):void 0)}function Mf(e,t){return e.Uri.parse(t)}function Eh({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:a,originalModelPath:i,modifiedModelPath:o,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:p={},height:g="100%",width:h="100%",className:S,wrapperProps:b={},beforeMount:R=Fe,onMount:T=Fe}){let[m,E]=_.useState(!1),[v,y]=_.useState(!0),f=_.useRef(null),A=_.useRef(null),N=_.useRef(null),w=_.useRef(T),O=_.useRef(R),x=_.useRef(!1);ks(()=>{let M=Qe.init();return M.then(B=>(A.current=B)&&y(!1)).catch(B=>B?.type!=="cancelation"&&console.error("Monaco initialization: error:",B)),()=>f.current?$():M.cancel()}),re(()=>{if(f.current&&A.current){let M=f.current.getOriginalEditor(),B=we(A.current,e||"",n||r||"text",i||"");B!==M.getModel()&&M.setModel(B)}},[i],m),re(()=>{if(f.current&&A.current){let M=f.current.getModifiedEditor(),B=we(A.current,t||"",a||r||"text",o||"");B!==M.getModel()&&M.setModel(B)}},[o],m),re(()=>{let M=f.current.getModifiedEditor();M.getOption(A.current.editor.EditorOption.readOnly)?M.setValue(t||""):t!==M.getValue()&&(M.executeEdits("",[{range:M.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),M.pushUndoStop())},[t],m),re(()=>{f.current?.getModel()?.original.setValue(e||"")},[e],m),re(()=>{let{original:M,modified:B}=f.current.getModel();A.current.editor.setModelLanguage(M,n||r||"text"),A.current.editor.setModelLanguage(B,a||r||"text")},[r,n,a],m),re(()=>{A.current?.editor.setTheme(c)},[c],m),re(()=>{f.current?.updateOptions(p)},[p],m);let P=_.useCallback(()=>{if(!A.current)return;O.current(A.current);let M=we(A.current,e||"",n||r||"text",i||""),B=we(A.current,t||"",a||r||"text",o||"");f.current?.setModel({original:M,modified:B})},[r,t,a,e,n,i,o]),G=_.useCallback(()=>{!x.current&&N.current&&(f.current=A.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...p}),P(),A.current?.editor.setTheme(c),E(!0),x.current=!0)},[p,c,P]);_.useEffect(()=>{m&&w.current(f.current,A.current)},[m]),_.useEffect(()=>{!v&&!m&&G()},[v,m,G]);function $(){let M=f.current?.getModel();s||M?.original?.dispose(),l||M?.modified?.dispose(),f.current?.dispose()}return _.createElement(Df,{width:h,height:g,isEditorReady:m,loading:u,_ref:N,className:S,wrapperProps:b})}var yh=Eh;_.memo(yh);function Sh(){let[e,t]=_.useState(Qe.__getMonacoInstance());return ks(()=>{let r;return e||(r=Qe.init(),r.then(n=>{t(n)})),()=>r?.cancel()}),e}var vh=Sh;function Th(e){let t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}var Ah=Th,We=new Map;function Rh({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:a,path:i,theme:o="light",line:s,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:p=!0,keepCurrentModel:g=!1,width:h="100%",height:S="100%",className:b,wrapperProps:R={},beforeMount:T=Fe,onMount:m=Fe,onChange:E,onValidate:v=Fe}){let[y,f]=_.useState(!1),[A,N]=_.useState(!0),w=_.useRef(null),O=_.useRef(null),x=_.useRef(null),P=_.useRef(m),G=_.useRef(T),$=_.useRef(),M=_.useRef(n),B=Ah(i),q=_.useRef(!1),F=_.useRef(!1);ks(()=>{let C=Qe.init();return C.then(L=>(w.current=L)&&N(!1)).catch(L=>L?.type!=="cancelation"&&console.error("Monaco initialization: error:",L)),()=>O.current?I():C.cancel()}),re(()=>{let C=we(w.current,e||n||"",t||a||"",i||r||"");C!==O.current?.getModel()&&(p&&We.set(B,O.current?.saveViewState()),O.current?.setModel(C),p&&O.current?.restoreViewState(We.get(i)))},[i],y),re(()=>{O.current?.updateOptions(c)},[c],y),re(()=>{!O.current||n===void 0||(O.current.getOption(w.current.editor.EditorOption.readOnly)?O.current.setValue(n):n!==O.current.getValue()&&(F.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),O.current.pushUndoStop(),F.current=!1))},[n],y),re(()=>{let C=O.current?.getModel();C&&a&&w.current?.editor.setModelLanguage(C,a)},[a],y),re(()=>{s!==void 0&&O.current?.revealLine(s)},[s],y),re(()=>{w.current?.editor.setTheme(o)},[o],y);let j=_.useCallback(()=>{if(!(!x.current||!w.current)&&!q.current){G.current(w.current);let C=i||r,L=we(w.current,n||e||"",t||a||"",C||"");O.current=w.current?.editor.create(x.current,{model:L,automaticLayout:!0,...c},u),p&&O.current.restoreViewState(We.get(C)),w.current.editor.setTheme(o),s!==void 0&&O.current.revealLine(s),f(!0),q.current=!0}},[e,t,r,n,a,i,c,u,p,o,s]);_.useEffect(()=>{y&&P.current(O.current,w.current)},[y]),_.useEffect(()=>{!A&&!y&&j()},[A,y,j]),M.current=n,_.useEffect(()=>{y&&E&&($.current?.dispose(),$.current=O.current?.onDidChangeModelContent(C=>{F.current||E(O.current.getValue(),C)}))},[y,E]),_.useEffect(()=>{if(y){let C=w.current.editor.onDidChangeMarkers(L=>{let k=O.current.getModel()?.uri;if(k&&L.find(D=>D.path===k.path)){let D=w.current.editor.getModelMarkers({resource:k});v?.(D)}});return()=>{C?.dispose()}}return()=>{}},[y,v]);function I(){$.current?.dispose(),g?p&&We.set(i,O.current.saveViewState()):O.current.getModel()?.dispose(),O.current.dispose()}return _.createElement(Df,{width:h,height:S,isEditorReady:y,loading:l,_ref:x,className:b,wrapperProps:R})}var _h=Rh,wh=_.memo(_h);const Ih=({value:e,schema:t,onChange:r,onValidate:n,language:a="json",readOnly:i=!1})=>{const o=vh(),s=U.useThemeStore(S=>S.theme),l=_.useMemo(()=>s==="dark"?"transparent-dark":"transparent-light",[s]),[c,u]=_.useState(null),p=_.useRef(null),g=_.useRef(!1);_.useLayoutEffect(()=>{o&&(o.editor.defineTheme("transparent-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000","editor.lineHighlightBackground":"#00000000","editorLineNumber.foreground":"#999999","editorLineNumber.activeForeground":"#000000",focusBorder:"#00000000","widget.border":"#00000000","editor.border":"#00000000","editorWidget.border":"#00000000"}}),o.editor.defineTheme("transparent-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000","editor.lineHighlightBackground":"#00000000","editorLineNumber.foreground":"#666666","editorLineNumber.activeForeground":"#ffffff",focusBorder:"#00000000","widget.border":"#00000000","editor.border":"#00000000","editorWidget.border":"#00000000"}}))},[o]),_.useEffect(()=>{o&&(o.languages.typescript.javascriptDefaults.setCompilerOptions({isolatedModules:!0}),o.languages.json.jsonDefaults.setDiagnosticsOptions({schemas:t?[{uri:window.location.href,fileMatch:["*"],schema:t}]:[]}))},[o,t]),_.useLayoutEffect(()=>{o&&o.editor.setTheme(l)},[o,l]),_.useEffect(()=>{if(!c)return;const S=c.getContainerDomNode().parentElement?.parentElement;if(!S)return;const b=()=>{p.current!==null&&cancelAnimationFrame(p.current),p.current=requestAnimationFrame(()=>{const{width:T,height:m}=S.getBoundingClientRect();c.layout({width:T,height:m}),p.current=null})};b();const R=new ResizeObserver(b);return R.observe(S),()=>{R.disconnect(),p.current!==null&&cancelAnimationFrame(p.current)}},[c]),_.useEffect(()=>{if(!c||!o||!n||g.current)return;const S=c.getModel();if(!S)return;if(t&&!e){g.current=!0,n(!1),g.current=!1;return}g.current=!0;const R=setTimeout(()=>{const m=o.editor.getModelMarkers({resource:S.uri}).length===0;n(m),g.current=!1},100);return()=>{clearTimeout(R),g.current=!1}},[c,o,n,e,t]);const h=_.useMemo(()=>t?JSON.stringify(t):"no-schema",[t]);return d.jsx(wh,{"data-testid":"json-editor",language:a,value:e,loading:"",theme:l,onMount:u,onChange:S=>{r?.(S??"")},onValidate:S=>{if(!n||g.current)return;g.current=!0,n(t&&!e?!1:S.length===0),g.current=!1},options:{automaticLayout:!1,readOnly:i,scrollBeyondLastLine:!1,minimap:{enabled:!1},overviewRulerLanes:0}},h)},Nh=_.memo(({schema:e})=>{const{setBody:t,setBodyIsValid:r}=K(),n=K(ie(Pm)),a=K(Sf),i=_.useRef(e),o=_.useRef(!1);_.useEffect(()=>{const l=i.current!==e;if(i.current=e,l&&(o.current=!1),e&&!a&&!o.current){t(JSON.stringify(Ae(e),null,2));return}e||(t(a||""),r(!0))},[e,a,t,r]);const s=_.useCallback(l=>{t(l),e&&!l?(r(!1),o.current=!0):o.current=!1},[t,e,r]);return d.jsxs("div",{className:"max-h-full h-full relative",children:[d.jsx(Ih,{value:a,schema:e,onChange:s,onValidate:r}),!n&&d.jsxs("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border p-3 text-sm dark:text-yellow-500 text-yellow-700 flex items-center gap-1 font-medium","data-testid":"endpoint-body-tab-invalid",children:[d.jsx(yb,{className:"w-4 h-4"}),"The body payload is invalid"]})]})});/**
82
+ `},Il=Hb(Yb)(Cf),Kb={config:Vb},Zb=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(a){return r.reduceRight(function(i,o){return o(i)},a)}};function Of(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],Of(e[r],t[r]))}),Al(Al({},e),t)}var Xb={type:"cancelation",msg:"operation is manually canceled"};function mt(e){var t=!1,r=new Promise(function(n,a){e.then(function(i){return t?a(Xb):n(i)}),e.catch(a)});return r.cancel=function(){return t=!0},r}var Jb=Gb.create({config:$b,isInitialized:!1,resolve:null,reject:null,monaco:null}),xf=Ab(Jb,2),qe=xf[0],nt=xf[1];function Qb(e){var t=Kb.config(e),r=t.monaco,n=Tb(t,["monaco"]);nt(function(a){return{config:Of(a.config,n),monaco:r}})}function eh(){var e=qe(function(t){var r=t.monaco,n=t.isInitialized,a=t.resolve;return{monaco:r,isInitialized:n,resolve:a}});if(!e.isInitialized){if(nt({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),mt(bt);if(window.monaco&&window.monaco.editor)return Lf(window.monaco),e.resolve(window.monaco),mt(bt);Zb(th,nh)(ah)}return mt(bt)}function th(e){return document.body.appendChild(e)}function rh(e){var t=document.createElement("script");return e&&(t.src=e),t}function nh(e){var t=qe(function(n){var a=n.config,i=n.reject;return{config:a,reject:i}}),r=rh("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function ah(){var e=qe(function(r){var n=r.config,a=r.resolve,i=r.reject;return{config:n,resolve:a,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){Lf(r),e.resolve(r)},function(r){e.reject(r)})}function Lf(e){qe().monaco||nt({monaco:e})}function ih(){return qe(function(e){var t=e.monaco;return t})}var bt=new Promise(function(e,t){return nt({resolve:e,reject:t})}),Qe={config:Qb,init:eh,__getMonacoInstance:ih},oh={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ht=oh,sh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},lh=sh;function uh({children:e}){return _.createElement("div",{style:lh.container},e)}var ch=uh,dh=ch;function ph({width:e,height:t,isEditorReady:r,loading:n,_ref:a,className:i,wrapperProps:o}){return _.createElement("section",{style:{...ht.wrapper,width:e,height:t},...o},!r&&_.createElement(dh,null,n),_.createElement("div",{ref:a,style:{...ht.fullWidth,...!r&&ht.hide},className:i}))}var gh=ph,Df=_.memo(gh);function fh(e){_.useEffect(e,[])}var ks=fh;function mh(e,t,r=!0){let n=_.useRef(!0);_.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var re=mh;function Fe(){}function we(e,t,r,n){return bh(e,n)||hh(e,t,r,n)}function bh(e,t){return e.editor.getModel(Mf(e,t))}function hh(e,t,r,n){return e.editor.createModel(t,r,n?Mf(e,n):void 0)}function Mf(e,t){return e.Uri.parse(t)}function Eh({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:a,originalModelPath:i,modifiedModelPath:o,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:p={},height:g="100%",width:h="100%",className:S,wrapperProps:b={},beforeMount:R=Fe,onMount:T=Fe}){let[m,E]=_.useState(!1),[v,y]=_.useState(!0),f=_.useRef(null),A=_.useRef(null),N=_.useRef(null),w=_.useRef(T),O=_.useRef(R),x=_.useRef(!1);ks(()=>{let M=Qe.init();return M.then(B=>(A.current=B)&&y(!1)).catch(B=>B?.type!=="cancelation"&&console.error("Monaco initialization: error:",B)),()=>f.current?$():M.cancel()}),re(()=>{if(f.current&&A.current){let M=f.current.getOriginalEditor(),B=we(A.current,e||"",n||r||"text",i||"");B!==M.getModel()&&M.setModel(B)}},[i],m),re(()=>{if(f.current&&A.current){let M=f.current.getModifiedEditor(),B=we(A.current,t||"",a||r||"text",o||"");B!==M.getModel()&&M.setModel(B)}},[o],m),re(()=>{let M=f.current.getModifiedEditor();M.getOption(A.current.editor.EditorOption.readOnly)?M.setValue(t||""):t!==M.getValue()&&(M.executeEdits("",[{range:M.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),M.pushUndoStop())},[t],m),re(()=>{f.current?.getModel()?.original.setValue(e||"")},[e],m),re(()=>{let{original:M,modified:B}=f.current.getModel();A.current.editor.setModelLanguage(M,n||r||"text"),A.current.editor.setModelLanguage(B,a||r||"text")},[r,n,a],m),re(()=>{A.current?.editor.setTheme(c)},[c],m),re(()=>{f.current?.updateOptions(p)},[p],m);let P=_.useCallback(()=>{if(!A.current)return;O.current(A.current);let M=we(A.current,e||"",n||r||"text",i||""),B=we(A.current,t||"",a||r||"text",o||"");f.current?.setModel({original:M,modified:B})},[r,t,a,e,n,i,o]),G=_.useCallback(()=>{!x.current&&N.current&&(f.current=A.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...p}),P(),A.current?.editor.setTheme(c),E(!0),x.current=!0)},[p,c,P]);_.useEffect(()=>{m&&w.current(f.current,A.current)},[m]),_.useEffect(()=>{!v&&!m&&G()},[v,m,G]);function $(){let M=f.current?.getModel();s||M?.original?.dispose(),l||M?.modified?.dispose(),f.current?.dispose()}return _.createElement(Df,{width:h,height:g,isEditorReady:m,loading:u,_ref:N,className:S,wrapperProps:b})}var yh=Eh;_.memo(yh);function Sh(){let[e,t]=_.useState(Qe.__getMonacoInstance());return ks(()=>{let r;return e||(r=Qe.init(),r.then(n=>{t(n)})),()=>r?.cancel()}),e}var vh=Sh;function Th(e){let t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}var Ah=Th,We=new Map;function Rh({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:a,path:i,theme:o="light",line:s,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:p=!0,keepCurrentModel:g=!1,width:h="100%",height:S="100%",className:b,wrapperProps:R={},beforeMount:T=Fe,onMount:m=Fe,onChange:E,onValidate:v=Fe}){let[y,f]=_.useState(!1),[A,N]=_.useState(!0),w=_.useRef(null),O=_.useRef(null),x=_.useRef(null),P=_.useRef(m),G=_.useRef(T),$=_.useRef(),M=_.useRef(n),B=Ah(i),q=_.useRef(!1),F=_.useRef(!1);ks(()=>{let C=Qe.init();return C.then(L=>(w.current=L)&&N(!1)).catch(L=>L?.type!=="cancelation"&&console.error("Monaco initialization: error:",L)),()=>O.current?I():C.cancel()}),re(()=>{let C=we(w.current,e||n||"",t||a||"",i||r||"");C!==O.current?.getModel()&&(p&&We.set(B,O.current?.saveViewState()),O.current?.setModel(C),p&&O.current?.restoreViewState(We.get(i)))},[i],y),re(()=>{O.current?.updateOptions(c)},[c],y),re(()=>{!O.current||n===void 0||(O.current.getOption(w.current.editor.EditorOption.readOnly)?O.current.setValue(n):n!==O.current.getValue()&&(F.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),O.current.pushUndoStop(),F.current=!1))},[n],y),re(()=>{let C=O.current?.getModel();C&&a&&w.current?.editor.setModelLanguage(C,a)},[a],y),re(()=>{s!==void 0&&O.current?.revealLine(s)},[s],y),re(()=>{w.current?.editor.setTheme(o)},[o],y);let j=_.useCallback(()=>{if(!(!x.current||!w.current)&&!q.current){G.current(w.current);let C=i||r,L=we(w.current,n||e||"",t||a||"",C||"");O.current=w.current?.editor.create(x.current,{model:L,automaticLayout:!0,...c},u),p&&O.current.restoreViewState(We.get(C)),w.current.editor.setTheme(o),s!==void 0&&O.current.revealLine(s),f(!0),q.current=!0}},[e,t,r,n,a,i,c,u,p,o,s]);_.useEffect(()=>{y&&P.current(O.current,w.current)},[y]),_.useEffect(()=>{!A&&!y&&j()},[A,y,j]),M.current=n,_.useEffect(()=>{y&&E&&($.current?.dispose(),$.current=O.current?.onDidChangeModelContent(C=>{F.current||E(O.current.getValue(),C)}))},[y,E]),_.useEffect(()=>{if(y){let C=w.current.editor.onDidChangeMarkers(L=>{let k=O.current.getModel()?.uri;if(k&&L.find(D=>D.path===k.path)){let D=w.current.editor.getModelMarkers({resource:k});v?.(D)}});return()=>{C?.dispose()}}return()=>{}},[y,v]);function I(){$.current?.dispose(),g?p&&We.set(i,O.current.saveViewState()):O.current.getModel()?.dispose(),O.current.dispose()}return _.createElement(Df,{width:h,height:S,isEditorReady:y,loading:l,_ref:x,className:b,wrapperProps:R})}var _h=Rh,wh=_.memo(_h);const Ih=({value:e,schema:t,onChange:r,onValidate:n,language:a="json",readOnly:i=!1})=>{const o=vh(),s=U.useThemeStore(S=>S.theme),l=_.useMemo(()=>s==="dark"?"transparent-dark":"transparent-light",[s]),[c,u]=_.useState(null),p=_.useRef(null),g=_.useRef(!1);_.useLayoutEffect(()=>{o&&(o.editor.defineTheme("transparent-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000","editor.lineHighlightBackground":"#00000000","editorLineNumber.foreground":"#999999","editorLineNumber.activeForeground":"#000000",focusBorder:"#00000000","widget.border":"#00000000","editor.border":"#00000000","editorWidget.border":"#00000000"}}),o.editor.defineTheme("transparent-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000","editor.lineHighlightBackground":"#00000000","editorLineNumber.foreground":"#666666","editorLineNumber.activeForeground":"#ffffff",focusBorder:"#00000000","widget.border":"#00000000","editor.border":"#00000000","editorWidget.border":"#00000000"}}))},[o]),_.useEffect(()=>{o&&(o.languages.typescript.javascriptDefaults.setCompilerOptions({isolatedModules:!0}),o.languages.json.jsonDefaults.setDiagnosticsOptions({schemas:t?[{uri:window.location.href,fileMatch:["*"],schema:t}]:[]}))},[o,t]),_.useLayoutEffect(()=>{o&&o.editor.setTheme(l)},[o,l]),_.useEffect(()=>{if(!c)return;const S=c.getContainerDomNode().parentElement?.parentElement;if(!S)return;const b=()=>{p.current!==null&&cancelAnimationFrame(p.current),p.current=requestAnimationFrame(()=>{const{width:T,height:m}=S.getBoundingClientRect();c.layout({width:T,height:m}),p.current=null})};b();const R=new ResizeObserver(b);return R.observe(S),()=>{R.disconnect(),p.current!==null&&cancelAnimationFrame(p.current)}},[c]),_.useEffect(()=>{if(!c||!o||!n||g.current)return;const S=c.getModel();if(!S)return;if(t&&!e){g.current=!0,n(!1),g.current=!1;return}g.current=!0;const R=setTimeout(()=>{const m=o.editor.getModelMarkers({resource:S.uri}).length===0;n(m),g.current=!1},100);return()=>{clearTimeout(R),g.current=!1}},[c,o,n,e,t]);const h=_.useMemo(()=>t?JSON.stringify(t):"no-schema",[t]);return d.jsx(wh,{"data-testid":"json-editor",language:a,value:e,loading:"",theme:l,onMount:u,onChange:S=>{r?.(S??"")},onValidate:S=>{if(!n||g.current)return;g.current=!0,n(t&&!e?!1:S.length===0),g.current=!1},options:{automaticLayout:!1,readOnly:i,scrollBeyondLastLine:!1,minimap:{enabled:!1},overviewRulerLanes:0}},h)},Nh=_.memo(({schema:e})=>{const{setBody:t,setBodyIsValid:r}=K(),n=K(ie(Pm)),a=K(Sf),i=_.useRef(e),o=_.useRef(!1);_.useEffect(()=>{const l=i.current!==e;if(i.current=e,l&&(o.current=!1),e&&!a&&!o.current){t(JSON.stringify(Ae(e),null,2));return}e||(t(a||""),r(!0))},[e,a,t,r]);const s=_.useCallback(l=>{t(l),e&&!l?(r(!1),o.current=!0):o.current=!1},[t,e,r]);return d.jsxs("div",{className:"max-h-full h-full relative",children:[d.jsx(Ih,{value:a,schema:e,onChange:s,onValidate:r}),n===!1&&d.jsxs("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border p-3 text-sm dark:text-yellow-500 text-yellow-700 flex items-center gap-1 font-medium","data-testid":"endpoint-body-tab-invalid",children:[d.jsx(yb,{className:"w-4 h-4"}),"The body payload is invalid"]})]})});/**
83
83
  * @license lucide-react v0.545.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
package/dist/index.js CHANGED
@@ -2572,7 +2572,7 @@ const Jh = ({
2572
2572
  );
2573
2573
  return /* @__PURE__ */ d.jsxs("div", { className: "max-h-full h-full relative", children: [
2574
2574
  /* @__PURE__ */ d.jsx(Jh, { value: a, schema: e, onChange: s, onValidate: r }),
2575
- !n && /* @__PURE__ */ d.jsxs(
2575
+ n === !1 && /* @__PURE__ */ d.jsxs(
2576
2576
  "div",
2577
2577
  {
2578
2578
  className: "absolute bottom-0 left-0 right-0 border-t border-border p-3 text-sm dark:text-yellow-500 text-yellow-700 flex items-center gap-1 font-medium",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motiadev/plugin-endpoint",
3
- "version": "0.11.1-beta.156-960492",
3
+ "version": "0.11.1-beta.156-491458",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,9 +31,9 @@
31
31
  "zustand": "^5.0.8"
32
32
  },
33
33
  "peerDependencies": {
34
- "@motiadev/core": "0.11.1-beta.156-960492",
35
- "@motiadev/stream-client-react": "0.11.1-beta.156-960492",
36
- "@motiadev/ui": "0.11.1-beta.156-960492"
34
+ "@motiadev/core": "0.11.1-beta.156-491458",
35
+ "@motiadev/stream-client-react": "0.11.1-beta.156-491458",
36
+ "@motiadev/ui": "0.11.1-beta.156-491458"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tailwindcss/vite": "^4.1.14",