Comparing version 0.5.1 to 0.5.2
@@ -83,3 +83,2 @@ 'use strict'; | ||
createJob: null, | ||
updateJobConfig: null, | ||
updateJobEnable: null, | ||
@@ -86,0 +85,0 @@ updateJobDisable: null, |
@@ -116,3 +116,6 @@ 'use strict'; | ||
}), _defineProperty(_successGenList, _constant.hasoopMethodTypes.createLink, function (responseJson, linkName) { | ||
return _lodash2.default.isEqual(responseJson, { name: linkName, 'validation-result': [{}] }); | ||
return _lodash2.default.isEqual(responseJson, { | ||
name: linkName, | ||
'validation-result': [{}] | ||
}); | ||
}), _defineProperty(_successGenList, _constant.hasoopMethodTypes.updateLinkConfig, function (responseJson) { | ||
@@ -128,5 +131,6 @@ return _lodash2.default.isEqual(responseJson, { 'validation-result': [{}] }); | ||
}), _defineProperty(_successGenList, _constant.hasoopMethodTypes.createJob, function (responseJson, jobName) { | ||
return _lodash2.default.isEqual(responseJson, { name: jobName, 'validation-result': [{}, {}, {}] }); | ||
}), _defineProperty(_successGenList, _constant.hasoopMethodTypes.updateJobConfig, function (responseJson) { | ||
return _lodash2.default.isEqual(responseJson, { 'validation-result': [{}, {}, {}] }); | ||
return _lodash2.default.isEqual(responseJson, { | ||
name: jobName, | ||
'validation-result': [{}, {}, {}] | ||
}); | ||
}), _defineProperty(_successGenList, _constant.hasoopMethodTypes.updateJobEnable, returnEmptyObject), _defineProperty(_successGenList, _constant.hasoopMethodTypes.updateJobDisable, returnEmptyObject), _defineProperty(_successGenList, _constant.hasoopMethodTypes.deleteJob, returnEmptyObject), _defineProperty(_successGenList, _constant.hasoopMethodTypes.deleteJobAll, returnEmptyObject), _defineProperty(_successGenList, _constant.hasoopMethodTypes.startJob, function (responseJson, jobName) { | ||
@@ -177,3 +181,3 @@ var submissionConfig = (0, _utils.splitSubmissionConfig)(responseJson); | ||
return success ? responseJson.name : responseJson; | ||
}), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.updateJobConfig, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.updateJobEnable, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.updateJobDisable, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.deleteJob, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.deleteJobAll, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.startJob, function (success, responseJson) { | ||
}), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.updateJobEnable, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.updateJobDisable, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.deleteJob, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.deleteJobAll, defaultEmptyData), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.startJob, function (success, responseJson) { | ||
return success ? (0, _utils.splitSubmissionConfig)(responseJson) : responseJson; | ||
@@ -180,0 +184,0 @@ }), _defineProperty(_dataGenList, _constant.hasoopMethodTypes.stopJob, function (success, responseJson) { |
@@ -55,6 +55,2 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _path = require('path'); | ||
@@ -94,9 +90,14 @@ | ||
var Hasoop = function () { | ||
function Hasoop(config) { | ||
function Hasoop(_ref) { | ||
var userName = _ref.userName, | ||
host = _ref.host, | ||
port = _ref.port, | ||
webapp = _ref.webapp; | ||
_classCallCheck(this, Hasoop); | ||
this.userName = config.userName; | ||
this.host = config.host; | ||
this.port = config.port; | ||
this.weapp = config.webapp; | ||
this.userName = userName; | ||
this.host = host; | ||
this.port = port; | ||
this.weapp = webapp; | ||
} | ||
@@ -106,7 +107,5 @@ | ||
* use some param to create a sqoop rest api url. | ||
* @param {Array} pathAndQuery - path and query | ||
* @param {string} pathAndQuery[0] - basicPath | ||
* @param {Object} pathAndQuery[1] - queryObject | ||
* @param {string} basicPath - basicPath | ||
* @param {Object} queryObject - queryObject | ||
* @param {Array<string>} otherPath - other paths | ||
* @returns {urlObject} - formatted url object | ||
*/ | ||
@@ -117,9 +116,9 @@ | ||
key: 'formatUrl', | ||
value: function formatUrl(_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
basicPath = _ref2[0], | ||
_ref2$ = _ref2[1], | ||
queryObject = _ref2$ === undefined ? {} : _ref2$; | ||
value: function formatUrl(_ref2) { | ||
var _ref3 = _slicedToArray(_ref2, 2), | ||
basicPath = _ref3[0], | ||
_ref3$ = _ref3[1], | ||
queryObject = _ref3$ === undefined ? {} : _ref3$; | ||
_lodash2.default.set(queryObject, ['user.name'], this.userName); | ||
queryObject['user.name'] = this.userName; | ||
var urlQuery = _querystring2.default.stringify(queryObject); | ||
@@ -142,11 +141,14 @@ | ||
} | ||
/** | ||
* get sqoop server version. | ||
* | ||
* @returns {*} | ||
*/ | ||
}, { | ||
key: 'launchRequest', | ||
key: 'getVersion', | ||
value: function () { | ||
var _ref3 = _asyncToGenerator(_regenerator2.default.mark(function _callee(methodName) { | ||
for (var _len2 = arguments.length, params = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
params[_key2 - 1] = arguments[_key2]; | ||
} | ||
var res, errorMessage; | ||
var _ref4 = _asyncToGenerator(_regenerator2.default.mark(function _callee() { | ||
var url; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
@@ -156,32 +158,8 @@ while (1) { | ||
case 0: | ||
if (Object.keys(_constant.hasoopMethodTypes).includes(methodName)) { | ||
_context.next = 2; | ||
break; | ||
} | ||
url = this.formatUrl([versionUri]); | ||
return _context.abrupt('return', (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getVersion', res); | ||
})); | ||
throw Error('hasoop method ' + methodName + ' is not supported'); | ||
case 2: | ||
_context.next = 4; | ||
return this[methodName].apply(this, params); | ||
case 4: | ||
res = _context.sent; | ||
if (!(res.headers.get('sqoop-error-code') === '1000' && res.headers.get('sqoop-error-message') === 'OK')) { | ||
_context.next = 11; | ||
break; | ||
} | ||
_context.next = 8; | ||
return res.json(); | ||
case 8: | ||
return _context.abrupt('return', _context.sent); | ||
case 11: | ||
errorMessage = res.headers.get('sqoop-internal-error-message'); | ||
throw new Error('Hasoop error of ' + errorMessage); | ||
case 13: | ||
case 'end': | ||
@@ -194,23 +172,10 @@ return _context.stop(); | ||
function launchRequest(_x) { | ||
return _ref3.apply(this, arguments); | ||
function getVersion() { | ||
return _ref4.apply(this, arguments); | ||
} | ||
return launchRequest; | ||
return getVersion; | ||
}() | ||
/** | ||
* get sqoop server version. | ||
* | ||
* @returns {*} | ||
*/ | ||
}, { | ||
key: 'getVersion', | ||
value: function getVersion() { | ||
var url = this.formatUrl([versionUri]); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
} | ||
/** | ||
* get infos of all drivers. | ||
@@ -223,7 +188,29 @@ * | ||
key: 'getDriver', | ||
value: function getDriver() { | ||
var url = this.formatUrl([driverUri], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
} | ||
value: function () { | ||
var _ref5 = _asyncToGenerator(_regenerator2.default.mark(function _callee2() { | ||
var url; | ||
return _regenerator2.default.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
url = this.formatUrl([driverUri], _constant.sqoopAction.all); | ||
return _context2.abrupt('return', (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getDriver', res); | ||
})); | ||
case 2: | ||
case 'end': | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, this); | ||
})); | ||
function getDriver() { | ||
return _ref5.apply(this, arguments); | ||
} | ||
return getDriver; | ||
}() | ||
/** | ||
@@ -239,3 +226,5 @@ * get infos of all connectors. | ||
var url = this.formatUrl([connectorUri], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getConnectorAll', res); | ||
}); | ||
} | ||
@@ -254,3 +243,5 @@ | ||
var url = this.formatUrl([connectorUri], connectorName); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getConnectorByConnectorName', res, connectorName); | ||
}); | ||
} | ||
@@ -268,3 +259,5 @@ | ||
var url = this.formatUrl([linkUri], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getLinkAll', res); | ||
}); | ||
} | ||
@@ -283,3 +276,5 @@ | ||
var url = this.formatUrl([linkUri, _defineProperty({}, _constant.sqoopAction.cname, connectorName)], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getLinkByConnectorName', res); | ||
}); | ||
} | ||
@@ -298,3 +293,5 @@ | ||
var url = this.formatUrl([linkUri], linkName); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getLinkByLinkName', res, linkName); | ||
}); | ||
} | ||
@@ -314,3 +311,5 @@ | ||
var url = this.formatUrl([linkUri]); | ||
return (0, _sendRequest.sendPostRequest)(url, JSON.stringify(body)); | ||
return (0, _sendRequest.sendPostRequest)(url, JSON.stringify(body)).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('createLink', res, config.linkName); | ||
}); | ||
} | ||
@@ -331,3 +330,5 @@ | ||
var url = this.formatUrl([linkUri], oldLinkName); | ||
return (0, _sendRequest.sendPutRequest)(url, JSON.stringify(body)); | ||
return (0, _sendRequest.sendPutRequest)(url, JSON.stringify(body)).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('updateLinkConfig', res); | ||
}); | ||
} | ||
@@ -346,3 +347,5 @@ | ||
var url = this.formatUrl([linkUri], linkName, _constant.sqoopAction.enable); | ||
return (0, _sendRequest.sendPutRequest)(url); | ||
return (0, _sendRequest.sendPutRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('updateLinkEnable', res); | ||
}); | ||
} | ||
@@ -361,3 +364,5 @@ | ||
var url = this.formatUrl([linkUri], linkName, _constant.sqoopAction.disable); | ||
return (0, _sendRequest.sendPutRequest)(url); | ||
return (0, _sendRequest.sendPutRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('updateLinkDisable', res); | ||
}); | ||
} | ||
@@ -376,52 +381,8 @@ | ||
var url = this.formatUrl([linkUri], linkName); | ||
return (0, _sendRequest.sendDeleteRequest)(url); | ||
return (0, _sendRequest.sendDeleteRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('deleteLink', res); | ||
}); | ||
} | ||
/** | ||
* delete all links on sqoop server. | ||
* | ||
* @returns {*} | ||
*/ | ||
}, { | ||
key: 'deleteLinkAll', | ||
value: function () { | ||
var _ref5 = _asyncToGenerator(_regenerator2.default.mark(function _callee2() { | ||
var _this = this; | ||
var data, deleteList; | ||
return _regenerator2.default.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return this.launchRequest(_constant.hasoopMethodTypes.getLinkAll); | ||
case 2: | ||
data = _context2.sent; | ||
deleteList = data.links.map(function (link) { | ||
return _this.deleteLink(link.name); | ||
}); | ||
_context2.next = 6; | ||
return Promise.all(deleteList); | ||
case 6: | ||
return _context2.abrupt('return', _context2.sent); | ||
case 7: | ||
case 'end': | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, this); | ||
})); | ||
function deleteLinkAll() { | ||
return _ref5.apply(this, arguments); | ||
} | ||
return deleteLinkAll; | ||
}() | ||
/** | ||
* get infos of all jobs. | ||
@@ -436,3 +397,5 @@ * | ||
var url = this.formatUrl([jobUri], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getJobAll', res); | ||
}); | ||
} | ||
@@ -451,3 +414,5 @@ | ||
var url = this.formatUrl([jobUri], JobName); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getJobByJobName', res, JobName); | ||
}); | ||
} | ||
@@ -466,3 +431,5 @@ | ||
var url = this.formatUrl([jobUri, _defineProperty({}, _constant.sqoopAction.cname, connectorName)], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getJobByConnectorName', res); | ||
}); | ||
} | ||
@@ -480,3 +447,3 @@ | ||
value: function () { | ||
var _ref7 = _asyncToGenerator(_regenerator2.default.mark(function _callee3(config) { | ||
var _ref8 = _asyncToGenerator(_regenerator2.default.mark(function _callee3(config) { | ||
var fromLinkInfo, toLinkInfo, body, url; | ||
@@ -488,3 +455,3 @@ return _regenerator2.default.wrap(function _callee3$(_context3) { | ||
_context3.next = 2; | ||
return this.launchRequest(_constant.hasoopMethodTypes.getLinkByLinkName, config['fromLinkName']); | ||
return this.getLinkByLinkName(config['fromLinkName']); | ||
@@ -494,9 +461,11 @@ case 2: | ||
_context3.next = 5; | ||
return this.launchRequest(_constant.hasoopMethodTypes.getLinkByLinkName, config['toLinkName']); | ||
return this.getLinkByLinkName(config['toLinkName']); | ||
case 5: | ||
toLinkInfo = _context3.sent; | ||
body = (0, _setJobOptions.setCreateJobRequestBody)(config.jobName, config.jobConfig, fromLinkInfo, toLinkInfo); | ||
body = (0, _setJobOptions.setCreateJobRequestBody)(config.jobName, config.jobConfig, fromLinkInfo.data, toLinkInfo.data); | ||
url = this.formatUrl([jobUri]); | ||
return _context3.abrupt('return', (0, _sendRequest.sendPostRequest)(url, JSON.stringify(body))); | ||
return _context3.abrupt('return', (0, _sendRequest.sendPostRequest)(url, JSON.stringify(body)).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('createJob', res, config.jobName); | ||
})); | ||
@@ -511,4 +480,4 @@ case 9: | ||
function createJob(_x2) { | ||
return _ref7.apply(this, arguments); | ||
function createJob(_x) { | ||
return _ref8.apply(this, arguments); | ||
} | ||
@@ -520,63 +489,2 @@ | ||
/** | ||
* update job config. | ||
* | ||
* @param oldJobName | ||
* @param config | ||
* @returns {*} | ||
*/ | ||
}, { | ||
key: 'updateJobConfig', | ||
value: function () { | ||
var _ref8 = _asyncToGenerator(_regenerator2.default.mark(function _callee4(oldJobName, config) { | ||
var oldJobConfig, updateJobConfig, jobName, fromLinkName, toLinkName, fromLinkInfo, toLinkInfo, body, url; | ||
return _regenerator2.default.wrap(function _callee4$(_context4) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
_context4.t0 = _utils.splitJobConfig; | ||
_context4.next = 3; | ||
return this.launchRequest(_constant.hasoopMethodTypes.getJobByJobName, oldJobName); | ||
case 3: | ||
_context4.t1 = _context4.sent; | ||
oldJobConfig = (0, _context4.t0)(_context4.t1); | ||
updateJobConfig = { | ||
schemaName: config.jobConfig.schemaName || oldJobConfig.fromSchemaName, | ||
tableName: config.jobConfig.tableName || oldJobConfig.fromTableName, | ||
outputDirectory: config.jobConfig.outputDirectory || oldJobConfig.toOutputDirectory | ||
}; | ||
jobName = config.jobName || oldJobConfig.topName; | ||
fromLinkName = config.fromLinkName || oldJobConfig.topFromLinkName; | ||
toLinkName = config.toLinkName || oldJobConfig.topToLinkName; | ||
_context4.next = 11; | ||
return this.launchRequest(_constant.hasoopMethodTypes.getLinkByLinkName, fromLinkName); | ||
case 11: | ||
fromLinkInfo = _context4.sent; | ||
_context4.next = 14; | ||
return this.launchRequest(_constant.hasoopMethodTypes.getLinkByLinkName, toLinkName); | ||
case 14: | ||
toLinkInfo = _context4.sent; | ||
body = (0, _setJobOptions.setUpdateJobRequestBody)(jobName, updateJobConfig, fromLinkInfo, toLinkInfo, oldJobConfig.topId); | ||
url = this.formatUrl([jobUri], oldJobName); | ||
return _context4.abrupt('return', (0, _sendRequest.sendPutRequest)(url, JSON.stringify(body))); | ||
case 18: | ||
case 'end': | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _callee4, this); | ||
})); | ||
function updateJobConfig(_x3, _x4) { | ||
return _ref8.apply(this, arguments); | ||
} | ||
return updateJobConfig; | ||
}() | ||
/** | ||
* change job to enable by job name. | ||
@@ -592,3 +500,5 @@ * | ||
var url = this.formatUrl([jobUri], jobName, _constant.sqoopAction.enable); | ||
return (0, _sendRequest.sendPutRequest)(url); | ||
return (0, _sendRequest.sendPutRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('updateJobEnable', res, jobName); | ||
}); | ||
} | ||
@@ -607,3 +517,5 @@ | ||
var url = this.formatUrl([jobUri], jobName, _constant.sqoopAction.disable); | ||
return (0, _sendRequest.sendPutRequest)(url); | ||
return (0, _sendRequest.sendPutRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('updateJobDisable', res, jobName); | ||
}); | ||
} | ||
@@ -622,52 +534,8 @@ | ||
var url = this.formatUrl([jobUri], jobName); | ||
return (0, _sendRequest.sendDeleteRequest)(url); | ||
return (0, _sendRequest.sendDeleteRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('deleteJob', res, jobName); | ||
}); | ||
} | ||
/** | ||
* delete all jobs on sqoop server. | ||
* | ||
* @returns {*} | ||
*/ | ||
}, { | ||
key: 'deleteJobAll', | ||
value: function () { | ||
var _ref9 = _asyncToGenerator(_regenerator2.default.mark(function _callee5() { | ||
var _this2 = this; | ||
var data, deleteList; | ||
return _regenerator2.default.wrap(function _callee5$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.next = 2; | ||
return this.launchRequest(_constant.hasoopMethodTypes.getJobAll); | ||
case 2: | ||
data = _context5.sent; | ||
deleteList = data.jobs.map(function (job) { | ||
return _this2.deleteJob(job.name); | ||
}); | ||
_context5.next = 6; | ||
return Promise.all(deleteList); | ||
case 6: | ||
return _context5.abrupt('return', _context5.sent); | ||
case 7: | ||
case 'end': | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _callee5, this); | ||
})); | ||
function deleteJobAll() { | ||
return _ref9.apply(this, arguments); | ||
} | ||
return deleteJobAll; | ||
}() | ||
/** | ||
* start job by job name. | ||
@@ -683,3 +551,5 @@ * | ||
var url = this.formatUrl([jobUri], jobName, _constant.sqoopAction.start); | ||
return (0, _sendRequest.sendPutRequest)(url); | ||
return (0, _sendRequest.sendPutRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('startJob', res, jobName); | ||
}); | ||
} | ||
@@ -698,3 +568,5 @@ | ||
var url = this.formatUrl([jobUri], jobName, _constant.sqoopAction.stop); | ||
return (0, _sendRequest.sendPutRequest)(url); | ||
return (0, _sendRequest.sendPutRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('stopJob', res, jobName); | ||
}); | ||
} | ||
@@ -713,3 +585,5 @@ | ||
var url = this.formatUrl([jobUri], jobName, _constant.sqoopAction.status); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('jobStatus', res, jobName); | ||
}); | ||
} | ||
@@ -727,3 +601,5 @@ | ||
var url = this.formatUrl([submissionsUri], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getSubmissionAll', res); | ||
}); | ||
} | ||
@@ -742,3 +618,5 @@ | ||
var url = this.formatUrl([submissionsUri, _defineProperty({}, _constant.sqoopAction.jname, jobName)], _constant.sqoopAction.all); | ||
return (0, _sendRequest.sendGetRequest)(url); | ||
return (0, _sendRequest.sendGetRequest)(url).then(function (res) { | ||
return (0, _dispose.hasoopRequestDispose)('getSubmissionByJobName', res); | ||
}); | ||
} | ||
@@ -745,0 +623,0 @@ }]); |
@@ -7,6 +7,6 @@ 'use strict'; | ||
exports.setCreateJobRequestBody = setCreateJobRequestBody; | ||
exports.setUpdateJobRequestBody = setUpdateJobRequestBody; | ||
/** | ||
* Created by Chyroc on 17/1/15. | ||
*/ | ||
var _utils = require('./utils'); | ||
/** | ||
@@ -118,7 +118,2 @@ * @ignore | ||
*/ | ||
/** | ||
* Created by Chyroc on 17/1/15. | ||
*/ | ||
// import { connectorType } from './index' | ||
function setHdfsJobConfig(linkConfig, jobConfig) { | ||
@@ -204,3 +199,3 @@ return { | ||
*/ | ||
function setJobConfig(jobConfig) { | ||
function setJobConfig() { | ||
return { | ||
@@ -254,4 +249,2 @@ 'configs': [{ | ||
var fromLinkConfig = (0, _utils.splitLinkConfig)(fromLinkInfo); | ||
var toLinkConfig = (0, _utils.splitLinkConfig)(toLinkInfo); | ||
return { | ||
@@ -266,18 +259,11 @@ 'jobs': [{ | ||
'enabled': true, | ||
'from-link-name': fromLinkConfig.name, | ||
'from-connector-name': fromLinkConfig.connectorName, | ||
'to-link-name': toLinkConfig.name, | ||
'to-connector-name': toLinkConfig.connectorName, | ||
'to-config-values': setHdfsJobConfig(toLinkConfig, jobConfig), | ||
'from-config-values': setMysqlJobConfig(fromLinkConfig, jobConfig), | ||
'driver-config-values': setJobConfig(jobConfig) | ||
'from-link-name': fromLinkInfo.name, | ||
'from-connector-name': fromLinkInfo.connectorName, | ||
'to-link-name': fromLinkInfo.name, | ||
'to-connector-name': toLinkInfo.connectorName, | ||
'to-config-values': setHdfsJobConfig(toLinkInfo, jobConfig), | ||
'from-config-values': setMysqlJobConfig(fromLinkInfo, jobConfig), | ||
'driver-config-values': setJobConfig() | ||
}] | ||
}; | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
function setUpdateJobRequestBody(jobName, jobConfig, fromLinkInfo, toLinkInfo, jobId) { | ||
return setCreateJobRequestBody(jobName, jobConfig, fromLinkInfo, toLinkInfo, jobId); | ||
} |
@@ -10,3 +10,2 @@ 'use strict'; | ||
exports.expectSqoopHeaders = expectSqoopHeaders; | ||
exports.splitLinkConfig = splitLinkConfig; | ||
@@ -19,4 +18,2 @@ exports.splitJobConfig = splitJobConfig; | ||
var _chai = require('chai'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,7 +28,2 @@ | ||
function expectSqoopHeaders(res) { | ||
(0, _chai.expect)(res.headers.get('sqoop-error-code')).to.equal('1000'); | ||
(0, _chai.expect)(res.headers.get('sqoop-error-message')).to.equal('OK'); | ||
} | ||
/** | ||
@@ -38,0 +30,0 @@ * @ignore |
{ | ||
"name": "hasoop", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58946
1363