@carto/api-client 0.4.1-alpha.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## Not released
4
+
3
5
  ## 0.4
4
6
 
7
+ ### 0.4.1
8
+
9
+ - add cache control mechanism for sources and query APIs
10
+
5
11
  ### 0.4.0
6
12
 
7
13
  - feat: Add Picking Model API
@@ -1,3 +1,3 @@
1
1
  import type { SourceOptions, QuerySourceOptions, QueryResult } from '../sources/types';
2
- export type QueryOptions = SourceOptions & QuerySourceOptions;
2
+ export type QueryOptions = SourceOptions & Omit<QuerySourceOptions, 'spatialDataColumn'>;
3
3
  export declare const query: (options: QueryOptions) => Promise<QueryResult>;
@@ -1,8 +1,10 @@
1
1
  import { APIErrorContext } from './carto-api-error';
2
- export declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, }: {
2
+ import { LocalCacheOptions } from '../sources/types';
3
+ export declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, localCache, }: {
3
4
  baseUrl: string;
4
5
  parameters?: Record<string, unknown>;
5
6
  headers?: Record<string, string>;
6
7
  errorContext: APIErrorContext;
7
8
  maxLengthURL?: number;
9
+ localCache?: LocalCacheOptions;
8
10
  }): Promise<T>;
@@ -509,43 +509,41 @@ function executeModel(props) {
509
509
  data,
510
510
  filters,
511
511
  filtersLogicalOperator = 'and',
512
- spatialDataType = 'geo',
513
- spatialFiltersMode = 'intersects',
514
- spatialFiltersResolution = 0
512
+ geoColumn = DEFAULT_GEO_COLUMN
515
513
  } = source;
514
+ const queryParameters = source.queryParameters ? JSON.stringify(source.queryParameters) : '';
516
515
  const queryParams = {
517
516
  type,
518
517
  client: clientId,
519
518
  source: data,
520
- params,
521
- queryParameters: source.queryParameters || '',
522
- filters,
519
+ params: JSON.stringify(params),
520
+ queryParameters,
521
+ filters: JSON.stringify(filters),
523
522
  filtersLogicalOperator
524
523
  };
525
- const spatialDataColumn = source.spatialDataColumn || DEFAULT_GEO_COLUMN;
526
524
  // Picking Model API requires 'spatialDataColumn'.
527
525
  if (model === 'pick') {
528
- queryParams.spatialDataColumn = spatialDataColumn;
526
+ queryParams.spatialDataColumn = geoColumn;
529
527
  }
530
- // API supports multiple filters, we apply it only to spatialDataColumn
528
+ // API supports multiple filters, we apply it only to geoColumn
531
529
  const spatialFilters = source.spatialFilter ? {
532
- [spatialDataColumn]: source.spatialFilter
530
+ [geoColumn]: source.spatialFilter
533
531
  } : undefined;
534
532
  if (spatialFilters) {
535
- queryParams.spatialFilters = spatialFilters; // JSON.stringify(spatialFilters);
536
- queryParams.spatialDataColumn = spatialDataColumn;
537
- queryParams.spatialDataType = spatialDataType;
538
- }
539
- if (spatialDataType !== 'geo') {
540
- if (spatialFiltersResolution > 0) {
541
- queryParams.spatialFiltersResolution = spatialFiltersResolution;
542
- }
543
- queryParams.spatialFiltersMode = spatialFiltersMode;
533
+ queryParams.spatialFilters = JSON.stringify(spatialFilters);
544
534
  }
545
- const urlWithSearchParams = url + '?' + objectToURLSearchParams(queryParams).toString();
535
+ const urlWithSearchParams = url + '?' + new URLSearchParams(queryParams).toString();
546
536
  const isGet = urlWithSearchParams.length <= REQUEST_GET_MAX_URL_LENGTH;
547
537
  if (isGet) {
548
538
  url = urlWithSearchParams;
539
+ } else {
540
+ // undo the JSON.stringify, @TODO find a better pattern
541
+ queryParams.params = params;
542
+ queryParams.filters = filters;
543
+ queryParams.queryParameters = source.queryParameters;
544
+ if (spatialFilters) {
545
+ queryParams.spatialFilters = spatialFilters;
546
+ }
549
547
  }
550
548
  return makeCall({
551
549
  url,
@@ -559,68 +557,6 @@ function executeModel(props) {
559
557
  }
560
558
  });
561
559
  }
