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

@esri/cedar

Package Overview
Dependencies
Maintainers
14
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/cedar - npm Package Compare versions

Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7

15

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

## [1.0.0-alpha.7]
### Changed
- Horizontal bar charts renamed from horizontal to bar-horizontal
- Time and bubble types convert to timeline and scatter and prompt a console.warn
- Grouped type converts to bar
- Multi series bar charts group by default instead of stack
- Single series charts (excluding pie/radar) now have x,y axis titles turned on by default and legend turned off by default
- Timeline charts now look like line charts with parseDates
### Fixed
- don't send multipart form data if not needed
- scatter/bubble tooltips no longer show 'undefined' at the top
## [1.0.0-alpha.6]

@@ -181,3 +193,4 @@ ### Fixed

[Unreleased]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.6...master
[Unreleased]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.7...master
[1.0.0-alpha.7]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.6...v1.0.0-alpha.7
[1.0.0-alpha.6]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.5...v1.0.0-alpha.6

@@ -184,0 +197,0 @@ [1.0.0-alpha.5]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.4...v1.0.0-alpha.5

13

dist/esm/request/request.d.ts
export interface IAuthenticationManager {
portal: string;
getToken(url: string): Promise<string>;

@@ -29,2 +30,6 @@ }

/**
* Base url for the portal you want to make the request to. Defaults to 'https://www.arcgis.com/sharing/rest'
*/
portal?: string;
/**
* The implementation of `fetch` to use. Defaults to a global `fetch`

@@ -38,3 +43,3 @@ */

* ```js
* import { request } from 'arcgis-core';
* import { request } from '@esri/arcgis-rest-request';
*

@@ -48,3 +53,3 @@ * request('https://www.arcgis.com/sharing/rest')

* ```js
* import { request, HTTPMethods } from 'arcgis-core';
* import { request, HTTPMethods } from '@esri/arcgis-rest-request';
*

