Comparing version 1.10.1-beta to 1.10.2-beta
{ | ||
"name": "code-push", | ||
"version": "1.10.1-beta", | ||
"version": "1.10.2-beta", | ||
"description": "Management SDK for the CodePush service", | ||
@@ -5,0 +5,0 @@ "main": "script/index.js", |
@@ -91,1 +91,13 @@ # CodePush Management SDK (Node.js) | ||
- __transferApp(appName: string, email: string): Promise<void>__ - Transfers the ownership of the specified app to the specified account. | ||
### Error Handling | ||
When an error occurs in any of the methods, the promise will be rejected with a CodePushError object with the following properties: | ||
- __message__: A user-friendly message that describes the error. | ||
- __statusCode__: An HTTP response code that identifies the category of error: | ||
- __CodePush.ERROR_GATEWAY_TIMEOUT__: A network error prevented you from connecting to the CodePush server. | ||
- __CodePush.ERROR_INTERNAL_SERVER__: An error occurred internally on the CodePush server. | ||
- __CodePush.ERROR_NOT_FOUND__: The resource you are attempting to retrieve does not exist. | ||
- __CodePush.ERROR_CONFLICT__: The resource you are attempting to create already exists. | ||
- __CodePush.ERROR_UNAUTHORIZED__: The access key you configured is invalid or expired. |
@@ -49,3 +49,3 @@ var os = require("os"); | ||
}); | ||
AccountManager.prototype.isAuthenticated = function () { | ||
AccountManager.prototype.isAuthenticated = function (throwIfUnauthorized) { | ||
var _this = this; | ||
@@ -64,2 +64,6 @@ return Promise(function (resolve, reject, notify) { | ||
var authenticated = status === 200; | ||
if (!authenticated && throwIfUnauthorized) { | ||
reject(_this.getCodePushError(err, res)); | ||
return; | ||
} | ||
resolve(authenticated); | ||
@@ -66,0 +70,0 @@ }); |
@@ -74,2 +74,14 @@ /// <reference path="../definitions/harness.d.ts" /> | ||
}); | ||
it("isAuthenticated handles unsuccessful auth with promise rejection", function (done) { | ||
mockReturn("Unauthorized", 401, {}); | ||
// use optional parameter to ask for rejection of the promise if not authenticated | ||
manager.isAuthenticated(true) | ||
.done(function (authenticated) { | ||
assert.fail("isAuthenticated should have rejected the promise"); | ||
done(); | ||
}, function (err) { | ||
assert.equal(err.message, "Unauthorized", "Error message should be 'Unauthorized'"); | ||
done(); | ||
}); | ||
}); | ||
it("isAuthenticated handles unexpected status codes", function (done) { | ||
@@ -76,0 +88,0 @@ mockReturn("Not Found", 404, {}); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
64068
1281
103
0