562
- function objectToURLSearchParams(object) {
563
- const params = new URLSearchParams();
564
- for (const key in object) {
565
- if (isPureObject(object[key])) {
566
- params.append(key, JSON.stringify(object[key]));
567
- } else if (Array.isArray(object[key])) {
568
- params.append(key, JSON.stringify(object[key]));
569
- } else if (object[key] === null) {
570
- params.append(key, 'null');
571
- } else if (object[key] !== undefined) {
572
- params.append(key, String(object[key]));
573
- }
574
- }
575
- return params;
576
- }
577
-
578
- const DEFAULT_TILE_SIZE = 512;
579
- const QUADBIN_ZOOM_MAX_OFFSET = 4;
580
- function getSpatialFiltersResolution(_ref) {
581
- let {
582
- source,
583
- viewState
584
- } = _ref;
585
- assert(viewState, 'viewState prop is required to compute automatic spatialFiltersResolution when using spatialFilter with spatial indexes. Either pass a `spatialFiltersResolution` prop or a `viewState` prop to avoid this error');
586
- const dataResolution = source.dataResolution ?? Number.MAX_VALUE;
587
- const aggregationResLevel = source.aggregationResLevel ?? (source.spatialDataType === 'h3' ? DEFAULT_AGGREGATION_RES_LEVEL_H3 : DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN);
588
- const aggregationResLevelOffset = Math.max(0, Math.floor(aggregationResLevel));
589
- const currentZoomInt = Math.ceil(viewState.zoom);
590
- if (source.spatialDataType === 'h3') {
591
- const tileSize = DEFAULT_TILE_SIZE;
592
- const maxResolutionForZoom = maxH3SpatialFiltersResolutions.find(_ref2 => {
593
- let [zoom] = _ref2;
594
- return zoom === currentZoomInt;
595
- })?.[1] ?? Math.max(0, currentZoomInt - 3);
596
- const maxSpatialFiltersResolution = maxResolutionForZoom ? Math.min(dataResolution, maxResolutionForZoom) : dataResolution;
597
- const hexagonResolution = getHexagonResolution(viewState, tileSize) + aggregationResLevelOffset;
598
- return Math.min(hexagonResolution, maxSpatialFiltersResolution);
599
- }
600
- if (source.spatialDataType === 'quadbin') {
601
- const maxResolutionForZoom = currentZoomInt + QUADBIN_ZOOM_MAX_OFFSET;
602
- const maxSpatialFiltersResolution = Math.min(dataResolution, maxResolutionForZoom);
603
- const quadsResolution = Math.floor(viewState.zoom) + aggregationResLevelOffset;
604
- return Math.min(quadsResolution, maxSpatialFiltersResolution);
605
- }
606
- return undefined;
607
- }
608
- const maxH3SpatialFiltersResolutions = [[20, 14], [19, 13], [18, 12], [17, 11], [16, 10], [15, 9], [14, 8], [13, 7], [12, 7], [11, 7], [10, 6], [9, 6], [8, 5], [7, 4], [6, 4], [5, 3], [4, 2], [3, 1], [2, 1], [1, 0]];
609
- // stolen from https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/h3-tileset-2d.ts
610
- // Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
611
- const BIAS = 2;
612
- // Resolution conversion function. Takes a WebMercatorViewport and returns
613
- // a H3 resolution such that the screen space size of the hexagons is
614
- // similar
615
- function getHexagonResolution(viewport, tileSize) {
616
- // Difference in given tile size compared to deck's internal 512px tile size,
617
- // expressed as an offset to the viewport zoom.
618
- const zoomOffset = Math.log2(tileSize / DEFAULT_TILE_SIZE);
619
- const hexagonScaleFactor = 2 / 3 * (viewport.zoom - zoomOffset);
620
- const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
621
- // Clip and bias
622
- return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
623
- }
624
560
 
