@reactivehub/cli
Version:
91 lines (77 loc) • 2.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _api = require('../services/api');
var api = _interopRequireWildcard(_api);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const typeAlias = {
GCP: 'GOOGLE_CLOUD_PLATFORM',
POSTGRES: 'POSTGRESQL'
};
const servicesMock = [{
id: 'service-account-id-1',
name: 'Service Account 1',
type: 'AWS'
}, {
id: 'service-account-id-2',
name: 'Service Account 2',
type: 'GOOGLE_CLOUD_PLATFORM'
}, {
id: 'service-account-id-2',
name: 'Service Account 2',
type: 'HTTP'
}, {
id: 'service-account-id-3',
name: 'Service Account 3',
type: 'MAILCHIMP'
}, {
id: 'mysql-service-account',
name: 'My MySQL Service',
type: 'MYSQL'
}, {
id: 'PSQL-service-account',
name: 'PSQL Service',
type: 'POSTGRESQL'
}, {
id: 'REDIS-service-account',
name: 'REDIS Service',
type: 'REDIS'
}, {
id: 'SLACK-service-account',
name: 'SLACK Service',
type: 'SLACK'
}];
const getServiceAccounts = (() => {
var _ref = (0, _asyncToGenerator3.default)(function* ({ type: typeParam }) {
const type = typeAlias[typeParam] || typeParam;
const services = yield api.getServiceAccounts(type);
if (type) return services.filter(function (service) {
return service.type === type;
});
return services;
});
return function getServiceAccounts(_x) {
return _ref.apply(this, arguments);
};
})();
const isServiceAccountOfType = (() => {
var _ref2 = (0, _asyncToGenerator3.default)(function* ({ type: typeParam, id }) {
const type = typeAlias[typeParam] || typeParam;
const services = yield api.getServiceAccounts(type);
return services.filter(function (service) {
return service.id === id && service.type === type;
}).length > 0;
});
return function isServiceAccountOfType(_x2) {
return _ref2.apply(this, arguments);
};
})();
exports.default = {
getServiceAccounts,
isServiceAccountOfType
};
//# sourceMappingURL=index.js.map