diff --git a/browser/deployr.js b/browser/deployr.js index 5eb8cd8..d91f621 100644 --- a/browser/deployr.js +++ b/browser/deployr.js @@ -1,3 +1,148 @@ +/*! + * `deployr` JavaScript Client Library v7.4.1 + * http://deployr.revolutionanalytics.com/documents/dev/client-jsdoc + * + * Copyright (C) 2010-2015 by Revolution Analytics Inc. + * Released under the Apache License 2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Includes: + * - superagent: https://github.com/visionmedia/superagent + * - ws: https://github.com/einaros/ws + * - D.js: http://malko.github.io/D.js + * - yui-lang.js: https://github.com/yui/yui3 (DeployR port) + * + * superagent + * + * Copyright (c) 2014-2015 TJ Holowaychuk + * Open Source Initiative OSI - The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the, + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ws + * + * Copyright (c) 2011 Einar Otto Stangvik + * Open Source Initiative OSI - The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * D + * + * Copyright (C) 2013 Jonathan Gotti + * Open Source Initiative OSI - The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the, + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * selfish + * + * Copyright 2011 Irakli Gozalishvili. All rights reserved + * Open Source Initiative OSI - The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the, + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * yui-lang + * + * The lang component is a DeployR port of yui-lang.js by Yahoo! + * + * Software License Agreement (BSD License) + * Copyright (c) 2013, Yahoo! Inc. All rights reserved. + * + * Redistribution and use of this software in source and binary forms, + * with or without modification, are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. Redistributions + * in binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * Neither the name of Yahoo! Inc. nor the names of YUI's contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission of Yahoo! Inc. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT, + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Date: 2015-07-27 + */ (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.deployr = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o3&&(o=o.slice(1)),E["new"]("/r/repository/shell/execute",r).data({author:o[0],directory:o[1],filename:o[2],args:e})},code:function(t,e){var r={cookies:this.cookies,queue:this.q,deferred:this.deferred},o="/r/project/execute/code";return e?E["new"](o,r).data({code:t,project:e}):E["new"]("/r/project/create",r).end(function(t){return{project:t.get("project").project}}).io(o).data({code:t})},release:function(t,e){function r(t){t===c&&(e?(i.resolve(!0),o.destroy()):E["new"]("/r/user/logout").share(u).error(function(){i.reject(!1)}).end(function(){i.resolve(!0)}).ensure(function(){o.destroy()}))}t=p.isArray(t)?t:[t];var o=this,i=s(),n=!t||!t[0],a=0,c=n?a:t.length-1,u=this.getCookies();return n?r(a):t.forEach(function(t){E["new"]("/r/project/close").data({project:t}).share(u).end().ensure(function(){r(a),a++})}),i.promise},routputs:function(t){return t&&(this.outputs=this.outputs.concat(t)),this},routput:function(t){return t&&this.routputs([t]),this},rinputs:function(t){return t&&(this.inputs=this.inputs.concat(t)),this},rinput:function(t){return t&&this.inputs.push(t),this},destroy:function(){try{this.emit("destroy"),this.offAll();for(var t in this)this.hasOwnProperty(t)&&(this[t]=null,delete this[t])}catch(e){}},_clear:function(){this.params={},this.inputs=[],this.outputs=[],this.rstream=!1,this.delayed=!1,this.api=null,this.file=null,this.entities=null,this.ioFilter=null},_prepRequest:function(t,e){var r=this.req,o=this.file;if(this.api.upload?i||this.req.type("multipart/form-data"):r.type("form"),r.on("error",function(t){t=t||{code:"UNKNOWN CODE",text:"UNKNOWN ERROR"},this._handleError({status:t.code||"UNKNOWN CODE",text:t})}.bind(this)),this.share(e?e.__cookies__:null),e&&this.data(e),this.inputs.length>0&&this.data({inputs:y.encode(this.inputs)}),this.outputs.length>0&&this.data({robjects:this.outputs.join()}),this.cookies&&this.cookies.forEach(function(t){r.set("Cookie",t)}),this.api.upload){for(var n in this.params)r.field(n,this.params[n]?this.params[n]+"":"");r.attach("file",this.rstream?a.createReadStream(o):o)}else r["GET"===this.api.method?"query":"send"](this.params)},_handleError:function(t){var e=t.status,r=t.body&&t.body.deployr?t.body:t,i=200!==e||r.deployr&&!r.deployr.response.success;return i&&(r={get:function(t){return l.get(this.deployr.response,t)},deployr:{response:{success:!1,call:this.api.call,errorCode:r.deployr?r.deployr.response.errorCode:e,error:r.deployr?r.deployr.response.error:r.text}}},h.error("error()",this.api,r,t),this.logger.error("error()",this.api,r,t),this.globalEvts&&o(this.api.call,r),this.emit("error",r),this.emit("deployr-io:"+r.deployr.response.errorCode,r),this.deferred.reject(r)),i}});i&&(window.Revolution=window.Revolution||t("./lib/deprecated")),e.exports={DeployR:E,apis:function(t){return t?Object.keys(c):c},configure:function(t){t=t||{};for(var e in t)j.set(e,t[e]);return j.sticky||j.set("cookies",null),h.setLevel(j.logging?h.DEBUG:h.OFF),this},io:function(t){return E["new"](t)},auth:function(t,e){var r={username:t,password:e};return E["new"]("/r/user/login").data(r).end()},script:function(){var t=l.signature(arguments),e=t.opts,r=t.api;return t.create?E["new"]("/r/project/create").end(function(t){return{project:t.get("project").project}}).io(r).data(e):E["new"](r).data(e)},pipeline:function(t){function e(){i.add(function(){t.shift().drain().then(function(t){n.push(t),a.push(c),i.isEmpty()&&(r.configure(u),o.resolve({results:n,errors:a})),i.take()},function(t){n.push(c),a.push(t),i.isEmpty()&&0===n.length&&(r.configure(u),o.reject(a)),i.take()})},null,!0)}var r=this,o=s(),i=new f,n=[],a=[],c=null,u={sticky:j.sticky,cookies:j.cookies};t=t.slice(0),r.configure({sticky:!0});for(var l=0;l=0;o.lengthi?"0"+i:i,s=10>s?"0"+s:s,a=10>a?"0"+a:a,c=10>c?"0"+c:c,l=o+"-"+i+"-"+n,e===p.RPOSIX_DATE||e===p.RPOSIX_DATE_VECTOR){var h=s+":"+a+":"+c,f=-u,d="+";0>f&&(f=-f,d="-"),u=d+r(f/60,2)+""+r(f%60,2),l+=" "+h+" "+u}return l}function n(t,e){for(var r=t.value,s=0;s "+i[2].call]);for(var u=2;u=this.context.value&&o(e,{level:t,name:this.context.name,value:this.context.value})},debug:function(){this.log(s.DEBUG,arguments)},error:function(){this.log(s.ERROR,arguments)},info:function(){this.log(s.INFO,arguments)},warn:function(){this.log(s.WARN,arguments)},setLevel:function(t){t&&"value"in t&&(this.context=t)}},s.DEBUG={value:1,name:"DEBUG"},s.INFO={value:2,name:"INFO"},s.WARN={value:4,name:"WARN"},s.ERROR={value:8,name:"ERROR"},s.OFF={value:99,name:"OFF"},s.setLevel=function(t){n.setLevel(t)},s.debug=function(){n.debug.apply(n,arguments)},s.info=function(){n.info.apply(n,arguments)},s.warn=function(){n.warn.apply(n,arguments)},s.error=function(){n.error.apply(n,arguments)},s.get=function(t,e,r){return a[t]||function(){return a[t]=new i(t,e,r),a[t]}()},n=s.get("global"),e.exports=s},{}],9:[function(t,e,r){e.exports=function(e){try{return t(e)}catch(r){}}},{}],10:[function(t,e,r){function o(){this.emptyCallback=null,this.callbacks=[],this.yielded=!1,this.response=null,this.responseChain=[]}o.prototype={add:function(t,e,r){this.yielded||r?this.callbacks.push({fn:t,ctx:e}):t.apply(e||this,[this.response])},size:function(){return this.callbacks.length},isEmpty:function(){return 0===this.callbacks.length},empty:function(t,e){this.emptyCallback={fn:t,ctx:e}},"yield":function(t){this.yielded=t},take:function(t,e,r){var o;t&&(this.response=t,this.responseChain.push(t)),!this.yielded&&this.callbacks[0]&&(o=this.callbacks.shift(),o.fn.apply(o.ctx||this,[this.responseChain,e,r]),this.callbacks[0]&&this.emptyCallback&&this.emptyCallback.fn.call(this.emptyCallback.ctx||this))},flush:function(t,e,r){for(t&&(this.response=t,this.responseChain.push(t));this.callbacks[0]&&!this.yielded;){var o=this.callbacks.shift();o.fn.apply(o.ctx||this,[this.responseChain,e,r]),this.callbacks[0]&&this.emptyCallback&&this.emptyCallback.fn.call(this.emptyCallback.ctx||this)}}},e.exports=o},{}],11:[function(t,e,r){var o=t("./selfish").Base,i=t("./rtypes");e.exports=o.extend(i,{initialize:function(t,e,r){this.name=t,this.value=e,this.options=r||{}},numeric:function(){return this.assert({type:this.deployr.RNUMERIC,name:this.name,value:this.value,toString:this.toString})},integer:function(){return this.assert({type:this.deployr.RINTEGER,name:this.name,value:this.value,toString:this.toString})},logical:function(){return this.assert({type:this.deployr.RBOOLEAN,name:this.name,value:this.value,toString:this.toString})},character:function(){return this.assert({type:this.deployr.RSTRING,name:this.name,value:this.value,toString:this.toString})},date:function(){return this.assert({type:this.deployr.RDATE,name:this.name,value:this.value,format:"yyyy-MM-dd",toString:this.toString})},posixct:function(){return this.assert({type:this.deployr.RPOSIX_DATE,name:this.name,value:this.value,format:"yyyy-MM-dd HH:mm:ss Z",toString:this.toString})},numericVector:function(){return this.assert({type:this.deployr.RNUMERIC_VECTOR,name:this.name,value:this.value,toString:this.toString})},integerVector:function(){return this.assert({type:this.deployr.RINTEGER_VECTOR,name:this.name,value:this.value,toString:this.toString})},logicalVector:function(){return this.assert({type:this.deployr.RBOOLEAN_VECTOR,name:this.name,value:this.value,toString:this.toString})},characterVector:function(){return this.assert({type:this.deployr.RSTRING_VECTOR,name:this.name,value:this.value,toString:this.toString})},dateVector:function(){return this.assert({type:this.deployr.RDATE_VECTOR,name:this.name,value:this.value,format:"yyyy-MM-dd",toString:this.toString})},posixctVector:function(){return this.assert({type:this.deployr.RPOSIX_DATE_VECTOR,name:this.name,value:this.value,format:"yyyy-MM-dd HH:mm:ss Z",toString:this.toString})},list:function(){return this.assert({type:this.deployr.RLIST,name:this.name,value:this.value,toString:this.toString})},dataframe:function(){return this.assert({type:this.deployr.RDATAFRAME,name:this.name,value:this.value,toString:this.toString})},factor:function(){var t=this.options;return this.assert({type:this.deployr.RFACTOR,name:this.name,value:this.value,ordered:!1,levels:t.levels,labels:t.labels,toString:this.toString})},ordered:function(){var t=this.options;return this.assert({type:this.deployr.RORDERED,name:this.name,value:this.value,ordered:!0,levels:t.levels,labels:t.labels,toString:this.toString})},numericMatrix:function(){return this.assert({type:this.deployr.RNUMERIC_MATRIX,name:this.name,value:this.value,toString:this.toString})},integerMatrix:function(){return this.assert({type:this.deployr.RINTEGER_MATRIX,name:this.name,value:this.value,toString:this.toString})},logicalMatrix:function(){return this.assert({type:this.deployr.RBOOLEAN_MATRIX,name:this.name,value:this.value,toString:this.toString})},characterMatrix:function(){return this.assert({type:this.deployr.RSTRING_MATRIX,name:this.name,value:this.value,toString:this.toString})},toString:function(){var t=this.options||{},e=t.levels?"[ levels = "+t.levels+"]":"",r=t.labels?"[ labels = "+t.labels+"]":"";return"[ name = "+this.name+" ] [ value = "+this.value+" ] [ type = "+this.type+" ] "+e+r}})},{"./rtypes":13,"./selfish":14}],12:[function(t,e,r){function o(t,e,r,o){var i;if(s.isObject(e)){if(i=e,!i.type!==t)throw new Error('IllegalArgumentError:Expecting "'+t+'" but found "'+i.type+'"')}else i=a["new"](e,r,o)[t]();return i}var i=t("./selfish").Base,n=t("./rtypes"),s=t("./lang"),a=t("./rinput");e.exports=i.extend(n,{numeric:function(t,e){return this.inputs.push(o(this.deployr.RNUMERIC,t,e)),this},integer:function(t,e){return this.inputs.push(o(this.deployr.RINTEGER,t,e)),this},logical:function(t,e){return this.inputs.push(o(this.deployr.RBOOLEAN,t,e)),this},character:function(t,e){return this.inputs.push(o(this.deployr.RSTRING,t,e)),this},date:function(t,e){return this.inputs.push(o(this.deployr.RDATE,t,e)),this},posixct:function(t,e){return this.inputs.push(o(this.deployr.RPOSIX_DATE,t,e)),this},numericVector:function(t,e){return this.inputs.push(o(this.deployr.RNUMERIC_VECTOR,t,e)),this},integerVector:function(t,e){return this.inputs.push(o(this.deployr.RINTEGER_VECTOR,t,e)),this},logicalVector:function(t,e){return this.inputs.push(o(this.deployr.RBOOLEAN_VECTOR,t,e)),this},characterVector:function(t,e){return this.inputs.push(o(this.deployr.RSTRING_VECTOR,t,e)),this},dateVector:function(t,e){return this.inputs.push(o(this.deployr.RDATE_VECTOR,t,e)),this},posixctVector:function(t,e){return this.inputs.push(o(this.deployr.RPOSIX_DATE_VECTOR,t,e)),this},list:function(t,e){return this.inputs.push(o(this.deployr.RLIST,t,e)),this},dataframe:function(t,e){return this.inputs.push(o(this.deployr.RDATAFRAME,t,e)),this},factor:function(t,e,r,i){var n={levels:r,labels:i};return this.inputs.push(o(this.deployr.RFACTOR,t,e,n)),this},ordered:function(t,e,r,i){var n={levels:r,labels:i};return this.inputs.push(o(this.deployr.RORDERED,t,e,n)),this},numericMatrix:function(t,e){return this.inputs.push(o(this.deployr.RNUMERIC_MATRIX,t,e)),this},integerMatrix:function(t,e){return this.inputs.push(o(this.deployr.RINTEGER_MATRIX,t,e)),this},logicalMatrix:function(t,e){return this.inputs.push(o(this.deployr.RBOOLEAN_MATRIX,t,e)),this},characterMatrix:function(t,e){return this.inputs.push(o(this.deployr.RSTRING_MATRIX,t,e)),this}})},{"./lang":7,"./rinput":11,"./rtypes":13,"./selfish":14}],13:[function(t,e,r){var o=t("./selfish").Base,i=t("./lang"),n={};e.exports=o.extend({r:{PRIMITIVE:"primitive",DATAFRAME:"dataframe",LIST:"list",MATRIX:"matrix",DATE:"date",FACTOR:"factor",VECTOR:"vector"},deployr:{RBOOLEAN:"logical",RNUMERIC:"numeric",RINTEGER:"integer",RSTRING:"character",RDATE:"date",RPOSIX_DATE:"posixct",RBOOLEAN_VECTOR:"logicalVector",RNUMERIC_VECTOR:"numericVector",RINTEGER_VECTOR:"integerVector",RSTRING_VECTOR:"characterVector",RDATE_VECTOR:"dateVector",RPOSIX_DATE_VECTOR:"posixctVector",RLIST:"list",RDATAFRAME:"dataframe",RFACTOR:"factor",RORDERED:"ordered",RBOOLEAN_MATRIX:"logicalMatrix",RNUMERIC_MATRIX:"numericMatrix",RINTEGER_MATRIX:"integerMatrix",RSTRING_MATRIX:"characterMatrix"},isDate:function(t){return t===this.deployr.RDATE||t===this.deployr.RPOSIX_DATE||t===this.deployr.RDATE_VECTOR||t===this.deployr.RPOSIX_DATE_VECTOR||t===this.r.DATE},deployrToR:function(t){var e=this.deployr,r=this.r;return n[t]||(n[e.RBOOLEAN]=r.PRIMITIVE,n[e.RNUMERIC]=r.PRIMITIVE,n[e.RINTEGER]=r.PRIMITIVE,n[e.RSTRING]=r.PRIMITIVE,n[e.RDATE]=r.DATE,n[e.RPOSIX_DATE]=r.DATE,n[e.RBOOLEAN_VECTOR]=r.VECTOR,n[e.RNUMERIC_VECTOR]=r.VECTOR,n[e.RINTEGER_VECTOR]=r.VECTOR,n[e.RSTRING_VECTOR]=r.VECTOR,n[e.RDATE_VECTOR]=r.VECTOR,n[e.RPOSIX_DATE_VECTOR]=r.VECTOR,n[e.RLIST]=r.LIST,n[e.RDATAFRAME]=r.DATAFRAME,n[e.RFACTOR]=r.FACTOR,n[e.RORDERED]=r.FACTOR,n[e.RBOOLEAN_MATRIX]=r.MATRIX,n[e.RNUMERIC_MATRIX]=r.MATRIX,n[e.RINTEGER_MATRIX]=r.MATRIX,n[e.RSTRING_MATRIX]=r.MATRIX),n[t]},assert:function(t){var e,r=this.deployr,o=null,n=t.value;n=i.isArray(n)?n:[n];for(var s=0;so;o++)if(r){if(t[o][r]===e)return t[o]}else if(t[o]===e)return t[o];return null};r.merge=function(t,e){t&&"object"==typeof t||(t={}),e&&"object"==typeof e||(e={});for(var r in e)t[r]=e[r];return t},r.workspace=function(t,e){var r=i(t,"workspace");return r?e?n(r.objects,e,"name"):r.objects||r.object:null},r.signature=function(){var t,e=Array.prototype.slice.call(arguments[0],0),r=e.length,i=!1,n={};if(1===r&&o.isObject(e[0]))n=e[0],t=n.project?"/r/project/execute/script":"/r/repository/script/execute";else if(1===r&&o.isString(e[0]))e=e[0].split("/"),t="/r/repository/script/execute",n={author:e[1],directory:e[2],filename:e[3]};else if(2===r){var s=e[1];t=s?"/r/project/execute/script":"/r/repository/script/execute",e=e[0].split("/"),n={project:s,author:e[1],directory:e[2],filename:e[3]}}else r>2&&(n={author:e[2],directory:e[1],filename:e[0]});return n.project&&o.isBoolean(n.project)&&(delete n.project,i=!0),{api:t,opts:n,create:i}}},{"./lang":7}],16:[function(t,e,r){},{}],17:[function(t,e,r){function o(){if(!a){a=!0;for(var t,e=s.length;e;){t=s,s=[];for(var r=-1;++ra;a++)s(a);else i.resolve(o);return i.promise}var p,h=function(t){return"function"==typeof t},f=function(t){return Array.isArray?Array.isArray(t):t instanceof Array},d=function(t){return!(!t||!(typeof t).match(/function|object/))},y=function(t){return t===!1||t===r||null===t},m=function(t,e){return[].slice.call(t,e)},v="undefined",R=typeof TypeError===v?Error:TypeError;if(typeof t!==v&&t.nextTick)p=t.nextTick;else if(typeof MessageChannel!==v){var g=new MessageChannel,j=[];g.port1.onmessage=function(){j.length&&j.shift()()},p=function(t){j.push(t),g.port2.postMessage(0)}}else p=function(t){setTimeout(t,0)};var T=function(t){function e(){if(0!==v){var t,e=g,r=0,o=e.length,i=~v?0:1;for(g=[];o>r;r++)(t=e[r][i])&&t(f)}}function o(t){function r(t){return function(e){return i?void 0:(i=!0,t(e))}}var i=!1;if(v)return this;try{var n=d(t)&&t.then;if(h(n)){if(t===j)throw new R("Promise can't resolve itself");return n.call(t,r(o),r(l)),this}}catch(s){return r(l)(s),this}return m(function(){f=t,v=1,e()}),this}function l(t){return v||m(function(){try{throw t}catch(r){f=r}v=-1,e()}),this}var f,m=(r!==t?t:T.alwaysAsync)?p:function(t){t()},v=0,g=[],j={then:function(t,r){var o=T();return g.push([function(e){try{o.resolve(y(t)?e:h(t)?t(e):T.onlyFuncs?e:t)}catch(r){o.reject(r)}},function(t){if((y(r)||!h(r)&&T.onlyFuncs)&&o.reject(t),r)try{o.resolve(h(r)?r(t):r)}catch(e){o.reject(e)}}]),0!==v&&m(e),o.promise},success:i,error:n,otherwise:n,apply:s,spread:s,ensure:a,nodify:c,rethrow:u,isPending:function(){return!(0!==v)},getStatus:function(){return v}};return j.toSource=j.toString=j.valueOf=function(){return f===r?this:f},{promise:j,resolve:o,fulfill:o,reject:l}};T.deferred=T.defer=T,T.nextTick=p,T.alwaysAsync=!0,T.onlyFuncs=!0,T.resolved=T.fulfilled=function(t){return T(!0).resolve(t).promise},T.rejected=function(t){return T(!0).reject(t).promise},T.wait=function(t){var e=T();return setTimeout(e.resolve,t||0),e.promise},T.delay=function(t,e){var r=T();return setTimeout(function(){try{r.resolve(t.apply(null))}catch(e){r.reject(e)}},e||0),r.promise},T.promisify=function(t){return t&&h(t.then)?t:T.resolved(t)},T.all=function(){return l(arguments,!1)},T.resolveAll=function(){return l(arguments,!0)},T.nodeCapsule=function(t,e){return e||(e=t,t=void 0),function(){var r=T(),o=m(arguments);o.push(function(t,e){t?r.reject(t):r.resolve(arguments.length>2?m(arguments,1):e)});try{e.apply(t,o)}catch(i){r.reject(i)}return r.promise}},typeof window!==v&&(window.D=T),typeof e!==v&&e.exports&&(e.exports=T)}()}).call(this,t("_process"))},{_process:17}],19:[function(t,e,r){function o(){}function i(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function n(){if(v.XMLHttpRequest&&("file:"!=v.location.protocol||!v.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1}function s(t){return t===Object(t)}function a(t){if(!s(t))return t;var e=[];for(var r in t)null!=t[r]&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}function c(t){for(var e,r,o={},i=t.split("&"),n=0,s=i.length;s>n;++n)r=i[n],e=r.split("="),o[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return o}function u(t){var e,r,o,i,n=t.split(/\r?\n/),s={};n.pop();for(var a=0,c=n.length;c>a;++a)r=n[a],e=r.indexOf(":"),o=r.slice(0,e).toLowerCase(),i=R(r.slice(e+1)),s[o]=i;return s}function l(t){return t.split(/ *; */).shift()}function p(t){return m(t.split(/ *; */),function(t,e){var r=e.split(/ *= */),o=r.shift(),i=r.shift();return o&&i&&(t[o]=i),t},{})}function h(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method?this.xhr.responseText:null,this.setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text):null}function f(t,e){var r=this;y.call(this),this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new h(r)}catch(o){t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=o}r.callback(t,e)})}function d(t,e){return"function"==typeof e?new f("GET",t).end(e):1==arguments.length?new f("GET",t):new f(t,e)}var y=t("emitter"),m=t("reduce"),v="undefined"==typeof window?this:window,R="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};d.serializeObject=a,d.parseString=c,d.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},d.serialize={"application/x-www-form-urlencoded":a,"application/json":JSON.stringify},d.parse={"application/x-www-form-urlencoded":c,"application/json":JSON.parse},h.prototype.get=function(t){return this.header[t.toLowerCase()]},h.prototype.setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=l(e);var r=p(e);for(var o in r)this[o]=r[o]},h.prototype.parseBody=function(t){var e=d.parse[this.type];return e&&t&&t.length?e(t):null},h.prototype.setStatusProperties=function(t){var e=t/100|0;this.status=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t||1223==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},h.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,o="cannot "+e+" "+r+" ("+this.status+")",i=new Error(o);return i.status=this.status,i.method=e,i.url=r,i},d.Response=h,y(f.prototype),f.prototype.use=function(t){return t(this),this},f.prototype.timeout=function(t){return this._timeout=t,this},f.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},f.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},f.prototype.set=function(t,e){if(s(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},f.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},f.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},f.prototype.type=function(t){return this.set("Content-Type",d.types[t]||t),this},f.prototype.accept=function(t){return this.set("Accept",d.types[t]||t),this},f.prototype.auth=function(t,e){var r=btoa(t+":"+e);return this.set("Authorization","Basic "+r),this},f.prototype.query=function(t){return"string"!=typeof t&&(t=a(t)),t&&this._query.push(t),this},f.prototype.field=function(t,e){return this._formData||(this._formData=new FormData),this._formData.append(t,e),this},f.prototype.attach=function(t,e,r){return this._formData||(this._formData=new FormData),this._formData.append(t,e,r),this},f.prototype.send=function(t){var e=s(t),r=this.getHeader("Content-Type");if(e&&s(this._data))for(var o in t)this._data[o]=t[o];else"string"==typeof t?(r||this.type("form"),r=this.getHeader("Content-Type"),this._data="application/x-www-form-urlencoded"==r?this._data?this._data+"&"+t:t:(this._data||"")+t):this._data=t;return e?(r||this.type("json"),this):this},f.prototype.callback=function(t,e){var r=this._callback;return this.clearTimeout(),2==r.length?r(t,e):t?this.emit("error",t):void r(e)},f.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},f.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype.withCredentials=function(){return this._withCredentials=!0,this},f.prototype.end=function(t){var e=this,r=this.xhr=n(),s=this._query.join("&"),a=this._timeout,c=this._formData||this._data;if(this._callback=t||o,r.onreadystatechange=function(){return 4==r.readyState?0==r.status?e.aborted?e.timeoutError():e.crossDomainError():void e.emit("end"):void 0},r.upload&&(r.upload.onprogress=function(t){t.percent=t.loaded/t.total*100,e.emit("progress",t)}),a&&!this._timer&&(this._timer=setTimeout(function(){e.abort()},a)),s&&(s=d.serializeObject(s),this.url+=~this.url.indexOf("?")?"&"+s:"?"+s),r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof c&&!i(c)){var u=d.serialize[this.getHeader("Content-Type")];u&&(c=u(c))}for(var l in this.header)null!=this.header[l]&&r.setRequestHeader(l,this.header[l]);return this.emit("request",this),r.send(c),this},d.Request=f,d.get=function(t,e,r){var o=d("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},d.head=function(t,e,r){var o=d("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},d.del=function(t,e){var r=d("DELETE",t);return e&&r.end(e),r},d.patch=function(t,e,r){var o=d("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},d.post=function(t,e,r){var o=d("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},d.put=function(t,e,r){var o=d("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},e.exports=d},{emitter:20,reduce:21}],20:[function(t,e,r){function o(t){return t?i(t):void 0}function i(t){for(var e in o.prototype)t[e]=o.prototype[e];return t}e.exports=o,o.prototype.on=o.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},o.prototype.once=function(t,e){function r(){o.off(t,r),e.apply(this,arguments)}var o=this;return this._callbacks=this._callbacks||{},r.fn=e,this.on(t,r),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks[t];if(!r)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var o,i=0;io;++o)r[o].apply(this,e)}return this},o.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},o.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],21:[function(t,e,r){e.exports=function(t,e,r){for(var o=0,i=t.length,n=3==arguments.length?r:t[o++];i>o;)n=e.call(null,n,t[o],++o,t);return n}},{}],22:[function(t,e,r){e.exports={name:"deployr",version:"7.4.1",description:"Simplified JavaScript client library for making requests to DeployR.",keywords:["deployr","deployr.io","ajax","R","api","simple"],author:"DeployR - Revolution Analytics Inc.",contributors:["Sean Wells"],repository:{type:"git",url:"git://github.com/deployr/js-client-library.git"},homepage:"http://deployr.revolutionanalytics.com/documents/dev/client-jsdoc",scripts:{start:"gulp start",build:"gulp"},devDependencies:{browserify:"^9.0.3",gulp:"^3.8.11","gulp-connect":"^2.2.0","gulp-header":"^1.2.2","gulp-jshint":"^1.9.2","gulp-livereload":"^3.8.0","gulp-plumber":"^0.6.6","gulp-rename":"^1.2.2","gulp-uglify":"^1.2.0","gulp-util":"^3.0.4",tape:"^3.5.0","vinyl-source-stream":"^1.0.0"},dependencies:{"d.js":"^0.6.0",superagent:"^0.21.0",ws:"^0.4.32"},main:"deployr.js",engines:{node:">= 0.10.0"},license:"Apache 2.0 License",bugs:{url:"https://github.com/deployr/js-client-library/issues"},directories:{example:"examples",test:"test"}}},{}]},{},[1])(1)}); \ No newline at end of file +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.deployr=t()}}(function(){var t;return function e(t,r,o){function i(s,a){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(n)return n(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r?r:e)},l,l.exports,e,t,r,o)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s3&&(o=o.slice(1)),E["new"]("/r/repository/shell/execute",r).data({author:o[0],directory:o[1],filename:o[2],args:e})},code:function(t,e){var r={cookies:this.cookies,queue:this.q,deferred:this.deferred},o="/r/project/execute/code";return e?E["new"](o,r).data({code:t,project:e}):E["new"]("/r/project/create",r).end(function(t){return{project:t.get("project").project}}).io(o).data({code:t})},release:function(t,e){function r(t){t===c&&(e?(i.resolve(!0),o.destroy()):E["new"]("/r/user/logout").share(u).error(function(){i.reject(!1)}).end(function(){i.resolve(!0)}).ensure(function(){o.destroy()}))}t=p.isArray(t)?t:[t];var o=this,i=s(),n=!t||!t[0],a=0,c=n?a:t.length-1,u=this.getCookies();return n?r(a):t.forEach(function(t){E["new"]("/r/project/close").data({project:t}).share(u).end().ensure(function(){r(a),a++})}),i.promise},routputs:function(t){return t&&(this.outputs=this.outputs.concat(t)),this},routput:function(t){return t&&this.routputs([t]),this},rinputs:function(t){return t&&(this.inputs=this.inputs.concat(t)),this},rinput:function(t){return t&&this.inputs.push(t),this},destroy:function(){try{this.emit("destroy"),this.offAll();for(var t in this)this.hasOwnProperty(t)&&(this[t]=null,delete this[t])}catch(e){}},_clear:function(){this.params={},this.inputs=[],this.outputs=[],this.rstream=!1,this.delayed=!1,this.api=null,this.file=null,this.entities=null,this.ioFilter=null},_prepRequest:function(t,e){var r=this.req,o=this.file;if(this.api.upload?i||this.req.type("multipart/form-data"):r.type("form"),r.on("error",function(t){t=t||{code:"UNKNOWN CODE",text:"UNKNOWN ERROR"},this._handleError({status:t.code||"UNKNOWN CODE",text:t})}.bind(this)),this.share(e?e.__cookies__:null),e&&this.data(e),this.inputs.length>0&&this.data({inputs:y.encode(this.inputs)}),this.outputs.length>0&&this.data({robjects:this.outputs.join()}),this.cookies&&this.cookies.forEach(function(t){r.set("Cookie",t)}),this.api.upload){for(var n in this.params)r.field(n,this.params[n]||this.params[n]===!1?this.params[n]+"":"");r.attach("file",this.rstream?a.createReadStream(o):o)}else r["GET"===this.api.method?"query":"send"](this.params)},_handleError:function(t){var e=t.status,r=t.body&&t.body.deployr?t.body:t,i=200!==e||r.deployr&&!r.deployr.response.success;return i&&(r={get:function(t){return l.get(this.deployr.response,t)},deployr:{response:{success:!1,call:this.api.call,errorCode:r.deployr?r.deployr.response.errorCode:e,error:r.deployr?r.deployr.response.error:r.text}}},h.error("error()",this.api,r,t),this.logger.error("error()",this.api,r,t),this.globalEvts&&o(this.api.call,r),this.emit("error",r),this.emit("deployr-io:"+r.deployr.response.errorCode,r),this.deferred.reject(r)),i}});i&&(window.Revolution=window.Revolution||t("./lib/deprecated")),e.exports={DeployR:E,apis:function(t){return t?Object.keys(c):c},configure:function(t){t=t||{};for(var e in t)j.set(e,t[e]);return j.sticky||j.set("cookies",null),h.setLevel(j.logging?h.DEBUG:h.OFF),this},io:function(t){return E["new"](t)},auth:function(t,e){var r={username:t,password:e};return E["new"]("/r/user/login").data(r).end()},script:function(){var t=l.signature(arguments),e=t.opts,r=t.api;return t.create?E["new"]("/r/project/create").end(function(t){return{project:t.get("project").project}}).io(r).data(e):E["new"](r).data(e)},pipeline:function(t){function e(){i.add(function(){t.shift().drain().then(function(t){n.push(t),a.push(c),i.isEmpty()&&(r.configure(u),o.resolve({results:n,errors:a})),i.take()},function(t){n.push(c),a.push(t),i.isEmpty()&&0===n.length&&(r.configure(u),o.reject(a)),i.take()})},null,!0)}var r=this,o=s(),i=new f,n=[],a=[],c=null,u={sticky:j.sticky,cookies:j.cookies};t=t.slice(0),r.configure({sticky:!0});for(var l=0;l=0;o.lengthi?"0"+i:i,s=10>s?"0"+s:s,a=10>a?"0"+a:a,c=10>c?"0"+c:c,l=o+"-"+i+"-"+n,e===p.RPOSIX_DATE||e===p.RPOSIX_DATE_VECTOR){var h=s+":"+a+":"+c,f=-u,d="+";0>f&&(f=-f,d="-"),u=d+r(f/60,2)+""+r(f%60,2),l+=" "+h+" "+u}return l}function n(t,e){for(var r=t.value,s=0;s "+i[2].call]);for(var u=2;u=this.context.value&&o(e,{level:t,name:this.context.name,value:this.context.value})},debug:function(){this.log(s.DEBUG,arguments)},error:function(){this.log(s.ERROR,arguments)},info:function(){this.log(s.INFO,arguments)},warn:function(){this.log(s.WARN,arguments)},setLevel:function(t){t&&"value"in t&&(this.context=t)}},s.DEBUG={value:1,name:"DEBUG"},s.INFO={value:2,name:"INFO"},s.WARN={value:4,name:"WARN"},s.ERROR={value:8,name:"ERROR"},s.OFF={value:99,name:"OFF"},s.setLevel=function(t){n.setLevel(t)},s.debug=function(){n.debug.apply(n,arguments)},s.info=function(){n.info.apply(n,arguments)},s.warn=function(){n.warn.apply(n,arguments)},s.error=function(){n.error.apply(n,arguments)},s.get=function(t,e,r){return a[t]||function(){return a[t]=new i(t,e,r),a[t]}()},n=s.get("global"),e.exports=s},{}],9:[function(t,e,r){e.exports=function(e){try{return t(e)}catch(r){}}},{}],10:[function(t,e,r){function o(){this.emptyCallback=null,this.callbacks=[],this.yielded=!1,this.response=null,this.responseChain=[]}o.prototype={add:function(t,e,r){this.yielded||r?this.callbacks.push({fn:t,ctx:e}):t.apply(e||this,[this.response])},size:function(){return this.callbacks.length},isEmpty:function(){return 0===this.callbacks.length},empty:function(t,e){this.emptyCallback={fn:t,ctx:e}},"yield":function(t){this.yielded=t},take:function(t,e,r){var o;t&&(this.response=t,this.responseChain.push(t)),!this.yielded&&this.callbacks[0]&&(o=this.callbacks.shift(),o.fn.apply(o.ctx||this,[this.responseChain,e,r]),this.callbacks[0]&&this.emptyCallback&&this.emptyCallback.fn.call(this.emptyCallback.ctx||this))},flush:function(t,e,r){for(t&&(this.response=t,this.responseChain.push(t));this.callbacks[0]&&!this.yielded;){var o=this.callbacks.shift();o.fn.apply(o.ctx||this,[this.responseChain,e,r]),this.callbacks[0]&&this.emptyCallback&&this.emptyCallback.fn.call(this.emptyCallback.ctx||this)}}},e.exports=o},{}],11:[function(t,e,r){var o=t("./selfish").Base,i=t("./rtypes");e.exports=o.extend(i,{initialize:function(t,e,r){this.name=t,this.value=e,this.options=r||{}},numeric:function(){return this.assert({type:this.deployr.RNUMERIC,name:this.name,value:this.value,toString:this.toString})},integer:function(){return this.assert({type:this.deployr.RINTEGER,name:this.name,value:this.value,toString:this.toString})},logical:function(){return this.assert({type:this.deployr.RBOOLEAN,name:this.name,value:this.value,toString:this.toString})},character:function(){return this.assert({type:this.deployr.RSTRING,name:this.name,value:this.value,toString:this.toString})},date:function(){return this.assert({type:this.deployr.RDATE,name:this.name,value:this.value,format:"yyyy-MM-dd",toString:this.toString})},posixct:function(){return this.assert({type:this.deployr.RPOSIX_DATE,name:this.name,value:this.value,format:"yyyy-MM-dd HH:mm:ss Z",toString:this.toString})},numericVector:function(){return this.assert({type:this.deployr.RNUMERIC_VECTOR,name:this.name,value:this.value,toString:this.toString})},integerVector:function(){return this.assert({type:this.deployr.RINTEGER_VECTOR,name:this.name,value:this.value,toString:this.toString})},logicalVector:function(){return this.assert({type:this.deployr.RBOOLEAN_VECTOR,name:this.name,value:this.value,toString:this.toString})},characterVector:function(){return this.assert({type:this.deployr.RSTRING_VECTOR,name:this.name,value:this.value,toString:this.toString})},dateVector:function(){return this.assert({type:this.deployr.RDATE_VECTOR,name:this.name,value:this.value,format:"yyyy-MM-dd",toString:this.toString})},posixctVector:function(){return this.assert({type:this.deployr.RPOSIX_DATE_VECTOR,name:this.name,value:this.value,format:"yyyy-MM-dd HH:mm:ss Z",toString:this.toString})},list:function(){return this.assert({type:this.deployr.RLIST,name:this.name,value:this.value,toString:this.toString})},dataframe:function(){return this.assert({type:this.deployr.RDATAFRAME,name:this.name,value:this.value,toString:this.toString})},factor:function(){var t=this.options;return this.assert({type:this.deployr.RFACTOR,name:this.name,value:this.value,ordered:!1,levels:t.levels,labels:t.labels,toString:this.toString})},ordered:function(){var t=this.options;return this.assert({type:this.deployr.RORDERED,name:this.name,value:this.value,ordered:!0,levels:t.levels,labels:t.labels,toString:this.toString})},numericMatrix:function(){return this.assert({type:this.deployr.RNUMERIC_MATRIX,name:this.name,value:this.value,toString:this.toString})},integerMatrix:function(){return this.assert({type:this.deployr.RINTEGER_MATRIX,name:this.name,value:this.value,toString:this.toString})},logicalMatrix:function(){return this.assert({type:this.deployr.RBOOLEAN_MATRIX,name:this.name,value:this.value,toString:this.toString})},characterMatrix:function(){return this.assert({type:this.deployr.RSTRING_MATRIX,name:this.name,value:this.value,toString:this.toString})},toString:function(){var t=this.options||{},e=t.levels?"[ levels = "+t.levels+"]":"",r=t.labels?"[ labels = "+t.labels+"]":"";return"[ name = "+this.name+" ] [ value = "+this.value+" ] [ type = "+this.type+" ] "+e+r}})},{"./rtypes":13,"./selfish":14}],12:[function(t,e,r){function o(t,e,r,o){var i;if(s.isObject(e)){if(i=e,!i.type!==t)throw new Error('IllegalArgumentError:Expecting "'+t+'" but found "'+i.type+'"')}else i=a["new"](e,r,o)[t]();return i}var i=t("./selfish").Base,n=t("./rtypes"),s=t("./lang"),a=t("./rinput");e.exports=i.extend(n,{numeric:function(t,e){return this.inputs.push(o(this.deployr.RNUMERIC,t,e)),this},integer:function(t,e){return this.inputs.push(o(this.deployr.RINTEGER,t,e)),this},logical:function(t,e){return this.inputs.push(o(this.deployr.RBOOLEAN,t,e)),this},character:function(t,e){return this.inputs.push(o(this.deployr.RSTRING,t,e)),this},date:function(t,e){return this.inputs.push(o(this.deployr.RDATE,t,e)),this},posixct:function(t,e){return this.inputs.push(o(this.deployr.RPOSIX_DATE,t,e)),this},numericVector:function(t,e){return this.inputs.push(o(this.deployr.RNUMERIC_VECTOR,t,e)),this},integerVector:function(t,e){return this.inputs.push(o(this.deployr.RINTEGER_VECTOR,t,e)),this},logicalVector:function(t,e){return this.inputs.push(o(this.deployr.RBOOLEAN_VECTOR,t,e)),this},characterVector:function(t,e){return this.inputs.push(o(this.deployr.RSTRING_VECTOR,t,e)),this},dateVector:function(t,e){return this.inputs.push(o(this.deployr.RDATE_VECTOR,t,e)),this},posixctVector:function(t,e){return this.inputs.push(o(this.deployr.RPOSIX_DATE_VECTOR,t,e)),this},list:function(t,e){return this.inputs.push(o(this.deployr.RLIST,t,e)),this},dataframe:function(t,e){return this.inputs.push(o(this.deployr.RDATAFRAME,t,e)),this},factor:function(t,e,r,i){var n={levels:r,labels:i};return this.inputs.push(o(this.deployr.RFACTOR,t,e,n)),this},ordered:function(t,e,r,i){var n={levels:r,labels:i};return this.inputs.push(o(this.deployr.RORDERED,t,e,n)),this},numericMatrix:function(t,e){return this.inputs.push(o(this.deployr.RNUMERIC_MATRIX,t,e)),this},integerMatrix:function(t,e){return this.inputs.push(o(this.deployr.RINTEGER_MATRIX,t,e)),this},logicalMatrix:function(t,e){return this.inputs.push(o(this.deployr.RBOOLEAN_MATRIX,t,e)),this},characterMatrix:function(t,e){return this.inputs.push(o(this.deployr.RSTRING_MATRIX,t,e)),this}})},{"./lang":7,"./rinput":11,"./rtypes":13,"./selfish":14}],13:[function(t,e,r){var o=t("./selfish").Base,i=t("./lang"),n={};e.exports=o.extend({r:{PRIMITIVE:"primitive",DATAFRAME:"dataframe",LIST:"list",MATRIX:"matrix",DATE:"date",FACTOR:"factor",VECTOR:"vector"},deployr:{RBOOLEAN:"logical",RNUMERIC:"numeric",RINTEGER:"integer",RSTRING:"character",RDATE:"date",RPOSIX_DATE:"posixct",RBOOLEAN_VECTOR:"logicalVector",RNUMERIC_VECTOR:"numericVector",RINTEGER_VECTOR:"integerVector",RSTRING_VECTOR:"characterVector",RDATE_VECTOR:"dateVector",RPOSIX_DATE_VECTOR:"posixctVector",RLIST:"list",RDATAFRAME:"dataframe",RFACTOR:"factor",RORDERED:"ordered",RBOOLEAN_MATRIX:"logicalMatrix",RNUMERIC_MATRIX:"numericMatrix",RINTEGER_MATRIX:"integerMatrix",RSTRING_MATRIX:"characterMatrix"},isDate:function(t){return t===this.deployr.RDATE||t===this.deployr.RPOSIX_DATE||t===this.deployr.RDATE_VECTOR||t===this.deployr.RPOSIX_DATE_VECTOR||t===this.r.DATE},deployrToR:function(t){var e=this.deployr,r=this.r;return n[t]||(n[e.RBOOLEAN]=r.PRIMITIVE,n[e.RNUMERIC]=r.PRIMITIVE,n[e.RINTEGER]=r.PRIMITIVE,n[e.RSTRING]=r.PRIMITIVE,n[e.RDATE]=r.DATE,n[e.RPOSIX_DATE]=r.DATE,n[e.RBOOLEAN_VECTOR]=r.VECTOR,n[e.RNUMERIC_VECTOR]=r.VECTOR,n[e.RINTEGER_VECTOR]=r.VECTOR,n[e.RSTRING_VECTOR]=r.VECTOR,n[e.RDATE_VECTOR]=r.VECTOR,n[e.RPOSIX_DATE_VECTOR]=r.VECTOR,n[e.RLIST]=r.LIST,n[e.RDATAFRAME]=r.DATAFRAME,n[e.RFACTOR]=r.FACTOR,n[e.RORDERED]=r.FACTOR,n[e.RBOOLEAN_MATRIX]=r.MATRIX,n[e.RNUMERIC_MATRIX]=r.MATRIX,n[e.RINTEGER_MATRIX]=r.MATRIX,n[e.RSTRING_MATRIX]=r.MATRIX),n[t]},assert:function(t){var e,r=this.deployr,o=null,n=t.value;n=i.isArray(n)?n:[n];for(var s=0;so;o++)if(r){if(t[o][r]===e)return t[o]}else if(t[o]===e)return t[o];return null};r.merge=function(t,e){t&&"object"==typeof t||(t={}),e&&"object"==typeof e||(e={});for(var r in e)t[r]=e[r];return t},r.workspace=function(t,e){var r=i(t,"workspace");return r?e?n(r.objects,e,"name"):r.objects||r.object:null},r.signature=function(){var t,e=Array.prototype.slice.call(arguments[0],0),r=e.length,i=!1,n={};if(1===r&&o.isObject(e[0]))n=e[0],t=n.project?"/r/project/execute/script":"/r/repository/script/execute";else if(1===r&&o.isString(e[0]))e=e[0].split("/"),t="/r/repository/script/execute",n={author:e[1],directory:e[2],filename:e[3]};else if(2===r){var s=e[1];t=s?"/r/project/execute/script":"/r/repository/script/execute",e=e[0].split("/"),n={project:s,author:e[1],directory:e[2],filename:e[3]}}else r>2&&(n={author:e[2],directory:e[1],filename:e[0]});return n.project&&o.isBoolean(n.project)&&(delete n.project,i=!0),{api:t,opts:n,create:i}}},{"./lang":7}],16:[function(t,e,r){},{}],17:[function(t,e,r){function o(){if(!a){a=!0;for(var t,e=s.length;e;){t=s,s=[];for(var r=-1;++ra;a++)s(a);else i.resolve(o);return i.promise}var p,h=function(t){return"function"==typeof t},f=function(t){return Array.isArray?Array.isArray(t):t instanceof Array},d=function(t){return!(!t||!(typeof t).match(/function|object/))},y=function(t){return t===!1||t===r||null===t},m=function(t,e){return[].slice.call(t,e)},v="undefined",R=typeof TypeError===v?Error:TypeError;if(typeof t!==v&&t.nextTick)p=t.nextTick;else if(typeof MessageChannel!==v){var g=new MessageChannel,j=[];g.port1.onmessage=function(){j.length&&j.shift()()},p=function(t){j.push(t),g.port2.postMessage(0)}}else p=function(t){setTimeout(t,0)};var T=function(t){function e(){if(0!==v){var t,e=g,r=0,o=e.length,i=~v?0:1;for(g=[];o>r;r++)(t=e[r][i])&&t(f)}}function o(t){function r(t){return function(e){return i?void 0:(i=!0,t(e))}}var i=!1;if(v)return this;try{var n=d(t)&&t.then;if(h(n)){if(t===j)throw new R("Promise can't resolve itself");return n.call(t,r(o),r(l)),this}}catch(s){return r(l)(s),this}return m(function(){f=t,v=1,e()}),this}function l(t){return v||m(function(){try{throw t}catch(r){f=r}v=-1,e()}),this}var f,m=(r!==t?t:T.alwaysAsync)?p:function(t){t()},v=0,g=[],j={then:function(t,r){var o=T();return g.push([function(e){try{o.resolve(y(t)?e:h(t)?t(e):T.onlyFuncs?e:t)}catch(r){o.reject(r)}},function(t){if((y(r)||!h(r)&&T.onlyFuncs)&&o.reject(t),r)try{o.resolve(h(r)?r(t):r)}catch(e){o.reject(e)}}]),0!==v&&m(e),o.promise},success:i,error:n,otherwise:n,apply:s,spread:s,ensure:a,nodify:c,rethrow:u,isPending:function(){return!(0!==v)},getStatus:function(){return v}};return j.toSource=j.toString=j.valueOf=function(){return f===r?this:f},{promise:j,resolve:o,fulfill:o,reject:l}};T.deferred=T.defer=T,T.nextTick=p,T.alwaysAsync=!0,T.onlyFuncs=!0,T.resolved=T.fulfilled=function(t){return T(!0).resolve(t).promise},T.rejected=function(t){return T(!0).reject(t).promise},T.wait=function(t){var e=T();return setTimeout(e.resolve,t||0),e.promise},T.delay=function(t,e){var r=T();return setTimeout(function(){try{r.resolve(t.apply(null))}catch(e){r.reject(e)}},e||0),r.promise},T.promisify=function(t){return t&&h(t.then)?t:T.resolved(t)},T.all=function(){return l(arguments,!1)},T.resolveAll=function(){return l(arguments,!0)},T.nodeCapsule=function(t,e){return e||(e=t,t=void 0),function(){var r=T(),o=m(arguments);o.push(function(t,e){t?r.reject(t):r.resolve(arguments.length>2?m(arguments,1):e)});try{e.apply(t,o)}catch(i){r.reject(i)}return r.promise}},typeof window!==v&&(window.D=T),typeof e!==v&&e.exports&&(e.exports=T)}()}).call(this,t("_process"))},{_process:17}],19:[function(t,e,r){function o(){}function i(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function n(){if(v.XMLHttpRequest&&("file:"!=v.location.protocol||!v.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1}function s(t){return t===Object(t)}function a(t){if(!s(t))return t;var e=[];for(var r in t)null!=t[r]&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}function c(t){for(var e,r,o={},i=t.split("&"),n=0,s=i.length;s>n;++n)r=i[n],e=r.split("="),o[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return o}function u(t){var e,r,o,i,n=t.split(/\r?\n/),s={};n.pop();for(var a=0,c=n.length;c>a;++a)r=n[a],e=r.indexOf(":"),o=r.slice(0,e).toLowerCase(),i=R(r.slice(e+1)),s[o]=i;return s}function l(t){return t.split(/ *; */).shift()}function p(t){return m(t.split(/ *; */),function(t,e){var r=e.split(/ *= */),o=r.shift(),i=r.shift();return o&&i&&(t[o]=i),t},{})}function h(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method?this.xhr.responseText:null,this.setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text):null}function f(t,e){var r=this;y.call(this),this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new h(r)}catch(o){t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=o}r.callback(t,e)})}function d(t,e){return"function"==typeof e?new f("GET",t).end(e):1==arguments.length?new f("GET",t):new f(t,e)}var y=t("emitter"),m=t("reduce"),v="undefined"==typeof window?this:window,R="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};d.serializeObject=a,d.parseString=c,d.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},d.serialize={"application/x-www-form-urlencoded":a,"application/json":JSON.stringify},d.parse={"application/x-www-form-urlencoded":c,"application/json":JSON.parse},h.prototype.get=function(t){return this.header[t.toLowerCase()]},h.prototype.setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=l(e);var r=p(e);for(var o in r)this[o]=r[o]},h.prototype.parseBody=function(t){var e=d.parse[this.type];return e&&t&&t.length?e(t):null},h.prototype.setStatusProperties=function(t){var e=t/100|0;this.status=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t||1223==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},h.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,o="cannot "+e+" "+r+" ("+this.status+")",i=new Error(o);return i.status=this.status,i.method=e,i.url=r,i},d.Response=h,y(f.prototype),f.prototype.use=function(t){return t(this),this},f.prototype.timeout=function(t){return this._timeout=t,this},f.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},f.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},f.prototype.set=function(t,e){if(s(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},f.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},f.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},f.prototype.type=function(t){return this.set("Content-Type",d.types[t]||t),this},f.prototype.accept=function(t){return this.set("Accept",d.types[t]||t),this},f.prototype.auth=function(t,e){var r=btoa(t+":"+e);return this.set("Authorization","Basic "+r),this},f.prototype.query=function(t){return"string"!=typeof t&&(t=a(t)),t&&this._query.push(t),this},f.prototype.field=function(t,e){return this._formData||(this._formData=new FormData),this._formData.append(t,e),this},f.prototype.attach=function(t,e,r){return this._formData||(this._formData=new FormData),this._formData.append(t,e,r),this},f.prototype.send=function(t){var e=s(t),r=this.getHeader("Content-Type");if(e&&s(this._data))for(var o in t)this._data[o]=t[o];else"string"==typeof t?(r||this.type("form"),r=this.getHeader("Content-Type"),this._data="application/x-www-form-urlencoded"==r?this._data?this._data+"&"+t:t:(this._data||"")+t):this._data=t;return e?(r||this.type("json"),this):this},f.prototype.callback=function(t,e){var r=this._callback;return this.clearTimeout(),2==r.length?r(t,e):t?this.emit("error",t):void r(e)},f.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},f.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype.withCredentials=function(){return this._withCredentials=!0,this},f.prototype.end=function(t){var e=this,r=this.xhr=n(),s=this._query.join("&"),a=this._timeout,c=this._formData||this._data;if(this._callback=t||o,r.onreadystatechange=function(){return 4==r.readyState?0==r.status?e.aborted?e.timeoutError():e.crossDomainError():void e.emit("end"):void 0},r.upload&&(r.upload.onprogress=function(t){t.percent=t.loaded/t.total*100,e.emit("progress",t)}),a&&!this._timer&&(this._timer=setTimeout(function(){e.abort()},a)),s&&(s=d.serializeObject(s),this.url+=~this.url.indexOf("?")?"&"+s:"?"+s),r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof c&&!i(c)){var u=d.serialize[this.getHeader("Content-Type")];u&&(c=u(c))}for(var l in this.header)null!=this.header[l]&&r.setRequestHeader(l,this.header[l]);return this.emit("request",this),r.send(c),this},d.Request=f,d.get=function(t,e,r){var o=d("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},d.head=function(t,e,r){var o=d("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},d.del=function(t,e){var r=d("DELETE",t);return e&&r.end(e),r},d.patch=function(t,e,r){var o=d("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},d.post=function(t,e,r){var o=d("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},d.put=function(t,e,r){var o=d("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},e.exports=d},{emitter:20,reduce:21}],20:[function(t,e,r){function o(t){return t?i(t):void 0}function i(t){for(var e in o.prototype)t[e]=o.prototype[e];return t}e.exports=o,o.prototype.on=o.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},o.prototype.once=function(t,e){function r(){o.off(t,r),e.apply(this,arguments)}var o=this;return this._callbacks=this._callbacks||{},r.fn=e,this.on(t,r),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks[t];if(!r)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var o,i=0;io;++o)r[o].apply(this,e)}return this},o.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},o.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],21:[function(t,e,r){e.exports=function(t,e,r){for(var o=0,i=t.length,n=3==arguments.length?r:t[o++];i>o;)n=e.call(null,n,t[o],++o,t);return n}},{}],22:[function(t,e,r){e.exports={name:"deployr",version:"7.4.1",description:"Simplified JavaScript client library for making requests to DeployR.",keywords:["deployr","deployr.io","ajax","R","api","simple"],author:"DeployR - Revolution Analytics Inc.",contributors:["Sean Wells"],repository:{type:"git",url:"git://github.com/deployr/js-client-library.git"},homepage:"http://deployr.revolutionanalytics.com/documents/dev/client-jsdoc",scripts:{start:"gulp start",build:"gulp"},devDependencies:{browserify:"^9.0.3",gulp:"^3.8.11","gulp-connect":"^2.2.0","gulp-header":"^1.2.2","gulp-jshint":"^1.9.2","gulp-livereload":"^3.8.0","gulp-plumber":"^0.6.6","gulp-rename":"^1.2.2","gulp-uglify":"^1.2.0","gulp-util":"^3.0.4",tape:"^3.5.0","vinyl-source-stream":"^1.0.0"},dependencies:{"d.js":"^0.6.0",superagent:"^0.21.0",ws:"^0.4.32"},main:"deployr.js",engines:{node:">= 0.10.0"},license:"Apache 2.0 License",bugs:{url:"https://github.com/deployr/js-client-library/issues"},directories:{example:"examples",test:"test"}}},{}]},{},[1])(1)}); \ No newline at end of file diff --git a/deployr.js b/deployr.js index 126ae93..7f9ba93 100644 --- a/deployr.js +++ b/deployr.js @@ -986,7 +986,8 @@ var DeployR = Base.extend(Emitter, RInputs, { if (this.api.upload) { for(var p in this.params) { - req.field(p, this.params[p] ? this.params[p] + '' : ''); + req.field(p, (this.params[p] || this.params[p] === false) ? + this.params[p] + '' : ''); } req.attach('file', this.rstream ? fs.createReadStream(file) : file); } else {