Comparing version 0.0.9 to 0.0.10
@@ -138,2 +138,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.autotune = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
request.setRequestHeader("Content-Type", "application/json"); | ||
request.onerror = function () { return reject(request.statusText); }; | ||
request.onreadystatechange = function () { | ||
@@ -169,2 +170,3 @@ if (request.readyState == 4 && request.status == 200) { | ||
e_1 = _a.sent(); | ||
log("ERROR getting outcomes", e_1); | ||
return [3, 4]; | ||
@@ -171,0 +173,0 @@ case 4: |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).autotune=e()}}(function(){return function o(u,s,a){function p(t,e){if(!s[t]){if(!u[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[t]={exports:{}};u[t][0].call(i.exports,function(e){return p(u[t][1][e]||e)},i,i.exports,o,u,s,a)}return s[t].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)p(a[e]);return p}({1:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(o,u,s,a){return new(s||(s=Promise))(function(e,t){function n(e){try{i(a.next(e))}catch(e){t(e)}}function r(e){try{i(a.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(n,r)}i((a=a.apply(o,u||[])).next())})},u=this&&this.__generator||function(n,r){var i,o,u,e,s={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(u=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(u=u.call(o,t[1])).done)return u;switch(o=0,u&&(t=[0,u.value]),t[0]){case 0:case 1:u=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(u=0<(u=s.trys).length&&u[u.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!u||t[1]>u[0]&&t[1]<u[3])){s.label=t[1];break}if(6===t[0]&&s.label<u[1]){s.label=u[1],u=t;break}if(u&&s.label<u[2]){s.label=u[2],s.ops.push(t);break}u[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(n,s)}catch(e){t=[6,e],o=0}finally{i=u=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(n,"__esModule",{value:!0});var s,i=!0;function a(e){return"https://2vyiuehl9j.execute-api.us-east-2.amazonaws.com/prod/"+e}function p(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i&&console.log.apply(console,["AUTOTUNE"].concat(e))}function o(e){var t=this;void 0!==s.startExperimentsTimer&&(clearTimeout(s.startExperimentsTimer),s.startExperimentsTimer=void 0),s.queuedStartedExperiments[e.name]=e,s.startExperimentsTimer=window.setTimeout(function(){return r(t,void 0,void 0,function(){var i,o;return u(this,function(e){switch(e.label){case 0:return t=s.queuedStartedExperiments,n=function(e){return{options:e.options,pick:e.pick}},r={},Object.getOwnPropertyNames(t).forEach(function(e){return r[e]=n(t[e],e)}),p("Starting experiments",i=r),s.queuedStartedExperiments={},s.startExperimentsTimer=void 0,[4,f("POST",a("/startExperiments"),{appKey:s.appKey,experiments:i})];case 1:return p("/startExperiments response",o=e.sent()),void 0!==o&&Object.getOwnPropertyNames(o.experiments).forEach(function(e){var t=s.experiments[e];void 0!==t&&(t.key=o.experiments[e].key)}),[2]}var t,n,r})})},100)}function c(e){var t=this;void 0!==s.completeExperimentsTimer&&(clearTimeout(s.completeExperimentsTimer),s.completeExperimentsTimer=void 0),s.queuedCompletedExperiments[e.name]=e,s.completeExperimentsTimer=window.setTimeout(function(){return r(t,void 0,void 0,function(){var n,r;return u(this,function(e){switch(e.label){case 0:return t=s.queuedCompletedExperiments,n=Object.getOwnPropertyNames(t).map(function(e){return t[e]}),s.queuedCompletedExperiments={},s.completeExperimentsTimer=void 0,r={},n.forEach(function(e){return r[e.key]={pick:e.pick,payoff:e.payoff}}),p("Completing experiments",r),[4,f("POST",a("/completeExperiments"),{appKey:s.appKey,experiments:r})];case 1:return e.sent(),[2]}var t})})},100)}function f(r,i,o){return void 0===o&&(o=void 0),new Promise(function(e,t){var n=new XMLHttpRequest;n.open(r,i,!0),n.setRequestHeader("Content-Type","application/json"),n.onreadystatechange=function(){4==n.readyState&&200==n.status&&e(JSON.parse(n.responseText))},void 0!==o?n.send(JSON.stringify(o)):n.send()})}function l(e){var t=s.experiments[e];return void 0===t&&(t=s.experiments[e]=new m(e)),t}n.initialize=function(n){return r(this,void 0,void 0,function(){var i,o;return u(this,function(e){switch(e.label){case 0:p("Initialize",n),i={},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f("GET",(t=n,"https://s3.us-east-2.amazonaws.com/autotune-outcomes/"+t+".json"))];case 2:return i=e.sent(),[3,4];case 3:return e.sent(),[3,4];case 4:return p("Got outcomes",i),o={},Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e],n=t.bestOption,r=t.epsilon;o[e]=new m(e,n,r)}),s={appKey:n,experiments:o,defaultCompletions:{},queuedCompletedExperiments:{},queuedStartedExperiments:{}},[2,{}]}var t})})},n.experiment=l;var m=function(){function e(e,t,n){void 0===t&&(t=void 0),void 0===n&&(n=1),this.name=e,this.bestOption=t,this.epsilon=n}return e.prototype.setValueAndStartExperiment=function(e){return void 0===this.pick&&(this.pick=e,o(this)),this.pick},e.prototype.complete=function(t){return void 0===t&&(t=1),r(this,void 0,void 0,function(){return u(this,function(e){return this.payoff=t,c(this),[2]})})},e.prototype.flipCoin=function(){return"true"===this.oneOf("true","false")},e.prototype.oneOf=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.options=t,e=void 0===this.bestOption||Math.random()<this.epsilon?t[Math.floor(Math.random()*t.length)]:this.bestOption,this.setValueAndStartExperiment(e)},e}();n.Experiment=m,n.flipCoin=function(e){var t=l(e);return(s.defaultCompletions[e]=t).flipCoin()},n.oneOf=function(e,t){var n=l(e);return(s.defaultCompletions[e]=n).oneOf.apply(n,t)},n.complete=function(t){void 0===t&&(t=1);var n=s.defaultCompletions;Object.getOwnPropertyNames(n).forEach(function(e){return n[e].complete(t)})}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).autotune=e()}}(function(){return function o(u,s,a){function p(t,e){if(!s[t]){if(!u[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[t]={exports:{}};u[t][0].call(i.exports,function(e){return p(u[t][1][e]||e)},i,i.exports,o,u,s,a)}return s[t].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)p(a[e]);return p}({1:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(o,u,s,a){return new(s||(s=Promise))(function(e,t){function n(e){try{i(a.next(e))}catch(e){t(e)}}function r(e){try{i(a.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(n,r)}i((a=a.apply(o,u||[])).next())})},u=this&&this.__generator||function(n,r){var i,o,u,e,s={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(u=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(u=u.call(o,t[1])).done)return u;switch(o=0,u&&(t=[0,u.value]),t[0]){case 0:case 1:u=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(u=0<(u=s.trys).length&&u[u.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!u||t[1]>u[0]&&t[1]<u[3])){s.label=t[1];break}if(6===t[0]&&s.label<u[1]){s.label=u[1],u=t;break}if(u&&s.label<u[2]){s.label=u[2],s.ops.push(t);break}u[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(n,s)}catch(e){t=[6,e],o=0}finally{i=u=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(n,"__esModule",{value:!0});var s,i=!0;function a(e){return"https://2vyiuehl9j.execute-api.us-east-2.amazonaws.com/prod/"+e}function p(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i&&console.log.apply(console,["AUTOTUNE"].concat(e))}function o(e){var t=this;void 0!==s.startExperimentsTimer&&(clearTimeout(s.startExperimentsTimer),s.startExperimentsTimer=void 0),s.queuedStartedExperiments[e.name]=e,s.startExperimentsTimer=window.setTimeout(function(){return r(t,void 0,void 0,function(){var i,o;return u(this,function(e){switch(e.label){case 0:return t=s.queuedStartedExperiments,n=function(e){return{options:e.options,pick:e.pick}},r={},Object.getOwnPropertyNames(t).forEach(function(e){return r[e]=n(t[e],e)}),p("Starting experiments",i=r),s.queuedStartedExperiments={},s.startExperimentsTimer=void 0,[4,f("POST",a("/startExperiments"),{appKey:s.appKey,experiments:i})];case 1:return p("/startExperiments response",o=e.sent()),void 0!==o&&Object.getOwnPropertyNames(o.experiments).forEach(function(e){var t=s.experiments[e];void 0!==t&&(t.key=o.experiments[e].key)}),[2]}var t,n,r})})},100)}function c(e){var t=this;void 0!==s.completeExperimentsTimer&&(clearTimeout(s.completeExperimentsTimer),s.completeExperimentsTimer=void 0),s.queuedCompletedExperiments[e.name]=e,s.completeExperimentsTimer=window.setTimeout(function(){return r(t,void 0,void 0,function(){var n,r;return u(this,function(e){switch(e.label){case 0:return t=s.queuedCompletedExperiments,n=Object.getOwnPropertyNames(t).map(function(e){return t[e]}),s.queuedCompletedExperiments={},s.completeExperimentsTimer=void 0,r={},n.forEach(function(e){return r[e.key]={pick:e.pick,payoff:e.payoff}}),p("Completing experiments",r),[4,f("POST",a("/completeExperiments"),{appKey:s.appKey,experiments:r})];case 1:return e.sent(),[2]}var t})})},100)}function f(r,i,o){return void 0===o&&(o=void 0),new Promise(function(e,t){var n=new XMLHttpRequest;n.open(r,i,!0),n.setRequestHeader("Content-Type","application/json"),n.onerror=function(){return t(n.statusText)},n.onreadystatechange=function(){4==n.readyState&&200==n.status&&e(JSON.parse(n.responseText))},void 0!==o?n.send(JSON.stringify(o)):n.send()})}function l(e){var t=s.experiments[e];return void 0===t&&(t=s.experiments[e]=new m(e)),t}n.initialize=function(n){return r(this,void 0,void 0,function(){var i,o;return u(this,function(e){switch(e.label){case 0:p("Initialize",n),i={},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f("GET",(t=n,"https://s3.us-east-2.amazonaws.com/autotune-outcomes/"+t+".json"))];case 2:return i=e.sent(),[3,4];case 3:return p("ERROR getting outcomes",e.sent()),[3,4];case 4:return p("Got outcomes",i),o={},Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e],n=t.bestOption,r=t.epsilon;o[e]=new m(e,n,r)}),s={appKey:n,experiments:o,defaultCompletions:{},queuedCompletedExperiments:{},queuedStartedExperiments:{}},[2,{}]}var t})})},n.experiment=l;var m=function(){function e(e,t,n){void 0===t&&(t=void 0),void 0===n&&(n=1),this.name=e,this.bestOption=t,this.epsilon=n}return e.prototype.setValueAndStartExperiment=function(e){return void 0===this.pick&&(this.pick=e,o(this)),this.pick},e.prototype.complete=function(t){return void 0===t&&(t=1),r(this,void 0,void 0,function(){return u(this,function(e){return this.payoff=t,c(this),[2]})})},e.prototype.flipCoin=function(){return"true"===this.oneOf("true","false")},e.prototype.oneOf=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.options=t,e=void 0===this.bestOption||Math.random()<this.epsilon?t[Math.floor(Math.random()*t.length)]:this.bestOption,this.setValueAndStartExperiment(e)},e}();n.Experiment=m,n.flipCoin=function(e){var t=l(e);return(s.defaultCompletions[e]=t).flipCoin()},n.oneOf=function(e,t){var n=l(e);return(s.defaultCompletions[e]=n).oneOf.apply(n,t)},n.complete=function(t){void 0===t&&(t=1);var n=s.defaultCompletions;Object.getOwnPropertyNames(n).forEach(function(e){return n[e].complete(t)})}},{}]},{},[1])(1)}); |
@@ -137,2 +137,3 @@ "use strict"; | ||
request.setRequestHeader("Content-Type", "application/json"); | ||
request.onerror = function () { return reject(request.statusText); }; | ||
request.onreadystatechange = function () { | ||
@@ -168,2 +169,3 @@ if (request.readyState == 4 && request.status == 200) { | ||
e_1 = _a.sent(); | ||
log("ERROR getting outcomes", e_1); | ||
return [3, 4]; | ||
@@ -170,0 +172,0 @@ case 4: |
{ | ||
"name": "autotune", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Automatically tune JavaScript apps", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
44228
552