expo-server-sdk
Advanced tools
Comparing version 3.5.1 to 3.6.0
@@ -8,2 +8,3 @@ /// <reference types="node" /> | ||
private limitConcurrentRequests; | ||
private accessToken; | ||
constructor(options?: ExpoClientOptions); | ||
@@ -50,2 +51,3 @@ /** | ||
maxConcurrentRequests?: number; | ||
accessToken?: string; | ||
}; | ||
@@ -52,0 +54,0 @@ export declare type ExpoPushToken = string; |
@@ -39,4 +39,2 @@ "use strict"; | ||
const DEFAULT_CONCURRENT_REQUEST_LIMIT = 6; | ||
// TODO: Eventually we'll want to have developers authenticate. Right now it's not necessary because | ||
// push notifications are the only API we have and the push tokens are secret anyway. | ||
class Expo { | ||
@@ -48,2 +46,3 @@ constructor(options = {}) { | ||
: DEFAULT_CONCURRENT_REQUEST_LIMIT); | ||
this.accessToken = options.accessToken; | ||
} | ||
@@ -175,2 +174,5 @@ /** | ||
}); | ||
if (this.accessToken) { | ||
requestHeaders.set('Authorization', `Bearer ${this.accessToken}`); | ||
} | ||
if (options.body != null) { | ||
@@ -177,0 +179,0 @@ const json = JSON.stringify(options.body); |
{ | ||
"name": "expo-server-sdk", | ||
"version": "3.5.1", | ||
"version": "3.6.0", | ||
"description": "Server-side library for working with Expo using Node.js", | ||
@@ -8,4 +8,3 @@ "main": "build/ExpoClient.js", | ||
"files": [ | ||
"build", | ||
"src" | ||
"build" | ||
], | ||
@@ -21,8 +20,3 @@ "scripts": { | ||
"eslintConfig": { | ||
"extends": "universe/node", | ||
"settings": { | ||
"react": { | ||
"version": "999.999.0" | ||
} | ||
} | ||
"extends": "universe/node" | ||
}, | ||
@@ -57,9 +51,9 @@ "jest": { | ||
"eslint": "^7.3.1", | ||
"eslint-config-universe": "^3.0.2", | ||
"eslint-config-universe": "^4.0.0", | ||
"fetch-mock": "^9.10.3", | ||
"jest": "^26.1.0", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "~26.1.1", | ||
"typescript": "^3.9.5" | ||
"ts-jest": "~26.4.0", | ||
"typescript": "^4.0.3" | ||
} | ||
} |
@@ -18,3 +18,4 @@ # expo-server-sdk-node ![Tests](https://github.com/expo/expo-server-sdk-node/workflows/Tests/badge.svg) [![codecov](https://codecov.io/gh/expo/expo-server-sdk-node/branch/master/graph/badge.svg)](https://codecov.io/gh/expo/expo-server-sdk-node) | ||
// Create a new Expo SDK client | ||
let expo = new Expo(); | ||
// optionally providing an access token if you have enabled push security | ||
let expo = new Expo({ accessToken: process.env.EXPO_ACCESS_TOKEN }); | ||
@@ -32,3 +33,3 @@ // Create the messages that you want to send to clients | ||
// Construct a message (see https://docs.expo.io/versions/latest/guides/push-notifications) | ||
// Construct a message (see https://docs.expo.io/push-notifications/sending-notifications/) | ||
messages.push({ | ||
@@ -61,3 +62,3 @@ to: pushToken, | ||
// documentation: | ||
// https://docs.expo.io/versions/latest/guides/push-notifications#response-format | ||
// https://docs.expo.io/push-notifications/sending-notifications/#individual-errors | ||
} catch (error) { | ||
@@ -116,3 +117,3 @@ console.error(error); | ||
// The error codes are listed in the Expo documentation: | ||
// https://docs.expo.io/versions/latest/guides/push-notifications/#individual-errors | ||
// https://docs.expo.io/push-notifications/sending-notifications/#individual-errors | ||
// You must handle the errors appropriately. | ||
@@ -119,0 +120,0 @@ console.error(`The error code is ${details.error}`); |
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
140
30888
6
386