@@ -59,3 +64,3 @@ * request('https://www.arcgis.com/sharing/rest', {}, {

* ```js
* import { request, HTTPMethods } from 'arcgis-core';
* import { request, HTTPMethods } from '@esri/arcgis-rest-request';
*

@@ -72,4 +77,4 @@ * request('https://www.arcgis.com/sharing/rest/search', {

* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the data from the request.
* @returns A Promise that will resolve with the data from the response.
*/
export declare function request(url: string, requestParams?: IParams, requestOptions?: IRequestOptions): Promise<any>;

@@ -14,2 +14,3 @@ /* Copyright (c) 2017 Environmental Systems Research Institute, Inc.

import { encodeQueryString } from "./utils/encode-query-string";
import { requiresFormData } from "./utils/process-params";
/**

@@ -19,3 +20,3 @@ * Generic method for making HTTP requests to ArcGIS REST API endpoints.

* ```js
* import { request } from 'arcgis-core';
* import { request } from '@esri/arcgis-rest-request';
*

@@ -29,3 +30,3 @@ * request('https://www.arcgis.com/sharing/rest')

* ```js
* import { request, HTTPMethods } from 'arcgis-core';
* import { request, HTTPMethods } from '@esri/arcgis-rest-request';
*

@@ -40,3 +41,3 @@ * request('https://www.arcgis.com/sharing/rest', {}, {

* ```js
* import { request, HTTPMethods } from 'arcgis-core';
* import { request, HTTPMethods } from '@esri/arcgis-rest-request';
*

@@ -53,3 +54,3 @@ * request('https://www.arcgis.com/sharing/rest/search', {

* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the data from the request.
* @returns A Promise that will resolve with the data from the response.
*/

@@ -75,2 +76,7 @@ export function request(url, requestParams, requestOptions) {

}
/* istanbul ignore else blob responses are difficult to make cross platform we will just have to trust the isomorphic fetch will do its job */
if (!requiresFormData(params)) {
fetchOptions.headers = new Headers();
fetchOptions.headers.append("Content-Type", "application/x-www-form-urlencoded");
}
return options.fetch(url, fetchOptions);

@@ -77,0 +83,0 @@ })

@@ -7,2 +7,2 @@ /**

*/
export declare function encodeFormData(params: any): FormData;
export declare function encodeFormData(params: any): FormData | string;
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import { processParams } from "./process-params";
import { processParams, requiresFormData } from "./process-params";
import { encodeQueryString } from "./encode-query-string";
/**

@@ -11,9 +12,15 @@ * Encodes parameters in a [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object in browsers or in a [FormData](https://github.com/form-data/form-data) in Node.js

export function encodeFormData(params) {
var formData = new FormData();
var useFormData = requiresFormData(params);
var newParams = processParams(params);
Object.keys(newParams).forEach(function (key) {
formData.append(key, newParams[key]);
});
return formData;
if (useFormData) {
var formData_1 = new FormData();
Object.keys(newParams).forEach(function (key) {
formData_1.append(key, newParams[key]);
});
return formData_1;
}
else {
return encodeQueryString(params);
}
}
//# sourceMappingURL=encode-form-data.js.map

@@ -0,1 +1,2 @@

export declare function encodeParam(key: string, value: any): string;
/**

@@ -2,0 +3,0 @@ * Encodes the passed object as a query string.

/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import { processParams } from "./process-params";
export function encodeParam(key, value) {
return encodeURIComponent(key) + "=" + encodeURIComponent(value);
}
/**

@@ -14,3 +17,3 @@ * Encodes the passed object as a query string.

.map(function (key) {
return encodeURIComponent(key) + "=" + encodeURIComponent(newParams[key]);
return encodeParam(key, newParams[key]);
})

@@ -17,0 +20,0 @@ .join("&");

/**
* Checks parameters to see if we should use FormData to send the request
* @param params The object whose keys will be encoded.
* @return A boolean indicating if FormData will be required.
*/
export declare function requiresFormData(params: any): boolean;
/**
* Converts parameters to the proper representation to send to the ArcGIS REST API.

@@ -3,0 +9,0 @@ * @param params The object whose keys will be encoded.

/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
/**
* Checks parameters to see if we should use FormData to send the request
* @param params The object whose keys will be encoded.
* @return A boolean indicating if FormData will be required.
*/
export function requiresFormData(params) {
return Object.keys(params).some(function (key) {
var value = params[key];
if (!value) {
return false;
}
var type = value.constructor.name;
switch (type) {
case "Array":
return false;
case "Object":
return false;
case "Date":
return false;
case "Function":
return false;
case "Boolean":
return false;
case "String":
return false;
case "Number":
return false;
default:
return true;
}
});
}
/**
* Converts parameters to the proper representation to send to the ArcGIS REST API.

@@ -12,3 +44,6 @@ * @param params The object whose keys will be encoded.

var param = params[key];
var type = Object.prototype.toString.call(param);
if (!param) {
return;
}
var type = param.constructor.name;
var value;

@@ -19,18 +54,18 @@ // properly encodes objects, arrays and dates for arcgis.com and other services.

switch (type) {
case "[object Array]":
case "Array":
value =
Object.prototype.toString.call(param[0]) === "[object Object]"
param[0].constructor.name === "Object"
? JSON.stringify(param)
: param.join(",");
break;
case "[object Object]":
case "Object":
value = JSON.stringify(param);
break;
case "[object Date]":
case "Date":
value = param.valueOf();
break;
case "[object Function]":
case "Function":
value = null;
break;
case "[object Boolean]":
case "Boolean":
value = param + "";

@@ -37,0 +72,0 @@ break;

/**
* @esri/cedar - v1.0.0-alpha.6 - Mon Dec 11 2017 09:45:21 GMT-0800 (PST)
* @esri/cedar - v1.0.0-alpha.7 - Thu Dec 14 2017 16:17:58 GMT-0800 (PST)
* Copyright (c) 2017 Environmental Systems Research Institute, Inc.

@@ -145,2 +145,3 @@ * Apache-2.0

type: 'column',
newStack: true
}],

@@ -156,3 +157,3 @@ legend: {},

var horizontal = {
var barHorizontal = {
type: 'serial',

@@ -295,73 +296,23 @@ theme: 'calcite',

theme: 'calcite',
marginRight: 40,
marginLeft: 40,
autoMarginOffset: 20,
mouseWheelZoomEnabled: true,
dataDateFormat: 'YYYY-MM-DD',
valueAxes: [
{
id: 'v1',
axisAlpha: 0,
position: 'left',
ignoreAxisWidth: true
}
],
balloon: {
borderThickness: 1,
shadowAlpha: 0
},
graphs: [
{
id: 'g1',
balloon: {
drop: true,
adjustBorderColor: false,
color: '#ffffff'
},
bullet: 'round',
bulletBorderAlpha: 1,
bulletColor: '#FFFFFF',
bulletSize: 5,
hideBulletsCount: 50,
lineThickness: 2,
title: 'red line',
useLineColorForBulletBorder: true,
valueField: null
}
],
chartScrollbar: {
graph: 'g1',
oppositeAxis: false,
offset: 30,
scrollbarHeight: 80,
backgroundAlpha: 0,
selectedBackgroundAlpha: 0.1,
selectedBackgroundColor: '#888888',
graphFillAlpha: 0,
graphLineAlpha: 0.5,
selectedGraphFillAlpha: 0,
selectedGraphLineAlpha: 1,
autoGridCount: true,
color: '#AAAAAA'
},
chartCursor: {
pan: true,
valueLineEnabled: true,
valueLineBalloonEnabled: true,
cursorAlpha: 1,
cursorColor: '#258cbb',
limitToGraph: 'g1',
valueLineAlpha: 0.2,
valueZoomable: true
categoryBalloonEnabled: false,
valueLineBalloonEnabled: true
},
valueScrollbar: {
oppositeAxis: false,
offset: 50,
scrollbarHeight: 10
graphs: [{
bullet: 'circle',
bulletAlpha: 1,
bulletBorderAlpha: 0.8,
bulletBorderThickness: 0,
// bulletColor: '#FFFFFF',
dashLengthField: 'dashLengthLine',
fillAlphas: 0,
useLineColorForBulletBorder: true
}],
legend: {
// horizontalGap: 10,
position: 'bottom',
useGraphSettings: true
},
categoryField: 'date',
categoryAxis: {
parseDates: true,
dashLength: 1,
minorGridEnabled: true
parseDates: true
},

@@ -375,3 +326,3 @@ export: {

bar: bar,
horizontal: horizontal,
'bar-horizontal': barHorizontal,
line: line,

@@ -403,3 +354,3 @@ area: area,

// Apply overrides
if (!!definition.overrides) {
if (definition.overrides) {
// NOTE: this counts on using deepmerge < 2.x

@@ -415,2 +366,36 @@ // see: https://github.com/KyleAMathews/deepmerge#arraymerge

var graphSpec = spec.graphs.pop();
// adjust legend and axis labels for single series charts
if (definition.series.length === 1 && (definition.type !== 'pie' && definition.type !== 'radar')) {
// don't show legend by default for single series charts
if (!spec.legend) {
spec.legend = {};
}
spec.legend.enabled = false;
// get default axis labels from series
var categoryAxisTitle_1 = definition.series[0].category.label;
var valueAxisTitle_1 = definition.series[0].value.label;
if (spec.type === 'xy' && Array.isArray(spec.valueAxes)) {
// for xy charts we treat the x axis as the category axis
// and the y axis as the value axis
spec.valueAxes.forEach(function (axis) {
if (axis.position === 'bottom') {
axis.title = categoryAxisTitle_1;
}
else if (axis.position === 'left') {
axis.title = valueAxisTitle_1;
}
});
}
else {
if (!spec.valueAxes) {
spec.valueAxes = [{}];
}
spec.valueAxes[0].title = definition.series[0].value.label;
spec.valueAxes[0].position = 'left';
if (!spec.categoryAxis) {
spec.categoryAxis = {};
}
spec.categoryAxis.title = categoryAxisTitle_1;
}
}
// Iterate over datasets

@@ -441,4 +426,4 @@ definition.datasets.forEach(function (dataset, d) {

// Group vs. stack
if (!!series.group) {
graph.newStack = true;
if (!!series.stack && graph.newStack) {
graph.newStack = false;
}

@@ -449,7 +434,7 @@ // x/y types, scatter, bubble

graph.yField = series.value.field;
graph.balloonText = series.name + " [[" + series.label + "]] <br/>\n " + series.category.label + ": [[" + series.category.field + "]],\n " + series.value.label + ": [[" + series.value.field + "]]";
graph.balloonText = "<div>" + series.category.label + ": [[" + series.category.field + "]]</div><div>" + series.value.label + ": [[" + series.value.field + "]]</div>";
// bubble
if (spec.type === 'xy' && series.size) {
graph.valueField = series.size.field;
graph.balloonText = graph.balloonText + " <br/> " + series.size.label + ": [[" + graph.valueField + "]]";
graph.balloonText = graph.balloonText + "<div>" + series.size.label + ": [[" + graph.valueField + "]]</div>";
}

@@ -467,3 +452,16 @@ else {

function fetchSpec(type) {
return clone$1(specs[type]);
var spec = type;
if (spec === 'time') {
console.warn("'time' is no longer a supported type. Please use 'timeline' instead");
spec = 'timeline';
}
else if (spec === 'bubble') {
console.warn("'bubble' is no longer a supported type. Please use 'scatter' instead");
spec = 'scatter';
}
else if (spec === 'grouped') {
console.warn("'grouped' is no longer a supported type. Please use 'bar' instead");
spec = 'bar';
}
return clone$1(specs[spec]);
}

@@ -473,3 +471,2 @@ function clone$1(json) {

}
// TODO: remove

@@ -707,2 +704,34 @@ var render = {

/**
* Checks parameters to see if we should use FormData to send the request
* @param params The object whose keys will be encoded.
* @return A boolean indicating if FormData will be required.
*/
function requiresFormData(params) {
return Object.keys(params).some(function (key) {
var value = params[key];
if (!value) {
return false;
}
var type = value.constructor.name;
switch (type) {
case "Array":
return false;
case "Object":
return false;
case "Date":
return false;
case "Function":
return false;
case "Boolean":
return false;
case "String":
return false;
case "Number":
return false;
default:
return true;
}
});
}
/**
* Converts parameters to the proper representation to send to the ArcGIS REST API.

@@ -716,3 +745,6 @@ * @param params The object whose keys will be encoded.

var param = params[key];
var type = Object.prototype.toString.call(param);
if (!param) {
return;
}
var type = param.constructor.name;
var value;

@@ -723,18 +755,18 @@ // properly encodes objects, arrays and dates for arcgis.com and other services.

switch (type) {
case "[object Array]":
case "Array":
value =
Object.prototype.toString.call(param[0]) === "[object Object]"
param[0].constructor.name === "Object"
? JSON.stringify(param)
: param.join(",");
break;
case "[object Object]":
case "Object":
value = JSON.stringify(param);
break;
case "[object Date]":
case "Date":
value = param.valueOf();
break;
case "[object Function]":
case "Function":
value = null;
break;
case "[object Boolean]":
case "Boolean":
value = param + "";

@@ -755,15 +787,18 @@ break;

* Apache-2.0 */
function encodeParam(key, value) {
return encodeURIComponent(key) + "=" + encodeURIComponent(value);
}
/**
* Encodes parameters in a [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object in browsers or in a [FormData](https://github.com/form-data/form-data) in Node.js
* Encodes the passed object as a query string.
*
* @param params An object to be encoded.
* @returns The complete [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object.
* @returns An encoded query string.
*/
function encodeFormData(params) {
var formData = new FormData();
function encodeQueryString(params) {
var newParams = processParams(params);
Object.keys(newParams).forEach(function (key) {
formData.append(key, newParams[key]);
});
return formData;
return Object.keys(newParams)
.map(function (key) {
return encodeParam(key, newParams[key]);
})
.join("&");
}

@@ -774,14 +809,20 @@

/**
* Encodes the passed object as a query string.
* Encodes parameters in a [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object in browsers or in a [FormData](https://github.com/form-data/form-data) in Node.js
*
* @param params An object to be encoded.
* @returns An encoded query string.
* @returns The complete [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object.
*/
function encodeQueryString(params) {
function encodeFormData(params) {
var useFormData = requiresFormData(params);
var newParams = processParams(params);
return Object.keys(newParams)
.map(function (key) {
return encodeURIComponent(key) + "=" + encodeURIComponent(newParams[key]);
})
.join("&");
if (useFormData) {
var formData_1 = new FormData();
Object.keys(newParams).forEach(function (key) {
formData_1.append(key, newParams[key]);
});
return formData_1;
}
else {
return encodeQueryString(params);
}
}

@@ -803,3 +844,3 @@

* ```js
* import { request } from 'arcgis-core';
* import { request } from '@esri/arcgis-rest-request';
*

@@ -813,3 +854,3 @@ * request('https://www.arcgis.com/sharing/rest')

* ```js
* import { request, HTTPMethods } from 'arcgis-core';
* import { request, HTTPMethods } from '@esri/arcgis-rest-request';
*

@@ -824,3 +865,3 @@ * request('https://www.arcgis.com/sharing/rest', {}, {

* ```js
* import { request, HTTPMethods } from 'arcgis-core';
* import { request, HTTPMethods } from '@esri/arcgis-rest-request';
*

@@ -837,3 +878,3 @@ * request('https://www.arcgis.com/sharing/rest/search', {

* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the data from the request.
* @returns A Promise that will resolve with the data from the response.
*/

@@ -859,2 +900,7 @@ function request(url, requestParams, requestOptions) {

}
/* istanbul ignore else blob responses are difficult to make cross platform we will just have to trust the isomorphic fetch will do its job */
if (!requiresFormData(params)) {
fetchOptions.headers = new Headers();
fetchOptions.headers.append("Content-Type", "application/x-www-form-urlencoded");
}
return options.fetch(url, fetchOptions);

@@ -861,0 +907,0 @@ })

{
"name": "@esri/cedar",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.7",
"description": "Visualization framework for the ArcGIS Platform",

@@ -65,3 +65,3 @@ "files": [

"amcharts3": "amcharts/amcharts3",
"@esri/cedar-amcharts": "^1.0.0-alpha.6"
"@esri/cedar-amcharts": "^1.0.0-alpha.7"
},

@@ -68,0 +68,0 @@ "devDependencies": {

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

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