625
561
  /**
626
562
  * Source for Widget API requests on a data source defined by a SQL query.
@@ -645,8 +581,7 @@ class WidgetBaseSource {
645
581
  connectionName: props.connectionName,
646
582
  filters: getApplicableFilters(owner, props.filters),
647
583
  filtersLogicalOperator: props.filtersLogicalOperator,
648
- spatialDataType: props.spatialDataType,
649
- spatialDataColumn: props.spatialDataColumn
584
+ geoColumn: props.geoColumn
650
585
  };
651
586
  }
652
587
  /****************************************************************************
@@ -662,9 +597,7 @@ class WidgetBaseSource {
662
597
  const {
663
598
  filterOwner,
664
599
  spatialFilter,
665
- spatialFiltersMode,
666
600
  abortController,
667
- viewState,
668
601
  ...params
669
602
  } = options;
670
603
  const {
@@ -672,20 +605,10 @@ class WidgetBaseSource {
672
605
  operation,
673
606
  operationColumn
674
607
  } = params;
675
- const source = _this.getModelSource(filterOwner);
676
- let spatialFiltersResolution;
677
- if (spatialFilter && source.spatialDataType !== 'geo') {
678
- spatialFiltersResolution = getSpatialFiltersResolution({
679
- source,
680
- viewState
681
- });
682
- }
683
608
  return Promise.resolve(executeModel({
684
609
  model: 'category',
685
610
  source: {
686
- ...source,
687
- spatialFiltersResolution,
688
- spatialFiltersMode,
611
+ ..._this.getModelSource(filterOwner),
689
612
  spatialFilter
690
613
  },
691
614
  params: {
@@ -718,9 +641,7 @@ class WidgetBaseSource {
718
641
  const {
719
642
  filterOwner,
720
643
  spatialFilter,
721
- spatialFiltersMode,
722
644
  abortController,
723
- viewState,
724
645
  ...params
725
646
  } = options;
726
647
  const {
@@ -731,20 +652,10 @@ class WidgetBaseSource {
731
652
  limit,
732
653
  tileResolution
733
654
  } = params;
734
- const source = _this2.getModelSource(filterOwner);
735
- let spatialFiltersResolution;
736
- if (spatialFilter && source.spatialDataType !== 'geo') {
737
- spatialFiltersResolution = getSpatialFiltersResolution({
738
- source,
739
- viewState
740
- });
741
- }
742
655
  return Promise.resolve(executeModel({
743
656
  model: 'pick',
744
657
  source: {
745
- ...source,
746
- spatialFiltersResolution,
747
- spatialFiltersMode,
658
+ ..._this2.getModelSource(filterOwner),
748
659
  spatialFilter
749
660
  },
750
661
  params: {
@@ -778,30 +689,18 @@ class WidgetBaseSource {
778
689
  const {
779
690
  filterOwner,
780
691
  spatialFilter,
781
- spatialFiltersMode,
782
692
  abortController,
783
693
  operationExp,
784
- viewState,
785
694
  ...params
786
695
  } = options;
787
696
  const {
788
697
  column,
789
698
  operation
790
699
  } = params;
791
- const source = _this3.getModelSource(filterOwner);
792
- let spatialFiltersResolution;
793
- if (spatialFilter && source.spatialDataType !== 'geo') {
794
- spatialFiltersResolution = getSpatialFiltersResolution({
795
- source,
796
- viewState
797
- });
798
- }
799
700
  return Promise.resolve(executeModel({
800
701
  model: 'formula',
801
702
  source: {
802
- ...source,
803
- spatialFiltersResolution,
804
- spatialFiltersMode,
703
+ ..._this3.getModelSource(filterOwner),
805
704
  spatialFilter
806
705
  },
807
706
  params: {
@@ -830,9 +729,7 @@ class WidgetBaseSource {
830
729
  const {
831
730
  filterOwner,
832
731
  spatialFilter,
833
- spatialFiltersMode,
834
732
  abortController,
835
- viewState,
836
733
  ...params
837
734
  } = options;
838
735
  const {
@@ -840,20 +737,10 @@ class WidgetBaseSource {
840
737
  operation,
841
738
  ticks
842
739
  } = params;
843
- const source = _this4.getModelSource(filterOwner);
844
- let spatialFiltersResolution;
845
- if (spatialFilter && source.spatialDataType !== 'geo') {
846
- spatialFiltersResolution = getSpatialFiltersResolution({
847
- source,
848
- viewState
849
- });
850
- }
851
740
  return Promise.resolve(executeModel({
852
741
  model: 'histogram',
853
742
  source: {
854
- ...source,
855
- spatialFiltersResolution,
856
- spatialFiltersMode,
743
+ ..._this4.getModelSource(filterOwner),
857
744
  spatialFilter
858
745
  },
859
746
  params: {
@@ -898,28 +785,16 @@ class WidgetBaseSource {
898
785
  const {
899
786
  filterOwner,
900
787
  spatialFilter,
901
- spatialFiltersMode,
902
788
  abortController,
903
- viewState,
904
789
  ...params
905
790
  } = options;
906
791
  const {
907
792
  column
908
793
  } = params;
909
- const source = _this5.getModelSource(filterOwner);
910
- let spatialFiltersResolution;
911
- if (spatialFilter && source.spatialDataType !== 'geo') {
912
- spatialFiltersResolution = getSpatialFiltersResolution({
913
- source,
914
- viewState
915
- });
916
- }
917
794
  return Promise.resolve(executeModel({
918
795
  model: 'range',
919
796
  source: {
920
- ...source,
921
- spatialFiltersResolution,
922
- spatialFiltersMode,
797
+ ..._this5.getModelSource(filterOwner),
923
798
  spatialFilter
924
799
  },
925
800
  params: {
@@ -946,9 +821,7 @@ class WidgetBaseSource {
946
821
  const {
947
822
  filterOwner,
948
823
  spatialFilter,
949
- spatialFiltersMode,
950
824
  abortController,
951
- viewState,
952
825
  ...params
953
826
  } = options;
954
827
  const {
@@ -957,22 +830,12 @@ class WidgetBaseSource {
957
830
  yAxisColumn,
958
831
  yAxisJoinOperation
959
832
  } = params;
960
- const source = _this6.getModelSource(filterOwner);
961
- let spatialFiltersResolution;
962
- if (spatialFilter && source.spatialDataType !== 'geo') {
963
- spatialFiltersResolution = getSpatialFiltersResolution({
964
- source,
965
- viewState
966
- });
967
- }
968
833
  // Make sure this is sync with the same constant in cloud-native/maps-api
969
834
  const HARD_LIMIT = 500;
970
835
  return Promise.resolve(executeModel({
971
836
  model: 'scatterplot',
972
837
  source: {
973
- ...source,
974
- spatialFiltersResolution,
975
- spatialFiltersMode,
838
+ ..._this6.getModelSource(filterOwner),
976
839
  spatialFilter
977
840
  },
978
841
  params: {
@@ -1009,9 +872,7 @@ class WidgetBaseSource {
1009
872
  const {
1010
873
  filterOwner,
1011
874
  spatialFilter,
1012
- spatialFiltersMode,
1013
875
  abortController,
1014
- viewState,
1015
876
  ...params
1016
877
  } = options;
1017
878
  const {
@@ -1021,20 +882,10 @@ class WidgetBaseSource {
1021
882
  offset = 0,
1022
883
  limit = 10
1023
884
  } = params;
1024
- const source = _this7.getModelSource(filterOwner);
1025
- let spatialFiltersResolution;
1026
- if (spatialFilter && source.spatialDataType !== 'geo') {
1027
- spatialFiltersResolution = getSpatialFiltersResolution({
1028
- source,
1029
- viewState
1030
- });
1031
- }
1032
885
  return Promise.resolve(executeModel({
1033
886
  model: 'table',
1034
887
  source: {
1035
- ...source,
1036
- spatialFiltersResolution,
1037
- spatialFiltersMode,
888
+ ..._this7.getModelSource(filterOwner),
1038
889
  spatialFilter
1039
890
  },
1040
891
  params: {
@@ -1070,8 +921,6 @@ class WidgetBaseSource {
1070
921
  filterOwner,
1071
922
  abortController,
1072
923
  spatialFilter,
1073
- spatialFiltersMode,
1074
- viewState,
1075
924
  ...params
1076
925
  } = options;
1077
926
  const {
@@ -1085,20 +934,10 @@ class WidgetBaseSource {
1085
934
  splitByCategoryLimit,
1086
935
  splitByCategoryValues
1087
936
  } = params;
1088
- const source = _this8.getModelSource(filterOwner);
1089
- let spatialFiltersResolution;
1090
- if (spatialFilter && source.spatialDataType !== 'geo') {
1091
- spatialFiltersResolution = getSpatialFiltersResolution({
1092
- source,
1093
- viewState
1094
- });
1095
- }
1096
937
  return Promise.resolve(executeModel({
1097
938
  model: 'timeseries',
1098
939
  source: {
1099
- ...source,
1100
- spatialFiltersResolution,
1101
- spatialFiltersMode,
940
+ ..._this8.getModelSource(filterOwner),
1102
941
  spatialFilter
1103
942
  },
1104
943
  params: {
@@ -1129,7 +968,8 @@ WidgetBaseSource.defaultProps = {
1129
968
  apiBaseUrl: DEFAULT_API_BASE_URL,
1130
969
  clientId: getClient(),
1131
970
  filters: {},
1132
- filtersLogicalOperator: 'and'
971
+ filtersLogicalOperator: 'and',
972
+ geoColumn: DEFAULT_GEO_COLUMN
1133
973
  };
1134
974
 
1135
975
  /**
@@ -1308,7 +1148,8 @@ const requestWithParameters = function (_ref) {
1308
1148
  parameters = {},
1309
1149
  headers: customHeaders = {},
1310
1150
  errorContext,
1311
- maxLengthURL = DEFAULT_MAX_LENGTH_URL
1151
+ maxLengthURL = DEFAULT_MAX_LENGTH_URL,
1152
+ localCache
1312
1153
  } = _ref;
1313
1154
  try {
1314
1155
  // Parameters added to all requests issued with `requestWithParameters()`.
@@ -1324,7 +1165,12 @@ const requestWithParameters = function (_ref) {
1324
1165
  };
1325
1166
  baseUrl = excludeURLParameters(baseUrl, Object.keys(parameters));
1326
1167
  const key = createCacheKey(baseUrl, parameters, customHeaders);
1327
- if (REQUEST_CACHE.has(key)) {
1168
+ const {
1169
+ cache: REQUEST_CACHE,
1170
+ canReadCache,
1171
+ canStoreInCache
1172
+ } = getCacheSettings(localCache);
1173
+ if (canReadCache && REQUEST_CACHE.has(key)) {
1328
1174
  return Promise.resolve(REQUEST_CACHE.get(key));
1329
1175
  }
1330
1176
  const url = createURLWithParameters(baseUrl, parameters);
@@ -1352,10 +1198,14 @@ const requestWithParameters = function (_ref) {
1352
1198
  }
1353
1199
  return json;
1354
1200
  }).catch(error => {
1355
- REQUEST_CACHE.delete(key);
1201
+ if (canStoreInCache) {
1202
+ REQUEST_CACHE.delete(key);
1203
+ }
1356
1204
  throw new CartoAPIError(error, errorContext, response, responseJson);
1357
1205
  });
1358
- REQUEST_CACHE.set(key, jsonPromise);
1206
+ if (canStoreInCache) {
1207
+ REQUEST_CACHE.set(key, jsonPromise);
1208
+ }
1359
1209
  return Promise.resolve(jsonPromise);
1360
1210
  } catch (e) {
1361
1211
  return Promise.reject(e);
@@ -1365,7 +1215,17 @@ const DEFAULT_HEADERS = {
1365
1215
  Accept: 'application/json',
1366
1216
  'Content-Type': 'application/json'
1367
1217
  };
1368
- const REQUEST_CACHE = new Map();
1218
+ const DEFAULT_REQUEST_CACHE = new Map();
1219
+ function getCacheSettings(localCache) {
1220
+ const canReadCache = localCache?.cacheControl?.includes('no-cache') ? false : true;
1221
+ const canStoreInCache = localCache?.cacheControl?.includes('no-store') ? false : true;
1222
+ const cache = localCache?.cache || DEFAULT_REQUEST_CACHE;
1223
+ return {
1224
+ cache,
1225
+ canReadCache,
1226
+ canStoreInCache
1227
+ };
1228
+ }
1369
1229
  function createCacheKey(baseUrl, parameters, headers) {
1370
1230
  const parameterEntries = Object.entries(parameters).sort((_ref2, _ref3) => {
1371
1231
  let [a] = _ref2;
@@ -1436,7 +1296,8 @@ const baseSource = function (endpoint, options, urlParameters) {
1436
1296
  const {
1437
1297
  clientId,
1438
1298
  maxLengthURL,
1439
- format
1299
+ format,
1300
+ localCache
1440
1301
  } = mergedOptions;
1441
1302
  const headers = {
1442
1303
  Authorization: `Bearer ${options.accessToken}`,
@@ -1457,7 +1318,8 @@ const baseSource = function (endpoint, options, urlParameters) {
1457
1318
  parameters,
1458
1319
  headers,
1459
1320
  errorContext,
1460
- maxLengthURL
1321
+ maxLengthURL,
1322
+ localCache
1461
1323
  })).then(function (mapInstantiation) {
1462
1324
  let _exit;
1463
1325
  function _temp2(_result) {
@@ -1465,7 +1327,8 @@ const baseSource = function (endpoint, options, urlParameters) {
1465
1327
  baseUrl: dataUrl,
1466
1328
  headers,
1467
1329
  errorContext,
1468
- maxLengthURL
1330
+ maxLengthURL,
1331
+ localCache
1469
1332
  }));
1470
1333
  }
1471
1334
  const dataUrl = mapInstantiation[format].url[0];
@@ -1479,7 +1342,8 @@ const baseSource = function (endpoint, options, urlParameters) {
1479
1342
  baseUrl: dataUrl,
1480
1343
  headers,
1481
1344
  errorContext,
1482
- maxLengthURL
1345
+ maxLengthURL,
1346
+ localCache
1483
1347
  })).then(function (json) {
1484
1348
  if (accessToken) {
1485
1349
  json.accessToken = accessToken;
@@ -1585,12 +1449,7 @@ const h3QuerySource = function (options) {
1585
1449
  }
1586
1450
  return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1587
1451
  ...result,
1588
- widgetSource: new WidgetQuerySource({
1589
- ...options,
1590
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
1591
- spatialDataColumn,
1592
- spatialDataType: 'h3'
1593
- })
1452
+ widgetSource: new WidgetQuerySource(options)
1594
1453
  })));
1595
1454
  } catch (e) {
1596
1455
  return Promise.reject(e);
@@ -1621,12 +1480,7 @@ const h3TableSource = function (options) {
1621
1480
  }
1622
1481
  return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1623
1482
  ...result,
1624
- widgetSource: new WidgetTableSource({
1625
- ...options,
1626
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
1627
- spatialDataColumn,
1628
- spatialDataType: 'h3'
1629
- })
1483
+ widgetSource: new WidgetTableSource(options)
1630
1484
  })));
1631
1485
  } catch (e) {
1632
1486
  return Promise.reject(e);
@@ -1695,12 +1549,7 @@ const quadbinQuerySource = function (options) {
1695
1549
  }
1696
1550
  return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1697
1551
  ...result,
1698
- widgetSource: new WidgetQuerySource({
1699
- ...options,
1700
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
1701
- spatialDataColumn,
1702
- spatialDataType: 'quadbin'
1703
- })
1552
+ widgetSource: new WidgetQuerySource(options)
1704
1553
  })));
1705
1554
  } catch (e) {
1706
1555
  return Promise.reject(e);
@@ -1731,12 +1580,7 @@ const quadbinTableSource = function (options) {
1731
1580
  }
1732
1581
  return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1733
1582
  ...result,
1734
- widgetSource: new WidgetTableSource({
1735
- ...options,
1736
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
1737
- spatialDataColumn,
1738
- spatialDataType: 'quadbin'
1739
- })
1583
+ widgetSource: new WidgetTableSource(options)
1740
1584
  })));
1741
1585
  } catch (e) {
1742
1586
  return Promise.reject(e);
@@ -1786,10 +1630,7 @@ const vectorQuerySource = function (options) {
1786
1630
  }
1787
1631
  return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1788
1632
  ...result,
1789
- widgetSource: new WidgetQuerySource({
1790
- ...options,
1791
- spatialDataType: 'geo'
1792
- })
1633
+ widgetSource: new WidgetQuerySource(options)
1793
1634
  })));
1794
1635
  } catch (e) {
1795
1636
  return Promise.reject(e);
@@ -1820,10 +1661,7 @@ const vectorTableSource = function (options) {
1820
1661
  }
1821
1662
  return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1822
1663
  ...result,
1823
- widgetSource: new WidgetTableSource({
1824
- ...options,
1825
- spatialDataType: 'geo'
1826
- })
1664
+ widgetSource: new WidgetTableSource(options)
1827
1665
  })));
1828
1666
  } catch (e) {
1829
1667
  return Promise.reject(e);
@@ -1852,6 +1690,7 @@ const query = function (options) {
1852
1690
  apiBaseUrl = SOURCE_DEFAULTS.apiBaseUrl,
1853
1691
  clientId = SOURCE_DEFAULTS.clientId,
1854
1692
  maxLengthURL = SOURCE_DEFAULTS.maxLengthURL,
1693
+ localCache,
1855
1694
  connectionName,
1856
1695
  sqlQuery,
1857
1696
  queryParameters
@@ -1885,7 +1724,8 @@ const query = function (options) {
1885
1724
  parameters,
1886
1725
  headers,
1887
1726
  errorContext,
1888
- maxLengthURL
1727
+ maxLengthURL,
1728
+ localCache
1889
1729
  }));
1890
1730
  } catch (e) {
1891
1731
  return Promise.reject(e);