expo-server-sdk
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -55,4 +55,9 @@ /// <reference types="node" /> | ||
title?: string; | ||
subtitle?: string; | ||
body?: string; | ||
sound?: 'default' | null; | ||
sound?: 'default' | null | { | ||
critical?: boolean; | ||
name?: 'default' | null; | ||
volume?: number; | ||
}; | ||
ttl?: number; | ||
@@ -74,3 +79,3 @@ expiration?: number; | ||
status: 'error'; | ||
message: 'string'; | ||
message: string; | ||
details?: { | ||
@@ -77,0 +82,0 @@ error?: 'DeviceNotRegistered' | 'InvalidCredentials' | 'MessageTooBig' | 'MessageRateExceeded'; |
@@ -76,5 +76,3 @@ "use strict"; | ||
if (!Array.isArray(data) || data.length !== messages.length) { | ||
let apiError = new Error(`Expected Expo to respond with ${messages.length} ${messages.length === 1 | ||
? 'ticket' | ||
: 'tickets'} but got ${data.length}`); | ||
let apiError = new Error(`Expected Expo to respond with ${messages.length} ${messages.length === 1 ? 'ticket' : 'tickets'} but got ${data.length}`); | ||
apiError.data = data; | ||
@@ -81,0 +79,0 @@ throw apiError; |
{ | ||
"name": "expo-server-sdk", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Server side library for working with Expo using Node.js", | ||
@@ -53,4 +53,2 @@ "main": "build/ExpoClient.js", | ||
"dependencies": { | ||
"@types/invariant": "^2.2.29", | ||
"@types/node-fetch": "^2.1.4", | ||
"node-fetch": "^2.3.0", | ||
@@ -60,3 +58,5 @@ "promise-limit": "^2.7.0" | ||
"devDependencies": { | ||
"@types/invariant": "^2.2.29", | ||
"@types/jest": "^23.3.10", | ||
"@types/node-fetch": "^2.1.4", | ||
"jest": "^23.6.0", | ||
@@ -63,0 +63,0 @@ "ts-jest": "^23.10.5", |
@@ -8,2 +8,4 @@ # expo-server-sdk-node [![CircleCI](https://circleci.com/gh/expo/expo-server-sdk-node.svg?style=svg)](https://circleci.com/gh/expo/expo-server-sdk-node) [![codecov](https://codecov.io/gh/expo/expo-server-sdk-node/branch/master/graph/badge.svg)](https://codecov.io/gh/expo/expo-server-sdk-node) | ||
_Note: the following code assumes that you are using JavaScript modules with `import`. If you aren't then you should use the old syntax for the SDK import: `const { Expo } = require('expo-server-sdk')`._ | ||
```bash | ||
@@ -58,3 +60,3 @@ yarn add expo-server-sdk | ||
// documentation: | ||
// https://docs.expo.io/versions/latest/guides/push-notifications#response-format | ||
// https://docs.expo.io/versions/latest/guides/push-notifications#response-format | ||
} catch (error) { | ||
@@ -110,3 +112,3 @@ console.error(error); | ||
// The error codes are listed in the Expo documentation: | ||
// https://docs.expo.io/versions/latest/guides/push-notifications#response-format | ||
// https://docs.expo.io/versions/latest/guides/push-notifications#response-format | ||
// You must handle the errors appropriately. | ||
@@ -113,0 +115,0 @@ console.error(`The error code is ${receipt.details.error}`); |
@@ -85,5 +85,5 @@ /** | ||
let apiError: ExtensibleError = new Error( | ||
`Expected Expo to respond with ${messages.length} ${messages.length === 1 | ||
? 'ticket' | ||
: 'tickets'} but got ${data.length}` | ||
`Expected Expo to respond with ${messages.length} ${ | ||
messages.length === 1 ? 'ticket' : 'tickets' | ||
} but got ${data.length}` | ||
); | ||
@@ -153,3 +153,3 @@ apiError.data = data; | ||
'User-Agent': `expo-server-sdk-node/${sdkVersion}`, | ||
}) | ||
}); | ||
@@ -169,8 +169,10 @@ if (options.body != null) { | ||
let response = await this._limitConcurrentRequests(() => fetch(url, { | ||
method: options.httpMethod, | ||
body: requestBody, | ||
headers: requestHeaders, | ||
agent: this._httpAgent, | ||
})); | ||
let response = await this._limitConcurrentRequests(() => | ||
fetch(url, { | ||
method: options.httpMethod, | ||
body: requestBody, | ||
headers: requestHeaders, | ||
agent: this._httpAgent, | ||
}) | ||
); | ||
@@ -275,4 +277,4 @@ if (response.status !== 200) { | ||
export type ExpoClientOptions = { | ||
httpAgent?: Agent, | ||
maxConcurrentRequests?: number, | ||
httpAgent?: Agent; | ||
maxConcurrentRequests?: number; | ||
}; | ||
@@ -283,11 +285,19 @@ | ||
export type ExpoPushMessage = { | ||
to: ExpoPushToken, | ||
data?: Object, | ||
title?: string, | ||
body?: string, | ||
sound?: 'default' | null, | ||
ttl?: number, | ||
expiration?: number, | ||
priority?: 'default' | 'normal' | 'high', | ||
badge?: number, | ||
to: ExpoPushToken; | ||
data?: Object; | ||
title?: string; | ||
subtitle?: string; | ||
body?: string; | ||
sound?: | ||
| 'default' | ||
| null | ||
| { | ||
critical?: boolean; | ||
name?: 'default' | null; | ||
volume?: number; | ||
}; | ||
ttl?: number; | ||
expiration?: number; | ||
priority?: 'default' | 'normal' | 'high'; | ||
badge?: number; | ||
}; | ||
@@ -298,20 +308,20 @@ | ||
export type ExpoPushTicket = { | ||
id: ExpoPushReceiptId, | ||
id: ExpoPushReceiptId; | ||
}; | ||
type ExpoPushSuccessReceipt = { | ||
status: 'ok', | ||
details?: Object, | ||
status: 'ok'; | ||
details?: Object; | ||
// Internal field used only by developers working on Expo | ||
__debug?: any, | ||
__debug?: any; | ||
}; | ||
type ExpoPushErrorReceipt = { | ||
status: 'error', | ||
message: 'string', | ||
status: 'error'; | ||
message: string; | ||
details?: { | ||
error?: 'DeviceNotRegistered' | 'InvalidCredentials' | 'MessageTooBig' | 'MessageRateExceeded', | ||
}, | ||
error?: 'DeviceNotRegistered' | 'InvalidCredentials' | 'MessageTooBig' | 'MessageRateExceeded'; | ||
}; | ||
// Internal field used only by developers working on Expo | ||
__debug?: any, | ||
__debug?: any; | ||
}; | ||
@@ -322,17 +332,17 @@ | ||
type RequestOptions = { | ||
httpMethod: 'get' | 'post', | ||
body?: any, | ||
shouldCompress: (body: string) => boolean, | ||
httpMethod: 'get' | 'post'; | ||
body?: any; | ||
shouldCompress: (body: string) => boolean; | ||
}; | ||
type ApiResult = { | ||
errors?: ApiResultError[], | ||
data?: any, | ||
errors?: ApiResultError[]; | ||
data?: any; | ||
}; | ||
type ApiResultError = { | ||
message: string, | ||
code: string, | ||
details?: any, | ||
stack?: string, | ||
message: string; | ||
code: string; | ||
details?: any; | ||
stack?: string; | ||
}; | ||
@@ -339,0 +349,0 @@ |
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
39430
2
682
140
6
- Removed@types/invariant@^2.2.29
- Removed@types/node-fetch@^2.1.4
- Removed@types/invariant@2.2.37(transitive)
- Removed@types/node@22.9.0(transitive)
- Removed@types/node-fetch@2.6.12(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedform-data@4.0.1(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedundici-types@6.19.8(transitive)