UNPKG

apns2

Version:

Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.

56 lines (55 loc) 1.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApnsError = exports.Errors = void 0; exports.Errors = { badCertificate: "BadCertificate", badCertificateEnvironment: "BadCertificateEnvironment", badCollapseId: "BadCollapseId", badDeviceToken: "BadDeviceToken", badExpirationDate: "BadExpirationDate", badMessageId: "BadMessageId", badPath: "BadPath", badPriority: "BadPriority", badTopic: "BadTopic", deviceTokenNotForTopic: "DeviceTokenNotForTopic", duplicateHeaders: "DuplicateHeaders", error: "Error", expiredProviderToken: "ExpiredProviderToken", forbidden: "Forbidden", idleTimeout: "IdleTimeout", internalServerError: "InternalServerError", invalidProviderToken: "InvalidProviderToken", invalidPushType: "InvalidPushType", invalidSigningKey: "InvalidSigningKey", methodNotAllowed: "MethodNotAllowed", missingDeviceToken: "MissingDeviceToken", missingProviderToken: "MissingProviderToken", missingTopic: "MissingTopic", payloadEmpty: "PayloadEmpty", payloadTooLarge: "PayloadTooLarge", serviceUnavailable: "ServiceUnavailable", shutdown: "Shutdown", tooManyProviderTokenUpdates: "TooManyProviderTokenUpdates", tooManyRequests: "TooManyRequests", topicDisallowed: "TopicDisallowed", unknownError: "UnknownError", unregistered: "Unregistered", }; class ApnsError extends Error { statusCode; notification; response; constructor(props) { super(`APNS Error: ${props.statusCode} - ${props.response.reason}`); this.statusCode = props.statusCode; this.notification = props.notification; this.response = props.response; } get reason() { return this.response.reason; } get timestamp() { return this.response.timestamp; } } exports.ApnsError = ApnsError;