Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Feat] Integration with loaders.gl 2.2 (#1156)
Wesam Manassra01484c6a77bc
diff --git a/.eslintrc b/.eslintrcindex 576ac8454..c8395e3ee 100644--- a/.eslintrc+++ b/.eslintrc@@ -16,7 +16,7 @@"page": true,"browser": true,"context": true,- "jestPuppeteer": true,+ "jestPuppeteer": true},"parser": "babel-eslint","plugins": [diff --git a/babel.config.js b/babel.config.jsindex 9f2ca9f16..2c18a7959 100644--- a/babel.config.js+++ b/babel.config.js@@ -20,56 +20,55 @@const KeplerPackage = require('./package');-module.exports = function babel(api) {- api.cache(true);-- const presets = [- '@babel/preset-env',- '@babel/preset-react'- ];- const plugins = [- '@babel/plugin-transform-modules-commonjs',- ['@babel/plugin-proposal-decorators', { legacy: true }],- '@babel/plugin-proposal-class-properties',- '@babel/plugin-proposal-export-namespace-from',- ['@babel/transform-runtime', {+const PRESETS = ['@babel/preset-env', '@babel/preset-react'];+const PLUGINS = [+ '@babel/plugin-transform-modules-commonjs',+ ['@babel/plugin-proposal-decorators', {legacy: true}],+ '@babel/plugin-proposal-class-properties',+ '@babel/plugin-proposal-export-namespace-from',+ [+ '@babel/transform-runtime',+ {regenerator: true- }],- [- 'module-resolver',- {- root: [- './src'- ],- alias: {- test: './test'- }+ }+ ],+ [+ 'module-resolver',+ {+ root: ['./src'],+ alias: {+ test: './test'}- ],- ['search-and-replace', {+ }+ ],+ [+ 'search-and-replace',+ {rules: [{search: '__PACKAGE_VERSION__',replace: KeplerPackage.version}]- }]- ];- const env = {- test: {- plugins: [- 'istanbul'- ]- },- debug: {- sourceMaps: 'inline',- retainLines: true}- };+ ]+];+const ENV = {+ test: {+ plugins: ['istanbul']+ },+ debug: {+ sourceMaps: 'inline',+ retainLines: true+ }+};++module.exports = function babel(api) {+ api.cache(true);return {- presets,- plugins,- env+ presets: PRESETS,+ plugins: PLUGINS,+ env: ENV};};diff --git a/examples/demo-app/package.json b/examples/demo-app/package.jsonindex ddc4763b7..89b9bf9a9 100644--- a/examples/demo-app/package.json+++ b/examples/demo-app/package.json@@ -6,6 +6,7 @@"start-local-e2e": "webpack-dev-server --mode development --env.es6","start-local-deck": "webpack-dev-server --mode development --env.es6 --env.deck --progress --hot --open","start-local-deck-src": "webpack-dev-server --mode development --env.es6 --env.deck_src --progress --hot --open",+ "start-local-loaders-src": "webpack-dev-server --mode development --env.es6 --env.loaders_src --progress --hot --open","start-local-https": "webpack-dev-server --mode development --https --env.es6 --progress --hot --open"},"dependencies": {diff --git a/examples/demo-app/src/store.js b/examples/demo-app/src/store.jsindex 12c624b4a..90d1116e3 100644--- a/examples/demo-app/src/store.js+++ b/examples/demo-app/src/store.js@@ -45,7 +45,7 @@ let composeEnhancers = compose;/*** comment out code below to enable Redux Devtools*/-/*+if (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({actionsBlacklist: [@@ -55,6 +55,5 @@ if (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {]});}-*/export default createStore(reducers, initialState, composeEnhancers(...enhancers));diff --git a/examples/webpack.config.local.js b/examples/webpack.config.local.jsindex 6a04cdf9e..f7f757e61 100644--- a/examples/webpack.config.local.js+++ b/examples/webpack.config.local.js@@ -42,6 +42,9 @@ const NODE_MODULES_DIR = resolve(__dirname, '../node_modules');// For debugging deck.gl, load deck.gl from external deck.gl directoryconst EXTERNAL_DECK_SRC = resolve(__dirname, '../../deck.gl');+// For debugging loaders.gl, load loaders.gl from external loaders.gl directory+const EXTERNAL_LOADERS_SRC = resolve(__dirname, '../../loaders.gl');+// Support for hot reloading changes to the deck.gl library:function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR, externals = {}) {const resolveAlias = {@@ -88,6 +91,12 @@ function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR, externals = {}) {});}+ if (env.loaders_src) {+ externals['loaders.gl'].forEach(mdl => {+ resolveAlias[`@loaders.gl/${mdl}`] = `${EXTERNAL_LOADERS_SRC}/modules/${mdl}/src`;+ });+ }+logStep(`resolve.alias:\n ${JSON.stringify(resolveAlias, null, 2)}`);// load deck.gl fromdiff --git a/package.json b/package.jsonindex c2bc1267b..87c869aa6 100644--- a/package.json+++ b/package.json@@ -22,8 +22,9 @@"install:web": "yarn install:example && cd website && yarn","install-and-start": "node ./scripts/install-and-start","fast-test": "npm run test-node && npm run test-browser",- "test-browser": "NODE_ENV=test babel-tape-runner -r ./test/setup-browser-env.js ./test/browser.js | tap-spec",+ "test-browser": "NODE_ENV=test babel-tape-runner -r ./test/setup-browser-env.js ./test/browser/index.js | tap-spec","test-node": "NODE_ENV=test babel-tape-runner ./test/node.js | tap-spec",+ "test-browser-headless": "NODE_ENV=test node ./test/browser-drive.js","test-e2e": "NODE_ENV=test HEADLESS=true SLOWMO=true jest","test": "npm run lint && npm run test-node && npm run test-browser","cover": "nyc --reporter html --reporter cobertura --reporter json-summary npm test && nyc report",@@ -31,6 +32,7 @@"start": "npm run install-and-start -- examples/demo-app start-local","start:deck": "npm run install-and-start -- examples/demo-app start-local-deck","start:deck-src": "npm run install-and-start -- examples/demo-app start-local-deck-src",+ "start:loaders-src": "npm run install-and-start -- examples/demo-app start-local-loaders-src","start:open-modal": "npm run install-and-start -- examples/open-modal start-local","start:custom-reducer": "npm run install-and-start -- examples/custom-reducer start-local","start:replace-component": "npm run install-and-start -- examples/replace-component start-local",@@ -81,7 +83,11 @@"@deck.gl/layers": "^8.2.0","@deck.gl/mesh-layers": "^8.2.0","@deck.gl/react": "^8.2.0",+ "@loaders.gl/core": "^2.2.5",+ "@loaders.gl/csv": "^2.2.5","@loaders.gl/gltf": "^2.2.5",+ "@loaders.gl/json": "^2.2.5",+ "@loaders.gl/polyfills": "^2.2.5","@luma.gl/constants": "^8.2.0","@luma.gl/core": "^8.2.0","@mapbox/geo-viewport": "^0.2.2",@@ -107,6 +113,7 @@"fuzzy": "^0.1.3","global": "^4.3.0","h3-js": "^3.1.0",+ "html-webpack-plugin": "^4.3.0","keymirror": "^0.1.1","lodash.clonedeep": "^4.0.1","lodash.curry": "^4.1.1",@@ -226,7 +233,7 @@"source-map-loader": "^0.2.1","styled-components": "^4.1.3","tap-spec": "^4.1.1",- "tape": "4.8.0",+ "tape": "^4.9.2","tape-catch": "^1.0.6","typedoc-plugin-markdown": "^2.2.17","typescript": "3.8.3",diff --git a/src/actions/vis-state-actions.d.ts b/src/actions/vis-state-actions.d.tsindex d827e8671..79f3434c1 100644--- a/src/actions/vis-state-actions.d.ts+++ b/src/actions/vis-state-actions.d.ts@@ -19,7 +19,7 @@// THE SOFTWARE.// vis-state-reducer-import ActionTypes from 'constants/action-types';+import ActionTypes, {ActionType} from 'constants/action-types';import {ProtoDataset, AddDataToMaoPayload} from '../actions/actions';import {ParsedConfig} from '../schemas';import {FileCacheItem} from '../processors/file-handler';@@ -371,29 +371,54 @@ export function toggleEditorVisibility(): Merge<{type: ActionTypes.TOGGLE_EDITOR_VISIBILITY}>;-export type LoadNextFileUpdaterAction = {- fileCache: FileCacheItem[];- filesToLoad: FileList[];- totalCount: number;- onFinish: function;-};-export function loadNextFile(payload: {- fileCache: FileCacheItem[];- filesToLoad: FileList[];- totalCount: number;- onFinish: function;-}): Merge<LoadNextFileUpdaterAction, {type: ActionTypes.LOAD_NEXT_FILE}>;+export function loadNextFile(): Merge<{type: ActionTypes.LOAD_NEXT_FILE}>;-export type LoadFileSuccessUpdaterAction = {+export type loadFilesSuccessUpdaterAction = {result: FileCacheItem[];};-export function loadFileSuccess(+export function loadFilesSuccess(result: FileCacheItem[]-): Merge<LoadFileSuccessUpdaterAction, {type: ActionTypes.LOAD_FILES_SUCCESS}>;+): Merge<loadFilesSuccessUpdaterAction, {type: ActionTypes.LOAD_FILES_SUCCESS}>;export type loadFilesErrUpdaterAction = {+ fileName: string;error: any;};export function loadFilesErr(+ fileName: string,error: any): Merge<loadFilesErrUpdaterAction, {type: ActionTypes.LOAD_FILES_ERR}>;++export type loadFileStepSuccessAction = {+ fileName: string;+ fileCache: FileCacheItem[];+};+export function loadFileStepSuccess(payload: {+ fileName: string;+ fileCache: FileCacheItem[];+}): Merge<loadFileStepSuccessAction, {type: ActionTypes.LOAD_FILE_STEP_SUCCESS}>;++type FileContent = {+ fileName: string;+ header: string[];+ data: any;+};+export type nextFileBatchUpdaterAction = {+ gen: AsyncGenerator<FileContent>;+ fileName: string;+ progress?: any;+ accumulated?: any;+ onFinish: (result: any) => any;+};+export function nextFileBatch(+ payload: nextFileBatchAction+): {payload: nextFileBatchAction; type: ActionTypes.NEXT_FILE_BATCH};++export type processFileContentUpdaterAction = {+ content: FileContent;+ fileCache: FileCacheItem[];+};++export function processFileContent(+ payload: processFileContentUpdaterAction+): {payload: processFileContentUpdaterAction; type: ActionTypes.PROCESS_FILE_CONTENT};diff --git a/src/actions/vis-state-actions.js b/src/actions/vis-state-actions.jsindex 37f3c54bf..003a43a2d 100644--- a/src/actions/vis-state-actions.js+++ b/src/actions/vis-state-actions.js@@ -592,18 +592,13 @@ export function loadFiles(files) {/*** Called with next file to load* @memberof visStateActions- * @param payload* @type {typeof import('./vis-state-actions').loadNextFile}* @returns action* @public*/-export function loadNextFile({fileCache, filesToLoad, totalCount, onFinish}) {+export function loadNextFile() {return {- type: ActionTypes.LOAD_NEXT_FILE,- fileCache,- filesToLoad,- totalCount,- onFinish+ type: ActionTypes.LOAD_NEXT_FILE};}@@ -611,16 +606,31 @@ export function loadNextFile({fileCache, filesToLoad, totalCount, onFinish}) {* called when all files are processed and loaded* @memberof visStateActions* @param result- * @type {typeof import('./vis-state-actions').loadFileSuccess}+ * @type {typeof import('./vis-state-actions').loadFilesSuccess}* @returns action*/-export function loadFileSuccess(result) {+export function loadFilesSuccess(result) {return {type: ActionTypes.LOAD_FILES_SUCCESS,result};}+/**+ * called when successfully loaded one file, ready to move on to the next one+ * @memberof visStateActions+ * @param result+ * @type {typeof import('./vis-state-actions').loadFileStepSuccess}+ * @returns action+ */+export function loadFileStepSuccess({fileName, fileCache}) {+ return {+ type: ActionTypes.LOAD_FILE_STEP_SUCCESS,+ fileName,+ fileCache+ };+}+/*** Trigger loading file error* @memberof visStateActions@@ -629,9 +639,10 @@ export function loadFileSuccess(result) {* @returns action* @public*/-export function loadFilesErr(error) {+export function loadFilesErr(fileName, error) {return {type: ActionTypes.LOAD_FILES_ERR,+ fileName,error};}@@ -730,7 +741,6 @@ export function applyCPUFilter(dataId) {}/**-* Toggle editor layer visibility* @memberof visStateActions* @type {typeof import('./vis-state-actions').toggleEditorVisibility}@@ -742,6 +752,34 @@ export function toggleEditorVisibility() {};}+/**+ * Process the next file batch+ * @memberof visStateActions+ * @param payload - batch payload+ * @type {typeof import('./vis-state-actions').nextFileBatch}+ * @return action+ */+export function nextFileBatch(payload) {+ return {+ type: ActionTypes.NEXT_FILE_BATCH,+ payload+ };+}++/**+ * Process the file content+ * @memberof visStateActions+ * @param payload - the file content+ * @type {typeof import('./vis-state-actions').processFileContent}+ * @return action+ */+export function processFileContent(payload) {+ return {+ type: ActionTypes.PROCESS_FILE_CONTENT,+ payload+ };+}+/*** This declaration is needed to group actions in docs*/diff --git a/src/components/common/file-uploader/file-upload-progress.js b/src/components/common/file-uploader/file-upload-progress.jsnew file mode 100644index 000000000..14c76fa51--- /dev/null+++ b/src/components/common/file-uploader/file-upload-progress.js@@ -0,0 +1,97 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React from 'react';+import styled, {withTheme} from 'styled-components';+import ProgressBar from '../progress-bar';+import {TrancatedTitleText} from 'components/common/styled-components';+import {getError} from 'utils/utils';++const StyledFileProgress = styled.div.attrs({+ className: 'file-upload__progress'+})`+ color: ${props => props.theme.textColorLT};+ font-size: 12px;+ margin-top: 12px;+ border-image: initial;+ padding: 8px 12px;++ .top-row {+ display: flex;+ justify-content: space-between;+ }++ .file-name {+ font-weight: 500;+ }+ .middle-row {+ margin-top: 6px;+ }+ .bottom-row {+ margin-top: 6px;+ text-align: start;+ }+`;++const StyledProgressWrapper = styled.div.attrs({+ className: 'file-upload__progress__wrapper'+})`+ width: 400px;+`;++const StyledContainer = styled.div`+ width: 100%;+ display: flex;+ justify-content: center;+`;+const formatPercent = percent => `${Math.floor(percent * 100)}%`;+const UploadProgress = ({message, fileName, percent, error, theme}) => {+ const percentStr = formatPercent(percent);+ const barColor = error ? theme.errorColor : theme.activeColorLT;++ return (+ <StyledFileProgress className="file-upload-progress__message">+ <div className="top-row">+ <TrancatedTitleText className="file-name" title={fileName}>+ {fileName}+ </TrancatedTitleText>+ <div className="percent">{percentStr}</div>+ </div>+ <div className="middle-row">+ <ProgressBar percent={percentStr} barColor={barColor} isLoading />+ </div>+ <div className="bottom-row" style={{color: error ? theme.errorColor : theme.textColorLT}}>+ {error ? getError(error) : message}+ </div>+ </StyledFileProgress>+ );+};++const FileUploadProgress = ({fileLoadingProgress, theme}) => (+ <StyledContainer>+ <StyledProgressWrapper>+ {Object.values(fileLoadingProgress).map(item => (+ <UploadProgress {...item} key={item.fileName} theme={theme} />+ ))}+ </StyledProgressWrapper>+ </StyledContainer>+);++export default withTheme(FileUploadProgress);diff --git a/src/components/common/file-uploader/file-upload.js b/src/components/common/file-uploader/file-upload.jsindex fd6a3eb2e..b8af6c872 100644--- a/src/components/common/file-uploader/file-upload.js+++ b/src/components/common/file-uploader/file-upload.js@@ -21,10 +21,9 @@import React, {Component, createRef} from 'react';import PropTypes from 'prop-types';import styled from 'styled-components';-import UploadButton from './upload-button';import {DragNDrop, FileType} from 'components/common/icons';-import LoadingSpinner from 'components/common/loading-spinner';+import FileUploadProgress from 'components/common/file-uploader/file-upload-progress';import FileDrop from './file-drop';import {isChrome} from 'utils/utils';@@ -65,28 +64,25 @@ export const WarningMsg = styled.span`font-weight: 500;`;-const PositiveMsg = styled.span`- display: inline-block;- color: ${props => props.theme.primaryBtnActBgd};- font-weight: 500;- margin-right: 8px;-`;-const StyledFileDrop = styled.div`background-color: white;border-radius: 4px;- border-style: dashed;+ border-style: ${props => (props.dragOver ? 'solid' : 'dashed')};border-width: 1px;- border-color: ${props => props.theme.subtextColorLT};+ border-color: ${props => (props.dragOver ? props.theme.textColorLT : props.theme.subtextColorLT)};text-align: center;width: 100%;padding: 48px 8px 0;+ height: 360px;.file-upload-or {color: ${props => props.theme.linkBtnColor};padding-right: 4px;}+ .file-type-row {+ opacity: 0.5;+ }${media.portable`padding: 16px 4px 0;`};@@ -159,7 +155,7 @@ function FileUploadFactory() {static propTypes = {onFileUpload: PropTypes.func.isRequired,validFileExt: PropTypes.arrayOf(PropTypes.string),- fileLoading: PropTypes.bool+ fileLoading: PropTypes.oneOfType([PropTypes.bool, PropTypes.object])};static defaultProps = {@@ -219,43 +215,9 @@ function FileUploadFactory() {this.setState({dragOver: newState});};- _renderMessage() {- const {errorFiles, files} = this.state;- if (errorFiles.length) {- return (- <WarningMsg>- <FormattedMessage- id={'fileUploader.filenNotSupported'}- values={{errorFiles: errorFiles.join(', ')}}- />- </WarningMsg>- );- } else if (this.props.fileLoading && files.length) {- return (- <StyledMessage className="file-uploader__message">- <div className="loading-action">- <FormattedMessage id={'fileUploader.uploading'} />- </div>- <div>- {files.map((f, i) => (- <PositiveMsg key={i}>{f.name}</PositiveMsg>- ))}- ...- </div>- <div className="loading-spinner">- <LoadingSpinner size={20} />- </div>- </StyledMessage>- );- }-- return null;- }-render() {- const {dragOver, files} = this.state;- const {validFileExt, intl} = this.props;-+ const {dragOver, files, errorFiles} = this.state;+ const {validFileExt, intl, fileLoading, fileLoadingProgress} = this.props;return (<StyledFileUpload className="file-uploader" ref={this.frame}>{FileDrop ? (@@ -275,33 +237,51 @@ function FileUploadFactory() {/></StyledUploadMessage><StyledFileDrop dragOver={dragOver}>- <div style={{opacity: dragOver ? 0.5 : 1}}>- <StyledDragNDropIcon>- <StyledFileTypeFow className="file-type-row">- {validFileExt.map(ext => (- <FileType key={ext} ext={ext} height="50px" fontSize="9px" />- ))}- </StyledFileTypeFow>- <DragNDrop height="44px" />- </StyledDragNDropIcon>- <div>{this._renderMessage()}</div>- </div>- {!files.length ? (- <StyledDragFileWrapper>- <MsgWrapper>- <FormattedMessage id={'fileUploader.message'} />- </MsgWrapper>- <span className="file-upload-or">- <FormattedMessage id={'fileUploader.or'} />- </span>- <UploadButton onUpload={this._handleFileInput}>- <FormattedMessage id={'fileUploader.browseFiles'} />- </UploadButton>- </StyledDragFileWrapper>- ) : null}- <StyledDisclaimer>- <FormattedMessage id={'fileUploader.disclaimer'} />- </StyledDisclaimer>+ <StyledFileTypeFow className="file-type-row">+ {validFileExt.map(ext => (+ <FileType key={ext} ext={ext} height="50px" fontSize="9px" />+ ))}+ </StyledFileTypeFow>+ {fileLoading ? (+ <FileUploadProgress fileLoadingProgress={fileLoadingProgress} />+ ) : (+ <>+ <div+ style={{opacity: dragOver ? 0.5 : 1}}+ className="file-upload-display-message"+ >+ <StyledDragNDropIcon>+ <DragNDrop height="44px" />+ </StyledDragNDropIcon>++ {errorFiles.length ? (+ <WarningMsg>+ <FormattedMessage+ id={'fileUploader.fileNotSupported'}+ values={{errorFiles: errorFiles.join(', ')}}+ />+ </WarningMsg>+ ) : null}+ </div>+ {!files.length ? (+ <StyledDragFileWrapper>+ <MsgWrapper>+ <FormattedMessage id={'fileUploader.message'} />+ </MsgWrapper>+ <span className="file-upload-or">+ <FormattedMessage id={'fileUploader.or'} />+ </span>+ <UploadButton onUpload={this._handleFileInput}>+ <FormattedMessage id={'fileUploader.browseFiles'} />+ </UploadButton>+ </StyledDragFileWrapper>+ ) : null}++ <StyledDisclaimer>+ <FormattedMessage id={'fileUploader.disclaimer'} />+ </StyledDisclaimer>+ </>+ )}</StyledFileDrop></FileDrop>) : null}diff --git a/src/components/common/progress-bar.js b/src/components/common/progress-bar.jsnew file mode 100644index 000000000..26218c7ec--- /dev/null+++ b/src/components/common/progress-bar.js@@ -0,0 +1,46 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React from 'react';+import styled from 'styled-components';++const StyledBar = styled.span.attrs({+ className: 'progress-bar__bar'+})`+ background-color: ${props => props.barColor || props.theme.progressBarColor};+ /* transition: width 200ms; */+ display: block;+`;+const StyledTrack = styled.div.attrs({+ className: 'progress-bar'+})`+ background-color: ${props => props.trackColor || props.theme.progressBarTrackColor};+`;++const ProgressBar = ({percent, height = 4, isLoading, barColor, trackColor}) => (+ <StyledTrack trackColor={trackColor}>+ <StyledBar+ barColor={barColor}+ style={{width: percent, height: `${height}px`, opacity: isLoading ? 1 : 0}}+ />+ </StyledTrack>+);++export default ProgressBar;diff --git a/src/components/common/styled-components.js b/src/components/common/styled-components.jsindex 60211c608..68e17702b 100644--- a/src/components/common/styled-components.js+++ b/src/components/common/styled-components.js@@ -623,3 +623,9 @@ export const StyledFilterContent = styled.div`background-color: ${props => props.theme.panelBackground};padding: 12px;`;++export const TrancatedTitleText = styled.div`+ white-space: nowrap;+ text-overflow: ellipsis;+ overflow: hidden;+`;diff --git a/src/components/index.js b/src/components/index.jsindex 65f73f7aa..6930a2fec 100644--- a/src/components/index.js+++ b/src/components/index.js@@ -127,7 +127,8 @@ export {default as LoadingDialog} from './modals/loading-dialog';export {default as FieldToken} from './common/field-token';export {default as Portaled} from './common/portaled';export {default as DropdownList} from './common/item-selector/dropdown-list';-+export {default as ProgressBar} from './common/progress-bar';+export {default as FileUploadProgress} from './common/file-uploader/file-upload-progress';export * from './common/styled-components';import * as Icons from './common/icons';export {Icons};diff --git a/src/components/modal-container.js b/src/components/modal-container.jsindex 4dddf365e..8a982fd43 100644--- a/src/components/modal-container.js+++ b/src/components/modal-container.js@@ -328,7 +328,8 @@ export default function ModalContainerFactory(onSetCloudProvider={this.props.providerActions.setCloudProvider}getSavedMaps={this.props.providerActions.getSavedMaps}loadFiles={uiState.loadFiles}- {...uiState.loadFiles}+ fileLoading={visState.fileLoading}+ fileLoadingProgress={visState.fileLoadingProgress}/>);modalProps = {diff --git a/src/components/modals/load-data-modal.js b/src/components/modals/load-data-modal.jsindex 7e5a06a60..7fc7a7615 100644--- a/src/components/modals/load-data-modal.js+++ b/src/components/modals/load-data-modal.js@@ -28,6 +28,7 @@ import LoadStorageMapFactory from './load-storage-map';import ModalTabsFactory from './modal-tabs';import LoadingDialog from './loading-dialog';+import {LOADING_METHODS} from 'constants/default-settings';const StyledLoadDataModal = styled.div.attrs({@@ -46,7 +47,7 @@ LoadDataModalFactory.deps = [ModalTabsFactory, FileUploadFactory, LoadStorageMapfunction LoadDataModalFactory(ModalTabs, FileUpload, LoadStorageMap) {const LoadDataModal = props => {- const {fileLoading, loadingMethods, isCloudMapLoading} = props;+ const {loadingMethods, isCloudMapLoading} = props;const [currentMethod, toggleMethod] = useState(getDefaultMethod(loadingMethods));return (@@ -56,7 +57,7 @@ function LoadDataModalFactory(ModalTabs, FileUpload, LoadStorageMap) {loadingMethods={loadingMethods}toggleMethod={toggleMethod}/>- {fileLoading || isCloudMapLoading ? (+ {isCloudMapLoading ? (<LoadingDialog size={64} />) : (currentMethod && <currentMethod.elementType key={currentMethod.id} {...props} />@@ -69,7 +70,7 @@ function LoadDataModalFactory(ModalTabs, FileUpload, LoadStorageMap) {// call backsonFileUpload: PropTypes.func.isRequired,onLoadCloudMap: PropTypes.func.isRequired,- fileLoading: PropTypes.bool,+ fileLoading: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),loadingMethods: PropTypes.arrayOf(PropTypes.shape({id: PropTypes.string,diff --git a/src/constants/action-types.d.ts b/src/constants/action-types.d.tsindex 9f0ec7540..c044eaa90 100644--- a/src/constants/action-types.d.ts+++ b/src/constants/action-types.d.ts@@ -42,6 +42,7 @@ export type ActionType = {LOAD_NEXT_FILE: string;LOAD_FILES_ERR: string;LOAD_FILES_SUCCESS: string;+ LOAD_FILE_STEP_SUCCESS: string;LAYER_COLOR_UI_CHANGE: string;TOGGLE_FEATURE_LAYER: string;APPLY_CPU_FILTER: string;@@ -49,7 +50,9 @@ export type ActionType = {SORT_TABLE_COLUMN: string;PIN_TABLE_COLUMN: string;COPY_TABLE_COLUMN: string;-+ NEXT_FILE_BATCH: string;+ PROCESS_FILE_CONTENT: string;+// mapStateUPDATE_MAP: string;FIT_BOUNDS: string;diff --git a/src/constants/action-types.js b/src/constants/action-types.jsindex 7cea768e7..7a8134135 100644--- a/src/constants/action-types.js+++ b/src/constants/action-types.js@@ -91,6 +91,7 @@ const ActionTypes = {SET_FILTER_PLOT: `${ACTION_PREFIX}SET_FILTER_PLOT`,LOAD_FILES: `${ACTION_PREFIX}LOAD_FILES`,LOAD_NEXT_FILE: `${ACTION_PREFIX}LOAD_NEXT_FILE`,+ LOAD_FILE_STEP_SUCCESS: `${ACTION_PREFIX}LOAD_FILE_STEP_SUCCESS`,LOAD_FILES_ERR: `${ACTION_PREFIX}LOAD_FILES_ERR`,LOAD_FILES_SUCCESS: `${ACTION_PREFIX}LOAD_FILES_SUCCESS`,LAYER_COLOR_UI_CHANGE: `${ACTION_PREFIX}LAYER_COLOR_UI_CHANGE`,@@ -100,6 +101,8 @@ const ActionTypes = {SORT_TABLE_COLUMN: `${ACTION_PREFIX}SORT_TABLE_COLUMN`,PIN_TABLE_COLUMN: `${ACTION_PREFIX}PIN_TABLE_COLUMN`,COPY_TABLE_COLUMN: `${ACTION_PREFIX}COPY_TABLE_COLUMN`,+ NEXT_FILE_BATCH: `${ACTION_PREFIX}NEXT_FILE_BATCH`,+ PROCESS_FILE_CONTENT: `${ACTION_PREFIX}PROCESS_FILE_CONTENT`,// mapStateUPDATE_MAP: `${ACTION_PREFIX}UPDATE_MAP`,diff --git a/src/processors/data-processor.d.ts b/src/processors/data-processor.d.tsindex dbc3d472f..f14fe78d0 100644--- a/src/processors/data-processor.d.ts+++ b/src/processors/data-processor.d.ts@@ -7,7 +7,7 @@ type RowData = {}[];type ProcessorResult = {fields: Field[]; rows: any[][]} | null;export function processGeojson(rawData: object): ProcessorResult;-export function processCsvData(rawData: string): ProcessorResult;+export function processCsvData(rawData: string | any[][], header?: strin[]): ProcessorResult;export function processKeplerglJSON(rawData: SavedMap): ProcessorResult;export function processRowObject(rawData: object[]): ProcessorResult;export function processKeplerglDataset(diff --git a/src/processors/data-processor.js b/src/processors/data-processor.jsindex 949c490b7..024bfa684 100644--- a/src/processors/data-processor.js+++ b/src/processors/data-processor.js@@ -25,7 +25,7 @@ import assert from 'assert';import {Analyzer, DATA_TYPES as AnalyzerDATA_TYPES} from 'type-analyzer';import normalize from '@mapbox/geojson-normalize';import {ALL_FIELD_TYPES, DATASET_FORMATS} from 'constants/default-settings';-import {notNullorUndefined, parseFieldValue, getSampleData} from 'utils/data-utils';+import {notNullorUndefined, parseFieldValue} from 'utils/data-utils';import KeplerGlSchema from 'schemas';import {GUIDES_FILE_FORMAT_DOC} from 'constants/user-guides';import {isPlainObject, toArray} from 'utils/utils';@@ -48,7 +48,9 @@ export const ACCEPTED_ANALYZER_TYPES = [];// if any of these value occurs in csv, parse it to null;-const CSV_NULLS = ['', 'null', 'NULL', 'Null', 'NaN', '/N'];+// const CSV_NULLS = ['', 'null', 'NULL', 'Null', 'NaN', '/N'];+// matches empty string+export const CSV_NULLS = /^(null|NULL|Null|NaN|\/N||)$/;const IGNORE_DATA_TYPES = Object.keys(AnalyzerDATA_TYPES).filter(type => !ACCEPTED_ANALYZER_TYPES.includes(type)@@ -70,6 +72,7 @@ export const PARSE_FIELD_VALUE_FROM_STRING = {},[ALL_FIELD_TYPES.real]: {valid: d => parseFloat(d) === d,+ // Note this will result in NaN for some stringparse: parseFloat}};@@ -100,25 +103,43 @@ export const PARSE_FIELD_VALUE_FROM_STRING = {* options: {centerMap: true, readOnly: true}* }));*/-export function processCsvData(rawData) {- // here we assume the csv file that people uploaded will have first row- // as name of the column- // TODO: add a alert at upload csv to remind define first row- const result = csvParseRows(rawData);- if (!Array.isArray(result) || result.length < 2) {- // looks like an empty file, throw error to be catch- throw new Error('Read File Failed: CSV is empty');+export function processCsvData(rawData, header) {+ let rows;+ let headerRow;++ if (typeof rawData === 'string') {+ const parsedRows = csvParseRows(rawData);++ if (!Array.isArray(parsedRows) || parsedRows.length < 2) {+ // looks like an empty file, throw error to be catch+ throw new Error('process Csv Data Failed: CSV is empty');+ }+ headerRow = parsedRows[0];+ rows = parsedRows.slice(1);+ } else if (Array.isArray(rawData) && rawData.length) {+ rows = rawData;+ headerRow = header;++ if (!Array.isArray(headerRow)) {+ // if data is passed in as array of rows and missing header+ // assume first row is header+ headerRow = rawData[0];+ rows = rawData.slice(1);+ }+ }++ if (!rows || !headerRow) {+ throw new Error('invalid input passed to processCsvData');}- const [headerRow, ...rows] = result;+ // here we assume the csv file that people uploaded will have first row+ // as name of the columncleanUpFalsyCsvValue(rows);// No need to run type detection on every data point// here we get a list of none null values to run analyze onconst sample = getSampleForTypeAnalyze({fields: headerRow, allData: rows});-const fields = getFieldsFromData(sample, headerRow);-const parsedRows = parseRowsByFields(rows, fields);return {fields, rows: parsedRows};@@ -178,13 +199,14 @@ export function getSampleForTypeAnalyze({fields, allData, sampleCount = 50}) {* @param {Array<Array>} rows*/function cleanUpFalsyCsvValue(rows) {+ const re = new RegExp(CSV_NULLS, 'g');for (let i = 0; i < rows.length; i++) {for (let j = 0; j < rows[i].length; j++) {// analyzer will set any fields to 'string' if there are empty values// which will be parsed as '' by d3.csv// here we parse empty data as null// TODO: create warning when deltect `CSV_NULLS` in the data- if (!rows[i][j] || CSV_NULLS.includes(rows[i][j])) {+ if (typeof rows[i][j] === 'string' && rows[i][j].match(re)) {rows[i][j] = null;}}@@ -409,15 +431,10 @@ export function processRowObject(rawData) {const keys = Object.keys(rawData[0]);const rows = rawData.map(d => keys.map(key => d[key]));- // pick samples- const sampleData = getSampleData(rawData, 500);- const fields = getFieldsFromData(sampleData, keys);- const parsedRows = parseRowsByFields(rows, fields);+ // row object an still contain values like `Null` or `N/A`+ cleanUpFalsyCsvValue(rows);- return {- fields,- rows: parsedRows- };+ return processCsvData(rows, keys);}/**diff --git a/src/processors/file-handler.d.ts b/src/processors/file-handler.d.tsindex de8af0c29..f91e999b8 100644--- a/src/processors/file-handler.d.ts+++ b/src/processors/file-handler.d.ts@@ -28,10 +28,14 @@ export type FileCacheItem = {};};-export function readFile(payload: {+export function readFileInBatches(payload: {file: File;fileCache: FileCacheItem[];+}): AsyncGenerator;++export function processFileData(payload: {+ content: any;+ fileCache: FileCacheItem[];}): Promise<FileCacheItem[]>;-export function getFileHandler(fileBlob: File): {handler: function; format: string};+export function filesToDataPayload(fileCache: FileCacheItem[]): AddDataToMaoPayload[];-export function getFileType(filename: string): 'csv' | 'json' | 'other';\ No newline at end of filediff --git a/src/processors/file-handler.js b/src/processors/file-handler.jsindex c02dd237d..a6221ba33 100644--- a/src/processors/file-handler.js+++ b/src/processors/file-handler.js@@ -18,130 +18,38 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {FileReader} from 'global/window';-import Console from 'global/console';-import {- processCsvData,- processGeojson,- processKeplerglJSON,- processRowObject-} from './data-processor';+import '@loaders.gl/polyfills';+import {parseInBatches} from '@loaders.gl/core';+import {JSONLoader, _JSONPath} from '@loaders.gl/json';+import {CSVLoader} from '@loaders.gl/csv';+import {processGeojson, processKeplerglJSON, processRowObject} from './data-processor';import {isPlainObject, generateHashId} from 'utils/utils';import {DATASET_FORMATS} from 'constants/default-settings';-const FILE_HANDLERS = {- csv: loadCsv,- json: loadJSON+const BATCH_TYPE = {+ METADATA: 'metadata',+ PARTIAL_RESULT: 'partial-result',+ FINAL_RESULT: 'final-result'};-/** @type {typeof import('./file-handler').readFile} */-export function readFile({file, fileCache = []}) {- return new Promise((resolve, reject) => {- const {handler, format} = getFileHandler(file);- if (!handler) {- Console.warn(- `Canont determine file handler for file ${file.name}. It must have a valid file extension`- );- resolve(fileCache);- }-- handler({file, format}).then(result => {- if (!result || !result.data) {- // return fileCache, to keep process other files- resolve(fileCache);- }- resolve([- ...fileCache,- {- data: result.data,- info: {- label: file.name,- format: result.format- }- }- ]);- });- });-}--/** @type {typeof import('./file-handler').getFileHandler} */-export function getFileHandler(fileBlob) {- const type = getFileType(fileBlob.name);-- return {handler: FILE_HANDLERS[type], format: type};-}--/** @type {typeof import('./file-handler').getFileType} */-export function getFileType(filename) {- if (filename.endsWith('csv')) {- return 'csv';- } else if (filename.endsWith('json') || filename.endsWith('geojson')) {- // Read GeoJson from browser- return 'json';- }-- // Wait to add other file type handler- return 'other';-}--function readCSVFile(fileBlob) {- return new Promise((resolve, reject) => {- const fileReader = new FileReader();- fileReader.onload = ({target: {result}}) => {- resolve(result);- };-- fileReader.readAsText(fileBlob);- });-}--export function loadCsv({file, format, processor = processCsvData}) {- return readCSVFile(file).then(rawData => (rawData ? {data: processor(rawData), format} : null));-}--export function loadJSON({file, processor = processGeojson}) {- return readJSONFile(file).then(content => {- if (isKeplerGlMap(content)) {- return {- format: DATASET_FORMATS.keplergl,- data: processKeplerglJSON(content)- };- } else if (isRowObject(content)) {- return {- format: DATASET_FORMATS.row,- data: processRowObject(content)- };- } else if (isGeoJson(content)) {- return {- format: DATASET_FORMATS.geojson,- data: processGeojson(content)- };- }- // unsupported json format- Console.warn(`unsupported Json format ${file.name}`);- return null;- });-}--export function readJSONFile(fileBlob) {- return new Promise((resolve, reject) => {- const fileReader = new FileReader();- fileReader.onload = ({target: {result}}) => {- try {- const json = JSON.parse(result);- resolve(json);- } catch (err) {- reject(null);- }- };+const CSV_LOADER_OPTIONS = {+ batchSize: 4000, // Auto de tect number of rows per batch (network batch size)+ rowFormat: 'object',+ dynamicTyping: false // not working for now+};- fileReader.readAsText(fileBlob, 'UTF-8');- });-}+const JSON_LOADER_OPTIONS = {+ // instruct loaders.gl on what json paths to stream+ jsonpaths: [+ '$', // JSON Row array+ '$.features', // GeoJSON+ '$.datasets' // KeplerGL JSON+ ]+};export function isGeoJson(json) {// json can be feature collection- // or simgle feature+ // or single featurereturn isPlainObject(json) && (isFeature(json) || isFeatureCollection(json));}@@ -158,21 +66,122 @@ export function isRowObject(json) {}export function isKeplerGlMap(json) {- return (+ return Boolean(isPlainObject(json) &&- json.datasets &&- json.config &&- json.info &&- json.info.app === 'kepler.gl'+ json.datasets &&+ json.config &&+ json.info &&+ json.info.app === 'kepler.gl');}-export function determineJsonProcess({dataset, format}, defaultProcessor) {- if (isKeplerGlMap(dataset)) {- return processKeplerglJSON;+export async function* makeProgressIterator(asyncIterator, info) {+ let rowCount = 0;++ for await (const batch of asyncIterator) {+ const rowCountInBatch = (batch.data && batch.data.length) || 0;+ rowCount += rowCountInBatch;+ const percent = Number.isFinite(batch.bytesUsed) ? batch.bytesUsed / info.size : null;++ // Update progress object+ const progress = {+ rowCount,+ rowCountInBatch,+ // @ts-ignore+ ...(Number.isFinite(percent) ? {percent} : {})+ };++ yield {...batch, progress};+ }+}++// eslint-disable-next-line complexity+export async function* readBatch(asyncIterator, fileName) {+ let result = null;+ const batches = [];++ for await (const batch of asyncIterator) {+ // Last batch will have this special type and will provide all the root+ // properties of the parsed document.+ if (batch.batchType === BATCH_TYPE.FINAL_RESULT) {+ if (batch.container) {+ result = {...batch.container};+ }+ // Set the streamed data correctly is Batch json path is set+ // and the path streamed is not the top level object (jsonpath = '$')+ if (batch.jsonpath && batch.jsonpath.length > 1) {+ const streamingPath = new _JSONPath(batch.jsonpath);+ streamingPath.setFieldAtPath(result, batches);+ } else {+ // The streamed object is a ROW JSON-batch+ result = batches;+ }+ } else {+ for (let i = 0; i < batch.data.length; i++) {+ batches.push(batch.data[i]);+ }+ }++ yield {+ ...batch,+ ...(batch.schema ? {headers: Object.keys(batch.schema)} : {}),+ fileName,+ // if dataset is CSV, data is set to the raw batches+ data: result ? result : batches+ };}+}++export async function readFileInBatches({file, fileCache = []}) {+ const batchIterator = await parseInBatches(+ file,+ [JSONLoader, CSVLoader],+ {+ csv: CSV_LOADER_OPTIONS,+ json: JSON_LOADER_OPTIONS,+ metadata: true+ },+ file.name+ );+ const progressIterator = makeProgressIterator(batchIterator, {size: file.size});++ return readBatch(progressIterator, file.name);+}++export function processFileData({content, fileCache}) {+ return new Promise((resolve, reject) => {+ const {data} = content;++ let format;+ let processor;+ if (isKeplerGlMap(data)) {+ format = DATASET_FORMATS.keplergl;+ processor = processKeplerglJSON;+ } else if (isRowObject(data)) {+ format = DATASET_FORMATS.row;+ processor = processRowObject;+ } else if (isGeoJson(data)) {+ format = DATASET_FORMATS.geojson;+ processor = processGeojson;+ }++ if (format && processor) {+ const result = processor(data);++ resolve([+ ...fileCache,+ {+ data: result,+ info: {+ label: content.fileName,+ format+ }+ }+ ]);+ }- return defaultProcessor;+ reject('Unknow File Format');+ });}export function filesToDataPayload(fileCache) {diff --git a/src/processors/index.js b/src/processors/index.jsindex cf1325783..1e4693b8a 100644--- a/src/processors/index.js+++ b/src/processors/index.js@@ -31,6 +31,6 @@ export {} from './data-processor';// File Handlers-export {getFileHandler, getFileType, readFile, filesToDataPayload} from './file-handler';+export {readFileInBatches, processFileData, filesToDataPayload} from './file-handler';export {Processors as default} from './data-processor';diff --git a/src/reducers/combined-updaters.d.ts b/src/reducers/combined-updaters.d.tsindex 49031285e..aff74a916 100644--- a/src/reducers/combined-updaters.d.ts+++ b/src/reducers/combined-updaters.d.ts@@ -5,7 +5,7 @@ import {MapStyle} from './map-style-updaters';import {ProviderState} from './provider-state-updaters';import {AddDataToMaoPayload} from 'actions/actions';import {FileCacheItem} from 'processors/file-handler';-import {LoadFileSuccessUpdaterAction} from 'actions/vis-state-actions';+import {loadFilesSuccessUpdaterAction} from 'actions/vis-state-actions';export type KeplerGlState = {visState: VisState;@@ -20,7 +20,7 @@ export function addDataToMapUpdater(action: {payload: AddDataToMaoPayload}): KeplerGlState;-export function loadFileSuccessUpdater(+export function loadFilesSuccessUpdater(state: KeplerGlState,- action: LoadFileSuccessUpdaterAction+ action: loadFilesSuccessUpdaterAction): KeplerGlState;\ No newline at end of filediff --git a/src/reducers/combined-updaters.js b/src/reducers/combined-updaters.jsindex ba16522fb..45aeb77e0 100644--- a/src/reducers/combined-updaters.js+++ b/src/reducers/combined-updaters.js@@ -18,7 +18,10 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {toggleModalUpdater, loadFilesSuccessUpdater} from './ui-state-updaters';+import {+ toggleModalUpdater,+ loadFilesSuccessUpdater as uiStateLoadFilesSuccessUpdater+} from './ui-state-updaters';import {updateVisDataUpdater as visStateUpdateVisDataUpdater,setMapInfoUpdater@@ -29,7 +32,7 @@ import {findMapBounds} from 'utils/data-utils';import KeplerGlSchema from 'schemas';import {isPlainObject} from 'utils/utils';import {filesToDataPayload} from 'processors/file-handler';-import Console from 'global/console';+import {payload_, apply_, with_, if_, compose_, merge_, pick_} from './composer-helpers';// compose action to apply result multiple reducers, with the output of one@@ -88,43 +91,6 @@ export const defaultAddDataToMapOptions = {keepExistingConfig: false};-const identity = state => state;--/* eslint-disable no-unused-vars */-// @ts-ignore-function log(text) {- return value => Console.log(text, value);-}-/* eslint-enable no-unused-vars */--function payload_(p) {- return {payload: p};-}--function apply_(updater, payload) {- return state => updater(state, payload);-}--function with_(fn) {- return state => fn(state)(state);-}--function if_(pred, fn) {- return pred ? fn : identity;-}--function compose_(fns) {- return state => fns.reduce((state2, fn) => fn(state2), state);-}--function merge_(obj) {- return state => ({...state, ...obj});-}--function pick_(prop) {- return fn => state => ({...state, [prop]: fn(state[prop])});-}-/*** Combine data and full configuration update in a single action*@@ -196,7 +162,7 @@ export const addDataToMapUpdater = (state, {payload}) => {pick_('mapStyle')(apply_(styleMapConfigUpdater, payload_({config: parsedConfig, options}))),- pick_('uiState')(apply_(loadFilesSuccessUpdater)),+ pick_('uiState')(apply_(uiStateLoadFilesSuccessUpdater)),pick_('uiState')(apply_(toggleModalUpdater, payload_(null))),@@ -205,22 +171,24 @@ export const addDataToMapUpdater = (state, {payload}) => {};/**- * @type {typeof import('./combined-updaters').loadFileSuccessUpdater}+ * @type {typeof import('./combined-updaters').loadFilesSuccessUpdater}*/-export const loadFileSuccessUpdater = (state, action) => {+export const loadFilesSuccessUpdater = (state, action) => {// still more to loadconst payloads = filesToDataPayload(action.result);const nextState = compose_([pick_('visState')(merge_({fileLoading: false,- fileLoadingProgress: 100+ fileLoadingProgress: {}}))])(state);-// make multiple add data to map calls- return compose_(payloads.map(p => apply_(addDataToMapUpdater, payload_(p))))(nextState);+ const stateWithData = compose_(payloads.map(p => apply_(addDataToMapUpdater, payload_(p))))(+ nextState+ );+ return stateWithData;};export const addDataToMapComposed = addDataToMapUpdater;diff --git a/src/reducers/composer-helpers.js b/src/reducers/composer-helpers.jsnew file mode 100644index 000000000..0065f83ae--- /dev/null+++ b/src/reducers/composer-helpers.js@@ -0,0 +1,58 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import Console from 'global/console';++const identity = state => state;++/* eslint-disable no-unused-vars */+// @ts-ignore+export function log(text) {+ return value => Console.log(text, value);+}+/* eslint-enable no-unused-vars */++export function payload_(p) {+ return {payload: p};+}++export function apply_(updater, payload) {+ return state => updater(state, payload);+}++export function with_(fn) {+ return state => fn(state)(state);+}++export function if_(pred, fn) {+ return pred ? fn : identity;+}++export function compose_(fns) {+ return state => fns.reduce((state2, fn) => fn(state2), state);+}++export function merge_(obj) {+ return state => ({...state, ...obj});+}++export function pick_(prop) {+ return fn => state => ({...state, [prop]: fn(state[prop])});+}diff --git a/src/reducers/composers.js b/src/reducers/composers.jsindex 7819fb873..5c82c249c 100644--- a/src/reducers/composers.js+++ b/src/reducers/composers.js@@ -27,7 +27,7 @@ import * as combinedUpdaters from './combined-updaters';*/const actionHandler = {[ActionTypes.ADD_DATA_TO_MAP]: combinedUpdaters.addDataToMapUpdater,- [ActionTypes.LOAD_FILES_SUCCESS]: combinedUpdaters.loadFileSuccessUpdater+ [ActionTypes.LOAD_FILES_SUCCESS]: combinedUpdaters.loadFilesSuccessUpdater};export default actionHandler;diff --git a/src/reducers/vis-state-updaters.d.ts b/src/reducers/vis-state-updaters.d.tsindex 82a391f1c..d4c665db9 100644--- a/src/reducers/vis-state-updaters.d.ts+++ b/src/reducers/vis-state-updaters.d.ts@@ -150,7 +150,7 @@ export type FieldPair = {[key: string]: {fieldIdx: number;value: string;- }+ };};suffix: string[];};@@ -231,7 +231,7 @@ type BaseInteraction = {type TooltipField = {name: string;format: string | null;-}+};export type Tooltip = BaseInteraction & {config: {fieldsToShow: {@@ -260,6 +260,22 @@ export type MapInfo = {title: string;description: string;};+export type FileLoading =+ | {+ filesToLoad: any[];+ onFinish: (payload: any) => any;+ fileCache: any[];+ }+ | false;+export type FileLoadingProgress = {+ [key: string]: {+ percent: number;+ message: string;+ fileName: string;+ error: any;+ };+};+export type VisState = {mapInfo: MapInfo;layers: Layer[];@@ -284,8 +300,8 @@ export type VisState = {splitMaps: SplitMap[];splitMapsToBeMerged?: SplitMap[];initialState?: Partial<VisState>;- fileLoading?: boolean;- fileLoadingErr?: any;+ fileLoading?: FileLoading;+ fileLoadingProgress?: FileLoadingProgress;};export function addDefaultLayers(@@ -447,14 +463,26 @@ export function loadNextFileUpdater(state: VisState,action: VisStateActions.LoadNextFileUpdaterAction): VisState;-export function loadFileSuccessUpdater(+export function loadFilesSuccessUpdater(state: VisState,- action: VisStateActions.LoadFileSuccessUpdaterAction+ action: VisStateActions.loadFilesSuccessUpdaterAction): VisState;export function loadFilesErrUpdater(state: VisState,action: VisStateActions.LoadFilesErrUpdaterAction): VisState;+export function loadFileStepSuccessUpdater(+ state: VisState,+ action: VisStateActions.loadFileStepSuccessAction+): VisState;+export function nextFileBatchUpdater(+ state: VisState,+ action: VisStateActions.nextFileBatchUpdaterAction+): VisState;+export function processFileContentUpdater(+ state: VisState,+ action: VisStateActions.processFileContentUpdaterAction+): VisState;export function setFeaturesUpdater(state: VisState,action: VisStateActions.SetFeaturesUpdaterActiondiff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.jsindex ac6d2edee..4590c9e73 100644--- a/src/reducers/vis-state-updaters.js+++ b/src/reducers/vis-state-updaters.js@@ -27,9 +27,15 @@ import xor from 'lodash.xor';import copy from 'copy-to-clipboard';import {parseFieldValue} from 'utils/data-utils';// Tasks-import {LOAD_FILE_TASK} from 'tasks/tasks';+import {LOAD_FILE_TASK, UNWRAP_TASK, PROCESS_FILE_DATA, DELAY_TASK} from 'tasks/tasks';// Actions-import {loadFilesErr, loadFileSuccess, loadNextFile} from 'actions/vis-state-actions';+import {+ loadFilesErr,+ loadFilesSuccess,+ loadFileStepSuccess,+ loadNextFile,+ nextFileBatch+} from 'actions/vis-state-actions';// Utilsimport {findFieldsToShow, getDefaultInteraction} from 'utils/interaction-utils';import {@@ -71,6 +77,8 @@ import {import {Layer, LayerClasses} from 'layers';import {DEFAULT_TEXT_LABEL} from 'layers/layer-factory';import {EDITOR_MODES, SORT_ORDER} from 'constants/default-settings';+import {pick_, merge_} from './composer-helpers';+import {processFileContent} from 'actions/vis-state-actions';// type imports/** @typedef {import('./vis-state-updaters').Field} Field */@@ -1231,65 +1239,160 @@ function closeSpecificMapAtIndex(state, action) {* @public*/export const loadFilesUpdater = (state, action) => {- const {files, onFinish = loadFileSuccess} = action;+ const {files, onFinish = loadFilesSuccess} = action;if (!files.length) {return state;}- const fileCache = [];- return withTask(- {- ...state,- fileLoading: true,- fileLoadingProgress: 0- },- makeLoadFileTask(files.length, files, fileCache, onFinish)+ const fileLoadingProgress = Array.from(files).reduce(+ (accu, f, i) => merge_(initialFileLoadingProgress(f, i))(accu),+ {});+ const fileLoading = {+ fileCache: [],+ filesToLoad: files,+ onFinish+ };+ const nextState = merge_({fileLoading})(merge_({fileLoadingProgress})(state));++ return loadNextFileUpdater(nextState);};-export function loadNextFileUpdater(state, action) {- const {fileCache, filesToLoad, totalCount, onFinish} = action;- const fileLoadingProgress = ((totalCount - filesToLoad.length) / totalCount) * 100;+// sucessfully loaded one file, move on to the next one+export function loadFileStepSuccessUpdater(state, action) {+ const {fileName, fileCache} = action;+ const {filesToLoad, onFinish} = state.fileLoading;+ const stateWithProgress = updateFileLoadingProgressUpdater(state, {+ fileName,+ progress: {percent: 1, message: 'Done'}+ });++ // save processed file to fileCache+ const stateWithCache = pick_('fileLoading')(merge_({fileCache}))(stateWithProgress);return withTask(- {- ...state,- fileLoadingProgress- },- makeLoadFileTask(totalCount, filesToLoad, fileCache, onFinish)+ stateWithCache,+ DELAY_TASK(200).map(filesToLoad.length ? loadNextFile : () => onFinish(fileCache)));}-export function makeLoadFileTask(totalCount, filesToLoad, fileCache, onFinish) {+export function loadNextFileUpdater(state) {+ const {filesToLoad} = state.fileLoading;const [file, ...remainingFilesToLoad] = filesToLoad;+ // save filesToLoad to state+ const nextState = pick_('fileLoading')(merge_({filesToLoad: remainingFilesToLoad}))(state);++ const stateWithProgress = updateFileLoadingProgressUpdater(nextState, {+ fileName: file.name,+ progress: {percent: 0, message: 'loading...'}+ });++ return withTask(stateWithProgress, makeLoadFileTask(file, nextState.fileLoading.fileCache));+}++export function makeLoadFileTask(file, fileCache) {return LOAD_FILE_TASK({file, fileCache}).bimap(+ // prettier ignore// success- result =>- remainingFilesToLoad.length- ? loadNextFile({- fileCache: result,- filesToLoad: remainingFilesToLoad,- totalCount,- onFinish+ gen =>+ nextFileBatch({+ gen,+ fileName: file.name,+ onFinish: result =>+ processFileContent({+ content: result,+ fileCache})- : onFinish(result),+ }),+// error- loadFilesErr+ err => loadFilesErr(file.name, err));}+export function processFileContentUpdater(state, action) {+ const {content, fileCache} = action.payload;++ const stateWithProgress = updateFileLoadingProgressUpdater(state, {+ fileName: content.fileName,+ progress: {percent: 1, message: 'processing...'}+ });++ return withTask(+ stateWithProgress,+ PROCESS_FILE_DATA({content, fileCache}).bimap(+ result => loadFileStepSuccess({fileName: content.fileName, fileCache: result}),+ err => loadFilesErr(content.fileName, err)+ )+ );+}++export function parseProgress(prevProgress = {}, progress) {+ // This happens when receiving query metadata or other cases we don't+ // have an update for the user.+ if (!progress || !progress.percent) {+ return {};+ }++ return {+ percent: progress.percent+ };+}++// gets called with payload = AsyncGenerator<???>+export const nextFileBatchUpdater = (+ state,+ {payload: {gen, fileName, progress, accumulated, onFinish}}+) => {+ const stateWithProgress = updateFileLoadingProgressUpdater(state, {+ fileName,+ progress: parseProgress(state.fileLoadingProgress[fileName], progress)+ });+ return withTask(+ stateWithProgress,+ UNWRAP_TASK(gen.next()).bimap(+ ({value, done}) => {+ return done+ ? onFinish(accumulated)+ : nextFileBatch({+ gen,+ fileName,+ progress: value.progress,+ accumulated: value,+ onFinish+ });+ },+ err => loadFilesErr(fileName, err)+ )+ );+};+/*** Trigger loading file error* @memberof visStateUpdaters* @type {typeof import('./vis-state-updaters').loadFilesErrUpdater}* @public*/-export const loadFilesErrUpdater = (state, {error}) => ({- ...state,- fileLoading: false,- fileLoadingErr: error-});+export const loadFilesErrUpdater = (state, {error, fileName}) => {+ // update ui with error message+ Console.warn(error);+ if (!state.fileLoading) {+ return state;+ }+ const {filesToLoad, onFinish, fileCache} = state.fileLoading;++ const nextState = updateFileLoadingProgressUpdater(state, {+ fileName,+ progress: {error}+ });++ // kick off next file or finish+ return withTask(+ nextState,+ DELAY_TASK(200).map(filesToLoad.length ? loadNextFile : () => onFinish(fileCache))+ );+};/*** When select dataset for export, apply cpu filter to selected dataset@@ -1322,11 +1425,12 @@ export const setMapInfoUpdater = (state, action) => ({* @type {typeof import('./vis-state-updaters').addDefaultLayers}*/export function addDefaultLayers(state, datasets) {- const defaultLayers = Object.values(datasets).reduce(- // @ts-ignore- (accu, dataset) => [...accu, ...(findDefaultLayer(dataset, state.layerClasses) || [])],- []- );+ /** @type {Layer[]} */+ const empty = [];+ const defaultLayers = Object.values(datasets).reduce((accu, dataset) => {+ const foundLayers = findDefaultLayer(dataset, state.layerClasses);+ return foundLayers && foundLayers.length ? accu.concat(foundLayers) : accu;+ }, empty);return {state: {@@ -1358,6 +1462,22 @@ export function addDefaultTooltips(state, dataset) {return set(['interactionConfig', 'tooltip', 'config', 'fieldsToShow'], merged, state);}+export function initialFileLoadingProgress(file, index) {+ const fileName = file.name || `Untitled File ${index}`;+ return {+ [fileName]: {+ // percent of current file+ percent: 0,+ message: '',+ fileName,+ error: null+ }+ };+}++export function updateFileLoadingProgressUpdater(state, {fileName, progress}) {+ return pick_('fileLoadingProgress')(pick_(fileName)(merge_(progress)))(state);+}/*** Helper function to update layer domains for an array of datasets* @type {typeof import('./vis-state-updaters').updateAllLayerDomainData}diff --git a/src/reducers/vis-state.js b/src/reducers/vis-state.jsindex c6ff63c28..671b43d2d 100644--- a/src/reducers/vis-state.js+++ b/src/reducers/vis-state.js@@ -57,6 +57,8 @@ const actionHandler = {[ActionTypes.LOAD_NEXT_FILE]: visStateUpdaters.loadNextFileUpdater,+ [ActionTypes.LOAD_FILE_STEP_SUCCESS]: visStateUpdaters.loadFileStepSuccessUpdater,+[ActionTypes.MAP_CLICK]: visStateUpdaters.mapClickUpdater,[ActionTypes.MOUSE_MOVE]: visStateUpdaters.mouseMoveUpdater,@@ -117,7 +119,11 @@ const actionHandler = {[ActionTypes.PIN_TABLE_COLUMN]: visStateUpdaters.pinTableColumnUpdater,- [ActionTypes.COPY_TABLE_COLUMN]: visStateUpdaters.copyTableColumnUpdater+ [ActionTypes.COPY_TABLE_COLUMN]: visStateUpdaters.copyTableColumnUpdater,++ [ActionTypes.NEXT_FILE_BATCH]: visStateUpdaters.nextFileBatchUpdater,++ [ActionTypes.PROCESS_FILE_CONTENT]: visStateUpdaters.processFileContentUpdater};// construct vis-state reducerdiff --git a/src/styles/base.js b/src/styles/base.jsindex 8cba9e227..926e19490 100644--- a/src/styles/base.js+++ b/src/styles/base.js@@ -294,6 +294,9 @@ const timeDisplayPadding = '0 24px';// Export map modalconst exportIntraSectionMargin = '8';+// progress bar+const progressBarColor = primaryBtnBgd;+const progressBarTrackColor = '#E8E8E8';// Action Panelexport const actionPanelWidth = 110;export const actionPanelHeight = 32;@@ -1131,7 +1134,11 @@ export const theme = {actionPanelHeight,// Breakpoints- breakPoints+ breakPoints,++ // progressbar+ progressBarColor,+ progressBarTrackColor};export const themeLT = {diff --git a/src/tasks/tasks.js b/src/tasks/tasks.jsindex 50f52c25d..219648c6b 100644--- a/src/tasks/tasks.js+++ b/src/tasks/tasks.js@@ -20,13 +20,19 @@import Task, {taskCreator} from 'react-palm/tasks';import {json as requestJson} from 'd3-request';-import {readFile} from '../processors/file-handler';+import {readFileInBatches, processFileData} from '../processors/file-handler';export const LOAD_FILE_TASK = Task.fromPromise(- ({file, fileCache}) => readFile({file, fileCache}),+ ({file, fileCache}) => readFileInBatches({file, fileCache}),'LOAD_FILE_TASK');+export const PROCESS_FILE_DATA = Task.fromPromise(+ processFileData,++ 'PROCESS_FILE_CONTENT'+);+export const LOAD_MAP_STYLE_TASK = taskCreator(({url, id}, success, error) =>requestJson(url, (err, result) => {@@ -77,3 +83,9 @@ export const DELAY_TASK = Task.fromCallback('DELAY_TASK');++export const UNWRAP_TASK = Task.fromPromise(+ promise => promise,++ 'UNWRAP'+);diff --git a/src/utils/layer-utils/layer-utils.d.ts b/src/utils/layer-utils/layer-utils.d.tsindex cf77a9b4d..28a32e88b 100644--- a/src/utils/layer-utils/layer-utils.d.ts+++ b/src/utils/layer-utils/layer-utils.d.ts@@ -16,4 +16,4 @@ type FoundLayerProp = {export function findDefaultLayer(dataset: Dataset,layerClasses: LayerClasses-): FoundLayerProp[]\ No newline at end of file+): Layer[]\ No newline at end of filediff --git a/test/browser-drive.js b/test/browser-drive.jsnew file mode 100644index 000000000..8af96db41--- /dev/null+++ b/test/browser-drive.js@@ -0,0 +1,53 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++const fs = require('fs');+const resolve = require('path').resolve;+const BrowserTestDriver = require('@probe.gl/test-utils').BrowserTestDriver;++const configPath = resolve(__dirname, './webpack.config.js');++const options = {+ server: {+ command: 'webpack-dev-server',+ arguments: ['--config', configPath, '--env.mode=test']+ },+ browser: {+ defaultViewport: {width: 1200, height: 800}+ },+ headless: false,+ executablePath: getExecutablePath()+};++function getExecutablePath(dir) {+ try {+ const puppeteer = require(dir ? `${dir}/node_modules/puppeteer` : 'puppeteer');+ const executablePath = puppeteer.executablePath();+ if (fs.existsSync(executablePath)) {+ return executablePath;+ }+ } catch (err) {+ // ignore+ }+ return null;+}++const browserTest = new BrowserTestDriver();+browserTest.run(options);diff --git a/test/browser.js b/test/browser.jsindex 21bea00e5..a52ff851a 100644--- a/test/browser.js+++ b/test/browser.js@@ -18,4 +18,19 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import './browser/index.js';+// import './browser/index.js';+require('@probe.gl/test-utils/polyfill');++const test = require('tape-catch');+const enableDOMLogging = require('@probe.gl/test-utils')._enableDOMLogging;+enableDOMLogging();++test.onFinish(window.browserTestDriver_finish);+test.onFailure(window.browserTestDriver_fail);++test('Browser tests', t => {+ // require('./node/index.js');+ require('./browser/index.js');++ t.end();+});diff --git a/test/browser/components/common/file-uploader-test.js b/test/browser/components/common/file-uploader-test.jsindex 2ed480d1e..15deeeb5c 100644--- a/test/browser/components/common/file-uploader-test.js+++ b/test/browser/components/common/file-uploader-test.js@@ -89,9 +89,21 @@ test('Components -> FileUpload.onDrop -> render loading msg', t => {t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');});+ const mockFileProgress = {+ 'tst-file.csv': {+ fileName: 'tst-file.csv',+ percent: 1,+ message: 'Done'+ }+ };const wrapper = mountWithTheme(<IntlWrapper>- <FileUpload onFileUpload={onFileUpload} fileLoading />+ <FileUpload+ validFileExts={['csv', 'json', 'geojson']}+ onFileUpload={onFileUpload}+ fileLoading={{fileCache: [], filesToLoad: [], onFinish: () => {}}}+ fileLoadingProgress={mockFileProgress}+ /></IntlWrapper>);@@ -108,11 +120,12 @@ test('Components -> FileUpload.onDrop -> render loading msg', t => {FileDropDiv.simulate('drop', mockEvent);t.ok(onFileUpload.called, 'onFileUpload should get called');+const uploadMsg = wrapper- .find('.file-uploader__message')+ .find('.file-upload-progress__message').at(0).html();-+ t.comment(uploadMsg);t.ok(uploadMsg.includes('tst-file.csv', 'should render upload file msg'));t.end();diff --git a/test/browser/file-handler.js b/test/browser/file-handler.jsnew file mode 100644index 000000000..41ef13b41--- /dev/null+++ b/test/browser/file-handler.js@@ -0,0 +1,550 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++/* eslint-disable max-statements */+import test from 'tape';+import {processFileData, readFileInBatches} from 'processors/file-handler';+import {csvWithNull} from '../node/processors/file-handler-fixtures';+import {dataWithNulls, testFields, parsedDataWithNulls} from 'test/fixtures/test-csv-data';+import geojsonString, {+ processedFields as geojsonFields,+ processedRows as geojsonRows+} from 'test/fixtures/geojson-style';+import rowDataString, {parsedFields, parsedRows} from 'test/fixtures/row-object';+import {+ savedStateV1InteractionCoordinate as keplerglMap,+ parsedFields as parsedKeplerMapFields+} from 'test/fixtures/state-saved-v1-7';++import global from 'global';++/** loaders.gl uses these from global */+global.File = global.window.File;+global.FileReader = global.window.FileReader;+global.Blob = global.window.Blob;++test('#file-handler -> readFileInBatches.csv -> processFileData', async t => {+ const cseFile = new File([dataWithNulls], 'text-data.csv', {type: 'text/csv'});+ const gen = await readFileInBatches({file: cseFile, fileCache: []});++ // metadata batch+ const batch1 = await gen.next();++ const expected1 = {+ value: {+ batchType: 'metadata',+ metadata: {_loader: {}, _context: {}},+ data: [],+ bytesUsed: 0,+ progress: {rowCount: 0, rowCountInBatch: 0, percent: 0},+ fileName: 'text-data.csv'+ },+ done: false+ };+ t.deepEqual(+ Object.keys(batch1.value).sort(),+ Object.keys(expected1.value).sort(),+ 'value should have same keyss'+ );++ t.equal(batch1.value.batchType, expected1.value.batchType, 'batch1.batchType should be the same');+ t.equal(batch1.value.fileName, expected1.value.fileName, 'batch1.fileName should be the same');+ t.deepEqual(batch1.value.data, expected1.value.data, 'batch1.data should be the same');+ t.deepEqual(+ batch1.value.progress,+ expected1.value.progress,+ 'batch1.progress should be the same'+ );++ // data batch+ const batch2 = await gen.next();++ const expected2 = {+ value: {+ bytesUsed: undefined,+ count: 0,+ cursor: 0,+ data: csvWithNull,+ fileName: 'text-data.csv',+ headers: [+ 'gps_data.utc_timestamp',+ 'gps_data.lat',+ 'gps_data.lng',+ 'gps_data.types',+ 'epoch',+ 'has_result',+ 'id',+ 'time',+ 'begintrip_ts_utc',+ 'begintrip_ts_local',+ 'date'+ ],+ length: 13,+ progress: {rowCount: 13, rowCountInBatch: 13},+ schema: {}+ },+ done: false+ };++ t.deepEqual(+ Object.keys(batch2.value).sort(),+ Object.keys(expected2.value).sort(),+ 'value should have same keyss'+ );++ t.equal(batch2.value.fileName, expected2.value.fileName, 'batch2.fileName should be the same');+ // t.deepEqual(batch2.value.data, expected2.value.data, 'batch2.data should be the same');+ t.deepEqual(batch2.value.headers, expected2.value.headers, 'batch2.headers should be the same');+ t.deepEqual(+ batch2.value.progress,+ expected2.value.progress,+ 'batch2.progress should be the same'+ );++ const batch3 = await gen.next();+ const expected3 = {value: undefined, done: true};+ t.deepEqual(batch3, expected3, 'batch3 should be the final batch');++ // go on to run processFileData+ const processed = await processFileData({content: batch2.value, fileCache: []});+ const expectedInfo = {label: 'text-data.csv', format: 'row'};++ t.equal(processed.length, 1, 'processFileData should return 1 result');+ t.ok(processed[0].info, 'processFileData should have info');+ t.ok(processed[0].data, 'processFileData should have data');+ t.deepEqual(processed[0].info, expectedInfo, 'info should be correct');++ const {fields, rows} = processed[0].data;++ fields.forEach((f, i) => {+ t.deepEqual(f, testFields[i], `should process correct field ${testFields[i].name}`);+ });++ rows.forEach((r, i) => {+ t.deepEqual(r, parsedDataWithNulls[i], `should process row ${i} correctly`);+ });++ t.end();+});++test('#file-handler -> readFileInBatches.geoJson -> processFileData', async t => {+ const geojsonFile = new File([geojsonString], 'text-data-1.geojson', {type: ''});+ const gen = await readFileInBatches({file: geojsonFile, fileCache: []});++ // metadata batch+ const batch1 = await gen.next();++ const expected1 = {+ value: {+ batchType: 'metadata',+ metadata: {_loader: {}, _context: {}},+ data: [],+ bytesUsed: 0,+ progress: {rowCount: 0, rowCountInBatch: 0, percent: 0},+ fileName: 'text-data-1.geojson'+ },+ done: false+ };++ t.deepEqual(+ Object.keys(batch1.value).sort(),+ Object.keys(expected1.value).sort(),+ 'value should have same keyss'+ );++ t.equal(batch1.value.batchType, expected1.value.batchType, 'batch1.batchType should be the same');+ t.equal(batch1.value.fileName, expected1.value.fileName, 'batch1.fileName should be the same');+ t.deepEqual(batch1.value.data, expected1.value.data, 'batch1.data should be the same');+ t.deepEqual(+ batch1.value.progress,+ expected1.value.progress,+ 'batch1.progress should be the same'+ );++ // partial result batch+ const batch2 = await gen.next();++ const expected2 = {+ value: {+ batchType: 'partial-result',+ container: {type: 'FeatureCollection', features: []},+ data: [],+ bytesUsed: 0,+ schema: null,+ jsonpath: '$.features',+ progress: {rowCount: 0, rowCountInBatch: 0, percent: 0},+ fileName: 'text-data-1.geojson'+ },+ done: false+ };+ t.deepEqual(batch2, expected2, 'batch2 should be partial-result');+ // data batch+ const batch3 = await gen.next();+ const expected3 = {+ value: {+ data: [], // 13 features+ schema: null,+ length: 26,+ cursor: 0,+ count: 0,+ bytesUsed: 4890,+ jsonpath: '$.features',+ progress: {rowCount: 26, rowCountInBatch: 26, percent: 1},+ fileName: 'text-data-1.geojson'+ },+ done: false+ };++ t.equal(batch3.value.data.length, 26, 'batch3 should data length 26');+ t.equal(batch3.value.jsonpath, expected3.value.jsonpath, 'batch3 should have jsonpath');+ t.deepEqual(batch3.value.progress, expected3.value.progress, 'batch3 should have progress');+ t.equal(batch3.value.fileName, expected3.value.fileName, 'batch3 should have fileName');+ t.equal(batch3.value.length, expected3.value.length, 'batch3 should have length');++ const batch4 = await gen.next();+ const expected4 = {+ value: {+ batchType: 'final-result',+ container: {type: 'FeatureCollection', features: []},+ jsonpath: '$.features',+ data: {type: 'FeatureCollection', features: []}, // feature should be length 26+ schema: null,+ progress: {rowCount: 26, rowCountInBatch: 0},+ fileName: 'text-data-1.geojson'+ },+ done: false+ };+ t.equal(+ batch4.value.data.type,+ 'FeatureCollection',+ 'batch4 should data be a geojson feature collection'+ );+ t.deepEqual(batch4.value.progress, expected4.value.progress, 'batch4 should have progress');+ t.equal(batch4.value.fileName, expected4.value.fileName, 'batch4 should have fileName');+ t.equal(batch4.value.data.features.length, 26, 'batch4 return 26 features');++ const batch5 = await gen.next();+ t.deepEqual(batch5, {value: undefined, done: true}, 'batch5 should be done');++ // process geojson data received+ const processed = await processFileData({content: batch4.value, fileCache: []});+ const expectedInfo = {label: 'text-data-1.geojson', format: 'geojson'};++ t.equal(processed.length, 1, 'processFileData should return 1 result');+ t.ok(processed[0].info, 'processFileData should have info');+ t.ok(processed[0].data, 'processFileData should have data');+ t.deepEqual(processed[0].info, expectedInfo, 'info should be correct');+ const {fields, rows} = processed[0].data;+ fields.forEach((f, i) => {+ t.deepEqual(+ f,+ geojsonFields[i],+ `should process correct geojson field ${geojsonFields[i].name}`+ );+ });+ rows.forEach((r, i) => {+ t.deepEqual(r, geojsonRows[i], `should process geojson row ${i} correctly`);+ });++ t.end();+});++test('#file-handler -> readFileInBatches.row -> processFileData', async t => {+ const fileName = 'row-data.json';+ const rowFile = new File([rowDataString], fileName, {type: ''});+ const gen = await readFileInBatches({file: rowFile, fileCache: []});++ // metadata batch+ const batch1 = await gen.next();++ const expected1 = {+ value: {+ batchType: 'metadata',+ metadata: {_loader: {}, _context: {}},+ data: [],+ bytesUsed: 0,+ progress: {rowCount: 0, rowCountInBatch: 0, percent: 0},+ fileName+ },+ done: false+ };+ t.deepEqual(+ Object.keys(batch1.value).sort(),+ Object.keys(expected1.value).sort(),+ 'value should have same keyss'+ );++ t.equal(batch1.value.batchType, expected1.value.batchType, 'batch1.batchType should be the same');+ t.equal(batch1.value.fileName, expected1.value.fileName, 'batch1.fileName should be the same');+ t.deepEqual(batch1.value.data, expected1.value.data, 'batch1.data should be the same');+ t.deepEqual(+ batch1.value.progress,+ expected1.value.progress,+ 'batch1.progress should be the same'+ );++ const batch2 = await gen.next();+ const expected2 = {+ value: {+ batchType: 'partial-result',+ container: {}, // do not test+ data: [],+ bytesUsed: 0,+ schema: null,+ jsonpath: '$',+ progress: {rowCount: 0, rowCountInBatch: 0, percent: 0},+ fileName+ },+ done: false+ };+ t.deepEqual(batch2.value.batchType, expected2.value.batchType, 'batch2 should be partial-result');+ t.deepEqual(batch2.value.jsonpath, expected2.value.jsonpath, 'batch2 should be partial-result');+ t.deepEqual(batch2.value.progress, expected2.value.progress, 'batch2 progress should be correct');++ const batch3 = await gen.next();+ const expected3 = {+ value: {+ data: [],+ schema: null,+ length: 8,+ cursor: 0,+ count: 0,+ bytesUsed: 4552,+ jsonpath: '$',+ progress: {rowCount: 8, rowCountInBatch: 8, percent: 1},+ fileName+ },+ done: false+ };+ t.equal(batch3.value.data.length, 8, 'batch3 should data length 26');+ t.deepEqual(batch3.value.progress, expected3.value.progress, 'batch3 should have progress');+ t.equal(batch3.value.fileName, expected3.value.fileName, 'batch3 should have fileName');+ t.equal(batch3.value.length, expected3.value.length, 'batch3 should have length');++ const batch4 = await gen.next();+ const expected4 = {+ value: {+ batchType: 'final-result',+ container: {}, // do not test+ jsonpath: '$',+ data: [], // do not test+ schema: null,+ progress: {rowCount: 8, rowCountInBatch: 0},+ fileName+ },+ done: false+ };++ t.deepEqual(batch4.value.progress, expected4.value.progress, 'batch4 should have progress');+ t.equal(batch4.value.fileName, expected4.value.fileName, 'batch4 should have fileName');+ t.equal(batch4.value.data.length, 8, 'batch4 return 8 rows');++ const batch5 = await gen.next();+ t.deepEqual(batch5, {value: undefined, done: true}, 'batch5 should be done');++ const processed = await processFileData({content: batch4.value, fileCache: []});+ const expectedFileCache = [+ {+ data: {+ fields: parsedFields,+ rows: parsedRows+ },+ info: {label: fileName, format: 'row'}+ }+ ];+ t.equal(processed.length, 1, 'processFileData should return 1 result');+ t.ok(processed[0].info, 'processFileData should have info');+ t.ok(processed[0].data, 'processFileData should have data');+ t.deepEqual(processed[0].info, expectedFileCache[0].info, 'info should be correct');++ const {fields, rows} = processed[0].data;++ fields.forEach((f, i) => {+ t.deepEqual(+ f,+ expectedFileCache[0].data.fields[i],+ `should process correct row object field ${parsedFields[i].name}`+ );+ });+ rows.forEach((r, i) => {+ t.deepEqual(r, expectedFileCache[0].data.rows[i], `should process row ${i} correctly`);+ });++ t.end();+});++test('#file-handler -> readFileInBatches.keplerMap -> processFileData', async t => {+ const fileName = 'keplergl.json';+ const keplerGlMap = new File([JSON.stringify(keplerglMap)], fileName, {type: ''});+ const gen = await readFileInBatches({file: keplerGlMap, fileCache: []});++ // metadata batch+ const batch1 = await gen.next();++ const expected1 = {+ value: {+ batchType: 'metadata',+ metadata: {_loader: {}, _context: {}},+ data: [],+ bytesUsed: 0,+ progress: {rowCount: 0, rowCountInBatch: 0, percent: 0},+ fileName+ },+ done: false+ };+ t.deepEqual(+ Object.keys(batch1.value).sort(),+ Object.keys(expected1.value).sort(),+ 'value should have same keyss'+ );++ t.equal(batch1.value.batchType, expected1.value.batchType, 'batch1.batchType should be the same');+ t.equal(batch1.value.fileName, expected1.value.fileName, 'batch1.fileName should be the same');+ t.deepEqual(batch1.value.data, expected1.value.data, 'batch1.data should be the same');+ t.deepEqual(+ batch1.value.progress,+ expected1.value.progress,+ 'batch1.progress should be the same'+ );++ const batch2 = await gen.next();+ const expected2 = {+ value: {+ batchType: 'partial-result',+ container: {}, // do not test+ data: [],+ bytesUsed: 0,+ schema: null,+ jsonpath: '$.datasets',+ progress: {rowCount: 0, rowCountInBatch: 0, percent: 0},+ fileName+ },+ done: false+ };+ t.deepEqual(batch2.value.batchType, expected2.value.batchType, 'batch2 should be partial-result');+ t.deepEqual(batch2.value.jsonpath, expected2.value.jsonpath, 'batch2 jsonapth should be correct');+ t.deepEqual(batch2.value.schema, expected2.value.schema, 'batch2 schema should be correct');+ t.deepEqual(batch2.value.progress, expected2.value.progress, 'batch2 progress should be correct');++ const batch3 = await gen.next();+ const expected3 = {+ value: {+ data: [],+ schema: null,+ length: 1,+ cursor: 0,+ count: 0,+ bytesUsed: 4552,+ jsonpath: '$.datasets',+ progress: {rowCount: 1, rowCountInBatch: 1, percent: 1},+ fileName+ },+ done: false+ };+ t.equal(batch3.value.data.length, 1, 'batch3 should data length 1');+ t.deepEqual(batch3.value.progress, expected3.value.progress, 'batch3 should have progress');+ t.equal(batch3.value.fileName, expected3.value.fileName, 'batch3 should have fileName');+ t.equal(batch3.value.length, expected3.value.length, 'batch3 should have length');++ const batch4 = await gen.next();+ const expected4 = {+ value: {+ batchType: 'final-result',+ container: {}, // do not test+ jsonpath: '$.datasets',+ data: [], // do not test+ schema: null,+ progress: {rowCount: 1, rowCountInBatch: 0},+ fileName+ },+ done: false+ };++ t.deepEqual(batch4.value.progress, expected4.value.progress, 'batch4 should have progress');+ t.deepEqual(batch4.value.batchType, expected4.value.batchType, 'batch4 should have batchType');+ t.equal(batch4.value.fileName, expected4.value.fileName, 'batch4 should have fileName');+ t.deepEqual(batch4.value.data, keplerglMap, 'batch4 should return saved kepler.gl map json');++ const batch5 = await gen.next();+ t.deepEqual(batch5, {value: undefined, done: true}, 'batch5 should be done');++ // process file+ const processed = await processFileData({content: batch4.value, fileCache: []});+ const expectedInfo = {label: fileName, format: 'keplergl'};++ const expectedFileCache = [+ {+ data: {+ datasets: [+ {+ data: {+ fields: parsedKeplerMapFields,+ rows: keplerglMap.datasets[0].data.allData+ },+ info: {id: 'a5ybmwl2d', label: 'geojson_as_string_small.csv', color: [53, 92, 125]}+ }+ ],+ config: keplerglMap.config+ },+ info: expectedInfo+ }+ ];++ t.equal(processed.length, 1, 'processFileData should return 1 result');+ t.ok(processed[0].info, 'processFileData should have info');+ t.ok(processed[0].data, 'processFileData should have data');+ t.deepEqual(processed[0].info, expectedInfo, 'info should be correct');++ t.deepEqual(+ Object.keys(processed[0].data),+ ['datasets', 'config'],+ 'processFileData of keplergl json should have datasets and config'+ );+ t.deepEqual(+ Object.keys(processed[0].data.datasets[0].data),+ ['fields', 'rows'],+ 'dataset should have fields and rows'+ );++ t.deepEqual(+ processed[0].data.datasets[0].data.rows,+ expectedFileCache[0].data.datasets[0].data.rows,+ 'should load datasets rows'+ );++ t.deepEqual(+ processed[0].data.datasets[0].data.fields,+ expectedFileCache[0].data.datasets[0].data.fields,+ 'should load and analyze datasets'+ );++ t.deepEqual(+ processed[0].data.datasets[0].info,+ expectedFileCache[0].data.datasets[0].info,+ 'should load correct file info'+ );+ t.deepEqual(+ Object.keys(processed[0].data.config),+ ['visState', 'mapStyle', 'mapState'],+ 'should prepare parsed config'+ );++ t.end();+});diff --git a/test/browser/index.js b/test/browser/index.jsindex 2c3559879..fdae1730d 100644--- a/test/browser/index.js+++ b/test/browser/index.js@@ -26,3 +26,6 @@ import './layer-tests';// test reducersimport './reducers';++// test processors+import './file-handler';diff --git a/test/e2e/upload-file.test.js b/test/e2e/upload-file.test.jsindex 4a7b24752..77d817b48 100644--- a/test/e2e/upload-file.test.js+++ b/test/e2e/upload-file.test.js@@ -64,7 +64,7 @@ describe('Load map', () => {await page.waitForSelector('.preview-image-placeholder');- await page.waitFor(DEFAULT_WAIT_TIME.SHORT);+ await page.waitFor(DEFAULT_WAIT_TIME.LONGER);await testScreenshot(page);diff --git a/test/e2e/utils.js b/test/e2e/utils.jsindex 1b019b1a1..9a4117d0b 100644--- a/test/e2e/utils.js+++ b/test/e2e/utils.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-export const TIMEOUT = process.env.SLOWMO ? 60000 : 10000;+export const TIMEOUT = process.env.SLOWMO ? 100000 : 10000;export const DEFAULT_WAIT_TIME = {SHORTER: 1000,diff --git a/test/fixtures/geojson-style.js b/test/fixtures/geojson-style.jsnew file mode 100644index 000000000..d8a95161a--- /dev/null+++ b/test/fixtures/geojson-style.js@@ -0,0 +1,384 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++const geojsonString = `{"type":"FeatureCollection","features":[{"geometry":{"type":"Point","coordinates":[-105.15471672508885,39.98626910199207,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"radius":1,"id":"a1398a11-d1ce-421c-bf66-a456ff525de9"}},{"geometry":{"type":"Point","coordinates":[-105.1549804351595,39.98397605319894,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"94ed2c0f-27ce-416e-b3b4-6c00954b41f0"}},{"geometry":{"type":"Point","coordinates":[-105.15478982047146,39.98296589543148,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"radius":3,"id":"1f59be4c-82e8-4644-b3cf-4c1c0510cbb2"}},{"geometry":{"type":"Point","coordinates":[-105.15449343321012,39.98437157892626,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"radius":5,"id":"de9210a0-c48c-41bf-8463-4b0734d402c0"}},{"geometry":{"type":"Point","coordinates":[-105.15484576666667,39.98312416666666,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"9438eea5-dde0-4e5e-bdf5-7420eedbc419"}},{"geometry":{"type":"Point","coordinates":[-105.15494596666667,39.98422703333333,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"radius":0.5,"id":"9ecefa7c-4fc6-46b7-936c-580a6084ff47"}},{"geometry":{"type":"Point","coordinates":[-105.15522212737501,39.98433057912913,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"696a33f6-3ff2-45a9-8a11-ab541aa2152f"}},{"geometry":{"type":"Point","coordinates":[-105.15447046666667,39.9834028,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"a5b27f57-37a4-4576-ac4e-24dfb57730c3"}},{"geometry":{"type":"Point","coordinates":[-105.15487273333333,39.98379046666667,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"7a640dbe-e0ca-4c50-a43a-b65ec33305b5"}},{"geometry":{"type":"Point","coordinates":[-105.154786,39.986418799999996,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"154cc349-c8b3-4b41-a008-364df1e6d83d"}},{"geometry":{"type":"Point","coordinates":[-105.15456956666667,39.984760566666665,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"932d45a2-bc4b-4825-9b9f-70b2415753b5"}},{"geometry":{"type":"Point","coordinates":[-105.15503543214001,39.983469561355626,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"a178d24c-1ea3-46cd-8762-3669d7b9d722"}},{"geometry":{"type":"Point","coordinates":[-105.15462816666667,39.984541766666666,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"41f8b94e-266c-450a-a7dc-60c159370ddb"}},{"geometry":{"type":"Point","coordinates":[-105.15494077274344,39.98493993797259,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"99ee26ca-13e1-4bef-bcd2-12cfc290d6ae"}},{"geometry":{"type":"Point","coordinates":[-105.15451193333332,39.98379226666666,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"de5103bb-2808-46b4-8012-76ceb5511fa9"}},{"geometry":{"type":"Point","coordinates":[-105.1547839,39.98589206666667,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"c5caef3d-abc9-4044-bb14-2f5999979d8d"}},{"geometry":{"type":"Point","coordinates":[-105.15513263333332,39.98269536666667,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"e0162a54-e2b2-4076-be24-4f550f0ac651"}},{"geometry":{"type":"Point","coordinates":[-105.1546226,39.98516726666667,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"e53ab272-7f6a-49b8-93f1-693bb57aa9f8"}},{"geometry":{"type":"Point","coordinates":[-105.1545185,39.98417893333333,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"fdc3fff3-5c35-430b-8bb4-9517473a8dc1"}},{"geometry":{"type":"Point","coordinates":[-105.15476356666666,39.98555806666667,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"f342e7bd-771d-4bf1-ad57-40d435f54fa0"}},{"geometry":{"type":"Point","coordinates":[-105.15468952992738,39.985742351897976,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"dbda33a4-b194-40e8-88a6-5e8816a97377"}},{"geometry":{"type":"Point","coordinates":[-105.1545091,39.983995666666665,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"5564b2fb-8368-4f81-a8b4-bebb30cbaaed"}},{"geometry":{"type":"Point","coordinates":[-105.15508416666667,39.985163,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"835f956f-6a86-4a7c-b1d6-3f32e4955a31"}},{"geometry":{"type":"Point","coordinates":[-105.15513636666667,39.983126066666664,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"8f8effff-f89d-417c-8e44-c8561f9f1eec"}},{"geometry":{"type":"Point","coordinates":[-105.15478573333333,39.98606776666667,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"59552665-bdd6-4c0c-bd0d-5ee79ea4848b"}},{"geometry":{"type":"Point","coordinates":[-105.1547872,39.9866052,0]},"type":"Feature","properties":{"fillColor":[77,193,156],"id":"32df5401-38d1-4e96-8d1e-a29d2c7c3955"}}]}`;+export default geojsonString;++export const processedFields = [+ {name: '_geojson', format: '', tableFieldIndex: 1, type: 'geojson', analyzerType: 'GEOMETRY'},+ {name: 'fillColor', format: '', tableFieldIndex: 2, type: 'geojson', analyzerType: 'ARRAY'},+ {name: 'radius', format: '', tableFieldIndex: 3, type: 'integer', analyzerType: 'INT'},+ {name: 'id', format: '', tableFieldIndex: 4, type: 'string', analyzerType: 'STRING'}+];++export const processedRows = [+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15471672508885, 39.98626910199207, 0]},+ type: 'Feature',+ properties: {fillColor: [77, 193, 156], radius: 1, id: 'a1398a11-d1ce-421c-bf66-a456ff525de9'}+ },+ [77, 193, 156],+ 1,+ 'a1398a11-d1ce-421c-bf66-a456ff525de9'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.1549804351595, 39.98397605319894, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '94ed2c0f-27ce-416e-b3b4-6c00954b41f0',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '94ed2c0f-27ce-416e-b3b4-6c00954b41f0'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15478982047146, 39.98296589543148, 0]},+ type: 'Feature',+ properties: {fillColor: [77, 193, 156], radius: 3, id: '1f59be4c-82e8-4644-b3cf-4c1c0510cbb2'}+ },+ [77, 193, 156],+ 3,+ '1f59be4c-82e8-4644-b3cf-4c1c0510cbb2'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15449343321012, 39.98437157892626, 0]},+ type: 'Feature',+ properties: {fillColor: [77, 193, 156], radius: 5, id: 'de9210a0-c48c-41bf-8463-4b0734d402c0'}+ },+ [77, 193, 156],+ 5,+ 'de9210a0-c48c-41bf-8463-4b0734d402c0'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15484576666667, 39.98312416666666, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '9438eea5-dde0-4e5e-bdf5-7420eedbc419',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '9438eea5-dde0-4e5e-bdf5-7420eedbc419'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15494596666667, 39.98422703333333, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ radius: 0.5,+ id: '9ecefa7c-4fc6-46b7-936c-580a6084ff47'+ }+ },+ [77, 193, 156],+ 0.5,+ '9ecefa7c-4fc6-46b7-936c-580a6084ff47'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15522212737501, 39.98433057912913, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '696a33f6-3ff2-45a9-8a11-ab541aa2152f',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '696a33f6-3ff2-45a9-8a11-ab541aa2152f'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15447046666667, 39.9834028, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'a5b27f57-37a4-4576-ac4e-24dfb57730c3',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'a5b27f57-37a4-4576-ac4e-24dfb57730c3'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15487273333333, 39.98379046666667, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '7a640dbe-e0ca-4c50-a43a-b65ec33305b5',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '7a640dbe-e0ca-4c50-a43a-b65ec33305b5'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.154786, 39.986418799999996, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '154cc349-c8b3-4b41-a008-364df1e6d83d',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '154cc349-c8b3-4b41-a008-364df1e6d83d'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15456956666667, 39.984760566666665, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '932d45a2-bc4b-4825-9b9f-70b2415753b5',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '932d45a2-bc4b-4825-9b9f-70b2415753b5'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15503543214001, 39.983469561355626, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'a178d24c-1ea3-46cd-8762-3669d7b9d722',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'a178d24c-1ea3-46cd-8762-3669d7b9d722'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15462816666667, 39.984541766666666, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '41f8b94e-266c-450a-a7dc-60c159370ddb',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '41f8b94e-266c-450a-a7dc-60c159370ddb'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15494077274344, 39.98493993797259, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '99ee26ca-13e1-4bef-bcd2-12cfc290d6ae',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '99ee26ca-13e1-4bef-bcd2-12cfc290d6ae'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15451193333332, 39.98379226666666, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'de5103bb-2808-46b4-8012-76ceb5511fa9',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'de5103bb-2808-46b4-8012-76ceb5511fa9'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.1547839, 39.98589206666667, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'c5caef3d-abc9-4044-bb14-2f5999979d8d',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'c5caef3d-abc9-4044-bb14-2f5999979d8d'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15513263333332, 39.98269536666667, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'e0162a54-e2b2-4076-be24-4f550f0ac651',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'e0162a54-e2b2-4076-be24-4f550f0ac651'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.1546226, 39.98516726666667, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'e53ab272-7f6a-49b8-93f1-693bb57aa9f8',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'e53ab272-7f6a-49b8-93f1-693bb57aa9f8'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.1545185, 39.98417893333333, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'fdc3fff3-5c35-430b-8bb4-9517473a8dc1',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'fdc3fff3-5c35-430b-8bb4-9517473a8dc1'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15476356666666, 39.98555806666667, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'f342e7bd-771d-4bf1-ad57-40d435f54fa0',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'f342e7bd-771d-4bf1-ad57-40d435f54fa0'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15468952992738, 39.985742351897976, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: 'dbda33a4-b194-40e8-88a6-5e8816a97377',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ 'dbda33a4-b194-40e8-88a6-5e8816a97377'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.1545091, 39.983995666666665, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '5564b2fb-8368-4f81-a8b4-bebb30cbaaed',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '5564b2fb-8368-4f81-a8b4-bebb30cbaaed'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15508416666667, 39.985163, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '835f956f-6a86-4a7c-b1d6-3f32e4955a31',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '835f956f-6a86-4a7c-b1d6-3f32e4955a31'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15513636666667, 39.983126066666664, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '8f8effff-f89d-417c-8e44-c8561f9f1eec',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '8f8effff-f89d-417c-8e44-c8561f9f1eec'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.15478573333333, 39.98606776666667, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '59552665-bdd6-4c0c-bd0d-5ee79ea4848b',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '59552665-bdd6-4c0c-bd0d-5ee79ea4848b'+ ],+ [+ {+ geometry: {type: 'Point', coordinates: [-105.1547872, 39.9866052, 0]},+ type: 'Feature',+ properties: {+ fillColor: [77, 193, 156],+ id: '32df5401-38d1-4e96-8d1e-a29d2c7c3955',+ radius: null+ }+ },+ [77, 193, 156],+ null,+ '32df5401-38d1-4e96-8d1e-a29d2c7c3955'+ ]+];diff --git a/test/fixtures/row-object.js b/test/fixtures/row-object.jsnew file mode 100644index 000000000..0117fb826--- /dev/null+++ b/test/fixtures/row-object.js@@ -0,0 +1,249 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++const data = `[{"bedrooms": "Null", "bathrooms": "N/A", "effectiveyearbuilt": "Null", "roll_landbaseyear": "N/", "roll_totlandimp": "37827477", "nettaxablevalue": "37827477", "center_lon": "-118.40032195", "roll_landvalue": "10627524", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "27199953", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "37827477", "situszip5": "90034", "center_lat": "34.02322471"}, {"bedrooms": "99", "bathrooms": "99", "effectiveyearbuilt": "2006", "roll_landbaseyear": "2007", "roll_totlandimp": "37085763", "nettaxablevalue": "37097927", "center_lon": "-118.40032195", "roll_landvalue": "10419142", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "26666621", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "37097927", "situszip5": "90034", "center_lat": "34.02322471"}, {"bedrooms": "99", "bathrooms": "99", "effectiveyearbuilt": "2006", "roll_landbaseyear": "2007", "roll_totlandimp": "35463324", "nettaxablevalue": "35463324", "center_lon": "-118.40032195", "roll_landvalue": "9963324", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "25500000", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "35463324", "situszip5": "90034", "center_lat": "34.02322471"}, {"bedrooms": "99", "bathrooms": "99", "effectiveyearbuilt": "2006", "roll_landbaseyear": "2007", "roll_totlandimp": "36172590", "nettaxablevalue": "36172590", "center_lon": "-118.40032195", "roll_landvalue": "10162590", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "26010000", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "36172590", "situszip5": "90034", "center_lat": "34.02322471"}, {"bedrooms": "99", "bathrooms": "99", "effectiveyearbuilt": "2006", "roll_landbaseyear": "2007", "roll_totlandimp": "38758435", "nettaxablevalue": "38775032", "center_lon": "-118.40032195", "roll_landvalue": "10889073", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "27869362", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "38775032", "situszip5": "90034", "center_lat": "34.02322471"}, {"bedrooms": "99", "bathrooms": "99", "effectiveyearbuilt": "2006", "roll_landbaseyear": "2007", "roll_totlandimp": "36086860", "nettaxablevalue": "36092822", "center_lon": "-118.40032195", "roll_landvalue": "10138504", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "25948356", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "36092822", "situszip5": "90034", "center_lat": "34.02322471"}, {"bedrooms": "99", "bathrooms": "99", "effectiveyearbuilt": "2006", "roll_landbaseyear": "2007", "roll_totlandimp": "37999212", "nettaxablevalue": "38012236", "center_lon": "-118.40032195", "roll_landvalue": "10675772", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "27323440", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "38012236", "situszip5": "90034", "center_lat": "34.02322471"}, {"bedrooms": "99", "bathrooms": "99", "effectiveyearbuilt": "2006", "roll_landbaseyear": "2007", "roll_totlandimp": "36358593", "nettaxablevalue": "36370757", "center_lon": "-118.40032195", "roll_landvalue": "10214846", "usecodedescchar1": "Residential", "usetype": "R-I", "yearbuiltTS": "1136073600000", "yearbuilt": "2006", "roll_impvalue": "26143747", "istaxableparcel": "true", "propertylocation": "3762 CLARINGTON AVE LOS ANGELES CA 90034", "units": "116", "sqftmain": "130693", "roll_totalvalue": "36370757", "situszip5": "90034", "center_lat": "34.02322471"}]`;++export const parsedFields = [+ {name: 'bedrooms', format: '', tableFieldIndex: 1, type: 'integer', analyzerType: 'INT'},+ {name: 'bathrooms', format: '', tableFieldIndex: 2, type: 'integer', analyzerType: 'INT'},+ {+ name: 'effectiveyearbuilt',+ format: '',+ tableFieldIndex: 3,+ type: 'integer',+ analyzerType: 'INT'+ },+ {name: 'roll_landbaseyear', format: '', tableFieldIndex: 4, type: 'integer', analyzerType: 'INT'},+ {name: 'roll_totlandimp', format: '', tableFieldIndex: 5, type: 'integer', analyzerType: 'INT'},+ {name: 'nettaxablevalue', format: '', tableFieldIndex: 6, type: 'integer', analyzerType: 'INT'},+ {name: 'center_lon', format: '', tableFieldIndex: 7, type: 'real', analyzerType: 'FLOAT'},+ {name: 'roll_landvalue', format: '', tableFieldIndex: 8, type: 'integer', analyzerType: 'INT'},+ {+ name: 'usecodedescchar1',+ format: '',+ tableFieldIndex: 9,+ type: 'string',+ analyzerType: 'STRING'+ },+ {name: 'usetype', format: '', tableFieldIndex: 10, type: 'string', analyzerType: 'STRING'},+ {name: 'yearbuiltTS', format: 'X', tableFieldIndex: 11, type: 'timestamp', analyzerType: 'TIME'},+ {name: 'yearbuilt', format: '', tableFieldIndex: 12, type: 'integer', analyzerType: 'INT'},+ {name: 'roll_impvalue', format: '', tableFieldIndex: 13, type: 'integer', analyzerType: 'INT'},+ {+ name: 'istaxableparcel',+ format: '',+ tableFieldIndex: 14,+ type: 'boolean',+ analyzerType: 'BOOLEAN'+ },+ {+ name: 'propertylocation',+ format: '',+ tableFieldIndex: 15,+ type: 'string',+ analyzerType: 'STRING'+ },+ {name: 'units', format: '', tableFieldIndex: 16, type: 'integer', analyzerType: 'INT'},+ {name: 'sqftmain', format: '', tableFieldIndex: 17, type: 'integer', analyzerType: 'INT'},+ {name: 'roll_totalvalue', format: '', tableFieldIndex: 18, type: 'integer', analyzerType: 'INT'},+ {name: 'situszip5', format: '', tableFieldIndex: 19, type: 'integer', analyzerType: 'INT'},+ {name: 'center_lat', format: '', tableFieldIndex: 20, type: 'real', analyzerType: 'FLOAT'}+];++export const parsedRows = [+ [+ null,+ NaN,+ null,+ NaN,+ 37827477,+ 37827477,+ -118.40032195,+ 10627524,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 27199953,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 37827477,+ 90034,+ 34.02322471+ ],+ [+ 99,+ 99,+ 2006,+ 2007,+ 37085763,+ 37097927,+ -118.40032195,+ 10419142,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 26666621,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 37097927,+ 90034,+ 34.02322471+ ],+ [+ 99,+ 99,+ 2006,+ 2007,+ 35463324,+ 35463324,+ -118.40032195,+ 9963324,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 25500000,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 35463324,+ 90034,+ 34.02322471+ ],+ [+ 99,+ 99,+ 2006,+ 2007,+ 36172590,+ 36172590,+ -118.40032195,+ 10162590,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 26010000,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 36172590,+ 90034,+ 34.02322471+ ],+ [+ 99,+ 99,+ 2006,+ 2007,+ 38758435,+ 38775032,+ -118.40032195,+ 10889073,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 27869362,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 38775032,+ 90034,+ 34.02322471+ ],+ [+ 99,+ 99,+ 2006,+ 2007,+ 36086860,+ 36092822,+ -118.40032195,+ 10138504,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 25948356,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 36092822,+ 90034,+ 34.02322471+ ],+ [+ 99,+ 99,+ 2006,+ 2007,+ 37999212,+ 38012236,+ -118.40032195,+ 10675772,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 27323440,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 38012236,+ 90034,+ 34.02322471+ ],+ [+ 99,+ 99,+ 2006,+ 2007,+ 36358593,+ 36370757,+ -118.40032195,+ 10214846,+ 'Residential',+ 'R-I',+ 1136073600000,+ 2006,+ 26143747,+ true,+ '3762 CLARINGTON AVE LOS ANGELES CA 90034',+ 116,+ 130693,+ 36370757,+ 90034,+ 34.02322471+ ]+];++export default data;diff --git a/test/fixtures/state-saved-v1-7.js b/test/fixtures/state-saved-v1-7.jsindex e444cd29b..03ea4f989 100644--- a/test/fixtures/state-saved-v1-7.js+++ b/test/fixtures/state-saved-v1-7.js@@ -796,5 +796,33 @@ export const savedStateV1InteractionCoordinate = {]}}+ },+ info: {+ app: 'kepler.gl',+ created_at: 'Sun Nov 17 2019 18:37:59 GMT-0800 (Pacific Standard Time)'}};++export const parsedFields = [+ {name: 'a_zip', type: 'integer', format: '', analyzerType: 'INT'},+ {+ name: 'simplified_shape_v2',+ type: 'geojson',+ format: '',+ analyzerType: 'PAIR_GEOMETRY_FROM_STRING'+ },+ {name: 'simplified_shape', type: 'geojson', format: '', analyzerType: 'GEOMETRY_FROM_STRING'},+ {name: 'zip_area', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'avg_number', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'str_type', type: 'string', format: '', analyzerType: 'STRING'},+ {name: 'int_type', type: 'integer', format: '', analyzerType: 'INT'},+ {name: 'real_type', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'c_m_r', type: 'integer', format: '', analyzerType: 'INT'},+ {name: 'c_m_t', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'c_a_v', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'c_ch', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'c_ta', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'c_k_a', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'c_ltv', type: 'real', format: '', analyzerType: 'FLOAT'},+ {name: 'b_r_p', type: 'real', format: '', analyzerType: 'FLOAT'}+];diff --git a/test/node/index.js b/test/node/index.jsindex 144263bc7..c2e2f7c14 100644--- a/test/node/index.js+++ b/test/node/index.js@@ -26,3 +26,6 @@ import './reducers';// test schemasimport './schemas';++// test processers+import './processors';diff --git a/test/node/processors/file-handler-fixtures.js b/test/node/processors/file-handler-fixtures.jsnew file mode 100644index 000000000..a25d67ae3--- /dev/null+++ b/test/node/processors/file-handler-fixtures.js@@ -0,0 +1,325 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++// csv restul returned by loaders.gl+// Nulls are returned as string+import {geojsonData} from 'test/fixtures/geojson';++// TODO: this is result returned by loaders.gl+// ideally we would test loaders.gl from start to end+// need to upgrade JSDom to+export const csvWithNull = [+ {+ 'gps_data.utc_timestamp': 'Null',+ 'gps_data.lat': 29.9900937,+ 'gps_data.lng': 31.2590542,+ 'gps_data.types': 'driver_analytics_0',+ epoch: 1472688000000,+ has_result: 'False',+ id: 1,+ time: '2016-09-23T00:00:00.000Z',+ begintrip_ts_utc: '2016-10-01 09:41:39+00:00',+ begintrip_ts_local: '2016-10-01 09:41:39+00:00',+ date: '2016-09-23'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:10:56',+ 'gps_data.lat': 29.9927699,+ 'gps_data.lng': 31.2461142,+ 'gps_data.types': 'null',+ epoch: 1472688000000,+ has_result: 'False',+ id: 'null',+ time: '2016-09-23T00:00:00.000Z',+ begintrip_ts_utc: '2016-10-01 09:46:37+00:00',+ begintrip_ts_local: '2016-10-01 16:46:37+00:00',+ date: '2016-09-23'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:11:56',+ 'gps_data.lat': 29.9907261,+ 'gps_data.lng': 'NaN',+ 'gps_data.types': 'driver_analytics',+ epoch: 1472688000000,+ has_result: 'False',+ id: 3,+ time: '2016-09-23T00:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-23'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:12:58',+ 'gps_data.lat': 29.9870074,+ 'gps_data.lng': 31.2175827,+ 'gps_data.types': 'driver_gps',+ epoch: 1472688000000,+ has_result: 'False',+ id: 4,+ time: '2016-09-23T00:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-23'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:14:00',+ 'gps_data.lat': 29.9923041,+ 'gps_data.lng': 31.2154899,+ 'gps_data.types': 'driver_analytics',+ epoch: 1472688000000,+ has_result: 1,+ id: 5,+ time: '2016-09-23T00:00:00.000Z',+ begintrip_ts_utc: '2016-10-01 09:47:37+00:00',+ begintrip_ts_local: '2016-10-01 16:47:37+00:00',+ date: null+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:15:01',+ 'gps_data.lat': 29.9968249,+ 'gps_data.lng': 31.2149361,+ 'gps_data.types': 'driver_analytics',+ epoch: 1472688000000,+ has_result: 'False',+ id: 12124,+ time: '2016-09-23T05:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: null+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:16:03',+ 'gps_data.lat': 'Null',+ 'gps_data.lng': 31.2164035,+ 'gps_data.types': 'driver_analytics',+ epoch: 1472688000000,+ has_result: 'False',+ id: 222,+ time: '2016-09-23T05:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: null+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:17:05',+ 'gps_data.lat': 30.0116207,+ 'gps_data.lng': 31.2179346,+ 'gps_data.types': 'driver_analytics',+ epoch: 1472688000000,+ has_result: 'False',+ id: 345,+ time: '2016-09-23T00:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-24'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:18:09',+ 'gps_data.lat': 30.0208925,+ 'gps_data.lng': 31.2179556,+ 'gps_data.types': 'driver_analytics',+ epoch: 1472708000000,+ has_result: 'False',+ id: null,+ time: '2016-09-23T00:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-24'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:19:12',+ 'gps_data.lat': 30.0218999,+ 'gps_data.lng': 31.2178842,+ 'gps_data.types': 'driver_analytics',+ epoch: 'NULL',+ has_result: 0,+ id: null,+ time: '2016-09-23T06:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-24'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:19:27',+ 'gps_data.lat': 30.0229344,+ 'gps_data.lng': 31.2179138,+ 'gps_data.types': 'driver_gps',+ epoch: 1472708000000,+ has_result: 'False',+ id: null,+ time: '2016-09-23T05:00:00.000Z',+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-24'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:20:14',+ 'gps_data.lat': 30.0264237,+ 'gps_data.lng': 31.2179415,+ 'gps_data.types': 'driver_gps',+ epoch: 1472708000000,+ has_result: 'False',+ id: null,+ time: null,+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-24'+ },+ {+ 'gps_data.utc_timestamp': '2016-09-17 00:21:17',+ 'gps_data.lat': 30.0292134,+ 'gps_data.lng': 31.2181809,+ 'gps_data.types': 'driver_gps',+ epoch: 1472754400000,+ has_result: 'False',+ id: null,+ time: null,+ begintrip_ts_utc: null,+ begintrip_ts_local: null,+ date: '2016-09-24'+ }+];++// metaData batch csv+export const csvMetaDataBatch = {+ batchType: 'metadata',+ bytesUsed: 0,+ data: [],+ metadata: {+ _context: {},+ _loader: {}+ }+};++export const csvSchema = {+ 'gps_data.utc_timestamp': {+ name: 'gps_data.utc_timestamp',+ index: 0+ },+ 'gps_data.lat': {+ name: 'gps_data.lat',+ index: 1+ },+ 'gps_data.lng': {+ name: 'gps_data.lng',+ index: 2+ },+ 'gps_data.types': {+ name: 'gps_data.types',+ index: 3+ },+ epoch: {+ name: 'epoch',+ index: 4+ },+ has_result: {+ name: 'has_result',+ index: 5+ },+ id: {+ name: 'id',+ index: 6+ },+ time: {+ name: 'time',+ index: 7+ },+ begintrip_ts_utc: {+ name: 'begintrip_ts_utc',+ index: 8+ },+ begintrip_ts_local: {+ name: 'begintrip_ts_local',+ index: 9+ },+ date: {+ name: 'date',+ index: 10+ }+};++// data batch csv+export const csvDataBatch0 = {+ bytesUsed: 2000,+ count: 0,+ // cursor: 0+ data: csvWithNull.slice(0, 6),+ length: 6,+ schema: csvSchema+};++export const csvDataBatch1 = {+ bytesUsed: 3000,+ count: 1,+ // cursor: 0+ data: csvWithNull.slice(6, 13),+ length: 7,+ schema: csvSchema+};++export const geojsonMetaBatch = {+ batchType: 'metadata',+ bytesUsed: 0,+ // data is empty in metaBatch+ data: [],+ // omit loader+ metadata: {_loader: {}, _context: {}},+ progress: {+ percent: 0,+ rowCount: 0,+ rowCountInBatch: 0+ }+};+export const geoJsonPartialBatch = {+ batchType: 'partial-result',+ bytesUsed: 0,+ container: {type: 'FeatureCollection', features: []},+ data: [],+ jsonpath: '$.features',+ schema: {}+};++export const geoJsonDataBatch0 = {+ bytesUsed: 2000,+ count: 1,+ cursor: 0,+ data: geojsonData.features.slice(0, 2),+ jsonpath: '$.features',+ length: 5,+ schema: null+};++export const geoJsonDataBatch1 = {+ bytesUsed: 4000,+ count: 2,+ cursor: 0,+ data: geojsonData.features.slice(2, 5),+ jsonpath: '$.features',+ length: 3,+ schema: null+};++export const geoJsonFinalBatch = {+ batchType: 'final-result',+ container: {type: 'FeatureCollection', features: []},+ data: [],+ jsonpath: '$.features',+ schema: null+};diff --git a/test/node/processors/file-handler-test.js b/test/node/processors/file-handler-test.jsindex 591e44c51..beb479fe7 100644--- a/test/node/processors/file-handler-test.js+++ b/test/node/processors/file-handler-test.js@@ -19,21 +19,12 @@// THE SOFTWARE.import test from 'tape';-import {getFileType, isKeplerGlMap} from 'processors/file-handler';--test('#file-handler -> getFileType', t => {- t.equal(getFileType('filename.csv'), 'csv');-- t.equal(getFileType('filename.json'), 'json');-- t.equal(getFileType('filename.json.csv'), 'csv');-- t.equal(getFileType('filename.geojson'), 'json');-- t.equal(getFileType('filename.excel'), 'other');-- t.end();-});+import {isKeplerGlMap, makeProgressIterator, filesToDataPayload} from 'processors/file-handler';+import {parsedFields, parsedRows} from 'test/fixtures/row-object';+import {+ savedStateV1InteractionCoordinate as keplerglMap,+ parsedFields as parsedKeplerMapFields+} from 'test/fixtures/state-saved-v1-7';test('#file-handler -> isKeplerGlMap', t => {t.equal(@@ -56,3 +47,128 @@ test('#file-handler -> isKeplerGlMap', t => {t.end();});++test('#file-handler -> makeProgressIterator', async t => {+ // mock AsyncIterator returned by loarder.gl patchInBatches+ // Ideally should run this in browser-headless+ async function* mock() {+ let bytesUsed = 0;+ let value = 0;+ let b = 0;+ await new Promise(resolve => setTimeout(resolve, 100));+ while (b < 2) {+ b += 1;+ bytesUsed += 10;+ value += 1;+ yield {+ data: [{value}],+ bytesUsed+ };+ }+ }+ const asyncIterator = mock();+ const info = {size: 100};++ const progress = makeProgressIterator(asyncIterator, info);++ const batch1 = await progress.next();+ const batch2 = await progress.next();+ const batch3 = await progress.next();++ const expected1 = {+ value: {+ data: [{value: 1}],+ bytesUsed: 10,+ progress: {rowCount: 1, rowCountInBatch: 1, percent: 0.1}+ },+ done: false+ };++ const expected2 = {+ value: {+ data: [{value: 2}],+ bytesUsed: 20,+ progress: {rowCount: 2, rowCountInBatch: 1, percent: 0.2}+ },+ done: false+ };+ const expected3 = {+ value: undefined,+ done: true+ };++ t.deepEqual(batch1, expected1, 'batch1 should be correct');+ t.deepEqual(batch2, expected2, 'batch2 should be correct');+ t.deepEqual(batch3, expected3, 'batch3 should be correct');++ t.end();+});++test('#file-handler -> filesToDataPayload', t => {+ const fileCache = [+ {+ data: {+ fields: parsedFields,+ rows: parsedRows+ },+ info: {label: 'rows-data.json', format: 'row'}+ },+ {+ data: {+ datasets: [+ {+ data: {+ fields: parsedKeplerMapFields,+ rows: keplerglMap.datasets[0].data.allData+ },+ info: {id: 'a5ybmwl2d', label: 'geojson_as_string_small.csv', color: [53, 92, 125]}+ }+ ],+ config: keplerglMap.config+ },+ info: {label: 'keplergl-map.json', format: 'keplergl'}+ }+ ];++ const result = filesToDataPayload(fileCache);++ // const expectedResults = [+ // {+ // datasets: [{data, info}],+ // config: {+ // version: 'v1',+ // config: {}+ // },+ // options: {centerMap: true}+ // },+ // {datasets: [{data, info}]}+ // ];++ t.equal(result.length, 2, 'result shoud have 2 entries');+ t.deepEqual(+ Object.keys(result[0]),+ ['datasets', 'config', 'options'],+ 'result[0] should have 3 keys'+ );+ t.equal(result[0].datasets, fileCache[1].data.datasets, 'should save keplergl map datasets');+ t.equal(result[0].config, fileCache[1].data.config, 'should save keplergl map config');+ t.deepEqual(+ result[0].options,+ {centerMap: true},+ 'should save keplergl map set {centerMap: true}'+ );++ t.deepEqual(Object.keys(result[1]), ['datasets'], 'result[0] should have 1 key');+ t.deepEqual(+ result[1].datasets[0].data,+ fileCache[0].data,+ 'should pass file data to datasets only'+ );+ t.deepEqual(+ Object.keys(result[1].datasets[0].info),+ ['id', 'label', 'format'],+ 'result[0] datasets[0].info should have 3 key'+ );++ t.end();+});diff --git a/test/node/processors/index.js b/test/node/processors/index.jsnew file mode 100644index 000000000..f42644432--- /dev/null+++ b/test/node/processors/index.js@@ -0,0 +1,21 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import './file-handler-test';diff --git a/test/node/reducers/provider-state-test.js b/test/node/reducers/provider-state-test.jsindex efd3311cb..2e7a15157 100644--- a/test/node/reducers/provider-state-test.js+++ b/test/node/reducers/provider-state-test.js@@ -159,6 +159,8 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD', t => {},'Should set isLoading to false and error');++ errSpy.restore();t.end();});diff --git a/test/node/reducers/ui-state-test.js b/test/node/reducers/ui-state-test.jsindex b9f8707e7..904dd8997 100644--- a/test/node/reducers/ui-state-test.js+++ b/test/node/reducers/ui-state-test.js@@ -254,7 +254,7 @@ test('#uiStateReducer -> LOAD_FILES_ERR', t => {const newState = reducer(INITIAL_UI_STATE, loadFiles());t.equal(newState.loadFiles.fileLoading, true, 'should set fileLoading to true');- const newState1 = reducer(newState, loadFilesErr(new Error('this is an error')));+ const newState1 = reducer(newState, loadFilesErr('file.csv', new Error('this is an error')));const expectedId = newState1.notifications.length ? newState1.notifications[0].id : 'error';t.equal(newState1.loadFiles.fileLoading,diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.jsindex 4270716cb..0892e8336 100644--- a/test/node/reducers/vis-state-test.js+++ b/test/node/reducers/vis-state-test.js@@ -20,6 +20,10 @@/* eslint-disable max-statements */import test from 'tape-catch';+import sinon from 'sinon';+import {console as Console} from 'global/window';++import {drainTasksForTesting, succeedTaskInTest, errorTaskInTest} from 'react-palm/tasks';import CloneDeep from 'lodash.clonedeep';import * as VisStateActions from 'actions/vis-state-actions';@@ -66,7 +70,8 @@ import {StateWFiles,StateWFilesFiltersLayerColor,testCsvDataId,- testGeoJsonDataId+ testGeoJsonDataId,+ InitialState} from 'test/helpers/mock-state';import {LAYER_VIS_CONFIGS, DEFAULT_TEXT_LABEL, DEFAULT_COLOR_UI} from 'layers/layer-factory';import {getNextColorMakerValue} from 'test/helpers/layer-utils';@@ -910,7 +915,6 @@ test('#visStateReducer -> UPDATE_VIS_DATA.1 -> No data', t => {t.end();});-/* eslint-disable max-statements */test('#visStateReducer -> UPDATE_VIS_DATA.2 -> to empty state', t => {const oldState = INITIAL_VIS_STATE;@@ -2023,7 +2027,6 @@ test('#visStateReducer -> setFilter.dynamicDomain & gpu', t => {t.end();});-/* eslint-enable max-statements */test('#visStateReducer -> UPDATE_FILTER_ANIMATION_SPEED', t => {const initialState = StateWFilters.visState;@@ -3047,7 +3050,6 @@ test('#visStateReducer -> LAYER_COLOR_UI_CHANGE. show dropdown', t => {t.end();});-// eslint-disable-next-line max-statementstest('#visStateReducer -> LAYER_COLOR_UI_CHANGE. colorRangeConfig.step', t => {const initialState = CloneDeep(StateWFilesFiltersLayerColor.visState);const pointLayer = initialState.layers[0];@@ -3534,7 +3536,6 @@ test('#visStateReducer -> POLYGON: Add/Remove new polygon feature', t => {t.end();});-/* eslint-disable max-statements */test('#visStateReducer -> POLYGON: Create polygon filter', t => {const state = {...INITIAL_VIS_STATE@@ -3697,7 +3698,6 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {t.end();});-/* eslint-enable max-statements */test('#visStateReducer -> POLYGON: Toggle filter feature', t => {const state = {@@ -4167,3 +4167,309 @@ test('#visStateReducer -> PIN_TABLE_COLUMN', t => {t.end();});++test('#visStateReducer -> LOAD_FILES', async t => {+ const loadFilesSuccessSpy = sinon.spy(VisStateActions, 'loadFilesSuccess');+ const loadFileErrSpy = sinon.spy(Console, 'warn');+ const initialState = CloneDeep(InitialState).visState;+ const mockResults = {+ data: [+ {value1: 'a', value2: 1},+ {value1: 'b', value2: 2}+ ]+ };+ const mockFiles = [+ {type: 'text/csv', name: 'test-file.csv'},+ {type: 'text/csv', name: 'test-file-2.csv'}+ ];+ // mock async generator+ async function* run(fileName) {+ // Sleep for 100ms, see: https://masteringjs.io/tutorials/fundamentals/sleep+ let percent = 0;+ await new Promise(resolve => setTimeout(resolve, 100));+ while (percent < 1) {+ percent += 1;+ yield {progress: {percent}, fileName, ...mockResults};+ }+ }++ const nextState = reducer(initialState, VisStateActions.loadFiles(mockFiles));+ const [task1, ...more] = drainTasksForTesting();++ t.equal(more.length, 0, 'should ceate 1 task');++ const exptectedTask1 = {+ type: 'LOAD_FILE_TASK',+ payload: {file: {type: 'text/csv', name: 'test-file.csv'}, fileCache: []}+ };++ t.equal(task1.type, exptectedTask1.type, 'should create LOAD_FILE_TASK task');+ t.deepEqual(+ task1.payload,+ exptectedTask1.payload,+ 'should create LOAD_FILE_TASK correct payload'+ );++ const expectedFileLoading = {+ fileCache: [],+ filesToLoad: [{type: 'text/csv', name: 'test-file-2.csv'}],+ onFinish: VisStateActions.loadFilesSuccess+ };+ const expectedFileLoadingProgress = {+ 'test-file.csv': {percent: 0, message: 'loading...', fileName: 'test-file.csv', error: null},+ 'test-file-2.csv': {percent: 0, message: '', fileName: 'test-file-2.csv', error: null}+ };++ t.deepEqual(nextState.fileLoading, expectedFileLoading, 'should save fileLoading in state');+ t.deepEqual(+ nextState.fileLoadingProgress,+ expectedFileLoadingProgress,+ 'should save fileLoadingProgress in state'+ );++ const asyncIterator = run('test-file.csv');++ // test nextFileBatchUpdater+ const nextState2 = reducer(nextState, succeedTaskInTest(task1, asyncIterator));+ // test LOAD_FILE_TASK success+ const [task2, ...more2] = drainTasksForTesting();+ t.equal(more2.length, 0, 'should ceate 1 task');+ t.equal(task2.type, 'UNWRAP', 'should return an UNWRAP task');+ t.ok(task2.payload instanceof Promise, 'task 2 payload should be a Promise');++ t.equal(+ nextState2.fileLoading,+ nextState.fileLoading,+ 'fileLoading should not change for the first batch'+ );+ t.deepEqual(+ nextState2.fileLoadingProgress,+ nextState.fileLoadingProgress,+ 'fileLoadingProgress should not change for the first batch'+ );++ // test LOAD_FILE_TASK error+ const err1 = {message: 'error 1'};+ const nextState2Err = reducer(nextState, errorTaskInTest(task1, err1));+ const [task2Err, ...more2err] = drainTasksForTesting();+ t.equal(more2err.length, 0, 'should ceate 1 task');+ const expectedErrProgress = {+ 'test-file.csv': {percent: 0, message: 'loading...', fileName: 'test-file.csv', error: err1},+ 'test-file-2.csv': {percent: 0, message: '', fileName: 'test-file-2.csv', error: null}+ };+ t.deepEqual(+ nextState2Err.fileLoadingProgress,+ expectedErrProgress,+ 'should save error to fileLoadingProgress'+ );+ loadFileErrSpy.calledWith(err1);++ t.equal(+ task2Err.type,+ 'DELAY_TASK',+ 'should create a DELAY_TASK task when loadFileErr is triggered'+ );+ const nextState3Err = reducer(nextState2Err, succeedTaskInTest(task2Err));+ const [task3Err, ...more3err] = drainTasksForTesting();+ t.equal(more3err.length, 0, 'should ceate 1 task');+ t.equal(task3Err.type, 'LOAD_FILE_TASK', 'should return an LOAD_FILE_TASK');+ t.deepEqual(+ task3Err.payload,+ {file: {type: 'text/csv', name: 'test-file-2.csv'}, fileCache: []},+ 'should return an LOAD_FILE_TASK with 2nd file to load'+ );+ const expectedErrFileLoadingProgress = {+ 'test-file.csv': {percent: 0, message: 'loading...', fileName: 'test-file.csv', error: err1},+ 'test-file-2.csv': {percent: 0, message: 'loading...', fileName: 'test-file-2.csv', error: null}+ };+ t.deepEqual(+ nextState3Err.fileLoadingProgress,+ expectedErrFileLoadingProgress,+ 'fileLoadingProgress should update whe calling loadNextfileUpdater'+ );+ t.deepEqual(+ nextState3Err.fileLoading,+ {+ fileCache: [],+ filesToLoad: [],+ onFinish: VisStateActions.loadFilesSuccess+ },+ 'fileLoading should not add result to fileCache when error'+ );++ // UNWRAP Task success+ const unwrapSuccess = await task2.payload;+ const resultState3 = reducer(nextState2, succeedTaskInTest(task2, unwrapSuccess));++ // should return another unwrap task+ const [task3, ...more3] = drainTasksForTesting();+ t.equal(more3.length, 0, 'should ceate 1 task');+ t.equal(task3.type, 'UNWRAP', 'should return an UNWRAP task');+ t.ok(task3.payload instanceof Promise, 'task 3 payload should be a Promise');+ const expectedFileLoadingProgress3 = {+ 'test-file.csv': {percent: 1, message: 'loading...', fileName: 'test-file.csv', error: null},+ 'test-file-2.csv': {percent: 0, message: '', fileName: 'test-file-2.csv', error: null}+ };+ t.equal(+ resultState3.fileLoading,+ nextState2.fileLoading,+ 'fileLoading should not change when loadingis not finished'+ );+ t.deepEqual(+ resultState3.fileLoadingProgress,+ expectedFileLoadingProgress3,+ 'fileLoadingProgress should update with percent'+ );++ // calling UNWRAP_TASK sucess to create File Process task+ const unwrapSuccess3 = await task3.payload;+ const resultState4 = reducer(resultState3, succeedTaskInTest(task3, unwrapSuccess3));+ const [task4, ...more4] = drainTasksForTesting();++ const expectedFileLoadingProgress4 = {+ 'test-file.csv': {percent: 1, message: 'processing...', fileName: 'test-file.csv', error: null},+ 'test-file-2.csv': {percent: 0, message: '', fileName: 'test-file-2.csv', error: null}+ };+ t.equal(resultState3.fileLoading, resultState4.fileLoading, 'fileLoading should be the same');+ t.deepEqual(+ resultState4.fileLoadingProgress,+ expectedFileLoadingProgress4,+ 'fileLoadingProgress should update to reflect processing'+ );++ t.equal(more4.length, 0, 'should ceate 1 task');+ const expectedpayload = {+ content: {progress: {percent: 1}, fileName: 'test-file.csv', ...mockResults},+ fileCache: []+ };+ t.equal(task4.type, 'PROCESS_FILE_CONTENT', 'should return an PROCESS_FILE_CONTENT task');+ t.deepEqual(+ task4.payload,+ expectedpayload,+ 'PROCESS_FILE_CONTENT task payload should be correct'+ );++ const fileProcessResult = [+ {+ data: [],+ info: {+ label: 'test_data.csv',+ format: 'csv'+ }+ }+ ];++ // calling loadFileStepSuccess with file process result+ const resultState5 = reducer(resultState4, succeedTaskInTest(task4, fileProcessResult));++ const expectedFileLoadingProgress5 = {+ 'test-file.csv': {percent: 1, message: 'Done', fileName: 'test-file.csv', error: null},+ 'test-file-2.csv': {percent: 0, message: '', fileName: 'test-file-2.csv', error: null}+ };+ t.deepEqual(+ resultState5.fileLoadingProgress,+ expectedFileLoadingProgress5,+ 'fileLoadingProgress should update to show finish'+ );+ t.deepEqual(+ resultState5.fileLoading,+ {+ fileCache: fileProcessResult,+ filesToLoad: [{type: 'text/csv', name: 'test-file-2.csv'}],+ onFinish: VisStateActions.loadFilesSuccess+ },+ 'fileLoading should update to add result to fileCache'+ );+ const [task5, ...more5] = drainTasksForTesting();+ t.equal(more5.length, 0, 'should ceate 1 task');+ t.equal(task5.type, 'DELAY_TASK', 'should return an DELAY_TASK');++ // calling delayed task succeed to trigger load next file+ const resultState6 = reducer(resultState5, succeedTaskInTest(task5));+ const [task6, ...more6] = drainTasksForTesting();+ t.equal(more6.length, 0, 'should ceate 1 task');+ t.equal(task6.type, 'LOAD_FILE_TASK', 'should return an LOAD_FILE_TASK');+ t.deepEqual(+ task6.payload,+ {file: {type: 'text/csv', name: 'test-file-2.csv'}, fileCache: fileProcessResult},+ 'should return an LOAD_FILE_TASK with 2nd file to load'+ );+ const expectedFileLoadingProgress6 = {+ 'test-file.csv': {percent: 1, message: 'Done', fileName: 'test-file.csv', error: null},+ 'test-file-2.csv': {percent: 0, message: 'loading...', fileName: 'test-file-2.csv', error: null}+ };+ t.deepEqual(+ resultState6.fileLoadingProgress,+ expectedFileLoadingProgress6,+ 'fileLoadingProgress should update whe calling loadNextfileUpdater'+ );+ t.deepEqual(+ resultState6.fileLoading,+ {+ fileCache: fileProcessResult,+ filesToLoad: [],+ onFinish: VisStateActions.loadFilesSuccess+ },+ 'fileLoading should update to add result to fileCache'+ );+ // fast forward so we can test final result+ const asyncIterator2 = run('test-file-2.csv');+ const resultState7 = reducer(resultState6, succeedTaskInTest(task6, asyncIterator2));+ const [task7] = drainTasksForTesting();++ const unwrapSuccess7 = await task7.payload;+ const resultState8 = reducer(resultState7, succeedTaskInTest(task7, unwrapSuccess7));+ const [task8] = drainTasksForTesting();+ const unwrapSuccess8 = await task8.payload;+ const resultState9 = reducer(resultState8, succeedTaskInTest(task8, unwrapSuccess8));+ // process task+ const [task9] = drainTasksForTesting();+ const file2ProcessResult = [+ ...fileProcessResult,+ {+ data: [{value: 1}],+ info: {+ label: 'test_data_2.csv',+ format: 'csv'+ }+ }+ ];+ const resultState10 = reducer(resultState9, succeedTaskInTest(task9, file2ProcessResult));++ const expectedFileLoadingProgress10 = {+ 'test-file.csv': {percent: 1, message: 'Done', fileName: 'test-file.csv', error: null},+ 'test-file-2.csv': {percent: 1, message: 'Done', fileName: 'test-file-2.csv', error: null}+ };+ t.deepEqual(+ resultState10.fileLoadingProgress,+ expectedFileLoadingProgress10,+ 'fileLoadingProgress should update to show finish both files'+ );+ t.deepEqual(+ resultState10.fileLoading,+ {+ fileCache: file2ProcessResult,+ filesToLoad: [],+ onFinish: VisStateActions.loadFilesSuccess+ },+ 'fileLoading should update to add 2nd file result to fileCache'+ );+ const [task10, ...more10] = drainTasksForTesting();+ t.equal(more10.length, 0, 'should ceate 1 task');+ t.equal(task10.type, 'DELAY_TASK', 'should return an DELAY_TASK for onFinish');++ // calling delayed task succeed to trigger load next file+ /* eslint-disable no-unused-vars */+ const resultState11 = reducer(resultState10, succeedTaskInTest(task10));++ t.ok(loadFilesSuccessSpy.calledOnce);+ const expectedArgs = [+ {data: [], info: {label: 'test_data.csv', format: 'csv'}},+ {data: [{value: 1}], info: {label: 'test_data_2.csv', format: 'csv'}}+ ];+ t.ok(loadFilesSuccessSpy.calledWith(expectedArgs));+ loadFilesSuccessSpy.restore();++ loadFileErrSpy.restore();+ t.end();+});diff --git a/test/webpack.config.js b/test/webpack.config.jsnew file mode 100644index 000000000..988d388da--- /dev/null+++ b/test/webpack.config.js@@ -0,0 +1,109 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++const {resolve} = require('path');+const HtmlWebpackPlugin = require('html-webpack-plugin');+const SRC_DIR = resolve(__dirname, '../src');+const TEST_DIR = resolve(__dirname, './');++const COMMON_CONFIG = {+ mode: 'development',++ devServer: {+ stats: {+ warnings: false+ },+ clientLogLevel: 'debug'+ },+ entry: resolve(__dirname, './browser.js'),+ output: {+ filename: 'bundle.js'+ },+ devtool: 'inline-source-maps',++ module: {+ rules: [+ {+ test: /\.js$/,+ use: ['source-map-loader'],+ enforce: 'pre'+ },+ {+ test: /\.js$/,+ loader: 'babel-loader',+ include: [SRC_DIR, TEST_DIR],+ exclude: [/node_modules/],+ options: {+ rootMode: 'upward',+ presets: ['@babel/preset-env', '@babel/preset-react'],+ plugins: [+ ['@babel/plugin-proposal-decorators', {legacy: true}],+ '@babel/plugin-proposal-class-properties',+ [+ '@babel/transform-runtime',+ {+ regenerator: true+ }+ ],+ '@babel/plugin-syntax-dynamic-import',+ '@babel/plugin-syntax-import-meta',+ '@babel/plugin-proposal-json-strings',+ '@babel/plugin-proposal-function-sent',+ '@babel/plugin-proposal-export-namespace-from',+ '@babel/plugin-proposal-numeric-separator',+ '@babel/plugin-proposal-throw-expressions',+ '@babel/plugin-proposal-export-default-from',+ '@babel/plugin-proposal-logical-assignment-operators',+ '@babel/plugin-proposal-optional-chaining',+ [+ '@babel/plugin-proposal-pipeline-operator',+ {+ proposal: 'minimal'+ }+ ],+ '@babel/plugin-proposal-nullish-coalescing-operator',+ '@babel/plugin-proposal-do-expressions',+ '@babel/plugin-proposal-function-bind',+ '@babel/plugin-transform-modules-commonjs',+ [+ 'module-resolver',+ {+ root: [SRC_DIR],+ alias: {+ test: TEST_DIR+ }+ }+ ]+ ]+ }+ }+ ]+ },++ node: {+ fs: 'empty'+ },++ plugins: [new HtmlWebpackPlugin()]+};++module.exports = (env = {}, opts = {}) => {+ return COMMON_CONFIG;+};diff --git a/yarn.lock b/yarn.lockindex 88150cf62..0fcb1e199 100644--- a/yarn.lock+++ b/yarn.lock@@ -2235,7 +2235,7 @@"@math.gl/geospatial" "^3.2.0""@probe.gl/stats" "^3.3.0"-"@loaders.gl/[email protected]", "@loaders.gl/core@^2.2.3":+"@loaders.gl/[email protected]", "@loaders.gl/core@^2.2.3", "@loaders.gl/core@^2.2.5":version "2.2.5"resolved "https://registry.yarnpkg.com/@loaders.gl/core/-/core-2.2.5.tgz#414df7b85ac6387e857e41474dd834fefc802678"integrity sha512-mcSbxnKCz2JGOsLFCADWUOc4tQ8gED7keiIm5nzcEWdiz/ft1+B58PlTUMefiUWebad+MoyBG76uASpnX5MXVQ==@@ -2243,6 +2243,14 @@"@babel/runtime" "^7.3.1""@loaders.gl/loader-utils" "2.2.5"+"@loaders.gl/csv@^2.2.5":+ version "2.2.5"+ resolved "https://registry.yarnpkg.com/@loaders.gl/csv/-/csv-2.2.5.tgz#4667cbfb62b98d918a1c4e233bfb880939ab74fb"+ integrity sha512-18Sp28zfbkz+0G6l2xTDL/G28ZNEgFC8st96Rib82tRfTpWxEjkJLm0/ESaZFpPX2OPa/kNoU2DVz0CDL+Am/A==+ dependencies:+ "@loaders.gl/loader-utils" "2.2.5"+ "@loaders.gl/tables" "2.2.5"+"@loaders.gl/[email protected]":version "2.2.5"resolved "https://registry.yarnpkg.com/@loaders.gl/draco/-/draco-2.2.5.tgz#50b85cb79b48c650d11e65c1e3ec8fb9133ea27c"@@ -2269,6 +2277,14 @@dependencies:"@loaders.gl/loader-utils" "2.2.5"+"@loaders.gl/json@^2.2.5":+ version "2.2.5"+ resolved "https://registry.yarnpkg.com/@loaders.gl/json/-/json-2.2.5.tgz#1f1c757f85ed9f9e267914eaae8403c79ada1017"+ integrity sha512-BlqDTKWQs8RLuEQ7duHAmoDC5oQybdtorRRdAZziIKgMckaqVaU9+HhU3PcT+OcoElB8BAW8++w7JWwFfMhkbQ==+ dependencies:+ "@loaders.gl/loader-utils" "2.2.5"+ "@loaders.gl/tables" "2.2.5"+"@loaders.gl/[email protected]", "@loaders.gl/loader-utils@^2.2.3":version "2.2.5"resolved "https://registry.yarnpkg.com/@loaders.gl/loader-utils/-/loader-utils-2.2.5.tgz#8c19b10c2bd75a2bf2a913be62a701d52a37acfa"@@ -2295,6 +2311,25 @@"@mapbox/vector-tile" "^1.3.1"pbf "^3.2.1"+"@loaders.gl/polyfills@^2.2.5":+ version "2.2.5"+ resolved "https://registry.yarnpkg.com/@loaders.gl/polyfills/-/polyfills-2.2.5.tgz#393a0efc1c472b6090e92080217a78a311af090f"+ integrity sha512-Qlu29L+8PFRRf2UX1yk0oFF68yUBN0e633LDqUoDdUyCP8gXmoAtG+dGeF/6aTgk9UloBpjk2UP8EOg5kC7i6g==+ dependencies:+ "@babel/runtime" "^7.3.1"+ get-pixels "^3.3.2"+ ndarray "^1.0.18"+ save-pixels "^2.3.2"+ stream-to-async-iterator "^0.2.0"+ through "^2.3.8"++"@loaders.gl/[email protected]":+ version "2.2.5"+ resolved "https://registry.yarnpkg.com/@loaders.gl/tables/-/tables-2.2.5.tgz#c594262eb4d1fc4e26c356b6f5378ee70b997ea6"+ integrity sha512-GT9mBreBGPsi3AEelNlcZo0UjD3HIa+yyRvIoUMfD+dpHKvrSqk7zsEaC2wvsxIMdi7uW7iIh99ynhfODV+EKA==+ dependencies:+ "@loaders.gl/core" "2.2.5"+"@loaders.gl/terrain@^2.2.3":version "2.2.5"resolved "https://registry.yarnpkg.com/@loaders.gl/terrain/-/terrain-2.2.5.tgz#c984c6b8e1c536ccde3012e1054f5eb2482527de"@@ -2716,6 +2751,11 @@dependencies:"@turf/helpers" "6.x"+"@types/anymatch@*":+ version "1.3.1"+ resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"+ integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==+"@types/babel__core@^7.1.0":version "7.1.4"resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.4.tgz#5c5569cc40e5f2737dfc00692f5444e871e4a234"@@ -2781,6 +2821,11 @@"@types/react" "*"hoist-non-react-statics "^3.3.0"+"@types/html-minifier-terser@^5.0.0":+ version "5.1.0"+ resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-5.1.0.tgz#551a4589b6ee2cc9c1dff08056128aec29b94880"+ integrity sha512-iYCgjm1dGPRuo12+BStjd1HiVQqhlRhWDOQigNxn023HcjnhsiFz9pc6CzJj4HwDCSQca9bxTL4PxJDbkdm3PA==+"@types/invariant@^2.2.31":version "2.2.31"resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.31.tgz#4444c03004f215289dbca3856538434317dd28b2"@@ -2834,16 +2879,54 @@"@types/prop-types" "*"csstype "^2.2.0"+"@types/source-list-map@*":+ version "0.1.2"+ resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"+ integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==+"@types/stack-utils@^1.0.1":version "1.0.1"resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==+"@types/tapable@*", "@types/tapable@^1.0.5":+ version "1.0.6"+ resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.6.tgz#a9ca4b70a18b270ccb2bc0aaafefd1d486b7ea74"+ integrity sha512-W+bw9ds02rAQaMvaLYxAbJ6cvguW/iJXNT6lTssS1ps6QdrMKttqEAMEG/b5CR8TZl3/L7/lH0ZV5nNR1LXikA==++"@types/uglify-js@*":+ version "3.9.2"+ resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.9.2.tgz#01992579debba674e1e359cd6bcb1a1d0ab2e02b"+ integrity sha512-d6dIfpPbF+8B7WiCi2ELY7m0w1joD8cRW4ms88Emdb2w062NeEpbNCeWwVCgzLRpVG+5e74VFSg4rgJ2xXjEiQ==+ dependencies:+ source-map "^0.6.1"+"@types/unist@^2.0.2":version "2.0.3"resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e"integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==+"@types/webpack-sources@*":+ version "1.4.0"+ resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-1.4.0.tgz#e58f1f05f87d39a5c64cf85705bdbdbb94d4d57e"+ integrity sha512-c88dKrpSle9BtTqR6ifdaxu1Lvjsl3C5OsfvuUbUwdXymshv1TkufUAXBajCCUM/f/TmnkZC/Esb03MinzSiXQ==+ dependencies:+ "@types/node" "*"+ "@types/source-list-map" "*"+ source-map "^0.7.3"++"@types/webpack@^4.41.8":+ version "4.41.17"+ resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.17.tgz#0a69005e644d657c85b7d6ec1c826a71bebd1c93"+ integrity sha512-6FfeCidTSHozwKI67gIVQQ5Mp0g4X96c2IXxX75hYEQJwST/i6NyZexP//zzMOBb+wG9jJ7oO8fk9yObP2HWAw==+ dependencies:+ "@types/anymatch" "*"+ "@types/node" "*"+ "@types/tapable" "*"+ "@types/uglify-js" "*"+ "@types/webpack-sources" "*"+ source-map "^0.6.0"+"@types/yargs-parser@*":version "15.0.0"resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d"@@ -4310,6 +4393,14 @@ [email protected]:no-case "^2.2.0"upper-case "^1.1.1"+camel-case@^4.1.1:+ version "4.1.1"+ resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-4.1.1.tgz#1fc41c854f00e2f7d0139dfeba1542d6896fe547"+ integrity sha512-7fa2WcG4fYFkclIvEmxBbTvmibwF2/agfEBc6q3lOpVu0A13ltLsA+Hr/8Hp6kp5f+G7hKi6t8lys6XxP+1K6Q==+ dependencies:+ pascal-case "^3.1.1"+ tslib "^1.10.0"+camelcase-keys@^2.0.0:version "2.1.0"resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7"@@ -4521,7 +4612,7 @@ classnames@^2.2.1, classnames@^2.2.5:resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==[email protected], clean-css@^4.2.3:version "4.2.3"resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78"integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==@@ -4733,6 +4824,11 @@ commander@^4.0.1:resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.0.tgz#545983a0603fe425bc672d66c9e3c89c42121a83"integrity sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==+commander@^4.1.1:+ version "4.1.1"+ resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"+ integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==+commander@~2.19.0:version "2.19.0"resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"@@ -4865,6 +4961,13 @@ content-type@~1.0.4:resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==+contentstream@^1.0.0:+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/contentstream/-/contentstream-1.0.0.tgz#0bdcfa46da30464a86ce8fa7ece565410dc6f9a5"+ integrity sha1-C9z6RtowRkqGzo+n7OVlQQ3G+aU=+ dependencies:+ readable-stream "~1.0.33-1"+continuable-cache@^0.3.1:version "0.3.1"resolved "https://registry.yarnpkg.com/continuable-cache/-/continuable-cache-0.3.1.tgz#bd727a7faed77e71ff3985ac93351a912733ad0f"@@ -5232,6 +5335,13 @@ cwd@^0.10.0:find-pkg "^0.1.2"fs-exists-sync "^0.1.0"+cwise-compiler@^1.0.0, cwise-compiler@^1.1.2:+ version "1.1.3"+ resolved "https://registry.yarnpkg.com/cwise-compiler/-/cwise-compiler-1.1.3.tgz#f4d667410e850d3a313a7d2db7b1e505bb034cc5"+ integrity sha1-9NZnQQ6FDToxOn0tt7HlBbsDTMU=+ dependencies:+ uniq "^1.0.0"+cyclist@^1.0.1:version "1.0.1"resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"@@ -5433,6 +5543,11 @@ dashdash@^1.12.0:dependencies:assert-plus "^1.0.0"+ version "0.0.3"+ resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-0.0.3.tgz#18ae979a6a0ca994b0625853916d2662bbae0b1a"+ integrity sha1-GK6XmmoMqZSwYlhTkW0mYruuCxo=+data-urls@^1.1.0:version "1.1.0"resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe"@@ -5546,11 +5661,6 @@ deep-equal@^1.0.1, deep-equal@~1.1.1:object-keys "^1.1.1"regexp.prototype.flags "^1.2.0"-deep-equal@~1.0.1:- version "1.0.1"- resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"- integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=-deep-extend@^0.6.0:version "0.6.0"resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"@@ -6012,6 +6122,14 @@ domutils@^2.0.0:domelementtype "^2.0.1"domhandler "^3.0.0"+dot-case@^3.0.3:+ version "3.0.3"+ resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.3.tgz#21d3b52efaaba2ea5fda875bb1aa8124521cf4aa"+ integrity sha512-7hwEmg6RiSQfm/GwPL4AAWXKy3YNNZA3oFv2Pdiey0mwkRCPZ9x6SZbkLcn8Ma5PYeVokzoD4Twv2n7LKp5WeA==+ dependencies:+ no-case "^3.0.3"+ tslib "^1.10.0"+dot-prop@^3.0.0:version "3.0.0"resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177"@@ -6274,7 +6392,7 @@ error@^7.0.0:dependencies:string-template "~0.2.1"-es-abstract@^1.13.0, es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.5.0:+es-abstract@^1.13.0, es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2:version "1.17.4"resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184"integrity sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==@@ -7187,7 +7305,7 @@ follow-redirects@^1.0.0:dependencies:debug "^3.0.0"-for-each@~0.3.2, for-each@~0.3.3:+for-each@~0.3.3:version "0.3.3"resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==@@ -7332,7 +7450,7 @@ fsevents@^2.1.2:resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805"integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==-function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.0, function-bind@~1.1.1:+function-bind@^1.1.1, function-bind@~1.1.1:version "1.1.1"resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==@@ -7405,6 +7523,23 @@ get-caller-file@^2.0.1:resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==+get-pixels@^3.3.2:+ version "3.3.2"+ resolved "https://registry.yarnpkg.com/get-pixels/-/get-pixels-3.3.2.tgz#3f62fb8811932c69f262bba07cba72b692b4ff03"+ integrity sha512-6ar+8yPxRd1pskEcl2GSEu1La0+xYRjjnkby6AYiRDDwZ0tJbPQmHnSeH9fGLskT8kvR0OukVgtZLcsENF9YKQ==+ dependencies:+ data-uri-to-buffer "0.0.3"+ jpeg-js "^0.3.2"+ mime-types "^2.0.1"+ ndarray "^1.0.13"+ ndarray-pack "^1.1.1"+ node-bitmap "0.0.1"+ omggif "^1.0.5"+ parse-data-uri "^0.2.0"+ pngjs "^3.3.3"+ request "^2.44.0"+ through "^2.3.4"+get-pkg-repo@^1.0.0:version "1.4.0"resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz#c73b489c06d80cc5536c2c853f9e05232056972d"@@ -7467,6 +7602,13 @@ getpass@^0.1.1:dependencies:assert-plus "^1.0.0"+gif-encoder@~0.4.1:+ version "0.4.3"+ resolved "https://registry.yarnpkg.com/gif-encoder/-/gif-encoder-0.4.3.tgz#8a2b4fe8ca895a48e3a0b6cbb340a0a6a3571899"+ integrity sha1-iitP6MqJWkjjoLbLs0CgpqNXGJk=+ dependencies:+ readable-stream "~1.1.9"+version "2.0.0"resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.0.tgz#d92addf74440c14bcc5c83ecce3fb7f8a79118b5"@@ -7629,7 +7771,7 @@ glob@^6.0.1:once "^1.3.0"path-is-absolute "^1.0.0"-glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.2, glob@~7.1.6:+glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.6:version "7.1.6"resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==@@ -7921,7 +8063,7 @@ has-values@^1.0.0:is-number "^3.0.0"kind-of "^4.0.0"-has@^1.0.0, has@^1.0.1, has@^1.0.3, has@~1.0.1, has@~1.0.3:+has@^1.0.0, has@^1.0.1, has@^1.0.3, has@~1.0.3:version "1.0.3"resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==@@ -7984,7 +8126,7 @@ hast-util-whitespace@^1.0.0:resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.3.tgz#6d161b307bd0693b5ec000c7c7e8b5445109ee34"integrity sha512-AlkYiLTTwPOyxZ8axq2/bCwRUPjIPBfrHkXuCR92B38b3lSdU22R5F/Z4DL6a2kxWpekWq1w6Nj48tWat6GeRA==[email protected], he@^1.1.0:[email protected], he@^1.1.0, he@^1.2.0:version "1.2.0"resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==@@ -8078,6 +8220,19 @@ html-escaper@^2.0.0:resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.0.tgz#71e87f931de3fe09e56661ab9a29aadec707b491"integrity sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig==+html-minifier-terser@^5.0.1:+ version "5.1.1"+ resolved "https://registry.yarnpkg.com/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#922e96f1f3bb60832c2634b79884096389b1f054"+ integrity sha512-ZPr5MNObqnV/T9akshPKbVgyOqLmy+Bxo7juKCfTfnjNniTAMdy4hz21YQqoofMBJD2kdREaqPPdThoR78Tgxg==+ dependencies:+ camel-case "^4.1.1"+ clean-css "^4.2.3"+ commander "^4.1.1"+ he "^1.2.0"+ param-case "^3.0.3"+ relateurl "^0.2.7"+ terser "^4.6.3"+html-minifier@^3.2.3:version "3.5.21"resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.21.tgz#d0040e054730e354db008463593194015212d20c"@@ -8119,6 +8274,21 @@ html-webpack-plugin@^3.2.0:toposort "^1.0.0"util.promisify "1.0.0"+html-webpack-plugin@^4.3.0:+ version "4.3.0"+ resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.3.0.tgz#53bf8f6d696c4637d5b656d3d9863d89ce8174fd"+ integrity sha512-C0fzKN8yQoVLTelcJxZfJCE+aAvQiY2VUf3UuKrR4a9k5UMWYOtpDLsaXwATbcVCnI05hUS7L9ULQHWLZhyi3w==+ dependencies:+ "@types/html-minifier-terser" "^5.0.0"+ "@types/tapable" "^1.0.5"+ "@types/webpack" "^4.41.8"+ html-minifier-terser "^5.0.1"+ loader-utils "^1.2.3"+ lodash "^4.17.15"+ pretty-error "^2.1.1"+ tapable "^1.1.3"+ util.promisify "1.0.0"+htmlescape@^1.1.0:version "1.1.1"resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351"@@ -8504,6 +8674,11 @@ invert-kv@^2.0.0:resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02"integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==+iota-array@^1.0.0:+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/iota-array/-/iota-array-1.0.0.tgz#81ef57fe5d05814cd58c2483632a99c30a0e8087"+ integrity sha1-ge9X/l0FgUzVjCSDYyqZwwoOgIc=+ip-regex@^2.1.0:version "2.1.0"resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9"@@ -9565,6 +9740,16 @@ jest@^25.1.0:import-local "^3.0.2"jest-cli "^25.1.0"+ version "0.0.4"+ resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.0.4.tgz#06aaf47efec7af0b1924a59cd695a6d2b5ed870e"+ integrity sha1-Bqr0fv7HrwsZJKWc1pWm0rXthw4=++jpeg-js@^0.3.2:+ version "0.3.7"+ resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.7.tgz#471a89d06011640592d314158608690172b1028d"+ integrity sha512-9IXdWudL61npZjvLuVe/ktHiA41iE8qFyLB+4VDTblEsWBzeg8WQTlktdUK4CdncUqtUgUg0bbOmTE2bKBKaBQ==+"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:version "4.0.0"resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"@@ -10207,6 +10392,13 @@ lower-case@^1.1.1:resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=+lower-case@^2.0.1:+ version "2.0.1"+ resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.1.tgz#39eeb36e396115cc05e29422eaea9e692c9408c7"+ integrity sha512-LiWgfDLLb1dwbFQZsSglpRj+1ctGnayXz3Uv0/WO8n558JycT5fg6zkNcnW0G68Nn0aEldTFeEfmjCfmqry/rQ==+ dependencies:+ tslib "^1.10.0"+lowercase-keys@^1.0.0:version "1.0.1"resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f"@@ -10662,6 +10854,18 @@ [email protected], "mime-db@>= 1.43.0 < 2":resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58"integrity sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==+ version "1.44.0"+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92"+ integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==++mime-types@^2.0.1:+ version "2.1.27"+ resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f"+ integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==+ dependencies:+ mime-db "1.44.0"+mime-types@^2.1.12, mime-types@^2.1.25, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24:version "2.1.26"resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.26.tgz#9c921fc09b7e149a65dfdc0da4d20997200b0a06"@@ -11007,6 +11211,29 @@ natural-compare@^1.4.0:resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=+ndarray-ops@^1.2.2:+ version "1.2.2"+ resolved "https://registry.yarnpkg.com/ndarray-ops/-/ndarray-ops-1.2.2.tgz#59e88d2c32a7eebcb1bc690fae141579557a614e"+ integrity sha1-WeiNLDKn7ryxvGkPrhQVeVV6YU4=+ dependencies:+ cwise-compiler "^1.0.0"++ndarray-pack@^1.1.1:+ version "1.2.1"+ resolved "https://registry.yarnpkg.com/ndarray-pack/-/ndarray-pack-1.2.1.tgz#8caebeaaa24d5ecf70ff86020637977da8ee585a"+ integrity sha1-jK6+qqJNXs9w/4YCBjeXfajuWFo=+ dependencies:+ cwise-compiler "^1.1.2"+ ndarray "^1.0.13"++ndarray@^1.0.13, ndarray@^1.0.18:+ version "1.0.19"+ resolved "https://registry.yarnpkg.com/ndarray/-/ndarray-1.0.19.tgz#6785b5f5dfa58b83e31ae5b2a058cfd1ab3f694e"+ integrity sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ==+ dependencies:+ iota-array "^1.0.0"+ is-buffer "^1.0.2"+nearley@^2.7.10:version "2.19.1"resolved "https://registry.yarnpkg.com/nearley/-/nearley-2.19.1.tgz#4af4006e16645ff800e9f993c3af039857d9dbdc"@@ -11040,6 +11267,14 @@ no-case@^2.2.0:dependencies:lower-case "^1.1.1"+no-case@^3.0.3:+ version "3.0.3"+ resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.3.tgz#c21b434c1ffe48b39087e86cfb4d2582e9df18f8"+ integrity sha512-ehY/mVQCf9BL0gKfsJBvFJen+1V//U+0HQMPrWct40ixE4jnv0bfvxDbWtAHL9EcaPEOJHVVYKoQn1TlZUB8Tw==+ dependencies:+ lower-case "^2.0.1"+ tslib "^1.10.0"+node-abi@^2.7.0:version "2.13.0"resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.13.0.tgz#e2f2ec444d0aca3ea1b3874b6de41d1665828f63"@@ -11047,6 +11282,11 @@ node-abi@^2.7.0:dependencies:semver "^5.4.1"+ version "0.0.1"+ resolved "https://registry.yarnpkg.com/node-bitmap/-/node-bitmap-0.0.1.tgz#180eac7003e0c707618ef31368f62f84b2a69091"+ integrity sha1-GA6scAPgxwdhjvMTaPYvhLKmkJE=+node-environment-flags@^1.0.5:version "1.0.6"resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088"@@ -11424,11 +11664,6 @@ object-inspect@^1.7.0, object-inspect@~1.7.0:resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67"integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==-object-inspect@~1.3.0:- version "1.3.0"- resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.3.0.tgz#5b1eb8e6742e2ee83342a637034d844928ba2f6d"- integrity sha512-OHHnLgLNXpM++GnJRyyhbr2bwl3pPVm4YvaraHrRvDt/N3r+s/gDVHciA7EJBTkijKXj61ssgSAikq1fb0IBRg==-object-is@^1.0.1, object-is@^1.0.2:version "1.0.2"resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.2.tgz#6b80eb84fe451498f65007982f035a5b445edec4"@@ -11551,6 +11786,11 @@ ocular-dev-tools@^0.0.30:webpack-cli "^3.2.1"webpack-dev-server "^3.1.14"+omggif@^1.0.5:+ version "1.0.10"+ resolved "https://registry.yarnpkg.com/omggif/-/omggif-1.0.10.tgz#ddaaf90d4a42f532e9e7cb3a95ecdd47f17c7b19"+ integrity sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==+on-finished@~2.3.0:version "2.3.0"resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"@@ -11840,6 +12080,14 @@ [email protected]:dependencies:no-case "^2.2.0"+param-case@^3.0.3:+ version "3.0.3"+ resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.3.tgz#4be41f8399eff621c56eebb829a5e451d9801238"+ integrity sha512-VWBVyimc1+QrzappRs7waeN2YmoZFCGXWASRYX1/rGHtXqEcrGEIDm+jqIwFa2fRXNgQEwrxaYuIrX0WcAguTA==+ dependencies:+ dot-case "^3.0.3"+ tslib "^1.10.0"+parent-module@^1.0.0:version "1.0.1"resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"@@ -11866,6 +12114,13 @@ parse-asn1@^5.0.0:pbkdf2 "^3.0.3"safe-buffer "^5.1.1"+parse-data-uri@^0.2.0:+ version "0.2.0"+ resolved "https://registry.yarnpkg.com/parse-data-uri/-/parse-data-uri-0.2.0.tgz#bf04d851dd5c87b0ab238e5d01ace494b604b4c9"+ integrity sha1-vwTYUd1ch7CrI45dAazklLYEtMk=+ dependencies:+ data-uri-to-buffer "0.0.3"+parse-entities@^1.0.2, parse-entities@^1.1.0:version "1.2.2"resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.2.2.tgz#c31bf0f653b6661354f8973559cb86dd1d5edf50"@@ -11992,6 +12247,14 @@ parseurl@~1.3.2, parseurl@~1.3.3:resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==+pascal-case@^3.1.1:+ version "3.1.1"+ resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.1.tgz#5ac1975133ed619281e88920973d2cd1f279de5f"+ integrity sha512-XIeHKqIrsquVTQL2crjq3NfJUxmdLasn3TYOU0VBM+UX2a6ztAWBlJQBePLGY7VHW8+2dRadeIPK5+KImwTxQA==+ dependencies:+ no-case "^3.0.3"+ tslib "^1.10.0"+pascalcase@^0.1.1:version "0.1.1"resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14"@@ -12217,6 +12480,11 @@ pn@^1.1.0:resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb"integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==+pngjs-nozlib@^1.0.0:+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/pngjs-nozlib/-/pngjs-nozlib-1.0.0.tgz#9e64d602cfe9cce4d9d5997d0687429a73f0b7d7"+ integrity sha1-nmTWAs/pzOTZ1Zl9BodCmnPwt9c=+pngjs@^3.0.0, pngjs@^3.3.3:version "3.4.0"resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f"@@ -12306,7 +12574,7 @@ [email protected]:resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==-pretty-error@^2.0.2:+pretty-error@^2.0.2, pretty-error@^2.1.1:version "2.1.1"resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"integrity sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM=@@ -13118,7 +13386,7 @@ read@1, read@~1.0.1:string_decoder "^1.1.1"util-deprecate "^1.0.1"-"readable-stream@>=1.0.33-1 <1.1.0-0":+"readable-stream@>=1.0.33-1 <1.1.0-0", readable-stream@~1.0.33-1:version "1.0.34"resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=@@ -13128,6 +13396,16 @@ read@1, read@~1.0.1:isarray "0.0.1"string_decoder "~0.10.x"+readable-stream@~1.1.9:+ version "1.1.14"+ resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"+ integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk=+ dependencies:+ core-util-is "~1.0.0"+ inherits "~2.0.1"+ isarray "0.0.1"+ string_decoder "~0.10.x"+readable-stream@~2.0.0:version "2.0.6"resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"@@ -13358,7 +13636,7 @@ regjsparser@^0.6.0:dependencies:jsesc "~0.5.0"[email protected], relateurl@^0.2.7:version "0.2.7"resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=@@ -13532,10 +13810,10 @@ request-promise-native@^1.0.7, request-promise-native@^1.0.8:stealthy-require "^1.1.1"tough-cookie "^2.3.3"-request@^2.87.0, request@^2.88.0:- version "2.88.0"- resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"- integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==+request@^2.44.0, request@^2.88.2:+ version "2.88.2"+ resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3"+ integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==dependencies:aws-sign2 "~0.7.0"aws4 "^1.8.0"@@ -13544,7 +13822,7 @@ request@^2.87.0, request@^2.88.0:extend "~3.0.2"forever-agent "~0.6.1"form-data "~2.3.2"- har-validator "~5.1.0"+ har-validator "~5.1.3"http-signature "~1.2.0"is-typedarray "~1.0.0"isstream "~0.1.2"@@ -13554,14 +13832,14 @@ request@^2.87.0, request@^2.88.0:performance-now "^2.1.0"qs "~6.5.2"safe-buffer "^5.1.2"- tough-cookie "~2.4.3"+ tough-cookie "~2.5.0"tunnel-agent "^0.6.0"uuid "^3.3.2"-request@^2.88.2:- version "2.88.2"- resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3"- integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==+request@^2.87.0, request@^2.88.0:+ version "2.88.0"+ resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"+ integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==dependencies:aws-sign2 "~0.7.0"aws4 "^1.8.0"@@ -13570,7 +13848,7 @@ request@^2.88.2:extend "~3.0.2"forever-agent "~0.6.1"form-data "~2.3.2"- har-validator "~5.1.3"+ har-validator "~5.1.0"http-signature "~1.2.0"is-typedarray "~1.0.0"isstream "~0.1.2"@@ -13580,7 +13858,7 @@ request@^2.88.2:performance-now "^2.1.0"qs "~6.5.2"safe-buffer "^5.1.2"- tough-cookie "~2.5.0"+ tough-cookie "~2.4.3"tunnel-agent "^0.6.0"uuid "^3.3.2"@@ -13717,13 +13995,6 @@ resolve@~1.14.2:dependencies:path-parse "^1.0.6"-resolve@~1.4.0:- version "1.4.0"- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"- integrity sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==- dependencies:- path-parse "^1.0.5"-rest@^2.0.0:version "2.0.0"resolved "https://registry.yarnpkg.com/rest/-/rest-2.0.0.tgz#6dfadf66a405c49cfbd5b4bd25b59fd29cd861bc"@@ -13898,6 +14169,19 @@ sane@^4.0.3:minimist "^1.1.1"walker "~1.0.5"+save-pixels@^2.3.2:+ version "2.3.4"+ resolved "https://registry.yarnpkg.com/save-pixels/-/save-pixels-2.3.4.tgz#49d349c06b8d7c0127dbf0da24b44aca5afb59fe"+ integrity sha1-SdNJwGuNfAEn2/DaJLRKylr7Wf4=+ dependencies:+ contentstream "^1.0.0"+ gif-encoder "~0.4.1"+ jpeg-js "0.0.4"+ ndarray "^1.0.18"+ ndarray-ops "^1.2.2"+ pngjs-nozlib "^1.0.0"+ through "^2.3.4"+saxes@^3.1.9:version "3.1.11"resolved "https://registry.yarnpkg.com/saxes/-/saxes-3.1.11.tgz#d59d1fd332ec92ad98a2e0b2ee644702384b1c5b"@@ -14599,6 +14883,11 @@ stream-splicer@^2.0.0:inherits "^2.0.1"readable-stream "^2.0.2"+stream-to-async-iterator@^0.2.0:+ version "0.2.0"+ resolved "https://registry.yarnpkg.com/stream-to-async-iterator/-/stream-to-async-iterator-0.2.0.tgz#bef5c885e9524f98b2fa5effecc357bd58483780"+ integrity sha1-vvXIhelST5iy+l7/7MNXvVhIN4A=+strict-uri-encode@^1.0.0:version "1.1.0"resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"@@ -14661,15 +14950,6 @@ string.prototype.trim@^1.2.1, string.prototype.trim@~1.2.1:es-abstract "^1.17.0-next.1"function-bind "^1.1.1"-string.prototype.trim@~1.1.2:- version "1.1.2"- resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea"- integrity sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=- dependencies:- define-properties "^1.1.2"- es-abstract "^1.5.0"- function-bind "^1.0.2"-string.prototype.trimleft@^2.1.1:version "2.1.1"resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz#9bdb8ac6abd6d602b17a4ed321870d2f8dcefc74"@@ -14962,25 +15242,6 @@ tape-catch@^1.0.4, tape-catch@^1.0.6:dependencies:global "~4.3.0"- version "4.8.0"- resolved "https://registry.yarnpkg.com/tape/-/tape-4.8.0.tgz#f6a9fec41cc50a1de50fa33603ab580991f6068e"- integrity sha512-TWILfEnvO7I8mFe35d98F6T5fbLaEtbFTG/lxWvid8qDfFTxt19EBijWmB4j3+Hoh5TfHE2faWs73ua+EphuBA==- dependencies:- deep-equal "~1.0.1"- defined "~1.0.0"- for-each "~0.3.2"- function-bind "~1.1.0"- glob "~7.1.2"- has "~1.0.1"- inherits "~2.0.3"- minimist "~1.2.0"- object-inspect "~1.3.0"- resolve "~1.4.0"- resumer "~0.0.0"- string.prototype.trim "~1.1.2"- through "~2.3.8"-tape@^4.9.2:version "4.13.0"resolved "https://registry.yarnpkg.com/tape/-/tape-4.13.0.tgz#e2f581ff5f12a7cbd787e9f83c76c2851782fce2"@@ -15085,6 +15346,15 @@ terser@^4.1.2:source-map "~0.6.1"source-map-support "~0.5.12"+terser@^4.6.3:+ version "4.8.0"+ resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"+ integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==+ dependencies:+ commander "^2.20.0"+ source-map "~0.6.1"+ source-map-support "~0.5.12"+test-exclude@^4.2.0:version "4.2.3"resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.3.tgz#a9a5e64474e4398339245a0a769ad7c2f4a97c20"@@ -15180,7 +15450,7 @@ through2@^3.0.0:dependencies:readable-stream "2 || 3"-through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@~2.3.4, through@~2.3.8:+through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8, through@~2.3.4, through@~2.3.8:version "2.3.8"resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=@@ -15428,6 +15698,11 @@ tryer@^1.0.1:resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8"integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==+tslib@^1.10.0:+ version "1.13.0"+ resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"+ integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==+tslib@^1.9.0:version "1.10.0"resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"@@ -15653,6 +15928,11 @@ union-value@^1.0.0:is-extendable "^0.1.1"set-value "^2.0.1"+uniq@^1.0.0:+ version "1.0.1"+ resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"+ integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=+unique-filename@^1.1.1:version "1.1.1"resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230"