joyent-portal/legacy/spikes/compose-demo/vendor/docker-compose-client/dist/index.es.js

581 lines
16 KiB
JavaScript
Raw Normal View History

2017-05-11 18:30:03 +03:00
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var newArrowCheck = function (innerThis, boundThis) {
if (innerThis !== boundThis) {
throw new TypeError("Cannot instantiate an arrow function");
}
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var cov_es50xc93t = function () {
var path = '/Users/ramitos/dev/yld/joyent-portal/spikes/compose-demo/vendor/docker-compose-client/src/index.js',
hash = 'f84fef795787745e6663470c5523a8005895771a',
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/ramitos/dev/yld/joyent-portal/spikes/compose-demo/vendor/docker-compose-client/src/index.js',
statementMap: {
'0': {
start: {
line: 1,
column: 19
},
end: {
line: 1,
column: 37
}
},
'1': {
start: {
line: 2,
column: 25
},
end: {
line: 2,
column: 42
}
},
'2': {
start: {
line: 3,
column: 17
},
end: {
line: 3,
column: 40
}
},
'3': {
start: {
line: 7,
column: 4
},
end: {
line: 7,
column: 12
}
},
'4': {
start: {
line: 9,
column: 4
},
end: {
line: 12,
column: 7
}
},
'5': {
start: {
line: 14,
column: 4
},
end: {
line: 14,
column: 34
}
},
'6': {
start: {
line: 15,
column: 4
},
end: {
line: 15,
column: 60
}
},
'7': {
start: {
line: 15,
column: 35
},
end: {
line: 15,
column: 58
}
},
'8': {
start: {
line: 17,
column: 4
},
end: {
line: 17,
column: 53
}
},
'9': {
start: {
line: 22,
column: 4
},
end: {
line: 22,
column: 45
}
},
'10': {
start: {
line: 26,
column: 4
},
end: {
line: 26,
column: 31
}
},
'11': {
start: {
line: 31,
column: 4
},
end: {
line: 31,
column: 71
}
},
'12': {
start: {
line: 35,
column: 4
},
end: {
line: 46,
column: 6
}
},
'13': {
start: {
line: 40,
column: 53
},
end: {
line: 43,
column: 9
}
},
'14': {
start: {
line: 50,
column: 0
},
end: {
line: 50,
column: 37
}
}
},
fnMap: {
'0': {
name: '(anonymous_0)',
decl: {
start: {
line: 6,
column: 2
},
end: {
line: 6,
column: 3
}
},
loc: {
start: {
line: 6,
column: 47
},
end: {
line: 18,
column: 3
}
},
line: 6
},
'1': {
name: '(anonymous_1)',
decl: {
start: {
line: 15,
column: 28
},
end: {
line: 15,
column: 29
}
},
loc: {
start: {
line: 15,
column: 35
},
end: {
line: 15,
column: 58
}
},
line: 15
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 21,
column: 2
},
end: {
line: 21,
column: 3
}
},
loc: {
start: {
line: 21,
column: 25
},
end: {
line: 23,
column: 3
}
},
line: 21
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 25,
column: 2
},
end: {
line: 25,
column: 3
}
},
loc: {
start: {
line: 25,
column: 10
},
end: {
line: 27,
column: 3
}
},
line: 25
},
'4': {
name: '(anonymous_4)',
decl: {
start: {
line: 29,
column: 2
},
end: {
line: 29,
column: 3
}
},
loc: {
start: {
line: 29,
column: 39
},
end: {
line: 32,
column: 3
}
},
line: 29
},
'5': {
name: '(anonymous_5)',
decl: {
start: {
line: 34,
column: 2
},
end: {
line: 34,
column: 3
}
},
loc: {
start: {
line: 34,
column: 45
},
end: {
line: 47,
column: 3
}
},
line: 34
},
'6': {
name: '(anonymous_6)',
decl: {
start: {
line: 40,
column: 44
},
end: {
line: 40,
column: 45
}
},
loc: {
start: {
line: 40,
column: 53
},
end: {
line: 43,
column: 9
}
},
line: 40
}
},
branchMap: {
'0': {
loc: {
start: {
line: 6,
column: 14
},
end: {
line: 6,
column: 45
}
},
type: 'default-arg',
locations: [{
start: {
line: 6,
column: 25
},
end: {
line: 6,
column: 45
}
}],
line: 6
}
},
s: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0,
'7': 0,
'8': 0,
'9': 0,
'10': 0,
'11': 0,
'12': 0,
'13': 0,
'14': 0
},
f: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0
},
b: {
'0': [0]
},
_coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'
},
coverage = global[gcv] || (global[gcv] = {});
if (coverage[path] && coverage[path].hash === hash) {
return coverage[path];
}
coverageData.hash = hash;
return coverage[path] = coverageData;
}();
var _ref = (++cov_es50xc93t.s[0], require('zerorpc'));
var Client = _ref.Client;
var _ref2 = (++cov_es50xc93t.s[1], require('events'));
var EventEmitter = _ref2.EventEmitter;
var awaitify = (++cov_es50xc93t.s[2], require('apr-awaitify'));
var DockerComposeClient = function (_EventEmitter) {
inherits(DockerComposeClient, _EventEmitter);
function DockerComposeClient() {
var _this2 = this;
var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (++cov_es50xc93t.b[0][0], 'tcp://0.0.0.0:4242');
classCallCheck(this, DockerComposeClient);
++cov_es50xc93t.f[0];
++cov_es50xc93t.s[3];
var _this = possibleConstructorReturn(this, (DockerComposeClient.__proto__ || Object.getPrototypeOf(DockerComposeClient)).call(this));
++cov_es50xc93t.s[4];
_this.client = new Client({
heartbeatInterval: 60 * 60 * 2,
timeout: 60 * 60 * 2
});
++cov_es50xc93t.s[5];
_this.client.connect(endpoint);
++cov_es50xc93t.s[6];
_this.client.on('error', function (err) {
newArrowCheck(this, _this2);
++cov_es50xc93t.f[1];
++cov_es50xc93t.s[7];
return _this.emit('error', err);
}.bind(this));
++cov_es50xc93t.s[8];
_this._invoke = awaitify(_this._invoke.bind(_this));
return _this;
}
// Why isn't client.connect async with error??
createClass(DockerComposeClient, [{
key: '_invoke',
value: function _invoke(name) {
var _client;
++cov_es50xc93t.f[2];
++cov_es50xc93t.s[9];
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return (_client = this.client).invoke.apply(_client, [name].concat(args));
}
}, {
key: 'close',
value: function close() {
++cov_es50xc93t.f[3];
++cov_es50xc93t.s[10];
return this.client.close();
}
}, {
key: 'provision',
value: function provision(_ref3) {
var projectName = _ref3.projectName,
manifest = _ref3.manifest;
++cov_es50xc93t.f[4];
++cov_es50xc93t.s[11];
// eslint-disable-next-line camelcase
return this._invoke('up', { project_name: projectName }, manifest);
}
}, {
key: 'scale',
value: function scale(_ref4) {
var _this3 = this;
var projectName = _ref4.projectName,
services = _ref4.services,
manifest = _ref4.manifest;
++cov_es50xc93t.f[5];
++cov_es50xc93t.s[12];
return this._invoke('scale', {
// eslint-disable-next-line camelcase
project_name: projectName,
services: Object.keys(services).map(function (name) {
newArrowCheck(this, _this3);
++cov_es50xc93t.f[6];
++cov_es50xc93t.s[13];
return {
name: name,
num: services[name]
};
}.bind(this))
}, manifest);
}
}]);
return DockerComposeClient;
}(EventEmitter);
++cov_es50xc93t.s[14];
module.exports = DockerComposeClient;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZXMuanMiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5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