Socket
Socket
Sign inDemoInstall

@availity/api-core

Package Overview
Dependencies
Maintainers
13
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@availity/api-core - npm Package Compare versions

Comparing version 6.0.3 to 6.0.4-alpha.0

src/flattenObject.js

4

package.json
{
"name": "@availity/api-core",
"version": "6.0.3",
"version": "6.0.4-alpha.0+9350765",
"description": "Base API definitions for the Availity REST API",

@@ -24,3 +24,3 @@ "keywords": [

},
"gitHead": "c21c54fe3e92327f06069597a26ecc691b266b54"
"gitHead": "93507657b78a68ff431e92f0bd3336b74e2199c4"
}

@@ -197,2 +197,25 @@ import * as avLocalStorage from '@availity/localstorage-core';

sendBeacon(data, config) {
if (!data) {
throw new Error('called method without [data]');
}
config = this.config(config);
config.method = 'POST';
config.url = this.getUrl(config);
config.data = data;
const beforeFunc = this.beforeCreate || this.beforePost;
if (beforeFunc) {
config.data = beforeFunc(config.data);
}
if (navigator.sendBeacon) {
const result = navigator.sendBeacon(config.url, config.data);
// A truthy return value from navigator.sendBeacon means the browser successfully queued the request
if (result) return this.Promise.resolve();
}
// Fall back to XHR if browser does not support navigator.sendBeacon or browser fails to queue the request
return this.request(config, this.afterCreate || this.afterPost);
}
post(data, config) {

@@ -199,0 +222,0 @@ return this.create(data, config);

import AvApi from '../api';
import flattenObject from '../flattenObject';

@@ -19,20 +20,25 @@ export default class AvLogMessages extends AvApi {

delete entries.level;
return { level, entries };
const payload = { level, entries };
const flattened = flattenObject(payload);
return Object.keys(flattened).reduce((accum, key) => {
accum.append(key, flattened[key]);
return accum;
}, new FormData());
}
debug(entries) {
return this.create(this.send('debug', entries));
return this.sendBeacon(this.send('debug', entries));
}
info(entries) {
return this.create(this.send('info', entries));
return this.sendBeacon(this.send('info', entries));
}
warn(entries) {
return this.create(this.send('warn', entries));
return this.sendBeacon(this.send('warn', entries));
}
error(entries) {
return this.create(this.send('error', entries));
return this.sendBeacon(this.send('error', entries));
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc