1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-01 07:30:07 +02:00
copilot/spikes/docker-compose-client/dist/index.umd.js
2017-05-11 16:39:55 +01:00

585 lines
16 KiB
JavaScript

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
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_1eyosjm197 = function () {
var path = '/Users/ramitos/dev/yld/joyent-portal/spikes/docker-compose-client/src/index.js',
hash = '384e02ed4692c70a8c8d9e69b30064cdb319bdf4',
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/ramitos/dev/yld/joyent-portal/spikes/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: 9,
column: 31
}
},
'5': {
start: {
line: 10,
column: 4
},
end: {
line: 10,
column: 34
}
},
'6': {
start: {
line: 11,
column: 4
},
end: {
line: 11,
column: 60
}
},
'7': {
start: {
line: 11,
column: 35
},
end: {
line: 11,
column: 58
}
},
'8': {
start: {
line: 13,
column: 4
},
end: {
line: 13,
column: 53
}
},
'9': {
start: {
line: 18,
column: 4
},
end: {
line: 18,
column: 45
}
},
'10': {
start: {
line: 22,
column: 4
},
end: {
line: 22,
column: 31
}
},
'11': {
start: {
line: 27,
column: 4
},
end: {
line: 27,
column: 71
}
},
'12': {
start: {
line: 31,
column: 4
},
end: {
line: 42,
column: 6
}
},
'13': {
start: {
line: 36,
column: 53
},
end: {
line: 39,
column: 9
}
},
'14': {
start: {
line: 46,
column: 0
},
end: {
line: 46,
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: 14,
column: 3
}
},
line: 6
},
'1': {
name: '(anonymous_1)',
decl: {
start: {
line: 11,
column: 28
},
end: {
line: 11,
column: 29
}
},
loc: {
start: {
line: 11,
column: 35
},
end: {
line: 11,
column: 58
}
},
line: 11
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 17,
column: 2
},
end: {
line: 17,
column: 3
}
},
loc: {
start: {
line: 17,
column: 25
},
end: {
line: 19,
column: 3
}
},
line: 17
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 21,
column: 2
},
end: {
line: 21,
column: 3
}
},
loc: {
start: {
line: 21,
column: 10
},
end: {
line: 23,
column: 3
}
},
line: 21
},
'4': {
name: '(anonymous_4)',
decl: {
start: {
line: 25,
column: 2
},
end: {
line: 25,
column: 3
}
},
loc: {
start: {
line: 25,
column: 39
},
end: {
line: 28,
column: 3
}
},
line: 25
},
'5': {
name: '(anonymous_5)',
decl: {
start: {
line: 30,
column: 2
},
end: {
line: 30,
column: 3
}
},
loc: {
start: {
line: 30,
column: 45
},
end: {
line: 43,
column: 3
}
},
line: 30
},
'6': {
name: '(anonymous_6)',
decl: {
start: {
line: 36,
column: 44
},
end: {
line: 36,
column: 45
}
},
loc: {
start: {
line: 36,
column: 53
},
end: {
line: 39,
column: 9
}
},
line: 36
}
},
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_1eyosjm197.s[0], require('zerorpc'));
var Client = _ref.Client;
var _ref2 = (++cov_1eyosjm197.s[1], require('events'));
var EventEmitter = _ref2.EventEmitter;
var awaitify = (++cov_1eyosjm197.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_1eyosjm197.b[0][0], 'tcp://0.0.0.0:4242');
classCallCheck(this, DockerComposeClient);
++cov_1eyosjm197.f[0];
++cov_1eyosjm197.s[3];
var _this = possibleConstructorReturn(this, (DockerComposeClient.__proto__ || Object.getPrototypeOf(DockerComposeClient)).call(this));
++cov_1eyosjm197.s[4];
_this.client = new Client();
++cov_1eyosjm197.s[5];
_this.client.connect(endpoint);
++cov_1eyosjm197.s[6];
_this.client.on('error', function (err) {
newArrowCheck(this, _this2);
++cov_1eyosjm197.f[1];
++cov_1eyosjm197.s[7];
return _this.emit('error', err);
}.bind(this));
++cov_1eyosjm197.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_1eyosjm197.f[2];
++cov_1eyosjm197.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_1eyosjm197.f[3];
++cov_1eyosjm197.s[10];
return this.client.close();
}
}, {
key: 'provision',
value: function provision(_ref3) {
var projectName = _ref3.projectName,
manifest = _ref3.manifest;
++cov_1eyosjm197.f[4];
++cov_1eyosjm197.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_1eyosjm197.f[5];
++cov_1eyosjm197.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_1eyosjm197.f[6];
++cov_1eyosjm197.s[13];
return {
name: name,
num: services[name]
};
}.bind(this))
}, manifest);
}
}]);
return DockerComposeClient;
}(EventEmitter);
++cov_1eyosjm197.s[14];
module.exports = DockerComposeClient;
})));
//# sourceMappingURL=data:application/json;charset=utf-8;base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