Comparing version 1.0.23 to 1.0.24
@@ -1,1 +0,1 @@ | ||
"use strict";var __awaiter=this&&this.__awaiter||function(e,a,n,u){function s(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(t,n){function r(e){try{o(u.next(e))}catch(e){n(e)}}function i(e){try{o(u["throw"](e))}catch(e){n(e)}}function o(e){e.done?t(e.value):s(e.value).then(r,i)}o((u=u.apply(e,a||[])).next())})};var __generator=this&&this.__generator||function(e,n){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,o,a,t;return t={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(t[Symbol.iterator]=function(){return this}),t;function u(t){return function(e){return s([t,e])}}function s(t){if(i)throw new TypeError("Generator is already executing.");while(r)try{if(i=1,o&&(a=t[0]&2?o["return"]:t[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;if(o=0,a)t=[t[0]&2,a.value];switch(t[0]){case 0:case 1:a=t;break;case 4:r.label++;return{value:t[1],done:false};case 5:r.label++;o=t[1];t=[0];continue;case 7:t=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(t[0]===6||t[0]===2)){r=0;continue}if(t[0]===3&&(!a||t[1]>a[0]&&t[1]<a[3])){r.label=t[1];break}if(t[0]===6&&r.label<a[1]){r.label=a[1];a=t;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(t);break}if(a[2])r.ops.pop();r.trys.pop();continue}t=n.call(e,r)}catch(e){t=[6,e];o=0}finally{i=a=0}if(t[0]&5)throw t[1];return{value:t[0]?t[1]:void 0,done:true}}};var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:true});exports.Libmon=void 0;var axios_1=__importDefault(require("axios"));var BASE_URL="https://pvxtcvzp9a.execute-api.us-east-1.amazonaws.com/dev/";var isValidated=false;var counters={};var libName="";var opts=undefined;var Libmon=function(){function n(){}n.initialize=function(e,t){libName=e;opts=t};n.validate=function(r){return __awaiter(this,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);if(!libName)throw new Error("Libmon: No library name was provided when initializing");return[4,axios_1.default.get(BASE_URL+"\\validate",{headers:{token:r,lib:libName}})];case 1:t=e.sent();if(t.status===200)isValidated=true;if(t.status===204)isValidated=false;return[3,3];case 2:n=e.sent();console.log("Libmon Server failed to give proper response. Authorizing...");isValidated=true;return[3,3];case 3:return[2,isValidated]}})})};n.disable=function(){var e="LibMon: This function is not available. Please purchase a valid token to improve reliability at libmon.com\\"+libName+".";if(!isValidated)throw new Error(e)};n.crash=function(){var e="LibMon: This crash was done intentionally. Please purchase a library token to improve reliability and performance at libmon.com\\lib\\"+libName;if(!isValidated)throw new Error(e)};n.setupCounter=function(e,t){if(!e||!t)new Error("Libmon: A counter name or a max count value was not provided.");counters[e]={count:0,max:t}};n.increment=function(e){this.doesCounterExist(e);var t=counters[e].count;counters[e].count=t+1;this.validateCounter(e)};n.decrement=function(e){n.doesCounterExist(e);var t=counters[e].count;counters[e].count=t-1;this.validateCounter(e)};n.doesCounterExist=function(e){if(!counters[e]){throw new Error("LibMon: Counter: "+e+" was not setup. Please use the setupCounter method to validate")}};n.validateCounter=function(e){if(isValidated)return;var t=counters[e],n=t.max,r=t.count;if(r>n){throw new Error("LibMon: Counter: "+e+" limit exceeded. Please restart the program to reset the limit.")}};return n}();exports.Libmon=Libmon; | ||
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Libmon=void 0;var e=require("tslib"),t=e.__importDefault(require("axios")),i=!1,n={},o="",r=function(){function r(){}return r.initialize=function(e,t){o=e},r.validate=function(n){return e.__awaiter(this,void 0,void 0,(function(){var r;return e.__generator(this,(function(e){switch(e.label){case 0:if(e.trys.push([0,2,,3]),!o)throw new Error("Libmon: No library name was provided when initializing");return[4,t.default.get("https://api.libmon.com\\validate",{headers:{token:n,lib:o}})];case 1:return 200===(r=e.sent()).status&&(i=!0),204===r.status&&(i=!1),[3,3];case 2:return e.sent(),console.log("Libmon Server failed to give proper response. Authorizing..."),i=!0,[3,3];case 3:return[2,i]}}))}))},r.disable=function(){if(!i)throw new Error("LibMon: This function is not available. Please purchase a valid token to improve reliability at libmon.com\\"+o+".")},r.crash=function(){if(!i)throw new Error("LibMon: This crash was done intentionally. Please purchase a library token to improve reliability and performance at libmon.com\\lib\\"+o)},r.setupCounter=function(e,t){n[e]={count:0,max:t}},r.increment=function(e){this.doesCounterExist(e);var t=n[e].count;n[e].count=t+1,this.validateCounter(e)},r.decrement=function(e){r.doesCounterExist(e);var t=n[e].count;n[e].count=t-1,this.validateCounter(e)},r.doesCounterExist=function(e){if(!n[e])throw new Error("LibMon: Counter: "+e+" was not setup. Please use the setupCounter method to validate")},r.validateCounter=function(e){if(!i){var t=n[e],o=t.max;if(t.count>o)throw new Error("LibMon: Counter: "+e+" limit exceeded. Please restart the program to reset the limit.")}},r}();exports.Libmon=r})); |
{ | ||
"name": "libmon", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
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
158
14457