@deck.gl/carto 9.0.0-beta.9 → 9.0.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/dist/api/request-with-parameters.d.ts.map +1 -1
- package/dist/api/request-with-parameters.js +29 -33
- package/dist/cartoRasterTile-worker.js +49 -14
- package/dist/cartoSpatialTile-worker.js +49 -14
- package/dist/cartoVectorTile-worker.js +49 -14
- package/dist/dist.dev.js +731 -591
- package/dist/index.cjs +26 -32
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
- package/dist/layers/vector-tile-layer.d.ts +1 -1
- package/dist/sources/index.d.ts +1 -0
- package/dist/sources/index.d.ts.map +1 -1
- package/dist.min.js +9 -9
- package/package.json +14 -14
- package/src/api/request-with-parameters.ts +36 -34
- package/src/index.ts +7 -3
- package/src/layers/vector-tile-layer.ts +2 -2
- package/src/sources/index.ts +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-with-parameters.d.ts","sourceRoot":"","sources":["../../src/api/request-with-parameters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,eAAe,EAAC,mBAAgB;AAU7C,wBAAsB,qBAAqB,CAAC,CAAC,GAAG,GAAG,EAAE,EACnD,WAAW,EACX,OAAO,EACP,UAAU,EACV,OAAO,EAAE,aAAa,EACtB,YAAY,EACb,EAAE;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,GAAG,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"request-with-parameters.d.ts","sourceRoot":"","sources":["../../src/api/request-with-parameters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,eAAe,EAAC,mBAAgB;AAU7C,wBAAsB,qBAAqB,CAAC,CAAC,GAAG,GAAG,EAAE,EACnD,WAAW,EACX,OAAO,EACP,UAAU,EACV,OAAO,EAAE,aAAa,EACtB,YAAY,EACb,EAAE;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,GAAG,OAAO,CAAC,CAAC,CAAC,CAqCb"}
|
|
@@ -12,46 +12,42 @@ export async function requestWithParameters({ accessToken, baseUrl, parameters,
|
|
|
12
12
|
if (REQUEST_CACHE.has(key)) {
|
|
13
13
|
return REQUEST_CACHE.get(key);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
if (parameters) {
|
|
17
|
-
const encodedParameters = Object.entries({ ...DEFAULT_PARAMETERS, ...parameters }).map(([key, value]) => {
|
|
18
|
-
return encodeParameter(key, value);
|
|
19
|
-
});
|
|
20
|
-
url += `?${encodedParameters.join('&')}`;
|
|
21
|
-
}
|
|
15
|
+
const url = parameters ? createURLWithParameters(baseUrl, parameters) : baseUrl;
|
|
22
16
|
const headers = { ...DEFAULT_HEADERS, ...customHeaders };
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
json.accessToken = accessToken;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
json = { error: '' };
|
|
17
|
+
/* global fetch */
|
|
18
|
+
const fetchPromise = url.length > MAX_GET_LENGTH
|
|
19
|
+
? fetch(baseUrl, { method: 'POST', body: JSON.stringify(parameters), headers })
|
|
20
|
+
: fetch(url, { headers });
|
|
21
|
+
let response;
|
|
22
|
+
const jsonPromise = fetchPromise
|
|
23
|
+
.then((_response) => {
|
|
24
|
+
response = _response;
|
|
25
|
+
return response.json();
|
|
26
|
+
})
|
|
27
|
+
.then((json) => {
|
|
28
|
+
if (!response || !response.ok) {
|
|
29
|
+
throw new Error(json.error);
|
|
41
30
|
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
throw new CartoAPIError(json.error, errorContext, response);
|
|
31
|
+
if (accessToken) {
|
|
32
|
+
json.accessToken = accessToken;
|
|
45
33
|
}
|
|
46
|
-
REQUEST_CACHE.set(key, json);
|
|
47
34
|
return json;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
})
|
|
36
|
+
.catch((error) => {
|
|
37
|
+
REQUEST_CACHE.delete(key);
|
|
38
|
+
throw new CartoAPIError(error, errorContext, response);
|
|
39
|
+
});
|
|
40
|
+
REQUEST_CACHE.set(key, jsonPromise);
|
|
41
|
+
return jsonPromise;
|
|
52
42
|
}
|
|
53
43
|
function createCacheKey(baseUrl, parameters, headers) {
|
|
54
44
|
const parameterEntries = Object.entries(parameters).sort(([a], [b]) => (a > b ? 1 : -1));
|
|
55
45
|
const headerEntries = Object.entries(headers).sort(([a], [b]) => (a > b ? 1 : -1));
|
|
56
46
|
return JSON.stringify({ baseUrl, parameters: parameterEntries, headers: headerEntries });
|
|
57
47
|
}
|
|
48
|
+
function createURLWithParameters(baseUrl, parameters) {
|
|
49
|
+
const encodedParameters = Object.entries({ ...DEFAULT_PARAMETERS, ...parameters }).map(([key, value]) => {
|
|
50
|
+
return encodeParameter(key, value);
|
|
51
|
+
});
|
|
52
|
+
return `${baseUrl}?${encodedParameters.join('&')}`;
|
|
53
|
+
}
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/
|
|
25
|
+
// ../../node_modules/ieee754/index.js
|
|
26
26
|
var require_ieee754 = __commonJS({
|
|
27
|
-
"../../node_modules/
|
|
27
|
+
"../../node_modules/ieee754/index.js"(exports) {
|
|
28
28
|
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
29
29
|
var e, m;
|
|
30
30
|
var eLen = nBytes * 8 - mLen - 1;
|
|
@@ -762,7 +762,9 @@
|
|
|
762
762
|
var parentPort = null;
|
|
763
763
|
|
|
764
764
|
// ../../node_modules/@loaders.gl/worker-utils/dist/lib/worker-utils/get-transfer-list.js
|
|
765
|
-
function getTransferList(object
|
|
765
|
+
function getTransferList(object) {
|
|
766
|
+
let recursive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
767
|
+
let transfers = arguments.length > 2 ? arguments[2] : void 0;
|
|
766
768
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
767
769
|
if (!object) {
|
|
768
770
|
} else if (isTransferable(object)) {
|
|
@@ -808,7 +810,10 @@
|
|
|
808
810
|
static set onmessage(onMessage) {
|
|
809
811
|
async function handleMessage(message) {
|
|
810
812
|
const parentPort2 = await getParentPort();
|
|
811
|
-
const {
|
|
813
|
+
const {
|
|
814
|
+
type,
|
|
815
|
+
payload
|
|
816
|
+
} = parentPort2 ? message : message.data;
|
|
812
817
|
onMessage(type, payload);
|
|
813
818
|
}
|
|
814
819
|
getParentPort().then((parentPort2) => {
|
|
@@ -828,7 +833,10 @@
|
|
|
828
833
|
return;
|
|
829
834
|
}
|
|
830
835
|
const parentPort3 = await getParentPort();
|
|
831
|
-
const {
|
|
836
|
+
const {
|
|
837
|
+
type,
|
|
838
|
+
payload
|
|
839
|
+
} = parentPort3 ? message : message.data;
|
|
832
840
|
onMessage(type, payload);
|
|
833
841
|
};
|
|
834
842
|
}
|
|
@@ -850,7 +858,11 @@
|
|
|
850
858
|
}
|
|
851
859
|
}
|
|
852
860
|
static async postMessage(type, payload) {
|
|
853
|
-
const data = {
|
|
861
|
+
const data = {
|
|
862
|
+
source: "loaders.gl",
|
|
863
|
+
type,
|
|
864
|
+
payload
|
|
865
|
+
};
|
|
854
866
|
const transferList = getTransferList(payload);
|
|
855
867
|
const parentPort2 = await getParentPort();
|
|
856
868
|
if (parentPort2) {
|
|
@@ -861,7 +873,10 @@
|
|
|
861
873
|
}
|
|
862
874
|
};
|
|
863
875
|
function isKnownMessage(message) {
|
|
864
|
-
const {
|
|
876
|
+
const {
|
|
877
|
+
type,
|
|
878
|
+
data
|
|
879
|
+
} = message;
|
|
865
880
|
return type === "message" && data && typeof data.source === "string" && data.source.startsWith("loaders.gl");
|
|
866
881
|
}
|
|
867
882
|
|
|
@@ -875,7 +890,11 @@
|
|
|
875
890
|
switch (type) {
|
|
876
891
|
case "process":
|
|
877
892
|
try {
|
|
878
|
-
const {
|
|
893
|
+
const {
|
|
894
|
+
input,
|
|
895
|
+
options = {},
|
|
896
|
+
context = {}
|
|
897
|
+
} = payload;
|
|
879
898
|
const result = await parseData({
|
|
880
899
|
loader,
|
|
881
900
|
arrayBuffer: input,
|
|
@@ -885,10 +904,14 @@
|
|
|
885
904
|
_parse: parseOnMainThread
|
|
886
905
|
}
|
|
887
906
|
});
|
|
888
|
-
WorkerBody.postMessage("done", {
|
|
907
|
+
WorkerBody.postMessage("done", {
|
|
908
|
+
result
|
|
909
|
+
});
|
|
889
910
|
} catch (error) {
|
|
890
911
|
const message = error instanceof Error ? error.message : "";
|
|
891
|
-
WorkerBody.postMessage("error", {
|
|
912
|
+
WorkerBody.postMessage("error", {
|
|
913
|
+
error: message
|
|
914
|
+
});
|
|
892
915
|
}
|
|
893
916
|
break;
|
|
894
917
|
default:
|
|
@@ -915,11 +938,21 @@
|
|
|
915
938
|
}
|
|
916
939
|
};
|
|
917
940
|
WorkerBody.addEventListener(onMessage);
|
|
918
|
-
const payload = {
|
|
941
|
+
const payload = {
|
|
942
|
+
id: id2,
|
|
943
|
+
input: arrayBuffer,
|
|
944
|
+
options
|
|
945
|
+
};
|
|
919
946
|
WorkerBody.postMessage("process", payload);
|
|
920
947
|
});
|
|
921
948
|
}
|
|
922
|
-
async function parseData(
|
|
949
|
+
async function parseData(_ref) {
|
|
950
|
+
let {
|
|
951
|
+
loader,
|
|
952
|
+
arrayBuffer,
|
|
953
|
+
options,
|
|
954
|
+
context
|
|
955
|
+
} = _ref;
|
|
923
956
|
let data;
|
|
924
957
|
let parser;
|
|
925
958
|
if (loader.parseSync || loader.parse) {
|
|
@@ -937,7 +970,9 @@
|
|
|
937
970
|
modules: loader && loader.options && loader.options.modules || {},
|
|
938
971
|
worker: false
|
|
939
972
|
};
|
|
940
|
-
return await parser(data, {
|
|
973
|
+
return await parser(data, {
|
|
974
|
+
...options
|
|
975
|
+
}, context, loader);
|
|
941
976
|
}
|
|
942
977
|
|
|
943
978
|
// src/layers/schema/fast-pbf.ts
|
|
@@ -1006,7 +1041,7 @@
|
|
|
1006
1041
|
}
|
|
1007
1042
|
|
|
1008
1043
|
// src/layers/schema/carto-raster-tile-loader.ts
|
|
1009
|
-
var VERSION = true ? "9.0.
|
|
1044
|
+
var VERSION = true ? "9.0.1" : "latest";
|
|
1010
1045
|
var id = "cartoRasterTile";
|
|
1011
1046
|
var DEFAULT_OPTIONS = {
|
|
1012
1047
|
cartoRasterTile: {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/
|
|
25
|
+
// ../../node_modules/ieee754/index.js
|
|
26
26
|
var require_ieee754 = __commonJS({
|
|
27
|
-
"../../node_modules/
|
|
27
|
+
"../../node_modules/ieee754/index.js"(exports) {
|
|
28
28
|
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
29
29
|
var e, m;
|
|
30
30
|
var eLen = nBytes * 8 - mLen - 1;
|
|
@@ -1088,7 +1088,9 @@
|
|
|
1088
1088
|
var parentPort = null;
|
|
1089
1089
|
|
|
1090
1090
|
// ../../node_modules/@loaders.gl/worker-utils/dist/lib/worker-utils/get-transfer-list.js
|
|
1091
|
-
function getTransferList(object
|
|
1091
|
+
function getTransferList(object) {
|
|
1092
|
+
let recursive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1093
|
+
let transfers = arguments.length > 2 ? arguments[2] : void 0;
|
|
1092
1094
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
1093
1095
|
if (!object) {
|
|
1094
1096
|
} else if (isTransferable(object)) {
|
|
@@ -1134,7 +1136,10 @@
|
|
|
1134
1136
|
static set onmessage(onMessage) {
|
|
1135
1137
|
async function handleMessage(message) {
|
|
1136
1138
|
const parentPort2 = await getParentPort();
|
|
1137
|
-
const {
|
|
1139
|
+
const {
|
|
1140
|
+
type,
|
|
1141
|
+
payload
|
|
1142
|
+
} = parentPort2 ? message : message.data;
|
|
1138
1143
|
onMessage(type, payload);
|
|
1139
1144
|
}
|
|
1140
1145
|
getParentPort().then((parentPort2) => {
|
|
@@ -1154,7 +1159,10 @@
|
|
|
1154
1159
|
return;
|
|
1155
1160
|
}
|
|
1156
1161
|
const parentPort3 = await getParentPort();
|
|
1157
|
-
const {
|
|
1162
|
+
const {
|
|
1163
|
+
type,
|
|
1164
|
+
payload
|
|
1165
|
+
} = parentPort3 ? message : message.data;
|
|
1158
1166
|
onMessage(type, payload);
|
|
1159
1167
|
};
|
|
1160
1168
|
}
|
|
@@ -1176,7 +1184,11 @@
|
|
|
1176
1184
|
}
|
|
1177
1185
|
}
|
|
1178
1186
|
static async postMessage(type, payload) {
|
|
1179
|
-
const data = {
|
|
1187
|
+
const data = {
|
|
1188
|
+
source: "loaders.gl",
|
|
1189
|
+
type,
|
|
1190
|
+
payload
|
|
1191
|
+
};
|
|
1180
1192
|
const transferList = getTransferList(payload);
|
|
1181
1193
|
const parentPort2 = await getParentPort();
|
|
1182
1194
|
if (parentPort2) {
|
|
@@ -1187,7 +1199,10 @@
|
|
|
1187
1199
|
}
|
|
1188
1200
|
};
|
|
1189
1201
|
function isKnownMessage(message) {
|
|
1190
|
-
const {
|
|
1202
|
+
const {
|
|
1203
|
+
type,
|
|
1204
|
+
data
|
|
1205
|
+
} = message;
|
|
1191
1206
|
return type === "message" && data && typeof data.source === "string" && data.source.startsWith("loaders.gl");
|
|
1192
1207
|
}
|
|
1193
1208
|
|
|
@@ -1201,7 +1216,11 @@
|
|
|
1201
1216
|
switch (type) {
|
|
1202
1217
|
case "process":
|
|
1203
1218
|
try {
|
|
1204
|
-
const {
|
|
1219
|
+
const {
|
|
1220
|
+
input,
|
|
1221
|
+
options = {},
|
|
1222
|
+
context = {}
|
|
1223
|
+
} = payload;
|
|
1205
1224
|
const result = await parseData({
|
|
1206
1225
|
loader,
|
|
1207
1226
|
arrayBuffer: input,
|
|
@@ -1211,10 +1230,14 @@
|
|
|
1211
1230
|
_parse: parseOnMainThread
|
|
1212
1231
|
}
|
|
1213
1232
|
});
|
|
1214
|
-
WorkerBody.postMessage("done", {
|
|
1233
|
+
WorkerBody.postMessage("done", {
|
|
1234
|
+
result
|
|
1235
|
+
});
|
|
1215
1236
|
} catch (error) {
|
|
1216
1237
|
const message = error instanceof Error ? error.message : "";
|
|
1217
|
-
WorkerBody.postMessage("error", {
|
|
1238
|
+
WorkerBody.postMessage("error", {
|
|
1239
|
+
error: message
|
|
1240
|
+
});
|
|
1218
1241
|
}
|
|
1219
1242
|
break;
|
|
1220
1243
|
default:
|
|
@@ -1241,11 +1264,21 @@
|
|
|
1241
1264
|
}
|
|
1242
1265
|
};
|
|
1243
1266
|
WorkerBody.addEventListener(onMessage);
|
|
1244
|
-
const payload = {
|
|
1267
|
+
const payload = {
|
|
1268
|
+
id: id2,
|
|
1269
|
+
input: arrayBuffer,
|
|
1270
|
+
options
|
|
1271
|
+
};
|
|
1245
1272
|
WorkerBody.postMessage("process", payload);
|
|
1246
1273
|
});
|
|
1247
1274
|
}
|
|
1248
|
-
async function parseData(
|
|
1275
|
+
async function parseData(_ref) {
|
|
1276
|
+
let {
|
|
1277
|
+
loader,
|
|
1278
|
+
arrayBuffer,
|
|
1279
|
+
options,
|
|
1280
|
+
context
|
|
1281
|
+
} = _ref;
|
|
1249
1282
|
let data;
|
|
1250
1283
|
let parser;
|
|
1251
1284
|
if (loader.parseSync || loader.parse) {
|
|
@@ -1263,7 +1296,9 @@
|
|
|
1263
1296
|
modules: loader && loader.options && loader.options.modules || {},
|
|
1264
1297
|
worker: false
|
|
1265
1298
|
};
|
|
1266
|
-
return await parser(data, {
|
|
1299
|
+
return await parser(data, {
|
|
1300
|
+
...options
|
|
1301
|
+
}, context, loader);
|
|
1267
1302
|
}
|
|
1268
1303
|
|
|
1269
1304
|
// src/layers/schema/fast-pbf.ts
|
|
@@ -1395,7 +1430,7 @@
|
|
|
1395
1430
|
}
|
|
1396
1431
|
|
|
1397
1432
|
// src/layers/schema/carto-spatial-tile-loader.ts
|
|
1398
|
-
var VERSION = true ? "9.0.
|
|
1433
|
+
var VERSION = true ? "9.0.1" : "latest";
|
|
1399
1434
|
var id = "cartoSpatialTile";
|
|
1400
1435
|
var DEFAULT_OPTIONS = {
|
|
1401
1436
|
cartoSpatialTile: {
|
|
@@ -485,9 +485,9 @@
|
|
|
485
485
|
}
|
|
486
486
|
});
|
|
487
487
|
|
|
488
|
-
// ../../node_modules/
|
|
488
|
+
// ../../node_modules/ieee754/index.js
|
|
489
489
|
var require_ieee754 = __commonJS({
|
|
490
|
-
"../../node_modules/
|
|
490
|
+
"../../node_modules/ieee754/index.js"(exports) {
|
|
491
491
|
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
492
492
|
var e, m;
|
|
493
493
|
var eLen = nBytes * 8 - mLen - 1;
|
|
@@ -1225,7 +1225,9 @@
|
|
|
1225
1225
|
var parentPort = null;
|
|
1226
1226
|
|
|
1227
1227
|
// ../../node_modules/@loaders.gl/worker-utils/dist/lib/worker-utils/get-transfer-list.js
|
|
1228
|
-
function getTransferList(object
|
|
1228
|
+
function getTransferList(object) {
|
|
1229
|
+
let recursive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1230
|
+
let transfers = arguments.length > 2 ? arguments[2] : void 0;
|
|
1229
1231
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
1230
1232
|
if (!object) {
|
|
1231
1233
|
} else if (isTransferable(object)) {
|
|
@@ -1271,7 +1273,10 @@
|
|
|
1271
1273
|
static set onmessage(onMessage) {
|
|
1272
1274
|
async function handleMessage(message) {
|
|
1273
1275
|
const parentPort2 = await getParentPort();
|
|
1274
|
-
const {
|
|
1276
|
+
const {
|
|
1277
|
+
type,
|
|
1278
|
+
payload
|
|
1279
|
+
} = parentPort2 ? message : message.data;
|
|
1275
1280
|
onMessage(type, payload);
|
|
1276
1281
|
}
|
|
1277
1282
|
getParentPort().then((parentPort2) => {
|
|
@@ -1291,7 +1296,10 @@
|
|
|
1291
1296
|
return;
|
|
1292
1297
|
}
|
|
1293
1298
|
const parentPort3 = await getParentPort();
|
|
1294
|
-
const {
|
|
1299
|
+
const {
|
|
1300
|
+
type,
|
|
1301
|
+
payload
|
|
1302
|
+
} = parentPort3 ? message : message.data;
|
|
1295
1303
|
onMessage(type, payload);
|
|
1296
1304
|
};
|
|
1297
1305
|
}
|
|
@@ -1313,7 +1321,11 @@
|
|
|
1313
1321
|
}
|
|
1314
1322
|
}
|
|
1315
1323
|
static async postMessage(type, payload) {
|
|
1316
|
-
const data = {
|
|
1324
|
+
const data = {
|
|
1325
|
+
source: "loaders.gl",
|
|
1326
|
+
type,
|
|
1327
|
+
payload
|
|
1328
|
+
};
|
|
1317
1329
|
const transferList = getTransferList(payload);
|
|
1318
1330
|
const parentPort2 = await getParentPort();
|
|
1319
1331
|
if (parentPort2) {
|
|
@@ -1324,7 +1336,10 @@
|
|
|
1324
1336
|
}
|
|
1325
1337
|
};
|
|
1326
1338
|
function isKnownMessage(message) {
|
|
1327
|
-
const {
|
|
1339
|
+
const {
|
|
1340
|
+
type,
|
|
1341
|
+
data
|
|
1342
|
+
} = message;
|
|
1328
1343
|
return type === "message" && data && typeof data.source === "string" && data.source.startsWith("loaders.gl");
|
|
1329
1344
|
}
|
|
1330
1345
|
|
|
@@ -1338,7 +1353,11 @@
|
|
|
1338
1353
|
switch (type) {
|
|
1339
1354
|
case "process":
|
|
1340
1355
|
try {
|
|
1341
|
-
const {
|
|
1356
|
+
const {
|
|
1357
|
+
input,
|
|
1358
|
+
options = {},
|
|
1359
|
+
context = {}
|
|
1360
|
+
} = payload;
|
|
1342
1361
|
const result = await parseData({
|
|
1343
1362
|
loader,
|
|
1344
1363
|
arrayBuffer: input,
|
|
@@ -1348,10 +1367,14 @@
|
|
|
1348
1367
|
_parse: parseOnMainThread
|
|
1349
1368
|
}
|
|
1350
1369
|
});
|
|
1351
|
-
WorkerBody.postMessage("done", {
|
|
1370
|
+
WorkerBody.postMessage("done", {
|
|
1371
|
+
result
|
|
1372
|
+
});
|
|
1352
1373
|
} catch (error) {
|
|
1353
1374
|
const message = error instanceof Error ? error.message : "";
|
|
1354
|
-
WorkerBody.postMessage("error", {
|
|
1375
|
+
WorkerBody.postMessage("error", {
|
|
1376
|
+
error: message
|
|
1377
|
+
});
|
|
1355
1378
|
}
|
|
1356
1379
|
break;
|
|
1357
1380
|
default:
|
|
@@ -1378,11 +1401,21 @@
|
|
|
1378
1401
|
}
|
|
1379
1402
|
};
|
|
1380
1403
|
WorkerBody.addEventListener(onMessage);
|
|
1381
|
-
const payload = {
|
|
1404
|
+
const payload = {
|
|
1405
|
+
id: id2,
|
|
1406
|
+
input: arrayBuffer,
|
|
1407
|
+
options
|
|
1408
|
+
};
|
|
1382
1409
|
WorkerBody.postMessage("process", payload);
|
|
1383
1410
|
});
|
|
1384
1411
|
}
|
|
1385
|
-
async function parseData(
|
|
1412
|
+
async function parseData(_ref) {
|
|
1413
|
+
let {
|
|
1414
|
+
loader,
|
|
1415
|
+
arrayBuffer,
|
|
1416
|
+
options,
|
|
1417
|
+
context
|
|
1418
|
+
} = _ref;
|
|
1386
1419
|
let data;
|
|
1387
1420
|
let parser;
|
|
1388
1421
|
if (loader.parseSync || loader.parse) {
|
|
@@ -1400,7 +1433,9 @@
|
|
|
1400
1433
|
modules: loader && loader.options && loader.options.modules || {},
|
|
1401
1434
|
worker: false
|
|
1402
1435
|
};
|
|
1403
|
-
return await parser(data, {
|
|
1436
|
+
return await parser(data, {
|
|
1437
|
+
...options
|
|
1438
|
+
}, context, loader);
|
|
1404
1439
|
}
|
|
1405
1440
|
|
|
1406
1441
|
// src/layers/schema/carto-vector-tile-loader.ts
|
|
@@ -1623,7 +1658,7 @@
|
|
|
1623
1658
|
}
|
|
1624
1659
|
|
|
1625
1660
|
// src/layers/schema/carto-vector-tile-loader.ts
|
|
1626
|
-
var VERSION = true ? "9.0.
|
|
1661
|
+
var VERSION = true ? "9.0.1" : "latest";
|
|
1627
1662
|
var id = "cartoVectorTile";
|
|
1628
1663
|
var DEFAULT_OPTIONS = {
|
|
1629
1664
|
cartoVectorTile: {
|