Socket
Socket
Sign inDemoInstall

@bugsnag/delivery-expo

Package Overview
Dependencies
Maintainers
7
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bugsnag/delivery-expo - npm Package Compare versions

Comparing version 7.0.0-pre-alpha-ben.4 to 7.0.0-pre-alpha-ben.5

16

delivery.js

@@ -36,3 +36,3 @@ const payload = require('@bugsnag/core/lib/json-payload')

const { queues, queueConsumers } = initRedelivery(networkStatus, logError, send)
const { queues, queueConsumers } = initRedelivery(networkStatus, client._logger, send)

@@ -102,11 +102,13 @@ return {

const initRedelivery = (networkStatus, onerror, send) => {
const initRedelivery = (networkStatus, logger, send) => {
const onQueueError = e => logger.error('UndeliveredPayloadQueue error', e)
const queues = {
'report': new UndeliveredPayloadQueue('report', onerror),
'session': new UndeliveredPayloadQueue('session', onerror)
'report': new UndeliveredPayloadQueue('report', onQueueError),
'session': new UndeliveredPayloadQueue('session', onQueueError)
}
const onLoopError = e => logger.error('RedeliveryLoop error', e)
const queueConsumers = {
'report': new RedeliveryLoop(send, queues.report, onerror),
'session': new RedeliveryLoop(send, queues.session, onerror)
'report': new RedeliveryLoop(send, queues.report, onLoopError),
'session': new RedeliveryLoop(send, queues.session, onLoopError)
}

@@ -126,3 +128,3 @@

})
.catch(onerror)
.catch(onQueueError)

@@ -129,0 +131,0 @@ return { queues, queueConsumers }

{
"name": "@bugsnag/delivery-expo",
"version": "7.0.0-pre-alpha-ben.4",
"version": "7.0.0-pre-alpha-ben.5",
"main": "delivery.js",

@@ -23,3 +23,3 @@ "description": "@bugsnag/js delivery mechanism to send reports from Expo, using the FileSystem API to cache and retry sending failed reports",

"dependencies": {
"@bugsnag/core": "^7.0.0-pre-alpha-ben.4"
"@bugsnag/core": "^7.0.0-pre-alpha-ben.5"
},

@@ -32,3 +32,3 @@ "devDependencies": {

},
"gitHead": "475db88ddd9c33acf8a66a29507c379608e71421"
"gitHead": "eec4234333591b225ae4d8ad94c4adbf150e3972"
}

@@ -16,11 +16,48 @@ const { FileSystem } = require('expo')

this._truncating = false
this._initCall = null
}
/*
* Calls _init(), ensuring it only does that task once returning
* the same promise to each concurrent caller
*/
async init () {
// we don't want multiple calls to init() to incur multiple attempts at creating
// the directory, so we assign the existing _init() call
if (this._initCall) return this._initCall
this._initCall = this._init()
.then(() => { this._initCall = null })
.catch(e => {
this._initCall = null
throw e
})
return this._initCall
}
/*
* Ensure the persistent cache directory exists
*/
async init () {
async _init () {
if (await this._checkCacheDirExists()) return
try {
await FileSystem.makeDirectoryAsync(this._path, { intermediates: true })
} catch (e) {
// Expo has a bug where `makeDirectoryAsync` can error, even though it succesfully
// created the directory. See:
// https://github.com/expo/expo/issues/2050
// https://forums.expo.io/t/makedirectoryasync-error-could-not-be-created/11916
//
// To tolerate this, after getting an error, we check whether the directory
// now exist, swallowing the error if so, rethrowing if not.
if (await this._checkCacheDirExists()) return
throw e
}
}
/*
* Check if the cache directory exists
*/
async _checkCacheDirExists () {
const { exists, isDirectory } = await FileSystem.getInfoAsync(this._path)
if (exists && isDirectory) return
await FileSystem.makeDirectoryAsync(this._path, { intermediates: true })
return exists && isDirectory
}

@@ -27,0 +64,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc