expo-server-sdk
Advanced tools
Comparing version 2.3.1 to 2.3.3
@@ -214,3 +214,3 @@ 'use strict'; | ||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(url, options) { | ||
var sdkVersion, fetchOptions, json, response, apiError, result, _apiError, _apiError2; | ||
var sdkVersion, fetchOptions, json, response, apiError, textBody, result, _apiError, _apiError2; | ||
@@ -284,27 +284,29 @@ return _regenerator2.default.wrap(function _callee3$(_context3) { | ||
case 22: | ||
_context3.next = 24; | ||
return response.text(); | ||
case 24: | ||
textBody = _context3.sent; | ||
// We expect the API response body to be JSON | ||
result = void 0; | ||
_context3.prev = 23; | ||
_context3.next = 26; | ||
return response.json(); | ||
_context3.prev = 26; | ||
case 26: | ||
result = _context3.sent; | ||
_context3.next = 35; | ||
result = JSON.parse(textBody); | ||
_context3.next = 36; | ||
break; | ||
case 29: | ||
_context3.prev = 29; | ||
_context3.t0 = _context3['catch'](23); | ||
_context3.next = 33; | ||
return this._getTextResponseErrorAsync(response); | ||
case 30: | ||
_context3.prev = 30; | ||
_context3.t0 = _context3['catch'](26); | ||
_context3.next = 34; | ||
return this._getTextResponseErrorAsync(response, textBody); | ||
case 33: | ||
case 34: | ||
_apiError = _context3.sent; | ||
throw _apiError; | ||
case 35: | ||
case 36: | ||
if (!result.errors) { | ||
_context3.next = 38; | ||
_context3.next = 39; | ||
break; | ||
@@ -316,6 +318,6 @@ } | ||
case 38: | ||
case 39: | ||
return _context3.abrupt('return', result.data); | ||
case 39: | ||
case 40: | ||
case 'end': | ||
@@ -325,3 +327,3 @@ return _context3.stop(); | ||
} | ||
}, _callee3, this, [[23, 29]]); | ||
}, _callee3, this, [[26, 30]]); | ||
})); | ||
@@ -339,3 +341,3 @@ | ||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(response) { | ||
var result, apiError; | ||
var textBody, result, apiError; | ||
return _regenerator2.default.wrap(function _callee4$(_context4) { | ||
@@ -345,31 +347,33 @@ while (1) { | ||
case 0: | ||
_context4.next = 2; | ||
return response.text(); | ||
case 2: | ||
textBody = _context4.sent; | ||
result = void 0; | ||
_context4.prev = 1; | ||
_context4.next = 4; | ||
return response.json(); | ||
_context4.prev = 4; | ||
case 4: | ||
result = _context4.sent; | ||
_context4.next = 12; | ||
result = JSON.parse(textBody); | ||
_context4.next = 13; | ||
break; | ||
case 7: | ||
_context4.prev = 7; | ||
_context4.t0 = _context4['catch'](1); | ||
_context4.next = 11; | ||
return this._getTextResponseErrorAsync(response); | ||
case 8: | ||
_context4.prev = 8; | ||
_context4.t0 = _context4['catch'](4); | ||
_context4.next = 12; | ||
return this._getTextResponseErrorAsync(response, textBody); | ||
case 11: | ||
case 12: | ||
return _context4.abrupt('return', _context4.sent); | ||
case 12: | ||
case 13: | ||
if (!(!result.errors || !Array.isArray(result.errors) || !result.errors.length)) { | ||
_context4.next = 18; | ||
_context4.next = 19; | ||
break; | ||
} | ||
_context4.next = 15; | ||
return this._getTextResponseErrorAsync(response); | ||
_context4.next = 16; | ||
return this._getTextResponseErrorAsync(response, textBody); | ||
case 15: | ||
case 16: | ||
apiError = _context4.sent; | ||
@@ -380,6 +384,6 @@ | ||
case 18: | ||
case 19: | ||
return _context4.abrupt('return', this._getErrorFromResult(result)); | ||
case 19: | ||
case 20: | ||
case 'end': | ||
@@ -389,3 +393,3 @@ return _context4.stop(); | ||
} | ||
}, _callee4, this, [[1, 7]]); | ||
}, _callee4, this, [[4, 8]]); | ||
})); | ||
@@ -402,4 +406,4 @@ | ||
value: function () { | ||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(response) { | ||
var text, apiError; | ||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(response, text) { | ||
var apiError; | ||
return _regenerator2.default.wrap(function _callee5$(_context5) { | ||
@@ -409,9 +413,4 @@ while (1) { | ||
case 0: | ||
_context5.next = 2; | ||
return response.text(); | ||
apiError = new Error('Expo responded with an error with status code ' + response.status + ': ' + text); | ||
case 2: | ||
text = _context5.sent; | ||
apiError = new Error('Exponent responded with an error with status code ' + response.status + ': ' + text); | ||
apiError.statusCode = response.status; | ||
@@ -421,3 +420,3 @@ apiError.errorText = text; | ||
case 7: | ||
case 4: | ||
case 'end': | ||
@@ -430,3 +429,3 @@ return _context5.stop(); | ||
function _getTextResponseErrorAsync(_x7) { | ||
function _getTextResponseErrorAsync(_x7, _x8) { | ||
return _ref5.apply(this, arguments); | ||
@@ -448,3 +447,3 @@ } | ||
(0, _invariant2.default)(result.errors && result.errors.length > 0, 'Expected at least one error from Exponent'); | ||
(0, _invariant2.default)(result.errors && result.errors.length > 0, 'Expected at least one error from Expo'); | ||
@@ -451,0 +450,0 @@ var _result$errors = (0, _toArray3.default)(result.errors), |
{ | ||
"name": "expo-server-sdk", | ||
"version": "2.3.1", | ||
"version": "2.3.3", | ||
"description": "Server side library for working with Expo using Node.js", | ||
@@ -12,3 +12,2 @@ "main": "build/ExpoClient.js", | ||
"build": "./build.sh", | ||
"jest": "jest", | ||
"prepublish": "npm run build", | ||
@@ -26,6 +25,6 @@ "test": "jest", | ||
"type": "git", | ||
"url": "git+https://github.com/expo/exponent-server-sdk-node.git" | ||
"url": "git+https://github.com/expo/expo-server-sdk-node.git" | ||
}, | ||
"keywords": [ | ||
"exponent", | ||
"expo", | ||
"react-native", | ||
@@ -37,5 +36,5 @@ "push-notifications" | ||
"bugs": { | ||
"url": "https://github.com/expo/exponent-server-sdk-node/issues" | ||
"url": "https://github.com/expo/expo-server-sdk-node/issues" | ||
}, | ||
"homepage": "https://github.com/expo/exponent-server-sdk-node#readme", | ||
"homepage": "https://github.com/expo/expo-server-sdk-node#readme", | ||
"dependencies": { | ||
@@ -55,4 +54,4 @@ "babel-runtime": "^6.11.6", | ||
"babel-preset-es2017": "^6.14.0", | ||
"jest": "^20.0.0" | ||
"jest": "^21.2.1" | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
# expo-server-sdk-node | ||
Server side library for working with Exponent using Node.js | ||
# expo-server-sdk-node [![CircleCI](https://circleci.com/gh/expo/exponent-server-sdk-node.svg?style=svg)](https://circleci.com/gh/expo/exponent-server-sdk-node) [![codecov](https://codecov.io/gh/expo/exponent-server-sdk-node/branch/master/graph/badge.svg)](https://codecov.io/gh/expo/exponent-server-sdk-node) | ||
Server side library for working with Expo using Node.js | ||
@@ -37,3 +37,3 @@ ## Usage | ||
// The Expo push notification service accepts batches of notifications so | ||
// that you don't need to send 1000 requests to send 1000 notifications. We | ||
// that you don't need to send 1000 requests to send 1000 notifications. We | ||
// recommend you batch your notifications to reduce the number of requests | ||
@@ -73,3 +73,3 @@ // and to compress them (notifications with similar content will get | ||
* https://github.com/exponent/expo-server-sdk-ruby | ||
* https://github.com/exponent/expo-server-sdk-python | ||
* https://github.com/expo/expo-server-sdk-ruby | ||
* https://github.com/expo/expo-server-sdk-python |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41204
0
397