diff --git a/package.json b/package.json index 37f14ac65e..fa143b8bd9 100644 --- a/package.json +++ b/package.json @@ -40,16 +40,17 @@ ] }, "devDependencies": { - "@babel/core": "7.8.7", - "@babel/plugin-proposal-class-properties": "7.8.3", + "@babel/core": "7.23.9", + "@babel/plugin-proposal-class-properties": "7.18.6", "@babel/plugin-syntax-dynamic-import": "7.8.3", - "@babel/preset-env": "7.8.7", - "@babel/preset-react": "7.8.3", - "@babel/runtime": "7.11.2", + "@babel/plugin-transform-regenerator": "7.23.3", + "@babel/preset-env": "7.23.9", + "@babel/preset-react": "7.23.3", + "@babel/runtime": "7.23.9", "@geosolutions/acorn-jsx": "4.0.2", "@geosolutions/jsdoc": "3.4.4", "@geosolutions/mocha": "6.2.1-3", - "@mapstore/eslint-config-mapstore": "1.0.5", + "@mapstore/eslint-config-mapstore": "1.0.6", "@testing-library/react": "12.1.5", "axios-mock-adapter": "1.16.0", "babel-loader": "8.0.5", @@ -66,10 +67,10 @@ "download-cli": "1.0.1", "dynamic-public-path-webpack-plugin": "1.0.4", "escope": "3.2.0", - "eslint": "7.8.1", - "eslint-plugin-import": "2.20.2", - "eslint-plugin-no-only-tests": "2.3.1", - "eslint-plugin-react": "3.3.2", + "eslint": "7.32.0", + "eslint-plugin-import": "2.29.1", + "eslint-plugin-no-only-tests": "2.6.0", + "eslint-plugin-react": "3.16.1", "expect": "1.20.1", "file-loader": "2.0.0", "glob": "7.1.1", diff --git a/utility/eslint/index.js b/utility/eslint/index.js index 8400a7232b..f32048c206 100644 --- a/utility/eslint/index.js +++ b/utility/eslint/index.js @@ -189,7 +189,7 @@ module.exports = { "react/jsx-no-duplicate-props": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md "react/display-name": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md "react/jsx-boolean-value": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md - "react/jsx-quotes": [2, "double"], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quotes.md + "jsx-quotes": [2, "prefer-double"], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quotes.md "react/jsx-no-undef": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md "react/jsx-sort-props": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md "react/jsx-sort-prop-types": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md @@ -199,54 +199,20 @@ module.exports = { "react/no-did-update-set-state": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md "react/no-multi-comp": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md "react/no-unknown-property": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md - "react/prop-types": [2, { "ignore": ["children"] }], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md + "react/prop-types": [0, { "ignore": ["children"] }], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md "react/react-in-jsx-scope": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md "react/self-closing-comp": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md "react/wrap-multilines": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md - "react/sort-comp": [2, { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md - "order": [ - "displayName", - "propTypes", - "inheritedPropTypes", - "contextTypes", - "childContextTypes", - "mixins", - "statics", - "defaultProps", - "constructor", - "getDefaultProps", - "/^state$/", - "getInitialState", - "getChildContext", - "UNSAFE_componentWillMount", - "componentWillMount", - "componentDidMount", - "UNSAFE_componentWillReceiveProps", - "componentWillReceiveProps", - "shouldComponentUpdate", - "UNSAFE_componentWillUpdate", - "componentWillUpdate", - "componentDidUpdate", - "componentWillUnmount", - "/^on.+$/", - "/^get.+$/", - "/^render.+$/", - "render" - ], - // CUSTOM - // prevent to `import _ from 'lodash';`. Allows `import {get} from 'lodash';` or `import get from 'lodash/get';` - // for bundle size - "no-restricted-imports": [2, - { - "name": "lodash", - "importNames": ["default"], - "message": "Please use the default import from 'lodash/functionName' instead." - } - ], - // prevent to `const _ = require('lodash')`. Allows `const get = require('lodash/get');` - // for bundle size - "no-restricted-modules": [2, { "paths": ["lodash", "!lodash/*"] }] - }] + "no-restricted-imports": [2, + { + "name": "lodash", + "importNames": ["default"], + "message": "Please use the default import from 'lodash/functionName' instead." + } + ], + // prevent to `const _ = require('lodash')`. Allows `const get = require('lodash/get');` + // for bundle size + "no-restricted-modules": [2, { "paths": ["lodash", "!lodash/*"] }] } }; diff --git a/utility/eslint/package.json b/utility/eslint/package.json index b76c5def6e..fdcc4c6cb5 100644 --- a/utility/eslint/package.json +++ b/utility/eslint/package.json @@ -1,6 +1,6 @@ { "name": "@mapstore/eslint-config-mapstore", - "version": "1.0.5", + "version": "1.0.6", "private": false, "description": "ESLint Configuration for MapStore project", "author": "GeoSolutions S.a.s.", diff --git a/web/client/api/WFS.js b/web/client/api/WFS.js index 2410b1b263..cc749b3b09 100644 --- a/web/client/api/WFS.js +++ b/web/client/api/WFS.js @@ -100,6 +100,7 @@ export const getFeatureLayer = (layer, {version = "1.1.0", filters, proj, outpu .concat(featureGridFilter ? featureGridFilter : []); const reqBody = wfsGetFeature(query( typeName, + // TODO: insert propertyName before filter to limit attributes to return allFilters.length > 0 ? filter( and( diff --git a/web/client/components/TOC/fragments/settings/FeatureInfo.jsx b/web/client/components/TOC/fragments/settings/FeatureInfo.jsx index 5176a0fabe..243dc8dfc0 100644 --- a/web/client/components/TOC/fragments/settings/FeatureInfo.jsx +++ b/web/client/components/TOC/fragments/settings/FeatureInfo.jsx @@ -57,14 +57,14 @@ export default class extends React.Component { const getSupportedFormat = supportedFormatRequests[this.props.element.type]; // we dont know supported infoFormats yet if (getSupportedFormat && this.props.element.url && !this.props.element.infoFormats || this.props.element.infoFormats?.length === 0) { - this.setState({ loading: true }); + this.setState({ loading: true }); // eslint-disable-line -- TODO: need to be fixed getSupportedFormat(this.props.element.url, true) .then(({ infoFormats }) => { this.props.onChange("infoFormats", infoFormats); - this.setState({ loading: false }); + this.setState({ loading: false }); // eslint-disable-line -- TODO: need to be fixed }) .catch(() => { - this.setState({ loading: false }); + this.setState({ loading: false }); // eslint-disable-line -- TODO: need to be fixed }); } } diff --git a/web/client/components/catalog/RecordItem.jsx b/web/client/components/catalog/RecordItem.jsx index 0d2d7eab03..c69a516226 100644 --- a/web/client/components/catalog/RecordItem.jsx +++ b/web/client/components/catalog/RecordItem.jsx @@ -100,7 +100,7 @@ class RecordItem extends React.Component { componentDidMount() { const notAvailable = getMessageById(this.context.messages, "catalog.notAvailable"); const record = this.props.record; - this.setState({visibleExpand: !this.props.hideExpand && + this.setState({visibleExpand: !this.props.hideExpand && // eslint-disable-line -- TODO: need to be fixed ( this.displayExpand() || // show expand if the template is not empty diff --git a/web/client/components/geostory/contents/texteditor/CustomEditorLink.jsx b/web/client/components/geostory/contents/texteditor/CustomEditorLink.jsx index 184f729a7b..503bc3354d 100644 --- a/web/client/components/geostory/contents/texteditor/CustomEditorLink.jsx +++ b/web/client/components/geostory/contents/texteditor/CustomEditorLink.jsx @@ -103,7 +103,7 @@ class LayoutComponent extends Component { componentDidUpdate(prevProps) { if (prevProps.expanded && !this.props.expanded) { - this.setState({ + this.setState({ // eslint-disable-line -- TODO: need to be fixed showModal: false, linkTarget: '', linkTitle: '', diff --git a/web/client/components/import/style/StylePanel.jsx b/web/client/components/import/style/StylePanel.jsx index 81d68f137e..a0b6d69d54 100644 --- a/web/client/components/import/style/StylePanel.jsx +++ b/web/client/components/import/style/StylePanel.jsx @@ -68,11 +68,9 @@ class StylePanel extends React.Component { overrideAnnotation: false, initialLayers: [] }; - componentDidMount() { - this.setState({initialLayers: [...this.props.layers]}); + this.setState({initialLayers: [...this.props.layers]}); // eslint-disable-line -- TODO: need to be fixed } - getGeometryType = (geometry) => { if (geometry && geometry.type === 'GeometryCollection') { return geometry.geometries.reduce((previous, g) => { diff --git a/web/client/components/map/cesium/Map.jsx b/web/client/components/map/cesium/Map.jsx index db38b2b1d8..2e56628c90 100644 --- a/web/client/components/map/cesium/Map.jsx +++ b/web/client/components/map/cesium/Map.jsx @@ -128,7 +128,7 @@ class CesiumMap extends React.Component { if (this.props.errorPanel) { // override the default error message overlay map.cesiumWidget.showErrorPanel = (title, message, error) => { - this.setState({ renderError: { title, message, error } }); + this.setState({ renderError: { title, message, error } }); // eslint-disable-line -- TODO: need to be fixed }; } diff --git a/web/client/components/misc/datetimepicker/DateTimePicker.js b/web/client/components/misc/datetimepicker/DateTimePicker.js index 3ed50e0f43..3cf35d9acf 100644 --- a/web/client/components/misc/datetimepicker/DateTimePicker.js +++ b/web/client/components/misc/datetimepicker/DateTimePicker.js @@ -108,7 +108,7 @@ class DateTimePicker extends Component { if (prevProps.value !== this.props.value || prevProps.operator !== this.props.operator) { const { value, operator } = this.props; this.setDateFromValueProp(value, operator); - if (this.props.operator === 'isNull') this.setState({ inputValue: '', date: null }); + if (this.props.operator === 'isNull') this.setState({ inputValue: '', date: null }); // eslint-disable-line -- TODO: need to be fixed } } diff --git a/web/client/components/misc/datetimepicker/Hours.js b/web/client/components/misc/datetimepicker/Hours.js index 0844b0d455..740aac8ffd 100644 --- a/web/client/components/misc/datetimepicker/Hours.js +++ b/web/client/components/misc/datetimepicker/Hours.js @@ -41,7 +41,7 @@ class Hours extends Component { state = { focusedItemIndex: -1, times: [] }; componentDidMount() { - this.setState({ times: getDates() }); + this.setState({ times: getDates() }); // eslint-disable-line -- TODO: need to be fixed } render() { diff --git a/web/client/components/resources/modals/Save.jsx b/web/client/components/resources/modals/Save.jsx index 4949f75148..f1ea99e9d2 100644 --- a/web/client/components/resources/modals/Save.jsx +++ b/web/client/components/resources/modals/Save.jsx @@ -135,7 +135,7 @@ class SaveModal extends React.Component { !isEqual(this.props.errors, prevProps.errors) && this.state?.loading ) { - this.setState({ loading: false }); + this.setState({ loading: false }); // eslint-disable-line -- TODO: need to be fixed } } diff --git a/web/client/components/share/ShareEmbed.jsx b/web/client/components/share/ShareEmbed.jsx index cbd7162d0a..cb37bf4348 100644 --- a/web/client/components/share/ShareEmbed.jsx +++ b/web/client/components/share/ShareEmbed.jsx @@ -53,7 +53,7 @@ class ShareEmbed extends React.Component { componentDidMount() { if (this.props.sizeOptions && !isEqual(this.state.sizeOptions)) { - this.setState({sizeOptions: this.props.sizeOptions, selectedOption: this.props.selectedOption || 'Small'}); + this.setState({sizeOptions: this.props.sizeOptions, selectedOption: this.props.selectedOption || 'Small'}); // eslint-disable-line -- TODO: need to be fixed } } diff --git a/web/client/components/styleeditor/WMSJsonLegendIcon.jsx b/web/client/components/styleeditor/WMSJsonLegendIcon.jsx index e3fd875fcf..4b6aa9af69 100644 --- a/web/client/components/styleeditor/WMSJsonLegendIcon.jsx +++ b/web/client/components/styleeditor/WMSJsonLegendIcon.jsx @@ -124,7 +124,7 @@ const icon = { Text: ({ symbolizer }) => { return ( - this.state.value || 0; this.refsInput.setValue = (value) => { - this.setState({ + this.setState({ // eslint-disable-line -- TODO: need to be fixed value: this._parse(value), stringValue: value }); diff --git a/web/client/plugins/SidebarMenu.jsx b/web/client/plugins/SidebarMenu.jsx index 32bb6dcdf6..d1b82a4aa9 100644 --- a/web/client/plugins/SidebarMenu.jsx +++ b/web/client/plugins/SidebarMenu.jsx @@ -103,10 +103,10 @@ class SidebarMenu extends React.Component { if (visibleElements === 0 && !hidden) { onDetach(); - this.setState((state) => ({ ...state, hidden: true})); + this.setState((state) => ({ ...state, hidden: true})); // eslint-disable-line -- need to be fixed } else if (visibleElements > 0 && hidden) { onInit(); - this.setState((state) => ({ ...state, hidden: false})); + this.setState((state) => ({ ...state, hidden: false})); // eslint-disable-line -- need to be fixed } } diff --git a/web/client/plugins/TOC/components/WMSLegend.jsx b/web/client/plugins/TOC/components/WMSLegend.jsx index 6435f3fad7..c3218f3f99 100644 --- a/web/client/plugins/TOC/components/WMSLegend.jsx +++ b/web/client/plugins/TOC/components/WMSLegend.jsx @@ -61,7 +61,7 @@ class WMSLegend extends React.Component { componentDidMount() { const containerWidth = this.containerRef.current && this.containerRef.current.clientWidth; - this.setState({ containerWidth, ...this.state }); + this.setState({ containerWidth, ...this.state }); // eslint-disable-line -- TODO: need to be fixed } render() { diff --git a/web/client/utils/ogc/Filter/FilterBuilder.js b/web/client/utils/ogc/Filter/FilterBuilder.js index 1646c0cbb9..9dbf77c45d 100644 --- a/web/client/utils/ogc/Filter/FilterBuilder.js +++ b/web/client/utils/ogc/Filter/FilterBuilder.js @@ -5,10 +5,10 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -const {logical, spatial, comparison, literal, propertyName, valueReference, distance, lower, upper, func} = require('./operators'); -const {filter, fidFilter} = require('./filter'); -const {processOGCGeometry} = require("../GML"); -const {castArray} = require('lodash'); +import {logical, spatial, comparison, literal, propertyName, valueReference, distance, lower, upper, func} from './operators'; +import {filter, fidFilter} from './filter'; +import {processOGCGeometry} from "../GML"; +import {castArray} from 'lodash'; // const isValidXML = (value, {filterNS, gmlNS}) => value.indexOf(`<${filterNS}:` === 0) || value.indexOf(`<${gmlNS}:`) === 0; /** * Returns OGC Filter Builder. The FilterBuilder returns the method to compose the filter. @@ -17,7 +17,7 @@ const {castArray} = require('lodash'); * The property object have the methods listed as properies below. * The builder provides all the methods to compose the filter (filter, and, or, not, property) to compose the filter. * ``` - * const filterBuilder = require('.../FilterBuilder'); + * import filterBuilder from '.../FilterBuilder'; * const {filter, property, and, or, not} = filterBuilder({gmlVersion: "3.1.1"}); * filter( * and( @@ -105,7 +105,7 @@ const {castArray} = require('lodash'); * @prop {function} property.dwithin `property("P1").dwithin(geoJSONGeometry, 10, "m")` 2nd and 3rd params are optional * @prop {function} property.contains `property("P1").contains(geoJSONGeometry)` */ -module.exports = function({filterNS = "ogc", gmlVersion, wfsVersion = "1.1.0"} = {}) { +export default function({filterNS = "ogc", gmlVersion, wfsVersion = "1.1.0"} = {}) { let gmlV = gmlVersion || "3.1.1"; const getGeom = (geom) => processOGCGeometry(gmlV, geom); @@ -164,4 +164,4 @@ module.exports = function({filterNS = "ogc", gmlVersion, wfsVersion = "1.1.0"} = } }; -}; +} diff --git a/web/client/utils/ogc/Filter/__tests__/FilterBuilder-test.js b/web/client/utils/ogc/Filter/__tests__/FilterBuilder-test.js index 81a550c742..fd1d189495 100644 --- a/web/client/utils/ogc/Filter/__tests__/FilterBuilder-test.js +++ b/web/client/utils/ogc/Filter/__tests__/FilterBuilder-test.js @@ -6,9 +6,9 @@ * LICENSE file in the root directory of this source tree. */ // Disable ESLint because some of the names to include are not in camel case -const expect = require('expect'); -const FilterBuilder = require('../FilterBuilder'); -const {processOGCGeometry} = require("../../GML"); +import expect from 'expect'; +import FilterBuilder from '../FilterBuilder'; +import {processOGCGeometry} from "../../GML"; describe('FilterBuilder', () => { it('comparison', () => { const b = new FilterBuilder(); diff --git a/web/client/utils/ogc/WFS/RequestBuilder.js b/web/client/utils/ogc/WFS/RequestBuilder.js index 1857ca88f1..1a4c4a3bed 100644 --- a/web/client/utils/ogc/WFS/RequestBuilder.js +++ b/web/client/utils/ogc/WFS/RequestBuilder.js @@ -5,9 +5,9 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -const filterBuilder = require('../Filter/FilterBuilder'); -const castArray = require('lodash/castArray'); -const {wfsToGmlVersion} = require("./base"); +import filterBuilder from '../Filter/FilterBuilder'; +import castArray from 'lodash/castArray'; +import {wfsToGmlVersion} from "./base"; const getStaticAttributesWFS1 = (ver) => 'service="WFS" version="' + ver + '" ' + (ver === "1.0.0" ? 'outputFormat="GML2" ' : "") + 'xmlns:gml="http://www.opengis.net/gml" ' + @@ -42,7 +42,7 @@ const getStaticAttributesWFS2 = (ver) => 'service="WFS" version="' + ver + '" ' * @return {Object} A request builder. it contains all the `FilterBuilder` methods, plus the getFeature, query... methods * The request builder provides all the methods to compose the request (query, filter...). * @example - * const requestBuilder = require('.../RequestBuilder'); + * import requestBuilder from '.../RequestBuilder'; * const {getFeature, query, filter, property} = requestBuilder({wfsVersion: "1.0.0"}); * const reqBody = getFeature(query( * "workspace:layer", @@ -65,7 +65,7 @@ const getStaticAttributesWFS2 = (ver) => 'service="WFS" version="' + ver + '" ' * query("layerName", filter..., {options}) * ``` */ -module.exports = function({wfsVersion = "1.1.0", gmlVersion, filterNS, wfsNS = "wfs"} = {}) { +export default function({wfsVersion = "1.1.0", gmlVersion, filterNS, wfsNS = "wfs"} = {}) { let gmlV = gmlVersion; if (!gmlV && wfsVersion) { gmlV = wfsToGmlVersion(wfsVersion); @@ -110,4 +110,4 @@ module.exports = function({wfsVersion = "1.1.0", gmlVersion, filterNS, wfsNS = " + `` }; -}; +} diff --git a/web/client/utils/ogc/WFS/__tests__/RequestBuilder-test.js b/web/client/utils/ogc/WFS/__tests__/RequestBuilder-test.js index 09a0225b47..7c1b9ab496 100644 --- a/web/client/utils/ogc/WFS/__tests__/RequestBuilder-test.js +++ b/web/client/utils/ogc/WFS/__tests__/RequestBuilder-test.js @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. */ -const expect = require('expect'); -const requestBuilder = require('../RequestBuilder'); +import expect from 'expect'; +import requestBuilder from '../RequestBuilder'; const TEST_REQUEST_V2 = 'highway_systemstate'; diff --git a/web/client/utils/ogc/WFST/RequestBuilder.js b/web/client/utils/ogc/WFST/RequestBuilder.js index 856017200b..09e6c3eb8f 100644 --- a/web/client/utils/ogc/WFST/RequestBuilder.js +++ b/web/client/utils/ogc/WFST/RequestBuilder.js @@ -6,13 +6,13 @@ * LICENSE file in the root directory of this source tree. */ -const get = require('lodash/get'); -const {insert, feature, attribute} = require('./insert'); -const {transaction} = require('./transaction'); -const {deleteFeaturesByFilter, deleteFeature} = require('./delete'); -const {update, propertyChange} = require('./update'); -const {getPropertyDescriptor, getValue, findGeometryProperty, featureTypeSchema} = require("../WFS/base"); -const wfsRequestBuilder = require('../WFS/RequestBuilder'); +import get from 'lodash/get'; +import {insert, feature, attribute} from './insert'; +import {transaction} from './transaction'; +import {deleteFeaturesByFilter, deleteFeature} from './delete'; +import {update, propertyChange} from './update'; +import {getPropertyDescriptor, getValue, findGeometryProperty, featureTypeSchema} from "../WFS/base"; +import wfsRequestBuilder from '../WFS/RequestBuilder'; const mergeArray = (e, arr2) => arr2 && arr2.length > 0 ? [e, ...arr2] : e; const WFSVersionNotSupportedException = function(wfsVersion) { @@ -56,7 +56,7 @@ const getPropertyName = (name, describe) => name === "geometry" || name === getG * propertyChange("p", 2) // p2 * ``` */ -module.exports = function(describe, {wfsVersion = "1.1.0", wfsNS = "wfs", ...other} = {}) { +export default function(describe, {wfsVersion = "1.1.0", wfsNS = "wfs", ...other} = {}) { if (wfsVersion !== "1.1.0") { throw new WFSVersionNotSupportedException(wfsVersion); } @@ -83,4 +83,4 @@ module.exports = function(describe, {wfsVersion = "1.1.0", wfsNS = "wfs", ...oth propertyChange: (name, value) => propertyChange(wfsNS, name, getValue(value, name, describe)), transaction: (content, ...rest) => transaction(mergeArray(content, rest), featureTypeSchema(describe), wfsVersion, wfsNS) }; -}; +} diff --git a/web/client/utils/ogc/WFST/__tests__/WFST-test.js b/web/client/utils/ogc/WFST/__tests__/WFST-test.js index 4da6a5f3ff..cb70faad18 100644 --- a/web/client/utils/ogc/WFST/__tests__/WFST-test.js +++ b/web/client/utils/ogc/WFST/__tests__/WFST-test.js @@ -6,18 +6,18 @@ * LICENSE file in the root directory of this source tree. */ -const expect = require('expect'); -const requestBuilder = require('../RequestBuilder'); -const {fidFilter} = require('../../Filter/filter'); -const describeStates = require('../../../../test-resources/wfs/describe-states.json'); -const describePois = require('../../../../test-resources/wfs/describe-pois.json'); -const wyoming = require('../../../../test-resources/wfs/Wyoming.json'); -const museam = require('../../../../test-resources/wfs/museam.json'); -const expectedInsertWyoming = require('raw-loader!../../../../test-resources/wfst/insert/Wyoming_1_1_0.xml'); -const expectedInsertmuseam = require('raw-loader!../../../../test-resources/wfst/insert/museam_1_1_0.xml'); -const expectedDelete = require('raw-loader!../../../../test-resources/wfst/delete/museam_1_1_0.xml'); -const expectedUpdate = require('raw-loader!../../../../test-resources/wfst/update/museam_1_1_0.xml'); -const doubleMuseamInsert = require('raw-loader!../../../../test-resources/wfst/insert/double_museam_1_1_0.xml'); +import expect from 'expect'; +import requestBuilder from '../RequestBuilder'; +import {fidFilter} from '../../Filter/filter'; +import describeStates from '../../../../test-resources/wfs/describe-states.json'; +import describePois from '../../../../test-resources/wfs/describe-pois.json'; +import wyoming from '../../../../test-resources/wfs/Wyoming.json'; +import museam from '../../../../test-resources/wfs/museam.json'; +import expectedInsertWyoming from 'raw-loader!../../../../test-resources/wfst/insert/Wyoming_1_1_0.xml'; +import expectedInsertmuseam from 'raw-loader!../../../../test-resources/wfst/insert/museam_1_1_0.xml'; +import expectedDelete from 'raw-loader!../../../../test-resources/wfst/delete/museam_1_1_0.xml'; +import expectedUpdate from 'raw-loader!../../../../test-resources/wfst/update/museam_1_1_0.xml'; +import doubleMuseamInsert from 'raw-loader!../../../../test-resources/wfst/insert/double_museam_1_1_0.xml'; describe('Test WFS-T request bodies generation', () => { it('WFS-T insert', () => { const {insert} = requestBuilder(describeStates); diff --git a/web/client/utils/ogc/WPS/autocomplete.js b/web/client/utils/ogc/WPS/autocomplete.js index 149a736fa6..6872b222b6 100644 --- a/web/client/utils/ogc/WPS/autocomplete.js +++ b/web/client/utils/ogc/WPS/autocomplete.js @@ -1,10 +1,8 @@ -// const wfsRequestBuilder = require('../WFS/RequestBuilder'); -// const {getFeature, property, query} = wfsRequestBuilder({wfsVersion: "1.1.0"}); -const {isFilterValid, toOGCFilterParts} = require('../../FilterUtils'); -const filterBuilder = require('../Filter/FilterBuilder'); +import {isFilterValid, toOGCFilterParts} from '../../FilterUtils'; +import filterBuilder from '../Filter/FilterBuilder'; const {and} = filterBuilder({}); -const getWpsPayload = ({layerName, layerFilter, attribute, maxFeatures, startIndex, value}) => { +export const getWpsPayload = ({layerName, layerFilter, attribute, maxFeatures, startIndex, value}) => { const attributeFilterObj = value ? '' + ' ' + attribute + '' @@ -76,6 +74,6 @@ const getWpsPayload = ({layerName, layerFilter, attribute, maxFeatures, startInd return requestBody; }; -module.exports = { +export default { getWpsPayload };