Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ndustrial/contxt-sdk

Package Overview
Dependencies
Maintainers
9
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndustrial/contxt-sdk - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [v0.0.14](http://github.com/ndustrialio/contxt-sdk-js/tree/v0.0.14) (2018-06-18)
**Changed**
* Facilities#getAllByOrganizationId to accept parameters to include cost centers information
* Facilities#get to include cost centers information for that specific facility
## [v0.0.13](http://github.com/ndustrialio/contxt-sdk-js/tree/v0.0.13) (2018-06-16)

@@ -2,0 +9,0 @@

12

es/index.js

@@ -398,2 +398,6 @@ import axios from 'axios';

if (input.cost_centers) {
facility.costCenters = input.cost_centers.map(formatCostCenterFromServer);
}
return facility;

@@ -420,7 +424,11 @@ }

function formatFacilityOptionsToServer(options) {
function formatFacilityOptionsToServer() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var output = _extends({}, options, {
include_groupings: options && options.includeGroupings ? options.includeGroupings : false
include_cost_centers: !!options.includeCostCenters,
include_groupings: !!options.includeGroupings
});
delete output.includeCostCenters;
delete output.includeGroupings;

@@ -427,0 +435,0 @@

@@ -402,2 +402,6 @@ 'use strict';

if (input.cost_centers) {
facility.costCenters = input.cost_centers.map(formatCostCenterFromServer);
}
return facility;

@@ -424,7 +428,11 @@ }

function formatFacilityOptionsToServer(options) {
function formatFacilityOptionsToServer() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var output = _extends({}, options, {
include_groupings: options && options.includeGroupings ? options.includeGroupings : false
include_cost_centers: !!options.includeCostCenters,
include_groupings: !!options.includeGroupings
});
delete output.includeCostCenters;
delete output.includeGroupings;

@@ -431,0 +439,0 @@

2

package.json
{
"name": "@ndustrial/contxt-sdk",
"version": "0.0.13",
"version": "0.0.14",
"description": "",

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

import {
formatCostCenterFromServer,
formatGroupingFromServer,
formatOrganizationFromServer,
formatTagsFromServer,
formatGroupingFromServer
formatTagsFromServer
} from './index';

@@ -14,2 +15,9 @@

* @param {string} input.city
* @param {Object[]} [input.cost_centers]
* @param {string} [input.cost_centers[].created_at] ISO 8601 Extended Format date/time string
* @param {string} [input.cost_centers[].description]
* @param {string} [input.cost_centers[].id]
* @param {string} [input.cost_centers[].name]
* @param {string} [input.cost_centers[].organization_id] UUID corresponding with an organization
* @param {string} [input.cost_centers[].updated_at] ISO 8601 Extended Format date/time string
* @param {string} input.created_at ISO 8601 Extended Format date/time string

@@ -81,2 +89,6 @@ * @param {Object[]}[input.facility_groupings]

if (input.cost_centers) {
facility.costCenters = input.cost_centers.map(formatCostCenterFromServer);
}
return facility;

@@ -83,0 +95,0 @@ }

@@ -5,5 +5,7 @@ /**

* @param {Object} options
* @param {Boolean} [options.includeCostCenters] Boolean flag to include cost centers data with each facility
* @param {Boolean} [options.includeGroupings] Boolean flag for including groupings data with each facility
*
* @returns {Object} output
* @returns {Boolean} output.include_cost_centers
* @returns {Boolean} output.include_groupings

@@ -14,9 +16,10 @@ *

function formatFacilityOptionsToServer(options) {
function formatFacilityOptionsToServer(options = {}) {
const output = {
...options,
include_groupings:
options && options.includeGroupings ? options.includeGroupings : false
include_cost_centers: !!options.includeCostCenters,
include_groupings: !!options.includeGroupings
};
delete output.includeCostCenters;
delete output.includeGroupings;

@@ -23,0 +26,0 @@

@@ -8,2 +8,3 @@ import times from 'lodash.times';

expect(options).to.deep.equal({
include_cost_centers: false,
include_groupings: false

@@ -25,2 +26,3 @@ });

const expectedOptions = Object.assign({}, customOptions, {
include_cost_centers: false,
include_groupings: false

@@ -34,2 +36,28 @@ });

it('provides an object that includes the `include_cost_centers` key that the API service can understand', function() {
const expectedIncludeCostCenters = faker.random.boolean();
const customOptions = times(
faker.random.number({
min: 1,
max: 10
})
).reduce((memo) => {
memo[faker.hacker.adjective()] = faker.helpers.createTransaction();
return memo;
}, {});
const expectedOptions = Object.assign({}, customOptions, {
include_cost_centers: expectedIncludeCostCenters,
include_groupings: false
});
const options = formatFacilityOptionsToServer({
...customOptions,
includeCostCenters: expectedIncludeCostCenters,
includeGroupings: false
});
expect(options).to.deep.equal(expectedOptions);
});
it('provides an object that includes the `include_groupings` that the API service can understand', function() {

@@ -48,2 +76,3 @@ const expectedIncludeGroupings = faker.random.boolean();

const expectedOptions = Object.assign({}, customOptions, {
include_cost_centers: false,
include_groupings: expectedIncludeGroupings

@@ -54,2 +83,3 @@ });

...customOptions,
include_cost_centers: false,
includeGroupings: expectedIncludeGroupings

@@ -56,0 +86,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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