@expo/push-errors 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,6 +48,7 @@ export declare enum PushErrorCodeType {
48
48
  MESSAGE_RATE_EXCEEDED = 5,
49
49
  INVALID_CREDENTIALS = 6
50
50
  }
51
- export declare const PushErrorCodes: Record<PushErrorCodeType, string>;
51
+ export declare type PushErrorCode = 'ExpoError' | 'ProviderError' | 'DeveloperError' | 'DeviceNotRegistered' | 'MessageTooBig' | 'MessageRateExceeded' | 'InvalidCredentials';
52
+ export declare const PushErrorCodes: Record<PushErrorCodeType, PushErrorCode>;
52
53
  export declare const PushErrorMessages: Record<PushErrorMessageType, string>;
53
54
  export declare function interpolateErrorMessage(message: string, params: (string | null)[]): string;
@@ -1 +1 @@
1
- {"version":3,"file":"PushErrors.js","sourceRoot":"","sources":["../src/PushErrors.ts"],"names":[],"mappings":";;;AAAA,IAAY,uBAoBX;AApBD,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yGAAsB,CAAA;IACtB,6FAAgB,CAAA;IAChB,iHAA0B,CAAA;IAC1B,6FAAgB,CAAA;IAChB,yFAAc,CAAA;IACd,qHAA4B,CAAA;IAC5B,yFAAc,CAAA;IACd,qGAAoB,CAAA;IACpB,qGAAoB,CAAA;IACpB,4FAAe,CAAA;IACf,8FAAgB,CAAA;IAChB,oFAAW,CAAA;IACX,oFAAW,CAAA;IACX,gHAAyB,CAAA;IACzB,sHAA4B,CAAA;IAC5B,8GAAwB,CAAA;IACxB,sGAAoB,CAAA;IACpB,gGAAiB,CAAA;AACnB,CAAC,EApBW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAoBlC;AAED,IAAY,uBAkBX;AAlBD,WAAY,uBAAuB;IACjC,kHAAgC,CAAA;IAChC,0GAAqB,CAAA;IACrB,oHAA0B,CAAA;IAC1B,oHAA0B,CAAA;IAC1B,oGAAkB,CAAA;IAClB,kHAAyB,CAAA;IACzB,sHAA2B,CAAA;IAC3B,sGAAmB,CAAA;IAC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C,EAAE,wLAAwL;IACzO,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,EAAE,oKAAoK;IACxN,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,EAAE,qJAAqJ;IACpM,CAAC,uBAAuB,CAAC,sCAAsC,CAAC,EAAE,wOAAwO;IAC1S,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,EAAE,wJAAwJ;IAC5M,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,4KAA4K;IAC7N,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,EAAE,oPAAoP;IAC5S,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,EAAE,2KAA2K;IAC1N,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,4DAA4D;CAChG,CAAC;AAEF,SAAgB,uBAAuB,CAAC,OAAe,EAAE,MAAyB;IAChF,MAAM,KAAK,GAAG,eAAe,CAAC;IAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC;AACvE,CAAC;AAHD,0DAGC","sourcesContent":["export enum FcmPushErrorMessageType {\n UNKNOWN = 0,\n UNABLE_TO_RETRIEVE_KEY,\n UNEXPECTED_ERROR,\n UNABLE_TO_RESOLVE_HOSTNAME,\n CONNECTION_RESET,\n MALFORMED_JSON,\n EXPECTED_EXACTLY_ONE_MESSAGE,\n NOT_REGISTERED,\n MISSING_REGISTRATION,\n INVALID_REGISTRATION,\n MESSAGE_TOO_BIG,\n INVALID_DATA_KEY,\n INVALID_TTL,\n UNAVAILABLE,\n FCM_INTERNAL_SERVER_ERROR,\n DEVICE_MESSAGE_RATE_EXCEEDED,\n UNKNOWN_FCM_SERVER_ERROR,\n AUTHENTICATION_ERROR,\n MALFORMED_REQUEST,\n}\n\nexport enum ApnPushErrorMessageType {\n ALERT_CERTIFICATE_REVOKED = 1000,\n SSL_HANDSHAKE_FAILURE,\n APNS_INTERNAL_SERVER_ERROR,\n APNS_TERMINATED_CONNECTION,\n APNS_STREAM_BROKEN,\n UNEXPECTED_INTERNAL_ERROR,\n FAILED_TO_SEND_NOTIFICATION,\n MISSING_CREDENTIALS,\n MALFORMED_PRIVATE_KEY,\n INVALID_PRIVATE_KEY_TYPE,\n EXPIRED_CREDENTIALS,\n CREDENTIALS_DO_NOT_SUPPORT_ENVIRONMENT,\n CERTIFICATE_KEY_MISMATCH,\n MALFORMED_CERTIFICATE,\n MISSING_CERTIFICATE_PASSWORD,\n MISSING_CERTIFICATE,\n UNKNOWN,\n}\n\nexport type PushErrorMessageType = FcmPushErrorMessageType | ApnPushErrorMessageType;\n\nexport enum PushErrorCodeType {\n EXPO_ERROR = 0,\n PROVIDER_ERROR,\n DEVELOPER_ERROR,\n DEVICE_NOT_REGISTERED,\n MESSAGE_TOO_BIG,\n MESSAGE_RATE_EXCEEDED,\n INVALID_CREDENTIALS,\n}\n\nexport const PushErrorCodes: Record<PushErrorCodeType, string> = {\n [PushErrorCodeType.EXPO_ERROR]: 'ExpoError',\n [PushErrorCodeType.PROVIDER_ERROR]: 'ProviderError',\n [PushErrorCodeType.DEVELOPER_ERROR]: 'DeveloperError',\n [PushErrorCodeType.DEVICE_NOT_REGISTERED]: 'DeviceNotRegistered',\n [PushErrorCodeType.MESSAGE_TOO_BIG]: 'MessageTooBig',\n [PushErrorCodeType.MESSAGE_RATE_EXCEEDED]: 'MessageRateExceeded',\n [PushErrorCodeType.INVALID_CREDENTIALS]: 'InvalidCredentials',\n};\n\nexport const PushErrorMessages: Record<PushErrorMessageType, string> = {\n [FcmPushErrorMessageType.UNKNOWN]: `Received an unknown error from FCM. See this error details for more information.`,\n [FcmPushErrorMessageType.UNABLE_TO_RETRIEVE_KEY]: `Unable to retrieve the FCM server key for the recipient's app. Make sure you have provided a server key as directed by the Expo FCM documentation.`,\n [FcmPushErrorMessageType.UNEXPECTED_ERROR]: `There was an unexpected error delivering the notification.`,\n [FcmPushErrorMessageType.UNABLE_TO_RESOLVE_HOSTNAME]:\n 'Could not resolve the FCM API server hostname. Please try again.',\n [FcmPushErrorMessageType.CONNECTION_RESET]:\n 'Connection to FCM API server reset. Please try again.',\n [FcmPushErrorMessageType.MALFORMED_JSON]:\n 'The FCM server responded with a malformed JSON string.',\n [FcmPushErrorMessageType.EXPECTED_EXACTLY_ONE_MESSAGE]: `Expected FCM to have processed exactly one message`,\n [FcmPushErrorMessageType.NOT_REGISTERED]: 'The recipient device is not registered with FCM.',\n [FcmPushErrorMessageType.MISSING_REGISTRATION]: 'The native FCM device token was not specified.',\n [FcmPushErrorMessageType.INVALID_REGISTRATION]: 'The native FCM device token was malformed.',\n [FcmPushErrorMessageType.MESSAGE_TOO_BIG]: `The notification payload was too big and exceeded the 4KiB limit.`,\n [FcmPushErrorMessageType.INVALID_DATA_KEY]: `There was an invalid key in the notification payload.`,\n [FcmPushErrorMessageType.INVALID_TTL]: `There was an invalid TTL in the notification payload. The TTL must be between zero seconds and four weeks.`,\n [FcmPushErrorMessageType.UNAVAILABLE]: `The FCM service is currently unavailable. This is likely not an error with your code nor Expo. Try re-sending the notification later.`,\n [FcmPushErrorMessageType.FCM_INTERNAL_SERVER_ERROR]: `There was an internal error with the FCM server. This is likely not an issue with your code nor Expo. Try re-sending the notification later.`,\n [FcmPushErrorMessageType.DEVICE_MESSAGE_RATE_EXCEEDED]: `The rate of notifications to this device is too high. Try re-sending the notification later.`,\n [FcmPushErrorMessageType.UNKNOWN_FCM_SERVER_ERROR]: `There was an unknown error with the FCM server. See this error's details for more information.`,\n [FcmPushErrorMessageType.AUTHENTICATION_ERROR]: `Failed to authenticate with the FCM server. Ensure the FCM server key you uploaded is correct.`,\n [FcmPushErrorMessageType.MALFORMED_REQUEST]: `The request sent to the server was malformed or contained invalid parameters.`,\n [ApnPushErrorMessageType.ALERT_CERTIFICATE_REVOKED]: `The certificate to connect to the Apple Push Notification service for this app has been revoked.`,\n [ApnPushErrorMessageType.SSL_HANDSHAKE_FAILURE]: `Expo was unable to establish a secure connection to the Apple Push Notification service. This potentially is due to an invalid APNs certificate or token for your Apple developer account; if you have provided your own APNs certificate or token, carefully verify that it is for production and is in the format Expo expects.`,\n [ApnPushErrorMessageType.APNS_INTERNAL_SERVER_ERROR]: `The Apple Push Notification service experienced an internal server error. Retry sending the notification later.`,\n [ApnPushErrorMessageType.APNS_TERMINATED_CONNECTION]: `The Apple Push Notification service dropped the connection. Retry sending the notification later.`,\n [ApnPushErrorMessageType.APNS_STREAM_BROKEN]: `The Apple Push Notification service unexpectedly dropped the connection. Retry sending the notification later. If this error recurs very frequently, there is likely an issue with your Apple push notification credentials.`,\n [ApnPushErrorMessageType.UNEXPECTED_INTERNAL_ERROR]: `There was an unexpected internal error delivering the notification.`,\n [ApnPushErrorMessageType.FAILED_TO_SEND_NOTIFICATION]: `The Apple Push Notification service failed to send the notification (reason: {0}, status code: {1}). Read Apple's docs about \"Communicating with APNs\" to learn what this error means.`,\n [ApnPushErrorMessageType.MISSING_CREDENTIALS]: `{0}. Check whether you are trying to send a notification to a bare app. If this is an ad hoc Expo Client, please see https://docs.expo.dev/versions/latest/guides/adhoc-builds/#push-notifications-arent-working for more information.`,\n [ApnPushErrorMessageType.MALFORMED_PRIVATE_KEY]: `The Apple Push Notification service key for your account could not be loaded, likely due to a malformed p8 file. Expo needs a valid PEM key in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.INVALID_PRIVATE_KEY_TYPE]: `The Apple Push Notification service key for your account could not be loaded, likely due to a key of the wrong type. Ensure your push key is a p8 file from Apple.`,\n [ApnPushErrorMessageType.EXPIRED_CREDENTIALS]: `The Apple Push Notification service credentials for your app have expired: {0}. Clear and create new credentials or upload new credentials to Expo.`,\n [ApnPushErrorMessageType.CREDENTIALS_DO_NOT_SUPPORT_ENVIRONMENT]: `The certificate to connect to the Apple Push Notification service for this app does not match the environment for your app ({0}). Expo needs valid certificates for the correct environment in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.CERTIFICATE_KEY_MISMATCH]: `The Apple Push Notification certificate and key in your p12 file do not match. Expo needs valid credentials in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.MALFORMED_CERTIFICATE]: `The Apple Push Notification service credentials for your app could not be loaded. Expo needs certificates in the correct format in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.MISSING_CERTIFICATE_PASSWORD]: `The Apple Push Notification service credentials for your app could not be loaded ({0}) , likely due to a password-protected certificate that cannot be decrypted. Try using the latest Expo developer tools to create and upload your credentials.`,\n [ApnPushErrorMessageType.MISSING_CERTIFICATE]: `The Apple Push Notification service credentials for your app do not contain a valid certificate. Expo needs valid certificates in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.UNKNOWN]: `There was an unexpected error delivering the notification.`,\n};\n\nexport function interpolateErrorMessage(message: string, params: (string | null)[]): string {\n const regex = /\\{([0-9]+)\\}/g;\n return message.replace(regex, (_, index) => params[index] ?? 'null');\n}\n"]}
1
+ {"version":3,"file":"PushErrors.js","sourceRoot":"","sources":["../src/PushErrors.ts"],"names":[],"mappings":";;;AAAA,IAAY,uBAoBX;AApBD,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yGAAsB,CAAA;IACtB,6FAAgB,CAAA;IAChB,iHAA0B,CAAA;IAC1B,6FAAgB,CAAA;IAChB,yFAAc,CAAA;IACd,qHAA4B,CAAA;IAC5B,yFAAc,CAAA;IACd,qGAAoB,CAAA;IACpB,qGAAoB,CAAA;IACpB,4FAAe,CAAA;IACf,8FAAgB,CAAA;IAChB,oFAAW,CAAA;IACX,oFAAW,CAAA;IACX,gHAAyB,CAAA;IACzB,sHAA4B,CAAA;IAC5B,8GAAwB,CAAA;IACxB,sGAAoB,CAAA;IACpB,gGAAiB,CAAA;AACnB,CAAC,EApBW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAoBlC;AAED,IAAY,uBAkBX;AAlBD,WAAY,uBAAuB;IACjC,kHAAgC,CAAA;IAChC,0GA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uBAAuB,CAAC,2BAA2B,CAAC,EAAE,wLAAwL;IAC/O,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,EAAE,wOAAwO;IACvR,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,wLAAwL;IACzO,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,EAAE,oKAAoK;IACxN,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,EAAE,qJAAqJ;IACpM,CAAC,uBAAuB,CAAC,sCAAsC,CAAC,EAAE,wOAAwO;IAC1S,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,EAAE,wJAAwJ;IAC5M,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,4KAA4K;IAC7N,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,EAAE,oPAAoP;IAC5S,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,EAAE,2KAA2K;IAC1N,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,4DAA4D;CAChG,CAAC;AAEF,SAAgB,uBAAuB,CAAC,OAAe,EAAE,MAAyB;IAChF,MAAM,KAAK,GAAG,eAAe,CAAC;IAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC;AACvE,CAAC;AAHD,0DAGC","sourcesContent":["export enum FcmPushErrorMessageType {\n UNKNOWN = 0,\n UNABLE_TO_RETRIEVE_KEY,\n UNEXPECTED_ERROR,\n UNABLE_TO_RESOLVE_HOSTNAME,\n CONNECTION_RESET,\n MALFORMED_JSON,\n EXPECTED_EXACTLY_ONE_MESSAGE,\n NOT_REGISTERED,\n MISSING_REGISTRATION,\n INVALID_REGISTRATION,\n MESSAGE_TOO_BIG,\n INVALID_DATA_KEY,\n INVALID_TTL,\n UNAVAILABLE,\n FCM_INTERNAL_SERVER_ERROR,\n DEVICE_MESSAGE_RATE_EXCEEDED,\n UNKNOWN_FCM_SERVER_ERROR,\n AUTHENTICATION_ERROR,\n MALFORMED_REQUEST,\n}\n\nexport enum ApnPushErrorMessageType {\n ALERT_CERTIFICATE_REVOKED = 1000,\n SSL_HANDSHAKE_FAILURE,\n APNS_INTERNAL_SERVER_ERROR,\n APNS_TERMINATED_CONNECTION,\n APNS_STREAM_BROKEN,\n UNEXPECTED_INTERNAL_ERROR,\n FAILED_TO_SEND_NOTIFICATION,\n MISSING_CREDENTIALS,\n MALFORMED_PRIVATE_KEY,\n INVALID_PRIVATE_KEY_TYPE,\n EXPIRED_CREDENTIALS,\n CREDENTIALS_DO_NOT_SUPPORT_ENVIRONMENT,\n CERTIFICATE_KEY_MISMATCH,\n MALFORMED_CERTIFICATE,\n MISSING_CERTIFICATE_PASSWORD,\n MISSING_CERTIFICATE,\n UNKNOWN,\n}\n\nexport type PushErrorMessageType = FcmPushErrorMessageType | ApnPushErrorMessageType;\n\nexport enum PushErrorCodeType {\n EXPO_ERROR = 0,\n PROVIDER_ERROR,\n DEVELOPER_ERROR,\n DEVICE_NOT_REGISTERED,\n MESSAGE_TOO_BIG,\n MESSAGE_RATE_EXCEEDED,\n INVALID_CREDENTIALS,\n}\n\nexport type PushErrorCode =\n | 'ExpoError'\n | 'ProviderError'\n | 'DeveloperError'\n | 'DeviceNotRegistered'\n | 'MessageTooBig'\n | 'MessageRateExceeded'\n | 'InvalidCredentials';\n\nexport const PushErrorCodes: Record<PushErrorCodeType, PushErrorCode> = {\n [PushErrorCodeType.EXPO_ERROR]: 'ExpoError',\n [PushErrorCodeType.PROVIDER_ERROR]: 'ProviderError',\n [PushErrorCodeType.DEVELOPER_ERROR]: 'DeveloperError',\n [PushErrorCodeType.DEVICE_NOT_REGISTERED]: 'DeviceNotRegistered',\n [PushErrorCodeType.MESSAGE_TOO_BIG]: 'MessageTooBig',\n [PushErrorCodeType.MESSAGE_RATE_EXCEEDED]: 'MessageRateExceeded',\n [PushErrorCodeType.INVALID_CREDENTIALS]: 'InvalidCredentials',\n};\n\nexport const PushErrorMessages: Record<PushErrorMessageType, string> = {\n [FcmPushErrorMessageType.UNKNOWN]: `Received an unknown error from FCM. See this error details for more information.`,\n [FcmPushErrorMessageType.UNABLE_TO_RETRIEVE_KEY]: `Unable to retrieve the FCM server key for the recipient's app. Make sure you have provided a server key as directed by the Expo FCM documentation.`,\n [FcmPushErrorMessageType.UNEXPECTED_ERROR]: `There was an unexpected error delivering the notification.`,\n [FcmPushErrorMessageType.UNABLE_TO_RESOLVE_HOSTNAME]:\n 'Could not resolve the FCM API server hostname. Please try again.',\n [FcmPushErrorMessageType.CONNECTION_RESET]:\n 'Connection to FCM API server reset. Please try again.',\n [FcmPushErrorMessageType.MALFORMED_JSON]:\n 'The FCM server responded with a malformed JSON string.',\n [FcmPushErrorMessageType.EXPECTED_EXACTLY_ONE_MESSAGE]: `Expected FCM to have processed exactly one message`,\n [FcmPushErrorMessageType.NOT_REGISTERED]: 'The recipient device is not registered with FCM.',\n [FcmPushErrorMessageType.MISSING_REGISTRATION]: 'The native FCM device token was not specified.',\n [FcmPushErrorMessageType.INVALID_REGISTRATION]: 'The native FCM device token was malformed.',\n [FcmPushErrorMessageType.MESSAGE_TOO_BIG]: `The notification payload was too big and exceeded the 4KiB limit.`,\n [FcmPushErrorMessageType.INVALID_DATA_KEY]: `There was an invalid key in the notification payload.`,\n [FcmPushErrorMessageType.INVALID_TTL]: `There was an invalid TTL in the notification payload. The TTL must be between zero seconds and four weeks.`,\n [FcmPushErrorMessageType.UNAVAILABLE]: `The FCM service is currently unavailable. This is likely not an error with your code nor Expo. Try re-sending the notification later.`,\n [FcmPushErrorMessageType.FCM_INTERNAL_SERVER_ERROR]: `There was an internal error with the FCM server. This is likely not an issue with your code nor Expo. Try re-sending the notification later.`,\n [FcmPushErrorMessageType.DEVICE_MESSAGE_RATE_EXCEEDED]: `The rate of notifications to this device is too high. Try re-sending the notification later.`,\n [FcmPushErrorMessageType.UNKNOWN_FCM_SERVER_ERROR]: `There was an unknown error with the FCM server. See this error's details for more information.`,\n [FcmPushErrorMessageType.AUTHENTICATION_ERROR]: `Failed to authenticate with the FCM server. Ensure the FCM server key you uploaded is correct.`,\n [FcmPushErrorMessageType.MALFORMED_REQUEST]: `The request sent to the server was malformed or contained invalid parameters.`,\n [ApnPushErrorMessageType.ALERT_CERTIFICATE_REVOKED]: `The certificate to connect to the Apple Push Notification service for this app has been revoked.`,\n [ApnPushErrorMessageType.SSL_HANDSHAKE_FAILURE]: `Expo was unable to establish a secure connection to the Apple Push Notification service. This potentially is due to an invalid APNs certificate or token for your Apple developer account; if you have provided your own APNs certificate or token, carefully verify that it is for production and is in the format Expo expects.`,\n [ApnPushErrorMessageType.APNS_INTERNAL_SERVER_ERROR]: `The Apple Push Notification service experienced an internal server error. Retry sending the notification later.`,\n [ApnPushErrorMessageType.APNS_TERMINATED_CONNECTION]: `The Apple Push Notification service dropped the connection. Retry sending the notification later.`,\n [ApnPushErrorMessageType.APNS_STREAM_BROKEN]: `The Apple Push Notification service unexpectedly dropped the connection. Retry sending the notification later. If this error recurs very frequently, there is likely an issue with your Apple push notification credentials.`,\n [ApnPushErrorMessageType.UNEXPECTED_INTERNAL_ERROR]: `There was an unexpected internal error delivering the notification.`,\n [ApnPushErrorMessageType.FAILED_TO_SEND_NOTIFICATION]: `The Apple Push Notification service failed to send the notification (reason: {0}, status code: {1}). Read Apple's docs about \"Communicating with APNs\" to learn what this error means.`,\n [ApnPushErrorMessageType.MISSING_CREDENTIALS]: `{0}. Check whether you are trying to send a notification to a bare app. If this is an ad hoc Expo Client, please see https://docs.expo.dev/versions/latest/guides/adhoc-builds/#push-notifications-arent-working for more information.`,\n [ApnPushErrorMessageType.MALFORMED_PRIVATE_KEY]: `The Apple Push Notification service key for your account could not be loaded, likely due to a malformed p8 file. Expo needs a valid PEM key in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.INVALID_PRIVATE_KEY_TYPE]: `The Apple Push Notification service key for your account could not be loaded, likely due to a key of the wrong type. Ensure your push key is a p8 file from Apple.`,\n [ApnPushErrorMessageType.EXPIRED_CREDENTIALS]: `The Apple Push Notification service credentials for your app have expired: {0}. Clear and create new credentials or upload new credentials to Expo.`,\n [ApnPushErrorMessageType.CREDENTIALS_DO_NOT_SUPPORT_ENVIRONMENT]: `The certificate to connect to the Apple Push Notification service for this app does not match the environment for your app ({0}). Expo needs valid certificates for the correct environment in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.CERTIFICATE_KEY_MISMATCH]: `The Apple Push Notification certificate and key in your p12 file do not match. Expo needs valid credentials in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.MALFORMED_CERTIFICATE]: `The Apple Push Notification service credentials for your app could not be loaded. Expo needs certificates in the correct format in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.MISSING_CERTIFICATE_PASSWORD]: `The Apple Push Notification service credentials for your app could not be loaded ({0}) , likely due to a password-protected certificate that cannot be decrypted. Try using the latest Expo developer tools to create and upload your credentials.`,\n [ApnPushErrorMessageType.MISSING_CERTIFICATE]: `The Apple Push Notification service credentials for your app do not contain a valid certificate. Expo needs valid certificates in order to deliver notifications to APNs.`,\n [ApnPushErrorMessageType.UNKNOWN]: `There was an unexpected error delivering the notification.`,\n};\n\nexport function interpolateErrorMessage(message: string, params: (string | null)[]): string {\n const regex = /\\{([0-9]+)\\}/g;\n return message.replace(regex, (_, index) => params[index] ?? 'null');\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/push-errors",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Contains type definitions and helper functions related to writing and reading push receipts.",
5
5
  "main": "build/PushErrors.js",
6
6
  "files": [
@@ -8,9 +8,11 @@
8
8
  ],
9
9
  "scripts": {
10
10
  "build": "tsc",
11
- "test": "jest --passWithNoTests",
11
+ "clean": "rm -rf ./build",
12
12
  "lint": "eslint src",
13
- "prettier": "prettier --write 'src/**/*.ts'"
13
+ "prepare": "yarn clean && yarn build",
14
+ "prettier": "prettier --write 'src/**/*.ts'",
15
+ "test": "jest --passWithNoTests"
14
16
  },
15
17
  "author": "Expo",
16
18
  "license": "MIT",