Socket
Socket
Sign inDemoInstall

@bugsnag/delivery-expo

Package Overview
Dependencies
1
Maintainers
7
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

16

delivery.js

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

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

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

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

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

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

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

{
"name": "@bugsnag/delivery-expo",
"version": "7.0.0-pre-alpha-ben.5",
"version": "7.0.0-pre-alpha-ben.6",
"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.5"
"@bugsnag/core": "^7.0.0-pre-alpha-ben.6"
},

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

},
"gitHead": "eec4234333591b225ae4d8ad94c4adbf150e3972"
"gitHead": "2607f3de7d8c9bd06d8e3566e72cfef0b12708a5"
}

@@ -16,48 +16,11 @@ 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
* Ensure the persistent cache directory exists
*/
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 () {
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)
return exists && isDirectory
if (exists && isDirectory) return
await FileSystem.makeDirectoryAsync(this._path, { intermediates: true })
}

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc