Comparing version 1.1.8 to 1.1.9
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(function(){return(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},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,{default:()=>i});const o=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},n=function(e,t,o){var n;function r(){if(4==n.readyState)if(n.status.toString().match(/^20[0-9]$/)){var e=function(){var e=n.getResponseHeader("Content-Type"),t=n.responseText;if(e){var o=e.split(";");try{switch(o[0]){case"application/json":return JSON.parse(t);default:return t}}catch(e){throw"Unable to convert response header"}}}();t.call(this,e,n)}else o.call(this,n.responseText,n)}function i(e,t){var o=[];for(var n in e)if(e.hasOwnProperty(n)){var r=t?t+"["+n+"]":n,a=e[n];o.push("object"==typeof a?i(a,r):encodeURIComponent(r)+"="+encodeURIComponent(a))}return o.join("&")}return window.XMLHttpRequest?n=new XMLHttpRequest:window.ActiveXObject&&(n=new ActiveXObject("Microsoft.XMLHTTP")),{request:function(){if(window.XMLHttpRequest)n.onload=r;else{if(!window.ActiveXObject)throw"unable to process ajax";n.onreadystatechange=r}var t=i(e.params);if("get"==e.method.toLowerCase()&&"object"==typeof e.params){if(-1==e.url.indexOf("?"))e.url+="?";else{var o=e.url.split("?");o[1]&&o[1].split("=")[1]&&(e.url+="&")}e.url+=t}e.hasOwnProperty("async")||(e.async=!0),n.open(e.method,e.url,e.async),e.headers&&function(e){for(let t in e)n.setRequestHeader(t,e[t])}(e.headers),n.send(t)}}},r=e=>{const t="https://dashboard.mockforme.com",r=`${t}/mockforme`,i=`${t}/gateway/op/getEnabledApisForSdk`,a="mockforme";let s=[];const c=window.location,l=c.protocol;if(c.host,c.port,!e)throw"mockforme token cannot be null";const p=(e,t="get")=>{let n=null;if(!Array.isArray(s))return n;for(let r=0;r<s.length;r++){const i=s[r];if(o(i.apiMethod)===o(t)&&i.apiEndpoint===e){n={url:i.apiEndpoint,method:i.apiMethod};break}}return n},d=()=>{(()=>{const t=window.fetch;window.fetch=function(o,n={}){n.method||(n.method="get");let i=arguments;o&&(o.startsWith("//")?o=`${window.location.protocol}${o}`:o.startsWith("/")&&(o=`${window.location.origin}${o}`));const s=new URL(o),c=s&&s.pathname,l=p(c,n.method);return l&&(o=`${r}${l.url}`,i[0]=o,n.headers={[a]:e}),t.call(this,o,n)}})(),(()=>{let t=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(o,n,i,s,c){try{n&&(n.startsWith("//")?n=`${window.location.protocol}${n}`:n.startsWith("/")?n=`${window.location.origin}${n}`:n.indexOf("://")>-1||(n=`${l}//${n}`));const i=new URL(n),s=i&&i.pathname;let c=arguments;const d=p(s,o);return d&&(c[1]=`${r}${d.url}`),this.onreadystatechange=function(){1==this.readyState&&this.setRequestHeader(a,e)},t.apply(this,c)}catch(e){return console.log("Error in mock api, could be invalid url",e),t.apply(this,arguments)}}})()};return{initialize:e=>{var t;d(),t=t=>{e&&e(t)},n({method:"get",url:i,async:!1},(e=>{var o;e&&(o=e,s=s.concat(o)),t(e)}),(()=>{console.log("Error in loading mocked apis")})).request()}}};window.mockforme=r;const i=r;return t})()})); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,(function(){return(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>a});const o=t=>{try{return t?t.toLowerCase():t}catch(t){return console.log(t),null}},n=function(t,e,o){var n;function r(){if(4==n.readyState)if(n.status.toString().match(/^20[0-9]$/)){var t=function(){var t=n.getResponseHeader("Content-Type"),e=n.responseText;if(t){var o=t.split(";");try{switch(o[0]){case"application/json":return JSON.parse(e);default:return e}}catch(t){throw"Unable to convert response header"}}}();e.call(this,t,n)}else o.call(this,n.responseText,n)}function i(t,e){var o=[];for(var n in t)if(t.hasOwnProperty(n)){var r=e?e+"["+n+"]":n,a=t[n];o.push("object"==typeof a?i(a,r):encodeURIComponent(r)+"="+encodeURIComponent(a))}return o.join("&")}return window.XMLHttpRequest?n=new XMLHttpRequest:window.ActiveXObject&&(n=new ActiveXObject("Microsoft.XMLHTTP")),{request:function(){if(window.XMLHttpRequest)n.onload=r;else{if(!window.ActiveXObject)throw"unable to process ajax";n.onreadystatechange=r}var e=i(t.params);if("get"==t.method.toLowerCase()&&"object"==typeof t.params){if(-1==t.url.indexOf("?"))t.url+="?";else{var o=t.url.split("?");o[1]&&o[1].split("=")[1]&&(t.url+="&")}t.url+=e}t.hasOwnProperty("async")||(t.async=!0),n.open(t.method,t.url,t.async),t.headers&&function(t){for(let e in t)n.setRequestHeader(e,t[e])}(t.headers),n.send(e)}}},r=(t,e)=>{const o=t.split("/"),n=e.split("/");if(o.length!==n.length)return!1;for(let t=0;t<o.length;t++){const e=o[t];if(e!==n[t]&&":any"!==e)return!1}return!0},i=t=>{const e="https://dashboard.mockforme.com",i=`${e}/mockforme`,a=`${e}/gateway/op/getEnabledApisForSdk`,s="mockforme";let c=[];const l=window.location,p=l.protocol;if(l.host,l.port,!t)throw"mockforme token cannot be null";const d=(t,e="get")=>{let n=null;if(!Array.isArray(c))return n;for(let i=0;i<c.length;i++){const a=c[i];if(o(a.apiMethod)===o(e)&&(a.apiEndpoint===t||r(a.apiEndpoint,t))){n={url:t,method:a.apiMethod};break}}return n},u=()=>{(()=>{const e=window.fetch;window.fetch=function(o,n={}){n.method||(n.method="get");let r=arguments;o&&(o.startsWith("//")?o=`${window.location.protocol}${o}`:o.startsWith("/")&&(o=`${window.location.origin}${o}`));const a=new URL(o),c=a&&a.pathname,l=d(c,n.method);return l&&(o=`${i}${l.url}`,r[0]=o,n.headers={[s]:t}),e.call(this,o,n)}})(),(()=>{let e=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(o,n,r,a,c){try{n&&(n.startsWith("//")?n=`${window.location.protocol}${n}`:n.startsWith("/")?n=`${window.location.origin}${n}`:n.indexOf("://")>-1||(n=`${p}//${n}`));const r=new URL(n),a=r&&r.pathname;let c=arguments;const l=d(a,o);return l&&(c[1]=`${i}${l.url}`),this.onreadystatechange=function(){1==this.readyState&&this.setRequestHeader(s,t)},e.apply(this,c)}catch(t){return console.log("Error in mock api, could be invalid url",t),e.apply(this,arguments)}}})()};return{initialize:t=>{var e;u(),e=e=>{t&&t(e)},n({method:"get",url:a,async:!1},(t=>{var o;t&&(o=t,c=c.concat(o)),e(t)}),(()=>{console.log("Error in loading mocked apis")})).request()}}};window.mockforme=i;const a=i;return e})()})); |
{ | ||
"name": "mockforme", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "mockforme client integration kit. Intercept APIs & get mock responses. Integrate mockforme SDK with your codebase in seconds", | ||
@@ -5,0 +5,0 @@ "main": "dist/mockforme.min.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5973