Comparing version 1.3.0-beta to 1.4.0-beta
{ | ||
"name": "code-push", | ||
"version": "1.3.0-beta", | ||
"version": "1.4.0-beta", | ||
"description": "Management SDK for the CodePush service", | ||
@@ -5,0 +5,0 @@ "main": "script/index.js", |
@@ -29,3 +29,4 @@ /// <reference path="../definitions/harness.d.ts" /> | ||
packageHash: currentPackage.packageHash, | ||
isCompanion: this._ignoreAppVersion | ||
isCompanion: this._ignoreAppVersion, | ||
label: currentPackage.label | ||
}; | ||
@@ -32,0 +33,0 @@ var requestUrl = this._serverUrl + "updateCheck?" + queryStringify(updateRequest); |
@@ -617,39 +617,2 @@ var base64 = require("base-64"); | ||
}; | ||
// Deployment key | ||
AccountManager.prototype.addDeploymentKey = function (appId, deploymentId, name, description) { | ||
var _this = this; | ||
return Promise(function (resolve, reject, notify) { | ||
var deploymentKey = _this.generateDeploymentKey(name, description, false); | ||
var requester = (_this._authedAgent ? _this._authedAgent : request); | ||
var req = requester.post(_this.serverUrl + "/apps/" + appId + "/deployments/" + deploymentId + "/deploymentKeys"); | ||
_this.attachCredentials(req, requester); | ||
req.set("Content-Type", "application/json;charset=UTF-8") | ||
.send(JSON.stringify(deploymentKey)) | ||
.end(function (err, res) { | ||
if (err) { | ||
reject({ message: _this.getErrorMessage(err, res) }); | ||
return; | ||
} | ||
if (res.ok) { | ||
var body = tryJSON(res.text); | ||
if (res.ok) { | ||
if (body) { | ||
resolve(body.deploymentKey); | ||
} | ||
else { | ||
reject({ message: "Could not parse response: " + res.text, statusCode: res.status }); | ||
} | ||
} | ||
else { | ||
if (body) { | ||
reject(body); | ||
} | ||
else { | ||
reject({ message: res.text, statusCode: res.status }); | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
AccountManager.prototype.getDeploymentKeys = function (appId, deploymentId) { | ||
@@ -686,88 +649,2 @@ var _this = this; | ||
}; | ||
AccountManager.prototype.getDeploymentKey = function (appId, deploymentId, deploymentKeyId) { | ||
var _this = this; | ||
return Promise(function (resolve, reject, notify) { | ||
var requester = (_this._authedAgent ? _this._authedAgent : request); | ||
var req = requester.get(_this.serverUrl + "/apps/" + appId + "/deployments/" + deploymentId + "/deploymentKeys/" + deploymentKeyId); | ||
_this.attachCredentials(req, requester); | ||
req.end(function (err, res) { | ||
if (err) { | ||
reject({ message: _this.getErrorMessage(err, res) }); | ||
return; | ||
} | ||
var body = tryJSON(res.text); | ||
if (res.ok) { | ||
if (body) { | ||
resolve(body.deploymentKey); | ||
} | ||
else { | ||
reject({ message: "Could not parse response: " + res.text, statusCode: res.status }); | ||
} | ||
} | ||
else { | ||
if (body) { | ||
reject(body); | ||
} | ||
else { | ||
reject({ message: res.text, statusCode: res.status }); | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
AccountManager.prototype.updateDeploymentKey = function (appId, deploymentId, deploymentKeyId, infoToChange) { | ||
var _this = this; | ||
return Promise(function (resolve, reject, notify) { | ||
var requester = (_this._authedAgent ? _this._authedAgent : request); | ||
var req = requester.put(_this.serverUrl + "/apps/" + appId + "/deployments/" + deploymentId + "/deploymentKeys/" + deploymentKeyId); | ||
_this.attachCredentials(req, requester); | ||
req.set("Content-Type", "application/json;charset=UTF-8") | ||
.send(JSON.stringify(infoToChange)) | ||
.end(function (err, res) { | ||
if (err) { | ||
reject({ message: _this.getErrorMessage(err, res) }); | ||
return; | ||
} | ||
if (res.ok) { | ||
resolve(null); | ||
} | ||
else { | ||
var body = tryJSON(res.text); | ||
if (body) { | ||
reject(body); | ||
} | ||
else { | ||
reject({ message: res.text, statusCode: res.status }); | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
AccountManager.prototype.deleteDeploymentKey = function (appId, deploymentId, deploymentKey) { | ||
var _this = this; | ||
var id = (typeof deploymentKey === "string") ? deploymentKey : deploymentKey.id; | ||
return Promise(function (resolve, reject, notify) { | ||
var requester = (_this._authedAgent ? _this._authedAgent : request); | ||
var req = requester.del(_this.serverUrl + "/apps/" + appId + "/deployments/" + deploymentId + "/deploymentKeys/" + id); | ||
_this.attachCredentials(req, requester); | ||
req.end(function (err, res) { | ||
if (err) { | ||
reject({ message: _this.getErrorMessage(err, res) }); | ||
return; | ||
} | ||
if (res.ok) { | ||
resolve(null); | ||
} | ||
else { | ||
var body = tryJSON(res.text); | ||
if (body) { | ||
reject(body); | ||
} | ||
else { | ||
reject({ message: res.text, statusCode: res.status }); | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
AccountManager.prototype.addPackage = function (appId, deploymentId, fileOrPath, description, label, appVersion, isMandatory, uploadProgressCallback) { | ||
@@ -842,7 +719,7 @@ var _this = this; | ||
}; | ||
AccountManager.prototype.rollbackPackage = function (appId, deploymentId) { | ||
AccountManager.prototype.rollbackPackage = function (appId, deploymentId, targetRelease) { | ||
var _this = this; | ||
return Promise(function (resolve, reject, notify) { | ||
var requester = (_this._authedAgent ? _this._authedAgent : request); | ||
var req = requester.post(_this.serverUrl + "/apps/" + appId + "/deployments/" + deploymentId + "/rollback"); | ||
var req = requester.post(_this.serverUrl + "/apps/" + appId + "/deployments/" + deploymentId + "/rollback/" + (targetRelease || "")); | ||
_this.attachCredentials(req, requester); | ||
@@ -849,0 +726,0 @@ req.end(function (err, res) { |
@@ -76,3 +76,4 @@ /// <reference path="../definitions/harness.d.ts" /> | ||
packageHash: params.packageHash, | ||
isCompanion: !!(params.isCompanion) | ||
isCompanion: !!(params.isCompanion), | ||
label: params.label | ||
}; | ||
@@ -79,0 +80,0 @@ if (!updateRequest.deploymentKey || !updateRequest.appVersion) { |
@@ -13,3 +13,3 @@ /// <reference path="../definitions/harness.d.ts" /> | ||
description: "sdfsdf", | ||
label: "0.0.1", | ||
label: "v1", | ||
appVersion: latestPackage.appVersion, | ||
@@ -16,0 +16,0 @@ packageHash: "hash001", |
@@ -27,5 +27,3 @@ /// <reference path="../definitions/harness.d.ts" /> | ||
manager.removeDeployment.bind(manager, "appId", { id: "deploymentToChange" }), | ||
manager.getDeploymentKey.bind(manager, "appId", "deploymentId", "deploymentKeyId"), | ||
manager.getDeploymentKeys.bind(manager, "appId", "deploymentId"), | ||
manager.updateDeploymentKey.bind(manager, "appId", "deploymentId", "deploymentKeyId", {}), | ||
manager.getPackage.bind(manager, ""), | ||
@@ -157,9 +155,2 @@ manager.logout.bind(manager), | ||
}); | ||
it("getDeploymentKey handles JSON response", function (done) { | ||
mockReturn(JSON.stringify({ deploymentKey: {} }), 200, {}); | ||
manager.getDeploymentKey("appId", "deploymentId", "deploymentKeyId").done(function (obj) { | ||
assert.ok(obj); | ||
done(); | ||
}, rejectHandler); | ||
}); | ||
it("getDeploymentKeys handles JSON response", function (done) { | ||
@@ -172,16 +163,2 @@ mockReturn(JSON.stringify({ deploymentKeys: [] }), 200, {}); | ||
}); | ||
it("removeDeploymentKey handles success response", function (done) { | ||
mockReturn("", 200, {}); | ||
manager.updateDeploymentKey("appId", "deploymentId", "deploymentKeyId", {}).done(function (obj) { | ||
assert.ok(!obj); | ||
done(); | ||
}, rejectHandler); | ||
}); | ||
it("removeDeploymentKey handles success response", function (done) { | ||
mockReturn("", 200, {}); | ||
manager.deleteDeploymentKey("appId", "deploymentId", "deploymentKeyId").done(function (obj) { | ||
assert.ok(!obj); | ||
done(); | ||
}, rejectHandler); | ||
}); | ||
it("getPackage handles success response", function (done) { | ||
@@ -188,0 +165,0 @@ mockReturn(JSON.stringify({ package: {} }), 200); |
Sorry, the diff of this file is not supported yet
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
65525
1581