kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
466 lines (457 loc) • 59.9 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.resetProviderStatusUpdater = exports.postSaveLoadSuccessUpdater = exports.loadCloudMapUpdater = exports.loadCloudMapSuccessUpdater = exports.loadCloudMapSuccess2Updater = exports.loadCloudMapErrorUpdater = exports.exportFileToCloudUpdater = exports.exportFileSuccessUpdater = exports.exportFileErrorUpdater = exports.INITIAL_PROVIDER_STATE = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _tasks = _interopRequireWildcard(require("react-palm/tasks"));
var _console = _interopRequireDefault(require("global/console"));
var _utils = require("@kepler.gl/utils");
var _commonUtils = require("@kepler.gl/common-utils");
var _tasks2 = require("@kepler.gl/tasks");
var _actions = require("@kepler.gl/actions");
var _constants = require("@kepler.gl/constants");
var _cloudProviders = require("@kepler.gl/cloud-providers");
var _processors = require("@kepler.gl/processors");
var _table = require("@kepler.gl/table");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
var INITIAL_PROVIDER_STATE = exports.INITIAL_PROVIDER_STATE = {
isProviderLoading: false,
isCloudMapLoading: false,
providerError: null,
currentProvider: null,
successInfo: {},
mapSaved: null,
savedMapId: null,
visualizations: []
};
function createActionTask(action, payload) {
if (typeof action === 'function') {
return (0, _tasks2.ACTION_TASK)().map(function () {
return action(payload);
});
}
return null;
}
function _validateProvider(provider, method) {
if (!provider) {
_console["default"].error("provider is not defined");
return false;
}
if (typeof provider[method] !== 'function') {
_console["default"].error("".concat(method, " is not a function of Cloud provider: ").concat(provider.name));
return false;
}
return true;
}
function createGlobalNotificationTasks(_ref) {
var type = _ref.type,
message = _ref.message,
_ref$delayClose = _ref.delayClose,
delayClose = _ref$delayClose === void 0 ? true : _ref$delayClose;
var id = (0, _commonUtils.generateHashId)();
var successNote = {
id: id,
type: _constants.DEFAULT_NOTIFICATION_TYPES[type || ''] || _constants.DEFAULT_NOTIFICATION_TYPES.success,
topic: _constants.DEFAULT_NOTIFICATION_TOPICS.global,
message: message
};
var task = (0, _tasks2.ACTION_TASK)().map(function () {
return (0, _actions.addNotification)(successNote);
});
return delayClose ? [task, (0, _tasks2.DELAY_TASK)(3000).map(function () {
return (0, _actions.removeNotification)(id);
})] : [task];
}
/**
* This method will export the current kepler config file to the chosen cloud proder
* add returns a share URL
*
*/
var exportFileToCloudUpdater = exports.exportFileToCloudUpdater = function exportFileToCloudUpdater(state, action) {
var _action$payload = action.payload,
mapData = _action$payload.mapData,
provider = _action$payload.provider,
_action$payload$optio = _action$payload.options,
options = _action$payload$optio === void 0 ? {} : _action$payload$optio,
onSuccess = _action$payload.onSuccess,
onError = _action$payload.onError,
closeModal = _action$payload.closeModal;
if (!_validateProvider(provider, 'uploadMap')) {
return state;
}
var newState = _objectSpread(_objectSpread({}, state), {}, {
isProviderLoading: true,
currentProvider: provider.name
});
// payload called by provider.uploadMap
var payload = {
mapData: mapData,
options: options
};
var uploadFileTask = (0, _tasks2.EXPORT_FILE_TO_CLOUD_TASK)({
provider: provider,
payload: payload
}).bimap(
// success
function (response) {
return (0, _actions.exportFileSuccess)({
response: response,
provider: provider,
options: options,
onSuccess: onSuccess,
closeModal: closeModal
});
},
// error
function (error) {
return (0, _actions.exportFileError)({
error: error,
provider: provider,
options: options,
onError: onError
});
});
return (0, _tasks.withTask)(newState, uploadFileTask);
};
var exportFileSuccessUpdater = exports.exportFileSuccessUpdater = function exportFileSuccessUpdater(state, action) {
var _response$info$id, _response$info;
var _action$payload2 = action.payload,
response = _action$payload2.response,
provider = _action$payload2.provider,
_action$payload2$opti = _action$payload2.options,
options = _action$payload2$opti === void 0 ? {} : _action$payload2$opti,
onSuccess = _action$payload2.onSuccess,
closeModal = _action$payload2.closeModal;
var newState = _objectSpread(_objectSpread({}, state), {}, {
isProviderLoading: false,
// TODO: do we always have to store this?
successInfo: response
}, !options.isPublic ? {
mapSaved: provider.name,
savedMapId: (_response$info$id = response === null || response === void 0 || (_response$info = response.info) === null || _response$info === void 0 ? void 0 : _response$info.id) !== null && _response$info$id !== void 0 ? _response$info$id : null
} : {});
var tasks = [createActionTask(onSuccess, {
response: response,
provider: provider,
options: options
}), closeModal && (0, _tasks2.ACTION_TASK)().map(function () {
return (0, _actions.postSaveLoadSuccess)("Map saved to ".concat(state.currentProvider, "!"));
})].filter(function (d) {
return d;
});
return tasks.length ? (0, _tasks.withTask)(newState, tasks) : newState;
};
/**
* Close modal on success and display notification
*/
var postSaveLoadSuccessUpdater = exports.postSaveLoadSuccessUpdater = function postSaveLoadSuccessUpdater(state, action) {
var message = action.payload || "Saved / Load to ".concat(state.currentProvider, " Success");
var tasks = [(0, _tasks2.ACTION_TASK)().map(function () {
return (0, _actions.toggleModal)(null);
}), (0, _tasks2.ACTION_TASK)().map(function () {
return (0, _actions.resetProviderStatus)();
})].concat((0, _toConsumableArray2["default"])(createGlobalNotificationTasks({
message: message
})));
return (0, _tasks.withTask)(state, tasks);
};
var exportFileErrorUpdater = exports.exportFileErrorUpdater = function exportFileErrorUpdater(state, action) {
var _action$payload3 = action.payload,
error = _action$payload3.error,
provider = _action$payload3.provider,
onError = _action$payload3.onError;
var newState = _objectSpread(_objectSpread({}, state), {}, {
isProviderLoading: false
});
if (isFileConflict(error)) {
newState.mapSaved = provider.name;
return (0, _tasks.withTask)(newState, [(0, _tasks2.ACTION_TASK)().map(function () {
return (0, _actions.toggleModal)(_constants.OVERWRITE_MAP_ID);
})]);
}
newState.providerError = (0, _utils.getError)(error);
var task = createActionTask(onError, {
error: error,
provider: provider
});
return task ? (0, _tasks.withTask)(newState, task) : newState;
};
var loadCloudMapUpdater = exports.loadCloudMapUpdater = function loadCloudMapUpdater(state, action) {
var _action$payload4 = action.payload,
loadParams = _action$payload4.loadParams,
provider = _action$payload4.provider,
onSuccess = _action$payload4.onSuccess,
onError = _action$payload4.onError;
if (!loadParams) {
_console["default"].warn('load map error: loadParams is undefined');
return state;
}
if (!_validateProvider(provider, 'downloadMap')) {
return state;
}
var newState = _objectSpread(_objectSpread({}, state), {}, {
isProviderLoading: true,
isCloudMapLoading: true
});
// payload called by provider.downloadMap
var uploadFileTask = (0, _tasks2.LOAD_CLOUD_MAP_TASK)({
provider: provider,
payload: loadParams
}).bimap(
// success
// @ts-expect-error
function (response) {
return (0, _actions.loadCloudMapSuccess)({
response: response,
loadParams: loadParams,
provider: provider,
onSuccess: onSuccess,
onError: onError
});
},
// error
// @ts-expect-error
function (error) {
return (0, _actions.loadCloudMapError)({
error: error,
provider: provider,
onError: onError
});
});
return (0, _tasks.withTask)(newState, uploadFileTask);
};
function isFileConflict(error) {
return error && error.message === _cloudProviders.FILE_CONFLICT_MSG;
}
function checkLoadMapResponseError(response) {
if (!response || !(0, _utils.isPlainObject)(response)) {
return new Error('Load map response is empty');
}
if (!(0, _utils.isPlainObject)(response.map)) {
return new Error("Load map response should be an object property \"map\"");
}
if (!response.map.datasets || !response.map.config) {
return new Error("Load map response.map should be an object with property datasets or config");
}
return null;
}
function getDatasetHandler(format) {
var _getApplicationConfig;
var defaultHandler = _processors.DATASET_HANDLERS[_constants.DATASET_FORMATS.csv];
if (!format) {
_console["default"].warn('format is not provided in load map response, will use csv by default');
return defaultHandler;
}
// use custom processors from table class
var TableClass = (_getApplicationConfig = (0, _utils.getApplicationConfig)().table) !== null && _getApplicationConfig !== void 0 ? _getApplicationConfig : _table.KeplerTable;
if (typeof TableClass.getFileProcessor === 'function') {
var processorResult = TableClass.getFileProcessor(null, format);
if (!processorResult.processor) {
_console["default"].warn("No processor found for format ".concat(format, ", will use csv by default"));
return defaultHandler;
}
return processorResult.processor;
}
if (!_processors.DATASET_HANDLERS[format]) {
var supportedFormat = Object.keys(_constants.DATASET_FORMATS).map(function (k) {
return "'".concat(k, "'");
}).join(', ');
_console["default"].warn("unknown format ".concat(format, ". Please use one of ").concat(supportedFormat, ", will use csv by default"));
return defaultHandler;
}
return _processors.DATASET_HANDLERS[format];
}
/**
* A task to handle async processorMethod
* @param param0
* @returns
*/
function parseLoadMapResponseTask(_x) {
return _parseLoadMapResponseTask.apply(this, arguments);
}
function _parseLoadMapResponseTask() {
_parseLoadMapResponseTask = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref2) {
var response, loadParams, provider, map, format, processorMethod, parsedDatasets, parsedMap, datasets, info;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
response = _ref2.response, loadParams = _ref2.loadParams, provider = _ref2.provider;
map = response.map, format = response.format;
processorMethod = getDatasetHandler(format);
parsedDatasets = [];
if (!(format === _constants.DATASET_FORMATS.keplergl && processorMethod !== _processors.DATASET_HANDLERS[_constants.DATASET_FORMATS.keplergl])) {
_context2.next = 11;
break;
}
_context2.next = 7;
return processorMethod(map);
case 7:
parsedMap = _context2.sent;
parsedDatasets = parsedMap.datasets;
_context2.next = 15;
break;
case 11:
datasets = (0, _commonUtils.toArray)(map.datasets);
_context2.next = 14;
return Promise.all(datasets.map( /*#__PURE__*/function () {
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(ds) {
var info, data;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!(format === _constants.DATASET_FORMATS.keplergl)) {
_context.next = 4;
break;
}
_context.next = 3;
return processorMethod(ds);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
info = ds && ds.info || {
id: (0, _commonUtils.generateHashId)(6)
};
_context.next = 7;
return processorMethod(ds.data || ds);
case 7:
data = _context.sent;
return _context.abrupt("return", {
info: info,
data: data
});
case 9:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x2) {
return _ref3.apply(this, arguments);
};
}()));
case 14:
parsedDatasets = _context2.sent;
case 15:
info = _objectSpread(_objectSpread({}, map.info), {}, {
provider: provider.name,
loadParams: loadParams
});
return _context2.abrupt("return", _objectSpread(_objectSpread({
datasets: parsedDatasets,
info: info
}, map.config ? {
config: map.config
} : {}), {}, {
options: {
// do not center map when loading cloud map
centerMap: false
}
}));
case 17:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _parseLoadMapResponseTask.apply(this, arguments);
}
var PARSE_LOAD_MAP_RESPONSE_TASK = _tasks["default"].fromPromise(parseLoadMapResponseTask, 'PARSE_LOAD_MAP_RESPONSE_TASK');
/**
* Used to load resources stored in a private storage.
*/
var loadCloudMapSuccessUpdater = exports.loadCloudMapSuccessUpdater = function loadCloudMapSuccessUpdater(state, action) {
var _action$payload5 = action.payload,
response = _action$payload5.response,
loadParams = _action$payload5.loadParams,
provider = _action$payload5.provider,
onError = _action$payload5.onError;
var formatError = checkLoadMapResponseError(response);
if (formatError) {
// if response format is not correct
return exportFileErrorUpdater(state, {
payload: {
error: formatError,
provider: provider,
onError: onError
}
});
}
// processorMethod can be async so create a task
var parseLoadMapResponseTask = PARSE_LOAD_MAP_RESPONSE_TASK({
response: response,
loadParams: loadParams,
provider: provider
}).bimap(function (datasetsPayload) {
return (0, _actions.loadCloudMapSuccess2)(_objectSpread(_objectSpread({}, action.payload), {}, {
datasetsPayload: datasetsPayload
}));
}, function (error) {
return exportFileErrorUpdater(state, {
payload: {
error: error,
provider: provider,
onError: onError
}
});
});
return (0, _tasks.withTask)(state, parseLoadMapResponseTask);
};
var loadCloudMapSuccess2Updater = exports.loadCloudMapSuccess2Updater = function loadCloudMapSuccess2Updater(state, action) {
var _action$payload6 = action.payload,
datasetsPayload = _action$payload6.datasetsPayload,
response = _action$payload6.response,
loadParams = _action$payload6.loadParams,
provider = _action$payload6.provider,
onSuccess = _action$payload6.onSuccess;
var newState = _objectSpread(_objectSpread({}, state), {}, {
mapSaved: provider.name,
currentProvider: provider.name,
isCloudMapLoading: false,
isProviderLoading: false
});
var tasks = [(0, _tasks2.ACTION_TASK)().map(function () {
return (0, _actions.addDataToMap)(datasetsPayload);
}), createActionTask(onSuccess, {
response: response,
loadParams: loadParams,
provider: provider
}), (0, _tasks2.ACTION_TASK)().map(function () {
return (0, _actions.postSaveLoadSuccess)("Map from ".concat(provider.name, " loaded"));
})].filter(function (d) {
return d;
});
return tasks.length ? (0, _tasks.withTask)(newState, tasks) : newState;
};
var loadCloudMapErrorUpdater = exports.loadCloudMapErrorUpdater = function loadCloudMapErrorUpdater(state, action) {
var message = (0, _utils.getError)(action.payload.error) || "Error loading saved map";
_console["default"].warn(message);
var newState = _objectSpread(_objectSpread({}, state), {}, {
isProviderLoading: false,
isCloudMapLoading: false,
providerError: null
});
return (0, _tasks.withTask)(newState, createGlobalNotificationTasks({
type: 'error',
message: message,
delayClose: false
}));
};
var resetProviderStatusUpdater = exports.resetProviderStatusUpdater = function resetProviderStatusUpdater(state) {
return _objectSpread(_objectSpread({}, state), {}, {
isProviderLoading: false,
providerError: null,
isCloudMapLoading: false,
successInfo: {}
});
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfdGFza3MiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfY29uc29sZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfdXRpbHMiLCJfY29tbW9uVXRpbHMiLCJfdGFza3MyIiwiX2FjdGlvbnMiLCJfY29uc3RhbnRzIiwiX2Nsb3VkUHJvdmlkZXJzIiwiX3Byb2Nlc3NvcnMiLCJfdGFibGUiLCJfZ2V0UmVxdWlyZVdpbGRjYXJkQ2FjaGUiLCJlIiwiV2Vha01hcCIsInIiLCJ0IiwiX19lc01vZHVsZSIsIl90eXBlb2YiLCJoYXMiLCJnZXQiLCJuIiwiX19wcm90b19fIiwiYSIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwidSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImkiLCJzZXQiLCJvd25LZXlzIiwia2V5cyIsImdldE93blByb3BlcnR5U3ltYm9scyIsIm8iLCJmaWx0ZXIiLCJlbnVtZXJhYmxlIiwicHVzaCIsImFwcGx5IiwiX29iamVjdFNwcmVhZCIsImFyZ3VtZW50cyIsImxlbmd0aCIsImZvckVhY2giLCJfZGV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