diff --git a/.prettierrc b/.prettierrc index 73f3c7c3..9b6f917f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,5 +4,6 @@ "trailingComma": "all", "tabWidth": 2, "useTabs": false, - "endOfLine": "lf" + "endOfLine": "lf", + "printWidth": 100 } \ No newline at end of file diff --git a/ci/clean-coverage.js b/ci/clean-coverage.js index a0d2c612..3be82acc 100644 --- a/ci/clean-coverage.js +++ b/ci/clean-coverage.js @@ -2,4 +2,4 @@ const shell = require('shelljs'); shell.rm('-rf', './**/.coverage'); shell.rm('-rf', '.coverage'); -shell.rm('.branch-coverage-changes.md'); \ No newline at end of file +shell.rm('.branch-coverage-changes.md'); diff --git a/ci/format-branch-coverage-changes.js b/ci/format-branch-coverage-changes.js index d085d65d..dfa9ee7a 100644 --- a/ci/format-branch-coverage-changes.js +++ b/ci/format-branch-coverage-changes.js @@ -25,31 +25,16 @@ const rows = Object.entries(coverageChangesSummary) const masterCoverage = coverageSummary[packageFilePath]; return [ packageFilePath, - formatCovComparison( - changesCoverage.statements.pct, - masterCoverage?.statements?.pct || 0, - ), - formatCovComparison( - changesCoverage.branches.pct, - masterCoverage?.branches?.pct || 0, - ), - formatCovComparison( - changesCoverage.functions.pct, - masterCoverage?.functions?.pct || 0, - ), - formatCovComparison( - changesCoverage.lines.pct, - masterCoverage?.lines?.pct || 0, - ), + formatCovComparison(changesCoverage.statements.pct, masterCoverage?.statements?.pct || 0), + formatCovComparison(changesCoverage.branches.pct, masterCoverage?.branches?.pct || 0), + formatCovComparison(changesCoverage.functions.pct, masterCoverage?.functions?.pct || 0), + formatCovComparison(changesCoverage.lines.pct, masterCoverage?.lines?.pct || 0), ]; }); const headers = ['File Path', 'Statements', 'Branches', 'Functions', 'Lines']; -const table = json2md([ - { h2: 'Coverage Report (change vs master)' }, - { table: { headers, rows } }, -]); +const table = json2md([{ h2: 'Coverage Report (change vs master)' }, { table: { headers, rows } }]); const alignedTable = table.replace( '| --------- | ---------- | -------- | --------- | ----- |', diff --git a/ci/format-coverage-summary.js b/ci/format-coverage-summary.js index 1ddc216d..8961ccef 100644 --- a/ci/format-coverage-summary.js +++ b/ci/format-coverage-summary.js @@ -1,12 +1,12 @@ const { writeFileSync } = require('fs'); const _ = require('lodash'); const coverageSummary = require('../.coverage_json/coverage-summary.json'); -const formattedSummary = _.mapKeys(coverageSummary, ( value, key) => { - if(key === 'total') { +const formattedSummary = _.mapKeys(coverageSummary, (value, key) => { + if (key === 'total') { return key; } const packagePath = key.split('packages')[1]; return `packages${packagePath}`; }); -writeFileSync('.coverage_json/coverage-summary.json', JSON.stringify(formattedSummary), 'utf8'); \ No newline at end of file +writeFileSync('.coverage_json/coverage-summary.json', JSON.stringify(formattedSummary), 'utf8'); diff --git a/ci/merge-coverage-changes.js b/ci/merge-coverage-changes.js index 23478dd5..50492ca6 100644 --- a/ci/merge-coverage-changes.js +++ b/ci/merge-coverage-changes.js @@ -12,7 +12,7 @@ workspaces.forEach((workspace) => { const package = workspace.split(path.sep).pop(); const coverageDir = path.join('.coverage', context); - const packageCoverageDirectory = path.join(process.cwd(),'.coverage', context); + const packageCoverageDirectory = path.join(process.cwd(), '.coverage', context); console.log(`Package "${package}":`); @@ -30,9 +30,9 @@ workspaces.forEach((workspace) => { function getCmd(package, coverageDir) { const destination = path.join('..', '..', coverageDir); - if(package === 'output-geoservices') { + if (package === 'output-geoservices') { return `cp ${coverageDir}/coverage-final.json ${destination}/output-geoservices.json > /dev/null`; } return `npx nyc merge ${coverageDir}/analysis ${destination}/${package}.json > /dev/null`; -} \ No newline at end of file +} diff --git a/ci/run-coverage-on-branch-changes.js b/ci/run-coverage-on-branch-changes.js index e320f4bf..fb06ead3 100644 --- a/ci/run-coverage-on-branch-changes.js +++ b/ci/run-coverage-on-branch-changes.js @@ -5,25 +5,29 @@ const _ = require('lodash'); const { workspaces } = require('../package.json'); -async function execute () { +async function execute() { for (let i = 0; i < workspaces.length; i++) { const workspace = workspaces[i]; process.chdir(workspace); const package = workspace.split(path.sep).pop(); - const {files} = await git().diffSummary(['--name-only', '--relative', 'origin/master']); + const { files } = await git().diffSummary(['--name-only', '--relative', 'origin/master']); - const srcFiles = files.filter(({ file }) => { - return file.endsWith('.js') && !file.endsWith('spec.js'); - }).map(({ file }) => { - return `-n ${file}`; - }); + const srcFiles = files + .filter(({ file }) => { + return file.endsWith('.js') && !file.endsWith('spec.js'); + }) + .map(({ file }) => { + return `-n ${file}`; + }); - const testTargetFiles = files.filter(({ file }) => { - return file.startsWith('src') && file.endsWith('spec.js'); - }).map(({ file }) => { - return `-n ${file.replace('.spec', '')}`; - }); + const testTargetFiles = files + .filter(({ file }) => { + return file.startsWith('src') && file.endsWith('spec.js'); + }) + .map(({ file }) => { + return `-n ${file.replace('.spec', '')}`; + }); const filesForCoverageCheck = _.uniq([...srcFiles, ...testTargetFiles]); @@ -40,13 +44,14 @@ async function execute () { } } -execute().then(() => { - process.exit(); -}).catch(error => { - console.error(error); - process.exit(1); -}); - +execute() + .then(() => { + process.exit(); + }) + .catch((error) => { + console.error(error); + process.exit(1); + }); function getCovCmd(package, srcFiles) { if (package === 'output-geoservices') { @@ -62,4 +67,4 @@ function getTestCmd(package) { } return 'npm run test > /dev/null'; -} \ No newline at end of file +} diff --git a/ci/run-report-on-branch-changes.js b/ci/run-report-on-branch-changes.js index 0c7c4bb1..35d295ca 100644 --- a/ci/run-report-on-branch-changes.js +++ b/ci/run-report-on-branch-changes.js @@ -6,4 +6,6 @@ if (!fs.existsSync('.coverage/changes')) { return; } -shell.exec('nyc report --temp-dir=.coverage/changes --reporter=json-summary --report-dir=.coverage_changes_json'); +shell.exec( + 'nyc report --temp-dir=.coverage/changes --reporter=json-summary --report-dir=.coverage_changes_json', +); diff --git a/ci/run-test-coverage-analysis.js b/ci/run-test-coverage-analysis.js index e72923e5..53251558 100644 --- a/ci/run-test-coverage-analysis.js +++ b/ci/run-test-coverage-analysis.js @@ -1,4 +1,3 @@ - const { workspaces } = require('../package.json'); const shell = require('shelljs'); const path = require('path'); @@ -12,7 +11,7 @@ workspaces.forEach((workspace) => { const package = workspace.split(path.sep).pop(); console.log(`Package "${package}":`); process.stdout.write(` - running ${context} test coverage...`); - shell.exec(getCovCmd(package, context)); + shell.exec(getCovCmd(package, context)); process.stdout.write('completed.\n'); process.stdout.write(` - generating ${context} test coverage badge...`); shell.exec(getBadgeCmd(package, context)); @@ -42,4 +41,4 @@ function getTestCmd(package, context) { } return 'npm run test > /dev/null'; -} \ No newline at end of file +} diff --git a/eslint.config.js b/eslint.config.js index 30fce098..e55d9d0d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -4,32 +4,32 @@ const prettier = require('eslint-plugin-prettier'); module.exports = { languageOptions: { globals: { - commonjs: true, - es6: true, - mocha: true, - jest: true, - jasmine: true, - node: true, - Atomics: 'readonly', - SharedArrayBuffer: 'readonly', - process: 'readonly', - console: 'readonly', - __dirname: 'readonly', + commonjs: true, + es6: true, + mocha: true, + jest: true, + jasmine: true, + node: true, + Atomics: 'readonly', + SharedArrayBuffer: 'readonly', + process: 'readonly', + console: 'readonly', + __dirname: 'readonly', + }, + parserOptions: { + ecmaVersion: 2022, + }, }, - parserOptions: { - ecmaVersion: 2022, - }, -}, - + rules: { 'no-unused-vars': ['error', { ignoreRestSiblings: true }], - 'semi': ['error', 'always'], - 'prettier/prettier': ['error', {endOfLine: 'auto'}], + semi: ['error', 'always'], + 'prettier/prettier': ['error', { endOfLine: 'auto', printWidth: 100 }], 'no-only-tests/no-only-tests': 'error', - //'linebreak-style': ['error', 'unix'], + 'max-len': ['error', { code: 100 }], }, plugins: { 'no-only-tests': noOnlyTests, - 'prettier': prettier + prettier: prettier, }, }; diff --git a/packages/core/src/data-provider/extend-controller.js b/packages/core/src/data-provider/extend-controller.js index 31f62c14..a35f12e8 100644 --- a/packages/core/src/data-provider/extend-controller.js +++ b/packages/core/src/data-provider/extend-controller.js @@ -1,13 +1,10 @@ class DefaultController {} /** - * We extend all controllers to ensure the following properties exist: this.model, this.routes, this.namespace + * We extend all controllers to ensure the following properties exist: + * this.model, this.routes, this.namespace */ -module.exports = function extendController( - model, - BaseController = DefaultController, - options, -) { +module.exports = function extendController(model, BaseController = DefaultController, options) { class Controller extends BaseController { constructor(model, options) { super(model, options); @@ -15,13 +12,10 @@ module.exports = function extendController( } } const controller = new Controller(model, options); - const controllerEnumerables = Object.keys(BaseController).reduce( - (acc, member) => { - acc[member] = BaseController[member]; - return acc; - }, - {}, - ); + const controllerEnumerables = Object.keys(BaseController).reduce((acc, member) => { + acc[member] = BaseController[member]; + return acc; + }, {}); Object.assign(controller, controllerEnumerables); controller.routes = controller.routes || []; diff --git a/packages/core/src/data-provider/extend-controller.spec.js b/packages/core/src/data-provider/extend-controller.spec.js index fe90fddc..c6be5508 100644 --- a/packages/core/src/data-provider/extend-controller.spec.js +++ b/packages/core/src/data-provider/extend-controller.spec.js @@ -42,9 +42,6 @@ describe('Tests for create-controller', function () { it('should use a default namespace when unnamed constructor functions are used', () => { const mockModel = 'model-test'; const extendedController = extendController(mockModel, function () {}); - extendedController.should.have.property( - 'namespace', - 'UndefinedControllerNamespace', - ); + extendedController.should.have.property('namespace', 'UndefinedControllerNamespace'); }); }); diff --git a/packages/core/src/data-provider/extend-model.js b/packages/core/src/data-provider/extend-model.js index b4bc4795..4b1c523f 100644 --- a/packages/core/src/data-provider/extend-model.js +++ b/packages/core/src/data-provider/extend-model.js @@ -31,10 +31,7 @@ module.exports = function extendModel( this.#cacheTtl = options.cacheTtl; this.namespace = namespace; this.logger = logger; - this.#before = this.#normalizeAndBindMethod( - options.before || beforeNoop, - 2, - ); + this.#before = this.#normalizeAndBindMethod(options.before || beforeNoop, 2); this.#after = this.#normalizeAndBindMethod(options.after || afterNoop, 3); this.#cacheRetrieve = this.#normalizeAndBindMethod( modelCache?.retrieve || cacheRetrieveNoop, @@ -47,9 +44,7 @@ module.exports = function extendModel( modelCache, ); this.#getProviderData = this.#normalizeAndBindMethod(this.getData, 2); - this.#getLayer = this.getLayer - ? this.#normalizeAndBindMethod(this.getLayer, 2) - : undefined; + this.#getLayer = this.getLayer ? this.#normalizeAndBindMethod(this.getLayer, 2) : undefined; this.#getCatalog = this.getCatalog ? this.#normalizeAndBindMethod(this.getCatalog, 2) : undefined; @@ -117,9 +112,7 @@ module.exports = function extendModel( if (!this.#getLayer) { return this.#handleReturn( callback, - new Error( - `getLayer() method is not implemented in the ${this.namespace} provider.`, - ), + new Error(`getLayer() method is not implemented in the ${this.namespace} provider.`), ); } @@ -156,9 +149,7 @@ module.exports = function extendModel( if (!this.#getCatalog) { return this.#handleReturn( callback, - new Error( - `getCatalog() method is not implemented in the ${this.namespace} provider.`, - ), + new Error(`getCatalog() method is not implemented in the ${this.namespace} provider.`), ); } @@ -198,9 +189,7 @@ module.exports = function extendModel( const providerStream = await this.getStream(req); return providerStream; } else { - throw new Error( - 'getStream() function is not implemented in the provider.', - ); + throw new Error('getStream() function is not implemented in the provider.'); } } @@ -227,9 +216,7 @@ module.exports = function extendModel( // If provider has auth methods use them, then use auth-module methods, otherwise dummy methods if (typeof ProviderModel.prototype.authorize !== 'function') { Model.prototype.authorize = - typeof authModule?.authorize === 'function' - ? authModule.authorize - : async () => {}; + typeof authModule?.authorize === 'function' ? authModule.authorize : async () => {}; } if (typeof ProviderModel.prototype.authenticate !== 'function') { @@ -245,15 +232,14 @@ module.exports = function extendModel( logger.warn( 'Use of "authenticationSpecification" is deprecated. It will be removed in a future release.', ); - Model.prototype.authenticationSpecification = - authModule?.authenticationSpecification; + Model.prototype.authenticationSpecification = authModule?.authenticationSpecification; } return new Model({ logger, cache }, options); }; function shouldUseCache(cacheEntry) { - // older cache plugins stored expiry time explicitly; all caches should move to returning empty if expired + // older cache plugins stored expiry time; all should move to returning empty if expired if (!cacheEntry) { return false; } diff --git a/packages/core/src/data-provider/extend-model.spec.js b/packages/core/src/data-provider/extend-model.spec.js index 4800ce75..60710609 100644 --- a/packages/core/src/data-provider/extend-model.spec.js +++ b/packages/core/src/data-provider/extend-model.spec.js @@ -454,7 +454,7 @@ describe('Tests for extend-model', function () { }); describe('auth methods', () => { - it('should attach auth methods from authModule if provider does not already define them', async () => { + it('should add auth methods from authModule if provider does not have them', async () => { const model = extendModel({ ProviderModel: MockModel, namespace: 'test-provider', @@ -589,10 +589,7 @@ describe('Tests for extend-model', function () { }, ); - await model.pull( - { url: 'domain/test-provider', params: {}, query: {} }, - pullCallbackSpy, - ); + await model.pull({ url: 'domain/test-provider', params: {}, query: {} }, pullCallbackSpy); getDataSpy.should.be.calledOnce(); getDataSpy.firstCall.args.length.should.equal(2); getDataArgs[0].should.deepEqual({ @@ -978,7 +975,7 @@ describe('Tests for extend-model', function () { mockLogger.debug.should.be.calledOnce(); }); - it('should call the getCatalog() function if cache misses, inserts to cache', async function () { + it('should call getCatalog() function if cache misses, inserts to cache', async function () { const mockCache = { retrieve: sinon.spy((key, query, callback) => { callback(null); diff --git a/packages/core/src/data-provider/helpers/compose-route-path.js b/packages/core/src/data-provider/helpers/compose-route-path.js index fc594d44..8491658f 100644 --- a/packages/core/src/data-provider/helpers/compose-route-path.js +++ b/packages/core/src/data-provider/helpers/compose-route-path.js @@ -17,10 +17,7 @@ function composeRoutePath(params) { return routeJoiner(routePrefix, path); } - const providerParamsFragment = getProviderParamsFragment( - hosts, - disableIdParam, - ); + const providerParamsFragment = getProviderParamsFragment(hosts, disableIdParam); if (path.includes('$namespace') || path.includes('$providerParams')) { const paramsPath = path @@ -29,12 +26,7 @@ function composeRoutePath(params) { return routeJoiner(routePrefix, paramsPath); } - return routeJoiner( - routePrefix, - providerNamespace, - providerParamsFragment, - path, - ); + return routeJoiner(routePrefix, providerNamespace, providerParamsFragment, path); } function getProviderParamsFragment(hosts, disableIdParam) { diff --git a/packages/core/src/data-provider/helpers/compose-route-path.spec.js b/packages/core/src/data-provider/helpers/compose-route-path.spec.js index a84d125c..191c323a 100644 --- a/packages/core/src/data-provider/helpers/compose-route-path.spec.js +++ b/packages/core/src/data-provider/helpers/compose-route-path.spec.js @@ -59,9 +59,7 @@ describe('Tests for composeRoutePath', function () { path: '$namespace/rest/services/$providerParams/FeatureServer/:layer/:method', }; const fullRoute = composeRoutePath(params); - fullRoute.should.equal( - '/test/rest/services/:host/:id/FeatureServer/:layer/:method', - ); + fullRoute.should.equal('/test/rest/services/:host/:id/FeatureServer/:layer/:method'); }); it('create route without path construction', function () { diff --git a/packages/core/src/data-provider/index.js b/packages/core/src/data-provider/index.js index 3461eb36..1b93e24a 100644 --- a/packages/core/src/data-provider/index.js +++ b/packages/core/src/data-provider/index.js @@ -46,10 +46,7 @@ module.exports = class DataProvider { ..._.pick(pluginDefinition, 'hosts', 'disableIdParam'), }; - this.version = - pluginDefinition.version || - pluginDefinition?.status?.version || - 'unknown'; + this.version = pluginDefinition.version || pluginDefinition?.status?.version || 'unknown'; this.#urlSafeNamespace = this.namespace.replace(/\s/g, '-').toLowerCase(); @@ -66,16 +63,11 @@ module.exports = class DataProvider { this.#definedProviderRoutes = pluginDefinition.routes || []; - this.#outputPluginControllers = outputPlugins.map( - ({ outputClass, options }) => { - return extendRouteController(model, outputClass, options); - }, - ); + this.#outputPluginControllers = outputPlugins.map(({ outputClass, options }) => { + return extendRouteController(model, outputClass, options); + }); - this.#providerController = extendRouteController( - model, - pluginDefinition.Controller, - ); + this.#providerController = extendRouteController(model, pluginDefinition.Controller); this.#logger = logger; this.#createOutputRoutes(); @@ -94,32 +86,30 @@ module.exports = class DataProvider { } #createOutputRoutes() { - this.outputPluginRoutes = this.#outputPluginControllers.map( - (controller) => { - const routes = controller.routes.map((route) => { - const { handler, path, methods } = route; - - const compositeRoute = new ProviderRoute({ - controller, - handler, - path, - methods, - providerNamespace: this.#urlSafeNamespace, - outputNamespace: controller.namespace, - hosts: this.#options.hosts, - disableIdParam: this.#options.disableIdParam, - routePrefix: this.#options.routePrefix, - absolutePath: this.#options.absolutePath, - }); - return compositeRoute; + this.outputPluginRoutes = this.#outputPluginControllers.map((controller) => { + const routes = controller.routes.map((route) => { + const { handler, path, methods } = route; + + const compositeRoute = new ProviderRoute({ + controller, + handler, + path, + methods, + providerNamespace: this.#urlSafeNamespace, + outputNamespace: controller.namespace, + hosts: this.#options.hosts, + disableIdParam: this.#options.disableIdParam, + routePrefix: this.#options.routePrefix, + absolutePath: this.#options.absolutePath, }); + return compositeRoute; + }); - return { - namespace: controller.namespace, - routes, - }; - }, - ); + return { + namespace: controller.namespace, + routes, + }; + }); } #createProviderRoutes() { @@ -138,9 +128,7 @@ module.exports = class DataProvider { routePrefix: this.#options.routePrefix, absolutePath: true, }); - this.#logger.info( - `ROUTE | [${methods.join(', ').toUpperCase()}] | ${registeredRoute.path}`, - ); + this.#logger.info(`ROUTE | [${methods.join(', ').toUpperCase()}] | ${registeredRoute.path}`); return registeredRoute; }); } @@ -148,9 +136,7 @@ module.exports = class DataProvider { #addOutputRoutes(server) { this.outputPluginRoutes.forEach((output) => { const { namespace: outputNamespace, routes } = output; - this.#logger.info( - `"${outputNamespace}" routes for the "${this.namespace}" provider:`, - ); + this.#logger.info(`"${outputNamespace}" routes for the "${this.namespace}" provider:`); this.#addRouteCollection(server, routes); }); } @@ -170,9 +156,7 @@ module.exports = class DataProvider { server[method.toLowerCase()](path, handler); }); - this.#logger.info( - `ROUTE | [${methods.join(', ').toUpperCase()}] | ${path}`, - ); + this.#logger.info(`ROUTE | [${methods.join(', ').toUpperCase()}] | ${path}`); }); } diff --git a/packages/core/src/data-provider/index.spec.js b/packages/core/src/data-provider/index.spec.js index 0a0d9f0f..6069ab18 100644 --- a/packages/core/src/data-provider/index.spec.js +++ b/packages/core/src/data-provider/index.spec.js @@ -70,18 +70,10 @@ describe('Tests for Provider', function () { providerRegistration.should.have.property('namespace', 'test-provider'); providerRegistration.should.have.property('version', '99.0.0'); providerRegistration.should.have.property('providerRoutes').length(1); - providerRegistration.providerRoutes[0].should.have.property( - 'path', - '/mock-provider-route/:id', - ); + providerRegistration.providerRoutes[0].should.have.property('path', '/mock-provider-route/:id'); providerRegistration.should.have.property('outputPluginRoutes').length(1); - providerRegistration.outputPluginRoutes[0].should.have.property( - 'namespace', - 'MockOutput', - ); - providerRegistration.outputPluginRoutes[0].should.have - .property('routes') - .length(1); + providerRegistration.outputPluginRoutes[0].should.have.property('namespace', 'MockOutput'); + providerRegistration.outputPluginRoutes[0].should.have.property('routes').length(1); providerRegistration.outputPluginRoutes[0].routes[0].should.have.property( 'path', '/test-provider/:id/mock-output', @@ -133,13 +125,9 @@ describe('Tests for Provider', function () { providerRegistration.addRoutesToServer(mockServer); mockServer.get.callCount.should.equal(2); mockServer.get.firstCall.args[0].should.equal('/mock-provider-route/:id'); - mockServer.get.secondCall.args[0].should.equal( - '/test-provider/:id/mock-output', - ); + mockServer.get.secondCall.args[0].should.equal('/test-provider/:id/mock-output'); mockServer.post.callCount.should.equal(1); - mockServer.post.firstCall.args[0].should.equal( - '/test-provider/:id/mock-output', - ); + mockServer.post.firstCall.args[0].should.equal('/test-provider/:id/mock-output'); }); it('should add routes to server, provider routes last', function () { @@ -157,14 +145,10 @@ describe('Tests for Provider', function () { }; providerRegistration.addRoutesToServer(mockServer); mockServer.get.callCount.should.equal(2); - mockServer.get.firstCall.args[0].should.equal( - '/test-provider/:id/mock-output', - ); + mockServer.get.firstCall.args[0].should.equal('/test-provider/:id/mock-output'); mockServer.get.secondCall.args[0].should.equal('/mock-provider-route/:id'); mockServer.post.callCount.should.equal(1); - mockServer.post.firstCall.args[0].should.equal( - '/test-provider/:id/mock-output', - ); + mockServer.post.firstCall.args[0].should.equal('/test-provider/:id/mock-output'); }); it('should add routes to server, no provider-defined routes', function () { @@ -182,13 +166,9 @@ describe('Tests for Provider', function () { }; providerRegistration.addRoutesToServer(mockServer); mockServer.get.callCount.should.equal(1); - mockServer.get.firstCall.args[0].should.equal( - '/test-provider/:id/mock-output', - ); + mockServer.get.firstCall.args[0].should.equal('/test-provider/:id/mock-output'); mockServer.post.callCount.should.equal(1); - mockServer.post.firstCall.args[0].should.equal( - '/test-provider/:id/mock-output', - ); + mockServer.post.firstCall.args[0].should.equal('/test-provider/:id/mock-output'); }); it('should throw error on bad provider option', () => { diff --git a/packages/core/src/data-provider/provider-route.js b/packages/core/src/data-provider/provider-route.js index 9de0c4bc..469a350d 100644 --- a/packages/core/src/data-provider/provider-route.js +++ b/packages/core/src/data-provider/provider-route.js @@ -1,9 +1,7 @@ const Joi = require('joi'); const composeRoutePath = require('./helpers/compose-route-path'); const METHODS_SCHEMA = Joi.array().items( - Joi.string() - .valid('get', 'post', 'patch', 'put', 'delete', 'head') - .insensitive(), + Joi.string().valid('get', 'post', 'patch', 'put', 'delete', 'head').insensitive(), ); class ProviderRoute { @@ -20,18 +18,14 @@ class ProviderRoute { #validateController(controller, handler, path) { if (!controller[handler]) { - throw new Error( - `defines route "${path}" with unknown handler: ${handler}`, - ); + throw new Error(`defines route "${path}" with unknown handler: ${handler}`); } } #validateHttpMethods(methods, path) { const result = METHODS_SCHEMA.validate(methods); if (result.error) { - throw new Error( - `defines route "${path}" with unsupported HTTP method: ${result.value[0]}`, - ); + throw new Error(`defines route "${path}" with unsupported HTTP method: ${result.value[0]}`); } } } diff --git a/packages/core/src/index.js b/packages/core/src/index.js index ab57e0a6..9088ca4d 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -40,9 +40,7 @@ class Koop extends Events { this.server .on('mount', () => { - this.log.info( - `Koop ${this.version} mounted at ${this.server.mountpath}`, - ); + this.log.info(`Koop ${this.version} mounted at ${this.server.mountpath}`); }) .get('/status', (req, res) => res.json({ @@ -72,11 +70,7 @@ class Koop extends Events { return this.#registerAuth(plugin, options); } - this.log.warn( - 'Unrecognized plugin type: "' + - plugin.type + - '". Defaulting to provider.', - ); + this.log.warn('Unrecognized plugin type: "' + plugin.type + '". Defaulting to provider.'); return this.#registerProvider(plugin, options); } @@ -91,16 +85,12 @@ class Koop extends Events { }); dataProvider.addRoutesToServer(this.server); this.providers.push(dataProvider); - this.log.info( - `registered provider: ${dataProvider.namespace} v${dataProvider.version}`, - ); + this.log.info(`registered provider: ${dataProvider.namespace} v${dataProvider.version}`); } #registerOutput(outputClass, options) { this.outputs.push({ outputClass, options }); - this.log.info( - `registered output: ${outputClass.name} v${outputClass.version}`, - ); + this.log.info(`registered output: ${outputClass.name} v${outputClass.version}`); } #registerCache(Cache, options) { diff --git a/packages/core/src/index.spec.js b/packages/core/src/index.spec.js index 33b46dbe..6ff54791 100644 --- a/packages/core/src/index.spec.js +++ b/packages/core/src/index.spec.js @@ -118,10 +118,7 @@ describe('Index tests', function () { koop.register(); throw new Error('should have thrown'); } catch (error) { - error.should.have.property( - 'message', - 'Plugin registration failed: plugin undefined', - ); + error.should.have.property('message', 'Plugin registration failed: plugin undefined'); } }); @@ -132,7 +129,7 @@ describe('Index tests', function () { koop.providers[0].should.have.property('namespace', 'test-provider'); }); - it('should register unknown plugin type as provider and add output and provider routes to router stack', function () { + it('should register unknown plugin as provider and add routes to router stack', function () { const koop = new Koop({ logLevel: 'error' }); const unknownPlugin = _.cloneDeep(mockProviderDefinition); delete unknownPlugin.type; diff --git a/packages/featureserver/src/generate-renderer/color-ramp.js b/packages/featureserver/src/generate-renderer/color-ramp.js index 216a5237..b30c5232 100644 --- a/packages/featureserver/src/generate-renderer/color-ramp.js +++ b/packages/featureserver/src/generate-renderer/color-ramp.js @@ -40,9 +40,7 @@ function createMultipartRamp(options) { const { colorRamps, classificationCount } = options; if (!colorRamps || !Array.isArray(colorRamps)) { - throw new CodedError( - 'Multipart color-ramps need a valid color-ramp configuration array', - ); + throw new CodedError('Multipart color-ramps need a valid color-ramp configuration array'); } return colorRamps.map((ramp) => { diff --git a/packages/featureserver/src/generate-renderer/color-ramp.spec.js b/packages/featureserver/src/generate-renderer/color-ramp.spec.js index 183268b2..d3c6ad08 100644 --- a/packages/featureserver/src/generate-renderer/color-ramp.spec.js +++ b/packages/featureserver/src/generate-renderer/color-ramp.spec.js @@ -20,15 +20,11 @@ describe('when creating a color ramp that', () => { }); it('should throw an error on invalid type option', () => { - createColorRamp - .bind(null, { classification, type: 'foo' }) - .should.throw(); + createColorRamp.bind(null, { classification, type: 'foo' }).should.throw(); }); it('should throw an error on multipart type with color-ramps', () => { - createColorRamp - .bind(null, { classification, type: 'multipart' }) - .should.throw(); + createColorRamp.bind(null, { classification, type: 'multipart' }).should.throw(); }); it('should return correct hsv color ramp', () => { diff --git a/packages/featureserver/src/generate-renderer/create-symbol.js b/packages/featureserver/src/generate-renderer/create-symbol.js index 021bf6ee..df7923e3 100644 --- a/packages/featureserver/src/generate-renderer/create-symbol.js +++ b/packages/featureserver/src/generate-renderer/create-symbol.js @@ -14,10 +14,7 @@ function getDefaultSymbol(geomType) { } function getSymbolRenderer(geomType) { - if ( - geomType === 'esriGeometryPoint' || - geomType === 'esriGeometryMultiPoint' - ) { + if (geomType === 'esriGeometryPoint' || geomType === 'esriGeometryMultiPoint') { return new PointRenderer(); } @@ -29,8 +26,5 @@ function getSymbolRenderer(geomType) { return new PolygonRenderer(); } - throw new CodedError( - 'Dataset geometry type is not supported for renderers.', - 400, - ); + throw new CodedError('Dataset geometry type is not supported for renderers.', 400); } diff --git a/packages/featureserver/src/generate-renderer/create-symbol.spec.js b/packages/featureserver/src/generate-renderer/create-symbol.spec.js index 9c74576f..74cc5085 100644 --- a/packages/featureserver/src/generate-renderer/create-symbol.spec.js +++ b/packages/featureserver/src/generate-renderer/create-symbol.spec.js @@ -12,9 +12,7 @@ describe('when creating a symbol', () => { createSymbol(undefined, 'red'); should.fail('should have thrown error'); } catch (error) { - error.message.should.equal( - 'Dataset geometry type is not supported for renderers.', - ); + error.message.should.equal('Dataset geometry type is not supported for renderers.'); error.code.should.equal(400); } }); diff --git a/packages/featureserver/src/generate-renderer/index.js b/packages/featureserver/src/generate-renderer/index.js index 51f92b33..fb02e24b 100644 --- a/packages/featureserver/src/generate-renderer/index.js +++ b/packages/featureserver/src/generate-renderer/index.js @@ -30,11 +30,7 @@ function generateRendererFromPrecalculatedStatistics(statistics, options) { const { colorRamp: colorRampConfig = {}, baseSymbol } = classificationDef; const classification = statistics.classBreaks.sort((a, b) => a[0] - b[0]); - validateClassificationDefinition( - classificationDef, - geometryType, - classification, - ); + validateClassificationDefinition(classificationDef, geometryType, classification); const colorRamp = createColorRamp({ classification, ...colorRampConfig }); const symbolCollection = colorRamp.map((color) => { @@ -46,14 +42,11 @@ function generateRendererFromPrecalculatedStatistics(statistics, options) { function generateRendererFromFeatures(data, params) { const { classificationDef, geometryType } = params; - // TODO: this seems weird; the winnow method is "query" but it's really a very specialized transform (aggregation) - // consider changes to winnow - this should maybe be a different method + // TODO: this seems weird; the winnow method is "query" but it's really a very + // specialized transform (aggregation) consider changes to winnow - this should + // maybe be a different method const classification = Winnow.query(data, params); - validateClassificationDefinition( - classificationDef, - geometryType, - classification, - ); + validateClassificationDefinition(classificationDef, geometryType, classification); const { colorRamp: colorRampConfig = {}, baseSymbol } = classificationDef; @@ -63,11 +56,7 @@ function generateRendererFromFeatures(data, params) { }); if (classificationDef.type === 'classBreaksDef') { - return renderClassBreaks( - classification, - classificationDef, - symbolCollection, - ); + return renderClassBreaks(classification, classificationDef, symbolCollection); } // if not 'classBreaksDef', then its unique-values @@ -96,11 +85,7 @@ function createClassBreakInfos(breaks, symbolCollection) { }); } -function renderUniqueValue( - classification, - classificationDef, - symbolCollection, -) { +function renderUniqueValue(classification, classificationDef, symbolCollection) { const { uniqueValueFields, fieldDelimiter } = classificationDef; return { type: 'uniqueValue', @@ -110,19 +95,11 @@ function renderUniqueValue( fieldDelimiter, defaultSymbol: {}, defaultLabel: '', - uniqueValueInfos: createUniqueValueInfos( - classification, - fieldDelimiter, - symbolCollection, - ), + uniqueValueInfos: createUniqueValueInfos(classification, fieldDelimiter, symbolCollection), }; } -function createUniqueValueInfos( - uniqueValueEntries, - fieldDelimiter, - symbolCollection, -) { +function createUniqueValueInfos(uniqueValueEntries, fieldDelimiter, symbolCollection) { return uniqueValueEntries.map((uniqueValue, index) => { const value = serializeUniqueValues(uniqueValue, fieldDelimiter); diff --git a/packages/featureserver/src/generate-renderer/index.spec.js b/packages/featureserver/src/generate-renderer/index.spec.js index 86e73bce..f9be2e6d 100644 --- a/packages/featureserver/src/generate-renderer/index.spec.js +++ b/packages/featureserver/src/generate-renderer/index.spec.js @@ -85,16 +85,8 @@ describe('generate-renderer', () => { { classification: data.statistics.classBreaks }, ]); createSymbolSpy.calledTwice.should.equal(true); - createSymbolSpy.firstCall.args.should.deepEqual([ - undefined, - 'color-1', - 'esriGeometryPoint', - ]); - createSymbolSpy.secondCall.args.should.deepEqual([ - undefined, - 'color-2', - 'esriGeometryPoint', - ]); + createSymbolSpy.firstCall.args.should.deepEqual([undefined, 'color-1', 'esriGeometryPoint']); + createSymbolSpy.secondCall.args.should.deepEqual([undefined, 'color-2', 'esriGeometryPoint']); }); it('should render precalculated statistics with default geometry type', () => { @@ -168,16 +160,8 @@ describe('generate-renderer', () => { { classification: data.statistics.classBreaks }, ]); createSymbolSpy.calledTwice.should.equal(true); - createSymbolSpy.firstCall.args.should.deepEqual([ - undefined, - 'color-1', - 'esriGeometryPoint', - ]); - createSymbolSpy.secondCall.args.should.deepEqual([ - undefined, - 'color-2', - 'esriGeometryPoint', - ]); + createSymbolSpy.firstCall.args.should.deepEqual([undefined, 'color-1', 'esriGeometryPoint']); + createSymbolSpy.secondCall.args.should.deepEqual([undefined, 'color-2', 'esriGeometryPoint']); }); }); @@ -291,9 +275,7 @@ describe('generate-renderer', () => { }); getGeometrySpy.calledOnce.should.equal(true); - getGeometrySpy.firstCall.args.should.deepEqual([ - { features: ['feature'] }, - ]); + getGeometrySpy.firstCall.args.should.deepEqual([{ features: ['feature'] }]); winnowSpy.calledOnce.should.equal(true); winnowSpy.firstCall.args.should.deepEqual([ { features: ['feature'] }, @@ -396,9 +378,7 @@ describe('generate-renderer', () => { }); getGeometrySpy.calledOnce.should.equal(true); - getGeometrySpy.firstCall.args.should.deepEqual([ - { features: ['feature'] }, - ]); + getGeometrySpy.firstCall.args.should.deepEqual([{ features: ['feature'] }]); winnowSpy.calledOnce.should.equal(true); winnowSpy.firstCall.args.should.deepEqual([ { features: ['feature'] }, diff --git a/packages/featureserver/src/generate-renderer/validate-classification-definition.js b/packages/featureserver/src/generate-renderer/validate-classification-definition.js index 8e5aa1ca..af75f6e4 100644 --- a/packages/featureserver/src/generate-renderer/validate-classification-definition.js +++ b/packages/featureserver/src/generate-renderer/validate-classification-definition.js @@ -13,11 +13,7 @@ const classificationDefinitionSchema = joi .string() .valid('esriSMS', 'esriSLS', 'esriSFS') .required() - .error( - new Error( - 'baseSymbol requires a valid type: esriSMS, esriSLS, esriSFS', - ), - ), + .error(new Error('baseSymbol requires a valid type: esriSMS, esriSLS, esriSFS')), }) .optional() .unknown(), @@ -29,11 +25,7 @@ const classificationDefinitionSchema = joi 'any.required': 'classification definition is required', }); -function validateClassificationDefinition( - definition, - geometryType, - classification, -) { +function validateClassificationDefinition(definition, geometryType, classification) { validateDefinitionShape(definition); validateDefinitionSymbolAgainstGeometry(definition.baseSymbol, geometryType); validateUniqueValueFields(definition, classification); @@ -48,10 +40,7 @@ function validateDefinitionShape(definition) { } } -function validateDefinitionSymbolAgainstGeometry( - baseSymbol = {}, - geometryType, -) { +function validateDefinitionSymbolAgainstGeometry(baseSymbol = {}, geometryType) { const { type: symbolType } = baseSymbol; if (!symbolType) { @@ -60,7 +49,7 @@ function validateDefinitionSymbolAgainstGeometry( if (symbolLookup(geometryType) !== symbolType) { const error = new Error( - 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', + 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', // eslint-disable-line ); error.code = 400; throw error; @@ -94,14 +83,9 @@ function validateUniqueValueFields(definition, classification) { } const classificationFieldNames = Object.keys(classification[0]); - if ( - areFieldsMissingFromClassification( - uniqueValueFields, - classificationFieldNames, - ) - ) { + if (areFieldsMissingFromClassification(uniqueValueFields, classificationFieldNames)) { throw new CodedError( - `Unique value definition fields are incongruous with classification fields: ${uniqueValueFields.join( + `Unique value definition fields are incongruous with classification fields: ${uniqueValueFields.join( // eslint-disable-line ', ', )} : ${classificationFieldNames.join(', ')}`, 400, @@ -109,13 +93,8 @@ function validateUniqueValueFields(definition, classification) { } } -function areFieldsMissingFromClassification( - definitionFields, - classificationFieldNames, -) { - return definitionFields.some( - (fieldName) => !classificationFieldNames.includes(fieldName), - ); +function areFieldsMissingFromClassification(definitionFields, classificationFieldNames) { + return definitionFields.some((fieldName) => !classificationFieldNames.includes(fieldName)); } module.exports = validateClassificationDefinition; diff --git a/packages/featureserver/src/generate-renderer/validate-classification-definition.spec.js b/packages/featureserver/src/generate-renderer/validate-classification-definition.spec.js index 326bc7a3..5f8e324f 100644 --- a/packages/featureserver/src/generate-renderer/validate-classification-definition.spec.js +++ b/packages/featureserver/src/generate-renderer/validate-classification-definition.spec.js @@ -30,9 +30,7 @@ describe('when creating a symbol', () => { }); should.fail('should have thrown error'); } catch (error) { - error.message.should.equal( - 'baseSymbol requires a valid type: esriSMS, esriSLS, esriSFS', - ); + error.message.should.equal('baseSymbol requires a valid type: esriSMS, esriSLS, esriSFS'); error.code.should.equal(400); } }); @@ -45,9 +43,7 @@ describe('when creating a symbol', () => { }); should.fail('should have thrown error'); } catch (error) { - error.message.should.equal( - 'baseSymbol requires a valid type: esriSMS, esriSLS, esriSFS', - ); + error.message.should.equal('baseSymbol requires a valid type: esriSMS, esriSLS, esriSFS'); error.code.should.equal(400); } }); @@ -61,7 +57,7 @@ describe('when creating a symbol', () => { should.fail('should have thrown error'); } catch (error) { error.message.should.equal( - 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', + 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', // eslint-disable-line ); error.code.should.equal(400); } @@ -76,7 +72,7 @@ describe('when creating a symbol', () => { should.fail('should have thrown error'); } catch (error) { error.message.should.equal( - 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', + 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', // eslint-disable-line ); error.code.should.equal(400); } @@ -91,7 +87,7 @@ describe('when creating a symbol', () => { should.fail('should have thrown error'); } catch (error) { error.message.should.equal( - 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', + 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', // eslint-disable-line ); error.code.should.equal(400); } @@ -106,7 +102,7 @@ describe('when creating a symbol', () => { should.fail('should have thrown error'); } catch (error) { error.message.should.equal( - 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', + 'Classification defintion uses a base symbol type that is incompatiable with dataset geometry', // eslint-disable-line ); error.code.should.equal(400); } @@ -133,11 +129,9 @@ describe('when creating a symbol', () => { it('throws error when unique-value-fields definition is missing uniqueValueFields array', () => { try { - validateClassificationDefinition( - { type: 'uniqueValueDef' }, - 'esriGeometryPoint', - [{ fooz: 'bar' }], - ); + validateClassificationDefinition({ type: 'uniqueValueDef' }, 'esriGeometryPoint', [ + { fooz: 'bar' }, + ]); should.fail('should have thrown error'); } catch (error) { error.message.should.equal( diff --git a/packages/featureserver/src/helpers/data-type-utils.js b/packages/featureserver/src/helpers/data-type-utils.js index 50fc1843..8fe93778 100644 --- a/packages/featureserver/src/helpers/data-type-utils.js +++ b/packages/featureserver/src/helpers/data-type-utils.js @@ -1,8 +1,5 @@ const _ = require('lodash'); -const { - isValidISODateString, - isValidDate, -} = require('iso-datestring-validator'); +const { isValidISODateString, isValidDate } = require('iso-datestring-validator'); const dateTimeParser = require('postgres-date'); const PROBLEMATIC_STRING_SYMBOLS = ['(', '[', '*', '+', '\\', '?']; @@ -21,21 +18,14 @@ function getDataTypeFromValue(value) { function isDate(value) { // this is required due to RegExp error in in the iso-datestring-validator module - if ( - typeof value === 'string' && - PROBLEMATIC_STRING_SYMBOLS.includes(value.charAt(0)) - ) { + if (typeof value === 'string' && PROBLEMATIC_STRING_SYMBOLS.includes(value.charAt(0))) { return false; } return ( value instanceof Date || (typeof value === 'string' && - !!( - dateTimeParser(value) || - isValidDate(value) || - isValidISODateString(value) - )) + !!(dateTimeParser(value) || isValidDate(value) || isValidISODateString(value))) ); } diff --git a/packages/featureserver/src/helpers/feature-layer-metadata.js b/packages/featureserver/src/helpers/feature-layer-metadata.js index 2c24574b..51e743ab 100644 --- a/packages/featureserver/src/helpers/feature-layer-metadata.js +++ b/packages/featureserver/src/helpers/feature-layer-metadata.js @@ -104,9 +104,7 @@ function calculateExtentFromFeatures(geojson, spatialReference) { spatialReference, }; } catch (error) { - logManager.logger.debug( - `Could not calculate extent from data: ${error.message}`, - ); + logManager.logger.debug(`Could not calculate extent from data: ${error.message}`); } } diff --git a/packages/featureserver/src/helpers/feature-layer-metadata.spec.js b/packages/featureserver/src/helpers/feature-layer-metadata.spec.js index f1160b71..93fc3d5d 100644 --- a/packages/featureserver/src/helpers/feature-layer-metadata.spec.js +++ b/packages/featureserver/src/helpers/feature-layer-metadata.spec.js @@ -57,9 +57,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: '', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -187,9 +187,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -356,9 +356,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -517,9 +517,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -674,9 +674,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -837,9 +837,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -979,9 +979,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1121,7 +1121,7 @@ describe('FeatureLayerMetadata', () => { }); }); - it('static method "create" should normalize input, call constructor, and mixin-overrides ', () => { + it('static method "create" should normalize input, call constructor, and mixin-overrides', () => { const featureLayerMetadata = FeatureLayerMetadata.create( { features: [], @@ -1147,9 +1147,9 @@ describe('FeatureLayerMetadata', () => { type: 'Feature Layer', displayField: 'myField', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, diff --git a/packages/featureserver/src/helpers/fields/esri-type-utils.spec.js b/packages/featureserver/src/helpers/fields/esri-type-utils.spec.js index 285c78c4..5f7a3f7a 100644 --- a/packages/featureserver/src/helpers/fields/esri-type-utils.spec.js +++ b/packages/featureserver/src/helpers/fields/esri-type-utils.spec.js @@ -1,8 +1,5 @@ const should = require('should'); // eslint-disable-line -const { - getEsriTypeFromDefinition, - getEsriTypeFromValue, -} = require('./esri-type-utils'); +const { getEsriTypeFromDefinition, getEsriTypeFromValue } = require('./esri-type-utils'); describe('getEsriTypeFromDefinition', () => { it('no definition should default to string', () => { @@ -61,12 +58,8 @@ describe('getEsriTypeFromDefinition', () => { }); it('small-integer', () => { - getEsriTypeFromDefinition('SmallInteger').should.equal( - 'esriFieldTypeSmallInteger', - ); - getEsriTypeFromDefinition('smallinteger').should.equal( - 'esriFieldTypeSmallInteger', - ); + getEsriTypeFromDefinition('SmallInteger').should.equal('esriFieldTypeSmallInteger'); + getEsriTypeFromDefinition('smallinteger').should.equal('esriFieldTypeSmallInteger'); }); it('xml', () => { @@ -95,8 +88,6 @@ describe('getEsriTypeFromValue', () => { it('date', () => { getEsriTypeFromValue(new Date()).should.equal('esriFieldTypeDate'); - getEsriTypeFromValue(new Date().toISOString()).should.equal( - 'esriFieldTypeDate', - ); + getEsriTypeFromValue(new Date().toISOString()).should.equal('esriFieldTypeDate'); }); }); diff --git a/packages/featureserver/src/helpers/fields/field-classes.js b/packages/featureserver/src/helpers/fields/field-classes.js index d6a7ea79..efddb151 100644 --- a/packages/featureserver/src/helpers/fields/field-classes.js +++ b/packages/featureserver/src/helpers/fields/field-classes.js @@ -1,7 +1,4 @@ -const { - getEsriTypeFromDefinition, - getEsriTypeFromValue, -} = require('./esri-type-utils'); +const { getEsriTypeFromDefinition, getEsriTypeFromValue } = require('./esri-type-utils'); const { ESRI_FIELD_TYPE_OID, ESRI_FIELD_TYPE_STRING, @@ -81,8 +78,7 @@ class StatisticDateField extends StatisticField { class FieldFromFieldDefinition extends Field { constructor(fieldDefinition) { super(); - const { name, type, alias, domain, sqlType, length, defaultValue } = - fieldDefinition; + const { name, type, alias, domain, sqlType, length, defaultValue } = fieldDefinition; this.name = name; this.type = getEsriTypeFromDefinition(type); diff --git a/packages/featureserver/src/helpers/fields/fields.js b/packages/featureserver/src/helpers/fields/fields.js index 361d254a..dc11cbd1 100644 --- a/packages/featureserver/src/helpers/fields/fields.js +++ b/packages/featureserver/src/helpers/fields/fields.js @@ -19,8 +19,7 @@ class Fields { return { idField: options.idField || idField, fieldDefinitions: options.fieldDefinitions || options.fields || fields, - attributeSample: - attributeSample || getAttributeSample(features, attributeSample), + attributeSample: attributeSample || getAttributeSample(features, attributeSample), ...options, }; } @@ -30,7 +29,7 @@ class Fields { if (shouldWarnAboutMissingIdFieldDefinition(idField, fieldDefinitions)) { logManager.logger.debug( - `provider's "idField" is set to ${idField}, but this field is not found in field-definitions`, + `provider's "idField" is set to ${idField}, but this field is not found in field-definitions`, // eslint-disable-line ); } @@ -43,9 +42,7 @@ class Fields { } function getAttributeSample(features) { - return ( - _.get(features, '[0].properties') || _.get(features, '[0].attributes', {}) - ); + return _.get(features, '[0].properties') || _.get(features, '[0].attributes', {}); } function shouldWarnAboutMissingIdFieldDefinition(idField, fieldDefinitions) { diff --git a/packages/featureserver/src/helpers/fields/fields.spec.js b/packages/featureserver/src/helpers/fields/fields.spec.js index 2c42193e..b848d57b 100644 --- a/packages/featureserver/src/helpers/fields/fields.spec.js +++ b/packages/featureserver/src/helpers/fields/fields.spec.js @@ -68,10 +68,7 @@ describe('Fields', () => { it('should acquire "attributeSample" from features[0].attributes', () => { const { attributeSample } = Fields.normalizeOptions({ - features: [ - { attributes: { name: 'foo' } }, - { attributes: { name: 'bar' } }, - ], + features: [{ attributes: { name: 'foo' } }, { attributes: { name: 'bar' } }], }); attributeSample.should.deepEqual({ name: 'foo' }); @@ -79,10 +76,7 @@ describe('Fields', () => { it('should acquire "attributeSample" from features[0].properties', () => { const { attributeSample } = Fields.normalizeOptions({ - features: [ - { properties: { name: 'foo' } }, - { properties: { name: 'bar' } }, - ], + features: [{ properties: { name: 'foo' } }, { properties: { name: 'bar' } }], }); attributeSample.should.deepEqual({ name: 'foo' }); diff --git a/packages/featureserver/src/helpers/fields/statistics-fields.js b/packages/featureserver/src/helpers/fields/statistics-fields.js index 4a338178..f007e26b 100644 --- a/packages/featureserver/src/helpers/fields/statistics-fields.js +++ b/packages/featureserver/src/helpers/fields/statistics-fields.js @@ -42,9 +42,7 @@ class StatisticsFields { this.fields = Object.entries(statisticsSample).map(([key, value]) => { if (groupByFieldsForStatistics.includes(key)) { - const fieldDefinition = fieldDefinitions.find( - ({ name }) => name === key, - ); + const fieldDefinition = fieldDefinitions.find(({ name }) => name === key); if (fieldDefinition) { return new FieldFromFieldDefinition(fieldDefinition); diff --git a/packages/featureserver/src/helpers/fields/statistics-fields.spec.js b/packages/featureserver/src/helpers/fields/statistics-fields.spec.js index 4d6c8d50..bb19de33 100644 --- a/packages/featureserver/src/helpers/fields/statistics-fields.spec.js +++ b/packages/featureserver/src/helpers/fields/statistics-fields.spec.js @@ -69,9 +69,7 @@ describe('StatisticsFields', () => { }); it('should default groupByFieldsForStatistics to empty array', () => { - const { groupByFieldsForStatistics } = StatisticsFields.normalizeOptions( - {}, - ); + const { groupByFieldsForStatistics } = StatisticsFields.normalizeOptions({}); groupByFieldsForStatistics.should.deepEqual([]); }); @@ -132,9 +130,7 @@ describe('StatisticsFields', () => { const result = StatisticsFields.create({ statisticsSample: { bar: 100000 }, fieldDefinitions: [{ name: 'foo', type: 'Date' }], - outStatistics: [ - { onStatisticField: 'foo', outStatisticFieldName: 'bar' }, - ], + outStatistics: [{ onStatisticField: 'foo', outStatisticFieldName: 'bar' }], }); result.should.deepEqual([ { diff --git a/packages/featureserver/src/helpers/get-geometry-type-from-geojson.js b/packages/featureserver/src/helpers/get-geometry-type-from-geojson.js index 6d22494b..b0d7d058 100644 --- a/packages/featureserver/src/helpers/get-geometry-type-from-geojson.js +++ b/packages/featureserver/src/helpers/get-geometry-type-from-geojson.js @@ -19,8 +19,7 @@ module.exports = function getGeometryTypeFromGeojson({ metadata = {}, features = [], } = {}) { - const type = - geometryType || metadata.geometryType || findInFeatures(features); + const type = geometryType || metadata.geometryType || findInFeatures(features); if (!type) { logManager.logger.debug(`Input JSON has unsupported geometryType: ${type}`); diff --git a/packages/featureserver/src/helpers/is-geojson-table.js b/packages/featureserver/src/helpers/is-geojson-table.js index 700bcca3..6bffe996 100644 --- a/packages/featureserver/src/helpers/is-geojson-table.js +++ b/packages/featureserver/src/helpers/is-geojson-table.js @@ -3,8 +3,7 @@ const getGeometryTypeFromGeojson = require('./get-geometry-type-from-geojson'); function hasValidFullExent(data) { // Check for a valid fullExtent. If unset, assume this is a Table - const fullExtent = - data.fullExtent || (data.metadata && data.metadata.fullExtent); + const fullExtent = data.fullExtent || (data.metadata && data.metadata.fullExtent); if ( _.isUndefined(fullExtent) || _.isUndefined(fullExtent.xmin) || diff --git a/packages/featureserver/src/helpers/is-geojson-table.spec.js b/packages/featureserver/src/helpers/is-geojson-table.spec.js index 54b5d528..b5601165 100644 --- a/packages/featureserver/src/helpers/is-geojson-table.spec.js +++ b/packages/featureserver/src/helpers/is-geojson-table.spec.js @@ -108,7 +108,7 @@ describe('is-geojson-table', function () { should(result).be.exactly(true); }); - it('GeoJSON collection input with metadata geometryType but no features should return false', () => { + it('GeoJSON collection input with metadata geometryType but no features', () => { const collection = { metadata: { geometryType: 'Point' }, type: 'FeatureCollection', diff --git a/packages/featureserver/src/helpers/normalize-extent.js b/packages/featureserver/src/helpers/normalize-extent.js index 734b97de..413720f5 100644 --- a/packages/featureserver/src/helpers/normalize-extent.js +++ b/packages/featureserver/src/helpers/normalize-extent.js @@ -18,10 +18,7 @@ const esriExtentSchema = joi .unknown(); const simpleArraySchema = joi.array().items(joi.number().required()).min(4); -const cornerArraySchema = joi - .array() - .items(joi.array().items(joi.number()).length(2)) - .length(2); +const cornerArraySchema = joi.array().items(joi.array().items(joi.number()).length(2)).length(2); module.exports = function (input, spatialReference) { if (!input) return undefined; diff --git a/packages/featureserver/src/helpers/normalize-extent.spec.js b/packages/featureserver/src/helpers/normalize-extent.spec.js index 329d9de4..177a8dcd 100644 --- a/packages/featureserver/src/helpers/normalize-extent.spec.js +++ b/packages/featureserver/src/helpers/normalize-extent.spec.js @@ -39,9 +39,7 @@ describe('normalize-extent', function () { normalizeExtent([-180, -90, 180, 'foo'], { wkid: 4326 }); should.fail(); } catch (error) { - error.message.should.equal( - 'Received invalid extent: [-180,-90,180,"foo"]', - ); + error.message.should.equal('Received invalid extent: [-180,-90,180,"foo"]'); } }); diff --git a/packages/featureserver/src/helpers/normalize-input-data.js b/packages/featureserver/src/helpers/normalize-input-data.js index c47ec692..eaafae55 100644 --- a/packages/featureserver/src/helpers/normalize-input-data.js +++ b/packages/featureserver/src/helpers/normalize-input-data.js @@ -6,12 +6,8 @@ module.exports = function normalizeInput(input = {}) { const geometryType = getGeometryTypeFromGeojson(input); return { - layers: - layers || (type === 'FeatureCollection' && geometryType && [input]) || [], - tables: - tables || - (type === 'FeatureCollection' && !geometryType && [input]) || - [], + layers: layers || (type === 'FeatureCollection' && geometryType && [input]) || [], + tables: tables || (type === 'FeatureCollection' && !geometryType && [input]) || [], relationships: relationships || [], }; }; diff --git a/packages/featureserver/src/helpers/normalize-input-data.spec.js b/packages/featureserver/src/helpers/normalize-input-data.spec.js index 794c3f18..6c9af686 100644 --- a/packages/featureserver/src/helpers/normalize-input-data.spec.js +++ b/packages/featureserver/src/helpers/normalize-input-data.spec.js @@ -62,7 +62,7 @@ describe('normalize-input-data', function () { }); }); - it('GeoJSON collection input with metadata geometryType but no features should return single layer', () => { + it('GeoJSON collection input with metadata geometryType but no features', () => { const collection = { metadata: { geometryType: 'Point' }, type: 'FeatureCollection', diff --git a/packages/featureserver/src/helpers/normalize-request-params.js b/packages/featureserver/src/helpers/normalize-request-params.js index 559a66bc..928ee680 100644 --- a/packages/featureserver/src/helpers/normalize-request-params.js +++ b/packages/featureserver/src/helpers/normalize-request-params.js @@ -1,20 +1,13 @@ const _ = require('lodash'); const defaults = require('../metadata-defaults'); -function normalizeRequestParameters( - query, - body, - maxRecordCount = defaults.maxRecordCount(), -) { +function normalizeRequestParameters(query, body, maxRecordCount = defaults.maxRecordCount()) { const definedQueryParams = _.chain(query) .pickBy(isNotEmptyString) .mapValues(coerceStrings) .value(); - const definedBodyParams = _.chain(body) - .pickBy(isNotEmptyString) - .mapValues(coerceStrings) - .value(); + const definedBodyParams = _.chain(body).pickBy(isNotEmptyString).mapValues(coerceStrings).value(); const { resultRecordCount, ...params } = { ...definedQueryParams, diff --git a/packages/featureserver/src/helpers/normalize-request-params.spec.js b/packages/featureserver/src/helpers/normalize-request-params.spec.js index 6de7e678..69f2c455 100644 --- a/packages/featureserver/src/helpers/normalize-request-params.spec.js +++ b/packages/featureserver/src/helpers/normalize-request-params.spec.js @@ -9,18 +9,12 @@ describe('normailizeRequestParameters', () => { }); it('should remove empty strings from query params', () => { - const result = normalizeRequestParameters( - { test: '', foo: 'barb', boo: 400 }, - {}, - ); + const result = normalizeRequestParameters({ test: '', foo: 'barb', boo: 400 }, {}); result.should.deepEqual({ foo: 'barb', boo: 400, resultRecordCount: 2000 }); }); it('should coerce query string boolean', () => { - const result = normalizeRequestParameters( - { test: 'true', foo: 'false' }, - {}, - ); + const result = normalizeRequestParameters({ test: 'true', foo: 'false' }, {}); result.should.deepEqual({ test: true, foo: false, @@ -29,10 +23,7 @@ describe('normailizeRequestParameters', () => { }); it('should parse json', () => { - const result = normalizeRequestParameters( - { test: JSON.stringify({ foo: 'bard' }) }, - {}, - ); + const result = normalizeRequestParameters({ test: JSON.stringify({ foo: 'bard' }) }, {}); result.should.deepEqual({ test: { foo: 'bard' }, resultRecordCount: 2000, @@ -40,10 +31,7 @@ describe('normailizeRequestParameters', () => { }); it('should merge body and query', () => { - const result = normalizeRequestParameters( - { resultRecordCount: '99' }, - { foo: 'bart' }, - ); + const result = normalizeRequestParameters({ resultRecordCount: '99' }, { foo: 'bart' }); result.should.deepEqual({ resultRecordCount: 99, foo: 'bart' }); }); diff --git a/packages/featureserver/src/helpers/normalize-spatial-reference.js b/packages/featureserver/src/helpers/normalize-spatial-reference.js index afaa6eeb..af8dfc20 100644 --- a/packages/featureserver/src/helpers/normalize-spatial-reference.js +++ b/packages/featureserver/src/helpers/normalize-spatial-reference.js @@ -33,15 +33,10 @@ function normalizeSpatialReference(input) { const { type, value } = parseSpatialReferenceInput(input); if (type === 'wkid') { - return ( - wktLookup.get(value) || - esriWktLookup(value) || { wkid: 4326, latestWkid: 4326 } - ); + return wktLookup.get(value) || esriWktLookup(value) || { wkid: 4326, latestWkid: 4326 }; } - return ( - convertStringToSpatialReference(value) || { wkid: 4326, latestWkid: 4326 } - ); + return convertStringToSpatialReference(value) || { wkid: 4326, latestWkid: 4326 }; } function parseSpatialReferenceInput(spatialReference) { @@ -74,10 +69,7 @@ function parseSpatialReferenceInput(spatialReference) { } function isNumericSpatialReferenceId(spatialReference) { - return ( - Number.isInteger(spatialReference) || - Number.isInteger(Number(spatialReference)) - ); + return Number.isInteger(spatialReference) || Number.isInteger(Number(spatialReference)); } function isPrefixedSpatialReferenceId(spatialReference) { @@ -109,8 +101,7 @@ function esriWktLookup(lookupValue) { } function convertStringToSpatialReference(wkt) { - if (/WGS_1984_Web_Mercator_Auxiliary_Sphere/.test(wkt)) - return { wkid: 102100, latestWkid: 3857 }; + if (/WGS_1984_Web_Mercator_Auxiliary_Sphere/.test(wkt)) return { wkid: 102100, latestWkid: 3857 }; try { const wkid = getWktWkid(wkt); diff --git a/packages/featureserver/src/helpers/normalize-spatial-reference.spec.js b/packages/featureserver/src/helpers/normalize-spatial-reference.spec.js index d63804b1..bc7f6552 100644 --- a/packages/featureserver/src/helpers/normalize-spatial-reference.spec.js +++ b/packages/featureserver/src/helpers/normalize-spatial-reference.spec.js @@ -36,7 +36,7 @@ describe('normalize-spatial-reference', function () { it('object with wkt that is Web Mercator string', () => { const inputWkt = - 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; + 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; // eslint-disable-line const spatialRef = normalizeSpatialReference({ wkt: inputWkt }); spatialRef.should.deepEqual({ latestWkid: 3857, @@ -69,7 +69,7 @@ describe('normalize-spatial-reference', function () { it('Web Mercator wkt string', () => { const inputWkt = - 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; + 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; // eslint-disable-line const spatialRef = normalizeSpatialReference(inputWkt); spatialRef.should.deepEqual({ latestWkid: 3857, diff --git a/packages/featureserver/src/helpers/server-metadata.js b/packages/featureserver/src/helpers/server-metadata.js index 855ab474..b149d63b 100644 --- a/packages/featureserver/src/helpers/server-metadata.js +++ b/packages/featureserver/src/helpers/server-metadata.js @@ -61,9 +61,7 @@ function getUnits({ latestWkid, wkid, wkt }) { const units = wktParser(wkt)?.units; return esriUnitsLookup(units); } catch (error) { - logManager.logger.debug( - `Could not set feature service units from spatial reference: ${error}`, - ); + logManager.logger.debug(`Could not set feature service units from spatial reference: ${error}`); } } diff --git a/packages/featureserver/src/helpers/server-metadata.spec.js b/packages/featureserver/src/helpers/server-metadata.spec.js index 4fa92e2f..45030034 100644 --- a/packages/featureserver/src/helpers/server-metadata.spec.js +++ b/packages/featureserver/src/helpers/server-metadata.spec.js @@ -11,7 +11,7 @@ describe('ServerMetadata', () => { result.should.deepEqual({ currentVersion: CURRENT_VERSION, serviceDescription: - 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line hasVersionedData: false, supportsDisconnectedEditing: false, hasStaticData: false, @@ -22,9 +22,9 @@ describe('ServerMetadata', () => { supportedExportFormats: '', capabilities: 'Query', description: - 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line spatialReference: { wkid: 4326, latestWkid: 4326 }, fullExtent: { xmin: -180, @@ -133,7 +133,7 @@ describe('ServerMetadata', () => { result.should.deepEqual({ currentVersion: CURRENT_VERSION, serviceDescription: - 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line hasVersionedData: false, supportsDisconnectedEditing: false, hasStaticData: false, @@ -144,9 +144,9 @@ describe('ServerMetadata', () => { supportedExportFormats: '', capabilities: 'Query', description: - 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line spatialReference: { wkid: 4326, latestWkid: 4326 }, fullExtent: { xmin: -180, @@ -244,7 +244,7 @@ describe('ServerMetadata', () => { it('should use wkt if available', () => { const result = ServerMetadata.create({ spatialReference: { - wkt: 'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]', + wkt: 'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]', // eslint-disable-line }, }); diff --git a/packages/featureserver/src/helpers/table-layer-metadata.js b/packages/featureserver/src/helpers/table-layer-metadata.js index 8f0c53db..7a939200 100644 --- a/packages/featureserver/src/helpers/table-layer-metadata.js +++ b/packages/featureserver/src/helpers/table-layer-metadata.js @@ -30,11 +30,7 @@ class TableLayerMetadata { const layerId = reqLayer != null ? reqLayer : req.layerId; // TODO: deprecate req.app.locals.config usage - const { currentVersion, description } = _.get( - req, - 'app.locals.config.featureServer', - {}, - ); + const { currentVersion, description } = _.get(req, 'app.locals.config.featureServer', {}); const normalizedOptions = _.pickBy( { @@ -43,10 +39,7 @@ class TableLayerMetadata { layerId, ...query, ...metadata, - capabilities: normalizeCapabilities( - capabilities, - metadata.capabilities, - ), + capabilities: normalizeCapabilities(capabilities, metadata.capabilities), }, (value) => value, ); @@ -141,10 +134,7 @@ class TableLayerMetadata { return; } - if ( - _.has(capabilities, 'extract') && - !this.capabilities.includes('Extract') - ) { + if (_.has(capabilities, 'extract') && !this.capabilities.includes('Extract')) { this.capabilities = `${this.capabilities},Extract`; } } @@ -210,9 +200,7 @@ class TableLayerMetadata { return; } - validateQueryFormatsArray( - supportedQueryFormats.split(',').map((val) => val.trim()), - ); + validateQueryFormatsArray(supportedQueryFormats.split(',').map((val) => val.trim())); this.supportedQueryFormats = supportedQueryFormats; } catch (error) { logManager.logger.error(error.message); diff --git a/packages/featureserver/src/helpers/table-layer-metadata.spec.js b/packages/featureserver/src/helpers/table-layer-metadata.spec.js index a3dc1972..043c4ff6 100644 --- a/packages/featureserver/src/helpers/table-layer-metadata.spec.js +++ b/packages/featureserver/src/helpers/table-layer-metadata.spec.js @@ -37,9 +37,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: '', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -158,9 +158,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -272,9 +272,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -384,9 +384,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -496,9 +496,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'hellow', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -608,9 +608,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'fluffy', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -720,9 +720,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -832,9 +832,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -944,9 +944,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1056,9 +1056,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1168,9 +1168,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1270,10 +1270,7 @@ describe('TableLayerMetadata', () => { it('defer to "capabilities.list" option if defined ', () => { const tableLayerMetadata = new TableLayerMetadata(); - tableLayerMetadata.mixinOverrides( - {}, - { capabilities: { list: 'hello,world' } }, - ); + tableLayerMetadata.mixinOverrides({}, { capabilities: { list: 'hello,world' } }); tableLayerMetadata.should.deepEqual({ currentVersion: CURRENT_VERSION, @@ -1283,9 +1280,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1385,10 +1382,7 @@ describe('TableLayerMetadata', () => { it('add "Extract" to default "capabilities" if capabilities.extract is truthy', () => { const tableLayerMetadata = new TableLayerMetadata(); - tableLayerMetadata.mixinOverrides( - {}, - { capabilities: { extract: true } }, - ); + tableLayerMetadata.mixinOverrides({}, { capabilities: { extract: true } }); tableLayerMetadata.should.deepEqual({ currentVersion: CURRENT_VERSION, @@ -1398,9 +1392,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1510,9 +1504,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1622,9 +1616,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1734,9 +1728,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -1846,9 +1840,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'OBJECTID', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -2111,9 +2105,7 @@ describe('TableLayerMetadata', () => { supportedQueryFormats: ['PBF'], }, ); - tableLayerMetadata.supportedQueryFormats.should.equal( - 'JSON,geojson,PBF', - ); + tableLayerMetadata.supportedQueryFormats.should.equal('JSON,geojson,PBF'); loggerSpy.error.firstCall.args.should.deepEqual([ '"supportedQueryFormats" override is invalid; must contain "JSON". skipping override', ]); @@ -2191,7 +2183,7 @@ describe('TableLayerMetadata', () => { }); }); - it('static method "create" should normalize input, call constructor, and mixin-overrides ', () => { + it('should normalize input, call constructor, and mixin-overrides ', () => { const tableLayerMetadata = TableLayerMetadata.create( { features: ['feature'], @@ -2228,7 +2220,7 @@ describe('TableLayerMetadata', () => { displayField: 'myField', description: 'Overrides default layer description.', copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, @@ -2347,9 +2339,9 @@ describe('TableLayerMetadata', () => { type: 'Table', displayField: 'myField', description: - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.', // eslint-disable-line copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, diff --git a/packages/featureserver/src/helpers/validate-inputs.js b/packages/featureserver/src/helpers/validate-inputs.js index af274f6d..98a4f588 100644 --- a/packages/featureserver/src/helpers/validate-inputs.js +++ b/packages/featureserver/src/helpers/validate-inputs.js @@ -34,9 +34,7 @@ function shouldValidateGeojson() { function validateGeojson(geojson) { const geojsonErrors = geojsonhint.valid(geojson, true); if (geojsonErrors.length > 0) { - logManager.logger.debug( - `source data for contains invalid GeoJSON; ${geojsonErrors[0]}`, - ); + logManager.logger.debug(`source data for contains invalid GeoJSON; ${geojsonErrors[0]}`); } } diff --git a/packages/featureserver/src/layer-metadata.js b/packages/featureserver/src/layer-metadata.js index 47d5f7cb..6a3480d4 100644 --- a/packages/featureserver/src/layer-metadata.js +++ b/packages/featureserver/src/layer-metadata.js @@ -1,8 +1,4 @@ -const { - isTable, - TableLayerMetadata, - FeatureLayerMetadata, -} = require('./helpers'); +const { isTable, TableLayerMetadata, FeatureLayerMetadata } = require('./helpers'); function layerMetadata(data = {}, options = {}) { if (isTable({ ...data, ...options })) { diff --git a/packages/featureserver/src/layer-metadata.spec.js b/packages/featureserver/src/layer-metadata.spec.js index a7f03e38..b2ba9239 100644 --- a/packages/featureserver/src/layer-metadata.spec.js +++ b/packages/featureserver/src/layer-metadata.spec.js @@ -25,10 +25,7 @@ describe('layerMetadata', function () { isTableSpy.callCount.should.equal(1); isTableSpy.firstCall.args.should.deepEqual([{ foo: 'bar', sna: 'fu' }]); TableCreateSpy.callCount.should.equal(1); - TableCreateSpy.firstCall.args.should.deepEqual([ - { foo: 'bar' }, - { sna: 'fu' }, - ]); + TableCreateSpy.firstCall.args.should.deepEqual([{ foo: 'bar' }, { sna: 'fu' }]); TableCreateSpy.resetHistory(); }); @@ -48,10 +45,7 @@ describe('layerMetadata', function () { isTableSpy.callCount.should.equal(1); isTableSpy.firstCall.args.should.deepEqual([{ foo: 'bar', sna: 'fu' }]); FeatureLayerCreateSpy.callCount.should.equal(1); - FeatureLayerCreateSpy.firstCall.args.should.deepEqual([ - { foo: 'bar' }, - { sna: 'fu' }, - ]); + FeatureLayerCreateSpy.firstCall.args.should.deepEqual([{ foo: 'bar' }, { sna: 'fu' }]); FeatureLayerCreateSpy.resetHistory(); }); }); diff --git a/packages/featureserver/src/layers-metadata.js b/packages/featureserver/src/layers-metadata.js index 6211fbd8..0e4e0698 100644 --- a/packages/featureserver/src/layers-metadata.js +++ b/packages/featureserver/src/layers-metadata.js @@ -1,8 +1,4 @@ -const { - normalizeInputData, - TableLayerMetadata, - FeatureLayerMetadata, -} = require('./helpers'); +const { normalizeInputData, TableLayerMetadata, FeatureLayerMetadata } = require('./helpers'); module.exports = function layersMetadata(data, options = {}) { const { layers: layersInput, tables: tablesInput } = normalizeInputData(data); diff --git a/packages/featureserver/src/layers-metadata.spec.js b/packages/featureserver/src/layers-metadata.spec.js index 4ec8dac7..841dd272 100644 --- a/packages/featureserver/src/layers-metadata.spec.js +++ b/packages/featureserver/src/layers-metadata.spec.js @@ -35,7 +35,7 @@ describe('layers metadata', () => { FeatureLayerMetadata.callCount.should.equal(0); }); - it('table/feature layer input should generate appropriate class instances with default ids', () => { + it('table/feature layer input should generate class instances with default ids', () => { const normalizeInputData = sinon.spy(function () { return { layers: ['layer1', 'layer2'], @@ -67,10 +67,7 @@ describe('layers metadata', () => { }, }); - const layersInfo = layersInfoHandler( - { hello: 'world' }, - { some: 'options' }, - ); + const layersInfo = layersInfoHandler({ hello: 'world' }, { some: 'options' }); layersInfo.should.deepEqual({ layers: ['layer1-metadata', 'layer2-metadata'], @@ -89,9 +86,6 @@ describe('layers metadata', () => { { layerId: 1, some: 'options' }, ]); tableCreateSpy.callCount.should.equal(1); - tableCreateSpy.firstCall.args.should.deepEqual([ - 'table1', - { layerId: 2, some: 'options' }, - ]); + tableCreateSpy.firstCall.args.should.deepEqual(['table1', { layerId: 2, some: 'options' }]); }); }); diff --git a/packages/featureserver/src/metadata-defaults.js b/packages/featureserver/src/metadata-defaults.js index b59a05bf..3329f2ae 100644 --- a/packages/featureserver/src/metadata-defaults.js +++ b/packages/featureserver/src/metadata-defaults.js @@ -4,11 +4,11 @@ const CURRENT_VERSION = 11.2; const FULL_VERSION = '11.2.0'; const MAX_RECORD_COUNT = 2000; const SERVICE_DESCRIPTION = - 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.'; + 'This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.'; // eslint-disable-line const LAYER_DESCRIPTION = - 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.'; + 'This is a feature layer exposed with Koop. For more information go to https://github.com/koopjs/koop.'; // eslint-disable-line const COPYRIGHT = - 'Copyright information varies by provider. For more information please contact the source of this data.'; + 'Copyright information varies by provider. For more information please contact the source of this data.'; // eslint-disable-line const SPATIAL_REFERENCE = { wkid: 4326, latestWkid: 4326, @@ -267,9 +267,7 @@ class MetadataDefaults { }); if (error) { - throw new Error( - `FeatureServer default settings are invalid: ${error.details[0].message}.`, - ); + throw new Error(`FeatureServer default settings are invalid: ${error.details[0].message}.`); } this.#overridables = _.merge(this.#overridables, value); diff --git a/packages/featureserver/src/query/filter-and-transform.js b/packages/featureserver/src/query/filter-and-transform.js index b86e8b27..dbbfc01e 100644 --- a/packages/featureserver/src/query/filter-and-transform.js +++ b/packages/featureserver/src/query/filter-and-transform.js @@ -66,11 +66,7 @@ class FilterAndTransformParams { addInputCrs(data) { const { metadata = {} } = data; this.inputCrs = - this.inputCrs || - this.sourceSR || - metadata.crs || - helpers.getCollectionCrs(data) || - 4326; + this.inputCrs || this.sourceSR || metadata.crs || helpers.getCollectionCrs(data) || 4326; delete this.sourceSR; return this; } diff --git a/packages/featureserver/src/query/filter-and-transform.spec.js b/packages/featureserver/src/query/filter-and-transform.spec.js index 4af15f27..48fc6f6c 100644 --- a/packages/featureserver/src/query/filter-and-transform.spec.js +++ b/packages/featureserver/src/query/filter-and-transform.spec.js @@ -29,10 +29,7 @@ describe('filterAndTransform', () => { describe('should standardize parameters', () => { it('should convert "returnDistinctValues" to "distinct"', () => { - const result = filterAndTransform( - { features: [{}] }, - { returnDistinctValues: true }, - ); + const result = filterAndTransform({ features: [{}] }, { returnDistinctValues: true }); result.should.deepEqual({ features: 'expected-result', }); @@ -56,10 +53,7 @@ describe('filterAndTransform', () => { }); it('should remove "+" from where', () => { - const result = filterAndTransform( - { features: [{}] }, - { where: 'FOO+IS+NOT+NULL' }, - ); + const result = filterAndTransform({ features: [{}] }, { where: 'FOO+IS+NOT+NULL' }); result.should.deepEqual({ features: 'expected-result', }); @@ -76,10 +70,7 @@ describe('filterAndTransform', () => { }); it('should not remove "+" from where if wrapped in single quotes', () => { - const result = filterAndTransform( - { features: [{}] }, - { where: "'FOO+'+IS+NOT+NULL" }, - ); + const result = filterAndTransform({ features: [{}] }, { where: "'FOO+'+IS+NOT+NULL" }); result.should.deepEqual({ features: 'expected-result', }); @@ -96,10 +87,7 @@ describe('filterAndTransform', () => { }); it('should not remove "+" from where if wrapped in double quotes', () => { - const result = filterAndTransform( - { features: [{}] }, - { where: '"FOO+"+IS+NOT+NULL' }, - ); + const result = filterAndTransform({ features: [{}] }, { where: '"FOO+"+IS+NOT+NULL' }); result.should.deepEqual({ features: 'expected-result', }); @@ -136,10 +124,7 @@ describe('filterAndTransform', () => { }); it('should set toEsri:false when returnExtentOnly: true', () => { - const result = filterAndTransform( - { features: [{}] }, - { returnExtentOnly: true }, - ); + const result = filterAndTransform({ features: [{}] }, { returnExtentOnly: true }); result.should.deepEqual({ features: 'expected-result', }); @@ -183,10 +168,7 @@ describe('filterAndTransform', () => { query: filterAndTransformSpy, }, }; - const { filterAndTransform } = proxyquire( - './filter-and-transform', - stub, - ); + const { filterAndTransform } = proxyquire('./filter-and-transform', stub); const result = filterAndTransform({ features: [{}] }, {}); result.should.deepEqual({ features: 'expected-result', @@ -204,10 +186,7 @@ describe('filterAndTransform', () => { }); it('should get value from metadata.crs', () => { - const result = filterAndTransform( - { metadata: { crs: 1234 }, features: [{}] }, - {}, - ); + const result = filterAndTransform({ metadata: { crs: 1234 }, features: [{}] }, {}); result.should.deepEqual({ features: 'expected-result', }); diff --git a/packages/featureserver/src/query/index.js b/packages/featureserver/src/query/index.js index 0f616ca9..6fbb065b 100644 --- a/packages/featureserver/src/query/index.js +++ b/packages/featureserver/src/query/index.js @@ -3,9 +3,7 @@ const { filterAndTransform } = require('./filter-and-transform'); const { logProviderDataWarnings } = require('./log-provider-data-warnings'); const { renderFeaturesResponse } = require('./render-features'); const { renderStatisticsResponse } = require('./render-statistics'); -const { - renderPrecalculatedStatisticsResponse, -} = require('./render-precalculated-statistics'); +const { renderPrecalculatedStatisticsResponse } = require('./render-precalculated-statistics'); const { renderCountAndExtentResponse } = require('./render-count-and-extent'); const { getGeometryTypeFromGeojson } = require('../helpers'); const { validate } = require('./validate-query-request-parameters'); @@ -22,8 +20,7 @@ function query(json, requestParams = {}) { logProviderDataWarnings(json, requestParams); - const data = - skipFiltering || !features ? json : filterAndTransform(json, requestParams); + const data = skipFiltering || !features ? json : filterAndTransform(json, requestParams); // TODO: Bug when count or extent requested. // QUESTION: Is this problematic if its an aggregation with stats? @@ -54,12 +51,7 @@ function shouldRenderPrecalculatedData(json, requestParameters) { function renderPrecalculatedData( data, - { - returnCountOnly, - returnExtentOnly, - outStatistics, - groupByFieldsForStatistics, - }, + { returnCountOnly, returnExtentOnly, outStatistics, groupByFieldsForStatistics }, ) { const { statistics, count, extent } = data; diff --git a/packages/featureserver/src/query/index.spec.js b/packages/featureserver/src/query/index.spec.js index 4aee449c..bb16d8b8 100644 --- a/packages/featureserver/src/query/index.spec.js +++ b/packages/featureserver/src/query/index.spec.js @@ -41,8 +41,7 @@ const stub = { renderStatisticsResponse: renderStatisticsResponseSpy, }, './render-precalculated-statistics': { - renderPrecalculatedStatisticsResponse: - renderPrecalculatedStatisticsResponseSpy, + renderPrecalculatedStatisticsResponse: renderPrecalculatedStatisticsResponseSpy, }, './render-count-and-extent': { renderCountAndExtentResponse: renderCountAndExtentResponseSpy, diff --git a/packages/featureserver/src/query/log-provider-data-warnings.js b/packages/featureserver/src/query/log-provider-data-warnings.js index 8d138609..b7253dda 100644 --- a/packages/featureserver/src/query/log-provider-data-warnings.js +++ b/packages/featureserver/src/query/log-provider-data-warnings.js @@ -3,13 +3,7 @@ const { getDataTypeFromValue } = require('../helpers'); const logManager = require('../log-manager'); function logProviderDataWarnings(geojson, requestParams) { - const { - f, - outFields = '*', - returnCountOnly, - returnExtentOnly, - returnIdsOnly, - } = requestParams; + const { f, outFields = '*', returnCountOnly, returnExtentOnly, returnIdsOnly } = requestParams; if (f === 'geojson' || returnCountOnly || returnExtentOnly || returnIdsOnly) { return; @@ -21,13 +15,13 @@ function logProviderDataWarnings(geojson, requestParams) { if (!metadata.idField && properties?.OBJECTID === undefined) { logManager.logger.debug( - `provider data has no OBJECTID and has no "idField" assignment. You will get the most reliable behavior from ArcGIS clients if the provider assigns the "idField" to a property that is an integer in range 0 - ${Number.MAX_SAFE_INTEGER}. An OBJECTID field will be auto-generated in the absence of an "idField" assignment.`, + `provider data has no OBJECTID and has no "idField" assignment. You will get the most reliable behavior from ArcGIS clients if the provider assigns the "idField" to a property that is an integer in range 0 - ${Number.MAX_SAFE_INTEGER}. An OBJECTID field will be auto-generated in the absence of an "idField" assignment.`, // eslint-disable-line ); } if (hasMixedCaseObjectIdKey(metadata.idField)) { logManager.logger.debug( - 'requested provider has "idField" that is a mixed-case version of "OBJECTID". This can cause errors in ArcGIS clients.', + 'requested provider has "idField" that is a mixed-case version of "OBJECTID". This can cause errors in ArcGIS clients.', // eslint-disable-line ); } @@ -45,16 +39,13 @@ function hasMixedCaseObjectIdKey(idField = '') { } function getFieldsDefinitionsForResponse(fields, outFields) { - const outFieldsSet = - outFields === '*' || outFields === '' ? null : outFields.split(','); + const outFieldsSet = outFields === '*' || outFields === '' ? null : outFields.split(','); if (!outFieldsSet) { return fields; } return fields.filter((field) => { - return ( - outFieldsSet.includes(field.alias) || outFieldsSet.includes(field.name) - ); + return outFieldsSet.includes(field.alias) || outFieldsSet.includes(field.name); }); } @@ -74,12 +65,11 @@ function compareFieldDefintionsToFeature(fieldDefinitions, featureProperties) { function compareFeatureToFieldDefinitions(featureProperties, fieldDefinitions) { Object.keys(featureProperties).forEach((key) => { const definition = - _.find(fieldDefinitions, ['name', key]) || - _.find(fieldDefinitions, ['name', key]); + _.find(fieldDefinitions, ['name', key]) || _.find(fieldDefinitions, ['name', key]); if (!definition && key !== 'OBJECTID') { logManager.logger.debug( - `requested provider has feature with property "${key}" that was not defined in metadata fields array`, + `requested provider has feature with property "${key}" that was not defined in metadata fields array`, // eslint-disable-line ); } }); @@ -92,10 +82,7 @@ function findFeatureProperty(properties, name, alias) { function hasTypeMismatch(definitionType, value) { const propertyType = getDataTypeFromValue(value); - return ( - definitionType !== propertyType && - !isEsriTypeMatchException(definitionType, propertyType) - ); + return definitionType !== propertyType && !isEsriTypeMatchException(definitionType, propertyType); } function isEsriTypeMatchException(definitionType, propertyType) { diff --git a/packages/featureserver/src/query/log-provider-data-warnings.spec.js b/packages/featureserver/src/query/log-provider-data-warnings.spec.js index 781115d2..6274fd4b 100644 --- a/packages/featureserver/src/query/log-provider-data-warnings.spec.js +++ b/packages/featureserver/src/query/log-provider-data-warnings.spec.js @@ -5,16 +5,13 @@ const proxyquire = require('proxyquire'); describe('logProviderDataWarnings', () => { const loggerSpy = sinon.spy(() => {}); - const { logProviderDataWarnings } = proxyquire( - './log-provider-data-warnings', - { - '../log-manager': { - logger: { - debug: loggerSpy, - }, + const { logProviderDataWarnings } = proxyquire('./log-provider-data-warnings', { + '../log-manager': { + logger: { + debug: loggerSpy, }, }, - ); + }); afterEach(() => { loggerSpy.resetHistory(); @@ -24,7 +21,7 @@ describe('logProviderDataWarnings', () => { logProviderDataWarnings({}, {}); loggerSpy.callCount.should.equal(1); loggerSpy.firstCall.args.should.deepEqual([ - `provider data has no OBJECTID and has no "idField" assignment. You will get the most reliable behavior from ArcGIS clients if the provider assigns the "idField" to a property that is an integer in range 0 - ${Number.MAX_SAFE_INTEGER}. An OBJECTID field will be auto-generated in the absence of an "idField" assignment.`, + `provider data has no OBJECTID and has no "idField" assignment. You will get the most reliable behavior from ArcGIS clients if the provider assigns the "idField" to a property that is an integer in range 0 - ${Number.MAX_SAFE_INTEGER}. An OBJECTID field will be auto-generated in the absence of an "idField" assignment.`, // eslint-disable-line ]); }); @@ -32,7 +29,7 @@ describe('logProviderDataWarnings', () => { logProviderDataWarnings({ metadata: { idField: 'objEctId' } }, {}); loggerSpy.callCount.should.equal(1); loggerSpy.firstCall.args.should.deepEqual([ - 'requested provider has "idField" that is a mixed-case version of "OBJECTID". This can cause errors in ArcGIS clients.', + 'requested provider has "idField" that is a mixed-case version of "OBJECTID". This can cause errors in ArcGIS clients.', // eslint-disable-line ]); }); @@ -50,7 +47,7 @@ describe('logProviderDataWarnings', () => { ]); }); - it('should log field definition - feature property type mismatch', () => { + it('feature property type mismatch', () => { logProviderDataWarnings( { metadata: { fields: [{ name: 'foo', type: 'String' }] }, @@ -64,7 +61,7 @@ describe('logProviderDataWarnings', () => { ]); }); - it('should log field definition - feature property type mismatch (outFields as empty string)', () => { + it('feature property type mismatch (outFields as empty string)', () => { logProviderDataWarnings( { metadata: { fields: [{ name: 'foo', type: 'String' }] }, @@ -78,7 +75,7 @@ describe('logProviderDataWarnings', () => { ]); }); - it('should log field definition - feature property type mismatch (outFields defined)', () => { + it('feature property type mismatch (outFields defined)', () => { logProviderDataWarnings( { metadata: { fields: [{ name: 'foo', type: 'String' }] }, @@ -93,7 +90,7 @@ describe('logProviderDataWarnings', () => { ]); }); - it('should log field definition - feature property type mismatch (outFields defined with alias)', () => { + it('feature property type mismatch (outFields defined with alias)', () => { logProviderDataWarnings( { metadata: { fields: [{ name: 'foo', alias: 'food', type: 'String' }] }, @@ -140,7 +137,7 @@ describe('logProviderDataWarnings', () => { ); loggerSpy.callCount.should.equal(2); loggerSpy.secondCall.args.should.deepEqual([ - 'requested provider has feature with property "foo" that was not defined in metadata fields array', + 'requested provider has feature with property "foo" that was not defined in metadata fields array', // eslint-disable-line ]); }); }); diff --git a/packages/featureserver/src/query/render-count-and-extent.spec.js b/packages/featureserver/src/query/render-count-and-extent.spec.js index 17dd6557..7bfa7fa9 100644 --- a/packages/featureserver/src/query/render-count-and-extent.spec.js +++ b/packages/featureserver/src/query/render-count-and-extent.spec.js @@ -16,10 +16,7 @@ const stub = { 'esri-extent': esriExtentSpy, }; -const { renderCountAndExtentResponse } = proxyquire( - './render-count-and-extent', - stub, -); +const { renderCountAndExtentResponse } = proxyquire('./render-count-and-extent', stub); describe('renderCountAndExtent', () => { afterEach(function () { @@ -46,10 +43,7 @@ describe('renderCountAndExtent', () => { }); it('should render count', () => { - const result = renderCountAndExtentResponse( - { features: ['test'] }, - { returnCountOnly: true }, - ); + const result = renderCountAndExtentResponse({ features: ['test'] }, { returnCountOnly: true }); result.should.deepEqual({ count: 1, }); @@ -57,10 +51,7 @@ describe('renderCountAndExtent', () => { }); it('should render extent', () => { - const result = renderCountAndExtentResponse( - { features: ['test'] }, - { returnExtentOnly: true }, - ); + const result = renderCountAndExtentResponse({ features: ['test'] }, { returnExtentOnly: true }); result.should.deepEqual({ extent: { foo: 'bar', diff --git a/packages/featureserver/src/query/render-features.js b/packages/featureserver/src/query/render-features.js index d5cb6d76..fc2e6c55 100644 --- a/packages/featureserver/src/query/render-features.js +++ b/packages/featureserver/src/query/render-features.js @@ -25,14 +25,10 @@ const featureResponseTemplate = { function renderFeaturesResponse(data, params) { const template = _.cloneDeep(featureResponseTemplate); - const { - uniqueIdField: uniqueIdFieldDefault, - objectIdFieldName: objectIdFieldNameDefault, - } = template; + const { uniqueIdField: uniqueIdFieldDefault, objectIdFieldName: objectIdFieldNameDefault } = + template; - const { - metadata: { exceededTransferLimit = false, transform, idField, hasZ } = {}, - } = data; + const { metadata: { exceededTransferLimit = false, transform, idField, hasZ } = {} } = data; const computedProperties = { geometryType: params.geometryType, @@ -55,17 +51,9 @@ function renderFeaturesResponse(data, params) { return { ...template, ...computedProperties }; } -function getOutputSpatialReference( - collection, - { outSR, outputCrs, inputCrs, sourceSR }, -) { +function getOutputSpatialReference(collection, { outSR, outputCrs, inputCrs, sourceSR }) { const spatialReference = - outputCrs || - outSR || - inputCrs || - sourceSR || - getCollectionCrs(collection) || - 4326; + outputCrs || outSR || inputCrs || sourceSR || getCollectionCrs(collection) || 4326; const { wkid, wkt, latestWkid } = normalizeSpatialReference(spatialReference); diff --git a/packages/featureserver/src/query/render-features.spec.js b/packages/featureserver/src/query/render-features.spec.js index 4d9ecbe9..267c2521 100644 --- a/packages/featureserver/src/query/render-features.spec.js +++ b/packages/featureserver/src/query/render-features.spec.js @@ -533,9 +533,7 @@ describe('renderFeaturesResponse', () => { }); getCollectionCrsSpy.callCount.should.equal(0); normalizeSpatialReferenceSpy.callCount.should.equal(1); - normalizeSpatialReferenceSpy.firstCall.args.should.deepEqual([ - 'wkt-here', - ]); + normalizeSpatialReferenceSpy.firstCall.args.should.deepEqual(['wkt-here']); }); }); }); diff --git a/packages/featureserver/src/query/render-precalculated-statistics.js b/packages/featureserver/src/query/render-precalculated-statistics.js index 61133c1e..57f843c3 100644 --- a/packages/featureserver/src/query/render-precalculated-statistics.js +++ b/packages/featureserver/src/query/render-precalculated-statistics.js @@ -6,9 +6,7 @@ const { isDate } = require('../helpers/data-type-utils'); function renderPrecalculatedStatisticsResponse(input, options) { const { statistics } = input; - const normalizedStatistics = Array.isArray(statistics) - ? statistics - : [statistics]; + const normalizedStatistics = Array.isArray(statistics) ? statistics : [statistics]; const fields = StatisticsFields.create({ ...input, ...options, diff --git a/packages/featureserver/src/query/render-statistics.js b/packages/featureserver/src/query/render-statistics.js index 86cde174..fa711f21 100644 --- a/packages/featureserver/src/query/render-statistics.js +++ b/packages/featureserver/src/query/render-statistics.js @@ -2,9 +2,7 @@ const { StatisticsFields } = require('../helpers/fields'); function renderStatisticsResponse(input = {}, options = {}) { const { statistics } = input; - const normalizedStatistics = Array.isArray(statistics) - ? statistics - : [statistics]; + const normalizedStatistics = Array.isArray(statistics) ? statistics : [statistics]; const features = normalizedStatistics.map((attributes) => { return { attributes }; }); diff --git a/packages/featureserver/src/query/validate-query-request-parameters.spec.js b/packages/featureserver/src/query/validate-query-request-parameters.spec.js index 23918c9c..9942d0b5 100644 --- a/packages/featureserver/src/query/validate-query-request-parameters.spec.js +++ b/packages/featureserver/src/query/validate-query-request-parameters.spec.js @@ -11,12 +11,8 @@ describe('validate-query-request-parameters', () => { }, }); } catch (error) { - error.message.should.deepEqual( - "'quantizationParameters' parameter is invalid", - ); - error.details.should.deepEqual([ - '"quantizationParameters.extent.xmin" is required', - ]); + error.message.should.deepEqual("'quantizationParameters' parameter is invalid"); + error.details.should.deepEqual(['"quantizationParameters.extent.xmin" is required']); error.code.should.equal(400); } }); diff --git a/packages/featureserver/src/queryRelatedRecords.js b/packages/featureserver/src/queryRelatedRecords.js index 1e636e57..d7f4def5 100644 --- a/packages/featureserver/src/queryRelatedRecords.js +++ b/packages/featureserver/src/queryRelatedRecords.js @@ -9,8 +9,7 @@ function queryRelatedRecords(data, params = {}) { relatedRecordGroups: [], }; - if (!params.returnCountOnly) - response.fields = QueryFields.create({ ...data, ...params }); + if (!params.returnCountOnly) response.fields = QueryFields.create({ ...data, ...params }); const geomType = getGeometryTypeFromGeojson(data); if (geomType) { @@ -22,20 +21,14 @@ function queryRelatedRecords(data, params = {}) { if (data.features) { response.relatedRecordGroups = data.features.map((featureCollection) => { - return convertFeaturesToRelatedRecordGroups( - featureCollection, - params.returnCountOnly, - ); + return convertFeaturesToRelatedRecordGroups(featureCollection, params.returnCountOnly); }); } return response; } -function convertFeaturesToRelatedRecordGroups( - { features, properties }, - returnCountOnly = false, -) { +function convertFeaturesToRelatedRecordGroups({ features, properties }, returnCountOnly = false) { const recordGroup = { objectId: properties.objectid, }; diff --git a/packages/featureserver/src/response-handlers/general-response-handler.js b/packages/featureserver/src/response-handlers/general-response-handler.js index c3f23520..b9d59648 100644 --- a/packages/featureserver/src/response-handlers/general-response-handler.js +++ b/packages/featureserver/src/response-handlers/general-response-handler.js @@ -1,10 +1,6 @@ const { sendCallbackResponse, sendPrettyJson } = require('./helpers'); -module.exports = function generalResponseHandler( - res, - payload, - requestParameters, -) { +module.exports = function generalResponseHandler(res, payload, requestParameters) { const { f, callback } = requestParameters; if (typeof callback === 'string') { diff --git a/packages/featureserver/src/response-handlers/general-response-handler.spec.js b/packages/featureserver/src/response-handlers/general-response-handler.spec.js index 255479f0..e4b2e304 100644 --- a/packages/featureserver/src/response-handlers/general-response-handler.spec.js +++ b/packages/featureserver/src/response-handlers/general-response-handler.spec.js @@ -57,11 +57,7 @@ describe('general response handler', () => { }, ); - sendCallbackResponseSpy.firstCall.args.should.deepEqual([ - res, - { test: true }, - 'test-callback', - ]); + sendCallbackResponseSpy.firstCall.args.should.deepEqual([res, { test: true }, 'test-callback']); }); it('send as pretty json', () => { diff --git a/packages/featureserver/src/response-handlers/helpers/send-callback.spec.js b/packages/featureserver/src/response-handlers/helpers/send-callback.spec.js index 6f73b22e..0e563210 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-callback.spec.js +++ b/packages/featureserver/src/response-handlers/helpers/send-callback.spec.js @@ -15,10 +15,7 @@ const res = { describe('sendCallbackResponse', () => { it('should respond with callback string', () => { sendCallbackResponse(res, { hello: 'world' }, 'what'); - res.set.firstCall.args.should.deepEqual([ - 'Content-Type', - 'application/javascript', - ]); + res.set.firstCall.args.should.deepEqual(['Content-Type', 'application/javascript']); res.send.firstCall.args[0].should.equal('what({"hello":"world"})'); res.status.firstCall.args[0].should.be.exactly(200); }); diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/FeatureCollection.proto.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/FeatureCollection.proto.js index df3c634b..92c514cc 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/FeatureCollection.proto.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/FeatureCollection.proto.js @@ -1,3 +1,4 @@ +/* eslint-disable */ // TODO: move this to a npm 'use strict'; @@ -27,15 +28,9 @@ $root.esriPBuffer = (function () { FeatureCollectionPBuffer.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.version != null && - Object.hasOwnProperty.call(message, 'version') - ) + if (message.version != null && Object.hasOwnProperty.call(message, 'version')) writer.uint32(10).string(message.version); - if ( - message.queryResult != null && - Object.hasOwnProperty.call(message, 'queryResult') - ) + if (message.queryResult != null && Object.hasOwnProperty.call(message, 'queryResult')) $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.encode( message.queryResult, writer.uint32(18).fork(), @@ -43,45 +38,33 @@ $root.esriPBuffer = (function () { return writer; }; - FeatureCollectionPBuffer.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + FeatureCollectionPBuffer.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; FeatureCollectionPBuffer.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.version != null && message.hasOwnProperty('version')) if (!$util.isString(message.version)) return 'version: string expected'; - if ( - message.queryResult != null && - message.hasOwnProperty('queryResult') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.verify( - message.queryResult, - ); + if (message.queryResult != null && message.hasOwnProperty('queryResult')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.verify( + message.queryResult, + ); if (error) return 'queryResult.' + error; } return null; }; FeatureCollectionPBuffer.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer(); if (object.version != null) message.version = String(object.version); if (object.queryResult != null) { if (typeof object.queryResult !== 'object') - throw TypeError( - '.esriPBuffer.FeatureCollectionPBuffer.queryResult: object expected', - ); - message.queryResult = - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.fromObject( - object.queryResult, - ); + throw TypeError('.esriPBuffer.FeatureCollectionPBuffer.queryResult: object expected'); + message.queryResult = $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.fromObject( + object.queryResult, + ); } return message; }; @@ -96,11 +79,10 @@ $root.esriPBuffer = (function () { if (message.version != null && message.hasOwnProperty('version')) object.version = message.version; if (message.queryResult != null && message.hasOwnProperty('queryResult')) - object.queryResult = - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.toObject( - message.queryResult, - options, - ); + object.queryResult = $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.toObject( + message.queryResult, + options, + ); return object; }; @@ -196,8 +178,7 @@ $root.esriPBuffer = (function () { function SpatialReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } SpatialReference.prototype.wkid = 0; @@ -214,72 +195,44 @@ $root.esriPBuffer = (function () { if (!writer) writer = $Writer.create(); if (message.wkid != null && Object.hasOwnProperty.call(message, 'wkid')) writer.uint32(8).uint32(message.wkid); - if ( - message.lastestWkid != null && - Object.hasOwnProperty.call(message, 'lastestWkid') - ) + if (message.lastestWkid != null && Object.hasOwnProperty.call(message, 'lastestWkid')) writer.uint32(16).uint32(message.lastestWkid); - if ( - message.vcsWkid != null && - Object.hasOwnProperty.call(message, 'vcsWkid') - ) + if (message.vcsWkid != null && Object.hasOwnProperty.call(message, 'vcsWkid')) writer.uint32(24).uint32(message.vcsWkid); - if ( - message.latestVcsWkid != null && - Object.hasOwnProperty.call(message, 'latestVcsWkid') - ) + if (message.latestVcsWkid != null && Object.hasOwnProperty.call(message, 'latestVcsWkid')) writer.uint32(32).uint32(message.latestVcsWkid); if (message.wkt != null && Object.hasOwnProperty.call(message, 'wkt')) writer.uint32(42).string(message.wkt); return writer; }; - SpatialReference.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + SpatialReference.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; SpatialReference.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.wkid != null && message.hasOwnProperty('wkid')) if (!$util.isInteger(message.wkid)) return 'wkid: integer expected'; - if ( - message.lastestWkid != null && - message.hasOwnProperty('lastestWkid') - ) - if (!$util.isInteger(message.lastestWkid)) - return 'lastestWkid: integer expected'; + if (message.lastestWkid != null && message.hasOwnProperty('lastestWkid')) + if (!$util.isInteger(message.lastestWkid)) return 'lastestWkid: integer expected'; if (message.vcsWkid != null && message.hasOwnProperty('vcsWkid')) - if (!$util.isInteger(message.vcsWkid)) - return 'vcsWkid: integer expected'; - if ( - message.latestVcsWkid != null && - message.hasOwnProperty('latestVcsWkid') - ) - if (!$util.isInteger(message.latestVcsWkid)) - return 'latestVcsWkid: integer expected'; + if (!$util.isInteger(message.vcsWkid)) return 'vcsWkid: integer expected'; + if (message.latestVcsWkid != null && message.hasOwnProperty('latestVcsWkid')) + if (!$util.isInteger(message.latestVcsWkid)) return 'latestVcsWkid: integer expected'; if (message.wkt != null && message.hasOwnProperty('wkt')) if (!$util.isString(message.wkt)) return 'wkt: string expected'; return null; }; SpatialReference.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference(); if (object.wkid != null) message.wkid = object.wkid >>> 0; - if (object.lastestWkid != null) - message.lastestWkid = object.lastestWkid >>> 0; + if (object.lastestWkid != null) message.lastestWkid = object.lastestWkid >>> 0; if (object.vcsWkid != null) message.vcsWkid = object.vcsWkid >>> 0; - if (object.latestVcsWkid != null) - message.latestVcsWkid = object.latestVcsWkid >>> 0; + if (object.latestVcsWkid != null) message.latestVcsWkid = object.latestVcsWkid >>> 0; if (object.wkt != null) message.wkt = String(object.wkt); return message; }; @@ -294,22 +247,14 @@ $root.esriPBuffer = (function () { object.latestVcsWkid = 0; object.wkt = ''; } - if (message.wkid != null && message.hasOwnProperty('wkid')) - object.wkid = message.wkid; - if ( - message.lastestWkid != null && - message.hasOwnProperty('lastestWkid') - ) + if (message.wkid != null && message.hasOwnProperty('wkid')) object.wkid = message.wkid; + if (message.lastestWkid != null && message.hasOwnProperty('lastestWkid')) object.lastestWkid = message.lastestWkid; if (message.vcsWkid != null && message.hasOwnProperty('vcsWkid')) object.vcsWkid = message.vcsWkid; - if ( - message.latestVcsWkid != null && - message.hasOwnProperty('latestVcsWkid') - ) + if (message.latestVcsWkid != null && message.hasOwnProperty('latestVcsWkid')) object.latestVcsWkid = message.latestVcsWkid; - if (message.wkt != null && message.hasOwnProperty('wkt')) - object.wkt = message.wkt; + if (message.wkt != null && message.hasOwnProperty('wkt')) object.wkt = message.wkt; return object; }; @@ -321,10 +266,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.SpatialReference' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.SpatialReference'; }; return SpatialReference; @@ -334,8 +276,7 @@ $root.esriPBuffer = (function () { function Field(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Field.prototype.name = ''; @@ -353,30 +294,15 @@ $root.esriPBuffer = (function () { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, 'name')) writer.uint32(10).string(message.name); - if ( - message.fieldType != null && - Object.hasOwnProperty.call(message, 'fieldType') - ) + if (message.fieldType != null && Object.hasOwnProperty.call(message, 'fieldType')) writer.uint32(16).int32(message.fieldType); - if ( - message.alias != null && - Object.hasOwnProperty.call(message, 'alias') - ) + if (message.alias != null && Object.hasOwnProperty.call(message, 'alias')) writer.uint32(26).string(message.alias); - if ( - message.sqlType != null && - Object.hasOwnProperty.call(message, 'sqlType') - ) + if (message.sqlType != null && Object.hasOwnProperty.call(message, 'sqlType')) writer.uint32(32).int32(message.sqlType); - if ( - message.domain != null && - Object.hasOwnProperty.call(message, 'domain') - ) + if (message.domain != null && Object.hasOwnProperty.call(message, 'domain')) writer.uint32(42).string(message.domain); - if ( - message.defaultValue != null && - Object.hasOwnProperty.call(message, 'defaultValue') - ) + if (message.defaultValue != null && Object.hasOwnProperty.call(message, 'defaultValue')) writer.uint32(50).string(message.defaultValue); return writer; }; @@ -386,8 +312,7 @@ $root.esriPBuffer = (function () { }; Field.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.name != null && message.hasOwnProperty('name')) if (!$util.isString(message.name)) return 'name: string expected'; if (message.fieldType != null && message.hasOwnProperty('fieldType')) @@ -450,18 +375,13 @@ $root.esriPBuffer = (function () { } if (message.domain != null && message.hasOwnProperty('domain')) if (!$util.isString(message.domain)) return 'domain: string expected'; - if ( - message.defaultValue != null && - message.hasOwnProperty('defaultValue') - ) - if (!$util.isString(message.defaultValue)) - return 'defaultValue: string expected'; + if (message.defaultValue != null && message.hasOwnProperty('defaultValue')) + if (!$util.isString(message.defaultValue)) return 'defaultValue: string expected'; return null; }; Field.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Field) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Field) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Field(); if (object.name != null) message.name = String(object.name); switch (object.fieldType) { @@ -658,8 +578,7 @@ $root.esriPBuffer = (function () { break; } if (object.domain != null) message.domain = String(object.domain); - if (object.defaultValue != null) - message.defaultValue = String(object.defaultValue); + if (object.defaultValue != null) message.defaultValue = String(object.defaultValue); return message; }; @@ -668,45 +587,32 @@ $root.esriPBuffer = (function () { var object = {}; if (options.defaults) { object.name = ''; - object.fieldType = - options.enums === String ? 'esriFieldTypeSmallInteger' : 0; + object.fieldType = options.enums === String ? 'esriFieldTypeSmallInteger' : 0; object.alias = ''; object.sqlType = options.enums === String ? 'sqlTypeBigInt' : 0; object.domain = ''; object.defaultValue = ''; } - if (message.name != null && message.hasOwnProperty('name')) - object.name = message.name; + if (message.name != null && message.hasOwnProperty('name')) object.name = message.name; if (message.fieldType != null && message.hasOwnProperty('fieldType')) object.fieldType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[ - message.fieldType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[message.fieldType] === + undefined ? message.fieldType - : $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[ - message.fieldType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[message.fieldType] : message.fieldType; - if (message.alias != null && message.hasOwnProperty('alias')) - object.alias = message.alias; + if (message.alias != null && message.hasOwnProperty('alias')) object.alias = message.alias; if (message.sqlType != null && message.hasOwnProperty('sqlType')) object.sqlType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[ - message.sqlType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[message.sqlType] === undefined ? message.sqlType - : $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[ - message.sqlType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[message.sqlType] : message.sqlType; if (message.domain != null && message.hasOwnProperty('domain')) object.domain = message.domain; - if ( - message.defaultValue != null && - message.hasOwnProperty('defaultValue') - ) + if (message.defaultValue != null && message.hasOwnProperty('defaultValue')) object.defaultValue = message.defaultValue; return object; }; @@ -729,8 +635,7 @@ $root.esriPBuffer = (function () { function GeometryField(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } GeometryField.prototype.field = null; @@ -742,42 +647,27 @@ $root.esriPBuffer = (function () { GeometryField.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.field != null && - Object.hasOwnProperty.call(message, 'field') - ) + if (message.field != null && Object.hasOwnProperty.call(message, 'field')) $root.esriPBuffer.FeatureCollectionPBuffer.Field.encode( message.field, writer.uint32(10).fork(), ).ldelim(); - if ( - message.geometryType != null && - Object.hasOwnProperty.call(message, 'geometryType') - ) + if (message.geometryType != null && Object.hasOwnProperty.call(message, 'geometryType')) writer.uint32(16).int32(message.geometryType); return writer; }; - GeometryField.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + GeometryField.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; GeometryField.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.field != null && message.hasOwnProperty('field')) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify( - message.field, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify(message.field); if (error) return 'field.' + error; } - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + if (message.geometryType != null && message.hasOwnProperty('geometryType')) switch (message.geometryType) { default: return 'geometryType: enum value expected'; @@ -794,22 +684,15 @@ $root.esriPBuffer = (function () { }; GeometryField.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField(); if (object.field != null) { if (typeof object.field !== 'object') throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.GeometryField.field: object expected', ); - message.field = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject( - object.field, - ); + message.field = $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject(object.field); } switch (object.geometryType) { default: @@ -855,28 +738,20 @@ $root.esriPBuffer = (function () { var object = {}; if (options.defaults) { object.field = null; - object.geometryType = - options.enums === String ? 'esriGeometryTypePoint' : 0; + object.geometryType = options.enums === String ? 'esriGeometryTypePoint' : 0; } if (message.field != null && message.hasOwnProperty('field')) - object.field = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( - message.field, - options, - ); - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + object.field = $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( + message.field, + options, + ); + if (message.geometryType != null && message.hasOwnProperty('geometryType')) object.geometryType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] === + undefined ? message.geometryType - : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] : message.geometryType; return object; }; @@ -889,9 +764,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.GeometryField' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.GeometryField'; }; return GeometryField; @@ -901,8 +774,7 @@ $root.esriPBuffer = (function () { function Envelope(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Envelope.prototype.XMin = 0; @@ -941,8 +813,7 @@ $root.esriPBuffer = (function () { }; Envelope.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.XMin != null && message.hasOwnProperty('XMin')) if (typeof message.XMin !== 'number') return 'XMin: number expected'; if (message.YMin != null && message.hasOwnProperty('YMin')) @@ -951,24 +822,17 @@ $root.esriPBuffer = (function () { if (typeof message.XMax !== 'number') return 'XMax: number expected'; if (message.YMax != null && message.hasOwnProperty('YMax')) if (typeof message.YMax !== 'number') return 'YMax: number expected'; - if ( - message.SpatialReference != null && - message.hasOwnProperty('SpatialReference') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( - message.SpatialReference, - ); + if (message.SpatialReference != null && message.hasOwnProperty('SpatialReference')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( + message.SpatialReference, + ); if (error) return 'SpatialReference.' + error; } return null; }; Envelope.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Envelope - ) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Envelope) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Envelope(); if (object.XMin != null) message.XMin = Number(object.XMin); if (object.YMin != null) message.YMin = Number(object.YMin); @@ -999,28 +863,17 @@ $root.esriPBuffer = (function () { } if (message.XMin != null && message.hasOwnProperty('XMin')) object.XMin = - options.json && !isFinite(message.XMin) - ? String(message.XMin) - : message.XMin; + options.json && !isFinite(message.XMin) ? String(message.XMin) : message.XMin; if (message.YMin != null && message.hasOwnProperty('YMin')) object.YMin = - options.json && !isFinite(message.YMin) - ? String(message.YMin) - : message.YMin; + options.json && !isFinite(message.YMin) ? String(message.YMin) : message.YMin; if (message.XMax != null && message.hasOwnProperty('XMax')) object.XMax = - options.json && !isFinite(message.XMax) - ? String(message.XMax) - : message.XMax; + options.json && !isFinite(message.XMax) ? String(message.XMax) : message.XMax; if (message.YMax != null && message.hasOwnProperty('YMax')) object.YMax = - options.json && !isFinite(message.YMax) - ? String(message.YMax) - : message.YMax; - if ( - message.SpatialReference != null && - message.hasOwnProperty('SpatialReference') - ) + options.json && !isFinite(message.YMax) ? String(message.YMax) : message.YMax; + if (message.SpatialReference != null && message.hasOwnProperty('SpatialReference')) object.SpatialReference = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.toObject( message.SpatialReference, @@ -1047,8 +900,7 @@ $root.esriPBuffer = (function () { function Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Value.prototype.stringValue = null; @@ -1086,50 +938,23 @@ $root.esriPBuffer = (function () { Value.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.stringValue != null && - Object.hasOwnProperty.call(message, 'stringValue') - ) + if (message.stringValue != null && Object.hasOwnProperty.call(message, 'stringValue')) writer.uint32(10).string(message.stringValue); - if ( - message.floatValue != null && - Object.hasOwnProperty.call(message, 'floatValue') - ) + if (message.floatValue != null && Object.hasOwnProperty.call(message, 'floatValue')) writer.uint32(21).float(message.floatValue); - if ( - message.doubleValue != null && - Object.hasOwnProperty.call(message, 'doubleValue') - ) + if (message.doubleValue != null && Object.hasOwnProperty.call(message, 'doubleValue')) writer.uint32(25).double(message.doubleValue); - if ( - message.sintValue != null && - Object.hasOwnProperty.call(message, 'sintValue') - ) + if (message.sintValue != null && Object.hasOwnProperty.call(message, 'sintValue')) writer.uint32(32).sint32(message.sintValue); - if ( - message.uintValue != null && - Object.hasOwnProperty.call(message, 'uintValue') - ) + if (message.uintValue != null && Object.hasOwnProperty.call(message, 'uintValue')) writer.uint32(40).uint32(message.uintValue); - if ( - message.int64Value != null && - Object.hasOwnProperty.call(message, 'int64Value') - ) + if (message.int64Value != null && Object.hasOwnProperty.call(message, 'int64Value')) writer.uint32(48).int64(message.int64Value); - if ( - message.uint64Value != null && - Object.hasOwnProperty.call(message, 'uint64Value') - ) + if (message.uint64Value != null && Object.hasOwnProperty.call(message, 'uint64Value')) writer.uint32(56).uint64(message.uint64Value); - if ( - message.sint64Value != null && - Object.hasOwnProperty.call(message, 'sint64Value') - ) + if (message.sint64Value != null && Object.hasOwnProperty.call(message, 'sint64Value')) writer.uint32(64).sint64(message.sint64Value); - if ( - message.boolValue != null && - Object.hasOwnProperty.call(message, 'boolValue') - ) + if (message.boolValue != null && Object.hasOwnProperty.call(message, 'boolValue')) writer.uint32(72).bool(message.boolValue); return writer; }; @@ -1139,51 +964,33 @@ $root.esriPBuffer = (function () { }; Value.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; var properties = {}; - if ( - message.stringValue != null && - message.hasOwnProperty('stringValue') - ) { + if (message.stringValue != null && message.hasOwnProperty('stringValue')) { properties.valueType = 1; - if (!$util.isString(message.stringValue)) - return 'stringValue: string expected'; + if (!$util.isString(message.stringValue)) return 'stringValue: string expected'; } - if ( - message.floatValue != null && - message.hasOwnProperty('floatValue') - ) { + if (message.floatValue != null && message.hasOwnProperty('floatValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (typeof message.floatValue !== 'number') - return 'floatValue: number expected'; + if (typeof message.floatValue !== 'number') return 'floatValue: number expected'; } - if ( - message.doubleValue != null && - message.hasOwnProperty('doubleValue') - ) { + if (message.doubleValue != null && message.hasOwnProperty('doubleValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (typeof message.doubleValue !== 'number') - return 'doubleValue: number expected'; + if (typeof message.doubleValue !== 'number') return 'doubleValue: number expected'; } if (message.sintValue != null && message.hasOwnProperty('sintValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (!$util.isInteger(message.sintValue)) - return 'sintValue: integer expected'; + if (!$util.isInteger(message.sintValue)) return 'sintValue: integer expected'; } if (message.uintValue != null && message.hasOwnProperty('uintValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (!$util.isInteger(message.uintValue)) - return 'uintValue: integer expected'; + if (!$util.isInteger(message.uintValue)) return 'uintValue: integer expected'; } - if ( - message.int64Value != null && - message.hasOwnProperty('int64Value') - ) { + if (message.int64Value != null && message.hasOwnProperty('int64Value')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; if ( @@ -1196,10 +1003,7 @@ $root.esriPBuffer = (function () { ) return 'int64Value: integer|Long expected'; } - if ( - message.uint64Value != null && - message.hasOwnProperty('uint64Value') - ) { + if (message.uint64Value != null && message.hasOwnProperty('uint64Value')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; if ( @@ -1212,10 +1016,7 @@ $root.esriPBuffer = (function () { ) return 'uint64Value: integer|Long expected'; } - if ( - message.sint64Value != null && - message.hasOwnProperty('sint64Value') - ) { + if (message.sint64Value != null && message.hasOwnProperty('sint64Value')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; if ( @@ -1231,34 +1032,25 @@ $root.esriPBuffer = (function () { if (message.boolValue != null && message.hasOwnProperty('boolValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (typeof message.boolValue !== 'boolean') - return 'boolValue: boolean expected'; + if (typeof message.boolValue !== 'boolean') return 'boolValue: boolean expected'; } return null; }; Value.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Value) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Value) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Value(); - if (object.stringValue != null) - message.stringValue = String(object.stringValue); - if (object.floatValue != null) - message.floatValue = Number(object.floatValue); - if (object.doubleValue != null) - message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) message.stringValue = String(object.stringValue); + if (object.floatValue != null) message.floatValue = Number(object.floatValue); + if (object.doubleValue != null) message.doubleValue = Number(object.doubleValue); if (object.sintValue != null) message.sintValue = object.sintValue | 0; - if (object.uintValue != null) - message.uintValue = object.uintValue >>> 0; + if (object.uintValue != null) message.uintValue = object.uintValue >>> 0; if (object.int64Value != null) if ($util.Long) - (message.int64Value = $util.Long.fromValue( - object.int64Value, - )).unsigned = false; + (message.int64Value = $util.Long.fromValue(object.int64Value)).unsigned = false; else if (typeof object.int64Value === 'string') message.int64Value = parseInt(object.int64Value, 10); - else if (typeof object.int64Value === 'number') - message.int64Value = object.int64Value; + else if (typeof object.int64Value === 'number') message.int64Value = object.int64Value; else if (typeof object.int64Value === 'object') message.int64Value = new $util.LongBits( object.int64Value.low >>> 0, @@ -1266,13 +1058,10 @@ $root.esriPBuffer = (function () { ).toNumber(); if (object.uint64Value != null) if ($util.Long) - (message.uint64Value = $util.Long.fromValue( - object.uint64Value, - )).unsigned = true; + (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; else if (typeof object.uint64Value === 'string') message.uint64Value = parseInt(object.uint64Value, 10); - else if (typeof object.uint64Value === 'number') - message.uint64Value = object.uint64Value; + else if (typeof object.uint64Value === 'number') message.uint64Value = object.uint64Value; else if (typeof object.uint64Value === 'object') message.uint64Value = new $util.LongBits( object.uint64Value.low >>> 0, @@ -1280,47 +1069,34 @@ $root.esriPBuffer = (function () { ).toNumber(true); if (object.sint64Value != null) if ($util.Long) - (message.sint64Value = $util.Long.fromValue( - object.sint64Value, - )).unsigned = false; + (message.sint64Value = $util.Long.fromValue(object.sint64Value)).unsigned = false; else if (typeof object.sint64Value === 'string') message.sint64Value = parseInt(object.sint64Value, 10); - else if (typeof object.sint64Value === 'number') - message.sint64Value = object.sint64Value; + else if (typeof object.sint64Value === 'number') message.sint64Value = object.sint64Value; else if (typeof object.sint64Value === 'object') message.sint64Value = new $util.LongBits( object.sint64Value.low >>> 0, object.sint64Value.high >>> 0, ).toNumber(); - if (object.boolValue != null) - message.boolValue = Boolean(object.boolValue); + if (object.boolValue != null) message.boolValue = Boolean(object.boolValue); return message; }; Value.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if ( - message.stringValue != null && - message.hasOwnProperty('stringValue') - ) { + if (message.stringValue != null && message.hasOwnProperty('stringValue')) { object.stringValue = message.stringValue; if (options.oneofs) object.valueType = 'stringValue'; } - if ( - message.floatValue != null && - message.hasOwnProperty('floatValue') - ) { + if (message.floatValue != null && message.hasOwnProperty('floatValue')) { object.floatValue = options.json && !isFinite(message.floatValue) ? String(message.floatValue) : message.floatValue; if (options.oneofs) object.valueType = 'floatValue'; } - if ( - message.doubleValue != null && - message.hasOwnProperty('doubleValue') - ) { + if (message.doubleValue != null && message.hasOwnProperty('doubleValue')) { object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) @@ -1335,15 +1111,10 @@ $root.esriPBuffer = (function () { object.uintValue = message.uintValue; if (options.oneofs) object.valueType = 'uintValue'; } - if ( - message.int64Value != null && - message.hasOwnProperty('int64Value') - ) { + if (message.int64Value != null && message.hasOwnProperty('int64Value')) { if (typeof message.int64Value === 'number') object.int64Value = - options.longs === String - ? String(message.int64Value) - : message.int64Value; + options.longs === String ? String(message.int64Value) : message.int64Value; else object.int64Value = options.longs === String @@ -1356,15 +1127,10 @@ $root.esriPBuffer = (function () { : message.int64Value; if (options.oneofs) object.valueType = 'int64Value'; } - if ( - message.uint64Value != null && - message.hasOwnProperty('uint64Value') - ) { + if (message.uint64Value != null && message.hasOwnProperty('uint64Value')) { if (typeof message.uint64Value === 'number') object.uint64Value = - options.longs === String - ? String(message.uint64Value) - : message.uint64Value; + options.longs === String ? String(message.uint64Value) : message.uint64Value; else object.uint64Value = options.longs === String @@ -1377,15 +1143,10 @@ $root.esriPBuffer = (function () { : message.uint64Value; if (options.oneofs) object.valueType = 'uint64Value'; } - if ( - message.sint64Value != null && - message.hasOwnProperty('sint64Value') - ) { + if (message.sint64Value != null && message.hasOwnProperty('sint64Value')) { if (typeof message.sint64Value === 'number') object.sint64Value = - options.longs === String - ? String(message.sint64Value) - : message.sint64Value; + options.longs === String ? String(message.sint64Value) : message.sint64Value; else object.sint64Value = options.longs === String @@ -1425,8 +1186,7 @@ $root.esriPBuffer = (function () { this.coords = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Geometry.prototype.geometryType = 0; @@ -1439,21 +1199,16 @@ $root.esriPBuffer = (function () { Geometry.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.geometryType != null && - Object.hasOwnProperty.call(message, 'geometryType') - ) + if (message.geometryType != null && Object.hasOwnProperty.call(message, 'geometryType')) writer.uint32(8).int32(message.geometryType); if (message.lengths != null && message.lengths.length) { writer.uint32(18).fork(); - for (var i = 0; i < message.lengths.length; ++i) - writer.uint32(message.lengths[i]); + for (var i = 0; i < message.lengths.length; ++i) writer.uint32(message.lengths[i]); writer.ldelim(); } if (message.coords != null && message.coords.length) { writer.uint32(26).fork(); - for (var i = 0; i < message.coords.length; ++i) - writer.sint64(message.coords[i]); + for (var i = 0; i < message.coords.length; ++i) writer.sint64(message.coords[i]); writer.ldelim(); } return writer; @@ -1464,12 +1219,8 @@ $root.esriPBuffer = (function () { }; Geometry.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.geometryType != null && message.hasOwnProperty('geometryType')) switch (message.geometryType) { default: return 'geometryType: enum value expected'; @@ -1485,8 +1236,7 @@ $root.esriPBuffer = (function () { if (message.lengths != null && message.hasOwnProperty('lengths')) { if (!Array.isArray(message.lengths)) return 'lengths: array expected'; for (var i = 0; i < message.lengths.length; ++i) - if (!$util.isInteger(message.lengths[i])) - return 'lengths: integer[] expected'; + if (!$util.isInteger(message.lengths[i])) return 'lengths: integer[] expected'; } if (message.coords != null && message.hasOwnProperty('coords')) { if (!Array.isArray(message.coords)) return 'coords: array expected'; @@ -1505,10 +1255,7 @@ $root.esriPBuffer = (function () { }; Geometry.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Geometry - ) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Geometry) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Geometry(); switch (object.geometryType) { default: @@ -1563,13 +1310,10 @@ $root.esriPBuffer = (function () { message.coords = []; for (var i = 0; i < object.coords.length; ++i) if ($util.Long) - (message.coords[i] = $util.Long.fromValue( - object.coords[i], - )).unsigned = false; + (message.coords[i] = $util.Long.fromValue(object.coords[i])).unsigned = false; else if (typeof object.coords[i] === 'string') message.coords[i] = parseInt(object.coords[i], 10); - else if (typeof object.coords[i] === 'number') - message.coords[i] = object.coords[i]; + else if (typeof object.coords[i] === 'number') message.coords[i] = object.coords[i]; else if (typeof object.coords[i] === 'object') message.coords[i] = new $util.LongBits( object.coords[i].low >>> 0, @@ -1587,35 +1331,25 @@ $root.esriPBuffer = (function () { object.coords = []; } if (options.defaults) - object.geometryType = - options.enums === String ? 'esriGeometryTypePoint' : 0; - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + object.geometryType = options.enums === String ? 'esriGeometryTypePoint' : 0; + if (message.geometryType != null && message.hasOwnProperty('geometryType')) object.geometryType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] === + undefined ? message.geometryType - : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] : message.geometryType; if (message.lengths && message.lengths.length) { object.lengths = []; - for (var j = 0; j < message.lengths.length; ++j) - object.lengths[j] = message.lengths[j]; + for (var j = 0; j < message.lengths.length; ++j) object.lengths[j] = message.lengths[j]; } if (message.coords && message.coords.length) { object.coords = []; for (var j = 0; j < message.coords.length; ++j) if (typeof message.coords[j] === 'number') object.coords[j] = - options.longs === String - ? String(message.coords[j]) - : message.coords[j]; + options.longs === String ? String(message.coords[j]) : message.coords[j]; else object.coords[j] = options.longs === String @@ -1648,8 +1382,7 @@ $root.esriPBuffer = (function () { function esriShapeBuffer(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } esriShapeBuffer.prototype.bytes = $util.newBuffer([]); @@ -1660,24 +1393,17 @@ $root.esriPBuffer = (function () { esriShapeBuffer.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.bytes != null && - Object.hasOwnProperty.call(message, 'bytes') - ) + if (message.bytes != null && Object.hasOwnProperty.call(message, 'bytes')) writer.uint32(10).bytes(message.bytes); return writer; }; - esriShapeBuffer.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + esriShapeBuffer.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; esriShapeBuffer.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.bytes != null && message.hasOwnProperty('bytes')) if ( !( @@ -1690,20 +1416,14 @@ $root.esriPBuffer = (function () { }; esriShapeBuffer.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer(); if (object.bytes != null) if (typeof object.bytes === 'string') $util.base64.decode( object.bytes, - (message.bytes = $util.newBuffer( - $util.base64.length(object.bytes), - )), + (message.bytes = $util.newBuffer($util.base64.length(object.bytes))), 0, ); else if (object.bytes.length >= 0) message.bytes = object.bytes; @@ -1717,8 +1437,7 @@ $root.esriPBuffer = (function () { if (options.bytes === String) object.bytes = ''; else { object.bytes = []; - if (options.bytes !== Array) - object.bytes = $util.newBuffer(object.bytes); + if (options.bytes !== Array) object.bytes = $util.newBuffer(object.bytes); } if (message.bytes != null && message.hasOwnProperty('bytes')) object.bytes = @@ -1738,10 +1457,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer'; }; return esriShapeBuffer; @@ -1753,8 +1469,7 @@ $root.esriPBuffer = (function () { this.aggregateGeometries = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Feature.prototype.attributes = $util.emptyArray; @@ -1783,42 +1498,27 @@ $root.esriPBuffer = (function () { message.attributes[i], writer.uint32(10).fork(), ).ldelim(); - if ( - message.geometry != null && - Object.hasOwnProperty.call(message, 'geometry') - ) + if (message.geometry != null && Object.hasOwnProperty.call(message, 'geometry')) $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.encode( message.geometry, writer.uint32(18).fork(), ).ldelim(); - if ( - message.shapeBuffer != null && - Object.hasOwnProperty.call(message, 'shapeBuffer') - ) + if (message.shapeBuffer != null && Object.hasOwnProperty.call(message, 'shapeBuffer')) $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer .encode(message.shapeBuffer, writer.uint32(26).fork()) .ldelim(); - if ( - message.centroid != null && - Object.hasOwnProperty.call(message, 'centroid') - ) + if (message.centroid != null && Object.hasOwnProperty.call(message, 'centroid')) $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.encode( message.centroid, writer.uint32(34).fork(), ).ldelim(); - if ( - message.aggregateGeometries != null && - message.aggregateGeometries.length - ) + if (message.aggregateGeometries != null && message.aggregateGeometries.length) for (var i = 0; i < message.aggregateGeometries.length; ++i) $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.encode( message.aggregateGeometries[i], writer.uint32(42).fork(), ).ldelim(); - if ( - message.envelope != null && - Object.hasOwnProperty.call(message, 'envelope') - ) + if (message.envelope != null && Object.hasOwnProperty.call(message, 'envelope')) $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.encode( message.envelope, writer.uint32(50).fork(), @@ -1831,15 +1531,10 @@ $root.esriPBuffer = (function () { }; Feature.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; var properties = {}; - if ( - message.attributes != null && - message.hasOwnProperty('attributes') - ) { - if (!Array.isArray(message.attributes)) - return 'attributes: array expected'; + if (message.attributes != null && message.hasOwnProperty('attributes')) { + if (!Array.isArray(message.attributes)) return 'attributes: array expected'; for (var i = 0; i < message.attributes.length; ++i) { var error = $root.esriPBuffer.FeatureCollectionPBuffer.Value.verify( message.attributes[i], @@ -1850,64 +1545,45 @@ $root.esriPBuffer = (function () { if (message.geometry != null && message.hasOwnProperty('geometry')) { properties.compressedGeometry = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( - message.geometry, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( + message.geometry, + ); if (error) return 'geometry.' + error; } } - if ( - message.shapeBuffer != null && - message.hasOwnProperty('shapeBuffer') - ) { - if (properties.compressedGeometry === 1) - return 'compressedGeometry: multiple values'; + if (message.shapeBuffer != null && message.hasOwnProperty('shapeBuffer')) { + if (properties.compressedGeometry === 1) return 'compressedGeometry: multiple values'; properties.compressedGeometry = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.verify( - message.shapeBuffer, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.verify( + message.shapeBuffer, + ); if (error) return 'shapeBuffer.' + error; } } if (message.centroid != null && message.hasOwnProperty('centroid')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( - message.centroid, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify(message.centroid); if (error) return 'centroid.' + error; } - if ( - message.aggregateGeometries != null && - message.hasOwnProperty('aggregateGeometries') - ) { + if (message.aggregateGeometries != null && message.hasOwnProperty('aggregateGeometries')) { if (!Array.isArray(message.aggregateGeometries)) return 'aggregateGeometries: array expected'; for (var i = 0; i < message.aggregateGeometries.length; ++i) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( - message.aggregateGeometries[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( + message.aggregateGeometries[i], + ); if (error) return 'aggregateGeometries.' + error; } } if (message.envelope != null && message.hasOwnProperty('envelope')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.verify( - message.envelope, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.verify(message.envelope); if (error) return 'envelope.' + error; } return null; }; Feature.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Feature - ) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Feature) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Feature(); if (object.attributes) { if (!Array.isArray(object.attributes)) @@ -1920,10 +1596,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.attributes: object expected', ); - message.attributes[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( - object.attributes[i], - ); + message.attributes[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( + object.attributes[i], + ); } } if (object.geometry != null) { @@ -1931,10 +1606,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.geometry: object expected', ); - message.geometry = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( - object.geometry, - ); + message.geometry = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( + object.geometry, + ); } if (object.shapeBuffer != null) { if (typeof object.shapeBuffer !== 'object') @@ -1951,10 +1625,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.centroid: object expected', ); - message.centroid = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( - object.centroid, - ); + message.centroid = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( + object.centroid, + ); } if (object.aggregateGeometries) { if (!Array.isArray(object.aggregateGeometries)) @@ -1978,10 +1651,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.envelope: object expected', ); - message.envelope = - $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.fromObject( - object.envelope, - ); + message.envelope = $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.fromObject( + object.envelope, + ); } return message; }; @@ -2000,37 +1672,30 @@ $root.esriPBuffer = (function () { if (message.attributes && message.attributes.length) { object.attributes = []; for (var j = 0; j < message.attributes.length; ++j) - object.attributes[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( - message.attributes[j], - options, - ); - } - if (message.geometry != null && message.hasOwnProperty('geometry')) { - object.geometry = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( - message.geometry, + object.attributes[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( + message.attributes[j], options, ); + } + if (message.geometry != null && message.hasOwnProperty('geometry')) { + object.geometry = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( + message.geometry, + options, + ); if (options.oneofs) object.compressedGeometry = 'geometry'; } - if ( - message.shapeBuffer != null && - message.hasOwnProperty('shapeBuffer') - ) { - object.shapeBuffer = - $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.toObject( - message.shapeBuffer, - options, - ); + if (message.shapeBuffer != null && message.hasOwnProperty('shapeBuffer')) { + object.shapeBuffer = $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.toObject( + message.shapeBuffer, + options, + ); if (options.oneofs) object.compressedGeometry = 'shapeBuffer'; } if (message.centroid != null && message.hasOwnProperty('centroid')) - object.centroid = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( - message.centroid, - options, - ); + object.centroid = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( + message.centroid, + options, + ); if (message.aggregateGeometries && message.aggregateGeometries.length) { object.aggregateGeometries = []; for (var j = 0; j < message.aggregateGeometries.length; ++j) @@ -2041,11 +1706,10 @@ $root.esriPBuffer = (function () { ); } if (message.envelope != null && message.hasOwnProperty('envelope')) - object.envelope = - $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.toObject( - message.envelope, - options, - ); + object.envelope = $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.toObject( + message.envelope, + options, + ); return object; }; @@ -2067,8 +1731,7 @@ $root.esriPBuffer = (function () { function UniqueIdField(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } UniqueIdField.prototype.name = ''; @@ -2090,35 +1753,24 @@ $root.esriPBuffer = (function () { return writer; }; - UniqueIdField.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + UniqueIdField.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; UniqueIdField.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.name != null && message.hasOwnProperty('name')) if (!$util.isString(message.name)) return 'name: string expected'; - if ( - message.isSystemMaintained != null && - message.hasOwnProperty('isSystemMaintained') - ) + if (message.isSystemMaintained != null && message.hasOwnProperty('isSystemMaintained')) if (typeof message.isSystemMaintained !== 'boolean') return 'isSystemMaintained: boolean expected'; return null; }; UniqueIdField.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField(); if (object.name != null) message.name = String(object.name); if (object.isSystemMaintained != null) message.isSystemMaintained = Boolean(object.isSystemMaintained); @@ -2132,12 +1784,8 @@ $root.esriPBuffer = (function () { object.name = ''; object.isSystemMaintained = false; } - if (message.name != null && message.hasOwnProperty('name')) - object.name = message.name; - if ( - message.isSystemMaintained != null && - message.hasOwnProperty('isSystemMaintained') - ) + if (message.name != null && message.hasOwnProperty('name')) object.name = message.name; + if (message.isSystemMaintained != null && message.hasOwnProperty('isSystemMaintained')) object.isSystemMaintained = message.isSystemMaintained; return object; }; @@ -2150,9 +1798,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.UniqueIdField' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.UniqueIdField'; }; return UniqueIdField; @@ -2162,8 +1808,7 @@ $root.esriPBuffer = (function () { function GeometryProperties(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } GeometryProperties.prototype.shapeAreaFieldName = ''; @@ -2186,34 +1831,21 @@ $root.esriPBuffer = (function () { Object.hasOwnProperty.call(message, 'shapeLengthFieldName') ) writer.uint32(18).string(message.shapeLengthFieldName); - if ( - message.units != null && - Object.hasOwnProperty.call(message, 'units') - ) + if (message.units != null && Object.hasOwnProperty.call(message, 'units')) writer.uint32(26).string(message.units); return writer; }; - GeometryProperties.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + GeometryProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; GeometryProperties.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.shapeAreaFieldName != null && - message.hasOwnProperty('shapeAreaFieldName') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.shapeAreaFieldName != null && message.hasOwnProperty('shapeAreaFieldName')) if (!$util.isString(message.shapeAreaFieldName)) return 'shapeAreaFieldName: string expected'; - if ( - message.shapeLengthFieldName != null && - message.hasOwnProperty('shapeLengthFieldName') - ) + if (message.shapeLengthFieldName != null && message.hasOwnProperty('shapeLengthFieldName')) if (!$util.isString(message.shapeLengthFieldName)) return 'shapeLengthFieldName: string expected'; if (message.units != null && message.hasOwnProperty('units')) @@ -2222,13 +1854,9 @@ $root.esriPBuffer = (function () { }; GeometryProperties.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties(); if (object.shapeAreaFieldName != null) message.shapeAreaFieldName = String(object.shapeAreaFieldName); if (object.shapeLengthFieldName != null) @@ -2245,18 +1873,11 @@ $root.esriPBuffer = (function () { object.shapeLengthFieldName = ''; object.units = ''; } - if ( - message.shapeAreaFieldName != null && - message.hasOwnProperty('shapeAreaFieldName') - ) + if (message.shapeAreaFieldName != null && message.hasOwnProperty('shapeAreaFieldName')) object.shapeAreaFieldName = message.shapeAreaFieldName; - if ( - message.shapeLengthFieldName != null && - message.hasOwnProperty('shapeLengthFieldName') - ) + if (message.shapeLengthFieldName != null && message.hasOwnProperty('shapeLengthFieldName')) object.shapeLengthFieldName = message.shapeLengthFieldName; - if (message.units != null && message.hasOwnProperty('units')) - object.units = message.units; + if (message.units != null && message.hasOwnProperty('units')) object.units = message.units; return object; }; @@ -2268,10 +1889,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.GeometryProperties' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.GeometryProperties'; }; return GeometryProperties; @@ -2281,16 +1899,11 @@ $root.esriPBuffer = (function () { function ServerGens(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } - ServerGens.prototype.minServerGen = $util.Long - ? $util.Long.fromBits(0, 0, true) - : 0; - ServerGens.prototype.serverGen = $util.Long - ? $util.Long.fromBits(0, 0, true) - : 0; + ServerGens.prototype.minServerGen = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; + ServerGens.prototype.serverGen = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; ServerGens.create = function create(properties) { return new ServerGens(properties); @@ -2298,15 +1911,9 @@ $root.esriPBuffer = (function () { ServerGens.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.minServerGen != null && - Object.hasOwnProperty.call(message, 'minServerGen') - ) + if (message.minServerGen != null && Object.hasOwnProperty.call(message, 'minServerGen')) writer.uint32(8).uint64(message.minServerGen); - if ( - message.serverGen != null && - Object.hasOwnProperty.call(message, 'serverGen') - ) + if (message.serverGen != null && Object.hasOwnProperty.call(message, 'serverGen')) writer.uint32(16).uint64(message.serverGen); return writer; }; @@ -2316,12 +1923,8 @@ $root.esriPBuffer = (function () { }; ServerGens.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.minServerGen != null && - message.hasOwnProperty('minServerGen') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.minServerGen != null && message.hasOwnProperty('minServerGen')) if ( !$util.isInteger(message.minServerGen) && !( @@ -2345,18 +1948,11 @@ $root.esriPBuffer = (function () { }; ServerGens.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens(); if (object.minServerGen != null) if ($util.Long) - (message.minServerGen = $util.Long.fromValue( - object.minServerGen, - )).unsigned = true; + (message.minServerGen = $util.Long.fromValue(object.minServerGen)).unsigned = true; else if (typeof object.minServerGen === 'string') message.minServerGen = parseInt(object.minServerGen, 10); else if (typeof object.minServerGen === 'number') @@ -2368,13 +1964,10 @@ $root.esriPBuffer = (function () { ).toNumber(true); if (object.serverGen != null) if ($util.Long) - (message.serverGen = $util.Long.fromValue( - object.serverGen, - )).unsigned = true; + (message.serverGen = $util.Long.fromValue(object.serverGen)).unsigned = true; else if (typeof object.serverGen === 'string') message.serverGen = parseInt(object.serverGen, 10); - else if (typeof object.serverGen === 'number') - message.serverGen = object.serverGen; + else if (typeof object.serverGen === 'number') message.serverGen = object.serverGen; else if (typeof object.serverGen === 'object') message.serverGen = new $util.LongBits( object.serverGen.low >>> 0, @@ -2406,15 +1999,10 @@ $root.esriPBuffer = (function () { : long; } else object.serverGen = options.longs === String ? '0' : 0; } - if ( - message.minServerGen != null && - message.hasOwnProperty('minServerGen') - ) + if (message.minServerGen != null && message.hasOwnProperty('minServerGen')) if (typeof message.minServerGen === 'number') object.minServerGen = - options.longs === String - ? String(message.minServerGen) - : message.minServerGen; + options.longs === String ? String(message.minServerGen) : message.minServerGen; else object.minServerGen = options.longs === String @@ -2428,9 +2016,7 @@ $root.esriPBuffer = (function () { if (message.serverGen != null && message.hasOwnProperty('serverGen')) if (typeof message.serverGen === 'number') object.serverGen = - options.longs === String - ? String(message.serverGen) - : message.serverGen; + options.longs === String ? String(message.serverGen) : message.serverGen; else object.serverGen = options.longs === String @@ -2452,9 +2038,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.ServerGens' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.ServerGens'; }; return ServerGens; @@ -2464,8 +2048,7 @@ $root.esriPBuffer = (function () { function Scale(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Scale.prototype.xScale = 0; @@ -2479,25 +2062,13 @@ $root.esriPBuffer = (function () { Scale.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.xScale != null && - Object.hasOwnProperty.call(message, 'xScale') - ) + if (message.xScale != null && Object.hasOwnProperty.call(message, 'xScale')) writer.uint32(9).double(message.xScale); - if ( - message.yScale != null && - Object.hasOwnProperty.call(message, 'yScale') - ) + if (message.yScale != null && Object.hasOwnProperty.call(message, 'yScale')) writer.uint32(17).double(message.yScale); - if ( - message.mScale != null && - Object.hasOwnProperty.call(message, 'mScale') - ) + if (message.mScale != null && Object.hasOwnProperty.call(message, 'mScale')) writer.uint32(25).double(message.mScale); - if ( - message.zScale != null && - Object.hasOwnProperty.call(message, 'zScale') - ) + if (message.zScale != null && Object.hasOwnProperty.call(message, 'zScale')) writer.uint32(33).double(message.zScale); return writer; }; @@ -2507,26 +2078,20 @@ $root.esriPBuffer = (function () { }; Scale.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.xScale != null && message.hasOwnProperty('xScale')) - if (typeof message.xScale !== 'number') - return 'xScale: number expected'; + if (typeof message.xScale !== 'number') return 'xScale: number expected'; if (message.yScale != null && message.hasOwnProperty('yScale')) - if (typeof message.yScale !== 'number') - return 'yScale: number expected'; + if (typeof message.yScale !== 'number') return 'yScale: number expected'; if (message.mScale != null && message.hasOwnProperty('mScale')) - if (typeof message.mScale !== 'number') - return 'mScale: number expected'; + if (typeof message.mScale !== 'number') return 'mScale: number expected'; if (message.zScale != null && message.hasOwnProperty('zScale')) - if (typeof message.zScale !== 'number') - return 'zScale: number expected'; + if (typeof message.zScale !== 'number') return 'zScale: number expected'; return null; }; Scale.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Scale) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Scale) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Scale(); if (object.xScale != null) message.xScale = Number(object.xScale); if (object.yScale != null) message.yScale = Number(object.yScale); @@ -2546,24 +2111,16 @@ $root.esriPBuffer = (function () { } if (message.xScale != null && message.hasOwnProperty('xScale')) object.xScale = - options.json && !isFinite(message.xScale) - ? String(message.xScale) - : message.xScale; + options.json && !isFinite(message.xScale) ? String(message.xScale) : message.xScale; if (message.yScale != null && message.hasOwnProperty('yScale')) object.yScale = - options.json && !isFinite(message.yScale) - ? String(message.yScale) - : message.yScale; + options.json && !isFinite(message.yScale) ? String(message.yScale) : message.yScale; if (message.mScale != null && message.hasOwnProperty('mScale')) object.mScale = - options.json && !isFinite(message.mScale) - ? String(message.mScale) - : message.mScale; + options.json && !isFinite(message.mScale) ? String(message.mScale) : message.mScale; if (message.zScale != null && message.hasOwnProperty('zScale')) object.zScale = - options.json && !isFinite(message.zScale) - ? String(message.zScale) - : message.zScale; + options.json && !isFinite(message.zScale) ? String(message.zScale) : message.zScale; return object; }; @@ -2585,8 +2142,7 @@ $root.esriPBuffer = (function () { function Translate(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Translate.prototype.xTranslate = 0; @@ -2600,25 +2156,13 @@ $root.esriPBuffer = (function () { Translate.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.xTranslate != null && - Object.hasOwnProperty.call(message, 'xTranslate') - ) + if (message.xTranslate != null && Object.hasOwnProperty.call(message, 'xTranslate')) writer.uint32(9).double(message.xTranslate); - if ( - message.yTranslate != null && - Object.hasOwnProperty.call(message, 'yTranslate') - ) + if (message.yTranslate != null && Object.hasOwnProperty.call(message, 'yTranslate')) writer.uint32(17).double(message.yTranslate); - if ( - message.mTranslate != null && - Object.hasOwnProperty.call(message, 'mTranslate') - ) + if (message.mTranslate != null && Object.hasOwnProperty.call(message, 'mTranslate')) writer.uint32(25).double(message.mTranslate); - if ( - message.zTranslate != null && - Object.hasOwnProperty.call(message, 'zTranslate') - ) + if (message.zTranslate != null && Object.hasOwnProperty.call(message, 'zTranslate')) writer.uint32(33).double(message.zTranslate); return writer; }; @@ -2628,38 +2172,25 @@ $root.esriPBuffer = (function () { }; Translate.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.xTranslate != null && message.hasOwnProperty('xTranslate')) - if (typeof message.xTranslate !== 'number') - return 'xTranslate: number expected'; + if (typeof message.xTranslate !== 'number') return 'xTranslate: number expected'; if (message.yTranslate != null && message.hasOwnProperty('yTranslate')) - if (typeof message.yTranslate !== 'number') - return 'yTranslate: number expected'; + if (typeof message.yTranslate !== 'number') return 'yTranslate: number expected'; if (message.mTranslate != null && message.hasOwnProperty('mTranslate')) - if (typeof message.mTranslate !== 'number') - return 'mTranslate: number expected'; + if (typeof message.mTranslate !== 'number') return 'mTranslate: number expected'; if (message.zTranslate != null && message.hasOwnProperty('zTranslate')) - if (typeof message.zTranslate !== 'number') - return 'zTranslate: number expected'; + if (typeof message.zTranslate !== 'number') return 'zTranslate: number expected'; return null; }; Translate.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Translate - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.Translate(); - if (object.xTranslate != null) - message.xTranslate = Number(object.xTranslate); - if (object.yTranslate != null) - message.yTranslate = Number(object.yTranslate); - if (object.mTranslate != null) - message.mTranslate = Number(object.mTranslate); - if (object.zTranslate != null) - message.zTranslate = Number(object.zTranslate); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Translate) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Translate(); + if (object.xTranslate != null) message.xTranslate = Number(object.xTranslate); + if (object.yTranslate != null) message.yTranslate = Number(object.yTranslate); + if (object.mTranslate != null) message.mTranslate = Number(object.mTranslate); + if (object.zTranslate != null) message.zTranslate = Number(object.zTranslate); return message; }; @@ -2703,9 +2234,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Translate' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Translate'; }; return Translate; @@ -2715,8 +2244,7 @@ $root.esriPBuffer = (function () { function Transform(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } Transform.prototype.quantizeOriginPostion = 0; @@ -2734,18 +2262,12 @@ $root.esriPBuffer = (function () { Object.hasOwnProperty.call(message, 'quantizeOriginPostion') ) writer.uint32(8).int32(message.quantizeOriginPostion); - if ( - message.scale != null && - Object.hasOwnProperty.call(message, 'scale') - ) + if (message.scale != null && Object.hasOwnProperty.call(message, 'scale')) $root.esriPBuffer.FeatureCollectionPBuffer.Scale.encode( message.scale, writer.uint32(18).fork(), ).ldelim(); - if ( - message.translate != null && - Object.hasOwnProperty.call(message, 'translate') - ) + if (message.translate != null && Object.hasOwnProperty.call(message, 'translate')) $root.esriPBuffer.FeatureCollectionPBuffer.Translate.encode( message.translate, writer.uint32(26).fork(), @@ -2758,8 +2280,7 @@ $root.esriPBuffer = (function () { }; Transform.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if ( message.quantizeOriginPostion != null && message.hasOwnProperty('quantizeOriginPostion') @@ -2772,28 +2293,21 @@ $root.esriPBuffer = (function () { break; } if (message.scale != null && message.hasOwnProperty('scale')) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.verify( - message.scale, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.verify(message.scale); if (error) return 'scale.' + error; } if (message.translate != null && message.hasOwnProperty('translate')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Translate.verify( - message.translate, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Translate.verify( + message.translate, + ); if (error) return 'translate.' + error; } return null; }; Transform.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Transform - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.Transform(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Transform) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Transform(); switch (object.quantizeOriginPostion) { default: if (typeof object.quantizeOriginPostion === 'number') { @@ -2815,20 +2329,16 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Transform.scale: object expected', ); - message.scale = - $root.esriPBuffer.FeatureCollectionPBuffer.Scale.fromObject( - object.scale, - ); + message.scale = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.fromObject(object.scale); } if (object.translate != null) { if (typeof object.translate !== 'object') throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Transform.translate: object expected', ); - message.translate = - $root.esriPBuffer.FeatureCollectionPBuffer.Translate.fromObject( - object.translate, - ); + message.translate = $root.esriPBuffer.FeatureCollectionPBuffer.Translate.fromObject( + object.translate, + ); } return message; }; @@ -2837,8 +2347,7 @@ $root.esriPBuffer = (function () { if (!options) options = {}; var object = {}; if (options.defaults) { - object.quantizeOriginPostion = - options.enums === String ? 'upperLeft' : 0; + object.quantizeOriginPostion = options.enums === String ? 'upperLeft' : 0; object.scale = null; object.translate = null; } @@ -2848,25 +2357,24 @@ $root.esriPBuffer = (function () { ) object.quantizeOriginPostion = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer - .QuantizeOriginPostion[message.quantizeOriginPostion] === - undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.QuantizeOriginPostion[ + message.quantizeOriginPostion + ] === undefined ? message.quantizeOriginPostion - : $root.esriPBuffer.FeatureCollectionPBuffer - .QuantizeOriginPostion[message.quantizeOriginPostion] + : $root.esriPBuffer.FeatureCollectionPBuffer.QuantizeOriginPostion[ + message.quantizeOriginPostion + ] : message.quantizeOriginPostion; if (message.scale != null && message.hasOwnProperty('scale')) - object.scale = - $root.esriPBuffer.FeatureCollectionPBuffer.Scale.toObject( - message.scale, - options, - ); + object.scale = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.toObject( + message.scale, + options, + ); if (message.translate != null && message.hasOwnProperty('translate')) - object.translate = - $root.esriPBuffer.FeatureCollectionPBuffer.Translate.toObject( - message.translate, - options, - ); + object.translate = $root.esriPBuffer.FeatureCollectionPBuffer.Translate.toObject( + message.translate, + options, + ); return object; }; @@ -2878,9 +2386,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Transform' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Transform'; }; return Transform; @@ -2894,8 +2400,7 @@ $root.esriPBuffer = (function () { this.geometryFields = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } FeatureResult.prototype.objectIdFieldName = ''; @@ -2926,10 +2431,7 @@ $root.esriPBuffer = (function () { Object.hasOwnProperty.call(message, 'objectIdFieldName') ) writer.uint32(10).string(message.objectIdFieldName); - if ( - message.uniqueIdField != null && - Object.hasOwnProperty.call(message, 'uniqueIdField') - ) + if (message.uniqueIdField != null && Object.hasOwnProperty.call(message, 'uniqueIdField')) $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.encode( message.uniqueIdField, writer.uint32(18).fork(), @@ -2952,18 +2454,12 @@ $root.esriPBuffer = (function () { message.geometryProperties, writer.uint32(42).fork(), ).ldelim(); - if ( - message.serverGens != null && - Object.hasOwnProperty.call(message, 'serverGens') - ) + if (message.serverGens != null && Object.hasOwnProperty.call(message, 'serverGens')) $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.encode( message.serverGens, writer.uint32(50).fork(), ).ldelim(); - if ( - message.geometryType != null && - Object.hasOwnProperty.call(message, 'geometryType') - ) + if (message.geometryType != null && Object.hasOwnProperty.call(message, 'geometryType')) writer.uint32(56).int32(message.geometryType); if ( message.spatialReference != null && @@ -2982,10 +2478,7 @@ $root.esriPBuffer = (function () { writer.uint32(80).bool(message.hasZ); if (message.hasM != null && Object.hasOwnProperty.call(message, 'hasM')) writer.uint32(88).bool(message.hasM); - if ( - message.transform != null && - Object.hasOwnProperty.call(message, 'transform') - ) + if (message.transform != null && Object.hasOwnProperty.call(message, 'transform')) $root.esriPBuffer.FeatureCollectionPBuffer.Transform.encode( message.transform, writer.uint32(98).fork(), @@ -3017,68 +2510,39 @@ $root.esriPBuffer = (function () { return writer; }; - FeatureResult.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + FeatureResult.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; FeatureResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) if (!$util.isString(message.objectIdFieldName)) return 'objectIdFieldName: string expected'; - if ( - message.uniqueIdField != null && - message.hasOwnProperty('uniqueIdField') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.verify( - message.uniqueIdField, - ); + if (message.uniqueIdField != null && message.hasOwnProperty('uniqueIdField')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.verify( + message.uniqueIdField, + ); if (error) return 'uniqueIdField.' + error; } - if ( - message.globalIdFieldName != null && - message.hasOwnProperty('globalIdFieldName') - ) + if (message.globalIdFieldName != null && message.hasOwnProperty('globalIdFieldName')) if (!$util.isString(message.globalIdFieldName)) return 'globalIdFieldName: string expected'; - if ( - message.geohashFieldName != null && - message.hasOwnProperty('geohashFieldName') - ) - if (!$util.isString(message.geohashFieldName)) - return 'geohashFieldName: string expected'; - if ( - message.geometryProperties != null && - message.hasOwnProperty('geometryProperties') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties.verify( - message.geometryProperties, - ); + if (message.geohashFieldName != null && message.hasOwnProperty('geohashFieldName')) + if (!$util.isString(message.geohashFieldName)) return 'geohashFieldName: string expected'; + if (message.geometryProperties != null && message.hasOwnProperty('geometryProperties')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties.verify( + message.geometryProperties, + ); if (error) return 'geometryProperties.' + error; } - if ( - message.serverGens != null && - message.hasOwnProperty('serverGens') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( - message.serverGens, - ); + if (message.serverGens != null && message.hasOwnProperty('serverGens')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( + message.serverGens, + ); if (error) return 'serverGens.' + error; } - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + if (message.geometryType != null && message.hasOwnProperty('geometryType')) switch (message.geometryType) { default: return 'geometryType: enum value expected'; @@ -3091,14 +2555,10 @@ $root.esriPBuffer = (function () { case 5: break; } - if ( - message.spatialReference != null && - message.hasOwnProperty('spatialReference') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( - message.spatialReference, - ); + if (message.spatialReference != null && message.hasOwnProperty('spatialReference')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( + message.spatialReference, + ); if (error) return 'spatialReference.' + error; } if ( @@ -3108,58 +2568,44 @@ $root.esriPBuffer = (function () { if (typeof message.exceededTransferLimit !== 'boolean') return 'exceededTransferLimit: boolean expected'; if (message.hasZ != null && message.hasOwnProperty('hasZ')) - if (typeof message.hasZ !== 'boolean') - return 'hasZ: boolean expected'; + if (typeof message.hasZ !== 'boolean') return 'hasZ: boolean expected'; if (message.hasM != null && message.hasOwnProperty('hasM')) - if (typeof message.hasM !== 'boolean') - return 'hasM: boolean expected'; + if (typeof message.hasM !== 'boolean') return 'hasM: boolean expected'; if (message.transform != null && message.hasOwnProperty('transform')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Transform.verify( - message.transform, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Transform.verify( + message.transform, + ); if (error) return 'transform.' + error; } if (message.fields != null && message.hasOwnProperty('fields')) { if (!Array.isArray(message.fields)) return 'fields: array expected'; for (var i = 0; i < message.fields.length; ++i) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify( - message.fields[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify(message.fields[i]); if (error) return 'fields.' + error; } } if (message.values != null && message.hasOwnProperty('values')) { if (!Array.isArray(message.values)) return 'values: array expected'; for (var i = 0; i < message.values.length; ++i) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Value.verify( - message.values[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Value.verify(message.values[i]); if (error) return 'values.' + error; } } if (message.features != null && message.hasOwnProperty('features')) { - if (!Array.isArray(message.features)) - return 'features: array expected'; + if (!Array.isArray(message.features)) return 'features: array expected'; for (var i = 0; i < message.features.length; ++i) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Feature.verify( - message.features[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Feature.verify( + message.features[i], + ); if (error) return 'features.' + error; } } - if ( - message.geometryFields != null && - message.hasOwnProperty('geometryFields') - ) { - if (!Array.isArray(message.geometryFields)) - return 'geometryFields: array expected'; + if (message.geometryFields != null && message.hasOwnProperty('geometryFields')) { + if (!Array.isArray(message.geometryFields)) return 'geometryFields: array expected'; for (var i = 0; i < message.geometryFields.length; ++i) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField.verify( - message.geometryFields[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField.verify( + message.geometryFields[i], + ); if (error) return 'geometryFields.' + error; } } @@ -3167,13 +2613,9 @@ $root.esriPBuffer = (function () { }; FeatureResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult(); if (object.objectIdFieldName != null) message.objectIdFieldName = String(object.objectIdFieldName); if (object.uniqueIdField != null) { @@ -3205,10 +2647,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.serverGens: object expected', ); - message.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( - object.serverGens, - ); + message.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( + object.serverGens, + ); } switch (object.geometryType) { default: @@ -3265,10 +2706,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.transform: object expected', ); - message.transform = - $root.esriPBuffer.FeatureCollectionPBuffer.Transform.fromObject( - object.transform, - ); + message.transform = $root.esriPBuffer.FeatureCollectionPBuffer.Transform.fromObject( + object.transform, + ); } if (object.fields) { if (!Array.isArray(object.fields)) @@ -3281,10 +2721,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.fields: object expected', ); - message.fields[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject( - object.fields[i], - ); + message.fields[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject( + object.fields[i], + ); } } if (object.values) { @@ -3298,10 +2737,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.values: object expected', ); - message.values[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( - object.values[i], - ); + message.values[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( + object.values[i], + ); } } if (object.features) { @@ -3315,10 +2753,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.features: object expected', ); - message.features[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Feature.fromObject( - object.features[i], - ); + message.features[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Feature.fromObject( + object.features[i], + ); } } if (object.geometryFields) { @@ -3357,71 +2794,44 @@ $root.esriPBuffer = (function () { object.geohashFieldName = ''; object.geometryProperties = null; object.serverGens = null; - object.geometryType = - options.enums === String ? 'esriGeometryTypePoint' : 0; + object.geometryType = options.enums === String ? 'esriGeometryTypePoint' : 0; object.spatialReference = null; object.exceededTransferLimit = false; object.hasZ = false; object.hasM = false; object.transform = null; } - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) object.objectIdFieldName = message.objectIdFieldName; - if ( - message.uniqueIdField != null && - message.hasOwnProperty('uniqueIdField') - ) - object.uniqueIdField = - $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.toObject( - message.uniqueIdField, - options, - ); - if ( - message.globalIdFieldName != null && - message.hasOwnProperty('globalIdFieldName') - ) + if (message.uniqueIdField != null && message.hasOwnProperty('uniqueIdField')) + object.uniqueIdField = $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.toObject( + message.uniqueIdField, + options, + ); + if (message.globalIdFieldName != null && message.hasOwnProperty('globalIdFieldName')) object.globalIdFieldName = message.globalIdFieldName; - if ( - message.geohashFieldName != null && - message.hasOwnProperty('geohashFieldName') - ) + if (message.geohashFieldName != null && message.hasOwnProperty('geohashFieldName')) object.geohashFieldName = message.geohashFieldName; - if ( - message.geometryProperties != null && - message.hasOwnProperty('geometryProperties') - ) + if (message.geometryProperties != null && message.hasOwnProperty('geometryProperties')) object.geometryProperties = $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties.toObject( message.geometryProperties, options, ); if (message.serverGens != null && message.hasOwnProperty('serverGens')) - object.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( - message.serverGens, - options, - ); - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + object.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( + message.serverGens, + options, + ); + if (message.geometryType != null && message.hasOwnProperty('geometryType')) object.geometryType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] === + undefined ? message.geometryType - : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] : message.geometryType; - if ( - message.spatialReference != null && - message.hasOwnProperty('spatialReference') - ) + if (message.spatialReference != null && message.hasOwnProperty('spatialReference')) object.spatialReference = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.toObject( message.spatialReference, @@ -3432,42 +2842,36 @@ $root.esriPBuffer = (function () { message.hasOwnProperty('exceededTransferLimit') ) object.exceededTransferLimit = message.exceededTransferLimit; - if (message.hasZ != null && message.hasOwnProperty('hasZ')) - object.hasZ = message.hasZ; - if (message.hasM != null && message.hasOwnProperty('hasM')) - object.hasM = message.hasM; + if (message.hasZ != null && message.hasOwnProperty('hasZ')) object.hasZ = message.hasZ; + if (message.hasM != null && message.hasOwnProperty('hasM')) object.hasM = message.hasM; if (message.transform != null && message.hasOwnProperty('transform')) - object.transform = - $root.esriPBuffer.FeatureCollectionPBuffer.Transform.toObject( - message.transform, - options, - ); + object.transform = $root.esriPBuffer.FeatureCollectionPBuffer.Transform.toObject( + message.transform, + options, + ); if (message.fields && message.fields.length) { object.fields = []; for (var j = 0; j < message.fields.length; ++j) - object.fields[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( - message.fields[j], - options, - ); + object.fields[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( + message.fields[j], + options, + ); } if (message.values && message.values.length) { object.values = []; for (var j = 0; j < message.values.length; ++j) - object.values[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( - message.values[j], - options, - ); + object.values[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( + message.values[j], + options, + ); } if (message.features && message.features.length) { object.features = []; for (var j = 0; j < message.features.length; ++j) - object.features[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Feature.toObject( - message.features[j], - options, - ); + object.features[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Feature.toObject( + message.features[j], + options, + ); } if (message.geometryFields && message.geometryFields.length) { object.geometryFields = []; @@ -3489,9 +2893,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.FeatureResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.FeatureResult'; }; return FeatureResult; @@ -3501,13 +2903,10 @@ $root.esriPBuffer = (function () { function CountResult(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } - CountResult.prototype.count = $util.Long - ? $util.Long.fromBits(0, 0, true) - : 0; + CountResult.prototype.count = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; CountResult.create = function create(properties) { return new CountResult(properties); @@ -3515,10 +2914,7 @@ $root.esriPBuffer = (function () { CountResult.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.count != null && - Object.hasOwnProperty.call(message, 'count') - ) + if (message.count != null && Object.hasOwnProperty.call(message, 'count')) writer.uint32(8).uint64(message.count); return writer; }; @@ -3528,8 +2924,7 @@ $root.esriPBuffer = (function () { }; CountResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.count != null && message.hasOwnProperty('count')) if ( !$util.isInteger(message.count) && @@ -3544,21 +2939,12 @@ $root.esriPBuffer = (function () { }; CountResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.CountResult(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.CountResult) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.CountResult(); if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = - true; - else if (typeof object.count === 'string') - message.count = parseInt(object.count, 10); - else if (typeof object.count === 'number') - message.count = object.count; + if ($util.Long) (message.count = $util.Long.fromValue(object.count)).unsigned = true; + else if (typeof object.count === 'string') message.count = parseInt(object.count, 10); + else if (typeof object.count === 'number') message.count = object.count; else if (typeof object.count === 'object') message.count = new $util.LongBits( object.count.low >>> 0, @@ -3582,17 +2968,15 @@ $root.esriPBuffer = (function () { } else object.count = options.longs === String ? '0' : 0; if (message.count != null && message.hasOwnProperty('count')) if (typeof message.count === 'number') - object.count = - options.longs === String ? String(message.count) : message.count; + object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number - ? new $util.LongBits( - message.count.low >>> 0, - message.count.high >>> 0, - ).toNumber(true) + ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber( + true, + ) : message.count; return object; }; @@ -3605,9 +2989,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.CountResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.CountResult'; }; return CountResult; @@ -3618,8 +3000,7 @@ $root.esriPBuffer = (function () { this.objectIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } ObjectIdsResult.prototype.objectIdFieldName = ''; @@ -3637,52 +3018,36 @@ $root.esriPBuffer = (function () { Object.hasOwnProperty.call(message, 'objectIdFieldName') ) writer.uint32(10).string(message.objectIdFieldName); - if ( - message.serverGens != null && - Object.hasOwnProperty.call(message, 'serverGens') - ) + if (message.serverGens != null && Object.hasOwnProperty.call(message, 'serverGens')) $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.encode( message.serverGens, writer.uint32(18).fork(), ).ldelim(); if (message.objectIds != null && message.objectIds.length) { writer.uint32(26).fork(); - for (var i = 0; i < message.objectIds.length; ++i) - writer.uint64(message.objectIds[i]); + for (var i = 0; i < message.objectIds.length; ++i) writer.uint64(message.objectIds[i]); writer.ldelim(); } return writer; }; - ObjectIdsResult.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + ObjectIdsResult.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; ObjectIdsResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) if (!$util.isString(message.objectIdFieldName)) return 'objectIdFieldName: string expected'; - if ( - message.serverGens != null && - message.hasOwnProperty('serverGens') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( - message.serverGens, - ); + if (message.serverGens != null && message.hasOwnProperty('serverGens')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( + message.serverGens, + ); if (error) return 'serverGens.' + error; } if (message.objectIds != null && message.hasOwnProperty('objectIds')) { - if (!Array.isArray(message.objectIds)) - return 'objectIds: array expected'; + if (!Array.isArray(message.objectIds)) return 'objectIds: array expected'; for (var i = 0; i < message.objectIds.length; ++i) if ( !$util.isInteger(message.objectIds[i]) && @@ -3698,13 +3063,9 @@ $root.esriPBuffer = (function () { }; ObjectIdsResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult(); if (object.objectIdFieldName != null) message.objectIdFieldName = String(object.objectIdFieldName); if (object.serverGens != null) { @@ -3712,10 +3073,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.serverGens: object expected', ); - message.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( - object.serverGens, - ); + message.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( + object.serverGens, + ); } if (object.objectIds) { if (!Array.isArray(object.objectIds)) @@ -3725,9 +3085,7 @@ $root.esriPBuffer = (function () { message.objectIds = []; for (var i = 0; i < object.objectIds.length; ++i) if ($util.Long) - (message.objectIds[i] = $util.Long.fromValue( - object.objectIds[i], - )).unsigned = true; + (message.objectIds[i] = $util.Long.fromValue(object.objectIds[i])).unsigned = true; else if (typeof object.objectIds[i] === 'string') message.objectIds[i] = parseInt(object.objectIds[i], 10); else if (typeof object.objectIds[i] === 'number') @@ -3749,25 +3107,19 @@ $root.esriPBuffer = (function () { object.objectIdFieldName = ''; object.serverGens = null; } - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) object.objectIdFieldName = message.objectIdFieldName; if (message.serverGens != null && message.hasOwnProperty('serverGens')) - object.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( - message.serverGens, - options, - ); + object.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( + message.serverGens, + options, + ); if (message.objectIds && message.objectIds.length) { object.objectIds = []; for (var j = 0; j < message.objectIds.length; ++j) if (typeof message.objectIds[j] === 'number') object.objectIds[j] = - options.longs === String - ? String(message.objectIds[j]) - : message.objectIds[j]; + options.longs === String ? String(message.objectIds[j]) : message.objectIds[j]; else object.objectIds[j] = options.longs === String @@ -3790,10 +3142,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult'; }; return ObjectIdsResult; @@ -3803,8 +3152,7 @@ $root.esriPBuffer = (function () { function QueryResult(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } QueryResult.prototype.featureResult = null; @@ -3814,9 +3162,7 @@ $root.esriPBuffer = (function () { var $oneOfFields; Object.defineProperty(QueryResult.prototype, 'Results', { - get: $util.oneOfGetter( - ($oneOfFields = ['featureResult', 'countResult', 'idsResult']), - ), + get: $util.oneOfGetter(($oneOfFields = ['featureResult', 'countResult', 'idsResult'])), set: $util.oneOfSetter($oneOfFields), }); @@ -3826,26 +3172,17 @@ $root.esriPBuffer = (function () { QueryResult.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.featureResult != null && - Object.hasOwnProperty.call(message, 'featureResult') - ) + if (message.featureResult != null && Object.hasOwnProperty.call(message, 'featureResult')) $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.encode( message.featureResult, writer.uint32(10).fork(), ).ldelim(); - if ( - message.countResult != null && - Object.hasOwnProperty.call(message, 'countResult') - ) + if (message.countResult != null && Object.hasOwnProperty.call(message, 'countResult')) $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.encode( message.countResult, writer.uint32(18).fork(), ).ldelim(); - if ( - message.idsResult != null && - Object.hasOwnProperty.call(message, 'idsResult') - ) + if (message.idsResult != null && Object.hasOwnProperty.call(message, 'idsResult')) $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.encode( message.idsResult, writer.uint32(26).fork(), @@ -3858,33 +3195,24 @@ $root.esriPBuffer = (function () { }; QueryResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; var properties = {}; - if ( - message.featureResult != null && - message.hasOwnProperty('featureResult') - ) { + if (message.featureResult != null && message.hasOwnProperty('featureResult')) { properties.Results = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.verify( - message.featureResult, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.verify( + message.featureResult, + ); if (error) return 'featureResult.' + error; } } - if ( - message.countResult != null && - message.hasOwnProperty('countResult') - ) { + if (message.countResult != null && message.hasOwnProperty('countResult')) { if (properties.Results === 1) return 'Results: multiple values'; properties.Results = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.verify( - message.countResult, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.verify( + message.countResult, + ); if (error) return 'countResult.' + error; } } @@ -3892,10 +3220,9 @@ $root.esriPBuffer = (function () { if (properties.Results === 1) return 'Results: multiple values'; properties.Results = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.verify( - message.idsResult, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.verify( + message.idsResult, + ); if (error) return 'idsResult.' + error; } } @@ -3903,13 +3230,8 @@ $root.esriPBuffer = (function () { }; QueryResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult(); if (object.featureResult != null) { if (typeof object.featureResult !== 'object') throw TypeError( @@ -3925,20 +3247,18 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.QueryResult.countResult: object expected', ); - message.countResult = - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.fromObject( - object.countResult, - ); + message.countResult = $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.fromObject( + object.countResult, + ); } if (object.idsResult != null) { if (typeof object.idsResult !== 'object') throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.QueryResult.idsResult: object expected', ); - message.idsResult = - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.fromObject( - object.idsResult, - ); + message.idsResult = $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.fromObject( + object.idsResult, + ); } return message; }; @@ -3946,34 +3266,25 @@ $root.esriPBuffer = (function () { QueryResult.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if ( - message.featureResult != null && - message.hasOwnProperty('featureResult') - ) { - object.featureResult = - $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.toObject( - message.featureResult, - options, - ); + if (message.featureResult != null && message.hasOwnProperty('featureResult')) { + object.featureResult = $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.toObject( + message.featureResult, + options, + ); if (options.oneofs) object.Results = 'featureResult'; } - if ( - message.countResult != null && - message.hasOwnProperty('countResult') - ) { - object.countResult = - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.toObject( - message.countResult, - options, - ); + if (message.countResult != null && message.hasOwnProperty('countResult')) { + object.countResult = $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.toObject( + message.countResult, + options, + ); if (options.oneofs) object.Results = 'countResult'; } if (message.idsResult != null && message.hasOwnProperty('idsResult')) { - object.idsResult = - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.toObject( - message.idsResult, - options, - ); + object.idsResult = $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.toObject( + message.idsResult, + options, + ); if (options.oneofs) object.Results = 'idsResult'; } return object; @@ -3987,9 +3298,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.QueryResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.QueryResult'; }; return QueryResult; diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.js index 18d23f4f..316b16e5 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.js @@ -38,8 +38,7 @@ function parseQuantizationParameters(q) { const { tolerance = null } = q; const scale = tolerance !== null ? q.tolerance : 1; - const [xTranslate, yTranslate] = - q.extent != null ? [q.extent.xmin, q.extent.ymax] : [0, 0]; + const [xTranslate, yTranslate] = q.extent != null ? [q.extent.xmin, q.extent.ymax] : [0, 0]; return { originPosition: normalizeOriginPosition(q.originPosition), diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.spec.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.spec.js index 9441695a..cef56b02 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.spec.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/get-geometry-transform.spec.js @@ -17,10 +17,7 @@ describe('getGeometryTransform', () => { spatialReference: { wkid: 102100, latestWkid: 3857 }, }, }; - const result = getGeometryTransform( - { wkid: 4326 }, - quantizationParameters, - ); + const result = getGeometryTransform({ wkid: 4326 }, quantizationParameters); result.should.deepEqual({ originPosition: 'upperLeft', scale: { @@ -48,10 +45,7 @@ describe('getGeometryTransform', () => { spatialReference: { wkid: 102100, latestWkid: 3857 }, }, }; - const result = getGeometryTransform( - { wkid: 4326 }, - quantizationParameters, - ); + const result = getGeometryTransform({ wkid: 4326 }, quantizationParameters); result.should.deepEqual({ originPosition: 'upperLeft', scale: { @@ -79,10 +73,7 @@ describe('getGeometryTransform', () => { spatialReference: { wkid: 102100, latestWkid: 3857 }, }, }; - const result = getGeometryTransform( - { wkid: 4326 }, - quantizationParameters, - ); + const result = getGeometryTransform({ wkid: 4326 }, quantizationParameters); result.should.deepEqual({ originPosition: 'lowerLeft', scale: { @@ -109,10 +100,7 @@ describe('getGeometryTransform', () => { spatialReference: { wkid: 102100, latestWkid: 3857 }, }, }; - const result = getGeometryTransform( - { wkid: 4326 }, - quantizationParameters, - ); + const result = getGeometryTransform({ wkid: 4326 }, quantizationParameters); result.should.deepEqual({ originPosition: 'upperLeft', scale: { @@ -131,10 +119,7 @@ describe('getGeometryTransform', () => { originPosition: 'upperLeft', tolerance: 1.0583354500042335, }; - const result = getGeometryTransform( - { wkid: 4326 }, - quantizationParameters, - ); + const result = getGeometryTransform({ wkid: 4326 }, quantizationParameters); result.should.deepEqual({ originPosition: 'upperLeft', scale: { @@ -193,7 +178,7 @@ describe('getGeometryTransform', () => { it('from custom spatial reference', () => { const result = getGeometryTransform({ - wkt: 'PROJCRS["NAD83 / California zone 5 (ftUS)",BASEGEOGCRS["NAD83",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4269]],CONVERSION["SPCS83 California zone 5 (US Survey feet)",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of false origin",33.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",-118,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",35.4666666666667,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",34.0333333333333,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",6561666.667,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8826]],PARAMETER["Northing at false origin",1640416.667,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["US survey foot",0.304800609601219]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["US survey foot",0.304800609601219]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["United States (USA) - California - counties Kern; Los Angeles; San Bernardino; San Luis Obispo; Santa Barbara; Ventura."],BBOX[32.76,-121.42,35.81,-114.12]],ID["EPSG",2229]]', + wkt: 'PROJCRS["NAD83 / California zone 5 (ftUS)",BASEGEOGCRS["NAD83",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4269]],CONVERSION["SPCS83 California zone 5 (US Survey feet)",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of false origin",33.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",-118,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",35.4666666666667,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",34.0333333333333,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",6561666.667,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8826]],PARAMETER["Northing at false origin",1640416.667,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["US survey foot",0.304800609601219]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["US survey foot",0.304800609601219]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["United States (USA) - California - counties Kern; Los Angeles; San Bernardino; San Luis Obispo; Santa Barbara; Ventura."],BBOX[32.76,-121.42,35.81,-114.12]],ID["EPSG",2229]]', // eslint-disable-line }); result.should.deepEqual({ scale: { diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/index.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/index.js index 4166d175..b6279bf4 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/index.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/index.js @@ -42,8 +42,7 @@ function verifyPbfMessage(pbfMessage) { } function convertToPbfJson(payload, requestParameters) { - const { returnCountOnly, returnIdsOnly, quantizationParameters } = - requestParameters; + const { returnCountOnly, returnIdsOnly, quantizationParameters } = requestParameters; if (returnCountOnly === true) { return { diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/index.spec.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/index.spec.js index 68d84c16..bd01206d 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/index.spec.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/index.spec.js @@ -59,22 +59,13 @@ describe('sendPbf', () => { esri: 'pbf', length: 99, }); - res.set.firstCall.args.should.deepEqual([ - 'content-type', - 'application/x-protobuf', - ]); + res.set.firstCall.args.should.deepEqual(['content-type', 'application/x-protobuf']); res.set.secondCall.args.should.deepEqual(['content-length', 99]); - res.set.thirdCall.args.should.deepEqual([ - 'content-disposition', - 'inline;filename=results.pbf', - ]); + res.set.thirdCall.args.should.deepEqual(['content-disposition', 'inline;filename=results.pbf']); res.status.firstCall.args.should.deepEqual([200]); - transformFeaturesForPbfSpy.firstCall.args.should.deepEqual([ - { esri: 'json' }, - undefined, - ]); + transformFeaturesForPbfSpy.firstCall.args.should.deepEqual([{ esri: 'json' }, undefined]); protoSpy.encode.firstCall.args.should.deepEqual([ { queryResult: { @@ -94,15 +85,9 @@ describe('sendPbf', () => { esri: 'pbf', length: 99, }); - res.set.firstCall.args.should.deepEqual([ - 'content-type', - 'application/x-protobuf', - ]); + res.set.firstCall.args.should.deepEqual(['content-type', 'application/x-protobuf']); res.set.secondCall.args.should.deepEqual(['content-length', 99]); - res.set.thirdCall.args.should.deepEqual([ - 'content-disposition', - 'inline;filename=results.pbf', - ]); + res.set.thirdCall.args.should.deepEqual(['content-disposition', 'inline;filename=results.pbf']); res.status.firstCall.args.should.deepEqual([200]); @@ -128,15 +113,9 @@ describe('sendPbf', () => { length: 99, }); - res.set.firstCall.args.should.deepEqual([ - 'content-type', - 'application/x-protobuf', - ]); + res.set.firstCall.args.should.deepEqual(['content-type', 'application/x-protobuf']); res.set.secondCall.args.should.deepEqual(['content-length', 99]); - res.set.thirdCall.args.should.deepEqual([ - 'content-disposition', - 'inline;filename=results.pbf', - ]); + res.set.thirdCall.args.should.deepEqual(['content-disposition', 'inline;filename=results.pbf']); res.status.firstCall.args.should.deepEqual([200]); diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-features-for-pbf.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-features-for-pbf.js index 87c95a14..a6857496 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-features-for-pbf.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-features-for-pbf.js @@ -13,14 +13,9 @@ function transformFeaturesForPbf(json, quantizationParameters) { } = json; const fields = _.orderBy(json.fields, ['name'], ['asc']); - const geometryTransform = getGeometryTransform( - spatialReference, - quantizationParameters, - ); + const geometryTransform = getGeometryTransform(spatialReference, quantizationParameters); - const features = json.features.map( - transformFeatureFunction(fields, geometryTransform), - ); + const features = json.features.map(transformFeatureFunction(fields, geometryTransform)); return { objectIdFieldName, @@ -49,10 +44,7 @@ function transformFeatureFunction(fields, geometryTransform) { return (feature) => { const attributes = transformToPbfAttributes(feature.attributes, fieldMap); - const geometry = transformToPbfGeometry( - feature.geometry, - geometryTransform, - ); + const geometry = transformToPbfGeometry(feature.geometry, geometryTransform); return { attributes, diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-attributes.spec.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-attributes.spec.js index 735f95ba..bcff2300 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-attributes.spec.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-attributes.spec.js @@ -107,10 +107,7 @@ describe('transformToPbfAttributes', () => { }); it('should properly handle OIDs that are strings', () => { - const result = transformToPbfAttributes( - { ...attributes, FID: 'foo' }, - fieldMap, - ); + const result = transformToPbfAttributes({ ...attributes, FID: 'foo' }, fieldMap); result.should.deepEqual([ { sint64Value: 1421798400000, diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.js index 40d52e3d..fd010b71 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.js @@ -120,9 +120,7 @@ function transformCoordsArray(coordsArray, transform) { y = quantizeY(coords[1], yScale, yTranslate); if (x !== prevX || y !== prevY) { - result.push( - createCoordinatesArray(x - prevX, y - prevY, coords[2], coords[3]), - ); + result.push(createCoordinatesArray(x - prevX, y - prevY, coords[2], coords[3])); prevX = x; prevY = y; } diff --git a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.spec.js b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.spec.js index a4a15f5c..1a0c4e06 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.spec.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pbf/transform-to-pbf-geometry.spec.js @@ -76,9 +76,7 @@ describe('transformToPbfGeometry', () => { const result = transformToPbfGeometry(fixture, defaultTransform); result.should.deepEqual({ lengths: [3], - coords: [ - 64567221232, -357065421833, 3339584724, 0, 2226389816, 1534703364, - ], + coords: [64567221232, -357065421833, 3339584724, 0, 2226389816, 1534703364], }); }); @@ -95,10 +93,7 @@ describe('transformToPbfGeometry', () => { const result = transformToPbfGeometry(fixture, defaultTransform); result.should.deepEqual({ lengths: [3], - coords: [ - 65737760897, -361640524478, -587036377, -1064003433, 464737132, - -183448868, - ], + coords: [65737760897, -361640524478, -587036377, -1064003433, 464737132, -183448868], }); }); }); @@ -120,8 +115,7 @@ describe('transformToPbfGeometry', () => { result.should.deepEqual({ lengths: [5], coords: [ - 65680416140, -363479548349, 0, 1647807625, -1113194908, 0, 0, - -1647807625, 1113194908, 0, + 65680416140, -363479548349, 0, 1647807625, -1113194908, 0, 0, -1647807625, 1113194908, 0, ], }); }); @@ -162,8 +156,8 @@ describe('transformToPbfGeometry', () => { result.should.deepEqual({ lengths: [3, 2], coords: [ - 62340831416, -358626214862, 4452779632, 0, 0, -3205525862, - 62340831416, -354020794440, 4452779632, 0, + 62340831416, -358626214862, 4452779632, 0, 0, -3205525862, 62340831416, -354020794440, + 4452779632, 0, ], }); }); @@ -193,9 +187,8 @@ describe('transformToPbfGeometry', () => { result.should.deepEqual({ lengths: [5, 5], coords: [ - 87944314299, -346802067873, 0, -1403190256, 2226389816, 0, 0, - 1403190256, -2226389816, 0, 92397093931, -344049811441, 0, - -1367402279, 2226389815, 0, 0, 1367402279, -2226389815, 0, + 87944314299, -346802067873, 0, -1403190256, 2226389816, 0, 0, 1403190256, -2226389816, 0, + 92397093931, -344049811441, 0, -1367402279, 2226389815, 0, 0, 1367402279, -2226389815, 0, ], }); }); diff --git a/packages/featureserver/src/response-handlers/helpers/send-pretty-json.spec.js b/packages/featureserver/src/response-handlers/helpers/send-pretty-json.spec.js index d3f96fec..bddce242 100644 --- a/packages/featureserver/src/response-handlers/helpers/send-pretty-json.spec.js +++ b/packages/featureserver/src/response-handlers/helpers/send-pretty-json.spec.js @@ -15,13 +15,8 @@ const res = { describe('sendPrettyJson', () => { it('should respond with callback string', () => { sendPrettyJson(res, { hello: 'world' }); - res.set.firstCall.args.should.deepEqual([ - 'Content-Type', - 'application/json; charset=utf-8', - ]); - res.send.firstCall.args[0].should.deepEqual( - JSON.stringify({ hello: 'world' }, null, 2), - ); + res.set.firstCall.args.should.deepEqual(['Content-Type', 'application/json; charset=utf-8']); + res.send.firstCall.args[0].should.deepEqual(JSON.stringify({ hello: 'world' }, null, 2)); res.status.firstCall.args[0].should.be.exactly(200); }); }); diff --git a/packages/featureserver/src/response-handlers/query-response-handler.js b/packages/featureserver/src/response-handlers/query-response-handler.js index 6d9966ab..cb952839 100644 --- a/packages/featureserver/src/response-handlers/query-response-handler.js +++ b/packages/featureserver/src/response-handlers/query-response-handler.js @@ -1,10 +1,6 @@ const { sendCallbackResponse, sendPrettyJson, sendPbf } = require('./helpers'); -module.exports = function queryResponseHandler( - res, - payload, - requestParameters, -) { +module.exports = function queryResponseHandler(res, payload, requestParameters) { const { f, callback } = requestParameters; if (typeof callback === 'string') { diff --git a/packages/featureserver/src/response-handlers/query-response-handler.spec.js b/packages/featureserver/src/response-handlers/query-response-handler.spec.js index 2ffc6c51..034846bd 100644 --- a/packages/featureserver/src/response-handlers/query-response-handler.spec.js +++ b/packages/featureserver/src/response-handlers/query-response-handler.spec.js @@ -61,11 +61,7 @@ describe('query response handler', () => { }, ); - sendCallbackResponseSpy.firstCall.args.should.deepEqual([ - res, - { test: true }, - 'test-callback', - ]); + sendCallbackResponseSpy.firstCall.args.should.deepEqual([res, { test: true }, 'test-callback']); }); it('send as pretty json', () => { diff --git a/packages/featureserver/src/rest-info-route-handler.spec.js b/packages/featureserver/src/rest-info-route-handler.spec.js index 6ad71e71..e7a5109c 100644 --- a/packages/featureserver/src/rest-info-route-handler.spec.js +++ b/packages/featureserver/src/rest-info-route-handler.spec.js @@ -51,10 +51,7 @@ describe('rest/info handler', () => { }, }, }; - const result = restInfo( - { authInfo: { foo: 'bar' }, owningSystemUrl: 'helloworld' }, - req, - ); + const result = restInfo({ authInfo: { foo: 'bar' }, owningSystemUrl: 'helloworld' }, req); result.should.deepEqual({ currentVersion: 10.81, fullVersion: '10.8.1', diff --git a/packages/featureserver/src/route.js b/packages/featureserver/src/route.js index 76870b11..d3ee27c2 100644 --- a/packages/featureserver/src/route.js +++ b/packages/featureserver/src/route.js @@ -7,10 +7,7 @@ const generateRenderer = require('./generate-renderer'); const restInfo = require('./rest-info-route-handler'); const serverInfo = require('./server-info-route-handler'); const layersInfo = require('./layers-metadata'); -const { - generalResponseHandler, - queryResponseHandler, -} = require('./response-handlers'); +const { generalResponseHandler, queryResponseHandler } = require('./response-handlers'); const { validateInputs, normalizeRequestParameters } = require('./helpers'); module.exports = function route(req, res, geojson = {}) { @@ -45,10 +42,7 @@ module.exports = function route(req, res, geojson = {}) { return generalResponseHandler(res, result, req.query); } - if ( - isLayersMetadataRequest(route) || - isRelationshipsMetadataRequest(route) - ) { + if (isLayersMetadataRequest(route) || isRelationshipsMetadataRequest(route)) { const result = layersInfo(geojson, params); return generalResponseHandler(res, result, req.query); } diff --git a/packages/featureserver/src/server-info-route-handler.js b/packages/featureserver/src/server-info-route-handler.js index 51277d71..faef5eb8 100644 --- a/packages/featureserver/src/server-info-route-handler.js +++ b/packages/featureserver/src/server-info-route-handler.js @@ -12,11 +12,7 @@ const ServerMetadata = require('./helpers/server-metadata'); function serverMetadataResponse(data, req = {}) { const { query: { inputCrs, sourceSR } = {} } = req; - const providerMetadata = normalizeMetadataFromProvider( - data, - inputCrs, - sourceSR, - ); + const providerMetadata = normalizeMetadataFromProvider(data, inputCrs, sourceSR); // TODO: deprecate in favor or server-metadata-settings const appConfig = req.app?.locals?.config?.featureServer || {}; @@ -33,25 +29,20 @@ function normalizeMetadataFromProvider(data, inputCrs, sourceSR) { const collectionMetadata = flattenMetadata(data); - const spatialReference = getSpatialReference( - inputCrs, - sourceSR, - layers[0] || data, - ) || { wkid: 4326, latestWkid: 4326 }; + const spatialReference = getSpatialReference(inputCrs, sourceSR, layers[0] || data) || { + wkid: 4326, + latestWkid: 4326, + }; const extent = - collectionMetadata?.extent || - calculateServiceExtentFromLayers(layers, spatialReference); + collectionMetadata?.extent || calculateServiceExtentFromLayers(layers, spatialReference); const metadata = { ...flattenMetadata(tables[0]), ...flattenMetadata(layers[0]), ...flattenMetadata(data), fullExtent: getExtent(extent, spatialReference), - initialExtent: getExtent( - collectionMetadata?.initialExtent || extent, - spatialReference, - ), + initialExtent: getExtent(collectionMetadata?.initialExtent || extent, spatialReference), }; return { @@ -88,9 +79,7 @@ function calculateServiceExtentFromLayers(layers, spatialReference) { const bounds = calculateBounds(layer); bounds.forEach((coordinate) => { if (isNaN(coordinate)) { - throw new Error( - `Geometry coordinate is not a number: ${coordinate}`, - ); + throw new Error(`Geometry coordinate is not a number: ${coordinate}`); } }); return bounds; @@ -115,9 +104,7 @@ function calculateServiceExtentFromLayers(layers, spatialReference) { spatialReference, }; } catch (error) { - logManager.logger.debug( - `Could not calculate extent from data: ${error.message}`, - ); + logManager.logger.debug(`Could not calculate extent from data: ${error.message}`); } } @@ -139,15 +126,11 @@ function getExtent(extent, spatialReference) { } function formatServerItemInfo(json, defaultId) { - const { - metadata: { id, name, minScale = 0, maxScale = 0, defaultVisibility } = {}, - } = json; + const { metadata: { id, name, minScale = 0, maxScale = 0, defaultVisibility } = {} } = json; const geometryType = getGeometryTypeFromGeojson(json); - const defaultName = geometryType - ? `Layer_${id || defaultId}` - : `Table_${id || defaultId}`; + const defaultName = geometryType ? `Layer_${id || defaultId}` : `Table_${id || defaultId}`; const retVal = { id: id || defaultId, diff --git a/packages/featureserver/test/integration/info.spec.js b/packages/featureserver/test/integration/info.spec.js index ca748c65..a3959c19 100644 --- a/packages/featureserver/test/integration/info.spec.js +++ b/packages/featureserver/test/integration/info.spec.js @@ -24,9 +24,7 @@ describe('Info operations', () => { restInfo.should.have.property('currentVersion', CURRENT_VERSION); restInfo.should.have.property('authInfo'); restInfo.authInfo.should.have.property('isTokenBasedSecurity', true); - restInfo.authInfo.should.have - .property('tokenServicesUrl') - .be.type('string'); + restInfo.authInfo.should.have.property('tokenServicesUrl').be.type('string'); }); }); @@ -47,7 +45,7 @@ describe('Info operations', () => { capabilities: 'Query', description: 'MyTestDesc', copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line spatialReference: { wkid: 4326, latestWkid: 4326 }, fullExtent: { spatialReference: { wkid: 4326, latestWkid: 4326 }, @@ -193,7 +191,7 @@ describe('Info operations', () => { server.layers[0].geometryType.should.equal('esriGeometryPoint'); }); - it('should support a metadata with layer id, defaultVisibility, minScale, and maxScale values', () => { + it('should support metadata', () => { const layer0 = _.cloneDeep(data); const layer1 = _.cloneDeep(data); layer0.metadata = { diff --git a/packages/featureserver/test/integration/layers.spec.js b/packages/featureserver/test/integration/layers.spec.js index 9172d09a..4b4b0789 100644 --- a/packages/featureserver/test/integration/layers.spec.js +++ b/packages/featureserver/test/integration/layers.spec.js @@ -22,7 +22,7 @@ describe('Layers operations', () => { displayField: 'id', description: 'MyTestDesc', copyrightText: - 'Copyright information varies by provider. For more information please contact the source of this data.', + 'Copyright information varies by provider. For more information please contact the source of this data.', // eslint-disable-line defaultVisibility: true, isDataVersioned: false, hasContingentValuesDefinition: false, diff --git a/packages/featureserver/test/integration/query.spec.js b/packages/featureserver/test/integration/query.spec.js index 73240553..9ecdebc9 100644 --- a/packages/featureserver/test/integration/query.spec.js +++ b/packages/featureserver/test/integration/query.spec.js @@ -18,7 +18,7 @@ const dataWithTextOID = require('./fixtures/snow-text-objectid.json'); describe('Query operations', () => { before(function () { - // This pattern is used to help insulate bugs that occur from platform-specific logic in farmhash. + // This pattern prevents fails from platform-specific logic in farmhash. // The existing hard-coded OBJECTID's were generated by a unix-based farmhash, and would cause // the tests to fail when run on windows. const response = FeatureServer.query(data, { outFields: 'OBJECTID' }); @@ -26,9 +26,7 @@ describe('Query operations', () => { const textOIDResponse = FeatureServer.query(dataWithTextOID, { outFields: 'OBJECTID', }); - this.textObjectIds = textOIDResponse.features.map( - (feat) => feat.attributes.OBJECTID, - ); + this.textObjectIds = textOIDResponse.features.map((feat) => feat.attributes.OBJECTID); }); it('should return the expected response schema for an optionless query', () => { @@ -362,12 +360,8 @@ describe('Query operations', () => { const response = FeatureServer.query(budgetTable, options); response.fields.length.should.equal(2); - response.fields - .find((field) => field.name === 'Name') - .name.should.equal('Name'); - response.fields - .find((field) => field.name === 'Dept') - .name.should.equal('Dept'); + response.fields.find((field) => field.name === 'Name').name.should.equal('Name'); + response.fields.find((field) => field.name === 'Dept').name.should.equal('Dept'); Object.keys(response.features[0].attributes).length.should.equal(2); _.has(response, 'features[0].attributes.OBJECTID').should.equal(false); }); @@ -584,9 +578,7 @@ describe('Query operations', () => { ], }, ); - response.features[0].attributes.some_new_label.should.equal( - 1497578316179, - ); + response.features[0].attributes.some_new_label.should.equal(1497578316179); response.fields[0].type.should.equal('esriFieldTypeDate'); }); }); @@ -659,9 +651,7 @@ describe('Query operations', () => { response.should.be.an.instanceOf(Object); response.fields.length.should.equal(1); response.features.length.should.equal(1); - response.features[0].attributes.sum_precip.should.equal( - 135.69000000000003, - ); + response.features[0].attributes.sum_precip.should.equal(135.69000000000003); }); it('should return correct number of fields and features for avg stats', () => { @@ -674,9 +664,7 @@ describe('Query operations', () => { }, ], }); - response.features[0].attributes.avg_precip.should.equal( - 0.3253956834532375, - ); + response.features[0].attributes.avg_precip.should.equal(0.3253956834532375); }); it.skip('should return correct number of fields and features for var/stddev stats', () => { @@ -694,12 +682,8 @@ describe('Query operations', () => { }, ], }); - response.features[0].attributes.var_precip.should.equal( - 0.07661480700055341, - ); - response.features[0].attributes.stddev_precip.should.equal( - 0.27646171244241985, - ); + response.features[0].attributes.var_precip.should.equal(0.07661480700055341); + response.features[0].attributes.stddev_precip.should.equal(0.27646171244241985); }); it('should return a correct response when there are multiple stats returned', () => { @@ -741,10 +725,7 @@ describe('Query operations', () => { describe('when getting feature counts from a given count', () => { it('should return a correct count json', () => { - const json = FeatureServer.query( - { count: 100 }, - { returnCountOnly: true }, - ); + const json = FeatureServer.query({ count: 100 }, { returnCountOnly: true }); json.count.should.equal(100); }); }); @@ -804,10 +785,7 @@ describe('Query operations', () => { }); it('should pass through a count of 1', () => { - const json = FeatureServer.query( - { count: 1, features: [{}] }, - { returnCountOnly: true }, - ); + const json = FeatureServer.query({ count: 1, features: [{}] }, { returnCountOnly: true }); json.count.should.equal(1); }); }); diff --git a/packages/featureserver/test/integration/route.spec.js b/packages/featureserver/test/integration/route.spec.js index c7de6b32..fe4e5e19 100644 --- a/packages/featureserver/test/integration/route.spec.js +++ b/packages/featureserver/test/integration/route.spec.js @@ -83,7 +83,7 @@ describe('Routing feature server requests', () => { }); describe('Layer Info', () => { - it('should properly route and handle a layer info request of form /FeatureServer/:layerId`', (done) => { + it('should handle a layer info request of form /FeatureServer/:layerId`', (done) => { request(app) .get('/FeatureServer/3?f=json') .expect((res) => { @@ -101,7 +101,7 @@ describe('Routing feature server requests', () => { .expect(200, done); }); - it('should properly route and handle a layer info request of form /FeatureServer/:layerId/`', (done) => { + it('should handle a layer info request of form /FeatureServer/:layerId/`', (done) => { request(app) .get('/FeatureServer/3/?f=json') .expect((res) => { @@ -119,7 +119,7 @@ describe('Routing feature server requests', () => { .expect(200, done); }); - it('should properly route and handle a layer info request of form /FeatureServer/:layerId/info`', (done) => { + it('should handle a layer info request of form /FeatureServer/:layerId/info`', (done) => { request(app) .get('/FeatureServer/3/info?f=json') .expect((res) => { @@ -179,7 +179,7 @@ describe('Routing feature server requests', () => { describe('Query', () => { before(function () { - // This pattern is used to help insulate bugs that occur from platform-specific logic in farmhash. + // This pattern prevents fails from platform-specific logic in farmhash. // The existing hard-coded OBJECTID's were generated by a unix-based farmhash, and would cause // the tests to fail when run on windows. const response = FeatureServer.query(data, { outFields: 'OBJECTID' }); @@ -202,9 +202,7 @@ describe('Routing feature server requests', () => { request(app) .get('/FeatureServer/0/query?f=json&where=1%3D1') .expect((res) => { - res.body.features[1].attributes.OBJECTID.should.equal( - this.secondOBJECTID, - ); + res.body.features[1].attributes.OBJECTID.should.equal(this.secondOBJECTID); res.body.features.length.should.equal(2); res.body.exceededTransferLimit.should.equal(true); }) @@ -216,9 +214,7 @@ describe('Routing feature server requests', () => { request(app) .get('/FeatureServer/0/query?f=json&orderByFields=') .expect((res) => { - res.body.features[1].attributes.OBJECTID.should.equal( - this.secondOBJECTID, - ); + res.body.features[1].attributes.OBJECTID.should.equal(this.secondOBJECTID); res.body.features.length.should.equal(417); }) .expect('Content-Type', /json/) @@ -230,11 +226,11 @@ describe('Routing feature server requests', () => { request(app) .get( '/FeatureServer/0/query?f=json&' + - 'geometry={"xmin":-15576031.875835987,"ymin":-14167144.570483988,"xmax":15576031.875835987,"ymax":14167144.570483988}&' + + 'geometry={"xmin":-15576031.875835987,"ymin":-14167144.570483988,"xmax":15576031.875835987,"ymax":14167144.570483988}&' + // eslint-disable-line 'geometryType=esriGeometryEnvelope&' + 'inSR=102100&' + 'spatialRel=esriSpatialRelIntersects&' + - 'outStatistics=[{"onStatisticField":"OBJECTID","statisticType":"min","outStatisticFieldName":"min_2"},{"onStatisticField":"OBJECTID","statisticType":"max","outStatisticFieldName":"max_2"},{"onStatisticField":"OBJECTID","statisticType":"count","outStatisticFieldName":"count_2"}]&' + + 'outStatistics=[{"onStatisticField":"OBJECTID","statisticType":"min","outStatisticFieldName":"min_2"},{"onStatisticField":"OBJECTID","statisticType":"max","outStatisticFieldName":"max_2"},{"onStatisticField":"OBJECTID","statisticType":"count","outStatisticFieldName":"count_2"}]&' + // eslint-disable-line 'where=1=1', ) .expect((res) => { @@ -273,22 +269,16 @@ describe('Routing feature server requests', () => { }, }); }); - it('should properly route and handle when a provider passes in class breaks statistics', (done) => { + it('should handle a provider passing in class breaks statistics', (done) => { request(app) .get('/FeatureServer/3/generateRenderer?') .expect((res) => { res.body.type.should.equal('classBreaks'); res.body.classBreakInfos.length.should.equal(9); - res.body.classBreakInfos[0].symbol.color.should.deepEqual([ - 0, 255, 0, - ]); + res.body.classBreakInfos[0].symbol.color.should.deepEqual([0, 255, 0]); res.body.classBreakInfos[0].label.should.equal('80-147'); - res.body.classBreakInfos[4].symbol.color.should.deepEqual([ - 0, 255, 255, - ]); - res.body.classBreakInfos[8].symbol.color.should.deepEqual([ - 0, 0, 255, - ]); + res.body.classBreakInfos[4].symbol.color.should.deepEqual([0, 255, 255]); + res.body.classBreakInfos[8].symbol.color.should.deepEqual([0, 0, 255]); }) .expect('Content-Type', /json/) .expect(200, done); @@ -309,16 +299,10 @@ describe('Routing feature server requests', () => { .expect((res) => { res.body.type.should.equal('classBreaks'); res.body.classBreakInfos.length.should.equal(9); - res.body.classBreakInfos[0].symbol.color.should.deepEqual([ - 0, 255, 0, - ]); + res.body.classBreakInfos[0].symbol.color.should.deepEqual([0, 255, 0]); res.body.classBreakInfos[0].label.should.equal('80-147'); - res.body.classBreakInfos[4].symbol.color.should.deepEqual([ - 0, 255, 255, - ]); - res.body.classBreakInfos[8].symbol.color.should.deepEqual([ - 0, 0, 255, - ]); + res.body.classBreakInfos[4].symbol.color.should.deepEqual([0, 255, 255]); + res.body.classBreakInfos[8].symbol.color.should.deepEqual([0, 0, 255]); }) .expect('Content-Type', /json/) .expect(200, done); @@ -345,18 +329,10 @@ describe('Routing feature server requests', () => { .expect((res) => { res.body.type.should.equal('classBreaks'); res.body.classBreakInfos.length.should.equal(7); - res.body.classBreakInfos[0].symbol.color.should.deepEqual([ - 0, 100, 0, - ]); - res.body.classBreakInfos[0].label.should.equal( - '0-0.7571428571428571', - ); - res.body.classBreakInfos[3].symbol.color.should.deepEqual([ - 0, 177, 178, - ]); - res.body.classBreakInfos[6].symbol.color.should.deepEqual([ - 0, 0, 255, - ]); + res.body.classBreakInfos[0].symbol.color.should.deepEqual([0, 100, 0]); + res.body.classBreakInfos[0].label.should.equal('0-0.7571428571428571'); + res.body.classBreakInfos[3].symbol.color.should.deepEqual([0, 177, 178]); + res.body.classBreakInfos[6].symbol.color.should.deepEqual([0, 0, 255]); }) .expect('Content-Type', /json/) .expect(200, done); @@ -373,9 +349,7 @@ describe('Routing feature server requests', () => { .get('/FeatureServer/0/queryRelatedRecords?') .expect((res) => { res.body.relatedRecordGroups.length.should.equal(1); - res.body.relatedRecordGroups[0].relatedRecords.length.should.equal( - 11, - ); + res.body.relatedRecordGroups[0].relatedRecords.length.should.equal(11); }) .expect('Content-Type', /json/) .expect(200, done); diff --git a/packages/featureserver/test/integration/schemas/index.js b/packages/featureserver/test/integration/schemas/index.js index ef0e0f22..74a474ac 100644 --- a/packages/featureserver/test/integration/schemas/index.js +++ b/packages/featureserver/test/integration/schemas/index.js @@ -114,11 +114,7 @@ const layerTemplateSchema = Joi.object().keys({ domain: Joi.any().valid(null), editable: Joi.boolean().valid(false, true), nullable: Joi.boolean().valid(false), - sqlType: Joi.string().valid( - 'sqlTypeOther', - 'sqlTypeDouble', - 'sqlTypeInteger', - ), + sqlType: Joi.string().valid('sqlTypeOther', 'sqlTypeDouble', 'sqlTypeInteger'), }), ) .min(0), diff --git a/packages/logger/src/index.js b/packages/logger/src/index.js index b617bde6..deed5a01 100644 --- a/packages/logger/src/index.js +++ b/packages/logger/src/index.js @@ -95,8 +95,7 @@ function formatter(options) { if (options.message !== undefined) line.push(options.message); - if (options.meta && Object.keys(options.meta).length) - line.push(JSON.stringify(options.meta)); + if (options.meta && Object.keys(options.meta).length) line.push(JSON.stringify(options.meta)); return line.join(' '); } diff --git a/packages/output-geoservices/src/index.js b/packages/output-geoservices/src/index.js index c072beae..e906c6be 100644 --- a/packages/output-geoservices/src/index.js +++ b/packages/output-geoservices/src/index.js @@ -105,9 +105,7 @@ class GeoServices { #getHttpSetting(options, model) { if (options.useHttpForTokenUrl || process.env.GEOSERVICES_HTTP === 'true') { - return ( - options.useHttpForTokenUrl || process.env.GEOSERVICES_HTTP === 'true' - ); + return options.useHttpForTokenUrl || process.env.GEOSERVICES_HTTP === 'true'; } if (typeof model.authenticationSpecification === 'function') { @@ -116,7 +114,7 @@ class GeoServices { if (typeof process.env.KOOP_AUTH_HTTP !== 'undefined') { this.#logger.warn( - 'Use of "KOOP_AUTH_HTTP" environment variable is deprecated. It will be removed in a future release. Use the "useHttpForTokenUrl" option or "GEOSERVICES_HTTP" environment variable.', + 'Use of "KOOP_AUTH_HTTP" environment variable is deprecated. It will be removed in a future release. Use the "useHttpForTokenUrl" option or "GEOSERVICES_HTTP" environment variable.', // eslint-disable-line ); return process.env.KOOP_AUTH_HTTP === 'true'; } @@ -176,17 +174,11 @@ class GeoServices { const authInfo = { ...this.#authInfo }; if (this.#authInfo.isTokenBasedSecurity) { - authInfo.tokenServicesUrl = this.#buildTokensUrl( - req.headers.host, - req.baseUrl, - ); + authInfo.tokenServicesUrl = this.#buildTokensUrl(req.headers.host, req.baseUrl); } FeatureServer.route(req, res, { - owningSystemUrl: this.#buildOwningSystemUrl( - req.headers.host, - req.baseUrl, - ), + owningSystemUrl: this.#buildOwningSystemUrl(req.headers.host, req.baseUrl), authInfo, }); } diff --git a/packages/output-geoservices/src/index.spec.js b/packages/output-geoservices/src/index.spec.js index 82079f1b..1b3fc599 100644 --- a/packages/output-geoservices/src/index.spec.js +++ b/packages/output-geoservices/src/index.spec.js @@ -41,9 +41,7 @@ describe('Output Geoservices', () => { describe('constructor', () => { test('should include expected static properties', () => { expect(OutputGeoServices.type).toBe('output'); - expect(OutputGeoServices.version).toBe( - require('../package.json').version, - ); + expect(OutputGeoServices.version).toBe(require('../package.json').version); expect(OutputGeoServices.routes).toEqual([ { path: '$namespace/rest/info', @@ -94,11 +92,7 @@ describe('Output Geoservices', () => { const output = new OutputGeoServices(modelMock, { logger: loggerMock }); await output.generalHandler({ foo: 'bar' }, resMock); expect(FeatureServer.route.mock.calls.length).toBe(1); - expect(FeatureServer.route.mock.calls[0]).toEqual([ - { foo: 'bar' }, - resMock, - 'someData', - ]); + expect(FeatureServer.route.mock.calls[0]).toEqual([{ foo: 'bar' }, resMock, 'someData']); expect(modelMock.pull.mock.calls.length).toBe(1); expect(modelMock.pull.mock.calls[0][0]).toEqual({ foo: 'bar' }); }); @@ -110,11 +104,7 @@ describe('Output Geoservices', () => { const output = new OutputGeoServices(modelMock, { logger: loggerMock }); await output.generalHandler({ foo: 'bar' }, resMock); expect(FeatureServer.route.mock.calls.length).toBe(1); - expect(FeatureServer.route.mock.calls[0]).toEqual([ - { foo: 'bar' }, - resMock, - 'someData', - ]); + expect(FeatureServer.route.mock.calls[0]).toEqual([{ foo: 'bar' }, resMock, 'someData']); }); test('should handle 5xx error', async () => { @@ -197,10 +187,7 @@ describe('Output Geoservices', () => { }), }; const output = new OutputGeoServices(modelMock, { logger: loggerMock }); - await output.generalHandler( - { headers: { authorization: '123' } }, - resMock, - ); + await output.generalHandler({ headers: { authorization: '123' } }, resMock); expect(resMock.status.mock.calls[0].length).toBe(1); expect(resMock.status.mock.calls[0]).toEqual([200]); expect(resMock.json.mock.calls[0].length).toBe(1); @@ -224,10 +211,7 @@ describe('Output Geoservices', () => { }), }; const output = new OutputGeoServices(modelMock, { logger: loggerMock }); - await output.generalHandler( - { headers: { authorization: '123' } }, - resMock, - ); + await output.generalHandler({ headers: { authorization: '123' } }, resMock); expect(resMock.status.mock.calls[0].length).toBe(1); expect(resMock.status.mock.calls[0]).toEqual([200]); expect(resMock.json.mock.calls[0].length).toBe(1); @@ -298,14 +282,13 @@ describe('Output Geoservices', () => { owningSystemUrl: 'https://some-host.com/api/v1/provider-name', authInfo: { isTokenBasedSecurity: true, - tokenServicesUrl: - 'https://some-host.com/api/v1/provider-name/rest/generateToken', + tokenServicesUrl: 'https://some-host.com/api/v1/provider-name/rest/generateToken', }, }, ]); }); - test('should return rest info with default authInfo, http token url, set by option', async () => { + test('should set by option', async () => { const modelMock = { namespace: 'provider-name', pull: jest.fn(async () => 'someData'), @@ -322,14 +305,13 @@ describe('Output Geoservices', () => { owningSystemUrl: 'http://some-host.com/api/v1/provider-name', authInfo: { isTokenBasedSecurity: true, - tokenServicesUrl: - 'http://some-host.com/api/v1/provider-name/rest/generateToken', + tokenServicesUrl: 'http://some-host.com/api/v1/provider-name/rest/generateToken', }, }, ]); }); - test('should return rest info with default authInfo, http token url, set by GEOSERVICES_HTTP', async () => { + test('should set by GEOSERVICES_HTTP', async () => { const modelMock = { namespace: 'provider-name', pull: jest.fn(async () => 'someData'), @@ -346,8 +328,7 @@ describe('Output Geoservices', () => { owningSystemUrl: 'http://some-host.com/api/v1/provider-name', authInfo: { isTokenBasedSecurity: true, - tokenServicesUrl: - 'http://some-host.com/api/v1/provider-name/rest/generateToken', + tokenServicesUrl: 'http://some-host.com/api/v1/provider-name/rest/generateToken', }, }, ]); @@ -358,7 +339,7 @@ describe('Output Geoservices', () => { } }); - test('should return rest info with default authInfo, http token url, set by KOOP_AUTH_HTTP', async () => { + test('should set by KOOP_AUTH_HTTP', async () => { const modelMock = { namespace: 'provider-name', pull: jest.fn(async () => 'someData'), @@ -375,8 +356,7 @@ describe('Output Geoservices', () => { owningSystemUrl: 'http://some-host.com/api/v1/provider-name', authInfo: { isTokenBasedSecurity: true, - tokenServicesUrl: - 'http://some-host.com/api/v1/provider-name/rest/generateToken', + tokenServicesUrl: 'http://some-host.com/api/v1/provider-name/rest/generateToken', }, }, ]); @@ -387,7 +367,7 @@ describe('Output Geoservices', () => { } }); - test('should return rest info with default authInfo, http token url, set by authenticationSpecification', async () => { + test('should set with authenticationSpecification', async () => { const modelMock = { namespace: 'provider-name', pull: jest.fn(async () => 'someData'), @@ -406,8 +386,7 @@ describe('Output Geoservices', () => { owningSystemUrl: 'http://some-host.com/api/v1/provider-name', authInfo: { isTokenBasedSecurity: true, - tokenServicesUrl: - 'http://some-host.com/api/v1/provider-name/rest/generateToken', + tokenServicesUrl: 'http://some-host.com/api/v1/provider-name/rest/generateToken', }, }, ]); diff --git a/packages/winnow/benchmark/index.js b/packages/winnow/benchmark/index.js index 96b941e8..23d1b8b6 100644 --- a/packages/winnow/benchmark/index.js +++ b/packages/winnow/benchmark/index.js @@ -3,9 +3,7 @@ const fs = require('fs-extra'); const path = require('path'); const winnow = require('../src/index.js'); -const features = fs.readJSONSync( - path.join(__dirname, './fixtures.geojson'), -).features; +const features = fs.readJSONSync(path.join(__dirname, './fixtures.geojson')).features; const suite = new Benchmark.Suite(); suite diff --git a/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.js b/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.js index 446bea1f..8ba06e75 100644 --- a/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.js +++ b/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.js @@ -1,9 +1,6 @@ const _ = require('lodash'); -module.exports = function filterAndValidateClassificationFeatures( - features, - classificationField, -) { +module.exports = function filterAndValidateClassificationFeatures(features, classificationField) { return features .filter((feature) => { return !shouldSkipFeature({ feature, classificationField }); diff --git a/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.spec.js b/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.spec.js index 09ad8742..688dd044 100644 --- a/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.spec.js +++ b/packages/winnow/src/calculate-class-breaks/filter-and-validate-classification-features.spec.js @@ -1,5 +1,5 @@ const test = require('tape'); -const filterAndValidateClassificationValues = require('./filter-and-validate-classification-features'); +const filterAndValidateClassificationValues = require('./filter-and-validate-classification-features'); // eslint-disable-line test('filterAndValidateClassificationValues: success', (spec) => { const features = [ @@ -25,10 +25,7 @@ test('filterAndValidateClassificationValues: should throw error', (spec) => { filterAndValidateClassificationValues(features, 'rain'); spec.fail('should throw error'); } catch (error) { - spec.equals( - error.message, - 'Cannot use non-numeric classificationField, rain: "foo"', - ); + spec.equals(error.message, 'Cannot use non-numeric classificationField, rain: "foo"'); } spec.end(); }); diff --git a/packages/winnow/src/calculate-class-breaks/index.js b/packages/winnow/src/calculate-class-breaks/index.js index 8b2e120e..b7c8dfc7 100644 --- a/packages/winnow/src/calculate-class-breaks/index.js +++ b/packages/winnow/src/calculate-class-breaks/index.js @@ -2,26 +2,20 @@ const Classifier = require('classybrew'); const normalizeClassificationValues = require('./normalize-classification-values'); const calculateStdDevIntervals = require('./calculate-std-dev-intervals'); const transformClassBreaksToRanges = require('./transform-class-breaks-to-ranges'); -const filterAndValidateClassificationFeatures = require('./filter-and-validate-classification-features'); +const filterAndValidateClassificationFeatures = require('./filter-and-validate-classification-features'); // eslint-disable-line function calculateClassBreaks(features, classification) { - if (!classification.method) - throw new Error('must supply classification.method'); - if (!classification.breakCount) - throw new Error('must supply classification.breakCount'); + if (!classification.method) throw new Error('must supply classification.method'); + if (!classification.breakCount) throw new Error('must supply classification.breakCount'); const values = classification.normType ? normalizeClassificationValues(features, classification) : getFieldValues(features, classification.field); // limit break count to num values - if (classification.breakCount > values.length) - classification.breakCount = values.length; + if (classification.breakCount > values.length) classification.breakCount = values.length; // calculate break ranges [ [a-b], [b-c], ...] from input values - const classBreakArray = transformValuesToClassBreaksArray( - values, - classification, - ); + const classBreakArray = transformValuesToClassBreaksArray(values, classification); return transformClassBreaksToRanges(classBreakArray, classification); } @@ -48,12 +42,11 @@ function transformValuesToClassBreaksArray(values, classification) { } function getFieldValues(features, classificationField) { - const values = filterAndValidateClassificationFeatures( - features, - classificationField, - ).map((value) => { - return value <= 0 ? 0 : value; - }); + const values = filterAndValidateClassificationFeatures(features, classificationField).map( + (value) => { + return value <= 0 ? 0 : value; + }, + ); if (!values || values.length === 0) { throw new Error(`"${classificationField}" was not found on any feature.`); diff --git a/packages/winnow/src/calculate-class-breaks/normalize-classification-values.js b/packages/winnow/src/calculate-class-breaks/normalize-classification-values.js index bb10b66a..a972cd9a 100644 --- a/packages/winnow/src/calculate-class-breaks/normalize-classification-values.js +++ b/packages/winnow/src/calculate-class-breaks/normalize-classification-values.js @@ -1,5 +1,5 @@ const _ = require('lodash'); -const filterAndValidateClassificationFeatures = require('./filter-and-validate-classification-features'); +const filterAndValidateClassificationFeatures = require('./filter-and-validate-classification-features'); // eslint-disable-line function normalizeClassBreaks(features, classification) { const { normType: type } = classification; @@ -19,10 +19,7 @@ function normalizeClassBreaks(features, classification) { throw new Error(`Normalization not supported: ${type}`); } -function normalizeByField( - features, - { field: classificationField, normField: normalizationField }, -) { +function normalizeByField(features, { field: classificationField, normField: normalizationField }) { if (!normalizationField) { throw new Error('Normalization field is undefined'); } @@ -50,9 +47,7 @@ function normalizeByField( }); const valueToNormalizeBy = - feature.properties[normalizationField] > 0 - ? feature.properties[normalizationField] - : 1; + feature.properties[normalizationField] > 0 ? feature.properties[normalizationField] : 1; return feature.properties[classificationField] / valueToNormalizeBy; }) @@ -62,37 +57,31 @@ function normalizeByField( if (!values || values.length === 0) { throw new Error( - `Classification field "${classificationField}" and normalization field "${normalizationField}" were not found on any feature.`, + `Classification field "${classificationField}" and normalization field "${normalizationField}" were not found on any feature.`, // eslint-disable-line ); } return values; } function normalizeByLog(features, { field: classificationField }) { - const values = filterAndValidateClassificationFeatures( - features, - classificationField, - ).map((value) => { - if (value <= 0) { - return 0; - } - const logValue = Math.log10(value); - return logValue < 0 ? 0 : logValue; - }); + const values = filterAndValidateClassificationFeatures(features, classificationField).map( + (value) => { + if (value <= 0) { + return 0; + } + const logValue = Math.log10(value); + return logValue < 0 ? 0 : logValue; + }, + ); if (!values || values.length === 0) { - throw new Error( - `Classification field "${classificationField}" was not found on any feature.`, - ); + throw new Error(`Classification field "${classificationField}" was not found on any feature.`); } return values; } function normalizeByPercent(features, { field: classificationField }) { - const values = filterAndValidateClassificationFeatures( - features, - classificationField, - ); + const values = filterAndValidateClassificationFeatures(features, classificationField); const valueTotal = values.reduce((sum, value) => { return sum + value; diff --git a/packages/winnow/src/calculate-class-breaks/normalize-classification-values.spec.js b/packages/winnow/src/calculate-class-breaks/normalize-classification-values.spec.js index c6583c4a..ea264c92 100644 --- a/packages/winnow/src/calculate-class-breaks/normalize-classification-values.spec.js +++ b/packages/winnow/src/calculate-class-breaks/normalize-classification-values.spec.js @@ -1,7 +1,7 @@ const test = require('tape'); const normalizeClassificationValues = require('./normalize-classification-values'); -test('nomalizeClassificationValue: unsupported method', (spec) => { +test('unsupported method', (spec) => { try { normalizeClassificationValues([], { normType: 'unsupported' }); spec.fail('should have thrown error'); @@ -11,7 +11,7 @@ test('nomalizeClassificationValue: unsupported method', (spec) => { spec.end(); }); -test('nomalizeClassificationValue: normalize by field, field undefined', (spec) => { +test('normalize by field, field undefined', (spec) => { try { normalizeClassificationValues([], { normType: 'field' }); spec.fail('should have thrown error'); @@ -21,7 +21,7 @@ test('nomalizeClassificationValue: normalize by field, field undefined', (spec) spec.end(); }); -test('nomalizeClassificationValue: normalize by field, no classification field', (spec) => { +test('normalize by field, no classification field', (spec) => { try { normalizeClassificationValues([], { normType: 'field', normField: 'foo' }); spec.fail('should have thrown error'); @@ -31,7 +31,7 @@ test('nomalizeClassificationValue: normalize by field, no classification field', spec.end(); }); -test('nomalizeClassificationValue: normalize by field, fields not found', (spec) => { +test('normalize by field, fields not found', (spec) => { try { normalizeClassificationValues([], { normType: 'field', @@ -48,7 +48,7 @@ test('nomalizeClassificationValue: normalize by field, fields not found', (spec) spec.end(); }); -test('nomalizeClassificationValue: normalize by field, normalization field not found in feature', (spec) => { +test('normalize by field, normalization field not found in feature', (spec) => { try { normalizeClassificationValues([{ properties: { booz: 1 } }], { normType: 'field', @@ -65,48 +65,45 @@ test('nomalizeClassificationValue: normalize by field, normalization field not f spec.end(); }); -test('nomalizeClassificationValue: normalize by field, normalization field is non-numeric', (spec) => { +test('normalize by field, normalization field is non-numeric', (spec) => { try { - normalizeClassificationValues( - [{ properties: { booz: 1, foo: 'string' } }], - { normType: 'field', normField: 'foo', field: 'booz' }, - ); + normalizeClassificationValues([{ properties: { booz: 1, foo: 'string' } }], { + normType: 'field', + normField: 'foo', + field: 'booz', + }); spec.fail('should have thrown error'); } catch (error) { - spec.equals( - error.message, - 'Cannot use non-numeric normalizationField, foo: "string"', - ); + spec.equals(error.message, 'Cannot use non-numeric normalizationField, foo: "string"'); } spec.end(); }); -test('nomalizeClassificationValue: normalize by field, classification field is non-numeric', (spec) => { +test('normalize by field, classification field is non-numeric', (spec) => { try { - normalizeClassificationValues( - [{ properties: { booz: 'string', foo: 10 } }], - { normType: 'field', normField: 'foo', field: 'booz' }, - ); + normalizeClassificationValues([{ properties: { booz: 'string', foo: 10 } }], { + normType: 'field', + normField: 'foo', + field: 'booz', + }); spec.fail('should have thrown error'); } catch (error) { - spec.equals( - error.message, - 'Cannot use non-numeric classificationField, booz: "string"', - ); + spec.equals(error.message, 'Cannot use non-numeric classificationField, booz: "string"'); } spec.end(); }); -test('nomalizeClassificationValue: normalize by field', (spec) => { - const result = normalizeClassificationValues( - [{ properties: { booz: 1, foo: 10 } }], - { normType: 'field', normField: 'foo', field: 'booz' }, - ); +test('normalize by field', (spec) => { + const result = normalizeClassificationValues([{ properties: { booz: 1, foo: 10 } }], { + normType: 'field', + normField: 'foo', + field: 'booz', + }); spec.deepEquals(result, [0.1]); spec.end(); }); -test('nomalizeClassificationValue: normalize by log, normalization field not found in feature', (spec) => { +test('normalize by log, normalization field not found in feature', (spec) => { try { normalizeClassificationValues([{ properties: {} }], { normType: 'log', @@ -114,15 +111,12 @@ test('nomalizeClassificationValue: normalize by log, normalization field not fou }); spec.fail('should have thrown error'); } catch (error) { - spec.equals( - error.message, - 'Classification field "booz" was not found on any feature.', - ); + spec.equals(error.message, 'Classification field "booz" was not found on any feature.'); } spec.end(); }); -test('nomalizeClassificationValue: normalize by log, normalization field is non-numeric', (spec) => { +test('normalize by log, normalization field is non-numeric', (spec) => { try { normalizeClassificationValues([{ properties: { booz: 'string' } }], { normType: 'log', @@ -130,15 +124,12 @@ test('nomalizeClassificationValue: normalize by log, normalization field is non- }); spec.fail('should have thrown error'); } catch (error) { - spec.equals( - error.message, - 'Cannot use non-numeric classificationField, booz: "string"', - ); + spec.equals(error.message, 'Cannot use non-numeric classificationField, booz: "string"'); } spec.end(); }); -test('nomalizeClassificationValue: normalize by log, less than 0', (spec) => { +test('normalize by log, less than 0', (spec) => { const result = normalizeClassificationValues([{ properties: { booz: -1 } }], { normType: 'log', field: 'booz', @@ -147,7 +138,7 @@ test('nomalizeClassificationValue: normalize by log, less than 0', (spec) => { spec.end(); }); -test('nomalizeClassificationValue: normalize by log, 0', (spec) => { +test('normalize by log, 0', (spec) => { const result = normalizeClassificationValues([{ properties: { booz: 0 } }], { normType: 'log', field: 'booz', @@ -156,16 +147,16 @@ test('nomalizeClassificationValue: normalize by log, 0', (spec) => { spec.end(); }); -test('nomalizeClassificationValue: normalize by log', (spec) => { - const result = normalizeClassificationValues( - [{ properties: { booz: 200 } }], - { normType: 'log', field: 'booz' }, - ); +test('normalize by log', (spec) => { + const result = normalizeClassificationValues([{ properties: { booz: 200 } }], { + normType: 'log', + field: 'booz', + }); spec.deepEquals(result, [2.3010299956639813]); spec.end(); }); -test('nomalizeClassificationValue: normalize by percent, classification field not found in feature', (spec) => { +test('normalize by percent, classification field not found in feature', (spec) => { try { normalizeClassificationValues([{ properties: {} }, { properties: {} }], { normType: 'percent', @@ -181,12 +172,12 @@ test('nomalizeClassificationValue: normalize by percent, classification field no spec.end(); }); -test('nomalizeClassificationValue: normalize by percent, value total <= 0', (spec) => { +test('normalize by percent, value total <= 0', (spec) => { try { - normalizeClassificationValues( - [{ properties: { booz: 1 } }, { properties: { booz: -2 } }], - { normType: 'percent', field: 'booz' }, - ); + normalizeClassificationValues([{ properties: { booz: 1 } }, { properties: { booz: -2 } }], { + normType: 'percent', + field: 'booz', + }); spec.fail('should have thrown error'); } catch (error) { spec.equals( @@ -197,7 +188,7 @@ test('nomalizeClassificationValue: normalize by percent, value total <= 0', (spe spec.end(); }); -test('nomalizeClassificationValue: normalize by percent', (spec) => { +test('normalize by percent', (spec) => { const result = normalizeClassificationValues( [{ properties: { booz: 1 } }, { properties: { booz: 9 } }], { normType: 'percent', field: 'booz' }, diff --git a/packages/winnow/src/calculate-class-breaks/transform-class-breaks-to-ranges.spec.js b/packages/winnow/src/calculate-class-breaks/transform-class-breaks-to-ranges.spec.js index 1c353f91..7e074002 100644 --- a/packages/winnow/src/calculate-class-breaks/transform-class-breaks-to-ranges.spec.js +++ b/packages/winnow/src/calculate-class-breaks/transform-class-breaks-to-ranges.spec.js @@ -2,9 +2,7 @@ const test = require('tape'); const transformClassBreaksToRanges = require('./transform-class-breaks-to-ranges'); test('transformClassBreaksToRanges: non-stddev', (spec) => { - const result = transformClassBreaksToRanges([ - -3.01, -1.02, 2.01, 6.003, 9.004, - ]); + const result = transformClassBreaksToRanges([-3.01, -1.02, 2.01, 6.003, 9.004]); spec.deepEquals(result, [ [-3.01, -1.02], [-1.01, 2.01], @@ -15,10 +13,9 @@ test('transformClassBreaksToRanges: non-stddev', (spec) => { }); test('transformClassBreaksToRanges: stddev', (spec) => { - const result = transformClassBreaksToRanges( - [-3.01, -1.02, 2.01, 6.003, 9.004], - { method: 'stddev' }, - ); + const result = transformClassBreaksToRanges([-3.01, -1.02, 2.01, 6.003, 9.004], { + method: 'stddev', + }); spec.deepEquals(result, [ [-3.01, -1.03], [-1.02, 2], diff --git a/packages/winnow/src/filter-and-transform/filter-and-transform.spec.js b/packages/winnow/src/filter-and-transform/filter-and-transform.spec.js index fd0a7d10..c468f222 100644 --- a/packages/winnow/src/filter-and-transform/filter-and-transform.spec.js +++ b/packages/winnow/src/filter-and-transform/filter-and-transform.spec.js @@ -37,14 +37,8 @@ const polygonFeature = { test('sql.fn.ST_Within - geometries fully within a target polygon should return true', (t) => { t.plan(3); - t.ok( - filterAndTransform.fn.ST_Within(pointFeature, polygonFilter), - 'point within filter geom', - ); - t.ok( - filterAndTransform.fn.ST_Within(lineFeature, polygonFilter), - 'line within filter geom', - ); + t.ok(filterAndTransform.fn.ST_Within(pointFeature, polygonFilter), 'point within filter geom'); + t.ok(filterAndTransform.fn.ST_Within(lineFeature, polygonFilter), 'line within filter geom'); t.ok( filterAndTransform.fn.ST_Within(polygonFeature, polygonFilter), 'polygon within filter geom', diff --git a/packages/winnow/src/filter-and-transform/filters/envelope-intersects.js b/packages/winnow/src/filter-and-transform/filters/envelope-intersects.js index a71a6613..4755a5c8 100644 --- a/packages/winnow/src/filter-and-transform/filters/envelope-intersects.js +++ b/packages/winnow/src/filter-and-transform/filters/envelope-intersects.js @@ -1,9 +1,5 @@ const _ = require('lodash'); -const { - calculateBounds, - intersects, - contains, -} = require('@terraformer/spatial'); +const { calculateBounds, intersects, contains } = require('@terraformer/spatial'); const bboxPolygon = require('@turf/bbox-polygon').default; const { arcgisToGeoJSON } = require('@terraformer/arcgis'); @@ -18,15 +14,11 @@ module.exports = function (featureGeometry = {}, filterGeometry = {}) { if (!type || coordinates.length === 0) return false; - const geometryFilterEnvelope = - convertGeometryToEnvelopePolygon(filterGeometry); + const geometryFilterEnvelope = convertGeometryToEnvelopePolygon(filterGeometry); - if (type === 'Point') - return contains(geometryFilterEnvelope, normalizedFeatureGeometry); + if (type === 'Point') return contains(geometryFilterEnvelope, normalizedFeatureGeometry); - const featureEnvelope = convertGeometryToEnvelopePolygon( - normalizedFeatureGeometry, - ); + const featureEnvelope = convertGeometryToEnvelopePolygon(normalizedFeatureGeometry); return intersects(geometryFilterEnvelope, featureEnvelope); }; diff --git a/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.js b/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.js index 9ade6042..0ebde68b 100644 --- a/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.js +++ b/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.js @@ -10,13 +10,11 @@ const logManager = require('../../log-manager'); * * @param {object} properties GeoJSON feature properties * @param {*} geometry GeoJSON feature properties - * @param {*} value the objectId the feature is being compared to. Presumed to have been created by feature hashing + * @param {*} value objectId the feature is being compared to. Presumed to be created by hashing * @param {*} operator the predicate operator */ module.exports = function (properties, geometry, value, operator) { - const hashedFeature = createIntegerHash( - JSON.stringify({ properties, geometry }), - ); + const hashedFeature = createIntegerHash(JSON.stringify({ properties, geometry })); if (operator === '=' && hashedFeature === value) { return true; diff --git a/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.spec.js b/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.spec.js index 1ec44f53..059a4083 100644 --- a/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.spec.js +++ b/packages/winnow/src/filter-and-transform/filters/hashed-objectid-comparator.spec.js @@ -31,34 +31,19 @@ test('hashedObjectIdComparator: >=, should return true', (t) => { }); test('hashedObjectIdComparator: >, should return true', (t) => { - const result = hashedObjectIdComparator( - properties, - geometry, - 9999999999, - '<', - ); + const result = hashedObjectIdComparator(properties, geometry, 9999999999, '<'); t.equals(result, true); t.end(); }); test('hashedObjectIdComparator: >=, should return true', (t) => { - const result = hashedObjectIdComparator( - properties, - geometry, - 9999999999, - '<=', - ); + const result = hashedObjectIdComparator(properties, geometry, 9999999999, '<='); t.equals(result, true); t.end(); }); test('hashedObjectIdComparator: IN, should return true', (t) => { - const result = hashedObjectIdComparator( - properties, - geometry, - `${objectId},0000`, - 'IN', - ); + const result = hashedObjectIdComparator(properties, geometry, `${objectId},0000`, 'IN'); t.equals(result, true); t.end(); }); diff --git a/packages/winnow/src/filter-and-transform/helpers/hash-function.js b/packages/winnow/src/filter-and-transform/helpers/hash-function.js index a29c22a8..eb14c984 100644 --- a/packages/winnow/src/filter-and-transform/helpers/hash-function.js +++ b/packages/winnow/src/filter-and-transform/helpers/hash-function.js @@ -1,6 +1,5 @@ const hashFixture = require('./hash-fixture'); -const USE_JAVASCRIPT_HASHING = - process.env.OBJECTID_FEATURE_HASH === 'javascript'; +const USE_JAVASCRIPT_HASHING = process.env.OBJECTID_FEATURE_HASH === 'javascript'; const murmurhash = require('murmurhash'); function getHashFunction() { @@ -15,9 +14,7 @@ function getHashFunction() { return hashFunction; // eslint-disable-next-line } catch (e) { - console.info( - 'Using murmurhash as default hasher for OBJECTID auto-generate.', - ); + console.info('Using murmurhash as default hasher for OBJECTID auto-generate.'); return murmurhash; } } diff --git a/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.js b/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.js index 6da0cbde..ec8ba42f 100644 --- a/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.js +++ b/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.js @@ -13,8 +13,7 @@ function normalizeParams(inParams) { // If this is just a passed in feature if (!inParams.length) params = [[inParams]]; // If this is an array of features - if (isGeoJSONFeatures(inParams) || isEsriFeatures(inParams)) - params = [inParams]; + if (isGeoJSONFeatures(inParams) || isEsriFeatures(inParams)) params = [inParams]; return params; } diff --git a/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.spec.js b/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.spec.js index ad347735..a4655579 100644 --- a/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.spec.js +++ b/packages/winnow/src/filter-and-transform/prepare-filter-and-transform.spec.js @@ -19,8 +19,7 @@ test('Should return prepared filter and transform query', (t) => { }); // Get a prepared filter and transform query - const preparedFilterAndTransform = - prepareFilterAndTransform('SELECT foo FROM ?'); + const preparedFilterAndTransform = prepareFilterAndTransform('SELECT foo FROM ?'); t.equals(typeof preparedFilterAndTransform, 'function'); // Execute with single GeoJSON feature diff --git a/packages/winnow/src/filter-and-transform/transforms/project.spec.js b/packages/winnow/src/filter-and-transform/transforms/project.spec.js index 0d9b7634..70e746d2 100644 --- a/packages/winnow/src/filter-and-transform/transforms/project.spec.js +++ b/packages/winnow/src/filter-and-transform/transforms/project.spec.js @@ -65,11 +65,7 @@ test('project, error throw in projection, return null', (t) => { const project = proxyquire(modulePath, { '../../helpers/project-coordinates': projectSpy, }); - const result = project( - { type: 'Point', coordinates: [] }, - 'source-cs', - 'target-cs', - ); + const result = project({ type: 'Point', coordinates: [] }, 'source-cs', 'target-cs'); t.deepEquals(result, null); t.end(); }); diff --git a/packages/winnow/src/filter-and-transform/transforms/reduce-precision.js b/packages/winnow/src/filter-and-transform/transforms/reduce-precision.js index 588472cf..3adddb8c 100644 --- a/packages/winnow/src/filter-and-transform/transforms/reduce-precision.js +++ b/packages/winnow/src/filter-and-transform/transforms/reduce-precision.js @@ -14,13 +14,9 @@ module.exports = function (geometry, precision) { }; function reducePrecision(coordinates, precision) { - return transformCoordinates( - coordinates, - { precision }, - (coordinates, { precision }) => { - return coordinates.map((position) => { - return parseFloat(position.toFixed(precision)); - }); - }, - ); + return transformCoordinates(coordinates, { precision }, (coordinates, { precision }) => { + return coordinates.map((position) => { + return parseFloat(position.toFixed(precision)); + }); + }); } diff --git a/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.js b/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.js index fa625950..0590dcbc 100644 --- a/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.js +++ b/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.js @@ -16,19 +16,13 @@ module.exports = function transformToEsriProperties( if (requiresObjectId && !idField) { properties = injectObjectId({ properties, geometry }); - } else if ( - requiresObjectId && - shouldLogIdFieldDataTypeWarning(properties[idField]) - ) { + } else if (requiresObjectId && shouldLogIdFieldDataTypeWarning(properties[idField])) { logManager.logger.debug( - `Unique-identifier ("${idField}") has a value (${properties[idField]}) that is not an integer-type, it is a ${typeof properties[idField]}; this may cause problems in some clients.`, + `Unique-identifier ("${idField}") has a value (${properties[idField]}) that is not an integer-type, it is a ${typeof properties[idField]}; this may cause problems in some clients.`, // eslint-disable-line ); - } else if ( - requiresObjectId && - shouldLogIdFieldRangeWarning(properties[idField]) - ) { + } else if (requiresObjectId && shouldLogIdFieldRangeWarning(properties[idField])) { logManager.logger.debug( - `Unique-identifier ("${idField}") has a value (${properties[idField]}) that is not a valid integer range (0 to ${Number.MAX_SAFE_INTEGER}); this may cause problems in some clients.`, + `Unique-identifier ("${idField}") has a value (${properties[idField]}) that is not a valid integer range (0 to ${Number.MAX_SAFE_INTEGER}); this may cause problems in some clients.`, // eslint-disable-line ); } @@ -49,24 +43,18 @@ function shouldLogIdFieldDataTypeWarning(idFieldValue) { } function shouldLogIdFieldRangeWarning(idFieldValue) { - return ( - idFieldValue && (idFieldValue < 0 || idFieldValue > Number.MAX_SAFE_INTEGER) - ); + return idFieldValue && (idFieldValue < 0 || idFieldValue > Number.MAX_SAFE_INTEGER); } function transformProperties(properties, dateFields) { - return Object.entries(properties).reduce( - (transformedProperties, [key, value]) => { - if (dateFields.includes(key)) { - transformedProperties[key] = - value === null ? null : new Date(value).getTime(); - } else if (_.isObject(value)) { - transformedProperties[key] = JSON.stringify(value); - } else { - transformedProperties[key] = value; - } - return transformedProperties; - }, - {}, - ); + return Object.entries(properties).reduce((transformedProperties, [key, value]) => { + if (dateFields.includes(key)) { + transformedProperties[key] = value === null ? null : new Date(value).getTime(); + } else if (_.isObject(value)) { + transformedProperties[key] = JSON.stringify(value); + } else { + transformedProperties[key] = value; + } + return transformedProperties; + }, {}); } diff --git a/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.spec.js b/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.spec.js index 7d2c1d98..90631ebd 100644 --- a/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.spec.js +++ b/packages/winnow/src/filter-and-transform/transforms/to-esri-attributes.spec.js @@ -5,13 +5,7 @@ const toEsriAttributes = require(modulePath); test('toEsriAttributes, does not require idField', (t) => { // (properties, geometry, dateFields, requiresObjectId, idField) - const result = toEsriAttributes( - { foo: 'bar' }, - { coordinates: [-118, 34] }, - '', - 'false', - '', - ); + const result = toEsriAttributes({ foo: 'bar' }, { coordinates: [-118, 34] }, '', 'false', ''); t.deepEquals(result, { foo: 'bar' }); t.end(); }); @@ -29,14 +23,14 @@ test('toEsriAttributes, requires idField and properties contain it', (t) => { t.end(); }); -test('toEsriAttributes, requires idField, properties contain it, but logs debug string message', (t) => { +test('toEsriAttributes, requires idField, properties contain it, but logs string message', (t) => { const toEsriAttributes = proxyquire(modulePath, { '../../log-manager': { logger: { debug: (message) => { t.equals( message, - 'Unique-identifier ("OBJECTID") has a value (abc) that is not an integer-type, it is a string; this may cause problems in some clients.', + 'Unique-identifier ("OBJECTID") has a value (abc) that is not an integer-type, it is a string; this may cause problems in some clients.', // eslint-disable-line ); }, }, @@ -54,14 +48,14 @@ test('toEsriAttributes, requires idField, properties contain it, but logs debug t.end(); }); -test('toEsriAttributes, requires idField, properties contain it, but logs debug range message', (t) => { +test('toEsriAttributes, requires idField, properties contain it, but logs range message', (t) => { const toEsriAttributes = proxyquire(modulePath, { '../../log-manager': { logger: { debug: (message) => { t.equals( message, - 'Unique-identifier ("OBJECTID") has a value (-1) that is not a valid integer range (0 to 9007199254740991); this may cause problems in some clients.', + 'Unique-identifier ("OBJECTID") has a value (-1) that is not a valid integer range (0 to 9007199254740991); this may cause problems in some clients.', // eslint-disable-line ); }, }, @@ -83,23 +77,14 @@ test('toEsriAttributes, requires idField and properties do not have one, so crea const toEsriAttributes = proxyquire(modulePath, { '../helpers': { createIntegerHash: (string) => { - t.deepEquals( - string, - '{"properties":{"foo":"bar"},"geometry":{"coordinates":[-118,34]}}', - ); + t.deepEquals(string, '{"properties":{"foo":"bar"},"geometry":{"coordinates":[-118,34]}}'); return 99999; }, }, }); // (properties, geometry, dateFields, requiresObjectId, idField) - const result = toEsriAttributes( - { foo: 'bar' }, - { coordinates: [-118, 34] }, - '', - 'true', - 'null', - ); + const result = toEsriAttributes({ foo: 'bar' }, { coordinates: [-118, 34] }, '', 'true', 'null'); t.deepEquals(result, { foo: 'bar', OBJECTID: 99999 }); t.end(); }); @@ -132,7 +117,7 @@ test('toEsriAttributes, require idField, has dateFields', (t) => { createIntegerHash: (string) => { t.deepEquals( string, - `{"properties":{"hello":"world","foo":"${date1.toISOString()}","bar":"${date2.toISOString()}"},"geometry":{"coordinates":[-118,34]}}`, + `{"properties":{"hello":"world","foo":"${date1.toISOString()}","bar":"${date2.toISOString()}"},"geometry":{"coordinates":[-118,34]}}`, // eslint-disable-line ); return 99999; }, diff --git a/packages/winnow/src/helpers/project-coordinates.js b/packages/winnow/src/helpers/project-coordinates.js index be619859..ff17e371 100644 --- a/packages/winnow/src/helpers/project-coordinates.js +++ b/packages/winnow/src/helpers/project-coordinates.js @@ -7,14 +7,10 @@ module.exports = function projectCoordinates(params) { if (!toSR || fromSR === toSR) return coordinates; - return transformCoordinates( - coordinates, - { fromSR, toSR }, - (coordinates, options) => { - if (_.isNumber(coordinates[0]) && _.isNumber(coordinates[1])) { - return proj4(options.fromSR, options.toSR, coordinates); - } - return coordinates; - }, - ); + return transformCoordinates(coordinates, { fromSR, toSR }, (coordinates, options) => { + if (_.isNumber(coordinates[0]) && _.isNumber(coordinates[1])) { + return proj4(options.fromSR, options.toSR, coordinates); + } + return coordinates; + }); }; diff --git a/packages/winnow/src/helpers/transform-coordinates.js b/packages/winnow/src/helpers/transform-coordinates.js index 05a13dfc..2ffb7ae5 100644 --- a/packages/winnow/src/helpers/transform-coordinates.js +++ b/packages/winnow/src/helpers/transform-coordinates.js @@ -1,8 +1,4 @@ -module.exports = function transformCoordinates( - coordinates, - options = {}, - transformFunction, -) { +module.exports = function transformCoordinates(coordinates, options = {}, transformFunction) { if (Array.isArray(coordinates[0])) { return coordinates.map((el) => { return transformCoordinates(el, options, transformFunction); diff --git a/packages/winnow/src/index.js b/packages/winnow/src/index.js index 354d0e44..6b4aba53 100644 --- a/packages/winnow/src/index.js +++ b/packages/winnow/src/index.js @@ -1,9 +1,6 @@ const { setLogger } = require('./log-manager'); -const { - filterAndTransform, - prepareFilterAndTransform, -} = require('./filter-and-transform'); +const { filterAndTransform, prepareFilterAndTransform } = require('./filter-and-transform'); const { query, prepareQuery } = require('./query'); module.exports = { diff --git a/packages/winnow/src/normalize-query-options/aggregates.spec.js b/packages/winnow/src/normalize-query-options/aggregates.spec.js index ea5a1875..d44fd4f5 100644 --- a/packages/winnow/src/normalize-query-options/aggregates.spec.js +++ b/packages/winnow/src/normalize-query-options/aggregates.spec.js @@ -20,9 +20,7 @@ test('normalize-options, aggregates: generate name property when missing', (t) = ], }; const normalized = normalizeAggregates(options); - t.deepEquals(normalized, [ - { type: 'avg', field: 'height', name: 'avg_height' }, - ]); + t.deepEquals(normalized, [{ type: 'avg', field: 'height', name: 'avg_height' }]); }); test('normalize-options, aggregates: remove blank space in name property', (t) => { @@ -37,9 +35,7 @@ test('normalize-options, aggregates: remove blank space in name property', (t) = ], }; const normalized = normalizeAggregates(options); - t.deepEquals(normalized, [ - { type: 'avg', field: 'tree height', name: 'avg_tree_height' }, - ]); + t.deepEquals(normalized, [{ type: 'avg', field: 'tree height', name: 'avg_tree_height' }]); }); test('normalize-options, aggregates: defer to outStatistics as aggregates source', (t) => { @@ -60,7 +56,5 @@ test('normalize-options, aggregates: defer to outStatistics as aggregates source ], }; const normalized = normalizeAggregates(options); - t.deepEquals(normalized, [ - { type: 'avg', field: 'Trunk_Diameter', name: 'avg_Trunk_Diameter' }, - ]); + t.deepEquals(normalized, [{ type: 'avg', field: 'Trunk_Diameter', name: 'avg_Trunk_Diameter' }]); }); diff --git a/packages/winnow/src/normalize-query-options/classification.js b/packages/winnow/src/normalize-query-options/classification.js index 9f7805ae..6aa6eda8 100644 --- a/packages/winnow/src/normalize-query-options/classification.js +++ b/packages/winnow/src/normalize-query-options/classification.js @@ -1,8 +1,7 @@ function normalizeClassification({ classification, classificationDef } = {}) { if (classification) return classification; // TODO: ? normalize standard classification - else if (classificationDef) - return normalizeGeoservicesClassBreaks(classificationDef); + else if (classificationDef) return normalizeGeoservicesClassBreaks(classificationDef); else return undefined; } diff --git a/packages/winnow/src/normalize-query-options/classification.spec.js b/packages/winnow/src/normalize-query-options/classification.spec.js index 594266a8..d91136d1 100644 --- a/packages/winnow/src/normalize-query-options/classification.spec.js +++ b/packages/winnow/src/normalize-query-options/classification.spec.js @@ -1,13 +1,13 @@ const test = require('tape'); const normalizeClassification = require('./classification'); -test('normalize-options, classification: undefined', (t) => { +test('undefined', (t) => { t.plan(1); const normalized = normalizeClassification({}); t.equal(normalized, undefined); }); -test('normalize-options, classification: return classification', (t) => { +test('return classification', (t) => { t.plan(1); const normalized = normalizeClassification({ classification: 'some classification', @@ -15,7 +15,7 @@ test('normalize-options, classification: return classification', (t) => { t.equal(normalized, 'some classification'); }); -test('normalize-options, classification: classificationDef without type should throw error', (t) => { +test('classificationDef without type should throw error', (t) => { t.plan(1); try { normalizeClassification({ classificationDef: {} }); @@ -24,7 +24,7 @@ test('normalize-options, classification: classificationDef without type should t } }); -test('normalize-options, classification: classificationDef of type "classBreaksDef"', (t) => { +test('classificationDef of type "classBreaksDef"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { @@ -48,7 +48,7 @@ test('normalize-options, classification: classificationDef of type "classBreaksD }); }); -test('normalize-options, classification: classificationMethod "esriClassifyNaturalBreaks"', (t) => { +test('classificationMethod "esriClassifyNaturalBreaks"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { @@ -72,7 +72,7 @@ test('normalize-options, classification: classificationMethod "esriClassifyNatur }); }); -test('normalize-options, classification: classificationMethod "esriClassifyQuantile"', (t) => { +test('classificationMethod "esriClassifyQuantile"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { @@ -96,7 +96,7 @@ test('normalize-options, classification: classificationMethod "esriClassifyQuant }); }); -test('normalize-options, classification: classificationMethod "esriClassifyGeometricalInterval"', (t) => { +test('classificationMethod "esriClassifyGeometricalInterval"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { @@ -120,7 +120,7 @@ test('normalize-options, classification: classificationMethod "esriClassifyGeome }); }); -test('normalize-options, classification: classificationMethod "esriClassifyStandardDeviation"', (t) => { +test('classificationMethod "esriClassifyStandardDeviation"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { @@ -144,7 +144,7 @@ test('normalize-options, classification: classificationMethod "esriClassifyStand }); }); -test('normalize-options, classification: transformationMethod "esriNormalizeByLog"', (t) => { +test('transformationMethod "esriNormalizeByLog"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { @@ -168,7 +168,7 @@ test('normalize-options, classification: transformationMethod "esriNormalizeByLo }); }); -test('normalize-options, classification: transformationMethod "esriNormalizeByPercentOfTotal"', (t) => { +test('transformationMethod "esriNormalizeByPercentOfTotal"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { @@ -192,7 +192,7 @@ test('normalize-options, classification: transformationMethod "esriNormalizeByPe }); }); -test('normalize-options, classification: classificationDef of type "uniqueValueDev"', (t) => { +test('classificationDef of type "uniqueValueDev"', (t) => { t.plan(1); const normalized = normalizeClassification({ classificationDef: { diff --git a/packages/winnow/src/normalize-query-options/collection.spec.js b/packages/winnow/src/normalize-query-options/collection.spec.js index 5824b333..28428675 100644 --- a/packages/winnow/src/normalize-query-options/collection.spec.js +++ b/packages/winnow/src/normalize-query-options/collection.spec.js @@ -27,9 +27,7 @@ test('normalize-options, collection: metadata.fields already defined', (t) => { test('normalize-options, collection: generate metadata fields from feature', (t) => { t.plan(1); - const normalized = normalizeCollection({}, [ - { properties: { name: 'test' } }, - ]); + const normalized = normalizeCollection({}, [{ properties: { name: 'test' } }]); t.deepEquals(normalized, { metadata: { fields: [ diff --git a/packages/winnow/src/normalize-query-options/date-fields.js b/packages/winnow/src/normalize-query-options/date-fields.js index 87043d4a..63dbbddc 100644 --- a/packages/winnow/src/normalize-query-options/date-fields.js +++ b/packages/winnow/src/normalize-query-options/date-fields.js @@ -9,8 +9,7 @@ function deriveDateFields(collection, requestedFields) { return collection.metadata.fields .filter(({ type, name }) => { return ( - type === 'Date' && - (requestedFields === undefined || requestedFields.indexOf(name) > -1) + type === 'Date' && (requestedFields === undefined || requestedFields.indexOf(name) > -1) ); }) .map(({ name }) => { diff --git a/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.js b/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.js index 89c70c4e..9e17eab7 100644 --- a/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.js +++ b/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.js @@ -4,24 +4,20 @@ const { normalizeArray } = require('./helpers'); const normalizeSpatialReference = require('./spatial-reference'); /** - * Normalize the input spatial reference for a geometry filter. Look on options.geometry object first. - * If spatial reference not present, look in options.inSR. Defaults to EPSG:4326 (which is known to Proj4) - * @param {object} options options object that may or may not have "geometry" and "inSR" properties - * @returns {string} EPSG: or srs WKT; defaults to EPSG:4326 + * Normalize the input spatial reference for a geometry filter. Look on options.geometry + * object first; if spatial reference not present, look in options.inSR. Defaults to EPSG:4326 + * (which is known to Proj4) */ function normalizeGeometryFilterSpatialReference(options = {}) { const geometry = options.geometry || options.bbox; - const geometryEnvelopeSpatialReference = - extractGeometryFilterSpatialReference(geometry); + const geometryEnvelopeSpatialReference = extractGeometryFilterSpatialReference(geometry); const spatialReference = normalizeSpatialReference( geometryEnvelopeSpatialReference || options.inSR, ); if (!spatialReference) { - logManager.logger.debug( - 'geometry filter spatial reference unknown. Defaulting to EPSG:4326.', - ); + logManager.logger.debug('geometry filter spatial reference unknown. Defaulting to EPSG:4326.'); } return spatialReference || { wkid: 4326 }; } diff --git a/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.spec.js b/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.spec.js index a7165360..adcef88a 100644 --- a/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.spec.js +++ b/packages/winnow/src/normalize-query-options/geometry-filter-spatial-reference.spec.js @@ -1,19 +1,19 @@ const test = require('tape'); const normalizeGeometryFilterSpatialReference = require('./geometry-filter-spatial-reference'); -test('normalize-query-options, geometry-filter-spatial-reference: undefined input', (t) => { +test('undefined input', (t) => { t.plan(1); const { wkid } = normalizeGeometryFilterSpatialReference(); t.equal(wkid, 4326); }); -test('normalize-query-options, geometry-filter-spatial-reference: undefined options', (t) => { +test('undefined options', (t) => { t.plan(1); const { wkid } = normalizeGeometryFilterSpatialReference({}); t.equal(wkid, 4326); }); -test('normalize-query-options, geometry-filter-spatial-reference: defer to geometry option', (t) => { +test('defer to geometry option', (t) => { t.plan(1); const options = { geometry: '100,200,300,400,3857', @@ -24,7 +24,7 @@ test('normalize-query-options, geometry-filter-spatial-reference: defer to geome t.equal(wkid, 3857); }); -test('normalize-query-options, geometry-filter-spatial-reference: defer to bbox option if no geometry', (t) => { +test('defer to bbox option if no geometry', (t) => { t.plan(1); const options = { bbox: '100,200,300,400,3857', @@ -34,7 +34,7 @@ test('normalize-query-options, geometry-filter-spatial-reference: defer to bbox t.equal(wkid, 3857); }); -test('normalize-query-options, geometry-filter-spatial-reference: geometry filter bbox missing spatial reference', (t) => { +test('geometry filter bbox missing spatial reference', (t) => { t.plan(1); const options = { geometry: '100,200,300,400', @@ -44,7 +44,7 @@ test('normalize-query-options, geometry-filter-spatial-reference: geometry filte t.equal(wkid, 4269); }); -test('normalize-query-options, geometry-filter-spatial-reference: defer to geometry filter wkid', (t) => { +test('defer to geometry filter wkid', (t) => { t.plan(1); const options = { geometry: { @@ -58,14 +58,14 @@ test('normalize-query-options, geometry-filter-spatial-reference: defer to geome t.equal(wkid, 4326); }); -test('normalize-query-options, geometry-filter-spatial-reference: inSR string', (t) => { +test('inSR string', (t) => { t.plan(1); const options = { inSR: '4269' }; const { wkid } = normalizeGeometryFilterSpatialReference(options); t.equal(wkid, 4269); }); -test('normalize-query-options, geometry-filter-spatial-reference: inSR spatialReference object', (t) => { +test('inSR spatialReference object', (t) => { t.plan(1); const options = { inSR: { wkid: 4269 } }; const { wkid } = normalizeGeometryFilterSpatialReference(options); diff --git a/packages/winnow/src/normalize-query-options/geometry-filter.js b/packages/winnow/src/normalize-query-options/geometry-filter.js index a3cd84f6..fb125112 100644 --- a/packages/winnow/src/normalize-query-options/geometry-filter.js +++ b/packages/winnow/src/normalize-query-options/geometry-filter.js @@ -11,8 +11,7 @@ function normalizeGeometryFilter(options = {}) { if (!geometry) return; - const geometryFilterSpatialReference = - normalizeGeometryFilterSpatialReference(options); + const geometryFilterSpatialReference = normalizeGeometryFilterSpatialReference(options); const fromSR = getCrsString(geometryFilterSpatialReference); const geometryFilter = transformGeometryToGeojson(geometry); diff --git a/packages/winnow/src/normalize-query-options/geometry-filter.spec.js b/packages/winnow/src/normalize-query-options/geometry-filter.spec.js index 6b86a4cf..179288f3 100644 --- a/packages/winnow/src/normalize-query-options/geometry-filter.spec.js +++ b/packages/winnow/src/normalize-query-options/geometry-filter.spec.js @@ -1,13 +1,13 @@ const test = require('tape'); const normalizeGeometryFilter = require('./geometry-filter'); -test('normalize-query-options, geometry-filter: undefined options input', (t) => { +test('undefined options input', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter(); t.equal(geometryFilter, undefined); }); -test('normalize-query-options, geometry-filter: defer to geometry options', (t) => { +test('defer to geometry options', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: [10, 15, 20, 25], @@ -27,7 +27,7 @@ test('normalize-query-options, geometry-filter: defer to geometry options', (t) }); }); -test('normalize-query-options, geometry-filter: use bbox if geometry is undefined', (t) => { +test('use bbox if geometry is undefined', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ bbox: [0, 45, 50, 90] }); t.deepEquals(geometryFilter, { @@ -44,7 +44,7 @@ test('normalize-query-options, geometry-filter: use bbox if geometry is undefine }); }); -test('normalize-query-options, geometry-filter: filter spatial reference of 4326 does not trigger reproject', (t) => { +test('filter spatial reference of 4326 does not trigger reproject', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: [0, 45, 50, 90], @@ -64,7 +64,7 @@ test('normalize-query-options, geometry-filter: filter spatial reference of 4326 }); }); -test('normalize-query-options, geometry-filter: filter spatial reference of 3857 does trigger reproject', (t) => { +test('filter spatial reference of 3857 does trigger reproject', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: { @@ -91,7 +91,7 @@ test('normalize-query-options, geometry-filter: filter spatial reference of 3857 }); }); -test('normalize-query-options, geometry-filter: data spatial reference of 3857 triggers reproject of filter', (t) => { +test('data spatial reference of 3857 triggers reproject of filter', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: { @@ -119,7 +119,7 @@ test('normalize-query-options, geometry-filter: data spatial reference of 3857 t }); }); -test('normalize-query-options, geometry-filter: same data/filter spatial reference skips filter reprojection', (t) => { +test('same data/filter spatial reference skips filter reprojection', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: { @@ -147,7 +147,7 @@ test('normalize-query-options, geometry-filter: same data/filter spatial referen }); }); -test('normalize-query-options, geometry-filter: geometry as coordinate string polygon', (t) => { +test('geometry as coordinate string polygon', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: '10,15,20,25' }); t.deepEquals(geometryFilter, { @@ -164,7 +164,7 @@ test('normalize-query-options, geometry-filter: geometry as coordinate string po }); }); -test('normalize-query-options, geometry-filter: geometry as coordinate string point', (t) => { +test('geometry as coordinate string point', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: '-10,10' }); t.deepEquals(geometryFilter, { @@ -173,7 +173,7 @@ test('normalize-query-options, geometry-filter: geometry as coordinate string po }); }); -test('normalize-query-options, geometry-filter: geometry as coordinate array polygon', (t) => { +test('geometry as coordinate array polygon', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: [10, 15, 20, 25], @@ -192,7 +192,7 @@ test('normalize-query-options, geometry-filter: geometry as coordinate array pol }); }); -test('normalize-query-options, geometry-filter: geometry as coordinate array point', (t) => { +test('geometry as coordinate array point', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: [-10, 10] }); t.deepEquals(geometryFilter, { @@ -201,7 +201,7 @@ test('normalize-query-options, geometry-filter: geometry as coordinate array poi }); }); -test('normalize-query-options, geometry-filter: geometry as Esri envelope', (t) => { +test('geometry as Esri envelope', (t) => { t.plan(1); const geometryFilter = normalizeGeometryFilter({ geometry: { diff --git a/packages/winnow/src/normalize-query-options/id-field.js b/packages/winnow/src/normalize-query-options/id-field.js index 37025154..71f4a87e 100644 --- a/packages/winnow/src/normalize-query-options/id-field.js +++ b/packages/winnow/src/normalize-query-options/id-field.js @@ -10,7 +10,7 @@ function normalizeIdField(options, features = []) { if (shouldWarnIdFieldIsMissingFromData(idField, features)) { logManager.logger.debug( - 'requested provider has "idField" assignment, but this property is not found in properties of all features.', + 'requested provider has "idField" assignment, but this property is not found in properties of all features.', // eslint-disable-line ); } diff --git a/packages/winnow/src/normalize-query-options/limit.js b/packages/winnow/src/normalize-query-options/limit.js index 522baf15..d92b4905 100644 --- a/packages/winnow/src/normalize-query-options/limit.js +++ b/packages/winnow/src/normalize-query-options/limit.js @@ -12,7 +12,8 @@ function normalizeLimit(options) { logManager.logger.debug('"limit" option is not an integer; skipping'); return; } - // If there is a limit, add 1 to it so we can later calculate a exceededTransferLimit. The result set will be resized accordingly, post SQL + // If there is a limit, add 1 to it so we can later calculate a exceededTransferLimit + // The result set will be resized accordingly, post SQL return limit ? limit + 1 : undefined; } diff --git a/packages/winnow/src/normalize-query-options/offset.js b/packages/winnow/src/normalize-query-options/offset.js index bd44c3de..24bf56de 100644 --- a/packages/winnow/src/normalize-query-options/offset.js +++ b/packages/winnow/src/normalize-query-options/offset.js @@ -5,9 +5,7 @@ * @returns {integer} or undefined */ function normalizeOffset(options) { - return options.limit !== undefined - ? options.offset || options.resultOffset - : undefined; + return options.limit !== undefined ? options.offset || options.resultOffset : undefined; } module.exports = normalizeOffset; diff --git a/packages/winnow/src/normalize-query-options/output-data-spatial-reference.js b/packages/winnow/src/normalize-query-options/output-data-spatial-reference.js index 94462530..198c5937 100644 --- a/packages/winnow/src/normalize-query-options/output-data-spatial-reference.js +++ b/packages/winnow/src/normalize-query-options/output-data-spatial-reference.js @@ -3,18 +3,12 @@ const { getCollectionCrs } = require('./helpers'); const logManager = require('../log-manager'); function normalizeOutputDataSpatialReference(options = {}) { - const { - srsname, - srsName, - projection, - outputCrs, - outSR, - inputCrs, - sourceSR, - collection, - } = options; + const { srsname, srsName, projection, outputCrs, outSR, inputCrs, sourceSR, collection } = + options; - // if no output spatial reference set (outputCrs, projection, srsname, srsName, outSR), assume output will be same as input (inputCrs, sourceSR) + /* if no output spatial reference set (outputCrs, projection, srsname, srsName, outSR) + * assume output will be same as input (inputCrs, sourceSR) + */ const outputSpatialReference = outputCrs || projection || @@ -30,7 +24,7 @@ function normalizeOutputDataSpatialReference(options = {}) { if (!spatialReference) { logManager.logger.debug( - `spatial reference "${outputSpatialReference}" could not be normalized. Defaulting to EPSG:4326.`, + `spatial reference "${outputSpatialReference}" could not be normalized. Defaulting to EPSG:4326.`, // eslint-disable-line ); // @TODO: throw error } diff --git a/packages/winnow/src/normalize-query-options/output-data-spatial-reference.spec.js b/packages/winnow/src/normalize-query-options/output-data-spatial-reference.spec.js index 4e5ec484..813a71b1 100644 --- a/packages/winnow/src/normalize-query-options/output-data-spatial-reference.spec.js +++ b/packages/winnow/src/normalize-query-options/output-data-spatial-reference.spec.js @@ -1,19 +1,19 @@ const test = require('tape'); const normalizeOutputDataSpatialReference = require('./output-data-spatial-reference'); -test('normalize-query-options, output-data-spatial-reference: undefined input', (t) => { +test('undefined input', (t) => { t.plan(1); const { wkid } = normalizeOutputDataSpatialReference(); t.equal(wkid, 4326); }); -test('normalize-query-options, output-data-spatial-reference: undefined options', (t) => { +test('undefined options', (t) => { t.plan(1); const { wkid } = normalizeOutputDataSpatialReference({}); t.equal(wkid, 4326); }); -test('normalize-query-options, output-data-spatial-reference: defer to projection option', (t) => { +test('defer to projection option', (t) => { t.plan(1); const options = { projection: 4326, @@ -25,7 +25,7 @@ test('normalize-query-options, output-data-spatial-reference: defer to projectio t.equal(wkid, 4326); }); -test('normalize-query-options, output-data-spatial-reference: defer to srsname option', (t) => { +test('defer to srsname option', (t) => { t.plan(1); const options = { srsname: 4269, @@ -36,7 +36,7 @@ test('normalize-query-options, output-data-spatial-reference: defer to srsname o t.equal(wkid, 4269); }); -test('normalize-query-options, output-data-spatial-reference: defer to srsName option', (t) => { +test('defer to srsName option', (t) => { t.plan(1); const options = { srsName: 3857, @@ -46,7 +46,7 @@ test('normalize-query-options, output-data-spatial-reference: defer to srsName o t.equal(wkid, 3857); }); -test('normalize-query-options, output-data-spatial-reference: defer to outSR option', (t) => { +test('defer to outSR option', (t) => { t.plan(2); const options = { outSR: 2227, @@ -55,11 +55,11 @@ test('normalize-query-options, output-data-spatial-reference: defer to outSR opt t.equal(wkid, 2227); t.equal( wkt, - 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', + 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', // eslint-disable-line ); }); -test('normalize-query-options, output-data-spatial-reference: defer to inputCrs option', (t) => { +test('defer to inputCrs option', (t) => { t.plan(2); const options = { inputCrs: 2227, @@ -68,11 +68,11 @@ test('normalize-query-options, output-data-spatial-reference: defer to inputCrs t.equal(wkid, 2227); t.equal( wkt, - 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', + 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', // eslint-disable-line ); }); -test('normalize-query-options, output-data-spatial-reference: defer to sourceSR option', (t) => { +test('defer to sourceSR option', (t) => { t.plan(2); const options = { sourceSR: 2227, @@ -81,11 +81,11 @@ test('normalize-query-options, output-data-spatial-reference: defer to sourceSR t.equal(wkid, 2227); t.equal( wkt, - 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', + 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', // eslint-disable-line ); }); -test('normalize-query-options, output-data-spatial-reference: defer to collection.crs option', (t) => { +test('defer to collection.crs option', (t) => { t.plan(2); const options = { collection: { @@ -96,11 +96,11 @@ test('normalize-query-options, output-data-spatial-reference: defer to collectio t.equal(wkid, 2227); t.equal( wkt, - 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', + 'PROJCS["NAD_1983_StatePlane_California_III_FIPS_0403_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-120.5],PARAMETER["Standard_Parallel_1",37.06666666666667],PARAMETER["Standard_Parallel_2",38.43333333333333],PARAMETER["Latitude_Of_Origin",36.5],UNIT["Foot_US",0.3048006096012192]]', // eslint-disable-line ); }); -test('normalize-query-options, output-data-spatial-reference: bad input', (t) => { +test('bad input', (t) => { t.plan(1); const options = { outSR: 99999, diff --git a/packages/winnow/src/normalize-query-options/source-data-spatial-reference.js b/packages/winnow/src/normalize-query-options/source-data-spatial-reference.js index 99e6de17..dd09e04f 100644 --- a/packages/winnow/src/normalize-query-options/source-data-spatial-reference.js +++ b/packages/winnow/src/normalize-query-options/source-data-spatial-reference.js @@ -2,22 +2,15 @@ const normalizeSpatialReference = require('./spatial-reference'); const { getCollectionCrs } = require('./helpers'); const logManager = require('../log-manager'); -function normalizeSourceDataSpatialReference({ - inputCrs, - sourceSR, - collection, -} = {}) { - const sourceDataSpatialReference = - inputCrs || sourceSR || getCollectionCrs(collection); +function normalizeSourceDataSpatialReference({ inputCrs, sourceSR, collection } = {}) { + const sourceDataSpatialReference = inputCrs || sourceSR || getCollectionCrs(collection); if (!sourceDataSpatialReference) return { wkid: 4326 }; - const spatialReference = normalizeSpatialReference( - sourceDataSpatialReference, - ); + const spatialReference = normalizeSpatialReference(sourceDataSpatialReference); if (!spatialReference) { logManager.logger.debug( - `spatial reference "${sourceDataSpatialReference}" could not be normalized. Defaulting to EPSG:4326.`, + `spatial reference "${sourceDataSpatialReference}" could not be normalized. Defaulting to EPSG:4326.`, // eslint-disable-line ); // @TODO: throw error? } diff --git a/packages/winnow/src/normalize-query-options/source-data-spatial-reference.spec.js b/packages/winnow/src/normalize-query-options/source-data-spatial-reference.spec.js index ceac6b12..131c45f8 100644 --- a/packages/winnow/src/normalize-query-options/source-data-spatial-reference.spec.js +++ b/packages/winnow/src/normalize-query-options/source-data-spatial-reference.spec.js @@ -1,35 +1,35 @@ const test = require('tape'); const normalizeSourceDataSpatialReference = require('./source-data-spatial-reference'); -test('normalize-query-options, source-data-spatial-reference: undefined input', (t) => { +test('undefined input', (t) => { t.plan(1); const { wkid } = normalizeSourceDataSpatialReference(); t.equal(wkid, 4326); }); -test('normalize-query-options, source-data-spatial-reference: known spatial reference', (t) => { +test('known spatial reference', (t) => { t.plan(1); const { wkid } = normalizeSourceDataSpatialReference({ inputCrs: 3857 }); t.equal(wkid, 3857); }); -test('normalize-query-options, source-data-spatial-reference: spatial reference that requires wkt', (t) => { +test('spatial reference that requires wkt', (t) => { t.plan(2); const { wkid, wkt } = normalizeSourceDataSpatialReference({ inputCrs: 2228 }); t.equal(wkid, 2228); t.equal( wkt, - 'PROJCS["NAD_1983_StatePlane_California_IV_FIPS_0404_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-119.0],PARAMETER["Standard_Parallel_1",36.0],PARAMETER["Standard_Parallel_2",37.25],PARAMETER["Latitude_Of_Origin",35.33333333333334],UNIT["Foot_US",0.3048006096012192]]', + 'PROJCS["NAD_1983_StatePlane_California_IV_FIPS_0404_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-119.0],PARAMETER["Standard_Parallel_1",36.0],PARAMETER["Standard_Parallel_2",37.25],PARAMETER["Latitude_Of_Origin",35.33333333333334],UNIT["Foot_US",0.3048006096012192]]', // eslint-disable-line ); }); -test('normalize-query-options, source-data-spatial-reference: sourceSR option', (t) => { +test('sourceSR option', (t) => { t.plan(1); const { wkid } = normalizeSourceDataSpatialReference({ sourceSR: 3857 }); t.equal(wkid, 3857); }); -test('normalize-query-options, source-data-spatial-reference: collection crs', (t) => { +test('collection crs', (t) => { t.plan(1); const params = { collection: { @@ -40,7 +40,7 @@ test('normalize-query-options, source-data-spatial-reference: collection crs', ( t.equal(wkid, 4326); }); -test('normalize-query-options, source-data-spatial-reference: collection crs', (t) => { +test('collection crs', (t) => { t.plan(1); const params = { collection: { @@ -51,7 +51,7 @@ test('normalize-query-options, source-data-spatial-reference: collection crs', ( t.equal(wkid, 3857); }); -test('normalize-query-options, source-data-spatial-reference: known spatial reference', (t) => { +test('known spatial reference', (t) => { t.plan(1); const params = { collection: { diff --git a/packages/winnow/src/normalize-query-options/spatial-reference.js b/packages/winnow/src/normalize-query-options/spatial-reference.js index 18fbc446..f541d7e8 100644 --- a/packages/winnow/src/normalize-query-options/spatial-reference.js +++ b/packages/winnow/src/normalize-query-options/spatial-reference.js @@ -22,9 +22,7 @@ function normalizeSpatialReference(input) { const { error } = schema.validate(input); if (error) { - logManager.logger.debug( - `${input} is not a valid spatial reference; defaulting to none`, - ); + logManager.logger.debug(`${input} is not a valid spatial reference; defaulting to none`); // Todo: throw error return; } @@ -68,10 +66,7 @@ function parseSpatialReferenceInput(spatialReference) { } function isNumericSpatialReferenceId(spatialReference) { - return ( - Number.isInteger(spatialReference) || - Number.isInteger(Number(spatialReference)) - ); + return Number.isInteger(spatialReference) || Number.isInteger(Number(spatialReference)); } function isPrefixedSpatialReferenceId(spatialReference) { @@ -79,9 +74,7 @@ function isPrefixedSpatialReferenceId(spatialReference) { } function extractPrefixedSpatialReferenceId(prefixedId) { - const spatialRefId = prefixedId.match( - /^(EPSG|ESRI|SR-ORG|IAU2000):([0-9]+)/, - )[2]; + const spatialRefId = prefixedId.match(/^(EPSG|ESRI|SR-ORG|IAU2000):([0-9]+)/)[2]; return Number(spatialRefId); } @@ -92,7 +85,6 @@ function convertWkidToSpatialReference(wkid) { // If the input wkid is one of the set known to proj4, return it in an object if (PROJ4_WKIDS.includes(wkid)) return { wkid }; - // WKID is not known to proj4, so we need its WKT spatial reference in order to do downstream reprojections. First check in local lookup return wktLookup.get(wkid) || esriWktLookup(wkid); } diff --git a/packages/winnow/src/normalize-query-options/spatial-reference.spec.js b/packages/winnow/src/normalize-query-options/spatial-reference.spec.js index 49ce41a7..45322b35 100644 --- a/packages/winnow/src/normalize-query-options/spatial-reference.spec.js +++ b/packages/winnow/src/normalize-query-options/spatial-reference.spec.js @@ -43,15 +43,15 @@ test('normalize-query-options, spatial-reference: object with latest wkid from p t.equal(wkid, 4269); }); -test('normalize-query-options, spatial-reference: object with wkt that is Web Mercator string', (t) => { +test('object with wkt that is Web Mercator string', (t) => { t.plan(1); const inputWkt = - 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; + 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; // eslint-disable-line const { wkid } = normalizeSpatialReference({ wkt: inputWkt }); t.equal(wkid, 3857); }); -test('normalize-query-options, spatial-reference: object with wkt that is not Web Mercator string', (t) => { +test('object with wkt that is not Web Mercator string', (t) => { t.plan(2); const inputWkt = `PROJCS["NAD_1983_StatePlane_California_V_FIPS_0405_Feet", GEOGCS["GCS_North_American_1983", @@ -76,7 +76,7 @@ test('normalize-query-options, spatial-reference: object with wkt that is not We test('normalize-query-options, spatial-reference: Web Mercator wkt string', (t) => { t.plan(1); const inputWkt = - 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; + 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'; // eslint-disable-line const { wkid } = normalizeSpatialReference(inputWkt); t.equal(wkid, 3857); }); @@ -124,13 +124,13 @@ test('normalize-query-options, spatial-reference: wkid 102100', (t) => { test('normalize-query-options, spatial-reference: wkid not in Proj4 list', (t) => { t.plan(2); const inputWkt = - 'PROJCS["NAD_1983_HARN_StatePlane_Washington_North_FIPS_4601",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-120.8333333333333],PARAMETER["Standard_Parallel_1",47.5],PARAMETER["Standard_Parallel_2",48.73333333333333],PARAMETER["Latitude_Of_Origin",47.0],UNIT["Meter",1.0]]'; + 'PROJCS["NAD_1983_HARN_StatePlane_Washington_North_FIPS_4601",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-120.8333333333333],PARAMETER["Standard_Parallel_1",47.5],PARAMETER["Standard_Parallel_2",48.73333333333333],PARAMETER["Latitude_Of_Origin",47.0],UNIT["Meter",1.0]]'; // eslint-disable-line const { wkt, wkid } = normalizeSpatialReference(2855); t.equal(wkt, inputWkt); t.equal(wkid, 2855); }); -test('normalize-query-options, spatial-reference: object with wkid and other optional properties', (t) => { +test('object with wkid and other optional properties', (t) => { t.plan(1); const { wkid } = normalizeSpatialReference({ wkid: 102643, diff --git a/packages/winnow/src/normalize-query-options/where.js b/packages/winnow/src/normalize-query-options/where.js index 97fbc70a..ce03e92c 100644 --- a/packages/winnow/src/normalize-query-options/where.js +++ b/packages/winnow/src/normalize-query-options/where.js @@ -20,10 +20,7 @@ function normalizeWhere(where = '') { function convertToISODates(where) { const matches = where.match(/(?!date )('?\d\d\d\d-\d\d-\d\d'?)/g); matches.forEach((match) => { - where = where.replace( - `date ${match}`, - `'${new Date(match.toString()).toISOString()}'`, - ); + where = where.replace(`date ${match}`, `'${new Date(match.toString()).toISOString()}'`); }); return where; } diff --git a/packages/winnow/src/normalize-query-options/where.spec.js b/packages/winnow/src/normalize-query-options/where.spec.js index d5277aeb..f1d60de4 100644 --- a/packages/winnow/src/normalize-query-options/where.spec.js +++ b/packages/winnow/src/normalize-query-options/where.spec.js @@ -15,10 +15,7 @@ test('normalize-options, where: error on non-strings', (t) => { normalizeWhere(9999); t.fail('should have thrown'); } catch (error) { - t.equals( - error.message, - 'Invalid "where" parameter: must be a string if defined', - ); + t.equals(error.message, 'Invalid "where" parameter: must be a string if defined'); } }); @@ -38,12 +35,11 @@ test('normalize-options, where: remove esri-style select-all when present', (t) test('normalize-options, where: convert esri/sql-style dates to ISO dates', (t) => { t.plan(1); - const where = - "foo='bar' AND ISSUE_DATE >= date 2017-01-05 AND ISSUE_DATE <= date 2018-01-05"; + const where = "foo='bar' AND ISSUE_DATE >= date 2017-01-05 AND ISSUE_DATE <= date 2018-01-05"; const normalized = normalizeWhere(where); t.equal( normalized, - "foo='bar' AND ISSUE_DATE >= '2017-01-05T00:00:00.000Z' AND ISSUE_DATE <= '2018-01-05T00:00:00.000Z'", + "foo='bar' AND ISSUE_DATE >= '2017-01-05T00:00:00.000Z' AND ISSUE_DATE <= '2018-01-05T00:00:00.000Z'", // eslint-disable-line ); }); diff --git a/packages/winnow/src/query/classification-query.js b/packages/winnow/src/query/classification-query.js index a5d499c7..6b1db640 100644 --- a/packages/winnow/src/query/classification-query.js +++ b/packages/winnow/src/query/classification-query.js @@ -10,8 +10,7 @@ function classificationQuery(features, sqlstatement, options) { const { breakCount, type } = classification; if (type === 'classes') { - if (breakCount <= 0) - throw new Error('breakCount must be positive: ' + breakCount); + if (breakCount <= 0) throw new Error('breakCount must be positive: ' + breakCount); return calculateClassBreaks(filtered, classification); } @@ -27,9 +26,7 @@ function validateQueryResult(features) { throw new Error('query results include undefined features'); } if (features.length === 0) { - throw new Error( - 'query results in zero features; features needed in order to classify', - ); + throw new Error('query results in zero features; features needed in order to classify'); } } diff --git a/packages/winnow/src/query/classification-query.spec.js b/packages/winnow/src/query/classification-query.spec.js index dd610f90..60e9c81b 100644 --- a/packages/winnow/src/query/classification-query.spec.js +++ b/packages/winnow/src/query/classification-query.spec.js @@ -77,15 +77,11 @@ test('classificationQuery, classes classification type', (t) => { '../calculate-class-breaks/index': calculateClassBreaksSpy, }); - const result = classificationQuery( - ['feature1', 'feature2', 'feature3'], - 'SQL statement', - { - foo: 'bar', - collection: {}, - classification: { type: 'classes', breakCount: 1 }, - }, - ); + const result = classificationQuery(['feature1', 'feature2', 'feature3'], 'SQL statement', { + foo: 'bar', + collection: {}, + classification: { type: 'classes', breakCount: 1 }, + }); t.deepEquals(result, 'classification results'); t.ok(standardQuerySpy.calledOnce); t.deepEquals(standardQuerySpy.firstCall.args, [ @@ -119,15 +115,11 @@ test('classificationQuery, unique classification type', (t) => { './unique-value-query': uniqueValueQuerySpy, }); - const result = classificationQuery( - ['feature1', 'feature2', 'feature3'], - 'SQL filter statement', - { - foo: 'bar', - collection: {}, - classification: { type: 'unique' }, - }, - ); + const result = classificationQuery(['feature1', 'feature2', 'feature3'], 'SQL filter statement', { + foo: 'bar', + collection: {}, + classification: { type: 'unique' }, + }); t.deepEquals(result, 'unique value query result'); t.ok(standardQuerySpy.calledOnce); t.deepEquals(standardQuerySpy.firstCall.args, [ @@ -136,9 +128,6 @@ test('classificationQuery, unique classification type', (t) => { { foo: 'bar', collection: {}, classification: { type: 'unique' } }, ]); t.ok(uniqueValueQuerySpy.calledOnce); - t.deepEquals(uniqueValueQuerySpy.firstCall.args, [ - ['feature1', 'feature2'], - { type: 'unique' }, - ]); + t.deepEquals(uniqueValueQuerySpy.firstCall.args, [['feature1', 'feature2'], { type: 'unique' }]); t.end(); }); diff --git a/packages/winnow/src/query/normalize-query-input.spec.js b/packages/winnow/src/query/normalize-query-input.spec.js index 1747fa91..d83a8ca9 100644 --- a/packages/winnow/src/query/normalize-query-input.spec.js +++ b/packages/winnow/src/query/normalize-query-input.spec.js @@ -2,26 +2,14 @@ const test = require('tape'); const normalizeQueryInput = require('./normalize-query-input'); test('normalizeQueryInput: invalid input should throw error', (t) => { - const invalidInput = [ - undefined, - null, - {}, - { features: [{}] }, - [{}], - 'string', - 1234, - true, - ]; + const invalidInput = [undefined, null, {}, { features: [{}] }, [{}], 'string', 1234, true]; invalidInput.forEach((input) => { try { normalizeQueryInput(input); t.fail(`should have throw error on: ${input}`); } catch (error) { - t.equals( - error.message, - 'Could not normalize query input to feature array', - ); + t.equals(error.message, 'Could not normalize query input to feature array'); } }); t.end(); diff --git a/packages/winnow/src/query/package-features.js b/packages/winnow/src/query/package-features.js index bda7d0be..be4d40cb 100644 --- a/packages/winnow/src/query/package-features.js +++ b/packages/winnow/src/query/package-features.js @@ -1,9 +1,6 @@ const _ = require('lodash'); -function packageFeatures( - features = [], - { groupBy, aggregates, collection, outputCrs } = {}, -) { +function packageFeatures(features = [], { groupBy, aggregates, collection, outputCrs } = {}) { if (groupBy || (!aggregates && !collection)) { return features; } @@ -17,14 +14,8 @@ function packageFeatures( } } -function packageCollection({ - features, - collection, - outputCrs: { wkid, wkt } = {}, -}) { - const outputCollection = _.chain(collection) - .cloneDeep() - .set('features', features); +function packageCollection({ features, collection, outputCrs: { wkid, wkt } = {} }) { + const outputCollection = _.chain(collection).cloneDeep().set('features', features); if (!wkid && !wkt) { return outputCollection.value(); } diff --git a/packages/winnow/src/query/prepare-query.js b/packages/winnow/src/query/prepare-query.js index 54a1d9f1..5c794a62 100644 --- a/packages/winnow/src/query/prepare-query.js +++ b/packages/winnow/src/query/prepare-query.js @@ -1,9 +1,6 @@ const _ = require('lodash'); const { filterAndTransform } = require('../filter-and-transform'); -const { - create: createSqlStatement, - params: createSqlParams, -} = require('../sql-query-builder'); +const { create: createSqlStatement, params: createSqlParams } = require('../sql-query-builder'); const normalizeQueryOptions = require('../normalize-query-options'); const normalizeQueryInput = require('./normalize-query-input'); const packageFeatures = require('./package-features'); diff --git a/packages/winnow/src/query/prepare-query.spec.js b/packages/winnow/src/query/prepare-query.spec.js index 8e76a22f..0adeb22b 100644 --- a/packages/winnow/src/query/prepare-query.spec.js +++ b/packages/winnow/src/query/prepare-query.spec.js @@ -48,10 +48,7 @@ test('Should return prepared query', (t) => { t.ok(sqlQueryHelpers.create.calledOnce); t.deepEquals(sqlQueryHelpers.create.firstCall.args, [{ hello: 'world' }]); t.ok(sqlQueryHelpers.params.calledOnce); - t.deepEquals(sqlQueryHelpers.params.firstCall.args, [ - '$features$', - { hello: 'world' }, - ]); + t.deepEquals(sqlQueryHelpers.params.firstCall.args, ['$features$', { hello: 'world' }]); t.equals(typeof preparedQuery, 'function'); // Execute prepared query diff --git a/packages/winnow/src/query/query.js b/packages/winnow/src/query/query.js index 5756eb9a..13c6ea81 100644 --- a/packages/winnow/src/query/query.js +++ b/packages/winnow/src/query/query.js @@ -5,16 +5,12 @@ const classificationQuery = require('./classification-query'); const standardQuery = require('./standard-query'); module.exports = function (input, options = {}) { - const { options: normalizedOptions, features } = normalizeFeaturesAndOptions( - input, - options, - ); + const { options: normalizedOptions, features } = normalizeFeaturesAndOptions(input, options); const { aggregates, classification } = normalizedOptions; const sqlStatement = createSqlStatement(normalizedOptions); - if (classification) - return classificationQuery(features, sqlStatement, normalizedOptions); + if (classification) return classificationQuery(features, sqlStatement, normalizedOptions); return standardQuery(features, sqlStatement, { skipLimitHandling: !!aggregates, diff --git a/packages/winnow/src/query/query.spec.js b/packages/winnow/src/query/query.spec.js index 71454759..ffa7824b 100644 --- a/packages/winnow/src/query/query.spec.js +++ b/packages/winnow/src/query/query.spec.js @@ -32,14 +32,9 @@ test('Should normalize and execute standard query on feature array', (t) => { t.ok(spys.normalizeQueryInput.calledOnce); t.deepEquals(spys.normalizeQueryInput.firstCall.args, [['features']]); t.ok(spys.normalizeQueryOptions.calledOnce); - t.deepEquals(spys.normalizeQueryOptions.firstCall.args, [ - { hello: 'world' }, - ['features'], - ]); + t.deepEquals(spys.normalizeQueryOptions.firstCall.args, [{ hello: 'world' }, ['features']]); t.ok(spys.sqlQueryHelpers.create.calledOnce); - t.deepEquals(spys.sqlQueryHelpers.create.firstCall.args, [ - { hello: 'world' }, - ]); + t.deepEquals(spys.sqlQueryHelpers.create.firstCall.args, [{ hello: 'world' }]); t.ok(spys.standardQuery.calledOnce); t.deepEquals(spys.standardQuery.firstCall.args, [ ['features'], @@ -75,10 +70,7 @@ test('Should normalize and execute standard query on collection', (t) => { './standard-query': spys.standardQuery, }); - const result = query( - { metadata: { foo: 'bar' }, features: ['features'] }, - { hello: 'world' }, - ); + const result = query({ metadata: { foo: 'bar' }, features: ['features'] }, { hello: 'world' }); t.ok(spys.normalizeQueryInput.notCalled); t.ok(spys.normalizeQueryOptions.calledOnce); t.deepEquals(spys.normalizeQueryOptions.firstCall.args, [ diff --git a/packages/winnow/src/query/standard-query.js b/packages/winnow/src/query/standard-query.js index 2585d575..0b663e60 100644 --- a/packages/winnow/src/query/standard-query.js +++ b/packages/winnow/src/query/standard-query.js @@ -9,7 +9,8 @@ function standardQuery(features, sqlString, options = {}) { const filtered = filterAndTransform(sqlString, params); // 1) For GeoService API queries there is always a limit - // 2) options.limit is incremented by one in normalizeOptions.js; if filtered.length === options.limit, original limit option has been exceeded + // 2) options.limit is incremented by one in normalizeOptions.js; + // if filtered.length === options.limit, original limit option has been exceeded if (options.skipLimitHandling || !limit || filtered.length !== limit) { return packageFeatures(filtered, options); } diff --git a/packages/winnow/src/query/standard-query.spec.js b/packages/winnow/src/query/standard-query.spec.js index a6b738bf..ad32081d 100644 --- a/packages/winnow/src/query/standard-query.spec.js +++ b/packages/winnow/src/query/standard-query.spec.js @@ -21,16 +21,10 @@ test('standardQuery, no options', (t) => { '../sql-query-builder': queryBuilderSpy, }); - const result = standardQuery( - ['feature1', 'feature2', 'feature3'], - 'SQL statement', - ); + const result = standardQuery(['feature1', 'feature2', 'feature3'], 'SQL statement'); t.deepEquals(result, ['feature1', 'feature2']); t.ok(queryBuilderSpy.params.calledOnce); - t.deepEquals(queryBuilderSpy.params.firstCall.args, [ - ['feature1', 'feature2', 'feature3'], - {}, - ]); + t.deepEquals(queryBuilderSpy.params.firstCall.args, [['feature1', 'feature2', 'feature3'], {}]); t.ok(filterAndTransformSpy.filterAndTransform.calledOnce); t.deepEquals(filterAndTransformSpy.filterAndTransform.firstCall.args, [ 'SQL statement', @@ -57,11 +51,10 @@ test('standardQuery, limit option', (t) => { '../sql-query-builder': queryBuilderSpy, }); - const result = standardQuery( - ['feature1', 'feature2', 'feature3'], - 'SQL statement', - { foo: 'bar', limit: 2 }, - ); + const result = standardQuery(['feature1', 'feature2', 'feature3'], 'SQL statement', { + foo: 'bar', + limit: 2, + }); t.deepEquals(result, ['feature1']); t.ok(queryBuilderSpy.params.calledOnce); t.deepEquals(queryBuilderSpy.params.firstCall.args, [ @@ -94,11 +87,11 @@ test('standardQuery, limit and collection option', (t) => { '../sql-query-builder': queryBuilderSpy, }); - const result = standardQuery( - ['feature1', 'feature2', 'feature3'], - 'SQL statement', - { foo: 'bar', limit: 2, collection: {} }, - ); + const result = standardQuery(['feature1', 'feature2', 'feature3'], 'SQL statement', { + foo: 'bar', + limit: 2, + collection: {}, + }); t.deepEquals(result, { metadata: { exceededTransferLimit: true }, features: ['feature1'], diff --git a/packages/winnow/src/query/unique-value-query.js b/packages/winnow/src/query/unique-value-query.js index a66d6098..88bd6b42 100644 --- a/packages/winnow/src/query/unique-value-query.js +++ b/packages/winnow/src/query/unique-value-query.js @@ -3,12 +3,10 @@ const normalizeQueryOptions = require('../normalize-query-options'); const standardQuery = require('./standard-query'); module.exports = function uniqueValueQuery(features, { fields } = {}) { - if (fields.length > 3) - throw new Error('Cannot classify using more than three fields'); + if (fields.length > 3) throw new Error('Cannot classify using more than three fields'); fields.map((field) => { - if (!features[0].properties[field]) - throw new Error(`Unknown field: ${field}`); + if (!features[0].properties[field]) throw new Error(`Unknown field: ${field}`); }); const uniqueValueOptions = { diff --git a/packages/winnow/src/query/unique-value-query.spec.js b/packages/winnow/src/query/unique-value-query.spec.js index 417b384f..34dd6bf6 100644 --- a/packages/winnow/src/query/unique-value-query.spec.js +++ b/packages/winnow/src/query/unique-value-query.spec.js @@ -103,7 +103,7 @@ test('uniqueValueQuery, one field', (t) => { }, }, ], - 'SELECT COUNT(properties->`Name`) as `count`, properties->`Name` as `Name` FROM ? GROUP BY properties->`Name`', + 'SELECT COUNT(properties->`Name`) as `count`, properties->`Name` as `Name` FROM ? GROUP BY properties->`Name`', // eslint-disable-line { aggregates: [ { @@ -199,7 +199,7 @@ test('uniqueValueQuery, two fields', (t) => { }, }, ], - 'SELECT COUNT(properties->`Name`) as `count`, properties->`Name` as `Name`, properties->`Location` as `Location` FROM ? GROUP BY properties->`Name`, properties->`Location`', + 'SELECT COUNT(properties->`Name`) as `count`, properties->`Name` as `Name`, properties->`Location` as `Location` FROM ? GROUP BY properties->`Name`, properties->`Location`', // eslint-disable-line { aggregates: [ { diff --git a/packages/winnow/src/sql-query-builder/create-sql-params.js b/packages/winnow/src/sql-query-builder/create-sql-params.js index 3ba88ffc..fb49c8a6 100644 --- a/packages/winnow/src/sql-query-builder/create-sql-params.js +++ b/packages/winnow/src/sql-query-builder/create-sql-params.js @@ -2,14 +2,7 @@ const isDifferentCrs = require('./is-different-crs'); function params( features, - { - returnGeometry, - inputCrs, - outputCrs, - aggregates, - geometry, - geometryPrecision, - } = {}, + { returnGeometry, inputCrs, outputCrs, aggregates, geometry, geometryPrecision } = {}, ) { const params = []; // NOTE: order matters here @@ -32,17 +25,8 @@ function params( return params; } -function shouldAddCrsParams({ - aggregates, - returnGeometry, - inputCrs, - outputCrs, -} = {}) { - return ( - !aggregates && - returnGeometry !== false && - isDifferentCrs(inputCrs, outputCrs) - ); +function shouldAddCrsParams({ aggregates, returnGeometry, inputCrs, outputCrs } = {}) { + return !aggregates && returnGeometry !== false && isDifferentCrs(inputCrs, outputCrs); } function getCrsString({ wkt, wkid } = {}) { diff --git a/packages/winnow/src/sql-query-builder/create-sql-string.spec.js b/packages/winnow/src/sql-query-builder/create-sql-string.spec.js index 7d3d00b0..fad6a28b 100644 --- a/packages/winnow/src/sql-query-builder/create-sql-string.spec.js +++ b/packages/winnow/src/sql-query-builder/create-sql-string.spec.js @@ -38,10 +38,7 @@ test('createSqlString: with no options', (t) => { t.plan(9); testCleanup(); const sqlString = createSqlString(); - t.equals( - sqlString, - 'SELECT "substring" GROUP BY "substring" ORDER BY "substring"', - ); + t.equals(sqlString, 'SELECT "substring" GROUP BY "substring" ORDER BY "substring"'); t.equals(selectSpy.callCount, 1); t.equals(whereSpy.create.callCount, 0); t.equals(groupBySpy.callCount, 1); diff --git a/packages/winnow/src/sql-query-builder/order-by.spec.js b/packages/winnow/src/sql-query-builder/order-by.spec.js index 66516fb1..abbe43cd 100644 --- a/packages/winnow/src/sql-query-builder/order-by.spec.js +++ b/packages/winnow/src/sql-query-builder/order-by.spec.js @@ -16,10 +16,7 @@ test('createOrderByClause: returns empty string if empty options', (t) => { test('createOrderByClause: returns orderBy clause with default direction', (t) => { t.plan(1); const orderByClause = createOrderByClause({ order: ['foo', 'bar'] }); - t.equals( - orderByClause, - ' ORDER BY properties->`foo` ASC, properties->`bar` ASC', - ); + t.equals(orderByClause, ' ORDER BY properties->`foo` ASC, properties->`bar` ASC'); }); test('createOrderByClause: returns orderBy clause for esri JSON', (t) => { @@ -28,10 +25,7 @@ test('createOrderByClause: returns orderBy clause for esri JSON', (t) => { esri: true, order: ['foo', 'bar'], }); - t.equals( - orderByClause, - ' ORDER BY attributes->`foo` ASC, attributes->`bar` ASC', - ); + t.equals(orderByClause, ' ORDER BY attributes->`foo` ASC, attributes->`bar` ASC'); }); test('createOrderByClause: returns orderBy clause with directions ', (t) => { @@ -39,10 +33,7 @@ test('createOrderByClause: returns orderBy clause with directions ', (t) => { const orderByClause = createOrderByClause({ order: ['foo DESC', 'bar DESC'], }); - t.equals( - orderByClause, - ' ORDER BY properties->`foo` DESC, properties->`bar` DESC', - ); + t.equals(orderByClause, ' ORDER BY properties->`foo` DESC, properties->`bar` DESC'); }); test('createOrderByClause: returns orderBy clause formated for aggregation select', (t) => { @@ -60,8 +51,5 @@ test('createOrderByClause: returns orderBy clause formated for aggregation selec order: ['foo DESC', 'bar DESC'], aggregates: [{ name: 'hello' }], }); - t.equals( - orderByClause, - ' ORDER BY properties->`foo` DESC, properties->`bar` DESC', - ); + t.equals(orderByClause, ' ORDER BY properties->`foo` DESC, properties->`bar` DESC'); }); diff --git a/packages/winnow/src/sql-query-builder/select/fields-select-fragment.js b/packages/winnow/src/sql-query-builder/select/fields-select-fragment.js index b8cea2fb..6ce993d4 100644 --- a/packages/winnow/src/sql-query-builder/select/fields-select-fragment.js +++ b/packages/winnow/src/sql-query-builder/select/fields-select-fragment.js @@ -13,9 +13,9 @@ function selectFieldsAsEsriJson(options) { const delimitedDateFields = dateFields.join(','); const includeIdField = shouldIncludeIdField({ returnIdsOnly, fields }); if (fields) { - return `selectFieldsToEsriAttributes(properties, geometry, "${fields.join(',')}", "${delimitedDateFields}", "${includeIdField}", "${idField}") as attributes`; + return `selectFieldsToEsriAttributes(properties, geometry, "${fields.join(',')}", "${delimitedDateFields}", "${includeIdField}", "${idField}") as attributes`; // eslint-disable-line } - return `toEsriAttributes(properties, geometry, "${delimitedDateFields}", "${includeIdField}", "${idField}") as attributes`; + return `toEsriAttributes(properties, geometry, "${delimitedDateFields}", "${includeIdField}", "${idField}") as attributes`; // eslint-disable-line } function shouldIncludeIdField({ returnIdsOnly, fields }) { diff --git a/packages/winnow/src/sql-query-builder/select/fields-select-fragment.spec.js b/packages/winnow/src/sql-query-builder/select/fields-select-fragment.spec.js index 1e33a313..a1c4b65f 100644 --- a/packages/winnow/src/sql-query-builder/select/fields-select-fragment.spec.js +++ b/packages/winnow/src/sql-query-builder/select/fields-select-fragment.spec.js @@ -1,13 +1,13 @@ const test = require('tape'); const createFieldsSelectFragment = require('./fields-select-fragment'); -test('createFieldsSelectFragment: no specification', (t) => { +test('no specification', (t) => { const fieldsFragment = createFieldsSelectFragment({}); t.equal(fieldsFragment, 'type, properties as properties'); t.end(); }); -test('createFieldsSelectFragment: fields option', (t) => { +test('fields option', (t) => { const fieldsFragment = createFieldsSelectFragment({ fields: ['foo', 'bar'], }); @@ -15,60 +15,48 @@ test('createFieldsSelectFragment: fields option', (t) => { t.end(); }); -test('createFieldsSelectFragment: fields and dateFields options', (t) => { +test('fields and dateFields options', (t) => { const fieldsFragment = createFieldsSelectFragment({ fields: ['foo', 'bar', 'hello', 'world'], dateFields: ['foo', 'hello'], }); - t.equal( - fieldsFragment, - 'selectFields(properties, "foo,bar,hello,world") as properties', - ); + t.equal(fieldsFragment, 'selectFields(properties, "foo,bar,hello,world") as properties'); t.end(); }); -test('createFieldsSelectFragment: fields, dateFields, returnIdsOnly options', (t) => { +test('fields, dateFields, returnIdsOnly options', (t) => { const fieldsFragment = createFieldsSelectFragment({ fields: ['foo', 'bar', 'hello', 'world'], dateFields: ['foo', 'hello'], returnIdsOnly: true, }); - t.equal( - fieldsFragment, - 'selectFields(properties, "foo,bar,hello,world") as properties', - ); + t.equal(fieldsFragment, 'selectFields(properties, "foo,bar,hello,world") as properties'); t.end(); }); -test('createFieldsSelectFragment: fields, dateFields, returnIdsOnly, idField options', (t) => { +test('fields, dateFields, returnIdsOnly, idField options', (t) => { const fieldsFragment = createFieldsSelectFragment({ fields: ['foo', 'bar', 'hello', 'world'], dateFields: ['foo', 'hello'], returnIdsOnly: true, idField: 'bar', }); - t.equal( - fieldsFragment, - 'selectFields(properties, "foo,bar,hello,world") as properties', - ); + t.equal(fieldsFragment, 'selectFields(properties, "foo,bar,hello,world") as properties'); t.end(); }); -test('createFieldsSelectFragment: fields, dateFields, returnIdsOnly, idField as OBJECTID options', (t) => { +test('fields, dateFields, returnIdsOnly, idField as OBJECTID options', (t) => { const fieldsFragment = createFieldsSelectFragment({ fields: ['foo', 'OBJECTID', 'hello', 'world'], dateFields: ['foo', 'hello'], returnIdsOnly: true, idField: 'OBJECTID', }); - t.equal( - fieldsFragment, - 'selectFields(properties, "foo,OBJECTID,hello,world") as properties', - ); + t.equal(fieldsFragment, 'selectFields(properties, "foo,OBJECTID,hello,world") as properties'); t.end(); }); -test('createFieldsSelectFragment: toEsri option', (t) => { +test('toEsri option', (t) => { const fieldsFragment = createFieldsSelectFragment({ toEsri: true, }); @@ -79,19 +67,19 @@ test('createFieldsSelectFragment: toEsri option', (t) => { t.end(); }); -test('createFieldsSelectFragment: toEsri and fields options', (t) => { +test('toEsri and fields options', (t) => { const fieldsFragment = createFieldsSelectFragment({ toEsri: true, fields: ['foo', 'bar'], }); t.equal( fieldsFragment, - 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar", "", "false", "null") as attributes', + 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar", "", "false", "null") as attributes', // eslint-disable-line ); t.end(); }); -test('createFieldsSelectFragment: toEsri, fields, dateFields options', (t) => { +test('toEsri, fields, dateFields options', (t) => { const fieldsFragment = createFieldsSelectFragment({ toEsri: true, fields: ['foo', 'bar', 'hello', 'world'], @@ -99,12 +87,12 @@ test('createFieldsSelectFragment: toEsri, fields, dateFields options', (t) => { }); t.equal( fieldsFragment, - 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar,hello,world", "foo,hello", "false", "null") as attributes', + 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar,hello,world", "foo,hello", "false", "null") as attributes', // eslint-disable-line ); t.end(); }); -test('createFieldsSelectFragment: toEsri, fields, dateFields, returnIdsOnly options', (t) => { +test('toEsri, fields, dateFields, returnIdsOnly options', (t) => { const fieldsFragment = createFieldsSelectFragment({ toEsri: true, fields: ['foo', 'bar', 'hello', 'world'], @@ -113,12 +101,12 @@ test('createFieldsSelectFragment: toEsri, fields, dateFields, returnIdsOnly opti }); t.equal( fieldsFragment, - 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar,hello,world", "foo,hello", "true", "null") as attributes', + 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar,hello,world", "foo,hello", "true", "null") as attributes', // eslint-disable-line ); t.end(); }); -test('createFieldsSelectFragment: toEsri, fields, dateFields, returnIdsOnly, idField options', (t) => { +test('toEsri, fields, dateFields, returnIdsOnly, idField options', (t) => { const fieldsFragment = createFieldsSelectFragment({ toEsri: true, fields: ['foo', 'bar', 'hello', 'world'], @@ -128,12 +116,12 @@ test('createFieldsSelectFragment: toEsri, fields, dateFields, returnIdsOnly, idF }); t.equal( fieldsFragment, - 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar,hello,world", "foo,hello", "true", "bar") as attributes', + 'selectFieldsToEsriAttributes(properties, geometry, "foo,bar,hello,world", "foo,hello", "true", "bar") as attributes', // eslint-disable-line ); t.end(); }); -test('createFieldsSelectFragment: toEsri, fields, dateFields, returnIdsOnly, idField as OBJECTID options', (t) => { +test('toEsri, fields, dateFields, returnIdsOnly, idField as OBJECTID options', (t) => { const fieldsFragment = createFieldsSelectFragment({ toEsri: true, fields: ['foo', 'OBJECTID', 'hello', 'world'], @@ -143,7 +131,7 @@ test('createFieldsSelectFragment: toEsri, fields, dateFields, returnIdsOnly, idF }); t.equal( fieldsFragment, - 'selectFieldsToEsriAttributes(properties, geometry, "foo,OBJECTID,hello,world", "foo,hello", "true", "OBJECTID") as attributes', + 'selectFieldsToEsriAttributes(properties, geometry, "foo,OBJECTID,hello,world", "foo,hello", "true", "OBJECTID") as attributes', // eslint-disable-line ); t.end(); }); diff --git a/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.js b/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.js index 107b4ce8..6eff5926 100644 --- a/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.js +++ b/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.js @@ -1,10 +1,5 @@ const isDifferentCrs = require('../is-different-crs'); -function createGeometrySelectFragment({ - inputCrs, - outputCrs, - geometryPrecision, - toEsri, -} = {}) { +function createGeometrySelectFragment({ inputCrs, outputCrs, geometryPrecision, toEsri } = {}) { const geometryFunctions = []; if (isDifferentCrs(inputCrs, outputCrs)) { geometryFunctions.push('project(~~,?,?)'); @@ -22,10 +17,7 @@ function createGeometrySelectFragment({ return 'geometry'; } - const inlineGeometryFunctions = geometryFunctions.reduce( - nestGeometryFunctions, - '', - ); + const inlineGeometryFunctions = geometryFunctions.reduce(nestGeometryFunctions, ''); return `${inlineGeometryFunctions} as geometry`; } diff --git a/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.spec.js b/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.spec.js index 7a816ecd..2173bba5 100644 --- a/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.spec.js +++ b/packages/winnow/src/sql-query-builder/select/geometry-select-fragment.spec.js @@ -51,24 +51,18 @@ test('createGeometryFragment: different input/output CRS, and geometryPrecision outputCrs: { wkid: 3857 }, geometryPrecision: 1, }); - t.equal( - geometryFragment, - 'reducePrecision(project(geometry,?,?),?) as geometry', - ); + t.equal(geometryFragment, 'reducePrecision(project(geometry,?,?),?) as geometry'); t.end(); }); -test('createGeometryFragment: different input/output CRS, geometryPrecision, and toEsri options', (t) => { +test('different input/output CRS, geometryPrecision, and toEsri options', (t) => { const geometryFragment = createGeometrySelectFragment({ inputCrs: { wkid: 4326 }, outputCrs: { wkid: 3857 }, geometryPrecision: 1, toEsri: true, }); - t.equal( - geometryFragment, - 'esriGeometry(reducePrecision(project(geometry,?,?),?)) as geometry', - ); + t.equal(geometryFragment, 'esriGeometry(reducePrecision(project(geometry,?,?),?)) as geometry'); t.end(); }); diff --git a/packages/winnow/src/sql-query-builder/select/index.js b/packages/winnow/src/sql-query-builder/select/index.js index c8bca832..fb6098f5 100644 --- a/packages/winnow/src/sql-query-builder/select/index.js +++ b/packages/winnow/src/sql-query-builder/select/index.js @@ -4,11 +4,7 @@ const createFieldsSelectFragment = require('./fields-select-fragment'); function createSelectSql(options = {}) { if (options.aggregates) { - return createAggregationSelect( - options.aggregates, - options.groupBy, - options.esri, - ); + return createAggregationSelect(options.aggregates, options.groupBy, options.esri); } return createStandardSelect(options); diff --git a/packages/winnow/src/sql-query-builder/where-builder/index.js b/packages/winnow/src/sql-query-builder/where-builder/index.js index 829eb02a..4aa851b3 100644 --- a/packages/winnow/src/sql-query-builder/where-builder/index.js +++ b/packages/winnow/src/sql-query-builder/where-builder/index.js @@ -2,15 +2,13 @@ const { InvalidWhereParameterError } = require('../../errors'); const convertSqlWhereToJsonWhere = require('./to-json-where'); const timestampCastRegex = /(TIMESTAMP|DATE) '([^']*)'/gi; -const timestampWithoutZoneRegex = - /^\d{4}-\d{2}-\d{2} {0,1}\d{0,2}:{0,1}\d{0,2}:{0,1}\d{0,2}$/; +const timestampWithoutZoneRegex = /^\d{4}-\d{2}-\d{2} {0,1}\d{0,2}:{0,1}\d{0,2}:{0,1}\d{0,2}$/; // RegExp for name-first predicate, e.g "properties->`OBJECTID` = 1234" const fieldFirstObjectIdPredicateRegex = /(properties|attributes)->`OBJECTID` (=|<|>|<=|>=) ([0-9]+)/g; -const objectidInPredicateRegex = - /(properties|attributes)->`OBJECTID` (IN) \((.+)\)/g; +const objectidInPredicateRegex = /(properties|attributes)->`OBJECTID` (IN) \((.+)\)/g; // RegExp for value-first predicate, e.g "1234 = properties->`OBJECTID`"" const valueFirstObjectIdPredicateRegex = @@ -73,12 +71,9 @@ class WhereBuilder { return this; } - this.#where = this.#where.replace( - timestampCastRegex, - function (match, cast, timestamp) { - return `'${normalizeTimestamp(timestamp)}'`; - }, - ); + this.#where = this.#where.replace(timestampCastRegex, function (match, cast, timestamp) { + return `'${normalizeTimestamp(timestamp)}'`; + }); return this; } @@ -92,7 +87,7 @@ class WhereBuilder { const charArr = this.#where.split(''); - // loop thru each character of the WHERE string and replace any single-quote escape sequence ('') with \' + // loop thru each character of WHERE string, replace single-quote escape sequence ('') with \' charArr.forEach((currentChar, i) => { const nextChar = charArr[i + 1]; const prevChar = charArr[i - 1]; @@ -102,19 +97,10 @@ class WhereBuilder { // Encountered a ' that begins a value definition (e.g the 7th char of "foo = 'bar'""). // Flag that we are now inside the value definition insideValueDefinition = true; - } else if ( - isSingleQuoteEscapeChar( - currentChar, - nextChar, - prevChar, - insideValueDefinition, - ) - ) { + } else if (isSingleQuoteEscapeChar(currentChar, nextChar, prevChar, insideValueDefinition)) { // The current char is a ' used to escape a subsequent ' (e.g 'bar''s') charArr[i] = SINGLE_QUOTE_ESCAPE; - } else if ( - isEndOfValueDefinition(currentChar, lastTwoChars, insideValueDefinition) - ) { + } else if (isEndOfValueDefinition(currentChar, lastTwoChars, insideValueDefinition)) { insideValueDefinition = false; } }); @@ -141,9 +127,7 @@ class WhereBuilder { return isNaN(val) ? `'${val}'` : val; }); - const objectIdFilter = `${ - this.#options.idField || 'OBJECTID' - } IN (${inValues.join(',')})`; + const objectIdFilter = `${this.#options.idField || 'OBJECTID'} IN (${inValues.join(',')})`; if (this.#where) { this.#where = `${this.#where} AND ${objectIdFilter}`; @@ -168,19 +152,13 @@ class WhereBuilder { fieldFirstObjectIdPredicateRegex, `hashedObjectIdComparator($1, geometry, $3, '$2')=true`, ) - .replace( - objectidInPredicateRegex, - (match, parentProperty, operator, value) => { - const inValue = value.replace(/\s/g, ''); - return `hashedObjectIdComparator(${parentProperty}, geometry, '${inValue}', 'IN')=true`; - }, - ) - .replace( - valueFirstObjectIdPredicateRegex, - (match, value, operator, parentProperty) => { - return `hashedObjectIdComparator(${parentProperty}, geometry, ${value}, '${operatorInversions[operator]}')=true`; - }, - ); + .replace(objectidInPredicateRegex, (match, parentProperty, operator, value) => { + const inValue = value.replace(/\s/g, ''); + return `hashedObjectIdComparator(${parentProperty}, geometry, '${inValue}', 'IN')=true`; + }) + .replace(valueFirstObjectIdPredicateRegex, (match, value, operator, parentProperty) => { + return `hashedObjectIdComparator(${parentProperty}, geometry, ${value}, '${operatorInversions[operator]}')=true`; // eslint-disable-line + }); return this; } @@ -211,9 +189,7 @@ function normalizeTimestamp(timestamp) { try { return new Date(normalizedTimestamp).toISOString(); } catch (error) { - throw new InvalidWhereParameterError( - `${error.message} for timestamp "${timestamp}"`, - ); + throw new InvalidWhereParameterError(`${error.message} for timestamp "${timestamp}"`); } } @@ -223,18 +199,11 @@ function isBeginningOfValueDefinition(char, insideSingleQuotes) { function isSingleQuoteEscapeChar(char, next, prev, insideSingleQuotes) { return ( - insideSingleQuotes === true && - char === "'" && - next === "'" && - prev !== SINGLE_QUOTE_ESCAPE + insideSingleQuotes === true && char === "'" && next === "'" && prev !== SINGLE_QUOTE_ESCAPE ); } function isEndOfValueDefinition(char, lastTwoChars, insideSingleQuotes) { - return ( - insideSingleQuotes === true && - char === `'` && - lastTwoChars !== `${SINGLE_QUOTE_ESCAPE}'` - ); + return insideSingleQuotes === true && char === `'` && lastTwoChars !== `${SINGLE_QUOTE_ESCAPE}'`; } module.exports = WhereBuilder; diff --git a/packages/winnow/src/sql-query-builder/where-builder/index.spec.js b/packages/winnow/src/sql-query-builder/where-builder/index.spec.js index 8aa1eb68..190b1a1a 100644 --- a/packages/winnow/src/sql-query-builder/where-builder/index.spec.js +++ b/packages/winnow/src/sql-query-builder/where-builder/index.spec.js @@ -46,10 +46,7 @@ test('WhereBuilder.create: where param and objectIds param', (t) => { objectIds: [1, 2], idField: 'OBJECTID', }); - t.equals( - whereClause, - "properties->`color` = 'red' AND properties->`OBJECTID` IN (1, 2 )", - ); + t.equals(whereClause, "properties->`color` = 'red' AND properties->`OBJECTID` IN (1, 2 )"); }); test('WhereBuilder.create: returns where clause with geometry predicate', (t) => { @@ -60,39 +57,30 @@ test('WhereBuilder.create: returns where clause with geometry predicate', (t) => t.equals(whereClause, 'ST_Intersects(geometry, ?)'); }); -test('WhereBuilder.create: returns where clause with translated sql-where and geometry predicate', (t) => { +test('returns where clause with translated sql-where and geometry predicate', (t) => { t.plan(1); const whereClause = WhereBuilder.create({ geometry: [0, 0, 0, 0], where: "color='red'", }); - t.equals( - whereClause, - "properties->`color` = 'red' AND ST_Intersects(geometry, ?)", - ); + t.equals(whereClause, "properties->`color` = 'red' AND ST_Intersects(geometry, ?)"); }); -test('WhereBuilder.create: transform a predicate with OBJECTID and no metadata fields to user-defined function', (t) => { +test('predicate with OBJECTID and no metadata fields to user-defined function', (t) => { t.plan(1); const whereClause = WhereBuilder.create({ where: 'OBJECTID=1234' }); - t.equals( - whereClause, - "hashedObjectIdComparator(properties, geometry, 1234, '=')=true", - ); + t.equals(whereClause, "hashedObjectIdComparator(properties, geometry, 1234, '=')=true"); }); test('WhereBuilder.create: transform a predicate with OBJECTID IN (1234)', (t) => { t.plan(1); const whereClause = WhereBuilder.create({ objectIds: [1234, 4567] }); - t.equals( - whereClause, - "hashedObjectIdComparator(properties, geometry, '1234,4567', 'IN')=true", - ); + t.equals(whereClause, "hashedObjectIdComparator(properties, geometry, '1234,4567', 'IN')=true"); }); -test('WhereBuilder.create: transform a predicate with OBJECTID and no metadata fields to Esri flavor with user-defined function', (t) => { +test('predicate with OBJECTID and no metadata fields to Esri with user-defined function', (t) => { t.plan(1); const options = { esri: true, @@ -100,13 +88,10 @@ test('WhereBuilder.create: transform a predicate with OBJECTID and no metadata f }; const whereClause = WhereBuilder.create(options); - t.equals( - whereClause, - "hashedObjectIdComparator(attributes, geometry, 1234, '=')=true", - ); + t.equals(whereClause, "hashedObjectIdComparator(attributes, geometry, 1234, '=')=true"); }); -test('WhereBuilder.create: transform an inverse predicate with OBJECTID and no metadata fields to Esri flavor with user-defined function', (t) => { +test('inverse predicate with OBJECTID and no fields toEsri with user function', (t) => { t.plan(1); const options = { esri: true, @@ -114,10 +99,7 @@ test('WhereBuilder.create: transform an inverse predicate with OBJECTID and no m }; const whereClause = WhereBuilder.create(options); - t.equals( - whereClause, - "hashedObjectIdComparator(attributes, geometry, 1234, '<=')=true", - ); + t.equals(whereClause, "hashedObjectIdComparator(attributes, geometry, 1234, '<=')=true"); }); test('WhereBuilder.create: handle BETWEEN', (t) => { @@ -171,9 +153,6 @@ test('WhereBuilder.create: handle TIMESTAMP cast error', (t) => { WhereBuilder.create({ where: "foo > TIMESTAMP 'barz'" }); t.fail('should have thrown'); } catch (error) { - t.equals( - error.message, - 'Invalid "where" parameter: Invalid time value for timestamp "barz"', - ); + t.equals(error.message, 'Invalid "where" parameter: Invalid time value for timestamp "barz"'); } }); diff --git a/packages/winnow/src/sql-query-builder/where-builder/to-json-where.js b/packages/winnow/src/sql-query-builder/where-builder/to-json-where.js index bca0cba2..e413793e 100644 --- a/packages/winnow/src/sql-query-builder/where-builder/to-json-where.js +++ b/packages/winnow/src/sql-query-builder/where-builder/to-json-where.js @@ -41,9 +41,7 @@ function traverse(node, options) { } if (node.type === 'String') { - return shouldHandleAsColumn(node) - ? handleColumn(node, options) - : handleValue(node, options); + return shouldHandleAsColumn(node) ? handleColumn(node, options) : handleValue(node, options); } if (['Number', 'Boolean'].includes(node.type)) { @@ -64,9 +62,7 @@ function traverse(node, options) { function handleColumn(node, options) { node.value = node.value.replace(/^"([^"]*)"$/, (match, val) => val); - node.value = options?.esri - ? `attributes->\`${node.value}\`` - : `properties->\`${node.value}\``; + node.value = options?.esri ? `attributes->\`${node.value}\`` : `properties->\`${node.value}\``; } function shouldHandleAsColumn(node) { @@ -92,9 +88,7 @@ function trackTargetColumn(node) { // distribute target column to any downstream nodes; required for IN if (node.targetColumnName) { if (Array.isArray(node.value)) { - node.value.forEach( - (child) => (child.targetColumnName = node.targetColumnName), - ); + node.value.forEach((child) => (child.targetColumnName = node.targetColumnName)); } if (node.left) { diff --git a/packages/winnow/src/sql-query-builder/where-builder/to-json-where.spec.js b/packages/winnow/src/sql-query-builder/where-builder/to-json-where.spec.js index 2015782f..f404f60c 100644 --- a/packages/winnow/src/sql-query-builder/where-builder/to-json-where.spec.js +++ b/packages/winnow/src/sql-query-builder/where-builder/to-json-where.spec.js @@ -40,7 +40,7 @@ test('toJsonWhere: transform a simple but inverse predicate to Esri flavor', (t) t.equals(whereFragment, "'bar' = attributes->`foo`"); }); -test('toJsonWhere: transform a predicate with OBJECTID and metadata fields that define the OBJECTID', (t) => { +test('toJsonWhere: transform predicate with OBJECTID and field that defines the OBJECTID', (t) => { t.plan(1); const options = { idField: 'OBJECTID', @@ -63,12 +63,10 @@ test('toJsonWhere: handles 1=1', (t) => { test('toJsonWhere: handles (expression))', (t) => { t.plan(1); - const whereFragment = translateSqlWhere( - "(model = 'ford' OR model = 'benz') AND color = 'white'", - ); + const whereFragment = translateSqlWhere("(model = 'ford' OR model = 'benz') AND color = 'white'"); t.equals( whereFragment, - "(properties->`model` = 'ford' OR properties->`model` = 'benz') AND properties->`color` = 'white'", + "(properties->`model` = 'ford' OR properties->`model` = 'benz') AND properties->`color` = 'white'", // eslint-disable-line ); }); @@ -147,7 +145,7 @@ test('toJsonWhere: handle BETWEEN', (t) => { ); }); -test('toJsonWhere: transform a simple equality predicate and transform values by code value domain', (t) => { +test('toJsonWhere: transform equality predicate and transform values by code value domain', (t) => { t.plan(1); const options = { esriFields: [ diff --git a/packages/winnow/test/integration/filter.spec.js b/packages/winnow/test/integration/filter.spec.js index 5ec5cd10..f70e20dd 100644 --- a/packages/winnow/test/integration/filter.spec.js +++ b/packages/winnow/test/integration/filter.spec.js @@ -19,7 +19,7 @@ test('With a where options 1=1', (t) => { test('With a where option with multiple statements', (t) => { const options = { where: - "Genus like '%Quercus%' AND Street_Name = 'CLAREMONT' AND House_Number < 600 AND Trunk_Diameter = 9", + "Genus like '%Quercus%' AND Street_Name = 'CLAREMONT' AND House_Number < 600 AND Trunk_Diameter = 9", // eslint-disable-line }; run('trees', options, 1, t); }); @@ -27,7 +27,7 @@ test('With a where option with multiple statements', (t) => { test('With a where option with multiple statements with appended 1=1', (t) => { const options = { where: - "Genus like '%Quercus%' AND Street_Name = 'CLAREMONT' AND House_Number < 600 AND Trunk_Diameter = 9 AND 1=1", + "Genus like '%Quercus%' AND Street_Name = 'CLAREMONT' AND House_Number < 600 AND Trunk_Diameter = 9 AND 1=1", // eslint-disable-line }; run('trees', options, 1, t); }); @@ -79,8 +79,7 @@ test('With esri json', (t) => { test('With multiple like clauses', (t) => { const options = { - where: - "Genus like '%Quercus%' AND Common_Name like '%Live Oak%' AND Street_Type like '%ST%'", + where: "Genus like '%Quercus%' AND Common_Name like '%Live Oak%' AND Street_Type like '%ST%'", }; run('trees', options, 5, t); }); @@ -129,8 +128,7 @@ test('With an IN parameter and a numeric test', (t) => { test('With an AND and an OR', (t) => { const options = { - where: - "(Genus like '%Quercus%' AND Common_Name like '%Live Oak%') OR Street_Type like '%AVE%'", + where: "(Genus like '%Quercus%' AND Common_Name like '%Live Oak%') OR Street_Type like '%AVE%'", }; run('trees', options, 13, t); }); @@ -187,7 +185,7 @@ test('With an esri style envelope and wkt string for web mercator', (t) => { xmax: -13150342, ymax: 4051582, spatialReference: { - wkt: 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-97.03124999997486],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]', + wkt: 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-97.03124999997486],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]', // eslint-disable-line }, }, }; @@ -580,7 +578,7 @@ test('with a timestamp query', (t) => { test('with a between query', (t) => { const options = { where: - "survey_date between timestamp '2017-01-06T00:00:00.000Z' AND timestamp '2017-02-06T23:59:59.000Z'", + "survey_date between timestamp '2017-01-06T00:00:00.000Z' AND timestamp '2017-02-06T23:59:59.000Z'", // eslint-disable-line }; run('trees', options, 2, t); }); @@ -630,8 +628,7 @@ test('with null dates in data source', (t) => { // * 'toEsri' option enabled // * the geojson is passed to winnow.query with the metadata.fields populated const options = { - where: - "Date1 >= timestamp '2020-01-05 00:00:00' AND Date1 <= timestamp '2020-02-08 23:59:59'", + where: "Date1 >= timestamp '2020-01-05 00:00:00' AND Date1 <= timestamp '2020-02-08 23:59:59'", toEsri: true, }; t.plan(4); diff --git a/packages/winnow/test/integration/order.spec.js b/packages/winnow/test/integration/order.spec.js index 2a51005b..d227b463 100644 --- a/packages/winnow/test/integration/order.spec.js +++ b/packages/winnow/test/integration/order.spec.js @@ -41,7 +41,7 @@ test('With a limit of 10, toEsri, and an idField, order by OBJECTID DESC', (t) = t.equals(filtered.features[1].attributes.OBJECTID, 11309); }); -test('With a limit of 10, toEsri and no idField specified (winnow generates OBJECTID), order by OBJECTID DESC', (t) => { +test('limit of 10, toEsri and no idField specified, order by OBJECTID DESC', (t) => { t.plan(3); const options = { limit: 10, diff --git a/packages/winnow/test/integration/prepare.spec.js b/packages/winnow/test/integration/prepare.spec.js index 695859cf..915aa9db 100644 --- a/packages/winnow/test/integration/prepare.spec.js +++ b/packages/winnow/test/integration/prepare.spec.js @@ -28,7 +28,7 @@ test('compiling a complex query', (t) => { xmax: 37237674.195623085, ymax: 12416731.052879848, spatialReference: { - wkt: 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]', + wkt: 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-6.828007551173374],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]', // eslint-disable-line }, }, }), @@ -45,8 +45,7 @@ test('compiling with several and statements', (t) => { try { t.ok( Winnow.prepareQuery({ - where: - 'ELEVATION >= 1165 AND ELEVATION <= 4365 AND POP1990 >= 8247 AND POP1990 <= 5700236', + where: 'ELEVATION >= 1165 AND ELEVATION <= 4365 AND POP1990 >= 8247 AND POP1990 <= 5700236', }), ); t.end(); @@ -105,7 +104,7 @@ test('prepare query with geometry filter and projection, then execute filter', ( t.equal(filtered.features[0].geometry.coordinates[1], 4051225.3197446787); }); -test('prepare query with geometry filter and sourceSR, then execute filter on non-4326 source data', (t) => { +test('prepare query with geometry filter & sourceSR, execute on non-4326 source data', (t) => { t.plan(3); const options = { geometry: { diff --git a/packages/winnow/test/integration/project.spec.js b/packages/winnow/test/integration/project.spec.js index cb8ecd34..331d3fd0 100644 --- a/packages/winnow/test/integration/project.spec.js +++ b/packages/winnow/test/integration/project.spec.js @@ -13,10 +13,7 @@ test('Project to Web Mercator using 3857', (t) => { limit: 1, }; const results = winnow.query(features, options); - t.deepEqual( - results[0].geometry.coordinates, - [-11682713.391976157, 4857924.005275469], - ); + t.deepEqual(results[0].geometry.coordinates, [-11682713.391976157, 4857924.005275469]); t.equal(results[0].geometry.spatialReference, undefined); }); @@ -96,10 +93,7 @@ test('Project to Web Mercator using 3857 with an esri style outSR', (t) => { limit: 1, }; const results = winnow.query(features, options); - t.deepEqual( - results[0].geometry.coordinates, - [-11682713.391976157, 4857924.005275469], - ); + t.deepEqual(results[0].geometry.coordinates, [-11682713.391976157, 4857924.005275469]); }); test('Project to Web Mercator using 102100 when outSR is just a number', (t) => { @@ -131,10 +125,7 @@ test('Project to Web Mercator using 3857 with a geo filter', (t) => { }; const results = winnow.query(features, options); - t.deepEqual( - results[0].geometry.coordinates, - [-11682713.391976157, 4857924.005275469], - ); + t.deepEqual(results[0].geometry.coordinates, [-11682713.391976157, 4857924.005275469]); }); test('Project to Web Mercator using 102100', (t) => { @@ -144,24 +135,18 @@ test('Project to Web Mercator using 102100', (t) => { limit: 1, }; const results = winnow.query(features, options); - t.deepEqual( - results[0].geometry.coordinates, - [-11682713.391976157, 4857924.005275469], - ); + t.deepEqual(results[0].geometry.coordinates, [-11682713.391976157, 4857924.005275469]); }); test('Project to Web Mercator using WKT', (t) => { t.plan(1); const options = { projection: - 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]', + 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]', // eslint-disable-line limit: 1, }; const results = winnow.query(features, options); - t.deepEqual( - results[0].geometry.coordinates, - [-11682713.391976157, 4857924.005275469], - ); + t.deepEqual(results[0].geometry.coordinates, [-11682713.391976157, 4857924.005275469]); }); test('Do not project NaN coordinate values', (t) => { diff --git a/packages/winnow/test/integration/return-types.spec.js b/packages/winnow/test/integration/return-types.spec.js index 2af6d5f7..fe6f70c4 100644 --- a/packages/winnow/test/integration/return-types.spec.js +++ b/packages/winnow/test/integration/return-types.spec.js @@ -19,7 +19,7 @@ test('Return a feature array when an array is passed in', (t) => { t.equal(filtered[0].type, 'Feature'); }); -test('Return a feature collection when a feature collection is passed into a compiled query', (t) => { +test('Return feature collection when a feature collection is passed into a compiled query', (t) => { t.plan(1); const options = { where: 'Trunk_Diameter > 10' }; const query = winnow.prepareQuery(options); diff --git a/test/geoservice-client-requests-provider-w-id-field.spec.js b/test/geoservice-client-requests-provider-w-id-field.spec.js index 470b2a90..633f804b 100644 --- a/test/geoservice-client-requests-provider-w-id-field.spec.js +++ b/test/geoservice-client-requests-provider-w-id-field.spec.js @@ -105,9 +105,7 @@ describe('Typical Geoservice Client request sequence: Dataset with defined idFie `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&objectIds=${objectIds[0]}&outFields=*&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); test('filter by objectIds, return all outFields defined by layer info', async () => { @@ -125,9 +123,7 @@ describe('Typical Geoservice Client request sequence: Dataset with defined idFie )}&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); }); @@ -163,9 +159,7 @@ describe('Typical Geoservice Client request sequence: Dataset with defined idFie `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&&resultOffset=0&resultRecordCount=50&where=1%3D1&orderByFields=&outFields=*&returnGeometry=false&spatialRel=esriSpatialRelIntersects`, ); - expect(featuresResponse.body).toEqual( - getAttributeTable(IDFIELD, objectIds), - ); + expect(featuresResponse.body).toEqual(getAttributeTable(IDFIELD, objectIds)); }); }); }); diff --git a/test/geoservice-client-requests-provider-w-objectids.spec.js b/test/geoservice-client-requests-provider-w-objectids.spec.js index 3502b9cd..c6bb6386 100644 --- a/test/geoservice-client-requests-provider-w-objectids.spec.js +++ b/test/geoservice-client-requests-provider-w-objectids.spec.js @@ -105,9 +105,7 @@ describe('Typical Geoservice Client request sequence: Dataset with OBJECTID as a `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&objectIds=${objectIds[0]}&outFields=*&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); test('filter by objectIds, return all outFields defined by layer info', async () => { @@ -125,9 +123,7 @@ describe('Typical Geoservice Client request sequence: Dataset with OBJECTID as a )}&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); }); @@ -163,9 +159,7 @@ describe('Typical Geoservice Client request sequence: Dataset with OBJECTID as a `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&&resultOffset=0&resultRecordCount=50&where=1%3D1&orderByFields=&outFields=*&returnGeometry=false&spatialRel=esriSpatialRelIntersects`, ); - expect(featuresResponse.body).toEqual( - getAttributeTable(IDFIELD, objectIds), - ); + expect(featuresResponse.body).toEqual(getAttributeTable(IDFIELD, objectIds)); }); }); }); diff --git a/test/geoservice-client-requests-provider-w-string-id-field.spec.js b/test/geoservice-client-requests-provider-w-string-id-field.spec.js index bc0d9ecc..14446dd4 100644 --- a/test/geoservice-client-requests-provider-w-string-id-field.spec.js +++ b/test/geoservice-client-requests-provider-w-string-id-field.spec.js @@ -105,9 +105,7 @@ describe('Typical Geoservice Client request sequence: Dataset with defined idFie `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&objectIds=${objectIds[0]}&outFields=*&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); test('filter by objectIds, return all outFields defined by layer info', async () => { @@ -125,9 +123,7 @@ describe('Typical Geoservice Client request sequence: Dataset with defined idFie )}&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); }); @@ -163,9 +159,7 @@ describe('Typical Geoservice Client request sequence: Dataset with defined idFie `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&&resultOffset=0&resultRecordCount=50&where=1%3D1&orderByFields=&outFields=*&returnGeometry=false&spatialRel=esriSpatialRelIntersects`, ); - expect(featuresResponse.body).toEqual( - getAttributeTable(IDFIELD, objectIds), - ); + expect(featuresResponse.body).toEqual(getAttributeTable(IDFIELD, objectIds)); }); }); }); diff --git a/test/geoservice-client-requests-provider-wo-objectids-wo-fields-def.spec.js b/test/geoservice-client-requests-provider-wo-objectids-wo-fields-def.spec.js index 28ff9f76..5971ec07 100644 --- a/test/geoservice-client-requests-provider-wo-objectids-wo-fields-def.spec.js +++ b/test/geoservice-client-requests-provider-wo-objectids-wo-fields-def.spec.js @@ -105,9 +105,7 @@ describe('Typical Geoservice Client request sequence: Dataset without OBJECTID a `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&objectIds=${objectIds[0]}&outFields=*&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); test('filter by objectIds, return all outFields defined by layer info', async () => { @@ -125,9 +123,7 @@ describe('Typical Geoservice Client request sequence: Dataset without OBJECTID a )}&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); }); @@ -163,9 +159,7 @@ describe('Typical Geoservice Client request sequence: Dataset without OBJECTID a `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&&resultOffset=0&resultRecordCount=50&where=1%3D1&orderByFields=&outFields=*&returnGeometry=false&spatialRel=esriSpatialRelIntersects`, ); - expect(featuresResponse.body).toEqual( - getAttributeTable(IDFIELD, objectIds), - ); + expect(featuresResponse.body).toEqual(getAttributeTable(IDFIELD, objectIds)); }); }); }); diff --git a/test/geoservice-client-requests-provider-wo-objectids.spec.js b/test/geoservice-client-requests-provider-wo-objectids.spec.js index 4930a522..8038d932 100644 --- a/test/geoservice-client-requests-provider-wo-objectids.spec.js +++ b/test/geoservice-client-requests-provider-wo-objectids.spec.js @@ -105,9 +105,7 @@ describe('Typical Geoservice Client request sequence: Dataset without OBJECTID a `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&objectIds=${objectIds[0]}&outFields=*&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); test('filter by objectIds, return all outFields defined by layer info', async () => { @@ -125,9 +123,7 @@ describe('Typical Geoservice Client request sequence: Dataset without OBJECTID a )}&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1`, ); - expect(identifyResponse.body).toEqual( - filterByObjectIds(IDFIELD, objectIds), - ); + expect(identifyResponse.body).toEqual(filterByObjectIds(IDFIELD, objectIds)); }); }); @@ -163,9 +159,7 @@ describe('Typical Geoservice Client request sequence: Dataset without OBJECTID a `/file-geojson/rest/services/${idUrlParam}/FeatureServer/0/query?f=json&&resultOffset=0&resultRecordCount=50&where=1%3D1&orderByFields=&outFields=*&returnGeometry=false&spatialRel=esriSpatialRelIntersects`, ); - expect(featuresResponse.body).toEqual( - getAttributeTable(IDFIELD, objectIds), - ); + expect(featuresResponse.body).toEqual(getAttributeTable(IDFIELD, objectIds)); }); }); }); diff --git a/test/geoservice-error-handling.spec.js b/test/geoservice-error-handling.spec.js index 267e9bc3..5e2530f4 100644 --- a/test/geoservice-error-handling.spec.js +++ b/test/geoservice-error-handling.spec.js @@ -108,9 +108,7 @@ describe('geoservices error handling', () => { dataDir: './test/provider-data', }); try { - const response = await request(koop.server).get( - '/file-geojson/rest/generateToken', - ); + const response = await request(koop.server).get('/file-geojson/rest/generateToken'); expect(response.status).toBe(200); expect(response.body).toEqual({ error: { diff --git a/test/geoservice-pbf.spec.js b/test/geoservice-pbf.spec.js index 49070c1f..b1416bbf 100644 --- a/test/geoservice-pbf.spec.js +++ b/test/geoservice-pbf.spec.js @@ -1,8 +1,8 @@ const Koop = require('@koopjs/koop-core'); const provider = require('@koopjs/provider-file-geojson'); const request = require('supertest'); -const FeatureCollection = require('./helpers/FeatureCollection.proto') - .esriPBuffer.FeatureCollectionPBuffer; +const FeatureCollection = require('./helpers/FeatureCollection.proto').esriPBuffer + .FeatureCollectionPBuffer; const mockLogger = { debug: () => {}, info: () => {}, @@ -28,12 +28,8 @@ describe('koop', () => { const decodedBuffer = FeatureCollection.decode(response.body); const pbfJson = FeatureCollection.toObject(decodedBuffer); expect(response.status).toBe(200); - expect(response.headers['content-disposition']).toBe( - 'inline;filename=results.pbf', - ); - expect(response.headers['content-type']).toBe( - 'application/x-protobuf', - ); + expect(response.headers['content-disposition']).toBe('inline;filename=results.pbf'); + expect(response.headers['content-type']).toBe('application/x-protobuf'); expect(response.headers['content-length']).toBe('229'); expect(pbfJson).toEqual({ queryResult: { diff --git a/test/helpers/FeatureCollection.proto.js b/test/helpers/FeatureCollection.proto.js index 8ffa9301..2601b148 100644 --- a/test/helpers/FeatureCollection.proto.js +++ b/test/helpers/FeatureCollection.proto.js @@ -82,15 +82,9 @@ $root.esriPBuffer = (function () { */ FeatureCollectionPBuffer.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.version != null && - Object.hasOwnProperty.call(message, 'version') - ) + if (message.version != null && Object.hasOwnProperty.call(message, 'version')) writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.version); - if ( - message.queryResult != null && - Object.hasOwnProperty.call(message, 'queryResult') - ) + if (message.queryResult != null && Object.hasOwnProperty.call(message, 'queryResult')) $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.encode( message.queryResult, writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), @@ -107,10 +101,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureCollectionPBuffer.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + FeatureCollectionPBuffer.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -137,11 +128,10 @@ $root.esriPBuffer = (function () { break; } case 2: { - message.queryResult = - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.decode( - reader, - reader.uint32(), - ); + message.queryResult = $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.decode( + reader, + reader.uint32(), + ); break; } default: @@ -162,9 +152,7 @@ $root.esriPBuffer = (function () { * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureCollectionPBuffer.decodeDelimited = function decodeDelimited( - reader, - ) { + FeatureCollectionPBuffer.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; @@ -178,18 +166,13 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ FeatureCollectionPBuffer.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.version != null && message.hasOwnProperty('version')) if (!$util.isString(message.version)) return 'version: string expected'; - if ( - message.queryResult != null && - message.hasOwnProperty('queryResult') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.verify( - message.queryResult, - ); + if (message.queryResult != null && message.hasOwnProperty('queryResult')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.verify( + message.queryResult, + ); if (error) return 'queryResult.' + error; } return null; @@ -204,19 +187,15 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer} FeatureCollectionPBuffer */ FeatureCollectionPBuffer.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer(); if (object.version != null) message.version = String(object.version); if (object.queryResult != null) { if (typeof object.queryResult !== 'object') - throw TypeError( - '.esriPBuffer.FeatureCollectionPBuffer.queryResult: object expected', - ); - message.queryResult = - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.fromObject( - object.queryResult, - ); + throw TypeError('.esriPBuffer.FeatureCollectionPBuffer.queryResult: object expected'); + message.queryResult = $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.fromObject( + object.queryResult, + ); } return message; }; @@ -240,11 +219,10 @@ $root.esriPBuffer = (function () { if (message.version != null && message.hasOwnProperty('version')) object.version = message.version; if (message.queryResult != null && message.hasOwnProperty('queryResult')) - object.queryResult = - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.toObject( - message.queryResult, - options, - ); + object.queryResult = $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult.toObject( + message.queryResult, + options, + ); return object; }; @@ -447,8 +425,7 @@ $root.esriPBuffer = (function () { function SpatialReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -516,23 +493,12 @@ $root.esriPBuffer = (function () { if (!writer) writer = $Writer.create(); if (message.wkid != null && Object.hasOwnProperty.call(message, 'wkid')) writer.uint32(/* id 1, wireType 0 =*/ 8).uint32(message.wkid); - if ( - message.lastestWkid != null && - Object.hasOwnProperty.call(message, 'lastestWkid') - ) + if (message.lastestWkid != null && Object.hasOwnProperty.call(message, 'lastestWkid')) writer.uint32(/* id 2, wireType 0 =*/ 16).uint32(message.lastestWkid); - if ( - message.vcsWkid != null && - Object.hasOwnProperty.call(message, 'vcsWkid') - ) + if (message.vcsWkid != null && Object.hasOwnProperty.call(message, 'vcsWkid')) writer.uint32(/* id 3, wireType 0 =*/ 24).uint32(message.vcsWkid); - if ( - message.latestVcsWkid != null && - Object.hasOwnProperty.call(message, 'latestVcsWkid') - ) - writer - .uint32(/* id 4, wireType 0 =*/ 32) - .uint32(message.latestVcsWkid); + if (message.latestVcsWkid != null && Object.hasOwnProperty.call(message, 'latestVcsWkid')) + writer.uint32(/* id 4, wireType 0 =*/ 32).uint32(message.latestVcsWkid); if (message.wkt != null && Object.hasOwnProperty.call(message, 'wkt')) writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.wkt); return writer; @@ -547,10 +513,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SpatialReference.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + SpatialReference.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -568,8 +531,7 @@ $root.esriPBuffer = (function () { SpatialReference.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -625,25 +587,15 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ SpatialReference.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.wkid != null && message.hasOwnProperty('wkid')) if (!$util.isInteger(message.wkid)) return 'wkid: integer expected'; - if ( - message.lastestWkid != null && - message.hasOwnProperty('lastestWkid') - ) - if (!$util.isInteger(message.lastestWkid)) - return 'lastestWkid: integer expected'; + if (message.lastestWkid != null && message.hasOwnProperty('lastestWkid')) + if (!$util.isInteger(message.lastestWkid)) return 'lastestWkid: integer expected'; if (message.vcsWkid != null && message.hasOwnProperty('vcsWkid')) - if (!$util.isInteger(message.vcsWkid)) - return 'vcsWkid: integer expected'; - if ( - message.latestVcsWkid != null && - message.hasOwnProperty('latestVcsWkid') - ) - if (!$util.isInteger(message.latestVcsWkid)) - return 'latestVcsWkid: integer expected'; + if (!$util.isInteger(message.vcsWkid)) return 'vcsWkid: integer expected'; + if (message.latestVcsWkid != null && message.hasOwnProperty('latestVcsWkid')) + if (!$util.isInteger(message.latestVcsWkid)) return 'latestVcsWkid: integer expected'; if (message.wkt != null && message.hasOwnProperty('wkt')) if (!$util.isString(message.wkt)) return 'wkt: string expected'; return null; @@ -658,19 +610,13 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.SpatialReference} SpatialReference */ SpatialReference.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference(); if (object.wkid != null) message.wkid = object.wkid >>> 0; - if (object.lastestWkid != null) - message.lastestWkid = object.lastestWkid >>> 0; + if (object.lastestWkid != null) message.lastestWkid = object.lastestWkid >>> 0; if (object.vcsWkid != null) message.vcsWkid = object.vcsWkid >>> 0; - if (object.latestVcsWkid != null) - message.latestVcsWkid = object.latestVcsWkid >>> 0; + if (object.latestVcsWkid != null) message.latestVcsWkid = object.latestVcsWkid >>> 0; if (object.wkt != null) message.wkt = String(object.wkt); return message; }; @@ -694,22 +640,14 @@ $root.esriPBuffer = (function () { object.latestVcsWkid = 0; object.wkt = ''; } - if (message.wkid != null && message.hasOwnProperty('wkid')) - object.wkid = message.wkid; - if ( - message.lastestWkid != null && - message.hasOwnProperty('lastestWkid') - ) + if (message.wkid != null && message.hasOwnProperty('wkid')) object.wkid = message.wkid; + if (message.lastestWkid != null && message.hasOwnProperty('lastestWkid')) object.lastestWkid = message.lastestWkid; if (message.vcsWkid != null && message.hasOwnProperty('vcsWkid')) object.vcsWkid = message.vcsWkid; - if ( - message.latestVcsWkid != null && - message.hasOwnProperty('latestVcsWkid') - ) + if (message.latestVcsWkid != null && message.hasOwnProperty('latestVcsWkid')) object.latestVcsWkid = message.latestVcsWkid; - if (message.wkt != null && message.hasOwnProperty('wkt')) - object.wkt = message.wkt; + if (message.wkt != null && message.hasOwnProperty('wkt')) object.wkt = message.wkt; return object; }; @@ -736,10 +674,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.SpatialReference' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.SpatialReference'; }; return SpatialReference; @@ -769,8 +704,7 @@ $root.esriPBuffer = (function () { function Field(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -846,33 +780,16 @@ $root.esriPBuffer = (function () { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, 'name')) writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name); - if ( - message.fieldType != null && - Object.hasOwnProperty.call(message, 'fieldType') - ) + if (message.fieldType != null && Object.hasOwnProperty.call(message, 'fieldType')) writer.uint32(/* id 2, wireType 0 =*/ 16).int32(message.fieldType); - if ( - message.alias != null && - Object.hasOwnProperty.call(message, 'alias') - ) + if (message.alias != null && Object.hasOwnProperty.call(message, 'alias')) writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.alias); - if ( - message.sqlType != null && - Object.hasOwnProperty.call(message, 'sqlType') - ) + if (message.sqlType != null && Object.hasOwnProperty.call(message, 'sqlType')) writer.uint32(/* id 4, wireType 0 =*/ 32).int32(message.sqlType); - if ( - message.domain != null && - Object.hasOwnProperty.call(message, 'domain') - ) + if (message.domain != null && Object.hasOwnProperty.call(message, 'domain')) writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.domain); - if ( - message.defaultValue != null && - Object.hasOwnProperty.call(message, 'defaultValue') - ) - writer - .uint32(/* id 6, wireType 2 =*/ 50) - .string(message.defaultValue); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, 'defaultValue')) + writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.defaultValue); return writer; }; @@ -963,8 +880,7 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Field.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.name != null && message.hasOwnProperty('name')) if (!$util.isString(message.name)) return 'name: string expected'; if (message.fieldType != null && message.hasOwnProperty('fieldType')) @@ -1027,12 +943,8 @@ $root.esriPBuffer = (function () { } if (message.domain != null && message.hasOwnProperty('domain')) if (!$util.isString(message.domain)) return 'domain: string expected'; - if ( - message.defaultValue != null && - message.hasOwnProperty('defaultValue') - ) - if (!$util.isString(message.defaultValue)) - return 'defaultValue: string expected'; + if (message.defaultValue != null && message.hasOwnProperty('defaultValue')) + if (!$util.isString(message.defaultValue)) return 'defaultValue: string expected'; return null; }; @@ -1045,8 +957,7 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Field} Field */ Field.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Field) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Field) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Field(); if (object.name != null) message.name = String(object.name); switch (object.fieldType) { @@ -1243,8 +1154,7 @@ $root.esriPBuffer = (function () { break; } if (object.domain != null) message.domain = String(object.domain); - if (object.defaultValue != null) - message.defaultValue = String(object.defaultValue); + if (object.defaultValue != null) message.defaultValue = String(object.defaultValue); return message; }; @@ -1262,45 +1172,32 @@ $root.esriPBuffer = (function () { var object = {}; if (options.defaults) { object.name = ''; - object.fieldType = - options.enums === String ? 'esriFieldTypeSmallInteger' : 0; + object.fieldType = options.enums === String ? 'esriFieldTypeSmallInteger' : 0; object.alias = ''; object.sqlType = options.enums === String ? 'sqlTypeBigInt' : 0; object.domain = ''; object.defaultValue = ''; } - if (message.name != null && message.hasOwnProperty('name')) - object.name = message.name; + if (message.name != null && message.hasOwnProperty('name')) object.name = message.name; if (message.fieldType != null && message.hasOwnProperty('fieldType')) object.fieldType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[ - message.fieldType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[message.fieldType] === + undefined ? message.fieldType - : $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[ - message.fieldType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.FieldType[message.fieldType] : message.fieldType; - if (message.alias != null && message.hasOwnProperty('alias')) - object.alias = message.alias; + if (message.alias != null && message.hasOwnProperty('alias')) object.alias = message.alias; if (message.sqlType != null && message.hasOwnProperty('sqlType')) object.sqlType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[ - message.sqlType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[message.sqlType] === undefined ? message.sqlType - : $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[ - message.sqlType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.SQLType[message.sqlType] : message.sqlType; if (message.domain != null && message.hasOwnProperty('domain')) object.domain = message.domain; - if ( - message.defaultValue != null && - message.hasOwnProperty('defaultValue') - ) + if (message.defaultValue != null && message.hasOwnProperty('defaultValue')) object.defaultValue = message.defaultValue; return object; }; @@ -1354,8 +1251,7 @@ $root.esriPBuffer = (function () { function GeometryField(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -1397,18 +1293,12 @@ $root.esriPBuffer = (function () { */ GeometryField.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.field != null && - Object.hasOwnProperty.call(message, 'field') - ) + if (message.field != null && Object.hasOwnProperty.call(message, 'field')) $root.esriPBuffer.FeatureCollectionPBuffer.Field.encode( message.field, writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), ).ldelim(); - if ( - message.geometryType != null && - Object.hasOwnProperty.call(message, 'geometryType') - ) + if (message.geometryType != null && Object.hasOwnProperty.call(message, 'geometryType')) writer.uint32(/* id 2, wireType 0 =*/ 16).int32(message.geometryType); return writer; }; @@ -1422,10 +1312,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GeometryField.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + GeometryField.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -1443,17 +1330,15 @@ $root.esriPBuffer = (function () { GeometryField.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.field = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.decode( - reader, - reader.uint32(), - ); + message.field = $root.esriPBuffer.FeatureCollectionPBuffer.Field.decode( + reader, + reader.uint32(), + ); break; } case 2: { @@ -1492,18 +1377,12 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GeometryField.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.field != null && message.hasOwnProperty('field')) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify( - message.field, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify(message.field); if (error) return 'field.' + error; } - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + if (message.geometryType != null && message.hasOwnProperty('geometryType')) switch (message.geometryType) { default: return 'geometryType: enum value expected'; @@ -1528,22 +1407,15 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.GeometryField} GeometryField */ GeometryField.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField(); if (object.field != null) { if (typeof object.field !== 'object') throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.GeometryField.field: object expected', ); - message.field = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject( - object.field, - ); + message.field = $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject(object.field); } switch (object.geometryType) { default: @@ -1598,28 +1470,20 @@ $root.esriPBuffer = (function () { var object = {}; if (options.defaults) { object.field = null; - object.geometryType = - options.enums === String ? 'esriGeometryTypePoint' : 0; + object.geometryType = options.enums === String ? 'esriGeometryTypePoint' : 0; } if (message.field != null && message.hasOwnProperty('field')) - object.field = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( - message.field, - options, - ); - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + object.field = $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( + message.field, + options, + ); + if (message.geometryType != null && message.hasOwnProperty('geometryType')) object.geometryType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] === + undefined ? message.geometryType - : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] : message.geometryType; return object; }; @@ -1647,9 +1511,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.GeometryField' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.GeometryField'; }; return GeometryField; @@ -1678,8 +1540,7 @@ $root.esriPBuffer = (function () { function Envelope(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -1851,8 +1712,7 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Envelope.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.XMin != null && message.hasOwnProperty('XMin')) if (typeof message.XMin !== 'number') return 'XMin: number expected'; if (message.YMin != null && message.hasOwnProperty('YMin')) @@ -1861,14 +1721,10 @@ $root.esriPBuffer = (function () { if (typeof message.XMax !== 'number') return 'XMax: number expected'; if (message.YMax != null && message.hasOwnProperty('YMax')) if (typeof message.YMax !== 'number') return 'YMax: number expected'; - if ( - message.SpatialReference != null && - message.hasOwnProperty('SpatialReference') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( - message.SpatialReference, - ); + if (message.SpatialReference != null && message.hasOwnProperty('SpatialReference')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( + message.SpatialReference, + ); if (error) return 'SpatialReference.' + error; } return null; @@ -1883,10 +1739,7 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Envelope} Envelope */ Envelope.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Envelope - ) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Envelope) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Envelope(); if (object.XMin != null) message.XMin = Number(object.XMin); if (object.YMin != null) message.YMin = Number(object.YMin); @@ -1926,28 +1779,17 @@ $root.esriPBuffer = (function () { } if (message.XMin != null && message.hasOwnProperty('XMin')) object.XMin = - options.json && !isFinite(message.XMin) - ? String(message.XMin) - : message.XMin; + options.json && !isFinite(message.XMin) ? String(message.XMin) : message.XMin; if (message.YMin != null && message.hasOwnProperty('YMin')) object.YMin = - options.json && !isFinite(message.YMin) - ? String(message.YMin) - : message.YMin; + options.json && !isFinite(message.YMin) ? String(message.YMin) : message.YMin; if (message.XMax != null && message.hasOwnProperty('XMax')) object.XMax = - options.json && !isFinite(message.XMax) - ? String(message.XMax) - : message.XMax; + options.json && !isFinite(message.XMax) ? String(message.XMax) : message.XMax; if (message.YMax != null && message.hasOwnProperty('YMax')) object.YMax = - options.json && !isFinite(message.YMax) - ? String(message.YMax) - : message.YMax; - if ( - message.SpatialReference != null && - message.hasOwnProperty('SpatialReference') - ) + options.json && !isFinite(message.YMax) ? String(message.YMax) : message.YMax; + if (message.SpatialReference != null && message.hasOwnProperty('SpatialReference')) object.SpatialReference = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.toObject( message.SpatialReference, @@ -2012,8 +1854,7 @@ $root.esriPBuffer = (function () { function Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -2137,50 +1978,23 @@ $root.esriPBuffer = (function () { */ Value.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.stringValue != null && - Object.hasOwnProperty.call(message, 'stringValue') - ) + if (message.stringValue != null && Object.hasOwnProperty.call(message, 'stringValue')) writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.stringValue); - if ( - message.floatValue != null && - Object.hasOwnProperty.call(message, 'floatValue') - ) + if (message.floatValue != null && Object.hasOwnProperty.call(message, 'floatValue')) writer.uint32(/* id 2, wireType 5 =*/ 21).float(message.floatValue); - if ( - message.doubleValue != null && - Object.hasOwnProperty.call(message, 'doubleValue') - ) + if (message.doubleValue != null && Object.hasOwnProperty.call(message, 'doubleValue')) writer.uint32(/* id 3, wireType 1 =*/ 25).double(message.doubleValue); - if ( - message.sintValue != null && - Object.hasOwnProperty.call(message, 'sintValue') - ) + if (message.sintValue != null && Object.hasOwnProperty.call(message, 'sintValue')) writer.uint32(/* id 4, wireType 0 =*/ 32).sint32(message.sintValue); - if ( - message.uintValue != null && - Object.hasOwnProperty.call(message, 'uintValue') - ) + if (message.uintValue != null && Object.hasOwnProperty.call(message, 'uintValue')) writer.uint32(/* id 5, wireType 0 =*/ 40).uint32(message.uintValue); - if ( - message.int64Value != null && - Object.hasOwnProperty.call(message, 'int64Value') - ) + if (message.int64Value != null && Object.hasOwnProperty.call(message, 'int64Value')) writer.uint32(/* id 6, wireType 0 =*/ 48).int64(message.int64Value); - if ( - message.uint64Value != null && - Object.hasOwnProperty.call(message, 'uint64Value') - ) + if (message.uint64Value != null && Object.hasOwnProperty.call(message, 'uint64Value')) writer.uint32(/* id 7, wireType 0 =*/ 56).uint64(message.uint64Value); - if ( - message.sint64Value != null && - Object.hasOwnProperty.call(message, 'sint64Value') - ) + if (message.sint64Value != null && Object.hasOwnProperty.call(message, 'sint64Value')) writer.uint32(/* id 8, wireType 0 =*/ 64).sint64(message.sint64Value); - if ( - message.boolValue != null && - Object.hasOwnProperty.call(message, 'boolValue') - ) + if (message.boolValue != null && Object.hasOwnProperty.call(message, 'boolValue')) writer.uint32(/* id 9, wireType 0 =*/ 72).bool(message.boolValue); return writer; }; @@ -2284,51 +2098,33 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Value.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; var properties = {}; - if ( - message.stringValue != null && - message.hasOwnProperty('stringValue') - ) { + if (message.stringValue != null && message.hasOwnProperty('stringValue')) { properties.valueType = 1; - if (!$util.isString(message.stringValue)) - return 'stringValue: string expected'; + if (!$util.isString(message.stringValue)) return 'stringValue: string expected'; } - if ( - message.floatValue != null && - message.hasOwnProperty('floatValue') - ) { + if (message.floatValue != null && message.hasOwnProperty('floatValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (typeof message.floatValue !== 'number') - return 'floatValue: number expected'; + if (typeof message.floatValue !== 'number') return 'floatValue: number expected'; } - if ( - message.doubleValue != null && - message.hasOwnProperty('doubleValue') - ) { + if (message.doubleValue != null && message.hasOwnProperty('doubleValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (typeof message.doubleValue !== 'number') - return 'doubleValue: number expected'; + if (typeof message.doubleValue !== 'number') return 'doubleValue: number expected'; } if (message.sintValue != null && message.hasOwnProperty('sintValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (!$util.isInteger(message.sintValue)) - return 'sintValue: integer expected'; + if (!$util.isInteger(message.sintValue)) return 'sintValue: integer expected'; } if (message.uintValue != null && message.hasOwnProperty('uintValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (!$util.isInteger(message.uintValue)) - return 'uintValue: integer expected'; + if (!$util.isInteger(message.uintValue)) return 'uintValue: integer expected'; } - if ( - message.int64Value != null && - message.hasOwnProperty('int64Value') - ) { + if (message.int64Value != null && message.hasOwnProperty('int64Value')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; if ( @@ -2341,10 +2137,7 @@ $root.esriPBuffer = (function () { ) return 'int64Value: integer|Long expected'; } - if ( - message.uint64Value != null && - message.hasOwnProperty('uint64Value') - ) { + if (message.uint64Value != null && message.hasOwnProperty('uint64Value')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; if ( @@ -2357,10 +2150,7 @@ $root.esriPBuffer = (function () { ) return 'uint64Value: integer|Long expected'; } - if ( - message.sint64Value != null && - message.hasOwnProperty('sint64Value') - ) { + if (message.sint64Value != null && message.hasOwnProperty('sint64Value')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; if ( @@ -2376,8 +2166,7 @@ $root.esriPBuffer = (function () { if (message.boolValue != null && message.hasOwnProperty('boolValue')) { if (properties.valueType === 1) return 'valueType: multiple values'; properties.valueType = 1; - if (typeof message.boolValue !== 'boolean') - return 'boolValue: boolean expected'; + if (typeof message.boolValue !== 'boolean') return 'boolValue: boolean expected'; } return null; }; @@ -2391,27 +2180,19 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Value} Value */ Value.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Value) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Value) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Value(); - if (object.stringValue != null) - message.stringValue = String(object.stringValue); - if (object.floatValue != null) - message.floatValue = Number(object.floatValue); - if (object.doubleValue != null) - message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) message.stringValue = String(object.stringValue); + if (object.floatValue != null) message.floatValue = Number(object.floatValue); + if (object.doubleValue != null) message.doubleValue = Number(object.doubleValue); if (object.sintValue != null) message.sintValue = object.sintValue | 0; - if (object.uintValue != null) - message.uintValue = object.uintValue >>> 0; + if (object.uintValue != null) message.uintValue = object.uintValue >>> 0; if (object.int64Value != null) if ($util.Long) - (message.int64Value = $util.Long.fromValue( - object.int64Value, - )).unsigned = false; + (message.int64Value = $util.Long.fromValue(object.int64Value)).unsigned = false; else if (typeof object.int64Value === 'string') message.int64Value = parseInt(object.int64Value, 10); - else if (typeof object.int64Value === 'number') - message.int64Value = object.int64Value; + else if (typeof object.int64Value === 'number') message.int64Value = object.int64Value; else if (typeof object.int64Value === 'object') message.int64Value = new $util.LongBits( object.int64Value.low >>> 0, @@ -2419,13 +2200,10 @@ $root.esriPBuffer = (function () { ).toNumber(); if (object.uint64Value != null) if ($util.Long) - (message.uint64Value = $util.Long.fromValue( - object.uint64Value, - )).unsigned = true; + (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; else if (typeof object.uint64Value === 'string') message.uint64Value = parseInt(object.uint64Value, 10); - else if (typeof object.uint64Value === 'number') - message.uint64Value = object.uint64Value; + else if (typeof object.uint64Value === 'number') message.uint64Value = object.uint64Value; else if (typeof object.uint64Value === 'object') message.uint64Value = new $util.LongBits( object.uint64Value.low >>> 0, @@ -2433,20 +2211,16 @@ $root.esriPBuffer = (function () { ).toNumber(true); if (object.sint64Value != null) if ($util.Long) - (message.sint64Value = $util.Long.fromValue( - object.sint64Value, - )).unsigned = false; + (message.sint64Value = $util.Long.fromValue(object.sint64Value)).unsigned = false; else if (typeof object.sint64Value === 'string') message.sint64Value = parseInt(object.sint64Value, 10); - else if (typeof object.sint64Value === 'number') - message.sint64Value = object.sint64Value; + else if (typeof object.sint64Value === 'number') message.sint64Value = object.sint64Value; else if (typeof object.sint64Value === 'object') message.sint64Value = new $util.LongBits( object.sint64Value.low >>> 0, object.sint64Value.high >>> 0, ).toNumber(); - if (object.boolValue != null) - message.boolValue = Boolean(object.boolValue); + if (object.boolValue != null) message.boolValue = Boolean(object.boolValue); return message; }; @@ -2462,27 +2236,18 @@ $root.esriPBuffer = (function () { Value.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if ( - message.stringValue != null && - message.hasOwnProperty('stringValue') - ) { + if (message.stringValue != null && message.hasOwnProperty('stringValue')) { object.stringValue = message.stringValue; if (options.oneofs) object.valueType = 'stringValue'; } - if ( - message.floatValue != null && - message.hasOwnProperty('floatValue') - ) { + if (message.floatValue != null && message.hasOwnProperty('floatValue')) { object.floatValue = options.json && !isFinite(message.floatValue) ? String(message.floatValue) : message.floatValue; if (options.oneofs) object.valueType = 'floatValue'; } - if ( - message.doubleValue != null && - message.hasOwnProperty('doubleValue') - ) { + if (message.doubleValue != null && message.hasOwnProperty('doubleValue')) { object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) @@ -2497,15 +2262,10 @@ $root.esriPBuffer = (function () { object.uintValue = message.uintValue; if (options.oneofs) object.valueType = 'uintValue'; } - if ( - message.int64Value != null && - message.hasOwnProperty('int64Value') - ) { + if (message.int64Value != null && message.hasOwnProperty('int64Value')) { if (typeof message.int64Value === 'number') object.int64Value = - options.longs === String - ? String(message.int64Value) - : message.int64Value; + options.longs === String ? String(message.int64Value) : message.int64Value; else object.int64Value = options.longs === String @@ -2518,15 +2278,10 @@ $root.esriPBuffer = (function () { : message.int64Value; if (options.oneofs) object.valueType = 'int64Value'; } - if ( - message.uint64Value != null && - message.hasOwnProperty('uint64Value') - ) { + if (message.uint64Value != null && message.hasOwnProperty('uint64Value')) { if (typeof message.uint64Value === 'number') object.uint64Value = - options.longs === String - ? String(message.uint64Value) - : message.uint64Value; + options.longs === String ? String(message.uint64Value) : message.uint64Value; else object.uint64Value = options.longs === String @@ -2539,15 +2294,10 @@ $root.esriPBuffer = (function () { : message.uint64Value; if (options.oneofs) object.valueType = 'uint64Value'; } - if ( - message.sint64Value != null && - message.hasOwnProperty('sint64Value') - ) { + if (message.sint64Value != null && message.hasOwnProperty('sint64Value')) { if (typeof message.sint64Value === 'number') object.sint64Value = - options.longs === String - ? String(message.sint64Value) - : message.sint64Value; + options.longs === String ? String(message.sint64Value) : message.sint64Value; else object.sint64Value = options.longs === String @@ -2619,8 +2369,7 @@ $root.esriPBuffer = (function () { this.coords = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -2670,21 +2419,16 @@ $root.esriPBuffer = (function () { */ Geometry.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.geometryType != null && - Object.hasOwnProperty.call(message, 'geometryType') - ) + if (message.geometryType != null && Object.hasOwnProperty.call(message, 'geometryType')) writer.uint32(/* id 1, wireType 0 =*/ 8).int32(message.geometryType); if (message.lengths != null && message.lengths.length) { writer.uint32(/* id 2, wireType 2 =*/ 18).fork(); - for (var i = 0; i < message.lengths.length; ++i) - writer.uint32(message.lengths[i]); + for (var i = 0; i < message.lengths.length; ++i) writer.uint32(message.lengths[i]); writer.ldelim(); } if (message.coords != null && message.coords.length) { writer.uint32(/* id 3, wireType 2 =*/ 26).fork(); - for (var i = 0; i < message.coords.length; ++i) - writer.sint64(message.coords[i]); + for (var i = 0; i < message.coords.length; ++i) writer.sint64(message.coords[i]); writer.ldelim(); } return writer; @@ -2726,8 +2470,7 @@ $root.esriPBuffer = (function () { break; } case 2: { - if (!(message.lengths && message.lengths.length)) - message.lengths = []; + if (!(message.lengths && message.lengths.length)) message.lengths = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) message.lengths.push(reader.uint32()); @@ -2735,8 +2478,7 @@ $root.esriPBuffer = (function () { break; } case 3: { - if (!(message.coords && message.coords.length)) - message.coords = []; + if (!(message.coords && message.coords.length)) message.coords = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) message.coords.push(reader.sint64()); @@ -2775,12 +2517,8 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Geometry.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.geometryType != null && message.hasOwnProperty('geometryType')) switch (message.geometryType) { default: return 'geometryType: enum value expected'; @@ -2796,8 +2534,7 @@ $root.esriPBuffer = (function () { if (message.lengths != null && message.hasOwnProperty('lengths')) { if (!Array.isArray(message.lengths)) return 'lengths: array expected'; for (var i = 0; i < message.lengths.length; ++i) - if (!$util.isInteger(message.lengths[i])) - return 'lengths: integer[] expected'; + if (!$util.isInteger(message.lengths[i])) return 'lengths: integer[] expected'; } if (message.coords != null && message.hasOwnProperty('coords')) { if (!Array.isArray(message.coords)) return 'coords: array expected'; @@ -2824,10 +2561,7 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Geometry} Geometry */ Geometry.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Geometry - ) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Geometry) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Geometry(); switch (object.geometryType) { default: @@ -2882,13 +2616,10 @@ $root.esriPBuffer = (function () { message.coords = []; for (var i = 0; i < object.coords.length; ++i) if ($util.Long) - (message.coords[i] = $util.Long.fromValue( - object.coords[i], - )).unsigned = false; + (message.coords[i] = $util.Long.fromValue(object.coords[i])).unsigned = false; else if (typeof object.coords[i] === 'string') message.coords[i] = parseInt(object.coords[i], 10); - else if (typeof object.coords[i] === 'number') - message.coords[i] = object.coords[i]; + else if (typeof object.coords[i] === 'number') message.coords[i] = object.coords[i]; else if (typeof object.coords[i] === 'object') message.coords[i] = new $util.LongBits( object.coords[i].low >>> 0, @@ -2915,35 +2646,25 @@ $root.esriPBuffer = (function () { object.coords = []; } if (options.defaults) - object.geometryType = - options.enums === String ? 'esriGeometryTypePoint' : 0; - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + object.geometryType = options.enums === String ? 'esriGeometryTypePoint' : 0; + if (message.geometryType != null && message.hasOwnProperty('geometryType')) object.geometryType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] === + undefined ? message.geometryType - : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] : message.geometryType; if (message.lengths && message.lengths.length) { object.lengths = []; - for (var j = 0; j < message.lengths.length; ++j) - object.lengths[j] = message.lengths[j]; + for (var j = 0; j < message.lengths.length; ++j) object.lengths[j] = message.lengths[j]; } if (message.coords && message.coords.length) { object.coords = []; for (var j = 0; j < message.coords.length; ++j) if (typeof message.coords[j] === 'number') object.coords[j] = - options.longs === String - ? String(message.coords[j]) - : message.coords[j]; + options.longs === String ? String(message.coords[j]) : message.coords[j]; else object.coords[j] = options.longs === String @@ -3006,8 +2727,7 @@ $root.esriPBuffer = (function () { function esriShapeBuffer(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -3041,10 +2761,7 @@ $root.esriPBuffer = (function () { */ esriShapeBuffer.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.bytes != null && - Object.hasOwnProperty.call(message, 'bytes') - ) + if (message.bytes != null && Object.hasOwnProperty.call(message, 'bytes')) writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.bytes); return writer; }; @@ -3058,10 +2775,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - esriShapeBuffer.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + esriShapeBuffer.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -3079,8 +2793,7 @@ $root.esriPBuffer = (function () { esriShapeBuffer.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -3120,8 +2833,7 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ esriShapeBuffer.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.bytes != null && message.hasOwnProperty('bytes')) if ( !( @@ -3142,20 +2854,14 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer} esriShapeBuffer */ esriShapeBuffer.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer(); if (object.bytes != null) if (typeof object.bytes === 'string') $util.base64.decode( object.bytes, - (message.bytes = $util.newBuffer( - $util.base64.length(object.bytes), - )), + (message.bytes = $util.newBuffer($util.base64.length(object.bytes))), 0, ); else if (object.bytes.length >= 0) message.bytes = object.bytes; @@ -3178,8 +2884,7 @@ $root.esriPBuffer = (function () { if (options.bytes === String) object.bytes = ''; else { object.bytes = []; - if (options.bytes !== Array) - object.bytes = $util.newBuffer(object.bytes); + if (options.bytes !== Array) object.bytes = $util.newBuffer(object.bytes); } if (message.bytes != null && message.hasOwnProperty('bytes')) object.bytes = @@ -3214,10 +2919,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer'; }; return esriShapeBuffer; @@ -3249,8 +2951,7 @@ $root.esriPBuffer = (function () { this.aggregateGeometries = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -3344,45 +3045,27 @@ $root.esriPBuffer = (function () { message.attributes[i], writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), ).ldelim(); - if ( - message.geometry != null && - Object.hasOwnProperty.call(message, 'geometry') - ) + if (message.geometry != null && Object.hasOwnProperty.call(message, 'geometry')) $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.encode( message.geometry, writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), ).ldelim(); - if ( - message.shapeBuffer != null && - Object.hasOwnProperty.call(message, 'shapeBuffer') - ) + if (message.shapeBuffer != null && Object.hasOwnProperty.call(message, 'shapeBuffer')) $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer - .encode( - message.shapeBuffer, - writer.uint32(/* id 3, wireType 2 =*/ 26).fork(), - ) + .encode(message.shapeBuffer, writer.uint32(/* id 3, wireType 2 =*/ 26).fork()) .ldelim(); - if ( - message.centroid != null && - Object.hasOwnProperty.call(message, 'centroid') - ) + if (message.centroid != null && Object.hasOwnProperty.call(message, 'centroid')) $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.encode( message.centroid, writer.uint32(/* id 4, wireType 2 =*/ 34).fork(), ).ldelim(); - if ( - message.aggregateGeometries != null && - message.aggregateGeometries.length - ) + if (message.aggregateGeometries != null && message.aggregateGeometries.length) for (var i = 0; i < message.aggregateGeometries.length; ++i) $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.encode( message.aggregateGeometries[i], writer.uint32(/* id 5, wireType 2 =*/ 42).fork(), ).ldelim(); - if ( - message.envelope != null && - Object.hasOwnProperty.call(message, 'envelope') - ) + if (message.envelope != null && Object.hasOwnProperty.call(message, 'envelope')) $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.encode( message.envelope, writer.uint32(/* id 6, wireType 2 =*/ 50).fork(), @@ -3422,22 +3105,17 @@ $root.esriPBuffer = (function () { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.attributes && message.attributes.length)) - message.attributes = []; + if (!(message.attributes && message.attributes.length)) message.attributes = []; message.attributes.push( - $root.esriPBuffer.FeatureCollectionPBuffer.Value.decode( - reader, - reader.uint32(), - ), + $root.esriPBuffer.FeatureCollectionPBuffer.Value.decode(reader, reader.uint32()), ); break; } case 2: { - message.geometry = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.decode( - reader, - reader.uint32(), - ); + message.geometry = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.decode( + reader, + reader.uint32(), + ); break; } case 3: { @@ -3449,35 +3127,25 @@ $root.esriPBuffer = (function () { break; } case 4: { - message.centroid = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.decode( - reader, - reader.uint32(), - ); + message.centroid = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.decode( + reader, + reader.uint32(), + ); break; } case 5: { - if ( - !( - message.aggregateGeometries && - message.aggregateGeometries.length - ) - ) + if (!(message.aggregateGeometries && message.aggregateGeometries.length)) message.aggregateGeometries = []; message.aggregateGeometries.push( - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.decode( - reader, - reader.uint32(), - ), + $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.decode(reader, reader.uint32()), ); break; } case 6: { - message.envelope = - $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.decode( - reader, - reader.uint32(), - ); + message.envelope = $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.decode( + reader, + reader.uint32(), + ); break; } default: @@ -3512,15 +3180,10 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Feature.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; var properties = {}; - if ( - message.attributes != null && - message.hasOwnProperty('attributes') - ) { - if (!Array.isArray(message.attributes)) - return 'attributes: array expected'; + if (message.attributes != null && message.hasOwnProperty('attributes')) { + if (!Array.isArray(message.attributes)) return 'attributes: array expected'; for (var i = 0; i < message.attributes.length; ++i) { var error = $root.esriPBuffer.FeatureCollectionPBuffer.Value.verify( message.attributes[i], @@ -3531,54 +3194,38 @@ $root.esriPBuffer = (function () { if (message.geometry != null && message.hasOwnProperty('geometry')) { properties.compressedGeometry = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( - message.geometry, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( + message.geometry, + ); if (error) return 'geometry.' + error; } } - if ( - message.shapeBuffer != null && - message.hasOwnProperty('shapeBuffer') - ) { - if (properties.compressedGeometry === 1) - return 'compressedGeometry: multiple values'; + if (message.shapeBuffer != null && message.hasOwnProperty('shapeBuffer')) { + if (properties.compressedGeometry === 1) return 'compressedGeometry: multiple values'; properties.compressedGeometry = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.verify( - message.shapeBuffer, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.verify( + message.shapeBuffer, + ); if (error) return 'shapeBuffer.' + error; } } if (message.centroid != null && message.hasOwnProperty('centroid')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( - message.centroid, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify(message.centroid); if (error) return 'centroid.' + error; } - if ( - message.aggregateGeometries != null && - message.hasOwnProperty('aggregateGeometries') - ) { + if (message.aggregateGeometries != null && message.hasOwnProperty('aggregateGeometries')) { if (!Array.isArray(message.aggregateGeometries)) return 'aggregateGeometries: array expected'; for (var i = 0; i < message.aggregateGeometries.length; ++i) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( - message.aggregateGeometries[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.verify( + message.aggregateGeometries[i], + ); if (error) return 'aggregateGeometries.' + error; } } if (message.envelope != null && message.hasOwnProperty('envelope')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.verify( - message.envelope, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.verify(message.envelope); if (error) return 'envelope.' + error; } return null; @@ -3593,10 +3240,7 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Feature} Feature */ Feature.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Feature - ) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Feature) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Feature(); if (object.attributes) { if (!Array.isArray(object.attributes)) @@ -3609,10 +3253,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.attributes: object expected', ); - message.attributes[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( - object.attributes[i], - ); + message.attributes[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( + object.attributes[i], + ); } } if (object.geometry != null) { @@ -3620,10 +3263,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.geometry: object expected', ); - message.geometry = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( - object.geometry, - ); + message.geometry = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( + object.geometry, + ); } if (object.shapeBuffer != null) { if (typeof object.shapeBuffer !== 'object') @@ -3640,10 +3282,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.centroid: object expected', ); - message.centroid = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( - object.centroid, - ); + message.centroid = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.fromObject( + object.centroid, + ); } if (object.aggregateGeometries) { if (!Array.isArray(object.aggregateGeometries)) @@ -3667,10 +3308,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Feature.envelope: object expected', ); - message.envelope = - $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.fromObject( - object.envelope, - ); + message.envelope = $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.fromObject( + object.envelope, + ); } return message; }; @@ -3698,37 +3338,30 @@ $root.esriPBuffer = (function () { if (message.attributes && message.attributes.length) { object.attributes = []; for (var j = 0; j < message.attributes.length; ++j) - object.attributes[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( - message.attributes[j], - options, - ); - } - if (message.geometry != null && message.hasOwnProperty('geometry')) { - object.geometry = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( - message.geometry, + object.attributes[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( + message.attributes[j], options, ); + } + if (message.geometry != null && message.hasOwnProperty('geometry')) { + object.geometry = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( + message.geometry, + options, + ); if (options.oneofs) object.compressedGeometry = 'geometry'; } - if ( - message.shapeBuffer != null && - message.hasOwnProperty('shapeBuffer') - ) { - object.shapeBuffer = - $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.toObject( - message.shapeBuffer, - options, - ); + if (message.shapeBuffer != null && message.hasOwnProperty('shapeBuffer')) { + object.shapeBuffer = $root.esriPBuffer.FeatureCollectionPBuffer.esriShapeBuffer.toObject( + message.shapeBuffer, + options, + ); if (options.oneofs) object.compressedGeometry = 'shapeBuffer'; } if (message.centroid != null && message.hasOwnProperty('centroid')) - object.centroid = - $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( - message.centroid, - options, - ); + object.centroid = $root.esriPBuffer.FeatureCollectionPBuffer.Geometry.toObject( + message.centroid, + options, + ); if (message.aggregateGeometries && message.aggregateGeometries.length) { object.aggregateGeometries = []; for (var j = 0; j < message.aggregateGeometries.length; ++j) @@ -3739,11 +3372,10 @@ $root.esriPBuffer = (function () { ); } if (message.envelope != null && message.hasOwnProperty('envelope')) - object.envelope = - $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.toObject( - message.envelope, - options, - ); + object.envelope = $root.esriPBuffer.FeatureCollectionPBuffer.Envelope.toObject( + message.envelope, + options, + ); return object; }; @@ -3796,8 +3428,7 @@ $root.esriPBuffer = (function () { function UniqueIdField(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -3845,9 +3476,7 @@ $root.esriPBuffer = (function () { message.isSystemMaintained != null && Object.hasOwnProperty.call(message, 'isSystemMaintained') ) - writer - .uint32(/* id 2, wireType 0 =*/ 16) - .bool(message.isSystemMaintained); + writer.uint32(/* id 2, wireType 0 =*/ 16).bool(message.isSystemMaintained); return writer; }; @@ -3860,10 +3489,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UniqueIdField.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + UniqueIdField.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -3881,8 +3507,7 @@ $root.esriPBuffer = (function () { UniqueIdField.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -3926,14 +3551,10 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ UniqueIdField.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.name != null && message.hasOwnProperty('name')) if (!$util.isString(message.name)) return 'name: string expected'; - if ( - message.isSystemMaintained != null && - message.hasOwnProperty('isSystemMaintained') - ) + if (message.isSystemMaintained != null && message.hasOwnProperty('isSystemMaintained')) if (typeof message.isSystemMaintained !== 'boolean') return 'isSystemMaintained: boolean expected'; return null; @@ -3948,13 +3569,9 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.UniqueIdField} UniqueIdField */ UniqueIdField.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField(); if (object.name != null) message.name = String(object.name); if (object.isSystemMaintained != null) message.isSystemMaintained = Boolean(object.isSystemMaintained); @@ -3977,12 +3594,8 @@ $root.esriPBuffer = (function () { object.name = ''; object.isSystemMaintained = false; } - if (message.name != null && message.hasOwnProperty('name')) - object.name = message.name; - if ( - message.isSystemMaintained != null && - message.hasOwnProperty('isSystemMaintained') - ) + if (message.name != null && message.hasOwnProperty('name')) object.name = message.name; + if (message.isSystemMaintained != null && message.hasOwnProperty('isSystemMaintained')) object.isSystemMaintained = message.isSystemMaintained; return object; }; @@ -4010,9 +3623,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.UniqueIdField' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.UniqueIdField'; }; return UniqueIdField; @@ -4039,8 +3650,7 @@ $root.esriPBuffer = (function () { function GeometryProperties(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -4094,20 +3704,13 @@ $root.esriPBuffer = (function () { message.shapeAreaFieldName != null && Object.hasOwnProperty.call(message, 'shapeAreaFieldName') ) - writer - .uint32(/* id 1, wireType 2 =*/ 10) - .string(message.shapeAreaFieldName); + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.shapeAreaFieldName); if ( message.shapeLengthFieldName != null && Object.hasOwnProperty.call(message, 'shapeLengthFieldName') ) - writer - .uint32(/* id 2, wireType 2 =*/ 18) - .string(message.shapeLengthFieldName); - if ( - message.units != null && - Object.hasOwnProperty.call(message, 'units') - ) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.shapeLengthFieldName); + if (message.units != null && Object.hasOwnProperty.call(message, 'units')) writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.units); return writer; }; @@ -4121,10 +3724,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GeometryProperties.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + GeometryProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -4142,8 +3742,7 @@ $root.esriPBuffer = (function () { GeometryProperties.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -4191,18 +3790,11 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GeometryProperties.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.shapeAreaFieldName != null && - message.hasOwnProperty('shapeAreaFieldName') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.shapeAreaFieldName != null && message.hasOwnProperty('shapeAreaFieldName')) if (!$util.isString(message.shapeAreaFieldName)) return 'shapeAreaFieldName: string expected'; - if ( - message.shapeLengthFieldName != null && - message.hasOwnProperty('shapeLengthFieldName') - ) + if (message.shapeLengthFieldName != null && message.hasOwnProperty('shapeLengthFieldName')) if (!$util.isString(message.shapeLengthFieldName)) return 'shapeLengthFieldName: string expected'; if (message.units != null && message.hasOwnProperty('units')) @@ -4219,13 +3811,9 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.GeometryProperties} GeometryProperties */ GeometryProperties.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties(); if (object.shapeAreaFieldName != null) message.shapeAreaFieldName = String(object.shapeAreaFieldName); if (object.shapeLengthFieldName != null) @@ -4251,18 +3839,11 @@ $root.esriPBuffer = (function () { object.shapeLengthFieldName = ''; object.units = ''; } - if ( - message.shapeAreaFieldName != null && - message.hasOwnProperty('shapeAreaFieldName') - ) + if (message.shapeAreaFieldName != null && message.hasOwnProperty('shapeAreaFieldName')) object.shapeAreaFieldName = message.shapeAreaFieldName; - if ( - message.shapeLengthFieldName != null && - message.hasOwnProperty('shapeLengthFieldName') - ) + if (message.shapeLengthFieldName != null && message.hasOwnProperty('shapeLengthFieldName')) object.shapeLengthFieldName = message.shapeLengthFieldName; - if (message.units != null && message.hasOwnProperty('units')) - object.units = message.units; + if (message.units != null && message.hasOwnProperty('units')) object.units = message.units; return object; }; @@ -4289,10 +3870,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.GeometryProperties' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.GeometryProperties'; }; return GeometryProperties; @@ -4318,8 +3896,7 @@ $root.esriPBuffer = (function () { function ServerGens(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -4328,9 +3905,7 @@ $root.esriPBuffer = (function () { * @memberof esriPBuffer.FeatureCollectionPBuffer.ServerGens * @instance */ - ServerGens.prototype.minServerGen = $util.Long - ? $util.Long.fromBits(0, 0, true) - : 0; + ServerGens.prototype.minServerGen = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; /** * ServerGens serverGen. @@ -4338,9 +3913,7 @@ $root.esriPBuffer = (function () { * @memberof esriPBuffer.FeatureCollectionPBuffer.ServerGens * @instance */ - ServerGens.prototype.serverGen = $util.Long - ? $util.Long.fromBits(0, 0, true) - : 0; + ServerGens.prototype.serverGen = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; /** * Creates a new ServerGens instance using the specified properties. @@ -4365,15 +3938,9 @@ $root.esriPBuffer = (function () { */ ServerGens.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.minServerGen != null && - Object.hasOwnProperty.call(message, 'minServerGen') - ) + if (message.minServerGen != null && Object.hasOwnProperty.call(message, 'minServerGen')) writer.uint32(/* id 1, wireType 0 =*/ 8).uint64(message.minServerGen); - if ( - message.serverGen != null && - Object.hasOwnProperty.call(message, 'serverGen') - ) + if (message.serverGen != null && Object.hasOwnProperty.call(message, 'serverGen')) writer.uint32(/* id 2, wireType 0 =*/ 16).uint64(message.serverGen); return writer; }; @@ -4449,12 +4016,8 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ServerGens.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.minServerGen != null && - message.hasOwnProperty('minServerGen') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.minServerGen != null && message.hasOwnProperty('minServerGen')) if ( !$util.isInteger(message.minServerGen) && !( @@ -4486,18 +4049,11 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.ServerGens} ServerGens */ ServerGens.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens(); if (object.minServerGen != null) if ($util.Long) - (message.minServerGen = $util.Long.fromValue( - object.minServerGen, - )).unsigned = true; + (message.minServerGen = $util.Long.fromValue(object.minServerGen)).unsigned = true; else if (typeof object.minServerGen === 'string') message.minServerGen = parseInt(object.minServerGen, 10); else if (typeof object.minServerGen === 'number') @@ -4509,13 +4065,10 @@ $root.esriPBuffer = (function () { ).toNumber(true); if (object.serverGen != null) if ($util.Long) - (message.serverGen = $util.Long.fromValue( - object.serverGen, - )).unsigned = true; + (message.serverGen = $util.Long.fromValue(object.serverGen)).unsigned = true; else if (typeof object.serverGen === 'string') message.serverGen = parseInt(object.serverGen, 10); - else if (typeof object.serverGen === 'number') - message.serverGen = object.serverGen; + else if (typeof object.serverGen === 'number') message.serverGen = object.serverGen; else if (typeof object.serverGen === 'object') message.serverGen = new $util.LongBits( object.serverGen.low >>> 0, @@ -4556,15 +4109,10 @@ $root.esriPBuffer = (function () { : long; } else object.serverGen = options.longs === String ? '0' : 0; } - if ( - message.minServerGen != null && - message.hasOwnProperty('minServerGen') - ) + if (message.minServerGen != null && message.hasOwnProperty('minServerGen')) if (typeof message.minServerGen === 'number') object.minServerGen = - options.longs === String - ? String(message.minServerGen) - : message.minServerGen; + options.longs === String ? String(message.minServerGen) : message.minServerGen; else object.minServerGen = options.longs === String @@ -4578,9 +4126,7 @@ $root.esriPBuffer = (function () { if (message.serverGen != null && message.hasOwnProperty('serverGen')) if (typeof message.serverGen === 'number') object.serverGen = - options.longs === String - ? String(message.serverGen) - : message.serverGen; + options.longs === String ? String(message.serverGen) : message.serverGen; else object.serverGen = options.longs === String @@ -4617,9 +4163,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.ServerGens' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.ServerGens'; }; return ServerGens; @@ -4647,8 +4191,7 @@ $root.esriPBuffer = (function () { function Scale(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -4706,25 +4249,13 @@ $root.esriPBuffer = (function () { */ Scale.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.xScale != null && - Object.hasOwnProperty.call(message, 'xScale') - ) + if (message.xScale != null && Object.hasOwnProperty.call(message, 'xScale')) writer.uint32(/* id 1, wireType 1 =*/ 9).double(message.xScale); - if ( - message.yScale != null && - Object.hasOwnProperty.call(message, 'yScale') - ) + if (message.yScale != null && Object.hasOwnProperty.call(message, 'yScale')) writer.uint32(/* id 2, wireType 1 =*/ 17).double(message.yScale); - if ( - message.mScale != null && - Object.hasOwnProperty.call(message, 'mScale') - ) + if (message.mScale != null && Object.hasOwnProperty.call(message, 'mScale')) writer.uint32(/* id 3, wireType 1 =*/ 25).double(message.mScale); - if ( - message.zScale != null && - Object.hasOwnProperty.call(message, 'zScale') - ) + if (message.zScale != null && Object.hasOwnProperty.call(message, 'zScale')) writer.uint32(/* id 4, wireType 1 =*/ 33).double(message.zScale); return writer; }; @@ -4808,20 +4339,15 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Scale.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.xScale != null && message.hasOwnProperty('xScale')) - if (typeof message.xScale !== 'number') - return 'xScale: number expected'; + if (typeof message.xScale !== 'number') return 'xScale: number expected'; if (message.yScale != null && message.hasOwnProperty('yScale')) - if (typeof message.yScale !== 'number') - return 'yScale: number expected'; + if (typeof message.yScale !== 'number') return 'yScale: number expected'; if (message.mScale != null && message.hasOwnProperty('mScale')) - if (typeof message.mScale !== 'number') - return 'mScale: number expected'; + if (typeof message.mScale !== 'number') return 'mScale: number expected'; if (message.zScale != null && message.hasOwnProperty('zScale')) - if (typeof message.zScale !== 'number') - return 'zScale: number expected'; + if (typeof message.zScale !== 'number') return 'zScale: number expected'; return null; }; @@ -4834,8 +4360,7 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Scale} Scale */ Scale.fromObject = function fromObject(object) { - if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Scale) - return object; + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Scale) return object; var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Scale(); if (object.xScale != null) message.xScale = Number(object.xScale); if (object.yScale != null) message.yScale = Number(object.yScale); @@ -4864,24 +4389,16 @@ $root.esriPBuffer = (function () { } if (message.xScale != null && message.hasOwnProperty('xScale')) object.xScale = - options.json && !isFinite(message.xScale) - ? String(message.xScale) - : message.xScale; + options.json && !isFinite(message.xScale) ? String(message.xScale) : message.xScale; if (message.yScale != null && message.hasOwnProperty('yScale')) object.yScale = - options.json && !isFinite(message.yScale) - ? String(message.yScale) - : message.yScale; + options.json && !isFinite(message.yScale) ? String(message.yScale) : message.yScale; if (message.mScale != null && message.hasOwnProperty('mScale')) object.mScale = - options.json && !isFinite(message.mScale) - ? String(message.mScale) - : message.mScale; + options.json && !isFinite(message.mScale) ? String(message.mScale) : message.mScale; if (message.zScale != null && message.hasOwnProperty('zScale')) object.zScale = - options.json && !isFinite(message.zScale) - ? String(message.zScale) - : message.zScale; + options.json && !isFinite(message.zScale) ? String(message.zScale) : message.zScale; return object; }; @@ -4936,8 +4453,7 @@ $root.esriPBuffer = (function () { function Translate(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -4995,25 +4511,13 @@ $root.esriPBuffer = (function () { */ Translate.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.xTranslate != null && - Object.hasOwnProperty.call(message, 'xTranslate') - ) + if (message.xTranslate != null && Object.hasOwnProperty.call(message, 'xTranslate')) writer.uint32(/* id 1, wireType 1 =*/ 9).double(message.xTranslate); - if ( - message.yTranslate != null && - Object.hasOwnProperty.call(message, 'yTranslate') - ) + if (message.yTranslate != null && Object.hasOwnProperty.call(message, 'yTranslate')) writer.uint32(/* id 2, wireType 1 =*/ 17).double(message.yTranslate); - if ( - message.mTranslate != null && - Object.hasOwnProperty.call(message, 'mTranslate') - ) + if (message.mTranslate != null && Object.hasOwnProperty.call(message, 'mTranslate')) writer.uint32(/* id 3, wireType 1 =*/ 25).double(message.mTranslate); - if ( - message.zTranslate != null && - Object.hasOwnProperty.call(message, 'zTranslate') - ) + if (message.zTranslate != null && Object.hasOwnProperty.call(message, 'zTranslate')) writer.uint32(/* id 4, wireType 1 =*/ 33).double(message.zTranslate); return writer; }; @@ -5097,20 +4601,15 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Translate.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.xTranslate != null && message.hasOwnProperty('xTranslate')) - if (typeof message.xTranslate !== 'number') - return 'xTranslate: number expected'; + if (typeof message.xTranslate !== 'number') return 'xTranslate: number expected'; if (message.yTranslate != null && message.hasOwnProperty('yTranslate')) - if (typeof message.yTranslate !== 'number') - return 'yTranslate: number expected'; + if (typeof message.yTranslate !== 'number') return 'yTranslate: number expected'; if (message.mTranslate != null && message.hasOwnProperty('mTranslate')) - if (typeof message.mTranslate !== 'number') - return 'mTranslate: number expected'; + if (typeof message.mTranslate !== 'number') return 'mTranslate: number expected'; if (message.zTranslate != null && message.hasOwnProperty('zTranslate')) - if (typeof message.zTranslate !== 'number') - return 'zTranslate: number expected'; + if (typeof message.zTranslate !== 'number') return 'zTranslate: number expected'; return null; }; @@ -5123,20 +4622,12 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Translate} Translate */ Translate.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Translate - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.Translate(); - if (object.xTranslate != null) - message.xTranslate = Number(object.xTranslate); - if (object.yTranslate != null) - message.yTranslate = Number(object.yTranslate); - if (object.mTranslate != null) - message.mTranslate = Number(object.mTranslate); - if (object.zTranslate != null) - message.zTranslate = Number(object.zTranslate); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Translate) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Translate(); + if (object.xTranslate != null) message.xTranslate = Number(object.xTranslate); + if (object.yTranslate != null) message.yTranslate = Number(object.yTranslate); + if (object.mTranslate != null) message.mTranslate = Number(object.mTranslate); + if (object.zTranslate != null) message.zTranslate = Number(object.zTranslate); return message; }; @@ -5204,9 +4695,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Translate' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Translate'; }; return Translate; @@ -5233,8 +4722,7 @@ $root.esriPBuffer = (function () { function Transform(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -5288,21 +4776,13 @@ $root.esriPBuffer = (function () { message.quantizeOriginPostion != null && Object.hasOwnProperty.call(message, 'quantizeOriginPostion') ) - writer - .uint32(/* id 1, wireType 0 =*/ 8) - .int32(message.quantizeOriginPostion); - if ( - message.scale != null && - Object.hasOwnProperty.call(message, 'scale') - ) + writer.uint32(/* id 1, wireType 0 =*/ 8).int32(message.quantizeOriginPostion); + if (message.scale != null && Object.hasOwnProperty.call(message, 'scale')) $root.esriPBuffer.FeatureCollectionPBuffer.Scale.encode( message.scale, writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), ).ldelim(); - if ( - message.translate != null && - Object.hasOwnProperty.call(message, 'translate') - ) + if (message.translate != null && Object.hasOwnProperty.call(message, 'translate')) $root.esriPBuffer.FeatureCollectionPBuffer.Translate.encode( message.translate, writer.uint32(/* id 3, wireType 2 =*/ 26).fork(), @@ -5346,19 +4826,17 @@ $root.esriPBuffer = (function () { break; } case 2: { - message.scale = - $root.esriPBuffer.FeatureCollectionPBuffer.Scale.decode( - reader, - reader.uint32(), - ); + message.scale = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.decode( + reader, + reader.uint32(), + ); break; } case 3: { - message.translate = - $root.esriPBuffer.FeatureCollectionPBuffer.Translate.decode( - reader, - reader.uint32(), - ); + message.translate = $root.esriPBuffer.FeatureCollectionPBuffer.Translate.decode( + reader, + reader.uint32(), + ); break; } default: @@ -5393,8 +4871,7 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Transform.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if ( message.quantizeOriginPostion != null && message.hasOwnProperty('quantizeOriginPostion') @@ -5407,16 +4884,13 @@ $root.esriPBuffer = (function () { break; } if (message.scale != null && message.hasOwnProperty('scale')) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.verify( - message.scale, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.verify(message.scale); if (error) return 'scale.' + error; } if (message.translate != null && message.hasOwnProperty('translate')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Translate.verify( - message.translate, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Translate.verify( + message.translate, + ); if (error) return 'translate.' + error; } return null; @@ -5431,12 +4905,8 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.Transform} Transform */ Transform.fromObject = function fromObject(object) { - if ( - object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Transform - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.Transform(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.Transform) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.Transform(); switch (object.quantizeOriginPostion) { default: if (typeof object.quantizeOriginPostion === 'number') { @@ -5458,20 +4928,16 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Transform.scale: object expected', ); - message.scale = - $root.esriPBuffer.FeatureCollectionPBuffer.Scale.fromObject( - object.scale, - ); + message.scale = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.fromObject(object.scale); } if (object.translate != null) { if (typeof object.translate !== 'object') throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.Transform.translate: object expected', ); - message.translate = - $root.esriPBuffer.FeatureCollectionPBuffer.Translate.fromObject( - object.translate, - ); + message.translate = $root.esriPBuffer.FeatureCollectionPBuffer.Translate.fromObject( + object.translate, + ); } return message; }; @@ -5489,8 +4955,7 @@ $root.esriPBuffer = (function () { if (!options) options = {}; var object = {}; if (options.defaults) { - object.quantizeOriginPostion = - options.enums === String ? 'upperLeft' : 0; + object.quantizeOriginPostion = options.enums === String ? 'upperLeft' : 0; object.scale = null; object.translate = null; } @@ -5500,25 +4965,24 @@ $root.esriPBuffer = (function () { ) object.quantizeOriginPostion = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer - .QuantizeOriginPostion[message.quantizeOriginPostion] === - undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.QuantizeOriginPostion[ + message.quantizeOriginPostion + ] === undefined ? message.quantizeOriginPostion - : $root.esriPBuffer.FeatureCollectionPBuffer - .QuantizeOriginPostion[message.quantizeOriginPostion] + : $root.esriPBuffer.FeatureCollectionPBuffer.QuantizeOriginPostion[ + message.quantizeOriginPostion + ] : message.quantizeOriginPostion; if (message.scale != null && message.hasOwnProperty('scale')) - object.scale = - $root.esriPBuffer.FeatureCollectionPBuffer.Scale.toObject( - message.scale, - options, - ); + object.scale = $root.esriPBuffer.FeatureCollectionPBuffer.Scale.toObject( + message.scale, + options, + ); if (message.translate != null && message.hasOwnProperty('translate')) - object.translate = - $root.esriPBuffer.FeatureCollectionPBuffer.Translate.toObject( - message.translate, - options, - ); + object.translate = $root.esriPBuffer.FeatureCollectionPBuffer.Translate.toObject( + message.translate, + options, + ); return object; }; @@ -5545,9 +5009,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Transform' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.Transform'; }; return Transform; @@ -5591,8 +5053,7 @@ $root.esriPBuffer = (function () { this.geometryFields = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -5750,13 +5211,8 @@ $root.esriPBuffer = (function () { message.objectIdFieldName != null && Object.hasOwnProperty.call(message, 'objectIdFieldName') ) - writer - .uint32(/* id 1, wireType 2 =*/ 10) - .string(message.objectIdFieldName); - if ( - message.uniqueIdField != null && - Object.hasOwnProperty.call(message, 'uniqueIdField') - ) + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.objectIdFieldName); + if (message.uniqueIdField != null && Object.hasOwnProperty.call(message, 'uniqueIdField')) $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.encode( message.uniqueIdField, writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), @@ -5765,16 +5221,12 @@ $root.esriPBuffer = (function () { message.globalIdFieldName != null && Object.hasOwnProperty.call(message, 'globalIdFieldName') ) - writer - .uint32(/* id 3, wireType 2 =*/ 26) - .string(message.globalIdFieldName); + writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.globalIdFieldName); if ( message.geohashFieldName != null && Object.hasOwnProperty.call(message, 'geohashFieldName') ) - writer - .uint32(/* id 4, wireType 2 =*/ 34) - .string(message.geohashFieldName); + writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.geohashFieldName); if ( message.geometryProperties != null && Object.hasOwnProperty.call(message, 'geometryProperties') @@ -5783,18 +5235,12 @@ $root.esriPBuffer = (function () { message.geometryProperties, writer.uint32(/* id 5, wireType 2 =*/ 42).fork(), ).ldelim(); - if ( - message.serverGens != null && - Object.hasOwnProperty.call(message, 'serverGens') - ) + if (message.serverGens != null && Object.hasOwnProperty.call(message, 'serverGens')) $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.encode( message.serverGens, writer.uint32(/* id 6, wireType 2 =*/ 50).fork(), ).ldelim(); - if ( - message.geometryType != null && - Object.hasOwnProperty.call(message, 'geometryType') - ) + if (message.geometryType != null && Object.hasOwnProperty.call(message, 'geometryType')) writer.uint32(/* id 7, wireType 0 =*/ 56).int32(message.geometryType); if ( message.spatialReference != null && @@ -5808,17 +5254,12 @@ $root.esriPBuffer = (function () { message.exceededTransferLimit != null && Object.hasOwnProperty.call(message, 'exceededTransferLimit') ) - writer - .uint32(/* id 9, wireType 0 =*/ 72) - .bool(message.exceededTransferLimit); + writer.uint32(/* id 9, wireType 0 =*/ 72).bool(message.exceededTransferLimit); if (message.hasZ != null && Object.hasOwnProperty.call(message, 'hasZ')) writer.uint32(/* id 10, wireType 0 =*/ 80).bool(message.hasZ); if (message.hasM != null && Object.hasOwnProperty.call(message, 'hasM')) writer.uint32(/* id 11, wireType 0 =*/ 88).bool(message.hasM); - if ( - message.transform != null && - Object.hasOwnProperty.call(message, 'transform') - ) + if (message.transform != null && Object.hasOwnProperty.call(message, 'transform')) $root.esriPBuffer.FeatureCollectionPBuffer.Transform.encode( message.transform, writer.uint32(/* id 12, wireType 2 =*/ 98).fork(), @@ -5859,10 +5300,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureResult.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + FeatureResult.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -5880,8 +5318,7 @@ $root.esriPBuffer = (function () { FeatureResult.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -5914,11 +5351,10 @@ $root.esriPBuffer = (function () { break; } case 6: { - message.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.decode( - reader, - reader.uint32(), - ); + message.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.decode( + reader, + reader.uint32(), + ); break; } case 7: { @@ -5946,43 +5382,30 @@ $root.esriPBuffer = (function () { break; } case 12: { - message.transform = - $root.esriPBuffer.FeatureCollectionPBuffer.Transform.decode( - reader, - reader.uint32(), - ); + message.transform = $root.esriPBuffer.FeatureCollectionPBuffer.Transform.decode( + reader, + reader.uint32(), + ); break; } case 13: { - if (!(message.fields && message.fields.length)) - message.fields = []; + if (!(message.fields && message.fields.length)) message.fields = []; message.fields.push( - $root.esriPBuffer.FeatureCollectionPBuffer.Field.decode( - reader, - reader.uint32(), - ), + $root.esriPBuffer.FeatureCollectionPBuffer.Field.decode(reader, reader.uint32()), ); break; } case 14: { - if (!(message.values && message.values.length)) - message.values = []; + if (!(message.values && message.values.length)) message.values = []; message.values.push( - $root.esriPBuffer.FeatureCollectionPBuffer.Value.decode( - reader, - reader.uint32(), - ), + $root.esriPBuffer.FeatureCollectionPBuffer.Value.decode(reader, reader.uint32()), ); break; } case 15: { - if (!(message.features && message.features.length)) - message.features = []; + if (!(message.features && message.features.length)) message.features = []; message.features.push( - $root.esriPBuffer.FeatureCollectionPBuffer.Feature.decode( - reader, - reader.uint32(), - ), + $root.esriPBuffer.FeatureCollectionPBuffer.Feature.decode(reader, reader.uint32()), ); break; } @@ -6029,60 +5452,34 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ FeatureResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) if (!$util.isString(message.objectIdFieldName)) return 'objectIdFieldName: string expected'; - if ( - message.uniqueIdField != null && - message.hasOwnProperty('uniqueIdField') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.verify( - message.uniqueIdField, - ); + if (message.uniqueIdField != null && message.hasOwnProperty('uniqueIdField')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.verify( + message.uniqueIdField, + ); if (error) return 'uniqueIdField.' + error; } - if ( - message.globalIdFieldName != null && - message.hasOwnProperty('globalIdFieldName') - ) + if (message.globalIdFieldName != null && message.hasOwnProperty('globalIdFieldName')) if (!$util.isString(message.globalIdFieldName)) return 'globalIdFieldName: string expected'; - if ( - message.geohashFieldName != null && - message.hasOwnProperty('geohashFieldName') - ) - if (!$util.isString(message.geohashFieldName)) - return 'geohashFieldName: string expected'; - if ( - message.geometryProperties != null && - message.hasOwnProperty('geometryProperties') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties.verify( - message.geometryProperties, - ); + if (message.geohashFieldName != null && message.hasOwnProperty('geohashFieldName')) + if (!$util.isString(message.geohashFieldName)) return 'geohashFieldName: string expected'; + if (message.geometryProperties != null && message.hasOwnProperty('geometryProperties')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties.verify( + message.geometryProperties, + ); if (error) return 'geometryProperties.' + error; } - if ( - message.serverGens != null && - message.hasOwnProperty('serverGens') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( - message.serverGens, - ); + if (message.serverGens != null && message.hasOwnProperty('serverGens')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( + message.serverGens, + ); if (error) return 'serverGens.' + error; } - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + if (message.geometryType != null && message.hasOwnProperty('geometryType')) switch (message.geometryType) { default: return 'geometryType: enum value expected'; @@ -6095,14 +5492,10 @@ $root.esriPBuffer = (function () { case 5: break; } - if ( - message.spatialReference != null && - message.hasOwnProperty('spatialReference') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( - message.spatialReference, - ); + if (message.spatialReference != null && message.hasOwnProperty('spatialReference')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.verify( + message.spatialReference, + ); if (error) return 'spatialReference.' + error; } if ( @@ -6112,58 +5505,44 @@ $root.esriPBuffer = (function () { if (typeof message.exceededTransferLimit !== 'boolean') return 'exceededTransferLimit: boolean expected'; if (message.hasZ != null && message.hasOwnProperty('hasZ')) - if (typeof message.hasZ !== 'boolean') - return 'hasZ: boolean expected'; + if (typeof message.hasZ !== 'boolean') return 'hasZ: boolean expected'; if (message.hasM != null && message.hasOwnProperty('hasM')) - if (typeof message.hasM !== 'boolean') - return 'hasM: boolean expected'; + if (typeof message.hasM !== 'boolean') return 'hasM: boolean expected'; if (message.transform != null && message.hasOwnProperty('transform')) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Transform.verify( - message.transform, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Transform.verify( + message.transform, + ); if (error) return 'transform.' + error; } if (message.fields != null && message.hasOwnProperty('fields')) { if (!Array.isArray(message.fields)) return 'fields: array expected'; for (var i = 0; i < message.fields.length; ++i) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify( - message.fields[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Field.verify(message.fields[i]); if (error) return 'fields.' + error; } } if (message.values != null && message.hasOwnProperty('values')) { if (!Array.isArray(message.values)) return 'values: array expected'; for (var i = 0; i < message.values.length; ++i) { - var error = $root.esriPBuffer.FeatureCollectionPBuffer.Value.verify( - message.values[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Value.verify(message.values[i]); if (error) return 'values.' + error; } } if (message.features != null && message.hasOwnProperty('features')) { - if (!Array.isArray(message.features)) - return 'features: array expected'; + if (!Array.isArray(message.features)) return 'features: array expected'; for (var i = 0; i < message.features.length; ++i) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.Feature.verify( - message.features[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.Feature.verify( + message.features[i], + ); if (error) return 'features.' + error; } } - if ( - message.geometryFields != null && - message.hasOwnProperty('geometryFields') - ) { - if (!Array.isArray(message.geometryFields)) - return 'geometryFields: array expected'; + if (message.geometryFields != null && message.hasOwnProperty('geometryFields')) { + if (!Array.isArray(message.geometryFields)) return 'geometryFields: array expected'; for (var i = 0; i < message.geometryFields.length; ++i) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField.verify( - message.geometryFields[i], - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.GeometryField.verify( + message.geometryFields[i], + ); if (error) return 'geometryFields.' + error; } } @@ -6179,13 +5558,9 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.FeatureResult} FeatureResult */ FeatureResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult(); if (object.objectIdFieldName != null) message.objectIdFieldName = String(object.objectIdFieldName); if (object.uniqueIdField != null) { @@ -6217,10 +5592,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.serverGens: object expected', ); - message.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( - object.serverGens, - ); + message.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( + object.serverGens, + ); } switch (object.geometryType) { default: @@ -6277,10 +5651,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.transform: object expected', ); - message.transform = - $root.esriPBuffer.FeatureCollectionPBuffer.Transform.fromObject( - object.transform, - ); + message.transform = $root.esriPBuffer.FeatureCollectionPBuffer.Transform.fromObject( + object.transform, + ); } if (object.fields) { if (!Array.isArray(object.fields)) @@ -6293,10 +5666,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.fields: object expected', ); - message.fields[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject( - object.fields[i], - ); + message.fields[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Field.fromObject( + object.fields[i], + ); } } if (object.values) { @@ -6310,10 +5682,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.values: object expected', ); - message.values[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( - object.values[i], - ); + message.values[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.fromObject( + object.values[i], + ); } } if (object.features) { @@ -6327,10 +5698,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.features: object expected', ); - message.features[i] = - $root.esriPBuffer.FeatureCollectionPBuffer.Feature.fromObject( - object.features[i], - ); + message.features[i] = $root.esriPBuffer.FeatureCollectionPBuffer.Feature.fromObject( + object.features[i], + ); } } if (object.geometryFields) { @@ -6378,71 +5748,44 @@ $root.esriPBuffer = (function () { object.geohashFieldName = ''; object.geometryProperties = null; object.serverGens = null; - object.geometryType = - options.enums === String ? 'esriGeometryTypePoint' : 0; + object.geometryType = options.enums === String ? 'esriGeometryTypePoint' : 0; object.spatialReference = null; object.exceededTransferLimit = false; object.hasZ = false; object.hasM = false; object.transform = null; } - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) object.objectIdFieldName = message.objectIdFieldName; - if ( - message.uniqueIdField != null && - message.hasOwnProperty('uniqueIdField') - ) - object.uniqueIdField = - $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.toObject( - message.uniqueIdField, - options, - ); - if ( - message.globalIdFieldName != null && - message.hasOwnProperty('globalIdFieldName') - ) + if (message.uniqueIdField != null && message.hasOwnProperty('uniqueIdField')) + object.uniqueIdField = $root.esriPBuffer.FeatureCollectionPBuffer.UniqueIdField.toObject( + message.uniqueIdField, + options, + ); + if (message.globalIdFieldName != null && message.hasOwnProperty('globalIdFieldName')) object.globalIdFieldName = message.globalIdFieldName; - if ( - message.geohashFieldName != null && - message.hasOwnProperty('geohashFieldName') - ) + if (message.geohashFieldName != null && message.hasOwnProperty('geohashFieldName')) object.geohashFieldName = message.geohashFieldName; - if ( - message.geometryProperties != null && - message.hasOwnProperty('geometryProperties') - ) + if (message.geometryProperties != null && message.hasOwnProperty('geometryProperties')) object.geometryProperties = $root.esriPBuffer.FeatureCollectionPBuffer.GeometryProperties.toObject( message.geometryProperties, options, ); if (message.serverGens != null && message.hasOwnProperty('serverGens')) - object.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( - message.serverGens, - options, - ); - if ( - message.geometryType != null && - message.hasOwnProperty('geometryType') - ) + object.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( + message.serverGens, + options, + ); + if (message.geometryType != null && message.hasOwnProperty('geometryType')) object.geometryType = options.enums === String - ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] === undefined + ? $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] === + undefined ? message.geometryType - : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[ - message.geometryType - ] + : $root.esriPBuffer.FeatureCollectionPBuffer.GeometryType[message.geometryType] : message.geometryType; - if ( - message.spatialReference != null && - message.hasOwnProperty('spatialReference') - ) + if (message.spatialReference != null && message.hasOwnProperty('spatialReference')) object.spatialReference = $root.esriPBuffer.FeatureCollectionPBuffer.SpatialReference.toObject( message.spatialReference, @@ -6453,42 +5796,36 @@ $root.esriPBuffer = (function () { message.hasOwnProperty('exceededTransferLimit') ) object.exceededTransferLimit = message.exceededTransferLimit; - if (message.hasZ != null && message.hasOwnProperty('hasZ')) - object.hasZ = message.hasZ; - if (message.hasM != null && message.hasOwnProperty('hasM')) - object.hasM = message.hasM; + if (message.hasZ != null && message.hasOwnProperty('hasZ')) object.hasZ = message.hasZ; + if (message.hasM != null && message.hasOwnProperty('hasM')) object.hasM = message.hasM; if (message.transform != null && message.hasOwnProperty('transform')) - object.transform = - $root.esriPBuffer.FeatureCollectionPBuffer.Transform.toObject( - message.transform, - options, - ); + object.transform = $root.esriPBuffer.FeatureCollectionPBuffer.Transform.toObject( + message.transform, + options, + ); if (message.fields && message.fields.length) { object.fields = []; for (var j = 0; j < message.fields.length; ++j) - object.fields[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( - message.fields[j], - options, - ); + object.fields[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Field.toObject( + message.fields[j], + options, + ); } if (message.values && message.values.length) { object.values = []; for (var j = 0; j < message.values.length; ++j) - object.values[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( - message.values[j], - options, - ); + object.values[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Value.toObject( + message.values[j], + options, + ); } if (message.features && message.features.length) { object.features = []; for (var j = 0; j < message.features.length; ++j) - object.features[j] = - $root.esriPBuffer.FeatureCollectionPBuffer.Feature.toObject( - message.features[j], - options, - ); + object.features[j] = $root.esriPBuffer.FeatureCollectionPBuffer.Feature.toObject( + message.features[j], + options, + ); } if (message.geometryFields && message.geometryFields.length) { object.geometryFields = []; @@ -6525,9 +5862,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.FeatureResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.FeatureResult'; }; return FeatureResult; @@ -6552,8 +5887,7 @@ $root.esriPBuffer = (function () { function CountResult(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -6562,9 +5896,7 @@ $root.esriPBuffer = (function () { * @memberof esriPBuffer.FeatureCollectionPBuffer.CountResult * @instance */ - CountResult.prototype.count = $util.Long - ? $util.Long.fromBits(0, 0, true) - : 0; + CountResult.prototype.count = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; /** * Creates a new CountResult instance using the specified properties. @@ -6589,10 +5921,7 @@ $root.esriPBuffer = (function () { */ CountResult.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.count != null && - Object.hasOwnProperty.call(message, 'count') - ) + if (message.count != null && Object.hasOwnProperty.call(message, 'count')) writer.uint32(/* id 1, wireType 0 =*/ 8).uint64(message.count); return writer; }; @@ -6624,8 +5953,7 @@ $root.esriPBuffer = (function () { CountResult.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.CountResult(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.CountResult(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -6665,8 +5993,7 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CountResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; if (message.count != null && message.hasOwnProperty('count')) if ( !$util.isInteger(message.count) && @@ -6689,21 +6016,12 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.CountResult} CountResult */ CountResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.CountResult(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.CountResult) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.CountResult(); if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = - true; - else if (typeof object.count === 'string') - message.count = parseInt(object.count, 10); - else if (typeof object.count === 'number') - message.count = object.count; + if ($util.Long) (message.count = $util.Long.fromValue(object.count)).unsigned = true; + else if (typeof object.count === 'string') message.count = parseInt(object.count, 10); + else if (typeof object.count === 'number') message.count = object.count; else if (typeof object.count === 'object') message.count = new $util.LongBits( object.count.low >>> 0, @@ -6736,17 +6054,15 @@ $root.esriPBuffer = (function () { } else object.count = options.longs === String ? '0' : 0; if (message.count != null && message.hasOwnProperty('count')) if (typeof message.count === 'number') - object.count = - options.longs === String ? String(message.count) : message.count; + object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number - ? new $util.LongBits( - message.count.low >>> 0, - message.count.high >>> 0, - ).toNumber(true) + ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber( + true, + ) : message.count; return object; }; @@ -6774,9 +6090,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.CountResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.CountResult'; }; return CountResult; @@ -6804,8 +6118,7 @@ $root.esriPBuffer = (function () { this.objectIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -6859,21 +6172,15 @@ $root.esriPBuffer = (function () { message.objectIdFieldName != null && Object.hasOwnProperty.call(message, 'objectIdFieldName') ) - writer - .uint32(/* id 1, wireType 2 =*/ 10) - .string(message.objectIdFieldName); - if ( - message.serverGens != null && - Object.hasOwnProperty.call(message, 'serverGens') - ) + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.objectIdFieldName); + if (message.serverGens != null && Object.hasOwnProperty.call(message, 'serverGens')) $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.encode( message.serverGens, writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), ).ldelim(); if (message.objectIds != null && message.objectIds.length) { writer.uint32(/* id 3, wireType 2 =*/ 26).fork(); - for (var i = 0; i < message.objectIds.length; ++i) - writer.uint64(message.objectIds[i]); + for (var i = 0; i < message.objectIds.length; ++i) writer.uint64(message.objectIds[i]); writer.ldelim(); } return writer; @@ -6888,10 +6195,7 @@ $root.esriPBuffer = (function () { * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ObjectIdsResult.encodeDelimited = function encodeDelimited( - message, - writer, - ) { + ObjectIdsResult.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -6909,8 +6213,7 @@ $root.esriPBuffer = (function () { ObjectIdsResult.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -6919,20 +6222,17 @@ $root.esriPBuffer = (function () { break; } case 2: { - message.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.decode( - reader, - reader.uint32(), - ); + message.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.decode( + reader, + reader.uint32(), + ); break; } case 3: { - if (!(message.objectIds && message.objectIds.length)) - message.objectIds = []; + if (!(message.objectIds && message.objectIds.length)) message.objectIds = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.objectIds.push(reader.uint64()); + while (reader.pos < end2) message.objectIds.push(reader.uint64()); } else message.objectIds.push(reader.uint64()); break; } @@ -6968,27 +6268,18 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ObjectIdsResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (typeof message !== 'object' || message === null) return 'object expected'; + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) if (!$util.isString(message.objectIdFieldName)) return 'objectIdFieldName: string expected'; - if ( - message.serverGens != null && - message.hasOwnProperty('serverGens') - ) { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( - message.serverGens, - ); + if (message.serverGens != null && message.hasOwnProperty('serverGens')) { + var error = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.verify( + message.serverGens, + ); if (error) return 'serverGens.' + error; } if (message.objectIds != null && message.hasOwnProperty('objectIds')) { - if (!Array.isArray(message.objectIds)) - return 'objectIds: array expected'; + if (!Array.isArray(message.objectIds)) return 'objectIds: array expected'; for (var i = 0; i < message.objectIds.length; ++i) if ( !$util.isInteger(message.objectIds[i]) && @@ -7012,13 +6303,9 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult} ObjectIdsResult */ ObjectIdsResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult - ) + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult) return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult(); + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult(); if (object.objectIdFieldName != null) message.objectIdFieldName = String(object.objectIdFieldName); if (object.serverGens != null) { @@ -7026,10 +6313,9 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.serverGens: object expected', ); - message.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( - object.serverGens, - ); + message.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.fromObject( + object.serverGens, + ); } if (object.objectIds) { if (!Array.isArray(object.objectIds)) @@ -7039,9 +6325,7 @@ $root.esriPBuffer = (function () { message.objectIds = []; for (var i = 0; i < object.objectIds.length; ++i) if ($util.Long) - (message.objectIds[i] = $util.Long.fromValue( - object.objectIds[i], - )).unsigned = true; + (message.objectIds[i] = $util.Long.fromValue(object.objectIds[i])).unsigned = true; else if (typeof object.objectIds[i] === 'string') message.objectIds[i] = parseInt(object.objectIds[i], 10); else if (typeof object.objectIds[i] === 'number') @@ -7072,25 +6356,19 @@ $root.esriPBuffer = (function () { object.objectIdFieldName = ''; object.serverGens = null; } - if ( - message.objectIdFieldName != null && - message.hasOwnProperty('objectIdFieldName') - ) + if (message.objectIdFieldName != null && message.hasOwnProperty('objectIdFieldName')) object.objectIdFieldName = message.objectIdFieldName; if (message.serverGens != null && message.hasOwnProperty('serverGens')) - object.serverGens = - $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( - message.serverGens, - options, - ); + object.serverGens = $root.esriPBuffer.FeatureCollectionPBuffer.ServerGens.toObject( + message.serverGens, + options, + ); if (message.objectIds && message.objectIds.length) { object.objectIds = []; for (var j = 0; j < message.objectIds.length; ++j) if (typeof message.objectIds[j] === 'number') object.objectIds[j] = - options.longs === String - ? String(message.objectIds[j]) - : message.objectIds[j]; + options.longs === String ? String(message.objectIds[j]) : message.objectIds[j]; else object.objectIds[j] = options.longs === String @@ -7128,10 +6406,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + - '/esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult'; }; return ObjectIdsResult; @@ -7158,8 +6433,7 @@ $root.esriPBuffer = (function () { function QueryResult(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** @@ -7196,9 +6470,7 @@ $root.esriPBuffer = (function () { * @instance */ Object.defineProperty(QueryResult.prototype, 'Results', { - get: $util.oneOfGetter( - ($oneOfFields = ['featureResult', 'countResult', 'idsResult']), - ), + get: $util.oneOfGetter(($oneOfFields = ['featureResult', 'countResult', 'idsResult'])), set: $util.oneOfSetter($oneOfFields), }); @@ -7225,26 +6497,17 @@ $root.esriPBuffer = (function () { */ QueryResult.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if ( - message.featureResult != null && - Object.hasOwnProperty.call(message, 'featureResult') - ) + if (message.featureResult != null && Object.hasOwnProperty.call(message, 'featureResult')) $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.encode( message.featureResult, writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), ).ldelim(); - if ( - message.countResult != null && - Object.hasOwnProperty.call(message, 'countResult') - ) + if (message.countResult != null && Object.hasOwnProperty.call(message, 'countResult')) $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.encode( message.countResult, writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), ).ldelim(); - if ( - message.idsResult != null && - Object.hasOwnProperty.call(message, 'idsResult') - ) + if (message.idsResult != null && Object.hasOwnProperty.call(message, 'idsResult')) $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.encode( message.idsResult, writer.uint32(/* id 3, wireType 2 =*/ 26).fork(), @@ -7279,8 +6542,7 @@ $root.esriPBuffer = (function () { QueryResult.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, - message = - new $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult(); + message = new $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -7293,19 +6555,17 @@ $root.esriPBuffer = (function () { break; } case 2: { - message.countResult = - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.decode( - reader, - reader.uint32(), - ); + message.countResult = $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.decode( + reader, + reader.uint32(), + ); break; } case 3: { - message.idsResult = - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.decode( - reader, - reader.uint32(), - ); + message.idsResult = $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.decode( + reader, + reader.uint32(), + ); break; } default: @@ -7340,33 +6600,24 @@ $root.esriPBuffer = (function () { * @returns {string|null} `null` if valid, otherwise the reason why it is not */ QueryResult.verify = function verify(message) { - if (typeof message !== 'object' || message === null) - return 'object expected'; + if (typeof message !== 'object' || message === null) return 'object expected'; var properties = {}; - if ( - message.featureResult != null && - message.hasOwnProperty('featureResult') - ) { + if (message.featureResult != null && message.hasOwnProperty('featureResult')) { properties.Results = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.verify( - message.featureResult, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.verify( + message.featureResult, + ); if (error) return 'featureResult.' + error; } } - if ( - message.countResult != null && - message.hasOwnProperty('countResult') - ) { + if (message.countResult != null && message.hasOwnProperty('countResult')) { if (properties.Results === 1) return 'Results: multiple values'; properties.Results = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.verify( - message.countResult, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.verify( + message.countResult, + ); if (error) return 'countResult.' + error; } } @@ -7374,10 +6625,9 @@ $root.esriPBuffer = (function () { if (properties.Results === 1) return 'Results: multiple values'; properties.Results = 1; { - var error = - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.verify( - message.idsResult, - ); + var error = $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.verify( + message.idsResult, + ); if (error) return 'idsResult.' + error; } } @@ -7393,13 +6643,8 @@ $root.esriPBuffer = (function () { * @returns {esriPBuffer.FeatureCollectionPBuffer.QueryResult} QueryResult */ QueryResult.fromObject = function fromObject(object) { - if ( - object instanceof - $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult - ) - return object; - var message = - new $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult(); + if (object instanceof $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult) return object; + var message = new $root.esriPBuffer.FeatureCollectionPBuffer.QueryResult(); if (object.featureResult != null) { if (typeof object.featureResult !== 'object') throw TypeError( @@ -7415,20 +6660,18 @@ $root.esriPBuffer = (function () { throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.QueryResult.countResult: object expected', ); - message.countResult = - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.fromObject( - object.countResult, - ); + message.countResult = $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.fromObject( + object.countResult, + ); } if (object.idsResult != null) { if (typeof object.idsResult !== 'object') throw TypeError( '.esriPBuffer.FeatureCollectionPBuffer.QueryResult.idsResult: object expected', ); - message.idsResult = - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.fromObject( - object.idsResult, - ); + message.idsResult = $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.fromObject( + object.idsResult, + ); } return message; }; @@ -7445,34 +6688,25 @@ $root.esriPBuffer = (function () { QueryResult.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if ( - message.featureResult != null && - message.hasOwnProperty('featureResult') - ) { - object.featureResult = - $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.toObject( - message.featureResult, - options, - ); + if (message.featureResult != null && message.hasOwnProperty('featureResult')) { + object.featureResult = $root.esriPBuffer.FeatureCollectionPBuffer.FeatureResult.toObject( + message.featureResult, + options, + ); if (options.oneofs) object.Results = 'featureResult'; } - if ( - message.countResult != null && - message.hasOwnProperty('countResult') - ) { - object.countResult = - $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.toObject( - message.countResult, - options, - ); + if (message.countResult != null && message.hasOwnProperty('countResult')) { + object.countResult = $root.esriPBuffer.FeatureCollectionPBuffer.CountResult.toObject( + message.countResult, + options, + ); if (options.oneofs) object.Results = 'countResult'; } if (message.idsResult != null && message.hasOwnProperty('idsResult')) { - object.idsResult = - $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.toObject( - message.idsResult, - options, - ); + object.idsResult = $root.esriPBuffer.FeatureCollectionPBuffer.ObjectIdsResult.toObject( + message.idsResult, + options, + ); if (options.oneofs) object.Results = 'idsResult'; } return object; @@ -7501,9 +6735,7 @@ $root.esriPBuffer = (function () { if (typeUrlPrefix === undefined) { typeUrlPrefix = 'type.googleapis.com'; } - return ( - typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.QueryResult' - ); + return typeUrlPrefix + '/esriPBuffer.FeatureCollectionPBuffer.QueryResult'; }; return QueryResult; diff --git a/test/output-pull-invocations.spec.js b/test/output-pull-invocations.spec.js index 9e018770..edd021de 100644 --- a/test/output-pull-invocations.spec.js +++ b/test/output-pull-invocations.spec.js @@ -18,9 +18,7 @@ describe('test output using model.pull with callback arg', () => { test('should return data', async () => { try { - const response = await request(koop.server).get( - '/async-no-callback/output-path', - ); + const response = await request(koop.server).get('/async-no-callback/output-path'); expect(response.status).toBe(200); expect(response.body).toEqual({ features: [