@deck.gl/carto 8.9.0-alpha.5 → 8.9.0-beta.2
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/dist/dist.dev.js +13784 -58311
- package/dist/es5/api/carto-api-error.js +87 -0
- package/dist/es5/api/carto-api-error.js.map +1 -0
- package/dist/es5/api/index.js +8 -0
- package/dist/es5/api/index.js.map +1 -1
- package/dist/es5/api/layer-map.js +4 -1
- package/dist/es5/api/layer-map.js.map +1 -1
- package/dist/es5/api/maps-api-common.js +9 -1
- package/dist/es5/api/maps-api-common.js.map +1 -1
- package/dist/es5/api/maps-v3-client.js +140 -115
- package/dist/es5/api/maps-v3-client.js.map +1 -1
- package/dist/es5/index.js +6 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/layers/carto-layer.js.map +1 -1
- package/dist/es5/layers/carto-tile-layer.js.map +1 -1
- package/dist/es5/layers/h3-tile-layer.js.map +1 -1
- package/dist/es5/layers/quadbin-layer.js +3 -1
- package/dist/es5/layers/quadbin-layer.js.map +1 -1
- package/dist/es5/layers/quadbin-tile-layer.js +8 -2
- package/dist/es5/layers/quadbin-tile-layer.js.map +1 -1
- package/dist/es5/layers/quadbin-utils.js +5 -3
- package/dist/es5/layers/quadbin-utils.js.map +1 -1
- package/dist/es5/layers/spatial-index-tile-layer.js +21 -0
- package/dist/es5/layers/spatial-index-tile-layer.js.map +1 -1
- package/dist/esm/api/carto-api-error.js +51 -0
- package/dist/esm/api/carto-api-error.js.map +1 -0
- package/dist/esm/api/index.js +1 -0
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/layer-map.js +4 -1
- package/dist/esm/api/layer-map.js.map +1 -1
- package/dist/esm/api/maps-api-common.js +6 -0
- package/dist/esm/api/maps-api-common.js.map +1 -1
- package/dist/esm/api/maps-v3-client.js +64 -41
- package/dist/esm/api/maps-v3-client.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layers/carto-layer.js.map +1 -1
- package/dist/esm/layers/carto-tile-layer.js.map +1 -1
- package/dist/esm/layers/h3-tile-layer.js.map +1 -1
- package/dist/esm/layers/quadbin-layer.js +3 -1
- package/dist/esm/layers/quadbin-layer.js.map +1 -1
- package/dist/esm/layers/quadbin-tile-layer.js +4 -4
- package/dist/esm/layers/quadbin-tile-layer.js.map +1 -1
- package/dist/esm/layers/quadbin-utils.js +4 -4
- package/dist/esm/layers/quadbin-utils.js.map +1 -1
- package/dist/esm/layers/spatial-index-tile-layer.js +20 -0
- package/dist/esm/layers/spatial-index-tile-layer.js.map +1 -1
- package/dist.min.js +24 -278
- package/package.json +13 -13
- package/src/api/carto-api-error.ts +67 -0
- package/src/api/index.ts +2 -0
- package/src/api/layer-map.ts +3 -1
- package/src/api/maps-api-common.ts +8 -0
- package/src/api/maps-v3-client.ts +42 -38
- package/src/index.ts +2 -1
- package/src/layers/carto-layer.ts +6 -5
- package/src/layers/carto-tile-layer.ts +2 -2
- package/src/layers/h3-tile-layer.ts +1 -1
- package/src/layers/quadbin-layer.ts +5 -3
- package/src/layers/quadbin-tile-layer.ts +8 -5
- package/src/layers/quadbin-utils.ts +4 -4
- package/src/layers/spatial-index-tile-layer.ts +28 -1
- package/typed/api/carto-api-error.d.ts +24 -0
- package/typed/api/carto-api-error.d.ts.map +1 -0
- package/typed/api/index.d.ts +2 -0
- package/typed/api/index.d.ts.map +1 -1
- package/typed/api/index.js +3 -0
- package/typed/api/layer-map.d.ts.map +1 -1
- package/typed/api/layer-map.js +264 -0
- package/typed/api/maps-api-common.d.ts +7 -0
- package/typed/api/maps-api-common.d.ts.map +1 -1
- package/typed/api/maps-api-common.js +50 -0
- package/typed/api/maps-client.js +125 -0
- package/typed/api/maps-v3-client.d.ts.map +1 -1
- package/typed/api/maps-v3-client.js +304 -0
- package/typed/api/parseMap.js +178 -0
- package/typed/basemap.js +9 -0
- package/typed/config.js +35 -0
- package/typed/index.d.ts +2 -2
- package/typed/index.d.ts.map +1 -1
- package/typed/index.js +10 -0
- package/typed/layers/carto-layer.d.ts +40 -4
- package/typed/layers/carto-layer.d.ts.map +1 -1
- package/typed/layers/carto-layer.js +173 -0
- package/typed/layers/carto-tile-layer.d.ts +1 -1
- package/typed/layers/carto-tile-layer.d.ts.map +1 -1
- package/typed/layers/carto-tile-layer.js +105 -0
- package/typed/layers/h3-tile-layer.d.ts +1 -1
- package/typed/layers/h3-tile-layer.d.ts.map +1 -1
- package/typed/layers/h3-tile-layer.js +47 -0
- package/typed/layers/h3-tileset-2d.js +85 -0
- package/typed/layers/quadbin-layer.d.ts +1 -1
- package/typed/layers/quadbin-layer.d.ts.map +1 -1
- package/typed/layers/quadbin-tile-layer.d.ts +5 -2
- package/typed/layers/quadbin-tile-layer.d.ts.map +1 -1
- package/typed/layers/quadbin-utils.d.ts +2 -2
- package/typed/layers/quadbin-utils.d.ts.map +1 -1
- package/typed/layers/quadkey-tile-layer.d.ts +21 -0
- package/typed/layers/quadkey-tile-layer.d.ts.map +1 -0
- package/typed/layers/quadkey-tile-layer.js +42 -0
- package/typed/layers/quadkey-tileset-2d.d.ts +15 -0
- package/typed/layers/quadkey-tileset-2d.d.ts.map +1 -0
- package/typed/layers/quadkey-tileset-2d.js +36 -0
- package/typed/layers/schema/carto-tile.js +161 -0
- package/typed/layers/spatial-index-tile-layer.d.ts +11 -1
- package/typed/layers/spatial-index-tile-layer.d.ts.map +1 -1
- package/typed/layers/spatial-index-tile-layer.js +40 -0
- package/typed/style/color-bins-style.js +12 -0
- package/typed/style/color-categories-style.js +16 -0
- package/typed/style/color-continuous-style.js +12 -0
- package/typed/style/palette.js +62 -0
- package/typed/style/utils.js +15 -0
- package/typed/utils.js +4 -0
|
@@ -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");
|
|
@@ -35,7 +37,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
35
37
|
|
|
36
38
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
37
39
|
|
|
38
|
-
var MAX_GET_LENGTH =
|
|
40
|
+
var MAX_GET_LENGTH = 8192;
|
|
39
41
|
var DEFAULT_CLIENT = 'deck-gl-carto';
|
|
40
42
|
var V3_MINOR_VERSION = '3.1';
|
|
41
43
|
|
|
@@ -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
|
|
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 (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
error: json.error
|
|
125
|
-
});
|
|
124
|
+
if (response.ok) {
|
|
125
|
+
_context2.next = 9;
|
|
126
|
+
break;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
|
|
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
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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(
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
292
|
+
case 9:
|
|
294
293
|
return _context4.abrupt("return", _context4.sent);
|
|
295
294
|
|
|
296
|
-
case
|
|
297
|
-
_context4.next =
|
|
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
|
|
304
|
+
case 12:
|
|
305
305
|
return _context4.abrupt("return", _context4.sent);
|
|
306
306
|
|
|
307
|
-
case
|
|
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(
|
|
328
|
-
var type =
|
|
329
|
-
source =
|
|
330
|
-
connection =
|
|
331
|
-
credentials =
|
|
332
|
-
geoColumn =
|
|
333
|
-
columns =
|
|
334
|
-
aggregationExp =
|
|
335
|
-
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');
|
|
@@ -350,10 +350,6 @@ function checkFetchLayerDataParameters(_ref7) {
|
|
|
350
350
|
(0, _utils.assert)(!aggregationExp, 'Have aggregationExp, but geoColumn parameter is missing');
|
|
351
351
|
(0, _utils.assert)(!aggregationResLevel, 'Have aggregationResLevel, but geoColumn parameter is missing');
|
|
352
352
|
}
|
|
353
|
-
|
|
354
|
-
if (!aggregationExp) {
|
|
355
|
-
(0, _utils.assert)(!aggregationResLevel, 'Have aggregationResLevel, but aggregationExp parameter is missing');
|
|
356
|
-
}
|
|
357
353
|
}
|
|
358
354
|
|
|
359
355
|
function fetchLayerData(_x5) {
|
|
@@ -361,14 +357,14 @@ function fetchLayerData(_x5) {
|
|
|
361
357
|
}
|
|
362
358
|
|
|
363
359
|
function _fetchLayerData() {
|
|
364
|
-
_fetchLayerData = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(
|
|
365
|
-
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;
|
|
366
362
|
|
|
367
363
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
368
364
|
while (1) {
|
|
369
365
|
switch (_context5.prev = _context5.next) {
|
|
370
366
|
case 0:
|
|
371
|
-
type =
|
|
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;
|
|
372
368
|
_context5.next = 3;
|
|
373
369
|
return _fetchDataUrl({
|
|
374
370
|
type: type,
|
|
@@ -392,14 +388,21 @@ function _fetchLayerData() {
|
|
|
392
388
|
accessToken = _yield$_fetchDataUrl.accessToken;
|
|
393
389
|
mapFormat = _yield$_fetchDataUrl.mapFormat;
|
|
394
390
|
metadata = _yield$_fetchDataUrl.metadata;
|
|
395
|
-
|
|
391
|
+
errorContext = {
|
|
392
|
+
requestType: _mapsApiCommon.REQUEST_TYPES.DATA,
|
|
393
|
+
connection: connection,
|
|
394
|
+
type: type,
|
|
395
|
+
source: source
|
|
396
|
+
};
|
|
397
|
+
_context5.next = 11;
|
|
396
398
|
return requestData({
|
|
397
399
|
url: url,
|
|
398
400
|
format: mapFormat,
|
|
399
|
-
accessToken: accessToken
|
|
401
|
+
accessToken: accessToken,
|
|
402
|
+
errorContext: errorContext
|
|
400
403
|
});
|
|
401
404
|
|
|
402
|
-
case
|
|
405
|
+
case 11:
|
|
403
406
|
data = _context5.sent;
|
|
404
407
|
result = {
|
|
405
408
|
data: data,
|
|
@@ -408,7 +411,7 @@ function _fetchLayerData() {
|
|
|
408
411
|
};
|
|
409
412
|
return _context5.abrupt("return", result);
|
|
410
413
|
|
|
411
|
-
case
|
|
414
|
+
case 14:
|
|
412
415
|
case "end":
|
|
413
416
|
return _context5.stop();
|
|
414
417
|
}
|
|
@@ -423,14 +426,14 @@ function _fetchDataUrl(_x6) {
|
|
|
423
426
|
}
|
|
424
427
|
|
|
425
428
|
function _fetchDataUrl2() {
|
|
426
|
-
_fetchDataUrl2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(
|
|
429
|
+
_fetchDataUrl2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(_ref8) {
|
|
427
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;
|
|
428
431
|
|
|
429
432
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
430
433
|
while (1) {
|
|
431
434
|
switch (_context6.prev = _context6.next) {
|
|
432
435
|
case 0:
|
|
433
|
-
type =
|
|
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;
|
|
434
437
|
defaultCredentials = (0, _config.getDefaultCredentials)();
|
|
435
438
|
localCreds = _objectSpread(_objectSpread({}, defaultCredentials.apiVersion === _mapsApiCommon.API_VERSIONS.V3 && defaultCredentials), credentials);
|
|
436
439
|
checkFetchLayerDataParameters({
|
|
@@ -538,7 +541,7 @@ function _fetchMapDataset(_x7, _x8, _x9, _x10, _x11) {
|
|
|
538
541
|
|
|
539
542
|
function _fetchMapDataset2() {
|
|
540
543
|
_fetchMapDataset2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(dataset, accessToken, credentials, clientId, headers) {
|
|
541
|
-
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;
|
|
542
545
|
|
|
543
546
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
544
547
|
while (1) {
|
|
@@ -578,18 +581,25 @@ function _fetchMapDataset2() {
|
|
|
578
581
|
|
|
579
582
|
case 9:
|
|
580
583
|
dataset.cache = cache;
|
|
581
|
-
|
|
584
|
+
errorContext = {
|
|
585
|
+
requestType: _mapsApiCommon.REQUEST_TYPES.DATA,
|
|
586
|
+
connection: connection,
|
|
587
|
+
type: type,
|
|
588
|
+
source: source
|
|
589
|
+
};
|
|
590
|
+
_context7.next = 13;
|
|
582
591
|
return requestData({
|
|
583
592
|
url: url,
|
|
584
593
|
format: mapFormat,
|
|
585
|
-
accessToken: accessToken
|
|
594
|
+
accessToken: accessToken,
|
|
595
|
+
errorContext: errorContext
|
|
586
596
|
});
|
|
587
597
|
|
|
588
|
-
case
|
|
598
|
+
case 13:
|
|
589
599
|
dataset.data = _context7.sent;
|
|
590
600
|
return _context7.abrupt("return", true);
|
|
591
601
|
|
|
592
|
-
case
|
|
602
|
+
case 15:
|
|
593
603
|
case "end":
|
|
594
604
|
return _context7.stop();
|
|
595
605
|
}
|
|
@@ -605,7 +615,7 @@ function _fetchTilestats(_x12, _x13, _x14, _x15) {
|
|
|
605
615
|
|
|
606
616
|
function _fetchTilestats2() {
|
|
607
617
|
_fetchTilestats2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee8(attribute, dataset, accessToken, credentials) {
|
|
608
|
-
var connection, source, type, statsUrl, url, stats, attributes, index;
|
|
618
|
+
var connection, source, type, statsUrl, url, errorContext, stats, attributes, index;
|
|
609
619
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
610
620
|
while (1) {
|
|
611
621
|
switch (_context8.prev = _context8.next) {
|
|
@@ -620,14 +630,21 @@ function _fetchTilestats2() {
|
|
|
620
630
|
url += "".concat(source, "/").concat(attribute);
|
|
621
631
|
}
|
|
622
632
|
|
|
623
|
-
|
|
633
|
+
errorContext = {
|
|
634
|
+
requestType: _mapsApiCommon.REQUEST_TYPES.TILE_STATS,
|
|
635
|
+
connection: connection,
|
|
636
|
+
type: type,
|
|
637
|
+
source: source
|
|
638
|
+
};
|
|
639
|
+
_context8.next = 7;
|
|
624
640
|
return requestData({
|
|
625
641
|
url: url,
|
|
626
642
|
format: _mapsApiCommon.FORMATS.JSON,
|
|
627
|
-
accessToken: accessToken
|
|
643
|
+
accessToken: accessToken,
|
|
644
|
+
errorContext: errorContext
|
|
628
645
|
});
|
|
629
646
|
|
|
630
|
-
case
|
|
647
|
+
case 7:
|
|
631
648
|
stats = _context8.sent;
|
|
632
649
|
attributes = dataset.data.tilestats.layers[0].attributes;
|
|
633
650
|
index = attributes.findIndex(function (d) {
|
|
@@ -636,7 +653,7 @@ function _fetchTilestats2() {
|
|
|
636
653
|
attributes[index] = stats;
|
|
637
654
|
return _context8.abrupt("return", true);
|
|
638
655
|
|
|
639
|
-
case
|
|
656
|
+
case 12:
|
|
640
657
|
case "end":
|
|
641
658
|
return _context8.stop();
|
|
642
659
|
}
|
|
@@ -651,13 +668,13 @@ function fillInMapDatasets(_x16, _x17, _x18, _x19) {
|
|
|
651
668
|
}
|
|
652
669
|
|
|
653
670
|
function _fillInMapDatasets() {
|
|
654
|
-
_fillInMapDatasets = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(
|
|
671
|
+
_fillInMapDatasets = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(_ref9, clientId, credentials, headers) {
|
|
655
672
|
var datasets, token, promises;
|
|
656
673
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
657
674
|
while (1) {
|
|
658
675
|
switch (_context9.prev = _context9.next) {
|
|
659
676
|
case 0:
|
|
660
|
-
datasets =
|
|
677
|
+
datasets = _ref9.datasets, token = _ref9.token;
|
|
661
678
|
promises = datasets.map(function (dataset) {
|
|
662
679
|
return _fetchMapDataset(dataset, token, credentials, clientId, headers);
|
|
663
680
|
});
|
|
@@ -682,14 +699,14 @@ function fillInTileStats(_x20, _x21) {
|
|
|
682
699
|
}
|
|
683
700
|
|
|
684
701
|
function _fillInTileStats() {
|
|
685
|
-
_fillInTileStats = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee10(
|
|
702
|
+
_fillInTileStats = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee10(_ref10, credentials) {
|
|
686
703
|
var datasets, keplerMapConfig, token, attributes, layers, _iterator, _step, _loop2, filteredAttributes, _loop, _i2, _attributes, promises;
|
|
687
704
|
|
|
688
705
|
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
689
706
|
while (1) {
|
|
690
707
|
switch (_context10.prev = _context10.next) {
|
|
691
708
|
case 0:
|
|
692
|
-
datasets =
|
|
709
|
+
datasets = _ref10.datasets, keplerMapConfig = _ref10.keplerMapConfig, token = _ref10.token;
|
|
693
710
|
attributes = [];
|
|
694
711
|
layers = keplerMapConfig.config.visState.layers;
|
|
695
712
|
_iterator = _createForOfIteratorHelper(layers);
|
|
@@ -733,9 +750,9 @@ function _fillInTileStats() {
|
|
|
733
750
|
_loop = function _loop() {
|
|
734
751
|
var a = _attributes[_i2];
|
|
735
752
|
|
|
736
|
-
if (!filteredAttributes.find(function (
|
|
737
|
-
var attribute =
|
|
738
|
-
dataset =
|
|
753
|
+
if (!filteredAttributes.find(function (_ref12) {
|
|
754
|
+
var attribute = _ref12.attribute,
|
|
755
|
+
dataset = _ref12.dataset;
|
|
739
756
|
return attribute === a.attribute && dataset === a.dataset;
|
|
740
757
|
})) {
|
|
741
758
|
filteredAttributes.push(a);
|
|
@@ -746,9 +763,9 @@ function _fillInTileStats() {
|
|
|
746
763
|
_loop();
|
|
747
764
|
}
|
|
748
765
|
|
|
749
|
-
promises = filteredAttributes.map(function (
|
|
750
|
-
var attribute =
|
|
751
|
-
dataset =
|
|
766
|
+
promises = filteredAttributes.map(function (_ref13) {
|
|
767
|
+
var attribute = _ref13.attribute,
|
|
768
|
+
dataset = _ref13.dataset;
|
|
752
769
|
return _fetchTilestats(attribute, dataset, token, credentials);
|
|
753
770
|
});
|
|
754
771
|
_context10.next = 11;
|
|
@@ -772,13 +789,13 @@ function fetchMap(_x22) {
|
|
|
772
789
|
}
|
|
773
790
|
|
|
774
791
|
function _fetchMap() {
|
|
775
|
-
_fetchMap = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee12(
|
|
776
|
-
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;
|
|
777
794
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
778
795
|
while (1) {
|
|
779
796
|
switch (_context12.prev = _context12.next) {
|
|
780
797
|
case 0:
|
|
781
|
-
cartoMapId =
|
|
798
|
+
cartoMapId = _ref11.cartoMapId, clientId = _ref11.clientId, credentials = _ref11.credentials, headers = _ref11.headers, autoRefresh = _ref11.autoRefresh, onNewData = _ref11.onNewData;
|
|
782
799
|
defaultCredentials = (0, _config.getDefaultCredentials)();
|
|
783
800
|
localCreds = _objectSpread(_objectSpread({}, defaultCredentials.apiVersion === _mapsApiCommon.API_VERSIONS.V3 && defaultCredentials), credentials);
|
|
784
801
|
accessToken = localCreds.accessToken;
|
|
@@ -797,14 +814,19 @@ function _fetchMap() {
|
|
|
797
814
|
}
|
|
798
815
|
|
|
799
816
|
url = "".concat(localCreds.mapsUrl, "/public/").concat(cartoMapId);
|
|
800
|
-
|
|
817
|
+
errorContext = {
|
|
818
|
+
requestType: _mapsApiCommon.REQUEST_TYPES.PUBLIC_MAP,
|
|
819
|
+
mapId: cartoMapId
|
|
820
|
+
};
|
|
821
|
+
_context12.next = 13;
|
|
801
822
|
return requestJson({
|
|
802
823
|
url: url,
|
|
803
824
|
headers: headers,
|
|
804
|
-
accessToken: accessToken
|
|
825
|
+
accessToken: accessToken,
|
|
826
|
+
errorContext: errorContext
|
|
805
827
|
});
|
|
806
828
|
|
|
807
|
-
case
|
|
829
|
+
case 13:
|
|
808
830
|
map = _context12.sent;
|
|
809
831
|
|
|
810
832
|
if (autoRefresh) {
|
|
@@ -839,39 +861,42 @@ function _fetchMap() {
|
|
|
839
861
|
};
|
|
840
862
|
}
|
|
841
863
|
|
|
842
|
-
geojsonLayers = map.keplerMapConfig.config.visState.layers.filter(function (
|
|
843
|
-
var type =
|
|
864
|
+
geojsonLayers = map.keplerMapConfig.config.visState.layers.filter(function (_ref15) {
|
|
865
|
+
var type = _ref15.type;
|
|
844
866
|
return type === 'geojson' || type === 'point';
|
|
845
867
|
});
|
|
846
|
-
geojsonDatasetIds = geojsonLayers.map(function (
|
|
847
|
-
var config =
|
|
868
|
+
geojsonDatasetIds = geojsonLayers.map(function (_ref16) {
|
|
869
|
+
var config = _ref16.config;
|
|
848
870
|
return config.dataId;
|
|
849
871
|
});
|
|
850
872
|
map.datasets.forEach(function (dataset) {
|
|
851
873
|
if (geojsonDatasetIds.includes(dataset.id)) {
|
|
852
|
-
var _geojsonLayers$find = geojsonLayers.find(function (
|
|
853
|
-
var config =
|
|
874
|
+
var _geojsonLayers$find = geojsonLayers.find(function (_ref17) {
|
|
875
|
+
var config = _ref17.config;
|
|
854
876
|
return config.dataId === dataset.id;
|
|
855
877
|
}),
|
|
856
878
|
config = _geojsonLayers$find.config;
|
|
857
879
|
|
|
858
880
|
dataset.format = 'geojson';
|
|
859
|
-
|
|
881
|
+
|
|
882
|
+
if (!dataset.geoColumn && config.columns.geojson) {
|
|
883
|
+
dataset.geoColumn = config.columns.geojson;
|
|
884
|
+
}
|
|
860
885
|
}
|
|
861
886
|
});
|
|
862
|
-
_context12.next =
|
|
887
|
+
_context12.next = 20;
|
|
863
888
|
return fillInMapDatasets(map, clientId, localCreds, headers);
|
|
864
889
|
|
|
865
|
-
case
|
|
866
|
-
_context12.next =
|
|
890
|
+
case 20:
|
|
891
|
+
_context12.next = 22;
|
|
867
892
|
return fillInTileStats(map, localCreds);
|
|
868
893
|
|
|
869
|
-
case
|
|
894
|
+
case 22:
|
|
870
895
|
return _context12.abrupt("return", _objectSpread(_objectSpread({}, (0, _parseMap.parseMap)(map)), {
|
|
871
896
|
stopAutoRefresh: stopAutoRefresh
|
|
872
897
|
}));
|
|
873
898
|
|
|
874
|
-
case
|
|
899
|
+
case 23:
|
|
875
900
|
case "end":
|
|
876
901
|
return _context12.stop();
|
|
877
902
|
}
|