diff --git a/src/lib/maps/Maps.ts b/src/lib/maps/Client.ts similarity index 92% rename from src/lib/maps/Maps.ts rename to src/lib/maps/Client.ts index f7be7434..63e11ec4 100644 --- a/src/lib/maps/Maps.ts +++ b/src/lib/maps/Client.ts @@ -6,7 +6,7 @@ const REQUEST_GET_MAX_URL_LENGTH = 2048; const VECTOR_EXTENT = 2048; const VECTOR_SIMPLIFY_EXTENT = 2048; -export class Maps { +export class Client { private _credentials: Credentials; constructor(credentials: Credentials) { @@ -41,10 +41,8 @@ export class Maps { type: 'mapnik', options: { sql: sql || `select * from ${dataset}`, - /* eslint-disable @typescript-eslint/camelcase */ vector_extent: vectorExtent, vector_simplify_extent: vectorSimplifyExtent, - /* eslint-enable @typescript-eslint/camelcase */ metadata, aggregation } @@ -80,11 +78,7 @@ export class Maps { * @param layergroup * @param options */ - public async aggregationDataview( - layergroup: any, - dataview: string, - categories?: number - ) { + public async aggregationDataview(layergroup: any, dataview: string, categories?: number) { const { metadata: { dataviews: { @@ -96,10 +90,7 @@ export class Maps { const parameters = [encodeParameter('api_key', this._credentials.apiKey)]; if (categories) { - const encodedCategories = encodeParameter( - 'categories', - categories.toString() - ); + const encodedCategories = encodeParameter('categories', categories.toString()); parameters.push(encodedCategories); } @@ -167,7 +158,9 @@ export class Maps { } export interface AggregationColumn { + // eslint-disable-next-line camelcase aggregate_function: string; + // eslint-disable-next-line camelcase aggregated_column: string; } @@ -177,7 +170,9 @@ export interface StatsColumn { } export interface Sample { + // eslint-disable-next-line camelcase num_rows: number; + // eslint-disable-next-line camelcase include_columns: string[]; } @@ -210,6 +205,7 @@ interface BufferSizeOptions { export interface MapInstance { layergroupid: string; + // eslint-disable-next-line camelcase last_updated: string; metadata: { layers: [ @@ -250,6 +246,7 @@ export interface MapInstance { subdomains: string[]; }; }; + // eslint-disable-next-line camelcase cdn_url: { http: string; https: string; diff --git a/src/lib/maps/MapsDataviews.ts b/src/lib/maps/MapsDataviews.ts index 68963142..82eb3611 100644 --- a/src/lib/maps/MapsDataviews.ts +++ b/src/lib/maps/MapsDataviews.ts @@ -1,18 +1,16 @@ import { Credentials } from '../core/Credentials'; -import { Maps } from './Maps'; +import { Client } from './Client'; export class MapsDataviews { private _source: string; - private _mapClient: Maps; + private _mapClient: Client; constructor(source: string, credentials: Credentials) { this._source = source; - this._mapClient = new Maps(credentials); + this._mapClient = new Client(credentials); } - public async aggregation( - params: AggregationParameters - ): Promise { + public async aggregation(params: AggregationParameters): Promise { const { column, aggregation, operationColumn, limit } = params; const dataviewName = `${this._source}_${Date.now()}`; @@ -38,7 +36,7 @@ export class MapsDataviews { aggregation: AggregationType, operationColumn?: string ) { - const sourceMapConfig = Maps.generateMapConfigFromSource(this._source); + const sourceMapConfig = Client.generateMapConfigFromSource(this._source); const sourceId = sourceMapConfig.analyses[0].id; const mapConfig = { ...sourceMapConfig, @@ -70,6 +68,7 @@ export interface AggregationResponse { aggregation: AggregationType; categoriesCount: number; categories: AggregationCategory[]; + // eslint-disable-next-line camelcase errors_with_context?: { type: string; message: string }[]; errors?: string[]; } diff --git a/src/lib/maps/__tests__/Client.spec.ts b/src/lib/maps/__tests__/Client.spec.ts index 3159d0ce..b6a6d610 100644 --- a/src/lib/maps/__tests__/Client.spec.ts +++ b/src/lib/maps/__tests__/Client.spec.ts @@ -1,5 +1,5 @@ -import { Credentials } from '@carto/toolkit-core'; -import { MapOptions, Maps as Client } from '../src/Client'; +import { Credentials } from '../../core/Credentials'; +import { MapOptions, Client } from '../Client'; describe('maps', () => { it('can be easily created', () => {