mockforme 4.2.0 → 4.2.2

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/README.md CHANGED
@@ -43,7 +43,7 @@ yarn add mockforme
43
43
 
44
44
  * You can also directly use mockforme through script file using jsdelivr CDN.
45
45
  ```
46
- <script src="https://cdn.jsdelivr.net/npm/mockforme@4.1.0/dist/mockforme.client.umd.js"></script>
46
+ <script src="https://cdn.jsdelivr.net/npm/mockforme@latest/dist/mockforme.client.umd.js"></script>
47
47
 
48
48
  <script>
49
49
  console.log(window.mockforme);
package/dist/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><meta charset="utf-8"><title>mockforme - The best way to mock your APIs</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="mockforme.client.umd.js"></script></head><body></body></html>
1
+ <!doctype html><html><head><meta charset="utf-8"><title>mockforme - The best way to mock your APIs</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="mockforme.client.cjs.js"></script></head><body></body></html>
@@ -1 +1 @@
1
- function a0_0x3939(_0x8931bf,_0x3f78bb){const _0x214fd9=a0_0x214f();return a0_0x3939=function(_0x39396b,_0x2fb793){_0x39396b=_0x39396b-0x1c7;let _0x2a7929=_0x214fd9[_0x39396b];return _0x2a7929;},a0_0x3939(_0x8931bf,_0x3f78bb);}(function(_0x2d8e5a,_0x12d4c5){const _0x2122ab=a0_0x3939,_0x26d2e7=_0x2d8e5a();while(!![]){try{const _0x4083e8=-parseInt(_0x2122ab(0x1f5))/0x1*(parseInt(_0x2122ab(0x1e0))/0x2)+-parseInt(_0x2122ab(0x1d4))/0x3+-parseInt(_0x2122ab(0x1ca))/0x4+parseInt(_0x2122ab(0x1c9))/0x5+parseInt(_0x2122ab(0x1d8))/0x6+-parseInt(_0x2122ab(0x1dc))/0x7*(parseInt(_0x2122ab(0x1df))/0x8)+parseInt(_0x2122ab(0x1c7))/0x9;if(_0x4083e8===_0x12d4c5)break;else _0x26d2e7['push'](_0x26d2e7['shift']());}catch(_0x577f2f){_0x26d2e7['push'](_0x26d2e7['shift']());}}}(a0_0x214f,0x3a28e),((()=>{'use strict';const _0x506bee=a0_0x3939;var _0x5edeeb={'d':(_0x5b4a08,_0x39b09b)=>{const _0x488921=a0_0x3939;for(var _0x131934 in _0x39b09b)_0x5edeeb['o'](_0x39b09b,_0x131934)&&!_0x5edeeb['o'](_0x5b4a08,_0x131934)&&Object[_0x488921(0x20a)](_0x5b4a08,_0x131934,{'enumerable':!0x0,'get':_0x39b09b[_0x131934]});},'o':(_0x1ab1fe,_0x24bc57)=>Object[_0x506bee(0x1cc)][_0x506bee(0x1e9)]['call'](_0x1ab1fe,_0x24bc57),'r':_0x5a1ff7=>{const _0x1e1cb7=_0x506bee,_0x409263={};_0x409263['value']='Module';const _0x98a542={};_0x98a542['value']=!0x0,('undefined'!=typeof Symbol&&Symbol['toStringTag']&&Object['defineProperty'](_0x5a1ff7,Symbol['toStringTag'],_0x409263),Object['defineProperty'](_0x5a1ff7,_0x1e1cb7(0x201),_0x98a542));}},_0x16d4c5={};const _0x3bcc5b={};_0x3bcc5b['mockforme']=()=>_0x10b400,(_0x5edeeb['r'](_0x16d4c5),_0x5edeeb['d'](_0x16d4c5,_0x3bcc5b));const _0x16d9b6=_0x565f8a=>{try{return _0x565f8a?_0x565f8a['toLowerCase']():_0x565f8a;}catch(_0x324b1c){return console['log'](_0x324b1c),null;}},_0x479d4d=()=>_0x506bee(0x1f3)==typeof window,_0xbe3072=function(_0x4ef40a,_0x46eedb,_0x32330f){const _0xfa6c87=_0x506bee,_0x1c2faf=_0x479d4d();var _0x29a39d;function _0x5aaa89(){const _0x30b975=a0_0x3939;if(0x4==_0x29a39d[_0x30b975(0x1ec)]){if(_0x29a39d['status'][_0x30b975(0x1ef)]()[_0x30b975(0x1d3)](/^20[0-9]$/)){var _0x380824=(function(){const _0x594f7f=_0x30b975;var _0x1f4354=_0x29a39d[_0x594f7f(0x1f7)](_0x594f7f(0x1ea)),_0x43b358=_0x29a39d[_0x594f7f(0x1db)];if(_0x1f4354){var _0x335b72=_0x1f4354[_0x594f7f(0x1f1)](';');try{return _0x594f7f(0x1e3)===_0x335b72[0x0]?JSON['parse'](_0x43b358):_0x43b358;}catch(_0x23ae63){throw'Unable\x20to\x20convert\x20response\x20header';}}}());_0x46eedb[_0x30b975(0x1de)](this,_0x380824,_0x29a39d);}else _0x32330f['call'](this,_0x29a39d[_0x30b975(0x1db)],_0x29a39d);}}function _0x1d9850(_0x89ed4b,_0x489965){const _0x47f2d3=a0_0x3939;var _0x45ba98=[];for(var _0x3ec9cc in _0x89ed4b)if(_0x89ed4b[_0x47f2d3(0x1e9)](_0x3ec9cc)){var _0x115f5c=_0x489965?_0x489965+'['+_0x3ec9cc+']':_0x3ec9cc,_0x2da00d=_0x89ed4b[_0x3ec9cc];_0x45ba98[_0x47f2d3(0x1c8)](_0x47f2d3(0x1e2)==typeof _0x2da00d?_0x1d9850(_0x2da00d,_0x115f5c):encodeURIComponent(_0x115f5c)+'='+encodeURIComponent(_0x2da00d));}return _0x45ba98['join']('&');}return _0x1c2faf||(window['XMLHttpRequest']?_0x29a39d=new XMLHttpRequest():window['ActiveXObject']&&(_0x29a39d=new ActiveXObject(_0xfa6c87(0x200)))),{'request':function(){const _0x5c3918=_0xfa6c87;if(!_0x1c2faf){if(window['XMLHttpRequest'])_0x29a39d['onload']=_0x5aaa89;else{if(!window[_0x5c3918(0x1d9)])throw _0x5c3918(0x20b);_0x29a39d['onreadystatechange']=_0x5aaa89;}var _0x427fc5=_0x1d9850(_0x4ef40a['params']);if('get'==_0x4ef40a['method'][_0x5c3918(0x20d)]()&&'object'==typeof _0x4ef40a[_0x5c3918(0x1eb)]){if(-0x1==_0x4ef40a[_0x5c3918(0x205)][_0x5c3918(0x207)]('?'))_0x4ef40a['url']+='?';else{var _0x4731b0=_0x4ef40a[_0x5c3918(0x205)][_0x5c3918(0x1f1)]('?');_0x4731b0[0x1]&&_0x4731b0[0x1]['split']('=')[0x1]&&(_0x4ef40a['url']+='&');}_0x4ef40a['url']+=_0x427fc5;}_0x4ef40a['hasOwnProperty']('async')||(_0x4ef40a['async']=!0x0),_0x29a39d[_0x5c3918(0x1ee)](_0x4ef40a[_0x5c3918(0x1d5)],_0x4ef40a[_0x5c3918(0x205)],_0x4ef40a['async']),_0x4ef40a[_0x5c3918(0x1e4)]&&function(_0x5838e3){const _0x57927f=_0x5c3918;for(let _0x3045ab in _0x5838e3)_0x29a39d[_0x57927f(0x1d7)](_0x3045ab,_0x5838e3[_0x3045ab]);}(_0x4ef40a[_0x5c3918(0x1e4)]),_0x29a39d['send'](_0x427fc5);}}};},_0x16dfd3=(_0xd878f5,_0x6616d2)=>{const _0xacb3c0=_0x506bee,_0x4c85d6=_0xd878f5['split']('/'),_0x5e0cdc=_0x6616d2[_0xacb3c0(0x1f1)]('/');if(_0x4c85d6['length']!==_0x5e0cdc['length'])return!0x1;for(let _0x33f959=0x0;_0x33f959<_0x4c85d6[_0xacb3c0(0x204)];_0x33f959++){const _0x3065c4=_0x4c85d6[_0x33f959];if(_0x3065c4!==_0x5e0cdc[_0x33f959]&&_0xacb3c0(0x1fc)!==_0x3065c4)return!0x1;}return!0x0;};let _0x3380e6=null;const _0x25e49c=(_0x59f633,_0x540d86=null,_0x39e3cd='JAVASCRIPT')=>{const _0x18cbd7=_0x506bee,_0x151b4b={};_0x151b4b[_0x18cbd7(0x1f6)]=[],_0x151b4b['_o']=null,_0x151b4b['mk']=null,_0x151b4b[_0x18cbd7(0x20c)]=null,(_0x3380e6=_0x59f633,_0x540d86||(_0x540d86=_0x151b4b));const _0x357fe7=_0x540d86[_0x18cbd7(0x1f6)]||[],_0x55161c=_0x540d86['_o']||null,_0x1e4768=_0x540d86['mk']||null,_0x568627=_0x540d86['_mck']||null;if(_0x479d4d())return;const _0x342ce2='https://api.mockforme.com',_0x1e8e9f=_0x342ce2+_0x18cbd7(0x206);let _0xf8256f=_0x342ce2+'/gateway/3f4eae522b';const _0x99d9fa=_0x18cbd7(0x1fe),_0x4e4a2c=_0x18cbd7(0x1e7),_0x16b729=_0x18cbd7(0x1f0);let _0x592499=_0x55161c||null,_0x424f38=_0x1e4768,_0x2b729a=_0x568627,_0x2a398c=_0x357fe7||[];const _0x57f326=window['location'];if(_0x57f326['protocol'],_0x57f326['host'],_0x57f326[_0x18cbd7(0x1da)],!_0x59f633)throw'mockforme\x20token\x20cannot\x20be\x20null';const _0x27be41=()=>_0x1e8e9f+'/'+_0x592499+'/'+_0x424f38,_0x2c280c=(_0x555643,_0x58cb27=_0x18cbd7(0x1f2))=>{const _0x115624=_0x18cbd7;let _0x417efb=null;if(!Array['isArray'](_0x2a398c))return _0x417efb;for(let _0x12f401=0x0;_0x12f401<_0x2a398c[_0x115624(0x204)];_0x12f401++){const _0x5d8dc8=_0x2a398c[_0x12f401];if(_0x16d9b6(_0x5d8dc8['apiMethod'])===_0x16d9b6(_0x58cb27)&&(_0x5d8dc8[_0x115624(0x1d0)]===_0x555643||_0x16dfd3(_0x5d8dc8['apiEndpoint'],_0x555643))){const _0x40a2c0={};_0x40a2c0['url']=_0x555643,_0x40a2c0[_0x115624(0x1d5)]=_0x5d8dc8['apiMethod'],_0x40a2c0['_ack']=_0x5d8dc8?.['_ack']||null,(_0x417efb=_0x40a2c0,_0x5d8dc8['_ri_']&&(_0x417efb[_0x115624(0x1fa)]=_0x5d8dc8['_ri_']));break;}}return _0x417efb;},_0x1dab19=()=>{((()=>{const _0x28c041=a0_0x3939,_0x5d2f46=window['fetch'];window[_0x28c041(0x1e8)]=function(_0x3af4d6,_0x38212e){const _0xf7acd8=_0x28c041;let _0x50af86=_0x3af4d6;try{_0xf7acd8(0x1d1)==typeof _0x3af4d6&&(_0x3af4d6[_0xf7acd8(0x208)]('//')?_0x50af86=''+window[_0xf7acd8(0x1cf)]['protocol']+_0x3af4d6:_0x3af4d6['startsWith']('/')?_0x50af86=''+window[_0xf7acd8(0x1cf)]['origin']+_0x3af4d6:_0x3af4d6['includes'](_0xf7acd8(0x20e))||(_0x50af86=new URL(_0x3af4d6,window[_0xf7acd8(0x1cf)][_0xf7acd8(0x209)])['toString']()));let _0x3cd4b7='',_0x2d74c2='';try{const _0x5ccc8a=new URL(_0x50af86);_0x3cd4b7=_0x5ccc8a[_0xf7acd8(0x1dd)],_0x2d74c2=_0x5ccc8a['search'];}catch(_0xea1949){console[_0xf7acd8(0x1ff)]('Failed\x20to\x20parse\x20fetch\x20URL:',_0x50af86,_0xea1949);}(_0x38212e=_0x38212e||{})[_0xf7acd8(0x1d5)]||(_0x38212e[_0xf7acd8(0x1d5)]='get');const _0x15a680=_0x38212e['method'],_0x112e26=_0x2c280c(_0x3cd4b7,_0x15a680);if(_0x112e26){_0x50af86=''+_0x27be41()+_0x112e26['url']+_0x2d74c2,_0x38212e[_0xf7acd8(0x1e4)]={..._0x38212e['headers']||{},[_0x99d9fa]:_0x3380e6,[_0x4e4a2c]:_0x16b729,'x-mfm-adaptor':_0x39e3cd};const _0x3cb744=_0x112e26?.['_ack'];_0x2b729a&&_0x3cb744&&(_0x38212e[_0xf7acd8(0x1e4)][_0xf7acd8(0x1fb)]=_0x2b729a+'-'+_0x3cb744),_0x112e26[_0xf7acd8(0x1fa)]&&(_0x38212e[_0xf7acd8(0x1e4)]['_ri_']=_0x112e26[_0xf7acd8(0x1fa)]);}return _0x5d2f46['call'](this,_0x50af86,_0x38212e);}catch(_0x26a20f){return console[_0xf7acd8(0x1fd)]('Fetch\x20interceptor\x20error:',_0x26a20f),_0x5d2f46[_0xf7acd8(0x1e1)](this,arguments);}};})()),((()=>{const _0x708d8d=a0_0x3939,_0x538422=window['XMLHttpRequest'][_0x708d8d(0x1cc)]['open'];window[_0x708d8d(0x203)]['prototype'][_0x708d8d(0x1ee)]=function(_0x5658c2,_0x4c46d2,_0x4826ae,_0x5d03a2,_0xaeac17){const _0x28d79f=_0x708d8d,_0x59cc2e=arguments;try{let _0x20e586=_0x4c46d2;try{_0x20e586=_0x4c46d2['startsWith']('//')?''+window[_0x28d79f(0x1cf)]['protocol']+_0x4c46d2:_0x4c46d2[_0x28d79f(0x208)]('/')?''+window['location']['origin']+_0x4c46d2:_0x4c46d2['includes'](_0x28d79f(0x20e))?_0x4c46d2:new URL(_0x4c46d2,window['location']['origin'])['toString']();}catch(_0x7fd66b){console['warn']('Failed\x20to\x20normalize\x20URL:',_0x4c46d2,_0x7fd66b);}let _0x193871='',_0x2f11f4='';try{const _0x2f8080=new URL(_0x20e586);_0x193871=_0x2f8080[_0x28d79f(0x1dd)],_0x2f11f4=_0x2f8080['search'];}catch(_0x88e264){console[_0x28d79f(0x1ff)]('Failed\x20to\x20parse\x20finalUrl:',_0x20e586,_0x88e264);}const _0x3f806f=_0x2c280c(_0x193871,_0x5658c2);return _0x3f806f&&(_0x20e586=''+_0x27be41()+_0x3f806f[_0x28d79f(0x205)]+_0x2f11f4),_0x59cc2e[0x1]=_0x20e586,this['onreadystatechange']=function(){const _0x26b3b3=_0x28d79f;if(0x1===this[_0x26b3b3(0x1ec)])try{const _0x22305b=new URL(_0x20e586);if(['api.mockforme.com',_0x26b3b3(0x1cd)]['includes'](_0x22305b['hostname'])){this['setRequestHeader'](_0x99d9fa,_0x3380e6),this['setRequestHeader'](_0x4e4a2c,_0x16b729),this[_0x26b3b3(0x1d7)]('x-mfm-adaptor',_0x39e3cd);const _0x3813fc=_0x3f806f?.[_0x26b3b3(0x1ce)];_0x2b729a&&_0x3813fc&&this['setRequestHeader']('x-mfm-key',_0x2b729a+'-'+_0x3813fc),_0x3f806f&&_0x3f806f[_0x26b3b3(0x1fa)]&&this[_0x26b3b3(0x1d7)]('_ri_',_0x3f806f[_0x26b3b3(0x1fa)]);}}catch(_0x461fa0){console['warn'](_0x26b3b3(0x1e5),_0x20e586,_0x461fa0);}},_0x538422['apply'](this,_0x59cc2e);}catch(_0x204b99){return console['error'](_0x28d79f(0x1f4),_0x204b99),_0x538422[_0x28d79f(0x1e1)](this,arguments);}};})());},_0x3c434b=(_0x46f423,_0x1e5eea)=>{const _0x3c7963=_0x18cbd7,_0x3f237b={};_0x3f237b['method']='get',_0x3f237b[_0x3c7963(0x205)]=_0xf8256f,_0x3f237b[_0x3c7963(0x1d2)]=!0x1,_0xbe3072(_0x3f237b,_0x535a88=>{const _0x219dca=_0x3c7963;if(_0x535a88){const {di:_0x27df9e,iv:_0x2a2db5,_o:_0x3b9107,_mck:_0x19b03f,mk:_0x182d5f}=_0x535a88;_0x592499=_0x3b9107,_0x424f38=_0x182d5f,_0x2b729a=_0x19b03f;const _0x252dfb=function({di:_0x316569,iv:_0x407fab},_0x1a32b7){const _0x290844=a0_0x3939;var _0x35d23c;const _0x240a9f=function(_0x4c5f54,_0x6ab7e9){const _0x308054=a0_0x3939,_0x361ced=_0x6ab7e9[_0x308054(0x204)];return _0x4c5f54[_0x308054(0x1f1)]('')[_0x308054(0x1e6)]((_0x4ff04a,_0x5a773e)=>String['fromCharCode'](_0x4ff04a[_0x308054(0x1cb)](0x0)^_0x6ab7e9['charCodeAt'](_0x5a773e%_0x361ced)))[_0x308054(0x1ed)]('');}((_0x35d23c=_0x316569,_0x290844(0x1f3)!=typeof Buffer?Buffer['from'](_0x35d23c,_0x290844(0x202))['toString'](_0x290844(0x1f9)):decodeURIComponent(escape(atob(_0x35d23c)))),_0x1a32b7+_0x407fab);return JSON['parse'](_0x240a9f);}({'di':_0x27df9e,'iv':_0x2a2db5},_0x3b9107);_0x252dfb&&(_0x66beb4=_0x252dfb,_0x2a398c=_0x2a398c[_0x219dca(0x1f8)](_0x66beb4),_0x46f423(_0x252dfb));}var _0x66beb4;},_0x11fd17=>{console['log']('Error\x20in\x20loading\x20mocked\x20apis'),_0x1e5eea(_0x11fd17);})[_0x3c7963(0x1d6)]();};return{'run':(_0x252d9c,_0xa472b6=()=>{})=>{_0x1dab19(),_0x592499&&_0x424f38?_0x252d9c(_0x2a398c,{'_o':_0x592499,'mk':_0x424f38,'_mck':_0x2b729a}):_0x3c434b(_0x4edc06=>{const _0x37f289=a0_0x3939,_0x50aca3={};_0x50aca3['_o']=_0x592499,_0x50aca3['mk']=_0x424f38,_0x50aca3[_0x37f289(0x20c)]=_0x2b729a,_0x252d9c&&_0x252d9c(_0x4edc06,_0x50aca3);},_0xa472b6);}};},_0x8b778e=_0x479d4d();_0x8b778e||(window['mockforme']=_0x25e49c);let _0x49dd90=_0x25e49c;_0x8b778e&&(_0x49dd90=_0x57ad54=>({'run':()=>{}}));const _0x10b400=_0x49dd90;module['exports']=_0x16d4c5;})()));function a0_0x214f(){const _0x18a2e5=['split','get','undefined','XHR\x20interceptor\x20failed:','1AYCpxb','mappings','getResponseHeader','concat','utf8','_ri_','x-mfm-key',':any','error','mockforme','warn','Microsoft.XMLHTTP','__esModule','base64','XMLHttpRequest','length','url','/mockforme','indexOf','startsWith','origin','defineProperty','unable\x20to\x20process\x20ajax','_mck','toLowerCase','://','1438956IOnmvb','push','1962655joMhgm','611620hVIjja','charCodeAt','prototype','dashboard.mockforme.com','_ack','location','apiEndpoint','string','async','match','1138986jMTjoz','method','request','setRequestHeader','2568942lCvvwH','ActiveXObject','port','responseText','140PTTiYn','pathname','call','80024QkkkVp','19446lgvUul','apply','object','application/json','headers','Error\x20setting\x20headers:','map','mfmver','fetch','hasOwnProperty','Content-Type','params','readyState','join','open','toString','4.2.0'];a0_0x214f=function(){return _0x18a2e5;};return a0_0x214f();}
1
+ (()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{mockforme:()=>S});const r=()=>"undefined"!=typeof process&&null!=process.versions?.node,o=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},n=(e,t)=>{const r=e.split("/"),o=t.split("/");if(r.length!==o.length)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(t!==o[e]&&":any"!==t)return!1}return!0};let s=[];function i(e){s=e}function a(){return s}function d(e,t="get"){for(const r of s)if(o(r.apiMethod)===o(t)&&(r.apiEndpoint===e||n(r.apiEndpoint,e))){const t={url:e,method:r.apiMethod,_ack:r._ack||null};return r._ri_&&(t._ri_=r._ri_),t}return null}const c="CHROME_EXTENSION",h="mfmver",u="mockforme",l="4.2.1",p="https://api.mockforme.com",m=`${p}/mockforme`,f=`${p}/gateway/3f4eae522b`;let _=null,y=null,w=null;function g({_o:e,mk:t,_mck:r}){_=e,y=t,w=r}function v(){return`${m}/${_}/${y}`}function b(){return w}function E(e,t){!function(e,t){const r=window.fetch;window.fetch=function(o,n={}){const s="string"==typeof o?o:o.url;try{const i=new URL(s,window.location.origin),{pathname:a,search:p}=i;let m="get";n&&n.method?m=n.method:o instanceof Request&&o.method&&(m=o.method),m=m.toLowerCase();const f=d(a,m);if(!f)return r(o,n);const _=`${v()}${f.url}${p}`,y={[u]:e,[h]:l,"x-mfm-adaptor":t},w=b();w&&f._ack&&(y["x-mfm-key"]=`${w}-${f._ack}`),f._ri_&&(y._ri_=f._ri_);const g=o instanceof Request?o.headers:n.headers,E=new Headers(g||{});Object.entries(y).forEach((([e,t])=>{E.set(e,t)}));let k=n.body;if(!k&&o instanceof Request){const e=o.clone();"GET"!==e.method&&"HEAD"!==e.method&&(k=e.text())}const x={method:m,headers:E,credentials:n.credentials||"same-origin",mode:n.mode||"cors"},R=e=>(e&&(x.body=e),t===c?(({actualUrl:e,url:t,method:r,headers:o,body:n,credentials:s,mode:i})=>{const a=`${Date.now()}-${Math.random()}`;return new Promise(((d,c)=>{window.addEventListener("message",(function e(t){if(t.source!==window)return;const r=t.data;if("INTERCEPTED_RESPONSE"===r?.type&&r?.requestId===a){if(window.removeEventListener("message",e),r?.response?.error)return c(new Error(r.response.message));const{status:t,headers:o,body:n}=r.response;d(new Response(n,{status:t,headers:o}))}})),window.postMessage({type:"REQUEST_INTERCEPTED",requestId:a,payload:{actualUrl:e,url:t,method:r,headers:o,body:n,credentials:s,mode:i}},"*")}))})({actualUrl:s,url:_,method:m,headers:Object.fromEntries(E.entries()),body:e,credentials:x.credentials,mode:x.mode}):fetch(_,x).then((e=>{const t=e.clone();return(t.headers.get("content-type")||"").includes("application/json")?t.json().then((r=>new Response(JSON.stringify(r),{status:e.status,headers:t.headers}))):t.text().then((r=>new Response(r,{status:e.status,headers:t.headers})))})).catch((e=>(console.warn("mockforme fetch interceptor error",e),r(o,n)))));return k instanceof Promise?k.then((e=>R(e))):R(k)}catch(e){return console.warn("mockforme fetch interceptor error",e),r(o,n)}}}(e,t),function(e,t){const r=window.XMLHttpRequest;window.XMLHttpRequest=class{constructor(){this._xhr=new r,this._headers={},this._method=null,this._url=null,this._body=null,this._setupEventHandlers()}_setupEventHandlers(){const e=["onload","onerror","onabort","ontimeout","onreadystatechange"];for(const t of e)Object.defineProperty(this,t,{get:()=>this._xhr[t],set:e=>{this._xhr[t]=e}})}open(e,t,r=!0,o=null,n=null){return this._method=e.toUpperCase(),this._url=new URL(t,window.location.href).toString(),this._xhr._mockOriginalUrl=this._url,this._xhr._mockMethod=this._method,this._xhr.open(e,t,r,o,n)}setRequestHeader(e,t){return this._headers[e]=t,this._xhr.setRequestHeader(e,t)}send(o){this._body=o;try{const n=new URL(this._url),{pathname:s,search:i}=n,a=d(s,this._method);if(!a)return this._xhr.send(o);const p=`${v()}${a.url}${i}`,m={[u]:e,[h]:l,"x-mfm-adaptor":t},f=b();f&&a._ack&&(m["x-mfm-key"]=`${f}-${a._ack}`),a._ri_&&(m._ri_=a._ri_);const _={...this._headers,...m};if(t===c)(({actualUrl:e,url:t,method:r,headers:o,body:n,onSuccess:s,onError:i})=>{const a=`${Date.now()}-${Math.random()}`;window.addEventListener("message",(function e(t){if(t.source!==window)return;const r=t.data;if("INTERCEPTED_RESPONSE"===r.type&&r.requestId===a){if(window.removeEventListener("message",e),r.response?.error)return i?.(r.response.message);const{body:t,status:o,headers:n}=r.response;s?.({body:t,status:o,headers:n})}})),window.postMessage({type:"REQUEST_INTERCEPTED",requestId:a,payload:{actualUrl:e,url:t,method:r,headers:o,body:n,credentials:"same-origin",mode:"cors"}},"*")})({actualUrl:this._url,url:p,method:this._method,headers:_,body:this._body,onSuccess:({body:e,status:t})=>{Object.defineProperty(this,"responseText",{value:e}),Object.defineProperty(this,"status",{value:t}),Object.defineProperty(this,"readyState",{value:4}),this.onreadystatechange?.(),this.onload?.()},onError:e=>{Object.defineProperty(this,"readyState",{value:4}),this.onerror?.(new Error(e.message||"XHR mock error"))}});else{const e=new r;e.open(this._method,p,!0);for(const t in _)e.setRequestHeader(t,_[t]);e.onload=()=>{Object.defineProperty(this,"responseText",{value:e.responseText}),Object.defineProperty(this,"status",{value:e.status}),Object.defineProperty(this,"readyState",{value:4}),this.onreadystatechange?.(),this.onload?.()},e.onerror=()=>{Object.defineProperty(this,"readyState",{value:4}),this.onerror?.()},e.send(this._body)}}catch(e){return console.error("[mockforme][XHR] interception error",e),this._xhr.send(o)}}addEventListener(...e){return this._xhr.addEventListener(...e)}removeEventListener(...e){return this._xhr.removeEventListener(...e)}dispatchEvent(...e){return this._xhr.dispatchEvent(...e)}abort(){return this._xhr.abort()}getAllResponseHeaders(){return this._xhr.getAllResponseHeaders()}getResponseHeader(e){return this._xhr.getResponseHeader(e)}overrideMimeType(e){return this._xhr.overrideMimeType(e)}get readyState(){return this._xhr.readyState}get responseText(){return this._xhr.responseText}get status(){return this._xhr.status}get response(){return this._xhr.response}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get withCredentials(){return this._xhr.withCredentials}set withCredentials(e){this._xhr.withCredentials=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}get upload(){return this._xhr.upload}}}(e,t)}const k=function(e,t,o){const n=r();var s;function i(){if(4==s.readyState)if(s.status.toString().match(/^20[0-9]$/)){var e=function(){var e=s.getResponseHeader("Content-Type"),t=s.responseText;if(e){var r=e.split(";");try{return"application/json"===r[0]?JSON.parse(t):t}catch(e){throw"Unable to convert response header"}}}();t.call(this,e,s)}else o.call(this,s.responseText,s)}function a(e,t){var r=[];for(var o in e)if(e.hasOwnProperty(o)){var n=t?t+"["+o+"]":o,s=e[o];r.push("object"==typeof s?a(s,n):encodeURIComponent(n)+"="+encodeURIComponent(s))}return r.join("&")}return n||(window.XMLHttpRequest?s=new XMLHttpRequest:window.ActiveXObject&&(s=new ActiveXObject("Microsoft.XMLHTTP"))),{request:function(){if(!n){if(window.XMLHttpRequest)s.onload=i;else{if(!window.ActiveXObject)throw"unable to process ajax";s.onreadystatechange=i}var t=a(e.params);if("get"==e.method.toLowerCase()&&"object"==typeof e.params){if(-1==e.url.indexOf("?"))e.url+="?";else{var r=e.url.split("?");r[1]&&r[1].split("=")[1]&&(e.url+="&")}e.url+=t}e.hasOwnProperty("async")||(e.async=!0),s.open(e.method,e.url,e.async),e.headers&&function(e){for(let t in e)s.setRequestHeader(t,e[t])}(e.headers),s.send(t)}}}};function x({di:e,iv:t},r){var o;const n=function(e,t){const r=t.length;return e.split("").map(((e,o)=>String.fromCharCode(e.charCodeAt(0)^t.charCodeAt(o%r)))).join("")}((o=e,"undefined"!=typeof Buffer?Buffer.from(o,"base64").toString("utf8"):decodeURIComponent(escape(atob(o)))),r+t);return JSON.parse(n)}const R=(e,t=null,o="JAVASCRIPT")=>{if(r())return;t||={mappings:[],_o:null,mk:null,_mck:null};const{mappings:n=[],_o:s,mk:c,_mck:p}=t;return i(n),g({_o:s,mk:c,_mck:p}),{run:(t,r=()=>{})=>{E(e,o),s&&c?t(a(),{_o:s,mk:c,_mck:p}):function(e,r,o,n){k({method:"get",url:f,async:!1,headers:{[u]:e,[h]:l,"x-mfm-adaptor":r}},(e=>{if(e){const{di:n,iv:s,_o:a,_mck:d,mk:c}=e,h=x({di:n,iv:s},a);g({_o:a,mk:c,_mck:d}),h&&(i(h),r=h,o={_o:a,mk:c,_mck:d},t?.(r,o))}var r,o}),(e=>{console.log("Error in loading mocked apis"),n(e)})).request()}(e,o,0,r)},checkIfApiToBeMocked:d,getMappings:a,doFetchMappings:(t,r)=>{!function(e,t,r,o){fetch(f,{method:"GET",headers:{[u]:e,[h]:l,"x-mfm-adaptor":t}}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return e.json()})).then((e=>{if(e){const{di:t,iv:o,_o:n,_mck:s,mk:a}=e,d=x({di:t,iv:o},n);g({_o:n,mk:a,_mck:s}),d&&(i(d),r(d,{_o:n,mk:a,_mck:s}))}})).catch((e=>{console.error("Error in loading mocked APIs:",e),o(e)}))}(e,o,((e,r)=>{t?.(e,r)}),r)}}},T=r();T||(globalThis.mockforme=R);let O=R;T&&(O=e=>({run:()=>{}}));const S=O;module.exports=t})();
@@ -1 +1 @@
1
- function a0_0x5101(_0x28f033,_0x2415b8){const _0xcc872f=a0_0xcc87();return a0_0x5101=function(_0x510178,_0x36b60f){_0x510178=_0x510178-0x13e;let _0x33ae5f=_0xcc872f[_0x510178];return _0x33ae5f;},a0_0x5101(_0x28f033,_0x2415b8);}const a0_0x31d952=a0_0x5101;(function(_0x2a29f7,_0x321cd1){const _0x1e3fba=a0_0x5101,_0x588a5d=_0x2a29f7();while(!![]){try{const _0x351ef8=-parseInt(_0x1e3fba(0x178))/0x1+-parseInt(_0x1e3fba(0x176))/0x2+-parseInt(_0x1e3fba(0x152))/0x3+-parseInt(_0x1e3fba(0x13f))/0x4*(parseInt(_0x1e3fba(0x151))/0x5)+parseInt(_0x1e3fba(0x160))/0x6+parseInt(_0x1e3fba(0x162))/0x7+parseInt(_0x1e3fba(0x16e))/0x8*(parseInt(_0x1e3fba(0x14f))/0x9);if(_0x351ef8===_0x321cd1)break;else _0x588a5d['push'](_0x588a5d['shift']());}catch(_0x16f8b8){_0x588a5d['push'](_0x588a5d['shift']());}}}(a0_0xcc87,0xaf907));var t={'d':(_0x3e71f5,_0x397ed7)=>{const _0x1e7b65=a0_0x5101;for(var _0x46571e in _0x397ed7)t['o'](_0x397ed7,_0x46571e)&&!t['o'](_0x3e71f5,_0x46571e)&&Object[_0x1e7b65(0x15f)](_0x3e71f5,_0x46571e,{'enumerable':!0x0,'get':_0x397ed7[_0x46571e]});},'o':(_0x154f8e,_0x291425)=>Object['prototype'][a0_0x31d952(0x13e)]['call'](_0x154f8e,_0x291425)},e={};const a0_0x28548e={};a0_0x28548e['_']=()=>d,t['d'](e,a0_0x28548e);const o=_0x3eed83=>{const _0x1f9587=a0_0x31d952;try{return _0x3eed83?_0x3eed83['toLowerCase']():_0x3eed83;}catch(_0x2bff77){return console[_0x1f9587(0x15a)](_0x2bff77),null;}},n=()=>a0_0x31d952(0x17e)==typeof window,r=function(_0x3af962,_0x22db00,_0x42fd2c){const _0x1be75d=a0_0x31d952,_0x2d2045=n();var _0x46c352;function _0x4d54fd(){const _0x5c7f9b=a0_0x5101;if(0x4==_0x46c352[_0x5c7f9b(0x15b)]){if(_0x46c352['status']['toString']()[_0x5c7f9b(0x171)](/^20[0-9]$/)){var _0x47fe2a=(function(){const _0x25a4ca=_0x5c7f9b;var _0x4082c0=_0x46c352[_0x25a4ca(0x153)](_0x25a4ca(0x149)),_0x597e5b=_0x46c352[_0x25a4ca(0x14b)];if(_0x4082c0){var _0x2a6c13=_0x4082c0[_0x25a4ca(0x170)](';');try{return'application/json'===_0x2a6c13[0x0]?JSON['parse'](_0x597e5b):_0x597e5b;}catch(_0x228294){throw'Unable\x20to\x20convert\x20response\x20header';}}}());_0x22db00['call'](this,_0x47fe2a,_0x46c352);}else _0x42fd2c['call'](this,_0x46c352['responseText'],_0x46c352);}}function _0x437835(_0x4af2ed,_0x1325e7){const _0x3968bd=a0_0x5101;var _0x28d9d8=[];for(var _0xdf673e in _0x4af2ed)if(_0x4af2ed['hasOwnProperty'](_0xdf673e)){var _0x2c6372=_0x1325e7?_0x1325e7+'['+_0xdf673e+']':_0xdf673e,_0x15394c=_0x4af2ed[_0xdf673e];_0x28d9d8['push']('object'==typeof _0x15394c?_0x437835(_0x15394c,_0x2c6372):encodeURIComponent(_0x2c6372)+'='+encodeURIComponent(_0x15394c));}return _0x28d9d8[_0x3968bd(0x145)]('&');}return _0x2d2045||(window[_0x1be75d(0x155)]?_0x46c352=new XMLHttpRequest():window[_0x1be75d(0x17b)]&&(_0x46c352=new ActiveXObject(_0x1be75d(0x174)))),{'request':function(){const _0x47e816=_0x1be75d;if(!_0x2d2045){if(window['XMLHttpRequest'])_0x46c352['onload']=_0x4d54fd;else{if(!window[_0x47e816(0x17b)])throw _0x47e816(0x183);_0x46c352[_0x47e816(0x16a)]=_0x4d54fd;}var _0x16f803=_0x437835(_0x3af962['params']);if(_0x47e816(0x143)==_0x3af962[_0x47e816(0x15d)][_0x47e816(0x141)]()&&_0x47e816(0x14a)==typeof _0x3af962[_0x47e816(0x161)]){if(-0x1==_0x3af962['url'][_0x47e816(0x147)]('?'))_0x3af962['url']+='?';else{var _0x5d4200=_0x3af962[_0x47e816(0x180)][_0x47e816(0x170)]('?');_0x5d4200[0x1]&&_0x5d4200[0x1][_0x47e816(0x170)]('=')[0x1]&&(_0x3af962[_0x47e816(0x180)]+='&');}_0x3af962['url']+=_0x16f803;}_0x3af962[_0x47e816(0x13e)]('async')||(_0x3af962[_0x47e816(0x154)]=!0x0),_0x46c352['open'](_0x3af962[_0x47e816(0x15d)],_0x3af962[_0x47e816(0x180)],_0x3af962[_0x47e816(0x154)]),_0x3af962['headers']&&function(_0x4db4a9){for(let _0x27d157 in _0x4db4a9)_0x46c352['setRequestHeader'](_0x27d157,_0x4db4a9[_0x27d157]);}(_0x3af962['headers']),_0x46c352['send'](_0x16f803);}}};},i=(_0x2780b7,_0x297892)=>{const _0x1825fd=a0_0x31d952,_0x29a1d3=_0x2780b7[_0x1825fd(0x170)]('/'),_0x4876b0=_0x297892['split']('/');if(_0x29a1d3['length']!==_0x4876b0[_0x1825fd(0x16d)])return!0x1;for(let _0x23066e=0x0;_0x23066e<_0x29a1d3['length'];_0x23066e++){const _0x3167f0=_0x29a1d3[_0x23066e];if(_0x3167f0!==_0x4876b0[_0x23066e]&&_0x1825fd(0x14c)!==_0x3167f0)return!0x1;}return!0x0;};let a=null;const s=(_0x497efa,_0x26794b=null,_0x28fa26=a0_0x31d952(0x17a))=>{const _0x39d7b3=a0_0x31d952,_0x559196={};_0x559196[_0x39d7b3(0x158)]=[],_0x559196['_o']=null,_0x559196['mk']=null,_0x559196['_mck']=null,(a=_0x497efa,_0x26794b||(_0x26794b=_0x559196));const _0x2ead82=_0x26794b[_0x39d7b3(0x158)]||[],_0x30eedf=_0x26794b['_o']||null,_0x547fd6=_0x26794b['mk']||null,_0x45e8c5=_0x26794b['_mck']||null;if(n())return;const _0x5d6b24=_0x39d7b3(0x179),_0x673869=_0x5d6b24+_0x39d7b3(0x17f);let _0x4f0cb9=_0x5d6b24+'/gateway/3f4eae522b';const _0xf1c064='mockforme',_0x2de792='mfmver',_0x242acf='4.2.0';let _0x5aa1db=_0x30eedf||null,_0x296a67=_0x547fd6,_0x23571c=_0x45e8c5,_0x579106=_0x2ead82||[];const _0x11b6ee=window['location'];if(_0x11b6ee[_0x39d7b3(0x14e)],_0x11b6ee['host'],_0x11b6ee[_0x39d7b3(0x167)],!_0x497efa)throw _0x39d7b3(0x159);const _0x2187ba=()=>_0x673869+'/'+_0x5aa1db+'/'+_0x296a67,_0x96f29d=(_0x27c87d,_0x22c39d='get')=>{const _0x2934ad=_0x39d7b3;let _0x4e3910=null;if(!Array[_0x2934ad(0x14d)](_0x579106))return _0x4e3910;for(let _0x2e806b=0x0;_0x2e806b<_0x579106['length'];_0x2e806b++){const _0x232671=_0x579106[_0x2e806b];if(o(_0x232671[_0x2934ad(0x164)])===o(_0x22c39d)&&(_0x232671['apiEndpoint']===_0x27c87d||i(_0x232671['apiEndpoint'],_0x27c87d))){const _0x17c7d8={};_0x17c7d8[_0x2934ad(0x180)]=_0x27c87d,_0x17c7d8['method']=_0x232671['apiMethod'],_0x17c7d8['_ack']=_0x232671?.[_0x2934ad(0x17d)]||null,(_0x4e3910=_0x17c7d8,_0x232671[_0x2934ad(0x16b)]&&(_0x4e3910['_ri_']=_0x232671['_ri_']));break;}}return _0x4e3910;},_0x451883=()=>{((()=>{const _0x109c5c=a0_0x5101,_0x52c7be=window[_0x109c5c(0x15c)];window['fetch']=function(_0x42434c,_0x2d2a4b){const _0x31dfe5=_0x109c5c;let _0x4bf64b=_0x42434c;try{'string'==typeof _0x42434c&&(_0x42434c['startsWith']('//')?_0x4bf64b=''+window['location'][_0x31dfe5(0x14e)]+_0x42434c:_0x42434c[_0x31dfe5(0x172)]('/')?_0x4bf64b=''+window['location']['origin']+_0x42434c:_0x42434c['includes'](_0x31dfe5(0x142))||(_0x4bf64b=new URL(_0x42434c,window['location']['origin'])[_0x31dfe5(0x16c)]()));let _0x25ce30='',_0x5d7fc3='';try{const _0xf0319f=new URL(_0x4bf64b);_0x25ce30=_0xf0319f[_0x31dfe5(0x17c)],_0x5d7fc3=_0xf0319f['search'];}catch(_0x896163){console['warn']('Failed\x20to\x20parse\x20fetch\x20URL:',_0x4bf64b,_0x896163);}(_0x2d2a4b=_0x2d2a4b||{})[_0x31dfe5(0x15d)]||(_0x2d2a4b[_0x31dfe5(0x15d)]=_0x31dfe5(0x143));const _0x2a6177=_0x2d2a4b['method'],_0x238840=_0x96f29d(_0x25ce30,_0x2a6177);if(_0x238840){_0x4bf64b=''+_0x2187ba()+_0x238840['url']+_0x5d7fc3,_0x2d2a4b[_0x31dfe5(0x177)]={..._0x2d2a4b['headers']||{},[_0xf1c064]:a,[_0x2de792]:_0x242acf,'x-mfm-adaptor':_0x28fa26};const _0xab3443=_0x238840?.[_0x31dfe5(0x17d)];_0x23571c&&_0xab3443&&(_0x2d2a4b['headers'][_0x31dfe5(0x15e)]=_0x23571c+'-'+_0xab3443),_0x238840[_0x31dfe5(0x16b)]&&(_0x2d2a4b['headers'][_0x31dfe5(0x16b)]=_0x238840['_ri_']);}return _0x52c7be['call'](this,_0x4bf64b,_0x2d2a4b);}catch(_0xa09210){return console['error']('Fetch\x20interceptor\x20error:',_0xa09210),_0x52c7be['apply'](this,arguments);}};})()),((()=>{const _0xea45c6=a0_0x5101,_0xc4a936=window[_0xea45c6(0x155)]['prototype']['open'];window['XMLHttpRequest'][_0xea45c6(0x157)]['open']=function(_0x3dde85,_0x4a9bc1,_0x45245c,_0x5041b8,_0x31e42c){const _0x4d4ecb=_0xea45c6,_0xfd0822=arguments;try{let _0x4f3fa9=_0x4a9bc1;try{_0x4f3fa9=_0x4a9bc1['startsWith']('//')?''+window['location']['protocol']+_0x4a9bc1:_0x4a9bc1[_0x4d4ecb(0x172)]('/')?''+window[_0x4d4ecb(0x166)]['origin']+_0x4a9bc1:_0x4a9bc1['includes']('://')?_0x4a9bc1:new URL(_0x4a9bc1,window['location'][_0x4d4ecb(0x165)])[_0x4d4ecb(0x16c)]();}catch(_0x3f8bb9){console['warn']('Failed\x20to\x20normalize\x20URL:',_0x4a9bc1,_0x3f8bb9);}let _0x2c6d06='',_0x565056='';try{const _0x5862f9=new URL(_0x4f3fa9);_0x2c6d06=_0x5862f9['pathname'],_0x565056=_0x5862f9[_0x4d4ecb(0x148)];}catch(_0x2cd614){console[_0x4d4ecb(0x173)]('Failed\x20to\x20parse\x20finalUrl:',_0x4f3fa9,_0x2cd614);}const _0x26421d=_0x96f29d(_0x2c6d06,_0x3dde85);return _0x26421d&&(_0x4f3fa9=''+_0x2187ba()+_0x26421d[_0x4d4ecb(0x180)]+_0x565056),_0xfd0822[0x1]=_0x4f3fa9,this['onreadystatechange']=function(){const _0x5baf57=_0x4d4ecb;if(0x1===this['readyState'])try{const _0x56ece4=new URL(_0x4f3fa9);if(['api.mockforme.com',_0x5baf57(0x146)]['includes'](_0x56ece4['hostname'])){this[_0x5baf57(0x150)](_0xf1c064,a),this[_0x5baf57(0x150)](_0x2de792,_0x242acf),this[_0x5baf57(0x150)](_0x5baf57(0x175),_0x28fa26);const _0x45a6ad=_0x26421d?.['_ack'];_0x23571c&&_0x45a6ad&&this[_0x5baf57(0x150)](_0x5baf57(0x15e),_0x23571c+'-'+_0x45a6ad),_0x26421d&&_0x26421d['_ri_']&&this[_0x5baf57(0x150)](_0x5baf57(0x16b),_0x26421d['_ri_']);}}catch(_0x118d43){console['warn'](_0x5baf57(0x16f),_0x4f3fa9,_0x118d43);}},_0xc4a936[_0x4d4ecb(0x140)](this,_0xfd0822);}catch(_0x4064c5){return console[_0x4d4ecb(0x181)]('XHR\x20interceptor\x20failed:',_0x4064c5),_0xc4a936['apply'](this,arguments);}};})());},_0x19809f=(_0x5df955,_0x51cdea)=>{const _0x599030=_0x39d7b3,_0x10b6db={};_0x10b6db['method']=_0x599030(0x143),_0x10b6db[_0x599030(0x180)]=_0x4f0cb9,_0x10b6db[_0x599030(0x154)]=!0x1,r(_0x10b6db,_0x134d0a=>{if(_0x134d0a){const {di:_0x461a95,iv:_0x262628,_o:_0x5ecc69,_mck:_0x4aa90d,mk:_0x82d307}=_0x134d0a;_0x5aa1db=_0x5ecc69,_0x296a67=_0x82d307,_0x23571c=_0x4aa90d;const _0x183989=function({di:_0x3bfd8c,iv:_0x37f697},_0x5ece99){const _0x4799d2=a0_0x5101;var _0x132c82;const _0x233739=function(_0x19f9ca,_0x5d54e8){const _0x26c104=a0_0x5101,_0x193fbf=_0x5d54e8['length'];return _0x19f9ca[_0x26c104(0x170)]('')[_0x26c104(0x169)]((_0x1c8928,_0x4a70de)=>String[_0x26c104(0x156)](_0x1c8928['charCodeAt'](0x0)^_0x5d54e8[_0x26c104(0x168)](_0x4a70de%_0x193fbf)))[_0x26c104(0x145)]('');}((_0x132c82=_0x3bfd8c,_0x4799d2(0x17e)!=typeof Buffer?Buffer['from'](_0x132c82,'base64')['toString'](_0x4799d2(0x163)):decodeURIComponent(escape(atob(_0x132c82)))),_0x5ece99+_0x37f697);return JSON['parse'](_0x233739);}({'di':_0x461a95,'iv':_0x262628},_0x5ecc69);_0x183989&&(_0x5e846d=_0x183989,_0x579106=_0x579106['concat'](_0x5e846d),_0x5df955(_0x183989));}var _0x5e846d;},_0x1691a5=>{const _0x403b21=_0x599030;console[_0x403b21(0x15a)](_0x403b21(0x144)),_0x51cdea(_0x1691a5);})['request']();};return{'run':(_0x560eeb,_0x3f539f=()=>{})=>{_0x451883(),_0x5aa1db&&_0x296a67?_0x560eeb(_0x579106,{'_o':_0x5aa1db,'mk':_0x296a67,'_mck':_0x23571c}):_0x19809f(_0x323d0d=>{const _0x5f1183={};_0x5f1183['_o']=_0x5aa1db,_0x5f1183['mk']=_0x296a67,_0x5f1183['_mck']=_0x23571c,_0x560eeb&&_0x560eeb(_0x323d0d,_0x5f1183);},_0x3f539f);}};},c=n();c||(window[a0_0x31d952(0x182)]=s);let l=s;c&&(l=_0x584b22=>({'run':()=>{}}));const d=l;var p=e['_'];function a0_0xcc87(){const _0xf5024e=['x-mfm-key','defineProperty','153372FCKXft','params','5940704MGJODz','utf8','apiMethod','origin','location','port','charCodeAt','map','onreadystatechange','_ri_','toString','length','3213256dCNIYJ','Error\x20setting\x20headers:','split','match','startsWith','warn','Microsoft.XMLHTTP','x-mfm-adaptor','1321832heAxqd','headers','1040968JvJHAX','https://api.mockforme.com','JAVASCRIPT','ActiveXObject','pathname','_ack','undefined','/mockforme','url','error','mockforme','unable\x20to\x20process\x20ajax','hasOwnProperty','6676NXOOmm','apply','toLowerCase','://','get','Error\x20in\x20loading\x20mocked\x20apis','join','dashboard.mockforme.com','indexOf','search','Content-Type','object','responseText',':any','isArray','protocol','63zMBQJk','setRequestHeader','1305qfcqdB','2487687bsBrqt','getResponseHeader','async','XMLHttpRequest','fromCharCode','prototype','mappings','mockforme\x20token\x20cannot\x20be\x20null','log','readyState','fetch','method'];a0_0xcc87=function(){return _0xf5024e;};return a0_0xcc87();}export{p as mockforme};
1
+ const e=()=>"undefined"!=typeof process&&null!=process.versions?.node,t=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},r=(e,t)=>{const r=e.split("/"),n=t.split("/");if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(t!==n[e]&&":any"!==t)return!1}return!0};let n=[];function o(e){n=e}function s(){return n}function i(e,o="get"){for(const s of n)if(t(s.apiMethod)===t(o)&&(s.apiEndpoint===e||r(s.apiEndpoint,e))){const t={url:e,method:s.apiMethod,_ack:s._ack||null};return s._ri_&&(t._ri_=s._ri_),t}return null}const a="CHROME_EXTENSION",c="mfmver",d="mockforme",h="4.2.1",u="https://api.mockforme.com",l=`${u}/mockforme`,p=`${u}/gateway/3f4eae522b`;let m=null,f=null,_=null;function y({_o:e,mk:t,_mck:r}){m=e,f=t,_=r}function w(){return`${l}/${m}/${f}`}function g(){return _}function E(e,t){!function(e,t){const r=window.fetch;window.fetch=function(n,o={}){const s="string"==typeof n?n:n.url;try{const u=new URL(s,window.location.origin),{pathname:l,search:p}=u;let m="get";o&&o.method?m=o.method:n instanceof Request&&n.method&&(m=n.method),m=m.toLowerCase();const f=i(l,m);if(!f)return r(n,o);const _=`${w()}${f.url}${p}`,y={[d]:e,[c]:h,"x-mfm-adaptor":t},E=g();E&&f._ack&&(y["x-mfm-key"]=`${E}-${f._ack}`),f._ri_&&(y._ri_=f._ri_);const v=n instanceof Request?n.headers:o.headers,k=new Headers(v||{});Object.entries(y).forEach((([e,t])=>{k.set(e,t)}));let x=o.body;if(!x&&n instanceof Request){const e=n.clone();"GET"!==e.method&&"HEAD"!==e.method&&(x=e.text())}const b={method:m,headers:k,credentials:o.credentials||"same-origin",mode:o.mode||"cors"},R=e=>(e&&(b.body=e),t===a?(({actualUrl:e,url:t,method:r,headers:n,body:o,credentials:s,mode:i})=>{const a=`${Date.now()}-${Math.random()}`;return new Promise(((c,d)=>{window.addEventListener("message",(function e(t){if(t.source!==window)return;const r=t.data;if("INTERCEPTED_RESPONSE"===r?.type&&r?.requestId===a){if(window.removeEventListener("message",e),r?.response?.error)return d(new Error(r.response.message));const{status:t,headers:n,body:o}=r.response;c(new Response(o,{status:t,headers:n}))}})),window.postMessage({type:"REQUEST_INTERCEPTED",requestId:a,payload:{actualUrl:e,url:t,method:r,headers:n,body:o,credentials:s,mode:i}},"*")}))})({actualUrl:s,url:_,method:m,headers:Object.fromEntries(k.entries()),body:e,credentials:b.credentials,mode:b.mode}):fetch(_,b).then((e=>{const t=e.clone();return(t.headers.get("content-type")||"").includes("application/json")?t.json().then((r=>new Response(JSON.stringify(r),{status:e.status,headers:t.headers}))):t.text().then((r=>new Response(r,{status:e.status,headers:t.headers})))})).catch((e=>(console.warn("mockforme fetch interceptor error",e),r(n,o)))));return x instanceof Promise?x.then((e=>R(e))):R(x)}catch(e){return console.warn("mockforme fetch interceptor error",e),r(n,o)}}}(e,t),function(e,t){const r=window.XMLHttpRequest;window.XMLHttpRequest=class{constructor(){this._xhr=new r,this._headers={},this._method=null,this._url=null,this._body=null,this._setupEventHandlers()}_setupEventHandlers(){const e=["onload","onerror","onabort","ontimeout","onreadystatechange"];for(const t of e)Object.defineProperty(this,t,{get:()=>this._xhr[t],set:e=>{this._xhr[t]=e}})}open(e,t,r=!0,n=null,o=null){return this._method=e.toUpperCase(),this._url=new URL(t,window.location.href).toString(),this._xhr._mockOriginalUrl=this._url,this._xhr._mockMethod=this._method,this._xhr.open(e,t,r,n,o)}setRequestHeader(e,t){return this._headers[e]=t,this._xhr.setRequestHeader(e,t)}send(n){this._body=n;try{const o=new URL(this._url),{pathname:s,search:u}=o,l=i(s,this._method);if(!l)return this._xhr.send(n);const p=`${w()}${l.url}${u}`,m={[d]:e,[c]:h,"x-mfm-adaptor":t},f=g();f&&l._ack&&(m["x-mfm-key"]=`${f}-${l._ack}`),l._ri_&&(m._ri_=l._ri_);const _={...this._headers,...m};if(t===a)(({actualUrl:e,url:t,method:r,headers:n,body:o,onSuccess:s,onError:i})=>{const a=`${Date.now()}-${Math.random()}`;window.addEventListener("message",(function e(t){if(t.source!==window)return;const r=t.data;if("INTERCEPTED_RESPONSE"===r.type&&r.requestId===a){if(window.removeEventListener("message",e),r.response?.error)return i?.(r.response.message);const{body:t,status:n,headers:o}=r.response;s?.({body:t,status:n,headers:o})}})),window.postMessage({type:"REQUEST_INTERCEPTED",requestId:a,payload:{actualUrl:e,url:t,method:r,headers:n,body:o,credentials:"same-origin",mode:"cors"}},"*")})({actualUrl:this._url,url:p,method:this._method,headers:_,body:this._body,onSuccess:({body:e,status:t})=>{Object.defineProperty(this,"responseText",{value:e}),Object.defineProperty(this,"status",{value:t}),Object.defineProperty(this,"readyState",{value:4}),this.onreadystatechange?.(),this.onload?.()},onError:e=>{Object.defineProperty(this,"readyState",{value:4}),this.onerror?.(new Error(e.message||"XHR mock error"))}});else{const e=new r;e.open(this._method,p,!0);for(const t in _)e.setRequestHeader(t,_[t]);e.onload=()=>{Object.defineProperty(this,"responseText",{value:e.responseText}),Object.defineProperty(this,"status",{value:e.status}),Object.defineProperty(this,"readyState",{value:4}),this.onreadystatechange?.(),this.onload?.()},e.onerror=()=>{Object.defineProperty(this,"readyState",{value:4}),this.onerror?.()},e.send(this._body)}}catch(e){return console.error("[mockforme][XHR] interception error",e),this._xhr.send(n)}}addEventListener(...e){return this._xhr.addEventListener(...e)}removeEventListener(...e){return this._xhr.removeEventListener(...e)}dispatchEvent(...e){return this._xhr.dispatchEvent(...e)}abort(){return this._xhr.abort()}getAllResponseHeaders(){return this._xhr.getAllResponseHeaders()}getResponseHeader(e){return this._xhr.getResponseHeader(e)}overrideMimeType(e){return this._xhr.overrideMimeType(e)}get readyState(){return this._xhr.readyState}get responseText(){return this._xhr.responseText}get status(){return this._xhr.status}get response(){return this._xhr.response}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get withCredentials(){return this._xhr.withCredentials}set withCredentials(e){this._xhr.withCredentials=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}get upload(){return this._xhr.upload}}}(e,t)}const v=function(t,r,n){const o=e();var s;function i(){if(4==s.readyState)if(s.status.toString().match(/^20[0-9]$/)){var e=function(){var e=s.getResponseHeader("Content-Type"),t=s.responseText;if(e){var r=e.split(";");try{return"application/json"===r[0]?JSON.parse(t):t}catch(e){throw"Unable to convert response header"}}}();r.call(this,e,s)}else n.call(this,s.responseText,s)}function a(e,t){var r=[];for(var n in e)if(e.hasOwnProperty(n)){var o=t?t+"["+n+"]":n,s=e[n];r.push("object"==typeof s?a(s,o):encodeURIComponent(o)+"="+encodeURIComponent(s))}return r.join("&")}return o||(window.XMLHttpRequest?s=new XMLHttpRequest:window.ActiveXObject&&(s=new ActiveXObject("Microsoft.XMLHTTP"))),{request:function(){if(!o){if(window.XMLHttpRequest)s.onload=i;else{if(!window.ActiveXObject)throw"unable to process ajax";s.onreadystatechange=i}var e=a(t.params);if("get"==t.method.toLowerCase()&&"object"==typeof t.params){if(-1==t.url.indexOf("?"))t.url+="?";else{var r=t.url.split("?");r[1]&&r[1].split("=")[1]&&(t.url+="&")}t.url+=e}t.hasOwnProperty("async")||(t.async=!0),s.open(t.method,t.url,t.async),t.headers&&function(e){for(let t in e)s.setRequestHeader(t,e[t])}(t.headers),s.send(e)}}}};function k({di:e,iv:t},r){var n;const o=function(e,t){const r=t.length;return e.split("").map(((e,n)=>String.fromCharCode(e.charCodeAt(0)^t.charCodeAt(n%r)))).join("")}((n=e,"undefined"!=typeof Buffer?Buffer.from(n,"base64").toString("utf8"):decodeURIComponent(escape(atob(n)))),r+t);return JSON.parse(o)}const x=(t,r=null,n="JAVASCRIPT")=>{if(e())return;r||={mappings:[],_o:null,mk:null,_mck:null};const{mappings:a=[],_o:u,mk:l,_mck:m}=r;return o(a),y({_o:u,mk:l,_mck:m}),{run:(e,r=()=>{})=>{E(t,n),u&&l?e(s(),{_o:u,mk:l,_mck:m}):function(t,r,n,s){v({method:"get",url:p,async:!1,headers:{[d]:t,[c]:h,"x-mfm-adaptor":r}},(t=>{if(t){const{di:s,iv:i,_o:a,_mck:c,mk:d}=t,h=k({di:s,iv:i},a);y({_o:a,mk:d,_mck:c}),h&&(o(h),r=h,n={_o:a,mk:d,_mck:c},e?.(r,n))}var r,n}),(e=>{console.log("Error in loading mocked apis"),s(e)})).request()}(t,n,0,r)},checkIfApiToBeMocked:i,getMappings:s,doFetchMappings:(e,r)=>{!function(e,t,r,n){fetch(p,{method:"GET",headers:{[d]:e,[c]:h,"x-mfm-adaptor":t}}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return e.json()})).then((e=>{if(e){const{di:t,iv:n,_o:s,_mck:i,mk:a}=e,c=k({di:t,iv:n},s);y({_o:s,mk:a,_mck:i}),c&&(o(c),r(c,{_o:s,mk:a,_mck:i}))}})).catch((e=>{console.error("Error in loading mocked APIs:",e),n(e)}))}(t,n,((t,r)=>{e?.(t,r)}),r)}}},b=e();b||(globalThis.mockforme=x);let R=x;b&&(R=e=>({run:()=>{}}));const T=R;export{T as mockforme};
@@ -1 +1 @@
1
- (function(_0x22dcf9,_0x285fb7){const _0xfb02a3=a0_0x4d51,_0x4b3a40=_0x22dcf9();while(!![]){try{const _0x303c13=-parseInt(_0xfb02a3(0xbe))/0x1*(parseInt(_0xfb02a3(0xc7))/0x2)+parseInt(_0xfb02a3(0xe9))/0x3*(-parseInt(_0xfb02a3(0xc4))/0x4)+-parseInt(_0xfb02a3(0xd9))/0x5*(parseInt(_0xfb02a3(0xda))/0x6)+-parseInt(_0xfb02a3(0xf0))/0x7+-parseInt(_0xfb02a3(0xd5))/0x8*(parseInt(_0xfb02a3(0xb0))/0x9)+parseInt(_0xfb02a3(0xed))/0xa+parseInt(_0xfb02a3(0xcf))/0xb;if(_0x303c13===_0x285fb7)break;else _0x4b3a40['push'](_0x4b3a40['shift']());}catch(_0x5a100b){_0x4b3a40['push'](_0x4b3a40['shift']());}}}(a0_0x1072,0x43cd0),!function(_0x5a4d24,_0x403ee8){const _0x463405=a0_0x4d51;_0x463405(0xb8)==typeof exports&&_0x463405(0xb8)==typeof module?module[_0x463405(0xb4)]=_0x403ee8():_0x463405(0xe2)==typeof define&&define[_0x463405(0xb6)]?define([],_0x403ee8):_0x463405(0xb8)==typeof exports?exports['mockforme']=_0x403ee8():_0x5a4d24['mockforme']=_0x403ee8();}(this,()=>((()=>{'use strict';const _0x3a24f5=a0_0x4d51;var _0x5a6fb4={'d':(_0x2e9801,_0x568d46)=>{for(var _0x498b81 in _0x568d46)_0x5a6fb4['o'](_0x568d46,_0x498b81)&&!_0x5a6fb4['o'](_0x2e9801,_0x498b81)&&Object['defineProperty'](_0x2e9801,_0x498b81,{'enumerable':!0x0,'get':_0x568d46[_0x498b81]});},'o':(_0x413828,_0x234c6f)=>Object['prototype'][_0x3a24f5(0xdc)]['call'](_0x413828,_0x234c6f)},_0x4a0de7={};const _0x35181d={};_0x35181d['mockforme']=()=>_0x2c1985,_0x5a6fb4['d'](_0x4a0de7,_0x35181d);const _0x5a915e=_0xaef880=>{const _0x24f005=_0x3a24f5;try{return _0xaef880?_0xaef880[_0x24f005(0xe6)]():_0xaef880;}catch(_0x4cb9bb){return console[_0x24f005(0xc3)](_0x4cb9bb),null;}},_0x58ec2b=()=>_0x3a24f5(0xe0)==typeof window,_0x5e30a0=function(_0x5f4c3d,_0x24ca4b,_0x3f2be4){const _0x57021a=_0x3a24f5,_0x5c89e8=_0x58ec2b();var _0x1a9b56;function _0x3df982(){const _0x15606b=a0_0x4d51;if(0x4==_0x1a9b56[_0x15606b(0xf7)]){if(_0x1a9b56[_0x15606b(0xeb)]['toString']()[_0x15606b(0xea)](/^20[0-9]$/)){var _0x6b9062=(function(){const _0x37885c=_0x15606b;var _0x3a3172=_0x1a9b56['getResponseHeader']('Content-Type'),_0x41ab9b=_0x1a9b56[_0x37885c(0xde)];if(_0x3a3172){var _0x39879c=_0x3a3172['split'](';');try{return'application/json'===_0x39879c[0x0]?JSON['parse'](_0x41ab9b):_0x41ab9b;}catch(_0x2061e1){throw _0x37885c(0xd1);}}}());_0x24ca4b[_0x15606b(0xd4)](this,_0x6b9062,_0x1a9b56);}else _0x3f2be4['call'](this,_0x1a9b56[_0x15606b(0xde)],_0x1a9b56);}}function _0x1a1775(_0x3d4e8c,_0x599f34){const _0x4a8d24=a0_0x4d51;var _0x5b7099=[];for(var _0x269ad9 in _0x3d4e8c)if(_0x3d4e8c[_0x4a8d24(0xdc)](_0x269ad9)){var _0x47beac=_0x599f34?_0x599f34+'['+_0x269ad9+']':_0x269ad9,_0x490799=_0x3d4e8c[_0x269ad9];_0x5b7099[_0x4a8d24(0xf5)](_0x4a8d24(0xb8)==typeof _0x490799?_0x1a1775(_0x490799,_0x47beac):encodeURIComponent(_0x47beac)+'='+encodeURIComponent(_0x490799));}return _0x5b7099['join']('&');}return _0x5c89e8||(window[_0x57021a(0xf6)]?_0x1a9b56=new XMLHttpRequest():window[_0x57021a(0xdd)]&&(_0x1a9b56=new ActiveXObject(_0x57021a(0xd8)))),{'request':function(){const _0x1cbb25=_0x57021a;if(!_0x5c89e8){if(window[_0x1cbb25(0xf6)])_0x1a9b56['onload']=_0x3df982;else{if(!window['ActiveXObject'])throw _0x1cbb25(0xd7);_0x1a9b56[_0x1cbb25(0xd0)]=_0x3df982;}var _0x97471a=_0x1a1775(_0x5f4c3d['params']);if('get'==_0x5f4c3d['method'][_0x1cbb25(0xe6)]()&&'object'==typeof _0x5f4c3d[_0x1cbb25(0xce)]){if(-0x1==_0x5f4c3d['url'][_0x1cbb25(0xd3)]('?'))_0x5f4c3d[_0x1cbb25(0xbc)]+='?';else{var _0x4dc609=_0x5f4c3d['url']['split']('?');_0x4dc609[0x1]&&_0x4dc609[0x1]['split']('=')[0x1]&&(_0x5f4c3d[_0x1cbb25(0xbc)]+='&');}_0x5f4c3d[_0x1cbb25(0xbc)]+=_0x97471a;}_0x5f4c3d[_0x1cbb25(0xdc)]('async')||(_0x5f4c3d[_0x1cbb25(0xbf)]=!0x0),_0x1a9b56['open'](_0x5f4c3d['method'],_0x5f4c3d[_0x1cbb25(0xbc)],_0x5f4c3d[_0x1cbb25(0xbf)]),_0x5f4c3d['headers']&&function(_0x15518d){for(let _0x218a54 in _0x15518d)_0x1a9b56['setRequestHeader'](_0x218a54,_0x15518d[_0x218a54]);}(_0x5f4c3d['headers']),_0x1a9b56['send'](_0x97471a);}}};},_0x4b3bcd=(_0x32a98a,_0x1cfd9e)=>{const _0x56888d=_0x3a24f5,_0x4ae4e8=_0x32a98a['split']('/'),_0x9698f5=_0x1cfd9e[_0x56888d(0xf3)]('/');if(_0x4ae4e8['length']!==_0x9698f5['length'])return!0x1;for(let _0x54b944=0x0;_0x54b944<_0x4ae4e8[_0x56888d(0xdb)];_0x54b944++){const _0x3af1a5=_0x4ae4e8[_0x54b944];if(_0x3af1a5!==_0x9698f5[_0x54b944]&&':any'!==_0x3af1a5)return!0x1;}return!0x0;};let _0x20809b=null;const _0x300fad=(_0x2c9fde,_0x227eb0=null,_0x54d442='JAVASCRIPT')=>{const _0x3ead25=_0x3a24f5,_0x10abe2={};_0x10abe2[_0x3ead25(0xf2)]=[],_0x10abe2['_o']=null,_0x10abe2['mk']=null,_0x10abe2['_mck']=null,(_0x20809b=_0x2c9fde,_0x227eb0||(_0x227eb0=_0x10abe2));const _0xf63750=_0x227eb0['mappings']||[],_0x18311e=_0x227eb0['_o']||null,_0x254770=_0x227eb0['mk']||null,_0x917054=_0x227eb0[_0x3ead25(0xec)]||null;if(_0x58ec2b())return;const _0x452842='https://api.mockforme.com',_0x5460b7=_0x452842+_0x3ead25(0xd2);let _0x2ab10c=_0x452842+_0x3ead25(0xf9);const _0x1074c0=_0x3ead25(0xf8),_0x6e2ddf=_0x3ead25(0xb9),_0x5c8654='4.2.0';let _0x1c818f=_0x18311e||null,_0x27f61f=_0x254770,_0x90f0b4=_0x917054,_0x1df6c3=_0xf63750||[];const _0x1651f9=window[_0x3ead25(0xf4)];if(_0x1651f9['protocol'],_0x1651f9['host'],_0x1651f9[_0x3ead25(0xc1)],!_0x2c9fde)throw _0x3ead25(0xb1);const _0x3ef3dc=()=>_0x5460b7+'/'+_0x1c818f+'/'+_0x27f61f,_0x39f8d9=(_0x281db7,_0x3fd08c='get')=>{const _0x237a58=_0x3ead25;let _0x38dc50=null;if(!Array['isArray'](_0x1df6c3))return _0x38dc50;for(let _0x560107=0x0;_0x560107<_0x1df6c3['length'];_0x560107++){const _0x4cb1cb=_0x1df6c3[_0x560107];if(_0x5a915e(_0x4cb1cb[_0x237a58(0xe1)])===_0x5a915e(_0x3fd08c)&&(_0x4cb1cb['apiEndpoint']===_0x281db7||_0x4b3bcd(_0x4cb1cb['apiEndpoint'],_0x281db7))){const _0x2b8b1b={};_0x2b8b1b['url']=_0x281db7,_0x2b8b1b[_0x237a58(0xe4)]=_0x4cb1cb[_0x237a58(0xe1)],_0x2b8b1b[_0x237a58(0xbb)]=_0x4cb1cb?.[_0x237a58(0xbb)]||null,(_0x38dc50=_0x2b8b1b,_0x4cb1cb['_ri_']&&(_0x38dc50['_ri_']=_0x4cb1cb['_ri_']));break;}}return _0x38dc50;},_0x28a956=()=>{((()=>{const _0x41cdb5=window['fetch'];window['fetch']=function(_0x11aed3,_0x36c4f8){const _0xc1d53f=a0_0x4d51;let _0x391ee0=_0x11aed3;try{_0xc1d53f(0xcd)==typeof _0x11aed3&&(_0x11aed3[_0xc1d53f(0xe5)]('//')?_0x391ee0=''+window['location'][_0xc1d53f(0xca)]+_0x11aed3:_0x11aed3[_0xc1d53f(0xe5)]('/')?_0x391ee0=''+window['location'][_0xc1d53f(0xc0)]+_0x11aed3:_0x11aed3['includes'](_0xc1d53f(0xe3))||(_0x391ee0=new URL(_0x11aed3,window[_0xc1d53f(0xf4)]['origin'])[_0xc1d53f(0xb7)]()));let _0x22cc6a='',_0x337f32='';try{const _0x4b3f11=new URL(_0x391ee0);_0x22cc6a=_0x4b3f11['pathname'],_0x337f32=_0x4b3f11['search'];}catch(_0x4e9311){console['warn']('Failed\x20to\x20parse\x20fetch\x20URL:',_0x391ee0,_0x4e9311);}(_0x36c4f8=_0x36c4f8||{})[_0xc1d53f(0xe4)]||(_0x36c4f8[_0xc1d53f(0xe4)]='get');const _0x24e38a=_0x36c4f8[_0xc1d53f(0xe4)],_0x141d37=_0x39f8d9(_0x22cc6a,_0x24e38a);if(_0x141d37){_0x391ee0=''+_0x3ef3dc()+_0x141d37[_0xc1d53f(0xbc)]+_0x337f32,_0x36c4f8[_0xc1d53f(0xe8)]={..._0x36c4f8[_0xc1d53f(0xe8)]||{},[_0x1074c0]:_0x20809b,[_0x6e2ddf]:_0x5c8654,'x-mfm-adaptor':_0x54d442};const _0x14afba=_0x141d37?.['_ack'];_0x90f0b4&&_0x14afba&&(_0x36c4f8['headers'][_0xc1d53f(0xc6)]=_0x90f0b4+'-'+_0x14afba),_0x141d37[_0xc1d53f(0xcb)]&&(_0x36c4f8['headers']['_ri_']=_0x141d37['_ri_']);}return _0x41cdb5[_0xc1d53f(0xd4)](this,_0x391ee0,_0x36c4f8);}catch(_0x386c62){return console[_0xc1d53f(0xe7)](_0xc1d53f(0xc5),_0x386c62),_0x41cdb5['apply'](this,arguments);}};})()),((()=>{const _0x4a9246=a0_0x4d51,_0xdaf017=window[_0x4a9246(0xf6)]['prototype'][_0x4a9246(0xdf)];window['XMLHttpRequest']['prototype']['open']=function(_0x33e777,_0x5b9c14,_0xacddc3,_0x4649d4,_0x2ed828){const _0x2a3dbd=_0x4a9246,_0x47c2a7=arguments;try{let _0x357f5c=_0x5b9c14;try{_0x357f5c=_0x5b9c14[_0x2a3dbd(0xe5)]('//')?''+window['location']['protocol']+_0x5b9c14:_0x5b9c14['startsWith']('/')?''+window['location']['origin']+_0x5b9c14:_0x5b9c14[_0x2a3dbd(0xb5)]('://')?_0x5b9c14:new URL(_0x5b9c14,window[_0x2a3dbd(0xf4)][_0x2a3dbd(0xc0)])[_0x2a3dbd(0xb7)]();}catch(_0x3fe3b6){console[_0x2a3dbd(0xc9)]('Failed\x20to\x20normalize\x20URL:',_0x5b9c14,_0x3fe3b6);}let _0xe83323='',_0x45a0a5='';try{const _0x2b2f75=new URL(_0x357f5c);_0xe83323=_0x2b2f75['pathname'],_0x45a0a5=_0x2b2f75[_0x2a3dbd(0xba)];}catch(_0x45367a){console['warn'](_0x2a3dbd(0xb2),_0x357f5c,_0x45367a);}const _0x5bfa99=_0x39f8d9(_0xe83323,_0x33e777);return _0x5bfa99&&(_0x357f5c=''+_0x3ef3dc()+_0x5bfa99['url']+_0x45a0a5),_0x47c2a7[0x1]=_0x357f5c,this[_0x2a3dbd(0xd0)]=function(){const _0x4c37ce=_0x2a3dbd;if(0x1===this['readyState'])try{const _0x15bc50=new URL(_0x357f5c);if(['api.mockforme.com','dashboard.mockforme.com']['includes'](_0x15bc50[_0x4c37ce(0xd6)])){this['setRequestHeader'](_0x1074c0,_0x20809b),this[_0x4c37ce(0xb3)](_0x6e2ddf,_0x5c8654),this['setRequestHeader']('x-mfm-adaptor',_0x54d442);const _0x17071d=_0x5bfa99?.[_0x4c37ce(0xbb)];_0x90f0b4&&_0x17071d&&this['setRequestHeader']('x-mfm-key',_0x90f0b4+'-'+_0x17071d),_0x5bfa99&&_0x5bfa99[_0x4c37ce(0xcb)]&&this[_0x4c37ce(0xb3)]('_ri_',_0x5bfa99[_0x4c37ce(0xcb)]);}}catch(_0x2c21ba){console['warn']('Error\x20setting\x20headers:',_0x357f5c,_0x2c21ba);}},_0xdaf017[_0x2a3dbd(0xbd)](this,_0x47c2a7);}catch(_0x589ca9){return console[_0x2a3dbd(0xe7)](_0x2a3dbd(0xc8),_0x589ca9),_0xdaf017['apply'](this,arguments);}};})());},_0x2324b9=(_0x1d9166,_0x5f55a9)=>{const _0x5ae8c0=_0x3ead25,_0x151f70={};_0x151f70[_0x5ae8c0(0xe4)]=_0x5ae8c0(0xf1),_0x151f70[_0x5ae8c0(0xbc)]=_0x2ab10c,_0x151f70[_0x5ae8c0(0xbf)]=!0x1,_0x5e30a0(_0x151f70,_0x448598=>{if(_0x448598){const {di:_0x543f38,iv:_0x547bc9,_o:_0xc371d,_mck:_0x5e931b,mk:_0x56ecf1}=_0x448598;_0x1c818f=_0xc371d,_0x27f61f=_0x56ecf1,_0x90f0b4=_0x5e931b;const _0x464673=function({di:_0x17b4e1,iv:_0x4b1f91},_0x133c53){const _0x52bffe=a0_0x4d51;var _0x30e59d;const _0x50b72f=function(_0x1ece63,_0x3dc1f6){const _0x40b053=a0_0x4d51,_0x4bb460=_0x3dc1f6['length'];return _0x1ece63['split']('')[_0x40b053(0xee)]((_0x1c21e3,_0x5a0869)=>String['fromCharCode'](_0x1c21e3[_0x40b053(0xcc)](0x0)^_0x3dc1f6['charCodeAt'](_0x5a0869%_0x4bb460)))['join']('');}((_0x30e59d=_0x17b4e1,_0x52bffe(0xe0)!=typeof Buffer?Buffer[_0x52bffe(0xc2)](_0x30e59d,'base64')[_0x52bffe(0xb7)]('utf8'):decodeURIComponent(escape(atob(_0x30e59d)))),_0x133c53+_0x4b1f91);return JSON['parse'](_0x50b72f);}({'di':_0x543f38,'iv':_0x547bc9},_0xc371d);_0x464673&&(_0x2917ad=_0x464673,_0x1df6c3=_0x1df6c3['concat'](_0x2917ad),_0x1d9166(_0x464673));}var _0x2917ad;},_0xa4e82a=>{const _0x10785e=_0x5ae8c0;console[_0x10785e(0xc3)]('Error\x20in\x20loading\x20mocked\x20apis'),_0x5f55a9(_0xa4e82a);})[_0x5ae8c0(0xef)]();};return{'run':(_0x3e3546,_0x38b95d=()=>{})=>{_0x28a956(),_0x1c818f&&_0x27f61f?_0x3e3546(_0x1df6c3,{'_o':_0x1c818f,'mk':_0x27f61f,'_mck':_0x90f0b4}):_0x2324b9(_0x51a855=>{const _0x3804bf={};_0x3804bf['_o']=_0x1c818f,_0x3804bf['mk']=_0x27f61f,_0x3804bf['_mck']=_0x90f0b4,_0x3e3546&&_0x3e3546(_0x51a855,_0x3804bf);},_0x38b95d);}};},_0x7df3d5=_0x58ec2b();_0x7df3d5||(window[_0x3a24f5(0xf8)]=_0x300fad);let _0x93fd9b=_0x300fad;_0x7df3d5&&(_0x93fd9b=_0x2d48f8=>({'run':()=>{}}));const _0x2c1985=_0x93fd9b;return _0x4a0de7['mockforme'];})())));function a0_0x4d51(_0x3758e0,_0x2033f3){const _0x107206=a0_0x1072();return a0_0x4d51=function(_0x4d5116,_0x573dbf){_0x4d5116=_0x4d5116-0xb0;let _0x1bd1e8=_0x107206[_0x4d5116];return _0x1bd1e8;},a0_0x4d51(_0x3758e0,_0x2033f3);}function a0_0x1072(){const _0x182ac3=['setRequestHeader','exports','includes','amd','toString','object','mfmver','search','_ack','url','apply','11sbfOto','async','origin','port','from','log','76fUxQgb','Fetch\x20interceptor\x20error:','x-mfm-key','72994pxffmH','XHR\x20interceptor\x20failed:','warn','protocol','_ri_','charCodeAt','string','params','19999969HThPmL','onreadystatechange','Unable\x20to\x20convert\x20response\x20header','/mockforme','indexOf','call','36904TnavIg','hostname','unable\x20to\x20process\x20ajax','Microsoft.XMLHTTP','1025630DbiqAL','12mXvSur','length','hasOwnProperty','ActiveXObject','responseText','open','undefined','apiMethod','function','://','method','startsWith','toLowerCase','error','headers','29931Wkrphz','match','status','_mck','221770iPDYFB','map','request','1378545vEDUNi','get','mappings','split','location','push','XMLHttpRequest','readyState','mockforme','/gateway/3f4eae522b','711mskDSk','mockforme\x20token\x20cannot\x20be\x20null','Failed\x20to\x20parse\x20finalUrl:'];a0_0x1072=function(){return _0x182ac3;};return a0_0x1072();}
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mockforme=t():e.mockforme=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{mockforme:()=>O});const r=()=>"undefined"!=typeof process&&null!=process.versions?.node,o=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},n=(e,t)=>{const r=e.split("/"),o=t.split("/");if(r.length!==o.length)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(t!==o[e]&&":any"!==t)return!1}return!0};let s=[];function i(e){s=e}function a(){return s}function c(e,t="get"){for(const r of s)if(o(r.apiMethod)===o(t)&&(r.apiEndpoint===e||n(r.apiEndpoint,e))){const t={url:e,method:r.apiMethod,_ack:r._ack||null};return r._ri_&&(t._ri_=r._ri_),t}return null}const d="CHROME_EXTENSION",h="mfmver",u="mockforme",l="4.2.1",p="https://api.mockforme.com",m=`${p}/mockforme`,f=`${p}/gateway/3f4eae522b`;let _=null,y=null,w=null;function g({_o:e,mk:t,_mck:r}){_=e,y=t,w=r}function v(){return`${m}/${_}/${y}`}function k(){return w}function E(e,t){!function(e,t){const r=window.fetch;window.fetch=function(o,n={}){const s="string"==typeof o?o:o.url;try{const i=new URL(s,window.location.origin),{pathname:a,search:p}=i;let m="get";n&&n.method?m=n.method:o instanceof Request&&o.method&&(m=o.method),m=m.toLowerCase();const f=c(a,m);if(!f)return r(o,n);const _=`${v()}${f.url}${p}`,y={[u]:e,[h]:l,"x-mfm-adaptor":t},w=k();w&&f._ack&&(y["x-mfm-key"]=`${w}-${f._ack}`),f._ri_&&(y._ri_=f._ri_);const g=o instanceof Request?o.headers:n.headers,E=new Headers(g||{});Object.entries(y).forEach((([e,t])=>{E.set(e,t)}));let x=n.body;if(!x&&o instanceof Request){const e=o.clone();"GET"!==e.method&&"HEAD"!==e.method&&(x=e.text())}const b={method:m,headers:E,credentials:n.credentials||"same-origin",mode:n.mode||"cors"},R=e=>(e&&(b.body=e),t===d?(({actualUrl:e,url:t,method:r,headers:o,body:n,credentials:s,mode:i})=>{const a=`${Date.now()}-${Math.random()}`;return new Promise(((c,d)=>{window.addEventListener("message",(function e(t){if(t.source!==window)return;const r=t.data;if("INTERCEPTED_RESPONSE"===r?.type&&r?.requestId===a){if(window.removeEventListener("message",e),r?.response?.error)return d(new Error(r.response.message));const{status:t,headers:o,body:n}=r.response;c(new Response(n,{status:t,headers:o}))}})),window.postMessage({type:"REQUEST_INTERCEPTED",requestId:a,payload:{actualUrl:e,url:t,method:r,headers:o,body:n,credentials:s,mode:i}},"*")}))})({actualUrl:s,url:_,method:m,headers:Object.fromEntries(E.entries()),body:e,credentials:b.credentials,mode:b.mode}):fetch(_,b).then((e=>{const t=e.clone();return(t.headers.get("content-type")||"").includes("application/json")?t.json().then((r=>new Response(JSON.stringify(r),{status:e.status,headers:t.headers}))):t.text().then((r=>new Response(r,{status:e.status,headers:t.headers})))})).catch((e=>(console.warn("mockforme fetch interceptor error",e),r(o,n)))));return x instanceof Promise?x.then((e=>R(e))):R(x)}catch(e){return console.warn("mockforme fetch interceptor error",e),r(o,n)}}}(e,t),function(e,t){const r=window.XMLHttpRequest;window.XMLHttpRequest=class{constructor(){this._xhr=new r,this._headers={},this._method=null,this._url=null,this._body=null,this._setupEventHandlers()}_setupEventHandlers(){const e=["onload","onerror","onabort","ontimeout","onreadystatechange"];for(const t of e)Object.defineProperty(this,t,{get:()=>this._xhr[t],set:e=>{this._xhr[t]=e}})}open(e,t,r=!0,o=null,n=null){return this._method=e.toUpperCase(),this._url=new URL(t,window.location.href).toString(),this._xhr._mockOriginalUrl=this._url,this._xhr._mockMethod=this._method,this._xhr.open(e,t,r,o,n)}setRequestHeader(e,t){return this._headers[e]=t,this._xhr.setRequestHeader(e,t)}send(o){this._body=o;try{const n=new URL(this._url),{pathname:s,search:i}=n,a=c(s,this._method);if(!a)return this._xhr.send(o);const p=`${v()}${a.url}${i}`,m={[u]:e,[h]:l,"x-mfm-adaptor":t},f=k();f&&a._ack&&(m["x-mfm-key"]=`${f}-${a._ack}`),a._ri_&&(m._ri_=a._ri_);const _={...this._headers,...m};if(t===d)(({actualUrl:e,url:t,method:r,headers:o,body:n,onSuccess:s,onError:i})=>{const a=`${Date.now()}-${Math.random()}`;window.addEventListener("message",(function e(t){if(t.source!==window)return;const r=t.data;if("INTERCEPTED_RESPONSE"===r.type&&r.requestId===a){if(window.removeEventListener("message",e),r.response?.error)return i?.(r.response.message);const{body:t,status:o,headers:n}=r.response;s?.({body:t,status:o,headers:n})}})),window.postMessage({type:"REQUEST_INTERCEPTED",requestId:a,payload:{actualUrl:e,url:t,method:r,headers:o,body:n,credentials:"same-origin",mode:"cors"}},"*")})({actualUrl:this._url,url:p,method:this._method,headers:_,body:this._body,onSuccess:({body:e,status:t})=>{Object.defineProperty(this,"responseText",{value:e}),Object.defineProperty(this,"status",{value:t}),Object.defineProperty(this,"readyState",{value:4}),this.onreadystatechange?.(),this.onload?.()},onError:e=>{Object.defineProperty(this,"readyState",{value:4}),this.onerror?.(new Error(e.message||"XHR mock error"))}});else{const e=new r;e.open(this._method,p,!0);for(const t in _)e.setRequestHeader(t,_[t]);e.onload=()=>{Object.defineProperty(this,"responseText",{value:e.responseText}),Object.defineProperty(this,"status",{value:e.status}),Object.defineProperty(this,"readyState",{value:4}),this.onreadystatechange?.(),this.onload?.()},e.onerror=()=>{Object.defineProperty(this,"readyState",{value:4}),this.onerror?.()},e.send(this._body)}}catch(e){return console.error("[mockforme][XHR] interception error",e),this._xhr.send(o)}}addEventListener(...e){return this._xhr.addEventListener(...e)}removeEventListener(...e){return this._xhr.removeEventListener(...e)}dispatchEvent(...e){return this._xhr.dispatchEvent(...e)}abort(){return this._xhr.abort()}getAllResponseHeaders(){return this._xhr.getAllResponseHeaders()}getResponseHeader(e){return this._xhr.getResponseHeader(e)}overrideMimeType(e){return this._xhr.overrideMimeType(e)}get readyState(){return this._xhr.readyState}get responseText(){return this._xhr.responseText}get status(){return this._xhr.status}get response(){return this._xhr.response}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get withCredentials(){return this._xhr.withCredentials}set withCredentials(e){this._xhr.withCredentials=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}get upload(){return this._xhr.upload}}}(e,t)}const x=function(e,t,o){const n=r();var s;function i(){if(4==s.readyState)if(s.status.toString().match(/^20[0-9]$/)){var e=function(){var e=s.getResponseHeader("Content-Type"),t=s.responseText;if(e){var r=e.split(";");try{return"application/json"===r[0]?JSON.parse(t):t}catch(e){throw"Unable to convert response header"}}}();t.call(this,e,s)}else o.call(this,s.responseText,s)}function a(e,t){var r=[];for(var o in e)if(e.hasOwnProperty(o)){var n=t?t+"["+o+"]":o,s=e[o];r.push("object"==typeof s?a(s,n):encodeURIComponent(n)+"="+encodeURIComponent(s))}return r.join("&")}return n||(window.XMLHttpRequest?s=new XMLHttpRequest:window.ActiveXObject&&(s=new ActiveXObject("Microsoft.XMLHTTP"))),{request:function(){if(!n){if(window.XMLHttpRequest)s.onload=i;else{if(!window.ActiveXObject)throw"unable to process ajax";s.onreadystatechange=i}var t=a(e.params);if("get"==e.method.toLowerCase()&&"object"==typeof e.params){if(-1==e.url.indexOf("?"))e.url+="?";else{var r=e.url.split("?");r[1]&&r[1].split("=")[1]&&(e.url+="&")}e.url+=t}e.hasOwnProperty("async")||(e.async=!0),s.open(e.method,e.url,e.async),e.headers&&function(e){for(let t in e)s.setRequestHeader(t,e[t])}(e.headers),s.send(t)}}}};function b({di:e,iv:t},r){var o;const n=function(e,t){const r=t.length;return e.split("").map(((e,o)=>String.fromCharCode(e.charCodeAt(0)^t.charCodeAt(o%r)))).join("")}((o=e,"undefined"!=typeof Buffer?Buffer.from(o,"base64").toString("utf8"):decodeURIComponent(escape(atob(o)))),r+t);return JSON.parse(n)}const R=(e,t=null,o="JAVASCRIPT")=>{if(r())return;t||={mappings:[],_o:null,mk:null,_mck:null};const{mappings:n=[],_o:s,mk:d,_mck:p}=t;return i(n),g({_o:s,mk:d,_mck:p}),{run:(t,r=()=>{})=>{E(e,o),s&&d?t(a(),{_o:s,mk:d,_mck:p}):function(e,r,o,n){x({method:"get",url:f,async:!1,headers:{[u]:e,[h]:l,"x-mfm-adaptor":r}},(e=>{if(e){const{di:n,iv:s,_o:a,_mck:c,mk:d}=e,h=b({di:n,iv:s},a);g({_o:a,mk:d,_mck:c}),h&&(i(h),r=h,o={_o:a,mk:d,_mck:c},t?.(r,o))}var r,o}),(e=>{console.log("Error in loading mocked apis"),n(e)})).request()}(e,o,0,r)},checkIfApiToBeMocked:c,getMappings:a,doFetchMappings:(t,r)=>{!function(e,t,r,o){fetch(f,{method:"GET",headers:{[u]:e,[h]:l,"x-mfm-adaptor":t}}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return e.json()})).then((e=>{if(e){const{di:t,iv:o,_o:n,_mck:s,mk:a}=e,c=b({di:t,iv:o},n);g({_o:n,mk:a,_mck:s}),c&&(i(c),r(c,{_o:n,mk:a,_mck:s}))}})).catch((e=>{console.error("Error in loading mocked APIs:",e),o(e)}))}(e,o,((e,r)=>{t?.(e,r)}),r)}}},T=r();T||(globalThis.mockforme=R);let j=R;T&&(j=e=>({run:()=>{}}));const O=j;return t.mockforme})()));
@@ -28,5 +28,6 @@ declare namespace mockforme {
28
28
  * @param callback - Optional. Called with the list of available APIs once loaded.
29
29
  */
30
30
  run(callback?: (apis: []) => void, errorCallback?: (err: Error) => void): void;
31
+ doFetchMappings(successCallback?: (res: any, meta: any) => void, errorCallback?: (err: Error) => void): void;
31
32
  }
32
33
  }
@@ -1 +1 @@
1
- (()=>{var e={56:e=>{"use strict";e.exports=JSON.parse('{"name":"dotenv","version":"16.5.0","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},857:e=>{"use strict";e.exports=require("os")},896:e=>{"use strict";e.exports=require("fs")},928:e=>{"use strict";e.exports=require("path")},982:e=>{"use strict";e.exports=require("crypto")},998:(e,t,n)=>{const r=n(896),o=n(928),s=n(857),i=n(982),a=n(56).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function p(e){console.log(`[dotenv@${a}][DEBUG] ${e}`)}function l(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function u(e,t){let n;try{n=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}const r=n.password;if(!r){const e=new Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const o=n.searchParams.get("environment");if(!o){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const s=`DOTENV_VAULT_${o.toUpperCase()}`,i=e.parsed[s];if(!i){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:i,key:r}}function h(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(const n of e.path)r.existsSync(n)&&(t=n.endsWith(".vault")?n:`${n}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=o.resolve(process.cwd(),".env.vault");return r.existsSync(t)?t:null}function d(e){return"~"===e[0]?o.join(s.homedir(),e.slice(1)):e}const f={configDotenv:function(e){const t=o.resolve(process.cwd(),".env");let n="utf8";const s=Boolean(e&&e.debug);e&&e.encoding?n=e.encoding:s&&p("No encoding is specified. UTF-8 is used by default");let i,a=[t];if(e&&e.path)if(Array.isArray(e.path)){a=[];for(const t of e.path)a.push(d(t))}else a=[d(e.path)];const c={};for(const t of a)try{const o=f.parse(r.readFileSync(t,{encoding:n}));f.populate(c,o,e)}catch(e){s&&p(`Failed to load ${t} ${e.message}`),i=e}let l=process.env;return e&&null!=e.processEnv&&(l=e.processEnv),f.populate(l,c,e),i?{parsed:c,error:i}:{parsed:c}},_configVault:function(e){Boolean(e&&e.debug)&&p("Loading env from encrypted .env.vault");const t=f._parseVault(e);let n=process.env;return e&&null!=e.processEnv&&(n=e.processEnv),f.populate(n,t,e),{parsed:t}},_parseVault:function(e){const t=h(e),n=f.configDotenv({path:t});if(!n.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const r=l(e).split(","),o=r.length;let s;for(let e=0;e<o;e++)try{const t=u(n,r[e].trim());s=f.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=o)throw t}return f.parse(s)},config:function(e){if(0===l(e).length)return f.configDotenv(e);const t=h(e);return t?f._configVault(e):(n=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${a}][WARN] ${n}`),f.configDotenv(e));var n},decrypt:function(e,t){const n=Buffer.from(t.slice(-64),"hex");let r=Buffer.from(e,"base64");const o=r.subarray(0,12),s=r.subarray(-16);r=r.subarray(12,-16);try{const e=i.createDecipheriv("aes-256-gcm",n,o);return e.setAuthTag(s),`${e.update(r)}${e.final()}`}catch(e){const t=e instanceof RangeError,n="Invalid key length"===e.message,r="Unsupported state or unable to authenticate data"===e.message;if(t||n){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw e}},parse:function(e){const t={};let n,r=e.toString();for(r=r.replace(/\r\n?/gm,"\n");null!=(n=c.exec(r));){const e=n[1];let r=n[2]||"";r=r.trim();const o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===o&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[e]=r}return t},populate:function(e,t,n={}){const r=Boolean(n&&n.debug),o=Boolean(n&&n.override);if("object"!=typeof t){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(!0===o&&(e[n]=t[n]),r&&p(!0===o?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):e[n]=t[n]}};e.exports.configDotenv=f.configDotenv,e.exports._configVault=f._configVault,e.exports._parseVault=f._parseVault,e.exports.config=f.config,e.exports.decrypt=f.decrypt,e.exports.parse=f.parse,e.exports.populate=f.populate,e.exports=f}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{mockforme:()=>m});const e=require("http");var t=n.n(e);const o=require("https");var s=n.n(o);const i=require("child_process");var a=n(998);const c=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},p=(e,t)=>{const n=e.split("/"),r=t.split("/");if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e];if(t!==r[e]&&":any"!==t)return!1}return!0};n.n(a)().config("../../.env");const l="https://api.mockforme.com",u=`${l}/mockforme`;let h=`${l}/gateway/3f4eae522b`;const d="mfmver",f="4.2.0";class g{constructor(e,n=null,r="NODE"){this.token=e,this.apiMappings=[],this.isReady=!1,this.originalHttpRequest=t().request,this.originalHttpGet=t().get,this.originalHttpsRequest=s().request,this.originalHttpsGet=s().get,this.originalFetch=globalThis.fetch,this.organisationId=null,this.memberKey=null,this.memberCacheKey=null,this.fetchApiMappings(),this.setupInterceptor()}fetchApiMappings(){try{const e=`curl -s -H "mockforme: ${this.token}" "${h}"`,t=(0,i.execSync)(e,{encoding:"utf8"});if(t){const{di:e,iv:n,_o:r,_mck:o,mk:s}=JSON.parse(t);this.organisationId=r,this.memberKey=s,this.memberCacheKey=o;const i=function({di:e,iv:t},n){var r;const o=function(e,t){const n=t.length;return e.split("").map(((e,r)=>String.fromCharCode(e.charCodeAt(0)^t.charCodeAt(r%n)))).join("")}((r=e,"undefined"!=typeof Buffer?Buffer.from(r,"base64").toString("utf8"):decodeURIComponent(escape(atob(r)))),n+t);return JSON.parse(o)}({di:e,iv:n},r);i&&(this.apiMappings=i)}this.isReady=!0}catch(e){console.error("Failed to fetch mappings:",e.message)}}getProxyUrl(){return`${u}/${this.organisationId}/${this.memberKey}`}setupInterceptor(){const e=this;t().request=function(...t){return e.handleIntercept(e.originalHttpRequest,t)},s().request=function(...t){return e.handleIntercept(e.originalHttpsRequest,t)},t().get=function(...t){return e.handleIntercept(e.originalHttpGet,t)},s().get=function(...t){return e.handleIntercept(e.originalHttpsGet,t)},globalThis.fetch=async function(t,n={}){if(!e.isReady)return e.originalFetch(t,n);let r=t;"string"==typeof t?r=new URL(t,"http://localhost"):t instanceof Request&&(r=new URL(t.url));const o=e.interceptFetch(r,n);return e.originalFetch(o.url,o.init)}}handleIntercept(e,t){let n=t[0];if("string"==typeof n&&(n=new URL(n)),!this.isReady)return e.apply(null,[n,...t.slice(1)]);const r=this.interceptRequest(n);return e.apply(null,[r,...t.slice(1)])}interceptRequest(e){const t=this.apiMappings.find((t=>{if(c(t.apiMethod)===c(e.method)&&(t.apiEndpoint===e.path||p(t.apiEndpoint,e.path)))return!0}));if(t){const n={};n.mockforme=this.token,n[d]=f;const r=t?._ack||null;this.memberCacheKey&&r&&(n["x-mfm-key"]=`${this.memberCacheKey}-${r}`);let o=`${this.getProxyUrl()}${e.path}`;e.search&&(o+=e.search);const s=new URL(o);return{...e,hostname:s.hostname,path:s.pathname,headers:{...e.headers,...n}}}return e}interceptFetch(e,t){const n=(t.method||"GET").toUpperCase(),r=this.apiMappings.find((t=>{const r=c(t.apiMethod)===c(n),o=t.apiEndpoint===e.pathname||p(t.apiEndpoint,e.pathname);return r&&o}));if(r){const n={};n.mockforme=this.token,n[d]=f;const o=r?._ack||null;this.memberCacheKey&&o&&(n["x-mfm-key"]=`${this.memberCacheKey}-${o}`);let s=`${this.getProxyUrl()}${e.pathname}`;return e.search&&(s+=e.search),{url:`${s}`,init:{...t,headers:{...t.headers,...n}}}}return{url:e.href,init:t}}run(e){e&&e(this.apiMappings)}}function m(e){return new g(e)}})(),module.exports=r})();
1
+ (()=>{var e={56:e=>{"use strict";e.exports=JSON.parse('{"name":"dotenv","version":"16.5.0","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},857:e=>{"use strict";e.exports=require("os")},896:e=>{"use strict";e.exports=require("fs")},928:e=>{"use strict";e.exports=require("path")},982:e=>{"use strict";e.exports=require("crypto")},998:(e,t,n)=>{const r=n(896),o=n(928),s=n(857),i=n(982),a=n(56).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function p(e){console.log(`[dotenv@${a}][DEBUG] ${e}`)}function l(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function u(e,t){let n;try{n=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}const r=n.password;if(!r){const e=new Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const o=n.searchParams.get("environment");if(!o){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const s=`DOTENV_VAULT_${o.toUpperCase()}`,i=e.parsed[s];if(!i){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:i,key:r}}function h(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(const n of e.path)r.existsSync(n)&&(t=n.endsWith(".vault")?n:`${n}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=o.resolve(process.cwd(),".env.vault");return r.existsSync(t)?t:null}function d(e){return"~"===e[0]?o.join(s.homedir(),e.slice(1)):e}const f={configDotenv:function(e){const t=o.resolve(process.cwd(),".env");let n="utf8";const s=Boolean(e&&e.debug);e&&e.encoding?n=e.encoding:s&&p("No encoding is specified. UTF-8 is used by default");let i,a=[t];if(e&&e.path)if(Array.isArray(e.path)){a=[];for(const t of e.path)a.push(d(t))}else a=[d(e.path)];const c={};for(const t of a)try{const o=f.parse(r.readFileSync(t,{encoding:n}));f.populate(c,o,e)}catch(e){s&&p(`Failed to load ${t} ${e.message}`),i=e}let l=process.env;return e&&null!=e.processEnv&&(l=e.processEnv),f.populate(l,c,e),i?{parsed:c,error:i}:{parsed:c}},_configVault:function(e){Boolean(e&&e.debug)&&p("Loading env from encrypted .env.vault");const t=f._parseVault(e);let n=process.env;return e&&null!=e.processEnv&&(n=e.processEnv),f.populate(n,t,e),{parsed:t}},_parseVault:function(e){const t=h(e),n=f.configDotenv({path:t});if(!n.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const r=l(e).split(","),o=r.length;let s;for(let e=0;e<o;e++)try{const t=u(n,r[e].trim());s=f.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=o)throw t}return f.parse(s)},config:function(e){if(0===l(e).length)return f.configDotenv(e);const t=h(e);return t?f._configVault(e):(n=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${a}][WARN] ${n}`),f.configDotenv(e));var n},decrypt:function(e,t){const n=Buffer.from(t.slice(-64),"hex");let r=Buffer.from(e,"base64");const o=r.subarray(0,12),s=r.subarray(-16);r=r.subarray(12,-16);try{const e=i.createDecipheriv("aes-256-gcm",n,o);return e.setAuthTag(s),`${e.update(r)}${e.final()}`}catch(e){const t=e instanceof RangeError,n="Invalid key length"===e.message,r="Unsupported state or unable to authenticate data"===e.message;if(t||n){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw e}},parse:function(e){const t={};let n,r=e.toString();for(r=r.replace(/\r\n?/gm,"\n");null!=(n=c.exec(r));){const e=n[1];let r=n[2]||"";r=r.trim();const o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===o&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[e]=r}return t},populate:function(e,t,n={}){const r=Boolean(n&&n.debug),o=Boolean(n&&n.override);if("object"!=typeof t){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(!0===o&&(e[n]=t[n]),r&&p(!0===o?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):e[n]=t[n]}};e.exports.configDotenv=f.configDotenv,e.exports._configVault=f._configVault,e.exports._parseVault=f._parseVault,e.exports.config=f.config,e.exports.decrypt=f.decrypt,e.exports.parse=f.parse,e.exports.populate=f.populate,e.exports=f}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{mockforme:()=>m});const e=require("http");var t=n.n(e);const o=require("https");var s=n.n(o);const i=require("child_process");var a=n(998);const c=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},p=(e,t)=>{const n=e.split("/"),r=t.split("/");if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e];if(t!==r[e]&&":any"!==t)return!1}return!0};n.n(a)().config("../../.env");const l="https://api.mockforme.com",u=`${l}/mockforme`;let h=`${l}/gateway/3f4eae522b`;const d="mfmver",f="4.2.1";class g{constructor(e,n=null,r="NODE"){this.token=e,this.apiMappings=[],this.isReady=!1,this.originalHttpRequest=t().request,this.originalHttpGet=t().get,this.originalHttpsRequest=s().request,this.originalHttpsGet=s().get,this.originalFetch=globalThis.fetch,this.organisationId=null,this.memberKey=null,this.memberCacheKey=null,this.fetchApiMappings(),this.setupInterceptor()}fetchApiMappings(){try{const e=`curl -s -H "mockforme: ${this.token}" "${h}"`,t=(0,i.execSync)(e,{encoding:"utf8"});if(t){const{di:e,iv:n,_o:r,_mck:o,mk:s}=JSON.parse(t);this.organisationId=r,this.memberKey=s,this.memberCacheKey=o;const i=function({di:e,iv:t},n){var r;const o=function(e,t){const n=t.length;return e.split("").map(((e,r)=>String.fromCharCode(e.charCodeAt(0)^t.charCodeAt(r%n)))).join("")}((r=e,"undefined"!=typeof Buffer?Buffer.from(r,"base64").toString("utf8"):decodeURIComponent(escape(atob(r)))),n+t);return JSON.parse(o)}({di:e,iv:n},r);i&&(this.apiMappings=i)}this.isReady=!0}catch(e){console.error("Failed to fetch mappings:",e.message)}}getProxyUrl(){return`${u}/${this.organisationId}/${this.memberKey}`}setupInterceptor(){const e=this;t().request=function(...t){return e.handleIntercept(e.originalHttpRequest,t)},s().request=function(...t){return e.handleIntercept(e.originalHttpsRequest,t)},t().get=function(...t){return e.handleIntercept(e.originalHttpGet,t)},s().get=function(...t){return e.handleIntercept(e.originalHttpsGet,t)},globalThis.fetch=async function(t,n={}){if(!e.isReady)return e.originalFetch(t,n);let r=t;"string"==typeof t?r=new URL(t,"http://localhost"):t instanceof Request&&(r=new URL(t.url));const o=e.interceptFetch(r,n);return e.originalFetch(o.url,o.init)}}handleIntercept(e,t){let n=t[0];if("string"==typeof n&&(n=new URL(n)),!this.isReady)return e.apply(null,[n,...t.slice(1)]);const r=this.interceptRequest(n);return e.apply(null,[r,...t.slice(1)])}interceptRequest(e){const t=this.apiMappings.find((t=>{if(c(t.apiMethod)===c(e.method)&&(t.apiEndpoint===e.path||p(t.apiEndpoint,e.path)))return!0}));if(t){const n={};n.mockforme=this.token,n[d]=f;const r=t?._ack||null;this.memberCacheKey&&r&&(n["x-mfm-key"]=`${this.memberCacheKey}-${r}`);let o=`${this.getProxyUrl()}${e.path}`;e.search&&(o+=e.search);const s=new URL(o);return{...e,hostname:s.hostname,path:s.pathname,headers:{...e.headers,...n}}}return e}interceptFetch(e,t){const n=(t.method||"GET").toUpperCase(),r=this.apiMappings.find((t=>{const r=c(t.apiMethod)===c(n),o=t.apiEndpoint===e.pathname||p(t.apiEndpoint,e.pathname);return r&&o}));if(r){const n={};n.mockforme=this.token,n[d]=f;const o=r?._ack||null;this.memberCacheKey&&o&&(n["x-mfm-key"]=`${this.memberCacheKey}-${o}`);let s=`${this.getProxyUrl()}${e.pathname}`;return e.search&&(s+=e.search),{url:`${s}`,init:{...t,headers:{...t.headers,...n}}}}return{url:e.href,init:t}}run(e){e&&e(this.apiMappings)}}function m(e){return new g(e)}})(),module.exports=r})();
@@ -1 +1 @@
1
- import{createRequire as e}from"node:module";var t={56:e=>{e.exports=JSON.parse('{"name":"dotenv","version":"16.5.0","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},857:t=>{t.exports=e(import.meta.url)("os")},896:t=>{t.exports=e(import.meta.url)("fs")},928:t=>{t.exports=e(import.meta.url)("path")},982:t=>{t.exports=e(import.meta.url)("crypto")},998:(e,t,n)=>{const r=n(896),o=n(928),s=n(857),i=n(982),a=n(56).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function p(e){console.log(`[dotenv@${a}][DEBUG] ${e}`)}function l(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function u(e,t){let n;try{n=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}const r=n.password;if(!r){const e=new Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const o=n.searchParams.get("environment");if(!o){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const s=`DOTENV_VAULT_${o.toUpperCase()}`,i=e.parsed[s];if(!i){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:i,key:r}}function h(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(const n of e.path)r.existsSync(n)&&(t=n.endsWith(".vault")?n:`${n}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=o.resolve(process.cwd(),".env.vault");return r.existsSync(t)?t:null}function d(e){return"~"===e[0]?o.join(s.homedir(),e.slice(1)):e}const f={configDotenv:function(e){const t=o.resolve(process.cwd(),".env");let n="utf8";const s=Boolean(e&&e.debug);e&&e.encoding?n=e.encoding:s&&p("No encoding is specified. UTF-8 is used by default");let i,a=[t];if(e&&e.path)if(Array.isArray(e.path)){a=[];for(const t of e.path)a.push(d(t))}else a=[d(e.path)];const c={};for(const t of a)try{const o=f.parse(r.readFileSync(t,{encoding:n}));f.populate(c,o,e)}catch(e){s&&p(`Failed to load ${t} ${e.message}`),i=e}let l=process.env;return e&&null!=e.processEnv&&(l=e.processEnv),f.populate(l,c,e),i?{parsed:c,error:i}:{parsed:c}},_configVault:function(e){Boolean(e&&e.debug)&&p("Loading env from encrypted .env.vault");const t=f._parseVault(e);let n=process.env;return e&&null!=e.processEnv&&(n=e.processEnv),f.populate(n,t,e),{parsed:t}},_parseVault:function(e){const t=h(e),n=f.configDotenv({path:t});if(!n.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const r=l(e).split(","),o=r.length;let s;for(let e=0;e<o;e++)try{const t=u(n,r[e].trim());s=f.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=o)throw t}return f.parse(s)},config:function(e){if(0===l(e).length)return f.configDotenv(e);const t=h(e);return t?f._configVault(e):(n=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${a}][WARN] ${n}`),f.configDotenv(e));var n},decrypt:function(e,t){const n=Buffer.from(t.slice(-64),"hex");let r=Buffer.from(e,"base64");const o=r.subarray(0,12),s=r.subarray(-16);r=r.subarray(12,-16);try{const e=i.createDecipheriv("aes-256-gcm",n,o);return e.setAuthTag(s),`${e.update(r)}${e.final()}`}catch(e){const t=e instanceof RangeError,n="Invalid key length"===e.message,r="Unsupported state or unable to authenticate data"===e.message;if(t||n){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw e}},parse:function(e){const t={};let n,r=e.toString();for(r=r.replace(/\r\n?/gm,"\n");null!=(n=c.exec(r));){const e=n[1];let r=n[2]||"";r=r.trim();const o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===o&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[e]=r}return t},populate:function(e,t,n={}){const r=Boolean(n&&n.debug),o=Boolean(n&&n.override);if("object"!=typeof t){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(!0===o&&(e[n]=t[n]),r&&p(!0===o?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):e[n]=t[n]}};e.exports.configDotenv=f.configDotenv,e.exports._configVault=f._configVault,e.exports._parseVault=f._parseVault,e.exports.config=f.config,e.exports.decrypt=f.decrypt,e.exports.parse=f.parse,e.exports.populate=f.populate,e.exports=f}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};r.d(o,{_:()=>E});const s=e(import.meta.url)("http");var i=r.n(s);const a=e(import.meta.url)("https");var c=r.n(a);const p=e(import.meta.url)("child_process");var l=r(998);const u=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},h=(e,t)=>{const n=e.split("/"),r=t.split("/");if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e];if(t!==r[e]&&":any"!==t)return!1}return!0};r.n(l)().config("../../.env");const d="https://api.mockforme.com",f=`${d}/mockforme`;let m=`${d}/gateway/3f4eae522b`;const g="mfmver",v="4.2.0";class y{constructor(e,t=null,n="NODE"){this.token=e,this.apiMappings=[],this.isReady=!1,this.originalHttpRequest=i().request,this.originalHttpGet=i().get,this.originalHttpsRequest=c().request,this.originalHttpsGet=c().get,this.originalFetch=globalThis.fetch,this.organisationId=null,this.memberKey=null,this.memberCacheKey=null,this.fetchApiMappings(),this.setupInterceptor()}fetchApiMappings(){try{const e=`curl -s -H "mockforme: ${this.token}" "${m}"`,t=(0,p.execSync)(e,{encoding:"utf8"});if(t){const{di:e,iv:n,_o:r,_mck:o,mk:s}=JSON.parse(t);this.organisationId=r,this.memberKey=s,this.memberCacheKey=o;const i=function({di:e,iv:t},n){var r;const o=function(e,t){const n=t.length;return e.split("").map(((e,r)=>String.fromCharCode(e.charCodeAt(0)^t.charCodeAt(r%n)))).join("")}((r=e,"undefined"!=typeof Buffer?Buffer.from(r,"base64").toString("utf8"):decodeURIComponent(escape(atob(r)))),n+t);return JSON.parse(o)}({di:e,iv:n},r);i&&(this.apiMappings=i)}this.isReady=!0}catch(e){console.error("Failed to fetch mappings:",e.message)}}getProxyUrl(){return`${f}/${this.organisationId}/${this.memberKey}`}setupInterceptor(){const e=this;i().request=function(...t){return e.handleIntercept(e.originalHttpRequest,t)},c().request=function(...t){return e.handleIntercept(e.originalHttpsRequest,t)},i().get=function(...t){return e.handleIntercept(e.originalHttpGet,t)},c().get=function(...t){return e.handleIntercept(e.originalHttpsGet,t)},globalThis.fetch=async function(t,n={}){if(!e.isReady)return e.originalFetch(t,n);let r=t;"string"==typeof t?r=new URL(t,"http://localhost"):t instanceof Request&&(r=new URL(t.url));const o=e.interceptFetch(r,n);return e.originalFetch(o.url,o.init)}}handleIntercept(e,t){let n=t[0];if("string"==typeof n&&(n=new URL(n)),!this.isReady)return e.apply(null,[n,...t.slice(1)]);const r=this.interceptRequest(n);return e.apply(null,[r,...t.slice(1)])}interceptRequest(e){const t=this.apiMappings.find((t=>{if(u(t.apiMethod)===u(e.method)&&(t.apiEndpoint===e.path||h(t.apiEndpoint,e.path)))return!0}));if(t){const n={};n.mockforme=this.token,n[g]=v;const r=t?._ack||null;this.memberCacheKey&&r&&(n["x-mfm-key"]=`${this.memberCacheKey}-${r}`);let o=`${this.getProxyUrl()}${e.path}`;e.search&&(o+=e.search);const s=new URL(o);return{...e,hostname:s.hostname,path:s.pathname,headers:{...e.headers,...n}}}return e}interceptFetch(e,t){const n=(t.method||"GET").toUpperCase(),r=this.apiMappings.find((t=>{const r=u(t.apiMethod)===u(n),o=t.apiEndpoint===e.pathname||h(t.apiEndpoint,e.pathname);return r&&o}));if(r){const n={};n.mockforme=this.token,n[g]=v;const o=r?._ack||null;this.memberCacheKey&&o&&(n["x-mfm-key"]=`${this.memberCacheKey}-${o}`);let s=`${this.getProxyUrl()}${e.pathname}`;return e.search&&(s+=e.search),{url:`${s}`,init:{...t,headers:{...t.headers,...n}}}}return{url:e.href,init:t}}run(e){e&&e(this.apiMappings)}}function E(e){return new y(e)}var _=o._;export{_ as mockforme};
1
+ import{createRequire as e}from"node:module";var t={56:e=>{e.exports=JSON.parse('{"name":"dotenv","version":"16.5.0","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},857:t=>{t.exports=e(import.meta.url)("os")},896:t=>{t.exports=e(import.meta.url)("fs")},928:t=>{t.exports=e(import.meta.url)("path")},982:t=>{t.exports=e(import.meta.url)("crypto")},998:(e,t,n)=>{const r=n(896),o=n(928),s=n(857),i=n(982),a=n(56).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function p(e){console.log(`[dotenv@${a}][DEBUG] ${e}`)}function l(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function u(e,t){let n;try{n=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}const r=n.password;if(!r){const e=new Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const o=n.searchParams.get("environment");if(!o){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const s=`DOTENV_VAULT_${o.toUpperCase()}`,i=e.parsed[s];if(!i){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:i,key:r}}function h(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(const n of e.path)r.existsSync(n)&&(t=n.endsWith(".vault")?n:`${n}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=o.resolve(process.cwd(),".env.vault");return r.existsSync(t)?t:null}function d(e){return"~"===e[0]?o.join(s.homedir(),e.slice(1)):e}const f={configDotenv:function(e){const t=o.resolve(process.cwd(),".env");let n="utf8";const s=Boolean(e&&e.debug);e&&e.encoding?n=e.encoding:s&&p("No encoding is specified. UTF-8 is used by default");let i,a=[t];if(e&&e.path)if(Array.isArray(e.path)){a=[];for(const t of e.path)a.push(d(t))}else a=[d(e.path)];const c={};for(const t of a)try{const o=f.parse(r.readFileSync(t,{encoding:n}));f.populate(c,o,e)}catch(e){s&&p(`Failed to load ${t} ${e.message}`),i=e}let l=process.env;return e&&null!=e.processEnv&&(l=e.processEnv),f.populate(l,c,e),i?{parsed:c,error:i}:{parsed:c}},_configVault:function(e){Boolean(e&&e.debug)&&p("Loading env from encrypted .env.vault");const t=f._parseVault(e);let n=process.env;return e&&null!=e.processEnv&&(n=e.processEnv),f.populate(n,t,e),{parsed:t}},_parseVault:function(e){const t=h(e),n=f.configDotenv({path:t});if(!n.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const r=l(e).split(","),o=r.length;let s;for(let e=0;e<o;e++)try{const t=u(n,r[e].trim());s=f.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=o)throw t}return f.parse(s)},config:function(e){if(0===l(e).length)return f.configDotenv(e);const t=h(e);return t?f._configVault(e):(n=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${a}][WARN] ${n}`),f.configDotenv(e));var n},decrypt:function(e,t){const n=Buffer.from(t.slice(-64),"hex");let r=Buffer.from(e,"base64");const o=r.subarray(0,12),s=r.subarray(-16);r=r.subarray(12,-16);try{const e=i.createDecipheriv("aes-256-gcm",n,o);return e.setAuthTag(s),`${e.update(r)}${e.final()}`}catch(e){const t=e instanceof RangeError,n="Invalid key length"===e.message,r="Unsupported state or unable to authenticate data"===e.message;if(t||n){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw e}},parse:function(e){const t={};let n,r=e.toString();for(r=r.replace(/\r\n?/gm,"\n");null!=(n=c.exec(r));){const e=n[1];let r=n[2]||"";r=r.trim();const o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===o&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[e]=r}return t},populate:function(e,t,n={}){const r=Boolean(n&&n.debug),o=Boolean(n&&n.override);if("object"!=typeof t){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(!0===o&&(e[n]=t[n]),r&&p(!0===o?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):e[n]=t[n]}};e.exports.configDotenv=f.configDotenv,e.exports._configVault=f._configVault,e.exports._parseVault=f._parseVault,e.exports.config=f.config,e.exports.decrypt=f.decrypt,e.exports.parse=f.parse,e.exports.populate=f.populate,e.exports=f}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const o=e(import.meta.url)("http");var s=r.n(o);const i=e(import.meta.url)("https");var a=r.n(i);const c=e(import.meta.url)("child_process");var p=r(998);const l=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},u=(e,t)=>{const n=e.split("/"),r=t.split("/");if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e];if(t!==r[e]&&":any"!==t)return!1}return!0};r.n(p)().config("../../.env");const h="https://api.mockforme.com",d=`${h}/mockforme`;let f=`${h}/gateway/3f4eae522b`;const m="mfmver",g="4.2.1";class v{constructor(e,t=null,n="NODE"){this.token=e,this.apiMappings=[],this.isReady=!1,this.originalHttpRequest=s().request,this.originalHttpGet=s().get,this.originalHttpsRequest=a().request,this.originalHttpsGet=a().get,this.originalFetch=globalThis.fetch,this.organisationId=null,this.memberKey=null,this.memberCacheKey=null,this.fetchApiMappings(),this.setupInterceptor()}fetchApiMappings(){try{const e=`curl -s -H "mockforme: ${this.token}" "${f}"`,t=(0,c.execSync)(e,{encoding:"utf8"});if(t){const{di:e,iv:n,_o:r,_mck:o,mk:s}=JSON.parse(t);this.organisationId=r,this.memberKey=s,this.memberCacheKey=o;const i=function({di:e,iv:t},n){var r;const o=function(e,t){const n=t.length;return e.split("").map(((e,r)=>String.fromCharCode(e.charCodeAt(0)^t.charCodeAt(r%n)))).join("")}((r=e,"undefined"!=typeof Buffer?Buffer.from(r,"base64").toString("utf8"):decodeURIComponent(escape(atob(r)))),n+t);return JSON.parse(o)}({di:e,iv:n},r);i&&(this.apiMappings=i)}this.isReady=!0}catch(e){console.error("Failed to fetch mappings:",e.message)}}getProxyUrl(){return`${d}/${this.organisationId}/${this.memberKey}`}setupInterceptor(){const e=this;s().request=function(...t){return e.handleIntercept(e.originalHttpRequest,t)},a().request=function(...t){return e.handleIntercept(e.originalHttpsRequest,t)},s().get=function(...t){return e.handleIntercept(e.originalHttpGet,t)},a().get=function(...t){return e.handleIntercept(e.originalHttpsGet,t)},globalThis.fetch=async function(t,n={}){if(!e.isReady)return e.originalFetch(t,n);let r=t;"string"==typeof t?r=new URL(t,"http://localhost"):t instanceof Request&&(r=new URL(t.url));const o=e.interceptFetch(r,n);return e.originalFetch(o.url,o.init)}}handleIntercept(e,t){let n=t[0];if("string"==typeof n&&(n=new URL(n)),!this.isReady)return e.apply(null,[n,...t.slice(1)]);const r=this.interceptRequest(n);return e.apply(null,[r,...t.slice(1)])}interceptRequest(e){const t=this.apiMappings.find((t=>{if(l(t.apiMethod)===l(e.method)&&(t.apiEndpoint===e.path||u(t.apiEndpoint,e.path)))return!0}));if(t){const n={};n.mockforme=this.token,n[m]=g;const r=t?._ack||null;this.memberCacheKey&&r&&(n["x-mfm-key"]=`${this.memberCacheKey}-${r}`);let o=`${this.getProxyUrl()}${e.path}`;e.search&&(o+=e.search);const s=new URL(o);return{...e,hostname:s.hostname,path:s.pathname,headers:{...e.headers,...n}}}return e}interceptFetch(e,t){const n=(t.method||"GET").toUpperCase(),r=this.apiMappings.find((t=>{const r=l(t.apiMethod)===l(n),o=t.apiEndpoint===e.pathname||u(t.apiEndpoint,e.pathname);return r&&o}));if(r){const n={};n.mockforme=this.token,n[m]=g;const o=r?._ack||null;this.memberCacheKey&&o&&(n["x-mfm-key"]=`${this.memberCacheKey}-${o}`);let s=`${this.getProxyUrl()}${e.pathname}`;return e.search&&(s+=e.search),{url:`${s}`,init:{...t,headers:{...t.headers,...n}}}}return{url:e.href,init:t}}run(e){e&&e(this.apiMappings)}}function y(e){return new v(e)}export{y as mockforme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mockforme",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "mockforme client integration kit. Intercept APIs & get mock responses. Integrate mockforme SDK with your codebase in seconds",
5
5
  "main": "dist/mockforme.client.cjs.js",
6
6
  "module": "dist/mockforme.client.esm.js",
@@ -42,4 +42,4 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  }
45
- }
45
+ }