Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

code-push

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-push - npm Package Compare versions

Comparing version 1.0.0-beta to 1.1.0-beta

10

package.json
{
"name": "code-push",
"version": "1.0.0-beta",
"description": "Source code for the CodePush service SDK",
"version": "1.1.0-beta",
"description": "Management SDK for the CodePush service",
"main": "script/index.js",

@@ -13,3 +13,5 @@ "scripts": {

},
"author": "Microsoft",
"author": "Microsoft Corporation",
"license": "MIT",
"homepage": "https://microsoft.github.io/code-push",
"dependencies": {

@@ -23,2 +25,2 @@ "base-64": "^0.1.0",

}
}
}

59

script/management/account-manager.js

@@ -36,12 +36,16 @@ var base64 = require("base-64");

var loginInfo = AccountManager.getLoginInfo(accessToken);
if (!loginInfo || !loginInfo.providerName || !loginInfo.providerUniqueId) {
reject({ message: "Invalid access key." });
return;
}
var req = request.post(_this.serverUrl + "/auth/login/accessToken");
_this.attachCredentials(req, request);
req.type("form")
.send({ identity: JSON.stringify({ providerName: loginInfo.providerName, providerUniqueId: loginInfo.providerUniqueId }) })
.send({ token: loginInfo.accessKeyName })
.end(function (err, res) {
req = req.type("form");
if (loginInfo && loginInfo.providerName && loginInfo.providerUniqueId) {
// Login the old way.
req = req.send({ identity: JSON.stringify({ providerName: loginInfo.providerName, providerUniqueId: loginInfo.providerUniqueId }) })
.send({ token: loginInfo.accessKeyName });
}
else {
// Note: We can't send an empty identity string, or PassportAuth will short circuit and fail.
req = req.send({ identity: "accessKey" })
.send({ token: accessToken });
}
req.end(function (err, res) {
if (err) {

@@ -117,6 +121,6 @@ reject({ message: _this.getErrorMessage(err, res) });

};
AccountManager.prototype.addAccessKey = function (description) {
AccountManager.prototype.addAccessKey = function (machine, description) {
var _this = this;
return Promise(function (resolve, reject, notify) {
var accessKey = { id: null, name: uuid.v4(), description: description };
var accessKey = { id: null, name: uuid.v4(), createdTime: new Date().getTime(), createdBy: machine, description: description };
var requester = _this._authedAgent ? _this._authedAgent : request;

@@ -803,2 +807,28 @@ var req = requester.post(_this.serverUrl + "/accessKeys/");

};
AccountManager.prototype.promotePackage = function (appId, sourceDeploymentId, destDeploymentId) {
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/" + sourceDeploymentId + "/promote/" + destDeploymentId);
_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.getPackage = function (appId, deploymentId) {

@@ -836,4 +866,9 @@ var _this = this;

AccountManager.getLoginInfo = function (accessKey) {
var decoded = base64.decode(accessKey);
return tryJSON(decoded);
try {
var decoded = base64.decode(accessKey);
return tryJSON(decoded);
}
catch (ex) {
return null;
}
};

@@ -840,0 +875,0 @@ AccountManager.prototype.getErrorMessage = function (error, response) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc