Socket
Socket
Sign inDemoInstall

dispatch-node-sdk

Package Overview
Dependencies
7
Maintainers
4
Versions
148
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.5.1 to 3.6.0

package-lock.json

2

dist/lib/bookingService.js

@@ -20,3 +20,3 @@ 'use strict';

bookNewOffer: function bookNewOffer(offerData) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var accountId = offerData.accountId;

@@ -23,0 +23,0 @@ var data = offerData.data;

@@ -59,3 +59,3 @@ 'use strict';

value: function setForEntity(entityType, entityID, config) {
var overwrite = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var overwrite = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];

@@ -62,0 +62,0 @@ return this.client.doAuthenticatedRequest('POST', '/config/' + entityType + '/' + entityID, {

@@ -117,3 +117,3 @@ 'use strict';

function Dispatch(clientID, clientSecret) {
var host = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'https://api.dispatch.me';
var host = arguments.length <= 2 || arguments[2] === undefined ? 'https://api.dispatch.me' : arguments[2];

@@ -169,5 +169,5 @@ _classCallCheck(this, Dispatch);

/**
* Adds a callback to run when bearer token changes
* Adds a callback function to every api request
*
* @param {Function} callback
* @param {Function} action
*/

@@ -177,2 +177,14 @@

_createClass(Dispatch, [{
key: 'setAuditAction',
value: function setAuditAction(action) {
this.auditAction = action;
}
/**
* Adds a callback to run when bearer token changes
*
* @param {Function} callback
*/
}, {
key: 'onBearerToken',

@@ -198,2 +210,3 @@ value: function onBearerToken(callback) {

this.noAuthClient = new _rawClient2.default({
auditAction: this.auditAction,
authMode: _rawClient.AUTH_MODE_NONE,

@@ -218,5 +231,7 @@ host: this.host

this.authClient = new _rawClient2.default({
auditAction: this.auditAction,
authMode: _rawClient.AUTH_MODE_BEARER,
bearerToken: this.bearerToken,
host: this.host
});

@@ -267,2 +282,3 @@ }

this.auxiliaryClients[serviceName] = new _rawClient2.default({
auditAction: this.auditAction,
authMode: _rawClient.AUTH_MODE_BEARER,

@@ -297,2 +313,3 @@ bearerToken: this.bearerToken,

_this.appClient = new _rawClient2.default({
auditAction: _this.auditAction,
authMode: _rawClient.AUTH_MODE_BEARER,

@@ -511,3 +528,3 @@ bearerToken: response.access_token,

var refreshToken = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var refreshToken = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];

@@ -535,4 +552,4 @@ return this.getNoAuthClient().post('/oauth/token', {

value: function getCollection(endpoint) {
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var filter = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var opts = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

@@ -565,3 +582,3 @@ var fullPath = endpoint;

value: function getCollectionWithMeta(endpoint) {
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var filter = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];

@@ -593,3 +610,3 @@ return this.getCollection(endpoint, filter, { raw: true }).then(function (response) {

value: function appendAnalyticsHeaders() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

@@ -627,4 +644,4 @@ var analytics = Object.assign({}, this.session, options.analytics);

var body = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var body = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];

@@ -687,3 +704,3 @@ var req = new _request2.default(method, endpoint, body, this.appendAnalyticsHeaders(options));

value: function uploadFile(file, name) {
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'square_photo';
var type = arguments.length <= 2 || arguments[2] === undefined ? 'square_photo' : arguments[2];
var options = arguments[3];

@@ -710,3 +727,3 @@

value: function setSession() {
var sessionVars = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var sessionVars = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

@@ -744,3 +761,3 @@ this.session = sessionVars;

function getMatchedWords() {
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var result = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

@@ -776,3 +793,3 @@ var matches = result._highlightResult || {}; // eslint-disable-line no-underscore-dangle

function arraysToStrings(obj) {
var skipProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var skipProps = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];

@@ -858,3 +875,3 @@ Object.getOwnPropertyNames(obj || {}).forEach(function (prop) {

var appointmentInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var appointmentInfo = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];

@@ -861,0 +878,0 @@ var returnData = {

@@ -18,3 +18,3 @@ 'use strict';

sendNotification: function sendNotification(appointmentProperties) {
var headerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var headerOptions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

@@ -21,0 +21,0 @@ return client.doAuthenticatedRequest('PATCH', endpoints.APPOINTMENTS + '/' + id + '/notify', appointmentProperties, headerOptions);

@@ -36,4 +36,4 @@ 'use strict';

value: function get() {
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var query = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

@@ -45,3 +45,3 @@ return this.client.getCollection(this.endpoint, query, opts);

value: function getWithMeta() {
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var query = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

@@ -58,3 +58,3 @@ return this.client.getCollectionWithMeta(this.endpoint, query);

value: function create(data) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

@@ -76,3 +76,3 @@ return this.client.doAuthenticatedRequest('POST', this.endpoint, data, options).then(function (response) {

value: function update(id, data) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

@@ -79,0 +79,0 @@ return this.client.doAuthenticatedRequest('PATCH', this.getSingleEndpoint(id), data, options).then(function (response) {

@@ -73,4 +73,4 @@ 'use strict';

function actOnOffer(client, id, action) {
var body = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
var body = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
var options = arguments.length <= 4 || arguments[4] === undefined ? {} : arguments[4];

@@ -173,3 +173,3 @@ if (action === 'accept') {

createAppointment: function createAppointment() {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var data = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments[1];

@@ -185,3 +185,3 @@

getAppointments: function getAppointments() {
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var query = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

@@ -216,3 +216,3 @@ if (query.filter) {

getSurveys: function getSurveys() {
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var query = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

@@ -233,3 +233,3 @@ var DEFAULT_QUERY = {

update: function update(jobProperties) {
var headerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var headerOptions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

@@ -236,0 +236,0 @@ return client.doAuthenticatedRequest('PATCH', endpoints.JOBS + '/' + id, jobProperties, headerOptions).then(function (response) {

@@ -7,3 +7,3 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

@@ -10,0 +10,0 @@ exports.default = organizationMethods;

@@ -7,3 +7,3 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

@@ -10,0 +10,0 @@ exports.default = userMethods;

@@ -56,3 +56,3 @@ 'use strict';

value: function addForEntity(entityType, entityID, name) {
var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var config = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];

@@ -59,0 +59,0 @@ var body = _extends({

@@ -7,3 +7,3 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

@@ -10,0 +10,0 @@ exports.stringify = stringify;

@@ -72,2 +72,4 @@ 'use strict';

this.auditAction = options.auditAction;
this.host = options.host || 'https://api.dispatch.me';

@@ -89,3 +91,3 @@ }

value: function get(endpoint) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

@@ -97,3 +99,3 @@ return this.doRequest('GET', endpoint, null, options);

value: function post(endpoint, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

@@ -105,3 +107,3 @@ return this.doRequest('POST', endpoint, body, options);

value: function put(endpoint, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

@@ -113,3 +115,3 @@ return this.doRequest('PUT', endpoint, body, options);

value: function patch(endpoint, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

@@ -121,3 +123,3 @@ return this.doRequest('PATCH', endpoint, body, options);

value: function _delete(endpoint) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

@@ -129,4 +131,4 @@ return this.doRequest('DELETE', endpoint, null, options);

value: function doRequest(method, endpoint) {
var body = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var body = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];

@@ -181,2 +183,5 @@ var url = this.host + endpoint;

if (typeof this.auditAction === 'function') {
this.auditAction({ method: method, url: url, body: body });
}
return (0, _isomorphicFetch2.default)(url, params).then(function (response) {

@@ -183,0 +188,0 @@ // 204 returns no content. short circuit to prevent parse errors.

@@ -13,4 +13,4 @@ "use strict";

function Request(method, endpoint) {
var body = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var body = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];

@@ -17,0 +17,0 @@ _classCallCheck(this, Request);

@@ -84,2 +84,11 @@ import * as endpoints from './endpoints';

/**
* Adds a callback function to every api request
*
* @param {Function} action
*/
setAuditAction(action) {
this.auditAction = action;
}
/**
* Adds a callback to run when bearer token changes

@@ -105,2 +114,3 @@ *

this.noAuthClient = new RawClient({
auditAction: this.auditAction,
authMode: AUTH_MODE_NONE,

@@ -122,5 +132,7 @@ host: this.host,

this.authClient = new RawClient({
auditAction: this.auditAction,
authMode: AUTH_MODE_BEARER,
bearerToken: this.bearerToken,
host: this.host,
});

@@ -165,2 +177,3 @@ }

this.auxiliaryClients[serviceName] = new RawClient({
auditAction: this.auditAction,
authMode: AUTH_MODE_BEARER,

@@ -190,2 +203,3 @@ bearerToken: this.bearerToken,

this.appClient = new RawClient({
auditAction: this.auditAction,
authMode: AUTH_MODE_BEARER,

@@ -192,0 +206,0 @@ bearerToken: response.access_token,

@@ -56,2 +56,4 @@ import { ensure, oneOf } from 'simplecheck';

this.auditAction = options.auditAction;
this.host = options.host || 'https://api.dispatch.me';

@@ -137,2 +139,5 @@ }

if (typeof this.auditAction === 'function') {
this.auditAction({ method, url, body });
}
return fetch(url, params)

@@ -139,0 +144,0 @@ .then(response => {

{
"name": "dispatch-node-sdk",
"version": "3.5.1",
"version": "3.6.0",
"description": "High- and low-level libraries for interacting with the Dispatch API",

@@ -5,0 +5,0 @@ "main": "dist/lib/index.js",

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