expo-server-sdk
Advanced tools
Comparing version 3.9.0 to 3.10.0
@@ -48,3 +48,3 @@ /// <reference types="node" /> | ||
export default Expo; | ||
export declare type ExpoClientOptions = { | ||
export type ExpoClientOptions = { | ||
httpAgent?: Agent; | ||
@@ -55,4 +55,4 @@ maxConcurrentRequests?: number; | ||
}; | ||
export declare type ExpoPushToken = string; | ||
export declare type ExpoPushMessage = { | ||
export type ExpoPushToken = string; | ||
export type ExpoPushMessage = { | ||
to: ExpoPushToken | ExpoPushToken[]; | ||
@@ -76,10 +76,10 @@ data?: object; | ||
}; | ||
export declare type ExpoPushReceiptId = string; | ||
export declare type ExpoPushSuccessTicket = { | ||
export type ExpoPushReceiptId = string; | ||
export type ExpoPushSuccessTicket = { | ||
status: 'ok'; | ||
id: ExpoPushReceiptId; | ||
}; | ||
export declare type ExpoPushErrorTicket = ExpoPushErrorReceipt; | ||
export declare type ExpoPushTicket = ExpoPushSuccessTicket | ExpoPushErrorTicket; | ||
export declare type ExpoPushSuccessReceipt = { | ||
export type ExpoPushErrorTicket = ExpoPushErrorReceipt; | ||
export type ExpoPushTicket = ExpoPushSuccessTicket | ExpoPushErrorTicket; | ||
export type ExpoPushSuccessReceipt = { | ||
status: 'ok'; | ||
@@ -89,3 +89,3 @@ details?: object; | ||
}; | ||
export declare type ExpoPushErrorReceipt = { | ||
export type ExpoPushErrorReceipt = { | ||
status: 'error'; | ||
@@ -98,2 +98,2 @@ message: string; | ||
}; | ||
export declare type ExpoPushReceipt = ExpoPushSuccessReceipt | ExpoPushErrorReceipt; | ||
export type ExpoPushReceipt = ExpoPushSuccessReceipt | ExpoPushErrorReceipt; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -39,3 +43,4 @@ if (k2 === undefined) k2 = k; | ||
* Use this if you are running Node on your server backend when you are working with Expo | ||
* https://expo.io | ||
* Application Services | ||
* https://expo.dev | ||
*/ | ||
@@ -67,3 +72,3 @@ const assert_1 = __importDefault(require("assert")); | ||
this.httpAgent = options.httpAgent; | ||
this.limitConcurrentRequests = promise_limit_1.default(options.maxConcurrentRequests != null | ||
this.limitConcurrentRequests = (0, promise_limit_1.default)(options.maxConcurrentRequests != null | ||
? options.maxConcurrentRequests | ||
@@ -96,10 +101,9 @@ : DEFAULT_CONCURRENT_REQUEST_LIMIT); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// @ts-expect-error We don't yet have type declarations for URL | ||
const url = new URL(`${BASE_API_URL}/push/send`); | ||
if (typeof this.useFcmV1 === 'boolean') { | ||
url.searchParams.append('useFcmV1', this.useFcmV1); | ||
url.searchParams.append('useFcmV1', String(this.useFcmV1)); | ||
} | ||
const actualMessagesCount = Expo._getActualMessageCount(messages); | ||
const data = yield this.limitConcurrentRequests(() => __awaiter(this, void 0, void 0, function* () { | ||
return yield promise_retry_1.default((retry) => __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, promise_retry_1.default)((retry) => __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
@@ -227,3 +231,3 @@ return yield this.requestAsync(url.toString(), { | ||
const json = JSON.stringify(options.body); | ||
assert_1.default(json != null, `JSON request body must not be null`); | ||
(0, assert_1.default)(json != null, `JSON request body must not be null`); | ||
if (options.shouldCompress(json)) { | ||
@@ -238,3 +242,3 @@ requestBody = yield gzipAsync(Buffer.from(json)); | ||
} | ||
const response = yield node_fetch_1.default(url, { | ||
const response = yield (0, node_fetch_1.default)(url, { | ||
method: options.httpMethod, | ||
@@ -255,3 +259,3 @@ body: requestBody, | ||
} | ||
catch (e) { | ||
catch (_a) { | ||
const apiError = yield this.getTextResponseErrorAsync(response, textBody); | ||
@@ -274,3 +278,3 @@ throw apiError; | ||
} | ||
catch (e) { | ||
catch (_a) { | ||
return yield this.getTextResponseErrorAsync(response, textBody); | ||
@@ -299,3 +303,3 @@ } | ||
getErrorFromResult(response, result) { | ||
assert_1.default(result.errors && result.errors.length > 0, `Expected at least one error from Expo`); | ||
(0, assert_1.default)(result.errors && result.errors.length > 0, `Expected at least one error from Expo`); | ||
const [errorData, ...otherErrorData] = result.errors; | ||
@@ -302,0 +306,0 @@ const error = this.getErrorFromResultError(errorData); |
{ | ||
"name": "expo-server-sdk", | ||
"version": "3.9.0", | ||
"version": "3.10.0", | ||
"description": "Server-side library for working with Expo using Node.js", | ||
@@ -35,3 +35,3 @@ "main": "build/ExpoClient.js", | ||
], | ||
"author": "support@expo.io", | ||
"author": "support@expo.dev", | ||
"license": "MIT", | ||
@@ -48,13 +48,13 @@ "bugs": { | ||
"devDependencies": { | ||
"@types/jest": "^27.0.1", | ||
"@types/node-fetch": "^2.5.12", | ||
"@types/promise-retry": "^1.1.3", | ||
"eslint": "^7.32.0", | ||
"eslint-config-universe": "^7.0.1", | ||
"@types/jest": "^29.5.12", | ||
"@types/node-fetch": "^2.6.11", | ||
"@types/promise-retry": "^1.1.6", | ||
"eslint": "^8.57.0", | ||
"eslint-config-universe": "^12.0.0", | ||
"fetch-mock": "^9.11.0", | ||
"jest": "^27.0.6", | ||
"prettier": "^2.3.2", | ||
"ts-jest": "~27.0.5", | ||
"typescript": "^4.3.5" | ||
"jest": "^29.7.0", | ||
"prettier": "^3.2.5", | ||
"ts-jest": "~29.1.2", | ||
"typescript": "^5.4.2" | ||
} | ||
} |
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
35183
447