@deck.gl/carto 8.8.18 → 8.8.20

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.
Files changed (74) hide show
  1. package/dist/dist.dev.js +42413 -42270
  2. package/dist/es5/api/carto-api-error.js +87 -0
  3. package/dist/es5/api/carto-api-error.js.map +1 -0
  4. package/dist/es5/api/index.js +8 -0
  5. package/dist/es5/api/index.js.map +1 -1
  6. package/dist/es5/api/maps-api-common.js +9 -1
  7. package/dist/es5/api/maps-api-common.js.map +1 -1
  8. package/dist/es5/api/maps-v3-client.js +135 -109
  9. package/dist/es5/api/maps-v3-client.js.map +1 -1
  10. package/dist/es5/index.js +6 -0
  11. package/dist/es5/index.js.map +1 -1
  12. package/dist/es5/layers/carto-layer.js.map +1 -1
  13. package/dist/es5/layers/quadbin-tile-layer.js +8 -2
  14. package/dist/es5/layers/quadbin-tile-layer.js.map +1 -1
  15. package/dist/esm/api/carto-api-error.js +51 -0
  16. package/dist/esm/api/carto-api-error.js.map +1 -0
  17. package/dist/esm/api/index.js +1 -0
  18. package/dist/esm/api/index.js.map +1 -1
  19. package/dist/esm/api/maps-api-common.js +6 -0
  20. package/dist/esm/api/maps-api-common.js.map +1 -1
  21. package/dist/esm/api/maps-v3-client.js +59 -35
  22. package/dist/esm/api/maps-v3-client.js.map +1 -1
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/layers/carto-layer.js.map +1 -1
  26. package/dist/esm/layers/quadbin-tile-layer.js +4 -4
  27. package/dist/esm/layers/quadbin-tile-layer.js.map +1 -1
  28. package/dist.min.js +4 -4
  29. package/package.json +2 -2
  30. package/src/api/carto-api-error.ts +67 -0
  31. package/src/api/index.ts +2 -0
  32. package/src/api/maps-api-common.ts +8 -0
  33. package/src/api/maps-v3-client.ts +37 -29
  34. package/src/index.ts +2 -1
  35. package/src/layers/carto-layer.ts +4 -3
  36. package/src/layers/quadbin-tile-layer.ts +4 -2
  37. package/typed/api/carto-api-error.d.ts +24 -0
  38. package/typed/api/carto-api-error.d.ts.map +1 -0
  39. package/typed/api/index.d.ts +2 -0
  40. package/typed/api/index.d.ts.map +1 -1
  41. package/typed/api/maps-api-common.d.ts +7 -0
  42. package/typed/api/maps-api-common.d.ts.map +1 -1
  43. package/typed/api/maps-v3-client.d.ts.map +1 -1
  44. package/typed/index.d.ts +2 -2
  45. package/typed/index.d.ts.map +1 -1
  46. package/typed/layers/carto-layer.d.ts +3 -2
  47. package/typed/layers/carto-layer.d.ts.map +1 -1
  48. package/typed/layers/quadbin-tile-layer.d.ts +4 -1
  49. package/typed/layers/quadbin-tile-layer.d.ts.map +1 -1
  50. package/typed/layers/schema/carto-spa-tile.d.ts +57 -0
  51. package/typed/layers/schema/carto-spa-tile.d.ts.map +1 -0
  52. package/typed/api/index.js +0 -3
  53. package/typed/api/layer-map.js +0 -264
  54. package/typed/api/maps-api-common.js +0 -50
  55. package/typed/api/maps-client.js +0 -125
  56. package/typed/api/maps-v3-client.js +0 -304
  57. package/typed/api/parseMap.js +0 -178
  58. package/typed/basemap.js +0 -9
  59. package/typed/config.js +0 -35
  60. package/typed/index.js +0 -10
  61. package/typed/layers/carto-layer.js +0 -173
  62. package/typed/layers/carto-tile-layer.js +0 -105
  63. package/typed/layers/h3-tile-layer.js +0 -47
  64. package/typed/layers/h3-tileset-2d.js +0 -85
  65. package/typed/layers/quadkey-tile-layer.js +0 -42
  66. package/typed/layers/quadkey-tileset-2d.js +0 -36
  67. package/typed/layers/schema/carto-tile.js +0 -161
  68. package/typed/layers/spatial-index-tile-layer.js +0 -40
  69. package/typed/style/color-bins-style.js +0 -12
  70. package/typed/style/color-categories-style.js +0 -16
  71. package/typed/style/color-continuous-style.js +0 -12
  72. package/typed/style/palette.js +0 -62
  73. package/typed/style/utils.js +0 -15
  74. package/typed/utils.js +0 -4
@@ -19,6 +19,8 @@ var _config = require("../config");
19
19
 
20
20
  var _mapsApiCommon = require("./maps-api-common");
21
21
 
22
+ var _cartoApiError = require("./carto-api-error");
23
+
22
24
  var _parseMap = require("./parseMap");
23
25
 
24
26
  var _core = require("@deck.gl/core");
@@ -45,12 +47,12 @@ function request(_x) {
45
47
 
46
48
  function _request() {
47
49
  _request = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(_ref) {
48
- var method, url, customHeaders, accessToken, body, headers;
50
+ var method, url, customHeaders, accessToken, body, errorContext, headers;
49
51
  return _regenerator.default.wrap(function _callee$(_context) {
50
52
  while (1) {
51
53
  switch (_context.prev = _context.next) {
52
54
  case 0:
53
- method = _ref.method, url = _ref.url, customHeaders = _ref.headers, accessToken = _ref.accessToken, body = _ref.body;
55
+ method = _ref.method, url = _ref.url, customHeaders = _ref.headers, accessToken = _ref.accessToken, body = _ref.body, errorContext = _ref.errorContext;
54
56
  headers = _objectSpread(_objectSpread({}, customHeaders), {}, {
55
57
  Accept: 'application/json'
56
58
  });
@@ -77,7 +79,7 @@ function _request() {
77
79
  case 10:
78
80
  _context.prev = 10;
79
81
  _context.t0 = _context["catch"](4);
80
- throw new Error("Failed to connect to Maps API: ".concat(_context.t0));
82
+ throw new _cartoApiError.CartoAPIError(_context.t0, errorContext);
81
83
 
82
84
  case 13:
83
85
  case "end":
@@ -95,19 +97,20 @@ function requestJson(_x2) {
95
97
 
96
98
  function _requestJson() {
97
99
  _requestJson = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(_ref2) {
98
- var method, url, headers, accessToken, body, response, json;
100
+ var method, url, headers, accessToken, body, errorContext, response, json;
99
101
  return _regenerator.default.wrap(function _callee2$(_context2) {
100
102
  while (1) {
101
103
  switch (_context2.prev = _context2.next) {
102
104
  case 0:
103
- method = _ref2.method, url = _ref2.url, headers = _ref2.headers, accessToken = _ref2.accessToken, body = _ref2.body;
105
+ method = _ref2.method, url = _ref2.url, headers = _ref2.headers, accessToken = _ref2.accessToken, body = _ref2.body, errorContext = _ref2.errorContext;
104
106
  _context2.next = 3;
105
107
  return request({
106
108
  method: method,
107
109
  url: url,
108
110
  headers: headers,
109
111
  accessToken: accessToken,
110
- body: body
112
+ body: body,
113
+ errorContext: errorContext
111
114
  });
112
115
 
113
116
  case 3:
@@ -118,16 +121,17 @@ function _requestJson() {
118
121
  case 6:
119
122
  json = _context2.sent;
120
123
 
121
- if (!response.ok) {
122
- dealWithError({
123
- response: response,
124
- error: json.error
125
- });
124
+ if (response.ok) {
125
+ _context2.next = 9;
126
+ break;
126
127
  }
127
128
 
128
- return _context2.abrupt("return", json);
129
+ throw new _cartoApiError.CartoAPIError(json.error, errorContext, response);
129
130
 
130
131
  case 9:
132
+ return _context2.abrupt("return", json);
133
+
134
+ case 10:
131
135
  case "end":
132
136
  return _context2.stop();
133
137
  }
@@ -143,12 +147,12 @@ function requestData(_x3) {
143
147
 
144
148
  function _requestData() {
145
149
  _requestData = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(_ref3) {
146
- var method, url, accessToken, format, body, data;
150
+ var method, url, accessToken, format, body, errorContext, data;
147
151
  return _regenerator.default.wrap(function _callee3$(_context3) {
148
152
  while (1) {
149
153
  switch (_context3.prev = _context3.next) {
150
154
  case 0:
151
- method = _ref3.method, url = _ref3.url, accessToken = _ref3.accessToken, format = _ref3.format, body = _ref3.body;
155
+ method = _ref3.method, url = _ref3.url, accessToken = _ref3.accessToken, format = _ref3.format, body = _ref3.body, errorContext = _ref3.errorContext;
152
156
 
153
157
  if (!(format === _mapsApiCommon.FORMATS.NDJSON)) {
154
158
  _context3.next = 3;
@@ -159,7 +163,8 @@ function _requestData() {
159
163
  method: method,
160
164
  url: url,
161
165
  accessToken: accessToken,
162
- body: body
166
+ body: body,
167
+ errorContext: errorContext
163
168
  }));
164
169
 
165
170
  case 3:
@@ -168,7 +173,8 @@ function _requestData() {
168
173
  method: method,
169
174
  url: url,
170
175
  accessToken: accessToken,
171
- body: body
176
+ body: body,
177
+ errorContext: errorContext
172
178
  });
173
179
 
174
180
  case 5:
@@ -185,32 +191,15 @@ function _requestData() {
185
191
  return _requestData.apply(this, arguments);
186
192
  }
187
193
 
188
- function dealWithError(_ref4) {
189
- var response = _ref4.response,
190
- error = _ref4.error;
191
-
192
- switch (response.status) {
193
- case 400:
194
- throw new Error("Bad request. ".concat(error));
195
-
196
- case 401:
197
- case 403:
198
- throw new Error("Unauthorized access. ".concat(error));
199
-
200
- default:
201
- throw new Error(error);
202
- }
203
- }
204
-
205
- function getParameters(_ref5) {
206
- var type = _ref5.type,
207
- source = _ref5.source,
208
- geoColumn = _ref5.geoColumn,
209
- columns = _ref5.columns,
210
- clientId = _ref5.clientId,
211
- aggregationExp = _ref5.aggregationExp,
212
- aggregationResLevel = _ref5.aggregationResLevel,
213
- queryParameters = _ref5.queryParameters;
194
+ function getParameters(_ref4) {
195
+ var type = _ref4.type,
196
+ source = _ref4.source,
197
+ geoColumn = _ref4.geoColumn,
198
+ columns = _ref4.columns,
199
+ clientId = _ref4.clientId,
200
+ aggregationExp = _ref4.aggregationExp,
201
+ aggregationResLevel = _ref4.aggregationResLevel,
202
+ queryParameters = _ref4.queryParameters;
214
203
  var parameters = [(0, _mapsApiCommon.encodeParameter)('client', clientId || DEFAULT_CLIENT)];
215
204
  parameters.push((0, _mapsApiCommon.encodeParameter)('v', V3_MINOR_VERSION));
216
205
  var sourceName = type === _mapsApiCommon.MAP_TYPES.QUERY ? 'q' : 'name';
@@ -251,13 +240,13 @@ function mapInstantiation(_x4) {
251
240
  }
252
241
 
253
242
  function _mapInstantiation() {
254
- _mapInstantiation = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(_ref6) {
255
- var type, source, connection, credentials, geoColumn, columns, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, baseUrl, url, accessToken, body;
243
+ _mapInstantiation = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(_ref5) {
244
+ var type, source, connection, credentials, geoColumn, columns, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, baseUrl, url, accessToken, errorContext, body;
256
245
  return _regenerator.default.wrap(function _callee4$(_context4) {
257
246
  while (1) {
258
247
  switch (_context4.prev = _context4.next) {
259
248
  case 0:
260
- type = _ref6.type, source = _ref6.source, connection = _ref6.connection, credentials = _ref6.credentials, geoColumn = _ref6.geoColumn, columns = _ref6.columns, clientId = _ref6.clientId, headers = _ref6.headers, aggregationExp = _ref6.aggregationExp, aggregationResLevel = _ref6.aggregationResLevel, queryParameters = _ref6.queryParameters;
249
+ type = _ref5.type, source = _ref5.source, connection = _ref5.connection, credentials = _ref5.credentials, geoColumn = _ref5.geoColumn, columns = _ref5.columns, clientId = _ref5.clientId, headers = _ref5.headers, aggregationExp = _ref5.aggregationExp, aggregationResLevel = _ref5.aggregationResLevel, queryParameters = _ref5.queryParameters;
261
250
  baseUrl = "".concat(credentials.mapsUrl, "/").concat(connection, "/").concat(type);
262
251
  url = "".concat(baseUrl, "?").concat(getParameters({
263
252
  type: type,
@@ -270,41 +259,52 @@ function _mapInstantiation() {
270
259
  queryParameters: queryParameters
271
260
  }));
272
261
  accessToken = credentials.accessToken;
262
+ errorContext = {
263
+ requestType: _mapsApiCommon.REQUEST_TYPES.INSTANTIATION,
264
+ connection: connection,
265
+ type: type,
266
+ source: source
267
+ };
273
268
 
274
269
  if (!(url.length > MAX_GET_LENGTH && type === _mapsApiCommon.MAP_TYPES.QUERY)) {
275
- _context4.next = 9;
270
+ _context4.next = 10;
276
271
  break;
277
272
  }
278
273
 
279
274
  body = JSON.stringify({
280
275
  q: source,
281
276
  client: clientId || DEFAULT_CLIENT,
277
+ aggregationResLevel: aggregationResLevel,
278
+ aggregationExp: aggregationExp,
279
+ geoColumn: geoColumn,
282
280
  queryParameters: queryParameters
283
281
  });
284
- _context4.next = 8;
282
+ _context4.next = 9;
285
283
  return requestJson({
286
284
  method: 'POST',
287
285
  url: baseUrl,
288
286
  headers: headers,
289
287
  accessToken: accessToken,
290
- body: body
288
+ body: body,
289
+ errorContext: errorContext
291
290
  });
292
291
 
293
- case 8:
292
+ case 9:
294
293
  return _context4.abrupt("return", _context4.sent);
295
294
 
296
- case 9:
297
- _context4.next = 11;
295
+ case 10:
296
+ _context4.next = 12;
298
297
  return requestJson({
299
298
  url: url,
300
299
  headers: headers,
301
- accessToken: accessToken
300
+ accessToken: accessToken,
301
+ errorContext: errorContext
302
302
  });
303
303
 
304
- case 11:
304
+ case 12:
305
305
  return _context4.abrupt("return", _context4.sent);
306
306
 
307
- case 12:
307
+ case 13:
308
308
  case "end":
309
309
  return _context4.stop();
310
310
  }
@@ -324,15 +324,15 @@ function getUrlFromMetadata(metadata, format) {
324
324
  return null;
325
325
  }
326
326
 
327
- function checkFetchLayerDataParameters(_ref7) {
328
- var type = _ref7.type,
329
- source = _ref7.source,
330
- connection = _ref7.connection,
331
- credentials = _ref7.credentials,
332
- geoColumn = _ref7.geoColumn,
333
- columns = _ref7.columns,
334
- aggregationExp = _ref7.aggregationExp,
335
- aggregationResLevel = _ref7.aggregationResLevel;
327
+ function checkFetchLayerDataParameters(_ref6) {
328
+ var type = _ref6.type,
329
+ source = _ref6.source,
330
+ connection = _ref6.connection,
331
+ credentials = _ref6.credentials,
332
+ geoColumn = _ref6.geoColumn,
333
+ columns = _ref6.columns,
334
+ aggregationExp = _ref6.aggregationExp,
335
+ aggregationResLevel = _ref6.aggregationResLevel;
336
336
  (0, _utils.assert)(connection, 'Must define connection');
337
337
  (0, _utils.assert)(type, 'Must define a type');
338
338
  (0, _utils.assert)(source, 'Must define a source');
@@ -357,14 +357,14 @@ function fetchLayerData(_x5) {
357
357
  }
358
358
 
359
359
  function _fetchLayerData() {
360
- _fetchLayerData = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(_ref8) {
361
- var type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, _yield$_fetchDataUrl, url, accessToken, mapFormat, metadata, data, result;
360
+ _fetchLayerData = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(_ref7) {
361
+ var type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, _yield$_fetchDataUrl, url, accessToken, mapFormat, metadata, errorContext, data, result;
362
362
 
363
363
  return _regenerator.default.wrap(function _callee5$(_context5) {
364
364
  while (1) {
365
365
  switch (_context5.prev = _context5.next) {
366
366
  case 0:
367
- type = _ref8.type, source = _ref8.source, connection = _ref8.connection, credentials = _ref8.credentials, geoColumn = _ref8.geoColumn, columns = _ref8.columns, format = _ref8.format, formatTiles = _ref8.formatTiles, clientId = _ref8.clientId, headers = _ref8.headers, aggregationExp = _ref8.aggregationExp, aggregationResLevel = _ref8.aggregationResLevel, queryParameters = _ref8.queryParameters;
367
+ type = _ref7.type, source = _ref7.source, connection = _ref7.connection, credentials = _ref7.credentials, geoColumn = _ref7.geoColumn, columns = _ref7.columns, format = _ref7.format, formatTiles = _ref7.formatTiles, clientId = _ref7.clientId, headers = _ref7.headers, aggregationExp = _ref7.aggregationExp, aggregationResLevel = _ref7.aggregationResLevel, queryParameters = _ref7.queryParameters;
368
368
  _context5.next = 3;
369
369
  return _fetchDataUrl({
370
370
  type: type,
@@ -388,14 +388,21 @@ function _fetchLayerData() {
388
388
  accessToken = _yield$_fetchDataUrl.accessToken;
389
389
  mapFormat = _yield$_fetchDataUrl.mapFormat;
390
390
  metadata = _yield$_fetchDataUrl.metadata;
391
- _context5.next = 10;
391
+ errorContext = {
392
+ requestType: _mapsApiCommon.REQUEST_TYPES.DATA,
393
+ connection: connection,
394
+ type: type,
395
+ source: source
396
+ };
397
+ _context5.next = 11;
392
398
  return requestData({
393
399
  url: url,
394
400
  format: mapFormat,
395
- accessToken: accessToken
401
+ accessToken: accessToken,
402
+ errorContext: errorContext
396
403
  });
397
404
 
398
- case 10:
405
+ case 11:
399
406
  data = _context5.sent;
400
407
  result = {
401
408
  data: data,
@@ -404,7 +411,7 @@ function _fetchLayerData() {
404
411
  };
405
412
  return _context5.abrupt("return", result);
406
413
 
407
- case 13:
414
+ case 14:
408
415
  case "end":
409
416
  return _context5.stop();
410
417
  }
@@ -419,14 +426,14 @@ function _fetchDataUrl(_x6) {
419
426
  }
420
427
 
421
428
  function _fetchDataUrl2() {
422
- _fetchDataUrl2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(_ref9) {
429
+ _fetchDataUrl2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(_ref8) {
423
430
  var type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, defaultCredentials, localCreds, metadata, url, mapFormat, prioritizedFormats, _i, _prioritizedFormats, f, accessToken;
424
431
 
425
432
  return _regenerator.default.wrap(function _callee6$(_context6) {
426
433
  while (1) {
427
434
  switch (_context6.prev = _context6.next) {
428
435
  case 0:
429
- type = _ref9.type, source = _ref9.source, connection = _ref9.connection, credentials = _ref9.credentials, geoColumn = _ref9.geoColumn, columns = _ref9.columns, format = _ref9.format, formatTiles = _ref9.formatTiles, clientId = _ref9.clientId, headers = _ref9.headers, aggregationExp = _ref9.aggregationExp, aggregationResLevel = _ref9.aggregationResLevel, queryParameters = _ref9.queryParameters;
436
+ type = _ref8.type, source = _ref8.source, connection = _ref8.connection, credentials = _ref8.credentials, geoColumn = _ref8.geoColumn, columns = _ref8.columns, format = _ref8.format, formatTiles = _ref8.formatTiles, clientId = _ref8.clientId, headers = _ref8.headers, aggregationExp = _ref8.aggregationExp, aggregationResLevel = _ref8.aggregationResLevel, queryParameters = _ref8.queryParameters;
430
437
  defaultCredentials = (0, _config.getDefaultCredentials)();
431
438
  localCreds = _objectSpread(_objectSpread({}, defaultCredentials.apiVersion === _mapsApiCommon.API_VERSIONS.V3 && defaultCredentials), credentials);
432
439
  checkFetchLayerDataParameters({
@@ -534,7 +541,7 @@ function _fetchMapDataset(_x7, _x8, _x9, _x10, _x11) {
534
541
 
535
542
  function _fetchMapDataset2() {
536
543
  _fetchMapDataset2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(dataset, accessToken, credentials, clientId, headers) {
537
- var aggregationExp, aggregationResLevel, connection, columns, format, geoColumn, source, type, queryParameters, _yield$_fetchDataUrl2, url, mapFormat, cache;
544
+ var aggregationExp, aggregationResLevel, connection, columns, format, geoColumn, source, type, queryParameters, _yield$_fetchDataUrl2, url, mapFormat, cache, errorContext;
538
545
 
539
546
  return _regenerator.default.wrap(function _callee7$(_context7) {
540
547
  while (1) {
@@ -574,18 +581,25 @@ function _fetchMapDataset2() {
574
581
 
575
582
  case 9:
576
583
  dataset.cache = cache;
577
- _context7.next = 12;
584
+ errorContext = {
585
+ requestType: _mapsApiCommon.REQUEST_TYPES.DATA,
586
+ connection: connection,
587
+ type: type,
588
+ source: source
589
+ };
590
+ _context7.next = 13;
578
591
  return requestData({
579
592
  url: url,
580
593
  format: mapFormat,
581
- accessToken: accessToken
594
+ accessToken: accessToken,
595
+ errorContext: errorContext
582
596
  });
583
597
 
584
- case 12:
598
+ case 13:
585
599
  dataset.data = _context7.sent;
586
600
  return _context7.abrupt("return", true);
587
601
 
588
- case 14:
602
+ case 15:
589
603
  case "end":
590
604
  return _context7.stop();
591
605
  }
@@ -601,7 +615,7 @@ function _fetchTilestats(_x12, _x13, _x14, _x15) {
601
615
 
602
616
  function _fetchTilestats2() {
603
617
  _fetchTilestats2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee8(attribute, dataset, accessToken, credentials) {
604
- var connection, source, type, statsUrl, url, stats, attributes, index;
618
+ var connection, source, type, statsUrl, url, errorContext, stats, attributes, index;
605
619
  return _regenerator.default.wrap(function _callee8$(_context8) {
606
620
  while (1) {
607
621
  switch (_context8.prev = _context8.next) {
@@ -616,14 +630,21 @@ function _fetchTilestats2() {
616
630
  url += "".concat(source, "/").concat(attribute);
617
631
  }
618
632
 
619
- _context8.next = 6;
633
+ errorContext = {
634
+ requestType: _mapsApiCommon.REQUEST_TYPES.TILE_STATS,
635
+ connection: connection,
636
+ type: type,
637
+ source: source
638
+ };
639
+ _context8.next = 7;
620
640
  return requestData({
621
641
  url: url,
622
642
  format: _mapsApiCommon.FORMATS.JSON,
623
- accessToken: accessToken
643
+ accessToken: accessToken,
644
+ errorContext: errorContext
624
645
  });
625
646
 
626
- case 6:
647
+ case 7:
627
648
  stats = _context8.sent;
628
649
  attributes = dataset.data.tilestats.layers[0].attributes;
629
650
  index = attributes.findIndex(function (d) {
@@ -632,7 +653,7 @@ function _fetchTilestats2() {
632
653
  attributes[index] = stats;
633
654
  return _context8.abrupt("return", true);
634
655
 
635
- case 11:
656
+ case 12:
636
657
  case "end":
637
658
  return _context8.stop();
638
659
  }
@@ -647,13 +668,13 @@ function fillInMapDatasets(_x16, _x17, _x18, _x19) {
647
668
  }
648
669
 
649
670
  function _fillInMapDatasets() {
650
- _fillInMapDatasets = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(_ref10, clientId, credentials, headers) {
671
+ _fillInMapDatasets = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(_ref9, clientId, credentials, headers) {
651
672
  var datasets, token, promises;
652
673
  return _regenerator.default.wrap(function _callee9$(_context9) {
653
674
  while (1) {
654
675
  switch (_context9.prev = _context9.next) {
655
676
  case 0:
656
- datasets = _ref10.datasets, token = _ref10.token;
677
+ datasets = _ref9.datasets, token = _ref9.token;
657
678
  promises = datasets.map(function (dataset) {
658
679
  return _fetchMapDataset(dataset, token, credentials, clientId, headers);
659
680
  });
@@ -678,14 +699,14 @@ function fillInTileStats(_x20, _x21) {
678
699
  }
679
700
 
680
701
  function _fillInTileStats() {
681
- _fillInTileStats = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee10(_ref11, credentials) {
702
+ _fillInTileStats = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee10(_ref10, credentials) {
682
703
  var datasets, keplerMapConfig, token, attributes, layers, _iterator, _step, _loop2, filteredAttributes, _loop, _i2, _attributes, promises;
683
704
 
684
705
  return _regenerator.default.wrap(function _callee10$(_context10) {
685
706
  while (1) {
686
707
  switch (_context10.prev = _context10.next) {
687
708
  case 0:
688
- datasets = _ref11.datasets, keplerMapConfig = _ref11.keplerMapConfig, token = _ref11.token;
709
+ datasets = _ref10.datasets, keplerMapConfig = _ref10.keplerMapConfig, token = _ref10.token;
689
710
  attributes = [];
690
711
  layers = keplerMapConfig.config.visState.layers;
691
712
  _iterator = _createForOfIteratorHelper(layers);
@@ -729,9 +750,9 @@ function _fillInTileStats() {
729
750
  _loop = function _loop() {
730
751
  var a = _attributes[_i2];
731
752
 
732
- if (!filteredAttributes.find(function (_ref13) {
733
- var attribute = _ref13.attribute,
734
- dataset = _ref13.dataset;
753
+ if (!filteredAttributes.find(function (_ref12) {
754
+ var attribute = _ref12.attribute,
755
+ dataset = _ref12.dataset;
735
756
  return attribute === a.attribute && dataset === a.dataset;
736
757
  })) {
737
758
  filteredAttributes.push(a);
@@ -742,9 +763,9 @@ function _fillInTileStats() {
742
763
  _loop();
743
764
  }
744
765
 
745
- promises = filteredAttributes.map(function (_ref14) {
746
- var attribute = _ref14.attribute,
747
- dataset = _ref14.dataset;
766
+ promises = filteredAttributes.map(function (_ref13) {
767
+ var attribute = _ref13.attribute,
768
+ dataset = _ref13.dataset;
748
769
  return _fetchTilestats(attribute, dataset, token, credentials);
749
770
  });
750
771
  _context10.next = 11;
@@ -768,13 +789,13 @@ function fetchMap(_x22) {
768
789
  }
769
790
 
770
791
  function _fetchMap() {
771
- _fetchMap = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee12(_ref12) {
772
- var cartoMapId, clientId, credentials, headers, autoRefresh, onNewData, defaultCredentials, localCreds, accessToken, url, map, stopAutoRefresh, intervalId, geojsonLayers, geojsonDatasetIds;
792
+ _fetchMap = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee12(_ref11) {
793
+ var cartoMapId, clientId, credentials, headers, autoRefresh, onNewData, defaultCredentials, localCreds, accessToken, url, errorContext, map, stopAutoRefresh, intervalId, geojsonLayers, geojsonDatasetIds;
773
794
  return _regenerator.default.wrap(function _callee12$(_context12) {
774
795
  while (1) {
775
796
  switch (_context12.prev = _context12.next) {
776
797
  case 0:
777
- cartoMapId = _ref12.cartoMapId, clientId = _ref12.clientId, credentials = _ref12.credentials, headers = _ref12.headers, autoRefresh = _ref12.autoRefresh, onNewData = _ref12.onNewData;
798
+ cartoMapId = _ref11.cartoMapId, clientId = _ref11.clientId, credentials = _ref11.credentials, headers = _ref11.headers, autoRefresh = _ref11.autoRefresh, onNewData = _ref11.onNewData;
778
799
  defaultCredentials = (0, _config.getDefaultCredentials)();
779
800
  localCreds = _objectSpread(_objectSpread({}, defaultCredentials.apiVersion === _mapsApiCommon.API_VERSIONS.V3 && defaultCredentials), credentials);
780
801
  accessToken = localCreds.accessToken;
@@ -793,14 +814,19 @@ function _fetchMap() {
793
814
  }
794
815
 
795
816
  url = "".concat(localCreds.mapsUrl, "/public/").concat(cartoMapId);
796
- _context12.next = 12;
817
+ errorContext = {
818
+ requestType: _mapsApiCommon.REQUEST_TYPES.PUBLIC_MAP,
819
+ mapId: cartoMapId
820
+ };
821
+ _context12.next = 13;
797
822
  return requestJson({
798
823
  url: url,
799
824
  headers: headers,
800
- accessToken: accessToken
825
+ accessToken: accessToken,
826
+ errorContext: errorContext
801
827
  });
802
828
 
803
- case 12:
829
+ case 13:
804
830
  map = _context12.sent;
805
831
 
806
832
  if (autoRefresh) {
@@ -835,18 +861,18 @@ function _fetchMap() {
835
861
  };
836
862
  }
837
863
 
838
- geojsonLayers = map.keplerMapConfig.config.visState.layers.filter(function (_ref16) {
839
- var type = _ref16.type;
864
+ geojsonLayers = map.keplerMapConfig.config.visState.layers.filter(function (_ref15) {
865
+ var type = _ref15.type;
840
866
  return type === 'geojson' || type === 'point';
841
867
  });
842
- geojsonDatasetIds = geojsonLayers.map(function (_ref17) {
843
- var config = _ref17.config;
868
+ geojsonDatasetIds = geojsonLayers.map(function (_ref16) {
869
+ var config = _ref16.config;
844
870
  return config.dataId;
845
871
  });
846
872
  map.datasets.forEach(function (dataset) {
847
873
  if (geojsonDatasetIds.includes(dataset.id)) {
848
- var _geojsonLayers$find = geojsonLayers.find(function (_ref18) {
849
- var config = _ref18.config;
874
+ var _geojsonLayers$find = geojsonLayers.find(function (_ref17) {
875
+ var config = _ref17.config;
850
876
  return config.dataId === dataset.id;
851
877
  }),
852
878
  config = _geojsonLayers$find.config;
@@ -855,19 +881,19 @@ function _fetchMap() {
855
881
  dataset.geoColumn = config.columns.geojson;
856
882
  }
857
883
  });
858
- _context12.next = 19;
884
+ _context12.next = 20;
859
885
  return fillInMapDatasets(map, clientId, localCreds, headers);
860
886
 
861
- case 19:
862
- _context12.next = 21;
887
+ case 20:
888
+ _context12.next = 22;
863
889
  return fillInTileStats(map, localCreds);
864
890
 
865
- case 21:
891
+ case 22:
866
892
  return _context12.abrupt("return", _objectSpread(_objectSpread({}, (0, _parseMap.parseMap)(map)), {
867
893
  stopAutoRefresh: stopAutoRefresh
868
894
  }));
869
895
 
870
- case 22:
896
+ case 23:
871
897
  case "end":
872
898
  return _context12.stop();
873
899
  }