mirror of
https://github.com/google/earthengine-api.git
synced 2025-12-08 19:26:12 +00:00
v0.1.369
PiperOrigin-RevId: 563532158
This commit is contained in:
parent
cada8136b9
commit
1baca8818e
27
CONTRIBUTING
27
CONTRIBUTING
@ -1,26 +1 @@
|
||||
All contributors to the Earth Engine API libraries must sign a CLA.
|
||||
|
||||
What is a CLA?
|
||||
----------------------------------------
|
||||
|
||||
A CLA (Contributor License Agreement) basically says that you own the
|
||||
rights to any code you contribute, and that you give us permission to
|
||||
use that code in the Earth Engine API libraries. You maintain the
|
||||
copyright on that code.
|
||||
|
||||
Where do I sign up?
|
||||
----------------------------------------
|
||||
|
||||
If you own all the rights to your code, you can fill out an individual CLA.
|
||||
http://code.google.com/legal/individual-cla-v1.0.html
|
||||
|
||||
If your employer has any rights to your code, then they also need to fill
|
||||
out a corporate CLA. If you don't know if your employer has any rights
|
||||
to your code, you should ask before signing anything.
|
||||
http://code.google.com/legal/corporate-cla-v1.0.html
|
||||
|
||||
CLA Signers
|
||||
----------------------------------------
|
||||
|
||||
By default, anyone with an @google.com email address already has a CLA
|
||||
signed for them. Congratulations!
|
||||
The Earth Engine API clients are not currently accepting pull requests.
|
||||
|
||||
11
README.md
11
README.md
@ -1,5 +1,4 @@
|
||||
Google Earth Engine API
|
||||
=======================
|
||||
# Google Earth Engine API
|
||||
|
||||
Python and JavaScript client libraries for calling the Google Earth Engine API.
|
||||
|
||||
@ -39,3 +38,11 @@ Map.addLayer(
|
||||
{min: 0, max: [0.18, 20, -0.18], bands: ['scale', 'offset', 'scale']},
|
||||
'stable lights trend');
|
||||
```
|
||||
|
||||
## NOTICE
|
||||
|
||||
In order to be more responsive to bug reports and feature requests, we are
|
||||
currently using the Google Issue Tracker rather than the GitHub Issue tracker.
|
||||
Please see the [Get Help](https://developers.google.com/earth-engine/help) page
|
||||
of the Earth Engine documentation for details on how to browse and submit issues
|
||||
to Issue Tracker.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,4 @@
|
||||
/*
|
||||
|
||||
Copyright The Closure Library Authors.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var isChrome87, $jscomp = $jscomp || {};
|
||||
var $jscomp = $jscomp || {};
|
||||
$jscomp.scope = {};
|
||||
$jscomp.arrayIteratorImpl = function(array) {
|
||||
var index = 0;
|
||||
@ -1205,7 +1200,13 @@ $jscomp.polyfill("String.prototype.padStart", function(orig) {
|
||||
return $jscomp.stringPadding(opt_padString, targetLength - string.length) + string;
|
||||
};
|
||||
}, "es8", "es3");
|
||||
var goog = goog || {};
|
||||
var CLOSURE_TOGGLE_ORDINALS = {GoogFlags__async_throw_on_unicode_to_byte__enable:!1, GoogFlags__client_only_wiz_attribute_sanitization__enable:!1, GoogFlags__override_disable_toggles:!1, GoogFlags__testonly_debug_flag__enable:!1, GoogFlags__testonly_disabled_flag__enable:!1, GoogFlags__testonly_stable_flag__disable:!1, GoogFlags__testonly_staging_flag__disable:!1, GoogFlags__use_toggles:!1, GoogFlags__use_user_agent_client_hints__enable:!1};
|
||||
/*
|
||||
|
||||
Copyright The Closure Library Authors.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var isChrome87, goog = goog || {};
|
||||
goog.global = this || self;
|
||||
goog.exportPath_ = function(name, object, overwriteImplicit, objectToExportTo) {
|
||||
var parts = name.split("."), cur = objectToExportTo || goog.global;
|
||||
@ -2620,6 +2621,10 @@ goog.events.BrowserFeature = {TOUCH_ENABLED:"ontouchstart" in goog.global || !!(
|
||||
}
|
||||
return passive;
|
||||
})};
|
||||
goog.labs = {};
|
||||
goog.labs.userAgent = {};
|
||||
goog.labs.userAgent.chromiumRebrands = {};
|
||||
goog.labs.userAgent.chromiumRebrands.ChromiumRebrand = {GOOGLE_CHROME:"Google Chrome", BRAVE:"Brave", OPERA:"Opera", EDGE:"Microsoft Edge"};
|
||||
var module$exports$tslib = {}, module$contents$tslib_extendStatics = Object.setPrototypeOf || function(d, b) {
|
||||
for (var p in b) {
|
||||
Object.prototype.hasOwnProperty.call(b, p) && (d[p] = b[p]);
|
||||
@ -2967,13 +2972,11 @@ goog.flags = {};
|
||||
var module$contents$goog$flags_STAGING = goog.readFlagInternalDoNotUseOrElse(1, goog.FLAGS_STAGING_DEFAULT);
|
||||
goog.flags.USE_USER_AGENT_CLIENT_HINTS = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_user_agent_client_hints__enable : goog.readFlagInternalDoNotUseOrElse(610401301, !1);
|
||||
goog.flags.ASYNC_THROW_ON_UNICODE_TO_BYTE = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__async_throw_on_unicode_to_byte__enable : goog.readFlagInternalDoNotUseOrElse(899588437, !1);
|
||||
goog.flags.CLIENT_ONLY_WIZ_ATTRIBUTE_SANITIZATION = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__client_only_wiz_attribute_sanitization__enable : goog.readFlagInternalDoNotUseOrElse(533565600, !1);
|
||||
goog.flags.CLIENT_ONLY_WIZ_ATTRIBUTE_SANITIZATION = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? goog.DEBUG || module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__client_only_wiz_attribute_sanitization__enable : goog.readFlagInternalDoNotUseOrElse(533565600, goog.DEBUG);
|
||||
goog.flags.TESTONLY_DISABLED_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_disabled_flag__enable : goog.readFlagInternalDoNotUseOrElse(2147483644, !1);
|
||||
goog.flags.TESTONLY_DEBUG_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? goog.DEBUG || module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_debug_flag__enable : goog.readFlagInternalDoNotUseOrElse(2147483645, goog.DEBUG);
|
||||
goog.flags.TESTONLY_STAGING_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? goog.FLAGS_STAGING_DEFAULT && (module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__override_disable_toggles || !module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_staging_flag__disable) : goog.readFlagInternalDoNotUseOrElse(2147483646, module$contents$goog$flags_STAGING);
|
||||
goog.flags.TESTONLY_STABLE_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__override_disable_toggles || !module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_stable_flag__disable : goog.readFlagInternalDoNotUseOrElse(2147483647, !0);
|
||||
goog.labs = {};
|
||||
goog.labs.userAgent = {};
|
||||
var module$contents$goog$labs$userAgent_forceClientHintsInTests = !1;
|
||||
goog.labs.userAgent.setUseClientHintsForTesting = function(use) {
|
||||
module$contents$goog$labs$userAgent_forceClientHintsInTests = use;
|
||||
@ -3193,6 +3196,7 @@ module$exports$goog$labs$userAgent$highEntropy$highEntropyData.platformVersion =
|
||||
goog.labs.userAgent.browser = {};
|
||||
var module$contents$goog$labs$userAgent$browser_Brand = {ANDROID_BROWSER:"Android Browser", CHROMIUM:"Chromium", EDGE:"Microsoft Edge", FIREFOX:"Firefox", IE:"Internet Explorer", OPERA:"Opera", SAFARI:"Safari", SILK:"Silk"};
|
||||
goog.labs.userAgent.browser.Brand = module$contents$goog$labs$userAgent$browser_Brand;
|
||||
var module$contents$goog$labs$userAgent$browser_AllBrandsInternal;
|
||||
function module$contents$goog$labs$userAgent$browser_useUserAgentDataBrand(ignoreClientHintsFlag) {
|
||||
if (!(void 0 !== ignoreClientHintsFlag && ignoreClientHintsFlag || (0,goog.labs.userAgent.useClientHints)())) {
|
||||
return !1;
|
||||
@ -17372,7 +17376,7 @@ goog.debug.entryPointRegistry.register(function(transformer) {
|
||||
ee.apiclient = {};
|
||||
var module$contents$ee$apiclient_apiclient = {};
|
||||
ee.apiclient.VERSION = module$exports$ee$apiVersion.V1;
|
||||
ee.apiclient.API_CLIENT_VERSION = "0.1.368";
|
||||
ee.apiclient.API_CLIENT_VERSION = "0.1.369";
|
||||
ee.apiclient.NULL_VALUE = module$exports$eeapiclient$domain_object.NULL_VALUE;
|
||||
ee.apiclient.PromiseRequestService = module$exports$eeapiclient$promise_request_service.PromiseRequestService;
|
||||
ee.apiclient.MakeRequestParams = module$contents$eeapiclient$request_params_MakeRequestParams;
|
||||
@ -17383,6 +17387,10 @@ var module$contents$ee$apiclient_Call = function(callback, retries) {
|
||||
this.callback = callback;
|
||||
this.requestService = new module$contents$ee$apiclient_EERequestService(!callback, retries);
|
||||
};
|
||||
module$contents$ee$apiclient_Call.prototype.withDetectPartialError = function(detectPartialError) {
|
||||
this.requestService.detectPartialError = detectPartialError;
|
||||
return this;
|
||||
};
|
||||
module$contents$ee$apiclient_Call.prototype.handle = function(response) {
|
||||
var $jscomp$this = this;
|
||||
if (response instanceof Promise) {
|
||||
@ -17463,6 +17471,7 @@ module$contents$ee$apiclient_Call.prototype.filmstripThumbnails = function() {
|
||||
};
|
||||
var module$contents$ee$apiclient_EERequestService = function(sync, retries) {
|
||||
this.sync = sync = void 0 === sync ? !1 : sync;
|
||||
this.detectPartialError = void 0;
|
||||
this.retries = null != retries ? retries : sync ? module$contents$ee$apiclient_apiclient.MAX_SYNC_RETRIES_ : module$contents$ee$apiclient_apiclient.MAX_ASYNC_RETRIES_;
|
||||
};
|
||||
$jscomp.inherits(module$contents$ee$apiclient_EERequestService, module$exports$eeapiclient$promise_request_service.PromiseRequestService);
|
||||
@ -17471,7 +17480,7 @@ module$contents$ee$apiclient_EERequestService.prototype.send = function(params,
|
||||
module$contents$eeapiclient$request_params_processParams(params);
|
||||
var path = params.path || "", url = module$contents$ee$apiclient_apiclient.getSafeApiUrl() + path, args = module$contents$ee$apiclient_apiclient.makeRequest_(params.queryParams || {}), body = params.body ? JSON.stringify(params.body) : void 0;
|
||||
if (this.sync) {
|
||||
var raw = module$contents$ee$apiclient_apiclient.send(url, args, void 0, params.httpMethod, body, this.retries), value = responseCtor ? module$contents$eeapiclient$domain_object_deserialize(responseCtor, raw) : raw, thenable = function(v) {
|
||||
var raw = module$contents$ee$apiclient_apiclient.send(url, args, void 0, params.httpMethod, body, this.retries, this.detectPartialError), value = responseCtor ? module$contents$eeapiclient$domain_object_deserialize(responseCtor, raw) : raw, thenable = function(v) {
|
||||
return {then:function(f) {
|
||||
return thenable(f(v));
|
||||
}};
|
||||
@ -17481,7 +17490,7 @@ module$contents$ee$apiclient_EERequestService.prototype.send = function(params,
|
||||
return (new Promise(function(resolve, reject) {
|
||||
module$contents$ee$apiclient_apiclient.send(url, args, function(value, error) {
|
||||
error ? reject(error) : resolve(value);
|
||||
}, params.httpMethod, body, $jscomp$this.retries);
|
||||
}, params.httpMethod, body, $jscomp$this.retries, $jscomp$this.detectPartialError);
|
||||
})).then(function(r) {
|
||||
return responseCtor ? module$contents$eeapiclient$domain_object_deserialize(responseCtor, r) : r;
|
||||
});
|
||||
@ -17491,8 +17500,13 @@ module$contents$ee$apiclient_EERequestService.prototype.makeRequest = function(p
|
||||
var module$contents$ee$apiclient_BatchCall = function(callback) {
|
||||
module$contents$ee$apiclient_Call.call(this, callback);
|
||||
this.requestService = new module$contents$ee$apiclient_BatchRequestService();
|
||||
this.detectPartialError = void 0;
|
||||
};
|
||||
$jscomp.inherits(module$contents$ee$apiclient_BatchCall, module$contents$ee$apiclient_Call);
|
||||
module$contents$ee$apiclient_BatchCall.prototype.withDetectPartialError = function(detectPartialError) {
|
||||
this.detectPartialError = detectPartialError;
|
||||
return this;
|
||||
};
|
||||
module$contents$ee$apiclient_BatchCall.prototype.send = function(parts, getResponse) {
|
||||
var $jscomp$this = this, batchUrl = module$contents$ee$apiclient_apiclient.getSafeApiUrl() + "/batch", body = parts.map(function($jscomp$destructuring$var32) {
|
||||
var $jscomp$destructuring$var33 = $jscomp.makeIterator($jscomp$destructuring$var32), id = $jscomp$destructuring$var33.next().value, $jscomp$destructuring$var34 = $jscomp.makeIterator($jscomp$destructuring$var33.next().value), partBody = $jscomp$destructuring$var34.next().value, ctor = $jscomp$destructuring$var34.next().value;
|
||||
@ -17507,7 +17521,7 @@ module$contents$ee$apiclient_BatchCall.prototype.send = function(parts, getRespo
|
||||
};
|
||||
return this.callback ? (module$contents$ee$apiclient_apiclient.send(batchUrl, null, function(result, err) {
|
||||
return $jscomp$this.callback(err ? result : deserializeResponses(result), err);
|
||||
}, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body), null) : deserializeResponses(module$contents$ee$apiclient_apiclient.send(batchUrl, null, void 0, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body));
|
||||
}, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body, void 0, this.detectPartialError), null) : deserializeResponses(module$contents$ee$apiclient_apiclient.send(batchUrl, null, void 0, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body, void 0, this.detectPartialError));
|
||||
};
|
||||
var module$contents$ee$apiclient_BatchRequestService = function() {
|
||||
};
|
||||
@ -17648,13 +17662,13 @@ module$contents$ee$apiclient_apiclient.getXsrfToken = function() {
|
||||
module$contents$ee$apiclient_apiclient.isInitialized = function() {
|
||||
return module$contents$ee$apiclient_apiclient.initialized_;
|
||||
};
|
||||
module$contents$ee$apiclient_apiclient.send = function(path, params, callback, method, body, retries) {
|
||||
module$contents$ee$apiclient_apiclient.send = function(path, params, callback, method, body, retries, detectPartialError) {
|
||||
module$contents$ee$apiclient_apiclient.initialize();
|
||||
var profileHookAtCallTime = module$contents$ee$apiclient_apiclient.profileHook_, contentType = "application/x-www-form-urlencoded";
|
||||
body && (contentType = "application/json", method && method.startsWith("multipart") && (contentType = method, method = "POST"));
|
||||
method = method || "POST";
|
||||
var headers = {"Content-Type":contentType}, version = "0.1.368";
|
||||
"0.1.368" === version && (version = "latest");
|
||||
var headers = {"Content-Type":contentType}, version = "0.1.369";
|
||||
"0.1.369" === version && (version = "latest");
|
||||
headers[module$contents$ee$apiclient_apiclient.API_CLIENT_VERSION_HEADER] = "ee-js/" + version;
|
||||
var authToken = module$contents$ee$apiclient_apiclient.getAuthToken();
|
||||
if (null != authToken) {
|
||||
@ -17677,7 +17691,7 @@ module$contents$ee$apiclient_apiclient.send = function(path, params, callback, m
|
||||
"POST" === method && void 0 === body ? requestData = paramString : goog.string.isEmptyOrWhitespace(paramString) || (path += goog.string.contains(path, "?") ? "&" : "?", path += paramString);
|
||||
var url = path.startsWith("/") ? module$contents$ee$apiclient_apiclient.apiBaseUrl_ + path : path;
|
||||
if (callback) {
|
||||
return module$contents$ee$apiclient_apiclient.requestQueue_.push(module$contents$ee$apiclient_apiclient.buildAsyncRequest_(url, callback, method, requestData, headers, retries)), module$contents$ee$apiclient_apiclient.RequestThrottle_.fire(), null;
|
||||
return module$contents$ee$apiclient_apiclient.requestQueue_.push(module$contents$ee$apiclient_apiclient.buildAsyncRequest_(url, callback, method, requestData, headers, retries, detectPartialError)), module$contents$ee$apiclient_apiclient.RequestThrottle_.fire(), null;
|
||||
}
|
||||
for (var setRequestHeader = function(value, key) {
|
||||
this.setRequestHeader && this.setRequestHeader(key, value);
|
||||
@ -17697,16 +17711,16 @@ module$contents$ee$apiclient_apiclient.send = function(path, params, callback, m
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}, xmlHttp.responseText, profileHookAtCallTime, void 0, url, method);
|
||||
}, xmlHttp.responseText, profileHookAtCallTime, void 0, url, method, detectPartialError);
|
||||
};
|
||||
module$contents$ee$apiclient_apiclient.buildAsyncRequest_ = function(url, callback, method, content, headers, retries) {
|
||||
module$contents$ee$apiclient_apiclient.buildAsyncRequest_ = function(url, callback, method, content, headers, retries, detectPartialError) {
|
||||
var retryCount = 0, request = {url:url, method:method, content:content, headers:headers}, profileHookAtCallTime = module$contents$ee$apiclient_apiclient.profileHook_, maxRetries = null != retries ? retries : module$contents$ee$apiclient_apiclient.MAX_ASYNC_RETRIES_;
|
||||
request.callback = function(e) {
|
||||
var xhrIo = e.target;
|
||||
return 429 == xhrIo.getStatus() && retryCount < maxRetries ? (retryCount++, setTimeout(function() {
|
||||
module$contents$ee$apiclient_apiclient.requestQueue_.push(request);
|
||||
module$contents$ee$apiclient_apiclient.RequestThrottle_.fire();
|
||||
}, module$contents$ee$apiclient_apiclient.calculateRetryWait_(retryCount)), null) : module$contents$ee$apiclient_apiclient.handleResponse_(xhrIo.getStatus(), goog.bind(xhrIo.getResponseHeader, xhrIo), xhrIo.getResponseText(), profileHookAtCallTime, callback, url, method);
|
||||
}, module$contents$ee$apiclient_apiclient.calculateRetryWait_(retryCount)), null) : module$contents$ee$apiclient_apiclient.handleResponse_(xhrIo.getStatus(), goog.bind(xhrIo.getResponseHeader, xhrIo), xhrIo.getResponseText(), profileHookAtCallTime, callback, url, method, detectPartialError);
|
||||
};
|
||||
return request;
|
||||
};
|
||||
@ -17718,13 +17732,13 @@ module$contents$ee$apiclient_apiclient.withProfiling = function(hook, body, this
|
||||
module$contents$ee$apiclient_apiclient.profileHook_ = saved;
|
||||
}
|
||||
};
|
||||
module$contents$ee$apiclient_apiclient.handleResponse_ = function(status, getResponseHeader, responseText, profileHook, callback, url, method) {
|
||||
module$contents$ee$apiclient_apiclient.handleResponse_ = function(status, getResponseHeader, responseText, profileHook, callback, url, method, detectPartialError) {
|
||||
var profileId = profileHook ? getResponseHeader(module$contents$ee$apiclient_apiclient.PROFILE_HEADER) : "";
|
||||
profileId && profileHook && profileHook(profileId);
|
||||
var parseJson = function(body) {
|
||||
try {
|
||||
var response = JSON.parse(body);
|
||||
return goog.isObject(response) && "error" in response && "message" in response.error ? response.error.message : {parsed:response};
|
||||
return !(goog.isObject(response) && "error" in response && "message" in response.error) || detectPartialError && detectPartialError(response) ? {parsed:response} : response.error.message;
|
||||
} catch (e) {
|
||||
return "Invalid JSON: " + body;
|
||||
}
|
||||
@ -17735,15 +17749,10 @@ module$contents$ee$apiclient_apiclient.handleResponse_ = function(status, getRes
|
||||
if (200 > status || 300 <= status) {
|
||||
return "Server returned HTTP code: " + status + " for " + method + " " + url;
|
||||
}
|
||||
}, errorMessage, typeHeader = getResponseHeader("Content-Type") || "application/json", contentType = typeHeader.replace(/;.*/, "");
|
||||
}, errorMessage, data, typeHeader = getResponseHeader("Content-Type") || "application/json", contentType = typeHeader.replace(/;.*/, "");
|
||||
if ("application/json" === contentType || "text/json" === contentType) {
|
||||
var response = parseJson(responseText);
|
||||
if (response.parsed) {
|
||||
var data = response.parsed;
|
||||
void 0 === data && (errorMessage = "Malformed response: " + responseText);
|
||||
} else {
|
||||
errorMessage = response;
|
||||
}
|
||||
response.parsed ? data = response.parsed : errorMessage = response;
|
||||
} else if ("multipart/mixed" === contentType) {
|
||||
data = {};
|
||||
var errors = [];
|
||||
@ -17973,6 +17982,12 @@ goog.exportSymbol("ee.api.ListFeaturesResponse", module$exports$eeapiclient$ee_a
|
||||
goog.exportSymbol("ee.api.FeatureViewLocation", module$exports$eeapiclient$ee_api_client.FeatureViewLocation);
|
||||
ee.Encodable = function() {
|
||||
};
|
||||
ee.Encodable.prototype.getSourceFrame = function() {
|
||||
return null;
|
||||
};
|
||||
ee.Encodable.SourceFrame = function() {
|
||||
};
|
||||
goog.exportSymbol("ee.Encodable.SourceFrame", ee.Encodable.SourceFrame);
|
||||
ee.rpc_node = {};
|
||||
ee.rpc_node.constant = function(obj) {
|
||||
if (void 0 === obj || null === obj) {
|
||||
@ -18755,6 +18770,7 @@ ee.Serializer = function(opt_isCompound) {
|
||||
this.encoded_ = {};
|
||||
this.withHashes_ = [];
|
||||
this.hashes_ = new WeakMap();
|
||||
this.sourceNodeMap_ = new WeakMap();
|
||||
this.unboundName = void 0;
|
||||
};
|
||||
goog.exportSymbol("ee.Serializer", ee.Serializer);
|
||||
@ -18845,6 +18861,14 @@ ee.Serializer.encodeCloudApiExpressionWithSerializer = function(serializer, obj,
|
||||
serializer.unboundName = unboundName;
|
||||
return serializer.encodeForCloudApi_(obj);
|
||||
};
|
||||
ee.Serializer.prototype.encodeSourceCodeNodes = function(expression) {
|
||||
var sourceCodeNodes = {}, valueNodes = expression.values, id;
|
||||
for (id in valueNodes) {
|
||||
var sourceFrame = this.sourceNodeMap_.get(valueNodes[id]);
|
||||
sourceCodeNodes[id] = Object.assign({}, sourceFrame);
|
||||
}
|
||||
return sourceCodeNodes;
|
||||
};
|
||||
ee.Serializer.encodeCloudApiPretty = function(obj) {
|
||||
var encoded = (new ee.Serializer(!1)).encodeForCloudApi_(obj), values = encoded.values, walkObject = function(object) {
|
||||
if (!goog.isObject(object)) {
|
||||
@ -18871,7 +18895,7 @@ goog.exportSymbol("ee.Serializer.toReadableCloudApiJSON", ee.Serializer.toReadab
|
||||
ee.Serializer.prototype.encodeForCloudApi_ = function(obj) {
|
||||
try {
|
||||
var result = this.makeReference(obj);
|
||||
return (new ExpressionOptimizer(result, this.scope_, this.isCompound_)).optimize();
|
||||
return (new ExpressionOptimizer(result, this.scope_, this.isCompound_, this.sourceNodeMap_)).optimize();
|
||||
} finally {
|
||||
this.hashes_ = new WeakMap(), this.encoded_ = {}, this.scope_ = [];
|
||||
}
|
||||
@ -18897,7 +18921,9 @@ ee.Serializer.prototype.makeReference = function(obj) {
|
||||
return makeRef(ee.rpc_node.functionByName("Date", {value:ee.rpc_node.constant(Math.floor(obj.getTime()))}));
|
||||
}
|
||||
if (obj instanceof ee.Encodable) {
|
||||
return makeRef(obj.encodeCloudValue(this));
|
||||
var value = obj.encodeCloudValue(this), sourceFrame = obj.getSourceFrame();
|
||||
null !== sourceFrame && this.sourceNodeMap_.set(value, sourceFrame);
|
||||
return makeRef(value);
|
||||
}
|
||||
if (Array.isArray(obj)) {
|
||||
return makeRef(ee.rpc_node.array(obj.map(function(x) {
|
||||
@ -18913,7 +18939,7 @@ ee.Serializer.prototype.makeReference = function(obj) {
|
||||
}
|
||||
throw Error("Can't encode object: " + obj);
|
||||
};
|
||||
var ExpressionOptimizer = function(rootReference, values, isCompound) {
|
||||
var ExpressionOptimizer = function(rootReference, values, isCompound, sourceNodeMap) {
|
||||
var $jscomp$this = this;
|
||||
this.rootReference = rootReference;
|
||||
this.values = {};
|
||||
@ -18924,6 +18950,7 @@ var ExpressionOptimizer = function(rootReference, values, isCompound) {
|
||||
this.optimizedValues = {};
|
||||
this.referenceMap = {};
|
||||
this.nextMappedRef = 0;
|
||||
this.sourceNodeMap = sourceNodeMap;
|
||||
};
|
||||
ExpressionOptimizer.prototype.optimize = function() {
|
||||
var result = this.optimizeReference(this.rootReference);
|
||||
@ -18943,21 +18970,32 @@ ExpressionOptimizer.prototype.optimizeValue = function(value, depth) {
|
||||
return null !== v.constantValue;
|
||||
}, serializeConst = function(v) {
|
||||
return v === module$exports$eeapiclient$domain_object.NULL_VALUE ? null : v;
|
||||
}, storeInSourceMap = function(parentValue, valueNode) {
|
||||
$jscomp$this.sourceNodeMap && $jscomp$this.sourceNodeMap.has(parentValue) && !$jscomp$this.sourceNodeMap.has(valueNode) && $jscomp$this.sourceNodeMap.set(valueNode, $jscomp$this.sourceNodeMap.get(parentValue));
|
||||
return valueNode;
|
||||
};
|
||||
if (isConst(value) || null != value.integerValue || null != value.bytesValue || null != value.argumentReference) {
|
||||
return value;
|
||||
}
|
||||
if (null != value.valueReference) {
|
||||
var val = this.values[value.valueReference];
|
||||
return null === this.referenceCounts || 50 > depth && 1 === this.referenceCounts[value.valueReference] ? this.optimizeValue(val, depth) : ExpressionOptimizer.isAlwaysLiftable(val) ? val : ee.rpc_node.reference(this.optimizeReference(value.valueReference));
|
||||
var referencedValue = this.values[value.valueReference];
|
||||
if (null === this.referenceCounts || 50 > depth && 1 === this.referenceCounts[value.valueReference]) {
|
||||
var optimized = this.optimizeValue(referencedValue, depth);
|
||||
return storeInSourceMap(value, optimized);
|
||||
}
|
||||
if (ExpressionOptimizer.isAlwaysLiftable(referencedValue)) {
|
||||
return storeInSourceMap(value, referencedValue);
|
||||
}
|
||||
var optimized$jscomp$0 = ee.rpc_node.reference(this.optimizeReference(value.valueReference));
|
||||
return storeInSourceMap(value, optimized$jscomp$0);
|
||||
}
|
||||
if (null != value.arrayValue) {
|
||||
var arr = value.arrayValue.values.map(function(v) {
|
||||
return $jscomp$this.optimizeValue(v, depth + 3);
|
||||
});
|
||||
return arr.every(isConst) ? ee.rpc_node.constant(arr.map(function(v) {
|
||||
}), optimized$jscomp$1 = arr.every(isConst) ? ee.rpc_node.constant(arr.map(function(v) {
|
||||
return serializeConst(v.constantValue);
|
||||
})) : ee.rpc_node.array(arr);
|
||||
return storeInSourceMap(value, optimized$jscomp$1);
|
||||
}
|
||||
if (null != value.dictionaryValue) {
|
||||
for (var values = {}, constantValues = {}, $jscomp$iter$39 = $jscomp.makeIterator(Object.entries(value.dictionaryValue.values || {})), $jscomp$key$ = $jscomp$iter$39.next(); !$jscomp$key$.done; $jscomp$key$ = $jscomp$iter$39.next()) {
|
||||
@ -18965,18 +19003,19 @@ ExpressionOptimizer.prototype.optimizeValue = function(value, depth) {
|
||||
values[k] = this.optimizeValue(v, depth + 3);
|
||||
null !== constantValues && isConst(values[k]) ? constantValues[k] = serializeConst(values[k].constantValue) : constantValues = null;
|
||||
}
|
||||
return null !== constantValues ? ee.rpc_node.constant(constantValues) : ee.rpc_node.dictionary(values);
|
||||
return null !== constantValues ? storeInSourceMap(value, ee.rpc_node.constant(constantValues)) : storeInSourceMap(values, ee.rpc_node.dictionary(values));
|
||||
}
|
||||
if (null != value.functionDefinitionValue) {
|
||||
var def = value.functionDefinitionValue;
|
||||
return ee.rpc_node.functionDefinition(def.argumentNames || [], this.optimizeReference(def.body || ""));
|
||||
var def = value.functionDefinitionValue, optimized$jscomp$2 = ee.rpc_node.functionDefinition(def.argumentNames || [], this.optimizeReference(def.body || ""));
|
||||
return storeInSourceMap(value, optimized$jscomp$2);
|
||||
}
|
||||
if (null != value.functionInvocationValue) {
|
||||
for (var inv = value.functionInvocationValue, args = {}, $jscomp$iter$40 = $jscomp.makeIterator(Object.keys(inv.arguments || {})), $jscomp$key$k = $jscomp$iter$40.next(); !$jscomp$key$k.done; $jscomp$key$k = $jscomp$iter$40.next()) {
|
||||
var k$jscomp$0 = $jscomp$key$k.value;
|
||||
args[k$jscomp$0] = this.optimizeValue(inv.arguments[k$jscomp$0], depth + 3);
|
||||
}
|
||||
return inv.functionName ? ee.rpc_node.functionByName(inv.functionName, args) : ee.rpc_node.functionByReference(this.optimizeReference(inv.functionReference || ""), args);
|
||||
var optimized$jscomp$3 = inv.functionName ? ee.rpc_node.functionByName(inv.functionName, args) : ee.rpc_node.functionByReference(this.optimizeReference(inv.functionReference || ""), args);
|
||||
return storeInSourceMap(value, optimized$jscomp$3);
|
||||
}
|
||||
throw Error("Can't optimize value: " + value);
|
||||
};
|
||||
@ -19425,7 +19464,9 @@ ee.data.listFeatures = function(asset, params, opt_callback) {
|
||||
};
|
||||
goog.exportSymbol("ee.data.listFeatures", ee.data.listFeatures);
|
||||
ee.data.computeValue = function(obj, opt_callback) {
|
||||
var request = {expression:ee.data.expressionAugmenter_(ee.Serializer.encodeCloudApiExpressionWithSerializer(new ee.Serializer(!0), obj, void 0))}, workloadTag = ee.data.getWorkloadTag();
|
||||
var serializer = new ee.Serializer(!0), expression = ee.Serializer.encodeCloudApiExpressionWithSerializer(serializer, obj, void 0), extraMetadata = {}, sourceCodeNodes = serializer.encodeSourceCodeNodes(expression);
|
||||
Object.keys(sourceCodeNodes).length && (extraMetadata = {__source_code_nodes__:sourceCodeNodes});
|
||||
var request = {expression:ee.data.expressionAugmenter_(expression, extraMetadata)}, workloadTag = ee.data.getWorkloadTag();
|
||||
workloadTag && (request.workloadTag = workloadTag);
|
||||
var call = new module$contents$ee$apiclient_Call(opt_callback);
|
||||
return call.handle(call.value().compute(call.projectsPath(), new module$exports$eeapiclient$ee_api_client.ComputeValueRequest(request)).then(function(x) {
|
||||
@ -19570,15 +19611,18 @@ ee.data.newTaskId = function(opt_count, opt_callback) {
|
||||
return opt_callback ? opt_callback(uuids) : uuids;
|
||||
};
|
||||
goog.exportSymbol("ee.data.newTaskId", ee.data.newTaskId);
|
||||
ee.data.isOperationError_ = function(response) {
|
||||
return response.name && response.done && response.error;
|
||||
};
|
||||
ee.data.getTaskStatus = function(taskId, opt_callback) {
|
||||
var opNames = ee.data.makeStringArray_(taskId).map(ee.rpc_convert.taskIdToOperationName);
|
||||
if (1 === opNames.length) {
|
||||
var call = new module$contents$ee$apiclient_Call(opt_callback);
|
||||
var call = (new module$contents$ee$apiclient_Call(opt_callback)).withDetectPartialError(ee.data.isOperationError_);
|
||||
return call.handle(call.operations().get(opNames[0]).then(function(op) {
|
||||
return [ee.rpc_convert.operationToTask(op)];
|
||||
}));
|
||||
}
|
||||
var call$jscomp$0 = new module$contents$ee$apiclient_BatchCall(opt_callback), operations = call$jscomp$0.operations();
|
||||
var call$jscomp$0 = (new module$contents$ee$apiclient_BatchCall(opt_callback)).withDetectPartialError(ee.data.isOperationError_), operations = call$jscomp$0.operations();
|
||||
return call$jscomp$0.send(opNames.map(function(op) {
|
||||
return [op, operations.get(op)];
|
||||
}), function(data) {
|
||||
@ -19641,10 +19685,10 @@ goog.exportSymbol("ee.data.cancelOperation", ee.data.cancelOperation);
|
||||
ee.data.getOperation = function(operationName, opt_callback) {
|
||||
var opNames = ee.data.makeStringArray_(operationName).map(ee.rpc_convert.taskIdToOperationName);
|
||||
if (!Array.isArray(operationName)) {
|
||||
var call = new module$contents$ee$apiclient_Call(opt_callback);
|
||||
var call = (new module$contents$ee$apiclient_Call(opt_callback)).withDetectPartialError(ee.data.isOperationError_);
|
||||
return call.handle(call.operations().get(opNames[0]));
|
||||
}
|
||||
var call$jscomp$0 = new module$contents$ee$apiclient_BatchCall(opt_callback), operations = call$jscomp$0.operations();
|
||||
var call$jscomp$0 = (new module$contents$ee$apiclient_BatchCall(opt_callback)).withDetectPartialError(ee.data.isOperationError_), operations = call$jscomp$0.operations();
|
||||
return call$jscomp$0.send(opNames.map(function(op) {
|
||||
return [op, operations.get(op)];
|
||||
}));
|
||||
@ -20003,8 +20047,6 @@ ee.data.AssetQuotaEntry = function() {
|
||||
};
|
||||
ee.data.AssetQuotaDetails = function() {
|
||||
};
|
||||
ee.data.SourceFrame = function() {
|
||||
};
|
||||
ee.data.sourceFrameGenerator_ = null;
|
||||
ee.data.FeatureViewDescription = function() {
|
||||
};
|
||||
@ -20109,6 +20151,9 @@ ee.ComputedObject = function(func, args, opt_varName) {
|
||||
};
|
||||
goog.inherits(ee.ComputedObject, ee.Encodable);
|
||||
goog.exportSymbol("ee.ComputedObject", ee.ComputedObject);
|
||||
ee.ComputedObject.prototype.getSourceFrame = function() {
|
||||
return this.sourceFrame;
|
||||
};
|
||||
ee.ComputedObject.prototype.evaluate = function(callback) {
|
||||
if (!callback || "function" !== typeof callback) {
|
||||
throw Error("evaluate() requires a callback function.");
|
||||
@ -24295,7 +24340,7 @@ function module$contents$safevalues$builders$attribute_builders_safeAttrPrefix(t
|
||||
}
|
||||
;var module$contents$safevalues$internals$pure_module = module$contents$safevalues$internals$pure_module || {id:"third_party/javascript/safevalues/internals/pure.closure.js"};
|
||||
function module$contents$safevalues$internals$pure_pure(valueOf) {
|
||||
return {valueOf:valueOf}.valueOf();
|
||||
return valueOf();
|
||||
}
|
||||
;var module$exports$goog$html$internals = {};
|
||||
module$exports$goog$html$internals.createSafeHtml = module$contents$goog$html$SafeHtml_SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse;
|
||||
@ -24322,14 +24367,7 @@ function module$contents$safevalues$internals$url_impl_unwrapUrl(value) {
|
||||
module$exports$safevalues$internals$url_impl.unwrapUrl = module$contents$safevalues$internals$url_impl_unwrapUrl;
|
||||
var module$exports$safevalues$builders$url_sanitizer = {}, module$contents$safevalues$builders$url_sanitizer_module = module$contents$safevalues$builders$url_sanitizer_module || {id:"third_party/javascript/safevalues/builders/url_sanitizer.closure.js"}, module$contents$safevalues$builders$url_sanitizer_ASSUME_IMPLEMENTS_URL_API = 2020 <= goog.FEATURESET_YEAR, module$contents$safevalues$builders$url_sanitizer_supportsURLAPI =
|
||||
module$contents$safevalues$internals$pure_pure(function() {
|
||||
if (module$contents$safevalues$builders$url_sanitizer_ASSUME_IMPLEMENTS_URL_API) {
|
||||
return !0;
|
||||
}
|
||||
try {
|
||||
return new URL("s://g"), !0;
|
||||
} catch (e) {
|
||||
return !1;
|
||||
}
|
||||
return module$contents$safevalues$builders$url_sanitizer_ASSUME_IMPLEMENTS_URL_API ? !0 : "function" === typeof URL;
|
||||
});
|
||||
function module$contents$safevalues$builders$url_sanitizer_legacyExtractScheme(url) {
|
||||
var aTag = document.createElement("a");
|
||||
@ -25077,8 +25115,8 @@ module$exports$safevalues$builders$style_sheet_builders.safeStyleRule = function
|
||||
function module$contents$safevalues$builders$style_sheet_builders_safeStyleSheet(templateObj) {
|
||||
goog.DEBUG && module$contents$safevalues$internals$string_literal_assertIsTemplateObject(templateObj, 0);
|
||||
var styleSheet = templateObj[0];
|
||||
if (goog.DEBUG && /[<>]/.test(styleSheet)) {
|
||||
throw Error("Forbidden characters in styleSheet string: " + styleSheet);
|
||||
if (goog.DEBUG && /</.test(styleSheet)) {
|
||||
throw Error("'<' character is forbidden in styleSheet string: " + styleSheet);
|
||||
}
|
||||
return module$contents$safevalues$internals$style_sheet_impl_createStyleSheetInternal(styleSheet);
|
||||
}
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
/*
|
||||
|
||||
Copyright The Closure Library Authors.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var isChrome87, $jscomp = $jscomp || {};
|
||||
var $jscomp = $jscomp || {};
|
||||
$jscomp.scope = {};
|
||||
$jscomp.arrayIteratorImpl = function(array) {
|
||||
var index = 0;
|
||||
@ -1205,7 +1200,13 @@ $jscomp.polyfill("String.prototype.padStart", function(orig) {
|
||||
return $jscomp.stringPadding(opt_padString, targetLength - string.length) + string;
|
||||
};
|
||||
}, "es8", "es3");
|
||||
var goog = goog || {};
|
||||
var CLOSURE_TOGGLE_ORDINALS = {GoogFlags__async_throw_on_unicode_to_byte__enable:!1, GoogFlags__client_only_wiz_attribute_sanitization__enable:!1, GoogFlags__override_disable_toggles:!1, GoogFlags__testonly_debug_flag__enable:!1, GoogFlags__testonly_disabled_flag__enable:!1, GoogFlags__testonly_stable_flag__disable:!1, GoogFlags__testonly_staging_flag__disable:!1, GoogFlags__use_toggles:!1, GoogFlags__use_user_agent_client_hints__enable:!1};
|
||||
/*
|
||||
|
||||
Copyright The Closure Library Authors.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var isChrome87, goog = goog || {};
|
||||
goog.global = this || self;
|
||||
goog.exportPath_ = function(name, object, overwriteImplicit, objectToExportTo) {
|
||||
var parts = name.split("."), cur = objectToExportTo || goog.global;
|
||||
@ -2620,6 +2621,10 @@ goog.events.BrowserFeature = {TOUCH_ENABLED:"ontouchstart" in goog.global || !!(
|
||||
}
|
||||
return passive;
|
||||
})};
|
||||
goog.labs = {};
|
||||
goog.labs.userAgent = {};
|
||||
goog.labs.userAgent.chromiumRebrands = {};
|
||||
goog.labs.userAgent.chromiumRebrands.ChromiumRebrand = {GOOGLE_CHROME:"Google Chrome", BRAVE:"Brave", OPERA:"Opera", EDGE:"Microsoft Edge"};
|
||||
var module$exports$tslib = {}, module$contents$tslib_extendStatics = Object.setPrototypeOf || function(d, b) {
|
||||
for (var p in b) {
|
||||
Object.prototype.hasOwnProperty.call(b, p) && (d[p] = b[p]);
|
||||
@ -2967,13 +2972,11 @@ goog.flags = {};
|
||||
var module$contents$goog$flags_STAGING = goog.readFlagInternalDoNotUseOrElse(1, goog.FLAGS_STAGING_DEFAULT);
|
||||
goog.flags.USE_USER_AGENT_CLIENT_HINTS = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_user_agent_client_hints__enable : goog.readFlagInternalDoNotUseOrElse(610401301, !1);
|
||||
goog.flags.ASYNC_THROW_ON_UNICODE_TO_BYTE = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__async_throw_on_unicode_to_byte__enable : goog.readFlagInternalDoNotUseOrElse(899588437, !1);
|
||||
goog.flags.CLIENT_ONLY_WIZ_ATTRIBUTE_SANITIZATION = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__client_only_wiz_attribute_sanitization__enable : goog.readFlagInternalDoNotUseOrElse(533565600, !1);
|
||||
goog.flags.CLIENT_ONLY_WIZ_ATTRIBUTE_SANITIZATION = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? goog.DEBUG || module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__client_only_wiz_attribute_sanitization__enable : goog.readFlagInternalDoNotUseOrElse(533565600, goog.DEBUG);
|
||||
goog.flags.TESTONLY_DISABLED_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_disabled_flag__enable : goog.readFlagInternalDoNotUseOrElse(2147483644, !1);
|
||||
goog.flags.TESTONLY_DEBUG_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? goog.DEBUG || module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_debug_flag__enable : goog.readFlagInternalDoNotUseOrElse(2147483645, goog.DEBUG);
|
||||
goog.flags.TESTONLY_STAGING_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? goog.FLAGS_STAGING_DEFAULT && (module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__override_disable_toggles || !module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_staging_flag__disable) : goog.readFlagInternalDoNotUseOrElse(2147483646, module$contents$goog$flags_STAGING);
|
||||
goog.flags.TESTONLY_STABLE_FLAG = module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__use_toggles ? module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__override_disable_toggles || !module$exports$closure$flags$flags$2etoggles.TOGGLE_GoogFlags__testonly_stable_flag__disable : goog.readFlagInternalDoNotUseOrElse(2147483647, !0);
|
||||
goog.labs = {};
|
||||
goog.labs.userAgent = {};
|
||||
var module$contents$goog$labs$userAgent_forceClientHintsInTests = !1;
|
||||
goog.labs.userAgent.setUseClientHintsForTesting = function(use) {
|
||||
module$contents$goog$labs$userAgent_forceClientHintsInTests = use;
|
||||
@ -3193,6 +3196,7 @@ module$exports$goog$labs$userAgent$highEntropy$highEntropyData.platformVersion =
|
||||
goog.labs.userAgent.browser = {};
|
||||
var module$contents$goog$labs$userAgent$browser_Brand = {ANDROID_BROWSER:"Android Browser", CHROMIUM:"Chromium", EDGE:"Microsoft Edge", FIREFOX:"Firefox", IE:"Internet Explorer", OPERA:"Opera", SAFARI:"Safari", SILK:"Silk"};
|
||||
goog.labs.userAgent.browser.Brand = module$contents$goog$labs$userAgent$browser_Brand;
|
||||
var module$contents$goog$labs$userAgent$browser_AllBrandsInternal;
|
||||
function module$contents$goog$labs$userAgent$browser_useUserAgentDataBrand(ignoreClientHintsFlag) {
|
||||
if (!(void 0 !== ignoreClientHintsFlag && ignoreClientHintsFlag || (0,goog.labs.userAgent.useClientHints)())) {
|
||||
return !1;
|
||||
@ -17372,7 +17376,7 @@ goog.debug.entryPointRegistry.register(function(transformer) {
|
||||
ee.apiclient = {};
|
||||
var module$contents$ee$apiclient_apiclient = {};
|
||||
ee.apiclient.VERSION = module$exports$ee$apiVersion.V1;
|
||||
ee.apiclient.API_CLIENT_VERSION = "0.1.368";
|
||||
ee.apiclient.API_CLIENT_VERSION = "0.1.369";
|
||||
ee.apiclient.NULL_VALUE = module$exports$eeapiclient$domain_object.NULL_VALUE;
|
||||
ee.apiclient.PromiseRequestService = module$exports$eeapiclient$promise_request_service.PromiseRequestService;
|
||||
ee.apiclient.MakeRequestParams = module$contents$eeapiclient$request_params_MakeRequestParams;
|
||||
@ -17383,6 +17387,10 @@ var module$contents$ee$apiclient_Call = function(callback, retries) {
|
||||
this.callback = callback;
|
||||
this.requestService = new module$contents$ee$apiclient_EERequestService(!callback, retries);
|
||||
};
|
||||
module$contents$ee$apiclient_Call.prototype.withDetectPartialError = function(detectPartialError) {
|
||||
this.requestService.detectPartialError = detectPartialError;
|
||||
return this;
|
||||
};
|
||||
module$contents$ee$apiclient_Call.prototype.handle = function(response) {
|
||||
var $jscomp$this = this;
|
||||
if (response instanceof Promise) {
|
||||
@ -17463,6 +17471,7 @@ module$contents$ee$apiclient_Call.prototype.filmstripThumbnails = function() {
|
||||
};
|
||||
var module$contents$ee$apiclient_EERequestService = function(sync, retries) {
|
||||
this.sync = sync = void 0 === sync ? !1 : sync;
|
||||
this.detectPartialError = void 0;
|
||||
this.retries = null != retries ? retries : sync ? module$contents$ee$apiclient_apiclient.MAX_SYNC_RETRIES_ : module$contents$ee$apiclient_apiclient.MAX_ASYNC_RETRIES_;
|
||||
};
|
||||
$jscomp.inherits(module$contents$ee$apiclient_EERequestService, module$exports$eeapiclient$promise_request_service.PromiseRequestService);
|
||||
@ -17471,7 +17480,7 @@ module$contents$ee$apiclient_EERequestService.prototype.send = function(params,
|
||||
module$contents$eeapiclient$request_params_processParams(params);
|
||||
var path = params.path || "", url = module$contents$ee$apiclient_apiclient.getSafeApiUrl() + path, args = module$contents$ee$apiclient_apiclient.makeRequest_(params.queryParams || {}), body = params.body ? JSON.stringify(params.body) : void 0;
|
||||
if (this.sync) {
|
||||
var raw = module$contents$ee$apiclient_apiclient.send(url, args, void 0, params.httpMethod, body, this.retries), value = responseCtor ? module$contents$eeapiclient$domain_object_deserialize(responseCtor, raw) : raw, thenable = function(v) {
|
||||
var raw = module$contents$ee$apiclient_apiclient.send(url, args, void 0, params.httpMethod, body, this.retries, this.detectPartialError), value = responseCtor ? module$contents$eeapiclient$domain_object_deserialize(responseCtor, raw) : raw, thenable = function(v) {
|
||||
return {then:function(f) {
|
||||
return thenable(f(v));
|
||||
}};
|
||||
@ -17481,7 +17490,7 @@ module$contents$ee$apiclient_EERequestService.prototype.send = function(params,
|
||||
return (new Promise(function(resolve, reject) {
|
||||
module$contents$ee$apiclient_apiclient.send(url, args, function(value, error) {
|
||||
error ? reject(error) : resolve(value);
|
||||
}, params.httpMethod, body, $jscomp$this.retries);
|
||||
}, params.httpMethod, body, $jscomp$this.retries, $jscomp$this.detectPartialError);
|
||||
})).then(function(r) {
|
||||
return responseCtor ? module$contents$eeapiclient$domain_object_deserialize(responseCtor, r) : r;
|
||||
});
|
||||
@ -17491,8 +17500,13 @@ module$contents$ee$apiclient_EERequestService.prototype.makeRequest = function(p
|
||||
var module$contents$ee$apiclient_BatchCall = function(callback) {
|
||||
module$contents$ee$apiclient_Call.call(this, callback);
|
||||
this.requestService = new module$contents$ee$apiclient_BatchRequestService();
|
||||
this.detectPartialError = void 0;
|
||||
};
|
||||
$jscomp.inherits(module$contents$ee$apiclient_BatchCall, module$contents$ee$apiclient_Call);
|
||||
module$contents$ee$apiclient_BatchCall.prototype.withDetectPartialError = function(detectPartialError) {
|
||||
this.detectPartialError = detectPartialError;
|
||||
return this;
|
||||
};
|
||||
module$contents$ee$apiclient_BatchCall.prototype.send = function(parts, getResponse) {
|
||||
var $jscomp$this = this, batchUrl = module$contents$ee$apiclient_apiclient.getSafeApiUrl() + "/batch", body = parts.map(function($jscomp$destructuring$var32) {
|
||||
var $jscomp$destructuring$var33 = $jscomp.makeIterator($jscomp$destructuring$var32), id = $jscomp$destructuring$var33.next().value, $jscomp$destructuring$var34 = $jscomp.makeIterator($jscomp$destructuring$var33.next().value), partBody = $jscomp$destructuring$var34.next().value, ctor = $jscomp$destructuring$var34.next().value;
|
||||
@ -17507,7 +17521,7 @@ module$contents$ee$apiclient_BatchCall.prototype.send = function(parts, getRespo
|
||||
};
|
||||
return this.callback ? (module$contents$ee$apiclient_apiclient.send(batchUrl, null, function(result, err) {
|
||||
return $jscomp$this.callback(err ? result : deserializeResponses(result), err);
|
||||
}, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body), null) : deserializeResponses(module$contents$ee$apiclient_apiclient.send(batchUrl, null, void 0, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body));
|
||||
}, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body, void 0, this.detectPartialError), null) : deserializeResponses(module$contents$ee$apiclient_apiclient.send(batchUrl, null, void 0, "multipart/mixed; boundary=batch_EARTHENGINE_batch", body, void 0, this.detectPartialError));
|
||||
};
|
||||
var module$contents$ee$apiclient_BatchRequestService = function() {
|
||||
};
|
||||
@ -17648,13 +17662,13 @@ module$contents$ee$apiclient_apiclient.getXsrfToken = function() {
|
||||
module$contents$ee$apiclient_apiclient.isInitialized = function() {
|
||||
return module$contents$ee$apiclient_apiclient.initialized_;
|
||||
};
|
||||
module$contents$ee$apiclient_apiclient.send = function(path, params, callback, method, body, retries) {
|
||||
module$contents$ee$apiclient_apiclient.send = function(path, params, callback, method, body, retries, detectPartialError) {
|
||||
module$contents$ee$apiclient_apiclient.initialize();
|
||||
var profileHookAtCallTime = module$contents$ee$apiclient_apiclient.profileHook_, contentType = "application/x-www-form-urlencoded";
|
||||
body && (contentType = "application/json", method && method.startsWith("multipart") && (contentType = method, method = "POST"));
|
||||
method = method || "POST";
|
||||
var headers = {"Content-Type":contentType}, version = "0.1.368";
|
||||
"0.1.368" === version && (version = "latest");
|
||||
var headers = {"Content-Type":contentType}, version = "0.1.369";
|
||||
"0.1.369" === version && (version = "latest");
|
||||
headers[module$contents$ee$apiclient_apiclient.API_CLIENT_VERSION_HEADER] = "ee-js/" + version;
|
||||
var authToken = module$contents$ee$apiclient_apiclient.getAuthToken();
|
||||
if (null != authToken) {
|
||||
@ -17677,7 +17691,7 @@ module$contents$ee$apiclient_apiclient.send = function(path, params, callback, m
|
||||
"POST" === method && void 0 === body ? requestData = paramString : goog.string.isEmptyOrWhitespace(paramString) || (path += goog.string.contains(path, "?") ? "&" : "?", path += paramString);
|
||||
var url = path.startsWith("/") ? module$contents$ee$apiclient_apiclient.apiBaseUrl_ + path : path;
|
||||
if (callback) {
|
||||
return module$contents$ee$apiclient_apiclient.requestQueue_.push(module$contents$ee$apiclient_apiclient.buildAsyncRequest_(url, callback, method, requestData, headers, retries)), module$contents$ee$apiclient_apiclient.RequestThrottle_.fire(), null;
|
||||
return module$contents$ee$apiclient_apiclient.requestQueue_.push(module$contents$ee$apiclient_apiclient.buildAsyncRequest_(url, callback, method, requestData, headers, retries, detectPartialError)), module$contents$ee$apiclient_apiclient.RequestThrottle_.fire(), null;
|
||||
}
|
||||
for (var setRequestHeader = function(value, key) {
|
||||
this.setRequestHeader && this.setRequestHeader(key, value);
|
||||
@ -17697,16 +17711,16 @@ module$contents$ee$apiclient_apiclient.send = function(path, params, callback, m
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}, xmlHttp.responseText, profileHookAtCallTime, void 0, url, method);
|
||||
}, xmlHttp.responseText, profileHookAtCallTime, void 0, url, method, detectPartialError);
|
||||
};
|
||||
module$contents$ee$apiclient_apiclient.buildAsyncRequest_ = function(url, callback, method, content, headers, retries) {
|
||||
module$contents$ee$apiclient_apiclient.buildAsyncRequest_ = function(url, callback, method, content, headers, retries, detectPartialError) {
|
||||
var retryCount = 0, request = {url:url, method:method, content:content, headers:headers}, profileHookAtCallTime = module$contents$ee$apiclient_apiclient.profileHook_, maxRetries = null != retries ? retries : module$contents$ee$apiclient_apiclient.MAX_ASYNC_RETRIES_;
|
||||
request.callback = function(e) {
|
||||
var xhrIo = e.target;
|
||||
return 429 == xhrIo.getStatus() && retryCount < maxRetries ? (retryCount++, setTimeout(function() {
|
||||
module$contents$ee$apiclient_apiclient.requestQueue_.push(request);
|
||||
module$contents$ee$apiclient_apiclient.RequestThrottle_.fire();
|
||||
}, module$contents$ee$apiclient_apiclient.calculateRetryWait_(retryCount)), null) : module$contents$ee$apiclient_apiclient.handleResponse_(xhrIo.getStatus(), goog.bind(xhrIo.getResponseHeader, xhrIo), xhrIo.getResponseText(), profileHookAtCallTime, callback, url, method);
|
||||
}, module$contents$ee$apiclient_apiclient.calculateRetryWait_(retryCount)), null) : module$contents$ee$apiclient_apiclient.handleResponse_(xhrIo.getStatus(), goog.bind(xhrIo.getResponseHeader, xhrIo), xhrIo.getResponseText(), profileHookAtCallTime, callback, url, method, detectPartialError);
|
||||
};
|
||||
return request;
|
||||
};
|
||||
@ -17718,13 +17732,13 @@ module$contents$ee$apiclient_apiclient.withProfiling = function(hook, body, this
|
||||
module$contents$ee$apiclient_apiclient.profileHook_ = saved;
|
||||
}
|
||||
};
|
||||
module$contents$ee$apiclient_apiclient.handleResponse_ = function(status, getResponseHeader, responseText, profileHook, callback, url, method) {
|
||||
module$contents$ee$apiclient_apiclient.handleResponse_ = function(status, getResponseHeader, responseText, profileHook, callback, url, method, detectPartialError) {
|
||||
var profileId = profileHook ? getResponseHeader(module$contents$ee$apiclient_apiclient.PROFILE_HEADER) : "";
|
||||
profileId && profileHook && profileHook(profileId);
|
||||
var parseJson = function(body) {
|
||||
try {
|
||||
var response = JSON.parse(body);
|
||||
return goog.isObject(response) && "error" in response && "message" in response.error ? response.error.message : {parsed:response};
|
||||
return !(goog.isObject(response) && "error" in response && "message" in response.error) || detectPartialError && detectPartialError(response) ? {parsed:response} : response.error.message;
|
||||
} catch (e) {
|
||||
return "Invalid JSON: " + body;
|
||||
}
|
||||
@ -17735,15 +17749,10 @@ module$contents$ee$apiclient_apiclient.handleResponse_ = function(status, getRes
|
||||
if (200 > status || 300 <= status) {
|
||||
return "Server returned HTTP code: " + status + " for " + method + " " + url;
|
||||
}
|
||||
}, errorMessage, typeHeader = getResponseHeader("Content-Type") || "application/json", contentType = typeHeader.replace(/;.*/, "");
|
||||
}, errorMessage, data, typeHeader = getResponseHeader("Content-Type") || "application/json", contentType = typeHeader.replace(/;.*/, "");
|
||||
if ("application/json" === contentType || "text/json" === contentType) {
|
||||
var response = parseJson(responseText);
|
||||
if (response.parsed) {
|
||||
var data = response.parsed;
|
||||
void 0 === data && (errorMessage = "Malformed response: " + responseText);
|
||||
} else {
|
||||
errorMessage = response;
|
||||
}
|
||||
response.parsed ? data = response.parsed : errorMessage = response;
|
||||
} else if ("multipart/mixed" === contentType) {
|
||||
data = {};
|
||||
var errors = [];
|
||||
@ -17973,6 +17982,12 @@ goog.exportSymbol("ee.api.ListFeaturesResponse", module$exports$eeapiclient$ee_a
|
||||
goog.exportSymbol("ee.api.FeatureViewLocation", module$exports$eeapiclient$ee_api_client.FeatureViewLocation);
|
||||
ee.Encodable = function() {
|
||||
};
|
||||
ee.Encodable.prototype.getSourceFrame = function() {
|
||||
return null;
|
||||
};
|
||||
ee.Encodable.SourceFrame = function() {
|
||||
};
|
||||
goog.exportSymbol("ee.Encodable.SourceFrame", ee.Encodable.SourceFrame);
|
||||
ee.rpc_node = {};
|
||||
ee.rpc_node.constant = function(obj) {
|
||||
if (void 0 === obj || null === obj) {
|
||||
@ -18755,6 +18770,7 @@ ee.Serializer = function(opt_isCompound) {
|
||||
this.encoded_ = {};
|
||||
this.withHashes_ = [];
|
||||
this.hashes_ = new WeakMap();
|
||||
this.sourceNodeMap_ = new WeakMap();
|
||||
this.unboundName = void 0;
|
||||
};
|
||||
goog.exportSymbol("ee.Serializer", ee.Serializer);
|
||||
@ -18845,6 +18861,14 @@ ee.Serializer.encodeCloudApiExpressionWithSerializer = function(serializer, obj,
|
||||
serializer.unboundName = unboundName;
|
||||
return serializer.encodeForCloudApi_(obj);
|
||||
};
|
||||
ee.Serializer.prototype.encodeSourceCodeNodes = function(expression) {
|
||||
var sourceCodeNodes = {}, valueNodes = expression.values, id;
|
||||
for (id in valueNodes) {
|
||||
var sourceFrame = this.sourceNodeMap_.get(valueNodes[id]);
|
||||
sourceCodeNodes[id] = Object.assign({}, sourceFrame);
|
||||
}
|
||||
return sourceCodeNodes;
|
||||
};
|
||||
ee.Serializer.encodeCloudApiPretty = function(obj) {
|
||||
var encoded = (new ee.Serializer(!1)).encodeForCloudApi_(obj), values = encoded.values, walkObject = function(object) {
|
||||
if (!goog.isObject(object)) {
|
||||
@ -18871,7 +18895,7 @@ goog.exportSymbol("ee.Serializer.toReadableCloudApiJSON", ee.Serializer.toReadab
|
||||
ee.Serializer.prototype.encodeForCloudApi_ = function(obj) {
|
||||
try {
|
||||
var result = this.makeReference(obj);
|
||||
return (new ExpressionOptimizer(result, this.scope_, this.isCompound_)).optimize();
|
||||
return (new ExpressionOptimizer(result, this.scope_, this.isCompound_, this.sourceNodeMap_)).optimize();
|
||||
} finally {
|
||||
this.hashes_ = new WeakMap(), this.encoded_ = {}, this.scope_ = [];
|
||||
}
|
||||
@ -18897,7 +18921,9 @@ ee.Serializer.prototype.makeReference = function(obj) {
|
||||
return makeRef(ee.rpc_node.functionByName("Date", {value:ee.rpc_node.constant(Math.floor(obj.getTime()))}));
|
||||
}
|
||||
if (obj instanceof ee.Encodable) {
|
||||
return makeRef(obj.encodeCloudValue(this));
|
||||
var value = obj.encodeCloudValue(this), sourceFrame = obj.getSourceFrame();
|
||||
null !== sourceFrame && this.sourceNodeMap_.set(value, sourceFrame);
|
||||
return makeRef(value);
|
||||
}
|
||||
if (Array.isArray(obj)) {
|
||||
return makeRef(ee.rpc_node.array(obj.map(function(x) {
|
||||
@ -18913,7 +18939,7 @@ ee.Serializer.prototype.makeReference = function(obj) {
|
||||
}
|
||||
throw Error("Can't encode object: " + obj);
|
||||
};
|
||||
var ExpressionOptimizer = function(rootReference, values, isCompound) {
|
||||
var ExpressionOptimizer = function(rootReference, values, isCompound, sourceNodeMap) {
|
||||
var $jscomp$this = this;
|
||||
this.rootReference = rootReference;
|
||||
this.values = {};
|
||||
@ -18924,6 +18950,7 @@ var ExpressionOptimizer = function(rootReference, values, isCompound) {
|
||||
this.optimizedValues = {};
|
||||
this.referenceMap = {};
|
||||
this.nextMappedRef = 0;
|
||||
this.sourceNodeMap = sourceNodeMap;
|
||||
};
|
||||
ExpressionOptimizer.prototype.optimize = function() {
|
||||
var result = this.optimizeReference(this.rootReference);
|
||||
@ -18943,21 +18970,32 @@ ExpressionOptimizer.prototype.optimizeValue = function(value, depth) {
|
||||
return null !== v.constantValue;
|
||||
}, serializeConst = function(v) {
|
||||
return v === module$exports$eeapiclient$domain_object.NULL_VALUE ? null : v;
|
||||
}, storeInSourceMap = function(parentValue, valueNode) {
|
||||
$jscomp$this.sourceNodeMap && $jscomp$this.sourceNodeMap.has(parentValue) && !$jscomp$this.sourceNodeMap.has(valueNode) && $jscomp$this.sourceNodeMap.set(valueNode, $jscomp$this.sourceNodeMap.get(parentValue));
|
||||
return valueNode;
|
||||
};
|
||||
if (isConst(value) || null != value.integerValue || null != value.bytesValue || null != value.argumentReference) {
|
||||
return value;
|
||||
}
|
||||
if (null != value.valueReference) {
|
||||
var val = this.values[value.valueReference];
|
||||
return null === this.referenceCounts || 50 > depth && 1 === this.referenceCounts[value.valueReference] ? this.optimizeValue(val, depth) : ExpressionOptimizer.isAlwaysLiftable(val) ? val : ee.rpc_node.reference(this.optimizeReference(value.valueReference));
|
||||
var referencedValue = this.values[value.valueReference];
|
||||
if (null === this.referenceCounts || 50 > depth && 1 === this.referenceCounts[value.valueReference]) {
|
||||
var optimized = this.optimizeValue(referencedValue, depth);
|
||||
return storeInSourceMap(value, optimized);
|
||||
}
|
||||
if (ExpressionOptimizer.isAlwaysLiftable(referencedValue)) {
|
||||
return storeInSourceMap(value, referencedValue);
|
||||
}
|
||||
var optimized$jscomp$0 = ee.rpc_node.reference(this.optimizeReference(value.valueReference));
|
||||
return storeInSourceMap(value, optimized$jscomp$0);
|
||||
}
|
||||
if (null != value.arrayValue) {
|
||||
var arr = value.arrayValue.values.map(function(v) {
|
||||
return $jscomp$this.optimizeValue(v, depth + 3);
|
||||
});
|
||||
return arr.every(isConst) ? ee.rpc_node.constant(arr.map(function(v) {
|
||||
}), optimized$jscomp$1 = arr.every(isConst) ? ee.rpc_node.constant(arr.map(function(v) {
|
||||
return serializeConst(v.constantValue);
|
||||
})) : ee.rpc_node.array(arr);
|
||||
return storeInSourceMap(value, optimized$jscomp$1);
|
||||
}
|
||||
if (null != value.dictionaryValue) {
|
||||
for (var values = {}, constantValues = {}, $jscomp$iter$39 = $jscomp.makeIterator(Object.entries(value.dictionaryValue.values || {})), $jscomp$key$ = $jscomp$iter$39.next(); !$jscomp$key$.done; $jscomp$key$ = $jscomp$iter$39.next()) {
|
||||
@ -18965,18 +19003,19 @@ ExpressionOptimizer.prototype.optimizeValue = function(value, depth) {
|
||||
values[k] = this.optimizeValue(v, depth + 3);
|
||||
null !== constantValues && isConst(values[k]) ? constantValues[k] = serializeConst(values[k].constantValue) : constantValues = null;
|
||||
}
|
||||
return null !== constantValues ? ee.rpc_node.constant(constantValues) : ee.rpc_node.dictionary(values);
|
||||
return null !== constantValues ? storeInSourceMap(value, ee.rpc_node.constant(constantValues)) : storeInSourceMap(values, ee.rpc_node.dictionary(values));
|
||||
}
|
||||
if (null != value.functionDefinitionValue) {
|
||||
var def = value.functionDefinitionValue;
|
||||
return ee.rpc_node.functionDefinition(def.argumentNames || [], this.optimizeReference(def.body || ""));
|
||||
var def = value.functionDefinitionValue, optimized$jscomp$2 = ee.rpc_node.functionDefinition(def.argumentNames || [], this.optimizeReference(def.body || ""));
|
||||
return storeInSourceMap(value, optimized$jscomp$2);
|
||||
}
|
||||
if (null != value.functionInvocationValue) {
|
||||
for (var inv = value.functionInvocationValue, args = {}, $jscomp$iter$40 = $jscomp.makeIterator(Object.keys(inv.arguments || {})), $jscomp$key$k = $jscomp$iter$40.next(); !$jscomp$key$k.done; $jscomp$key$k = $jscomp$iter$40.next()) {
|
||||
var k$jscomp$0 = $jscomp$key$k.value;
|
||||
args[k$jscomp$0] = this.optimizeValue(inv.arguments[k$jscomp$0], depth + 3);
|
||||
}
|
||||
return inv.functionName ? ee.rpc_node.functionByName(inv.functionName, args) : ee.rpc_node.functionByReference(this.optimizeReference(inv.functionReference || ""), args);
|
||||
var optimized$jscomp$3 = inv.functionName ? ee.rpc_node.functionByName(inv.functionName, args) : ee.rpc_node.functionByReference(this.optimizeReference(inv.functionReference || ""), args);
|
||||
return storeInSourceMap(value, optimized$jscomp$3);
|
||||
}
|
||||
throw Error("Can't optimize value: " + value);
|
||||
};
|
||||
@ -19425,7 +19464,9 @@ ee.data.listFeatures = function(asset, params, opt_callback) {
|
||||
};
|
||||
goog.exportSymbol("ee.data.listFeatures", ee.data.listFeatures);
|
||||
ee.data.computeValue = function(obj, opt_callback) {
|
||||
var request = {expression:ee.data.expressionAugmenter_(ee.Serializer.encodeCloudApiExpressionWithSerializer(new ee.Serializer(!0), obj, void 0))}, workloadTag = ee.data.getWorkloadTag();
|
||||
var serializer = new ee.Serializer(!0), expression = ee.Serializer.encodeCloudApiExpressionWithSerializer(serializer, obj, void 0), extraMetadata = {}, sourceCodeNodes = serializer.encodeSourceCodeNodes(expression);
|
||||
Object.keys(sourceCodeNodes).length && (extraMetadata = {__source_code_nodes__:sourceCodeNodes});
|
||||
var request = {expression:ee.data.expressionAugmenter_(expression, extraMetadata)}, workloadTag = ee.data.getWorkloadTag();
|
||||
workloadTag && (request.workloadTag = workloadTag);
|
||||
var call = new module$contents$ee$apiclient_Call(opt_callback);
|
||||
return call.handle(call.value().compute(call.projectsPath(), new module$exports$eeapiclient$ee_api_client.ComputeValueRequest(request)).then(function(x) {
|
||||
@ -19570,15 +19611,18 @@ ee.data.newTaskId = function(opt_count, opt_callback) {
|
||||
return opt_callback ? opt_callback(uuids) : uuids;
|
||||
};
|
||||
goog.exportSymbol("ee.data.newTaskId", ee.data.newTaskId);
|
||||
ee.data.isOperationError_ = function(response) {
|
||||
return response.name && response.done && response.error;
|
||||
};
|
||||
ee.data.getTaskStatus = function(taskId, opt_callback) {
|
||||
var opNames = ee.data.makeStringArray_(taskId).map(ee.rpc_convert.taskIdToOperationName);
|
||||
if (1 === opNames.length) {
|
||||
var call = new module$contents$ee$apiclient_Call(opt_callback);
|
||||
var call = (new module$contents$ee$apiclient_Call(opt_callback)).withDetectPartialError(ee.data.isOperationError_);
|
||||
return call.handle(call.operations().get(opNames[0]).then(function(op) {
|
||||
return [ee.rpc_convert.operationToTask(op)];
|
||||
}));
|
||||
}
|
||||
var call$jscomp$0 = new module$contents$ee$apiclient_BatchCall(opt_callback), operations = call$jscomp$0.operations();
|
||||
var call$jscomp$0 = (new module$contents$ee$apiclient_BatchCall(opt_callback)).withDetectPartialError(ee.data.isOperationError_), operations = call$jscomp$0.operations();
|
||||
return call$jscomp$0.send(opNames.map(function(op) {
|
||||
return [op, operations.get(op)];
|
||||
}), function(data) {
|
||||
@ -19641,10 +19685,10 @@ goog.exportSymbol("ee.data.cancelOperation", ee.data.cancelOperation);
|
||||
ee.data.getOperation = function(operationName, opt_callback) {
|
||||
var opNames = ee.data.makeStringArray_(operationName).map(ee.rpc_convert.taskIdToOperationName);
|
||||
if (!Array.isArray(operationName)) {
|
||||
var call = new module$contents$ee$apiclient_Call(opt_callback);
|
||||
var call = (new module$contents$ee$apiclient_Call(opt_callback)).withDetectPartialError(ee.data.isOperationError_);
|
||||
return call.handle(call.operations().get(opNames[0]));
|
||||
}
|
||||
var call$jscomp$0 = new module$contents$ee$apiclient_BatchCall(opt_callback), operations = call$jscomp$0.operations();
|
||||
var call$jscomp$0 = (new module$contents$ee$apiclient_BatchCall(opt_callback)).withDetectPartialError(ee.data.isOperationError_), operations = call$jscomp$0.operations();
|
||||
return call$jscomp$0.send(opNames.map(function(op) {
|
||||
return [op, operations.get(op)];
|
||||
}));
|
||||
@ -20003,8 +20047,6 @@ ee.data.AssetQuotaEntry = function() {
|
||||
};
|
||||
ee.data.AssetQuotaDetails = function() {
|
||||
};
|
||||
ee.data.SourceFrame = function() {
|
||||
};
|
||||
ee.data.sourceFrameGenerator_ = null;
|
||||
ee.data.FeatureViewDescription = function() {
|
||||
};
|
||||
@ -20109,6 +20151,9 @@ ee.ComputedObject = function(func, args, opt_varName) {
|
||||
};
|
||||
goog.inherits(ee.ComputedObject, ee.Encodable);
|
||||
goog.exportSymbol("ee.ComputedObject", ee.ComputedObject);
|
||||
ee.ComputedObject.prototype.getSourceFrame = function() {
|
||||
return this.sourceFrame;
|
||||
};
|
||||
ee.ComputedObject.prototype.evaluate = function(callback) {
|
||||
if (!callback || "function" !== typeof callback) {
|
||||
throw Error("evaluate() requires a callback function.");
|
||||
@ -24295,7 +24340,7 @@ function module$contents$safevalues$builders$attribute_builders_safeAttrPrefix(t
|
||||
}
|
||||
;var module$contents$safevalues$internals$pure_module = module$contents$safevalues$internals$pure_module || {id:"third_party/javascript/safevalues/internals/pure.closure.js"};
|
||||
function module$contents$safevalues$internals$pure_pure(valueOf) {
|
||||
return {valueOf:valueOf}.valueOf();
|
||||
return valueOf();
|
||||
}
|
||||
;var module$exports$goog$html$internals = {};
|
||||
module$exports$goog$html$internals.createSafeHtml = module$contents$goog$html$SafeHtml_SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse;
|
||||
@ -24322,14 +24367,7 @@ function module$contents$safevalues$internals$url_impl_unwrapUrl(value) {
|
||||
module$exports$safevalues$internals$url_impl.unwrapUrl = module$contents$safevalues$internals$url_impl_unwrapUrl;
|
||||
var module$exports$safevalues$builders$url_sanitizer = {}, module$contents$safevalues$builders$url_sanitizer_module = module$contents$safevalues$builders$url_sanitizer_module || {id:"third_party/javascript/safevalues/builders/url_sanitizer.closure.js"}, module$contents$safevalues$builders$url_sanitizer_ASSUME_IMPLEMENTS_URL_API = 2020 <= goog.FEATURESET_YEAR, module$contents$safevalues$builders$url_sanitizer_supportsURLAPI =
|
||||
module$contents$safevalues$internals$pure_pure(function() {
|
||||
if (module$contents$safevalues$builders$url_sanitizer_ASSUME_IMPLEMENTS_URL_API) {
|
||||
return !0;
|
||||
}
|
||||
try {
|
||||
return new URL("s://g"), !0;
|
||||
} catch (e) {
|
||||
return !1;
|
||||
}
|
||||
return module$contents$safevalues$builders$url_sanitizer_ASSUME_IMPLEMENTS_URL_API ? !0 : "function" === typeof URL;
|
||||
});
|
||||
function module$contents$safevalues$builders$url_sanitizer_legacyExtractScheme(url) {
|
||||
var aTag = document.createElement("a");
|
||||
@ -25077,8 +25115,8 @@ module$exports$safevalues$builders$style_sheet_builders.safeStyleRule = function
|
||||
function module$contents$safevalues$builders$style_sheet_builders_safeStyleSheet(templateObj) {
|
||||
goog.DEBUG && module$contents$safevalues$internals$string_literal_assertIsTemplateObject(templateObj, 0);
|
||||
var styleSheet = templateObj[0];
|
||||
if (goog.DEBUG && /[<>]/.test(styleSheet)) {
|
||||
throw Error("Forbidden characters in styleSheet string: " + styleSheet);
|
||||
if (goog.DEBUG && /</.test(styleSheet)) {
|
||||
throw Error("'<' character is forbidden in styleSheet string: " + styleSheet);
|
||||
}
|
||||
return module$contents$safevalues$internals$style_sheet_impl_createStyleSheetInternal(styleSheet);
|
||||
}
|
||||
@ -26332,28 +26370,28 @@ ee.data.Profiler.Format.prototype.toString = function() {
|
||||
ee.data.Profiler.Format.TEXT = new ee.data.Profiler.Format("text");
|
||||
ee.data.Profiler.Format.JSON = new ee.data.Profiler.Format("json");
|
||||
(function() {
|
||||
var exportedFnInfo = {}, orderedFnNames = "ee.ApiFunction.lookup ee.ApiFunction._call ee.ApiFunction._apply ee.batch.Export.table.toDrive ee.batch.Export.table.toFeatureView ee.batch.Export.image.toCloudStorage ee.batch.Export.table.toAsset ee.batch.Export.video.toDrive ee.batch.Export.classifier.toAsset ee.batch.Export.map.toCloudStorage ee.batch.Export.video.toCloudStorage ee.batch.Export.videoMap.toCloudStorage ee.batch.Export.image.toAsset ee.batch.Export.table.toCloudStorage ee.batch.Export.image.toDrive ee.Collection.prototype.sort ee.Collection.prototype.filterBounds ee.Collection.prototype.limit ee.Collection.prototype.map ee.Collection.prototype.filter ee.Collection.prototype.filterDate ee.Collection.prototype.filterMetadata ee.Collection.prototype.iterate ee.ComputedObject.prototype.evaluate ee.ComputedObject.prototype.getInfo ee.ComputedObject.prototype.serialize ee.ComputedObject.prototype.aside ee.data.setDefaultWorkloadTag ee.data.getFeatureViewTilesKey ee.data.authenticate ee.data.createFolder ee.data.makeTableDownloadUrl ee.data.listFeatures ee.data.startIngestion ee.data.computeValue ee.data.getTaskList ee.data.getTableDownloadId ee.data.setWorkloadTag ee.data.getVideoThumbId ee.data.getWorkloadTag ee.data.getFilmstripThumbId ee.data.getAsset ee.data.makeDownloadUrl ee.data.makeThumbUrl ee.data.getThumbId ee.data.listImages ee.data.authenticateViaPrivateKey ee.data.createAsset ee.data.listBuckets ee.data.getDownloadId ee.data.createAssetHome ee.data.getAssetRootQuota ee.data.cancelTask ee.data.getAssetRoots ee.data.setAssetProperties ee.data.getOperation ee.data.getAssetAcl ee.data.startTableIngestion ee.data.getTaskListWithLimit ee.data.getList ee.data.listAssets ee.data.deleteAsset ee.data.setAssetAcl ee.data.cancelOperation ee.data.listOperations ee.data.resetWorkloadTag ee.data.getTaskStatus ee.data.getInfo ee.data.copyAsset ee.data.updateTask ee.data.startProcessing ee.data.newTaskId ee.data.getMapId ee.data.updateAsset ee.data.renameAsset ee.data.authenticateViaPopup ee.data.getTileUrl ee.data.authenticateViaOauth ee.Date ee.Deserializer.fromJSON ee.Deserializer.decodeCloudApi ee.Deserializer.decode ee.Deserializer.fromCloudApiJSON ee.Dictionary ee.reset ee.TILE_SIZE ee.call ee.apply ee.Algorithms ee.InitState ee.initialize ee.Element.prototype.set ee.Feature ee.Feature.prototype.getMap ee.Feature.prototype.getInfo ee.FeatureCollection ee.FeatureCollection.prototype.getInfo ee.FeatureCollection.prototype.getDownloadURL ee.FeatureCollection.prototype.getMap ee.FeatureCollection.prototype.select ee.Filter.or ee.Filter.gte ee.Filter.date ee.Filter.inList ee.Filter ee.Filter.prototype.not ee.Filter.metadata ee.Filter.eq ee.Filter.neq ee.Filter.bounds ee.Filter.gt ee.Filter.lte ee.Filter.lt ee.Filter.and ee.Function.prototype.call ee.Function.prototype.apply ee.Geometry.Point ee.Geometry.BBox ee.Geometry.LinearRing ee.Geometry.prototype.serialize ee.Geometry.MultiPolygon ee.Geometry ee.Geometry.MultiPoint ee.Geometry.MultiLineString ee.Geometry.Rectangle ee.Geometry.LineString ee.Geometry.Polygon ee.Geometry.prototype.toGeoJSON ee.Geometry.prototype.toGeoJSONString ee.Image ee.Image.prototype.rename ee.Image.prototype.getMap ee.Image.prototype.getDownloadURL ee.Image.rgb ee.Image.prototype.getInfo ee.Image.prototype.getThumbURL ee.Image.prototype.getThumbId ee.Image.prototype.clip ee.Image.prototype.select ee.Image.cat ee.Image.prototype.expression ee.ImageCollection.prototype.getMap ee.ImageCollection.prototype.getInfo ee.ImageCollection.prototype.first ee.ImageCollection.prototype.select ee.ImageCollection ee.ImageCollection.prototype.getFilmstripThumbURL ee.ImageCollection.prototype.getVideoThumbURL ee.List ee.Number ee.Serializer.toJSON ee.Serializer.toReadableJSON ee.Serializer.toReadableCloudApiJSON ee.Serializer.encodeCloudApiPretty ee.Serializer.toCloudApiJSON ee.Serializer.encodeCloudApi ee.Serializer.encode ee.String ee.Terrain".split(" "),
|
||||
orderedParamLists = [["name"], ["name", "var_args"], ["name", "namedArgs"], "collection opt_description opt_folder opt_fileNamePrefix opt_fileFormat opt_selectors opt_maxVertices".split(" "), "collection opt_description opt_assetId opt_maxFeaturesPerTile opt_thinningStrategy opt_thinningRanking opt_zOrderRanking".split(" "), "image opt_description opt_bucket opt_fileNamePrefix opt_dimensions opt_region opt_scale opt_crs opt_crsTransform opt_maxPixels opt_shardSize opt_fileDimensions opt_skipEmptyTiles opt_fileFormat opt_formatOptions".split(" "),
|
||||
var exportedFnInfo = {}, orderedFnNames = "ee.ApiFunction.lookup ee.ApiFunction._apply ee.ApiFunction._call ee.batch.Export.table.toDrive ee.batch.Export.table.toFeatureView ee.batch.Export.image.toCloudStorage ee.batch.Export.table.toAsset ee.batch.Export.video.toDrive ee.batch.Export.classifier.toAsset ee.batch.Export.map.toCloudStorage ee.batch.Export.video.toCloudStorage ee.batch.Export.videoMap.toCloudStorage ee.batch.Export.image.toAsset ee.batch.Export.table.toCloudStorage ee.batch.Export.image.toDrive ee.Collection.prototype.sort ee.Collection.prototype.filterBounds ee.Collection.prototype.limit ee.Collection.prototype.map ee.Collection.prototype.filter ee.Collection.prototype.filterDate ee.Collection.prototype.filterMetadata ee.Collection.prototype.iterate ee.ComputedObject.prototype.getInfo ee.ComputedObject.prototype.serialize ee.ComputedObject.prototype.aside ee.ComputedObject.prototype.evaluate ee.data.getWorkloadTag ee.data.getList ee.data.createAsset ee.data.getAssetAcl ee.data.listAssets ee.data.getFeatureViewTilesKey ee.data.listFeatures ee.data.makeTableDownloadUrl ee.data.getInfo ee.data.getTableDownloadId ee.data.makeDownloadUrl ee.data.getThumbId ee.data.getAssetRootQuota ee.data.getDownloadId ee.data.getVideoThumbId ee.data.getFilmstripThumbId ee.data.makeThumbUrl ee.data.computeValue ee.data.createAssetHome ee.data.authenticateViaPopup ee.data.getAssetRoots ee.data.authenticateViaPrivateKey ee.data.listImages ee.data.setAssetProperties ee.data.listBuckets ee.data.setAssetAcl ee.data.deleteAsset ee.data.resetWorkloadTag ee.data.cancelOperation ee.data.listOperations ee.data.getTaskList ee.data.copyAsset ee.data.updateAsset ee.data.getTaskListWithLimit ee.data.getAsset ee.data.renameAsset ee.data.newTaskId ee.data.cancelTask ee.data.authenticate ee.data.createFolder ee.data.getOperation ee.data.setWorkloadTag ee.data.getMapId ee.data.startTableIngestion ee.data.setDefaultWorkloadTag ee.data.startProcessing ee.data.updateTask ee.data.getTileUrl ee.data.authenticateViaOauth ee.data.getTaskStatus ee.data.startIngestion ee.Date ee.Deserializer.decodeCloudApi ee.Deserializer.decode ee.Deserializer.fromJSON ee.Deserializer.fromCloudApiJSON ee.Dictionary ee.InitState ee.apply ee.Algorithms ee.initialize ee.call ee.TILE_SIZE ee.reset ee.Element.prototype.set ee.Encodable.SourceFrame ee.Feature ee.Feature.prototype.getMap ee.Feature.prototype.getInfo ee.FeatureCollection ee.FeatureCollection.prototype.getInfo ee.FeatureCollection.prototype.getDownloadURL ee.FeatureCollection.prototype.getMap ee.FeatureCollection.prototype.select ee.Filter.lte ee.Filter.gt ee.Filter.lt ee.Filter.and ee.Filter.or ee.Filter.gte ee.Filter.date ee.Filter.inList ee.Filter ee.Filter.prototype.not ee.Filter.metadata ee.Filter.eq ee.Filter.neq ee.Filter.bounds ee.Function.prototype.apply ee.Function.prototype.call ee.Geometry.Rectangle ee.Geometry.LineString ee.Geometry.Polygon ee.Geometry.prototype.toGeoJSON ee.Geometry.prototype.toGeoJSONString ee.Geometry.Point ee.Geometry.BBox ee.Geometry.LinearRing ee.Geometry.prototype.serialize ee.Geometry.MultiPolygon ee.Geometry ee.Geometry.MultiPoint ee.Geometry.MultiLineString ee.Image ee.Image.prototype.expression ee.Image.prototype.getMap ee.Image.prototype.rename ee.Image.prototype.getDownloadURL ee.Image.prototype.getInfo ee.Image.rgb ee.Image.prototype.getThumbURL ee.Image.prototype.getThumbId ee.Image.prototype.clip ee.Image.prototype.select ee.Image.cat ee.ImageCollection.prototype.getMap ee.ImageCollection.prototype.getInfo ee.ImageCollection.prototype.first ee.ImageCollection.prototype.select ee.ImageCollection ee.ImageCollection.prototype.getFilmstripThumbURL ee.ImageCollection.prototype.getVideoThumbURL ee.List ee.Number ee.Serializer.encode ee.Serializer.toJSON ee.Serializer.encodeCloudApiPretty ee.Serializer.encodeCloudApi ee.Serializer.toReadableJSON ee.Serializer.toCloudApiJSON ee.Serializer.toReadableCloudApiJSON ee.String ee.Terrain".split(" "),
|
||||
orderedParamLists = [["name"], ["name", "namedArgs"], ["name", "var_args"], "collection opt_description opt_folder opt_fileNamePrefix opt_fileFormat opt_selectors opt_maxVertices".split(" "), "collection opt_description opt_assetId opt_maxFeaturesPerTile opt_thinningStrategy opt_thinningRanking opt_zOrderRanking".split(" "), "image opt_description opt_bucket opt_fileNamePrefix opt_dimensions opt_region opt_scale opt_crs opt_crsTransform opt_maxPixels opt_shardSize opt_fileDimensions opt_skipEmptyTiles opt_fileFormat opt_formatOptions".split(" "),
|
||||
["collection", "opt_description", "opt_assetId", "opt_maxVertices"], "collection opt_description opt_folder opt_fileNamePrefix opt_framesPerSecond opt_dimensions opt_region opt_scale opt_crs opt_crsTransform opt_maxPixels opt_maxFrames".split(" "), ["classifier", "opt_description", "opt_assetId"], "image opt_description opt_bucket opt_fileFormat opt_path opt_writePublicTiles opt_scale opt_maxZoom opt_minZoom opt_region opt_skipEmptyTiles opt_mapsApiKey opt_bucketCorsUris".split(" "), "collection opt_description opt_bucket opt_fileNamePrefix opt_framesPerSecond opt_dimensions opt_region opt_scale opt_crs opt_crsTransform opt_maxPixels opt_maxFrames".split(" "),
|
||||
"collection opt_description opt_bucket opt_fileNamePrefix opt_framesPerSecond opt_writePublicTiles opt_minZoom opt_maxZoom opt_scale opt_region opt_skipEmptyTiles opt_minTimeMachineZoomSubset opt_maxTimeMachineZoomSubset opt_tileWidth opt_tileHeight opt_tileStride opt_videoFormat opt_version opt_mapsApiKey opt_bucketCorsUris".split(" "), "image opt_description opt_assetId opt_pyramidingPolicy opt_dimensions opt_region opt_scale opt_crs opt_crsTransform opt_maxPixels opt_shardSize".split(" "), "collection opt_description opt_bucket opt_fileNamePrefix opt_fileFormat opt_selectors opt_maxVertices".split(" "),
|
||||
"image opt_description opt_folder opt_fileNamePrefix opt_dimensions opt_region opt_scale opt_crs opt_crsTransform opt_maxPixels opt_shardSize opt_fileDimensions opt_skipEmptyTiles opt_fileFormat opt_formatOptions".split(" "), ["property", "opt_ascending"], ["geometry"], ["max", "opt_property", "opt_ascending"], ["algorithm", "opt_dropNulls"], ["filter"], ["start", "opt_end"], ["name", "operator", "value"], ["algorithm", "opt_first"], ["callback"], ["opt_callback"], ["legacy"], ["func", "var_args"],
|
||||
["tag"], ["params", "opt_callback"], ["clientId", "success", "opt_error", "opt_extraScopes", "opt_onImmediateFailed"], ["path", "opt_force", "opt_callback"], ["id"], ["asset", "params", "opt_callback"], ["taskId", "request", "opt_callback"], ["obj", "opt_callback"], ["opt_callback"], ["params", "opt_callback"], ["tag"], ["params", "opt_callback"], [], ["params", "opt_callback"], ["id", "opt_callback"], ["id"], ["id"], ["params", "opt_callback"], ["parent", "opt_params", "opt_callback"], ["privateKey",
|
||||
"opt_success", "opt_error", "opt_extraScopes", "opt_suppressDefaultScopes"], ["value", "opt_path", "opt_force", "opt_properties", "opt_callback"], ["project", "opt_callback"], ["params", "opt_callback"], ["requestedId", "opt_callback"], ["rootId", "opt_callback"], ["taskId", "opt_callback"], ["opt_callback"], ["assetId", "properties", "opt_callback"], ["operationName", "opt_callback"], ["assetId", "opt_callback"], ["taskId", "request", "opt_callback"], ["opt_limit", "opt_callback"], ["params",
|
||||
"opt_callback"], ["parent", "opt_params", "opt_callback"], ["assetId", "opt_callback"], ["assetId", "aclUpdate", "opt_callback"], ["operationName", "opt_callback"], ["opt_limit", "opt_callback"], ["opt_resetDefault"], ["taskId", "opt_callback"], ["id", "opt_callback"], ["sourceId", "destinationId", "opt_overwrite", "opt_callback"], ["taskId", "action", "opt_callback"], ["taskId", "params", "opt_callback"], ["opt_count", "opt_callback"], ["params", "opt_callback"], ["assetId", "asset", "updateFields",
|
||||
"opt_callback"], ["sourceId", "destinationId", "opt_callback"], ["opt_success", "opt_error"], ["id", "x", "y", "z"], "clientId success opt_error opt_extraScopes opt_onImmediateFailed opt_suppressDefaultScopes".split(" "), ["date", "opt_tz"], ["json"], ["json"], ["json"], ["json"], ["opt_dict"], [], [], ["func", "var_args"], ["func", "namedArgs"], [], [], "opt_baseurl opt_tileurl opt_successCallback opt_errorCallback opt_xsrfToken opt_project".split(" "), ["var_args"], ["geometry", "opt_properties"],
|
||||
["opt_visParams", "opt_callback"], ["opt_callback"], ["args", "opt_column"], ["opt_callback"], ["opt_format", "opt_selectors", "opt_filename", "opt_callback"], ["opt_visParams", "opt_callback"], ["propertySelectors", "opt_newProperties", "opt_retainGeometry"], ["var_args"], ["name", "value"], ["start", "opt_end"], ["opt_leftField", "opt_rightValue", "opt_rightField", "opt_leftValue"], ["opt_filter"], [], ["name", "operator", "value"], ["name", "value"], ["name", "value"], ["geometry", "opt_errorMargin"],
|
||||
["name", "value"], ["name", "value"], ["name", "value"], ["var_args"], ["var_args"], ["namedArgs"], ["coords", "opt_proj"], ["west", "south", "east", "north"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError"], ["legacy"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError", "opt_evenOdd"], ["geoJson", "opt_proj", "opt_geodesic", "opt_evenOdd"], ["coords", "opt_proj"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError"], ["coords", "opt_proj", "opt_geodesic", "opt_evenOdd"], ["coords",
|
||||
"opt_proj", "opt_geodesic", "opt_maxError"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError", "opt_evenOdd"], [], [], ["opt_args"], ["var_args"], ["opt_visParams", "opt_callback"], ["params", "opt_callback"], ["r", "g", "b"], ["opt_callback"], ["params", "opt_callback"], ["params", "opt_callback"], ["geometry"], ["var_args"], ["var_args"], ["expression", "opt_map"], ["opt_visParams", "opt_callback"], ["opt_callback"], [], ["selectors", "opt_names"], ["args"], ["params", "opt_callback"], ["params",
|
||||
"opt_callback"], ["list"], ["number"], ["obj"], ["obj"], ["obj"], ["obj"], ["obj"], ["obj"], ["obj", "opt_isCompound"], ["string"], []];
|
||||
[ee.ApiFunction.lookup, ee.ApiFunction._call, ee.ApiFunction._apply, module$contents$ee$batch_Export.table.toDrive, module$contents$ee$batch_Export.table.toFeatureView, module$contents$ee$batch_Export.image.toCloudStorage, module$contents$ee$batch_Export.table.toAsset, module$contents$ee$batch_Export.video.toDrive, module$contents$ee$batch_Export.classifier.toAsset, module$contents$ee$batch_Export.map.toCloudStorage, module$contents$ee$batch_Export.video.toCloudStorage, module$contents$ee$batch_Export.videoMap.toCloudStorage,
|
||||
module$contents$ee$batch_Export.image.toAsset, module$contents$ee$batch_Export.table.toCloudStorage, module$contents$ee$batch_Export.image.toDrive, ee.Collection.prototype.sort, ee.Collection.prototype.filterBounds, ee.Collection.prototype.limit, ee.Collection.prototype.map, ee.Collection.prototype.filter, ee.Collection.prototype.filterDate, ee.Collection.prototype.filterMetadata, ee.Collection.prototype.iterate, ee.ComputedObject.prototype.evaluate, ee.ComputedObject.prototype.getInfo, ee.ComputedObject.prototype.serialize,
|
||||
ee.ComputedObject.prototype.aside, ee.data.setDefaultWorkloadTag, ee.data.getFeatureViewTilesKey, ee.data.authenticate, ee.data.createFolder, ee.data.makeTableDownloadUrl, ee.data.listFeatures, ee.data.startIngestion, ee.data.computeValue, ee.data.getTaskList, ee.data.getTableDownloadId, ee.data.setWorkloadTag, ee.data.getVideoThumbId, ee.data.getWorkloadTag, ee.data.getFilmstripThumbId, ee.data.getAsset, ee.data.makeDownloadUrl, ee.data.makeThumbUrl, ee.data.getThumbId, ee.data.listImages, ee.data.authenticateViaPrivateKey,
|
||||
ee.data.createAsset, ee.data.listBuckets, ee.data.getDownloadId, ee.data.createAssetHome, ee.data.getAssetRootQuota, ee.data.cancelTask, ee.data.getAssetRoots, ee.data.setAssetProperties, ee.data.getOperation, ee.data.getAssetAcl, ee.data.startTableIngestion, ee.data.getTaskListWithLimit, ee.data.getList, ee.data.listAssets, ee.data.deleteAsset, ee.data.setAssetAcl, ee.data.cancelOperation, ee.data.listOperations, ee.data.resetWorkloadTag, ee.data.getTaskStatus, ee.data.getInfo, ee.data.copyAsset,
|
||||
ee.data.updateTask, ee.data.startProcessing, ee.data.newTaskId, ee.data.getMapId, ee.data.updateAsset, ee.data.renameAsset, ee.data.authenticateViaPopup, ee.data.getTileUrl, ee.data.authenticateViaOauth, ee.Date, ee.Deserializer.fromJSON, ee.Deserializer.decodeCloudApi, ee.Deserializer.decode, ee.Deserializer.fromCloudApiJSON, ee.Dictionary, ee.reset, ee.TILE_SIZE, ee.call, ee.apply, ee.Algorithms, ee.InitState, ee.initialize, ee.Element.prototype.set, ee.Feature, ee.Feature.prototype.getMap, ee.Feature.prototype.getInfo,
|
||||
ee.FeatureCollection, ee.FeatureCollection.prototype.getInfo, ee.FeatureCollection.prototype.getDownloadURL, ee.FeatureCollection.prototype.getMap, ee.FeatureCollection.prototype.select, ee.Filter.or, ee.Filter.gte, ee.Filter.date, ee.Filter.inList, ee.Filter, ee.Filter.prototype.not, ee.Filter.metadata, ee.Filter.eq, ee.Filter.neq, ee.Filter.bounds, ee.Filter.gt, ee.Filter.lte, ee.Filter.lt, ee.Filter.and, ee.Function.prototype.call, ee.Function.prototype.apply, ee.Geometry.Point, ee.Geometry.BBox,
|
||||
ee.Geometry.LinearRing, ee.Geometry.prototype.serialize, ee.Geometry.MultiPolygon, ee.Geometry, ee.Geometry.MultiPoint, ee.Geometry.MultiLineString, ee.Geometry.Rectangle, ee.Geometry.LineString, ee.Geometry.Polygon, ee.Geometry.prototype.toGeoJSON, ee.Geometry.prototype.toGeoJSONString, ee.Image, ee.Image.prototype.rename, ee.Image.prototype.getMap, ee.Image.prototype.getDownloadURL, ee.Image.rgb, ee.Image.prototype.getInfo, ee.Image.prototype.getThumbURL, ee.Image.prototype.getThumbId, ee.Image.prototype.clip,
|
||||
ee.Image.prototype.select, ee.Image.cat, ee.Image.prototype.expression, ee.ImageCollection.prototype.getMap, ee.ImageCollection.prototype.getInfo, ee.ImageCollection.prototype.first, ee.ImageCollection.prototype.select, ee.ImageCollection, ee.ImageCollection.prototype.getFilmstripThumbURL, ee.ImageCollection.prototype.getVideoThumbURL, ee.List, ee.Number, ee.Serializer.toJSON, ee.Serializer.toReadableJSON, ee.Serializer.toReadableCloudApiJSON, ee.Serializer.encodeCloudApiPretty, ee.Serializer.toCloudApiJSON,
|
||||
ee.Serializer.encodeCloudApi, ee.Serializer.encode, ee.String, ee.Terrain].forEach(function(fn, i) {
|
||||
"image opt_description opt_folder opt_fileNamePrefix opt_dimensions opt_region opt_scale opt_crs opt_crsTransform opt_maxPixels opt_shardSize opt_fileDimensions opt_skipEmptyTiles opt_fileFormat opt_formatOptions".split(" "), ["property", "opt_ascending"], ["geometry"], ["max", "opt_property", "opt_ascending"], ["algorithm", "opt_dropNulls"], ["filter"], ["start", "opt_end"], ["name", "operator", "value"], ["algorithm", "opt_first"], ["opt_callback"], ["legacy"], ["func", "var_args"], ["callback"],
|
||||
[], ["params", "opt_callback"], ["value", "opt_path", "opt_force", "opt_properties", "opt_callback"], ["assetId", "opt_callback"], ["parent", "opt_params", "opt_callback"], ["params", "opt_callback"], ["asset", "params", "opt_callback"], ["id"], ["id", "opt_callback"], ["params", "opt_callback"], ["id"], ["params", "opt_callback"], ["rootId", "opt_callback"], ["params", "opt_callback"], ["params", "opt_callback"], ["params", "opt_callback"], ["id"], ["obj", "opt_callback"], ["requestedId", "opt_callback"],
|
||||
["opt_success", "opt_error"], ["opt_callback"], ["privateKey", "opt_success", "opt_error", "opt_extraScopes", "opt_suppressDefaultScopes"], ["parent", "opt_params", "opt_callback"], ["assetId", "properties", "opt_callback"], ["project", "opt_callback"], ["assetId", "aclUpdate", "opt_callback"], ["assetId", "opt_callback"], ["opt_resetDefault"], ["operationName", "opt_callback"], ["opt_limit", "opt_callback"], ["opt_callback"], ["sourceId", "destinationId", "opt_overwrite", "opt_callback"], ["assetId",
|
||||
"asset", "updateFields", "opt_callback"], ["opt_limit", "opt_callback"], ["id", "opt_callback"], ["sourceId", "destinationId", "opt_callback"], ["opt_count", "opt_callback"], ["taskId", "opt_callback"], ["clientId", "success", "opt_error", "opt_extraScopes", "opt_onImmediateFailed"], ["path", "opt_force", "opt_callback"], ["operationName", "opt_callback"], ["tag"], ["params", "opt_callback"], ["taskId", "request", "opt_callback"], ["tag"], ["taskId", "params", "opt_callback"], ["taskId", "action",
|
||||
"opt_callback"], ["id", "x", "y", "z"], "clientId success opt_error opt_extraScopes opt_onImmediateFailed opt_suppressDefaultScopes".split(" "), ["taskId", "opt_callback"], ["taskId", "request", "opt_callback"], ["date", "opt_tz"], ["json"], ["json"], ["json"], ["json"], ["opt_dict"], [], ["func", "namedArgs"], [], "opt_baseurl opt_tileurl opt_successCallback opt_errorCallback opt_xsrfToken opt_project".split(" "), ["func", "var_args"], [], [], ["var_args"], [], ["geometry", "opt_properties"],
|
||||
["opt_visParams", "opt_callback"], ["opt_callback"], ["args", "opt_column"], ["opt_callback"], ["opt_format", "opt_selectors", "opt_filename", "opt_callback"], ["opt_visParams", "opt_callback"], ["propertySelectors", "opt_newProperties", "opt_retainGeometry"], ["name", "value"], ["name", "value"], ["name", "value"], ["var_args"], ["var_args"], ["name", "value"], ["start", "opt_end"], ["opt_leftField", "opt_rightValue", "opt_rightField", "opt_leftValue"], ["opt_filter"], [], ["name", "operator",
|
||||
"value"], ["name", "value"], ["name", "value"], ["geometry", "opt_errorMargin"], ["namedArgs"], ["var_args"], ["coords", "opt_proj", "opt_geodesic", "opt_evenOdd"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError", "opt_evenOdd"], [], [], ["coords", "opt_proj"], ["west", "south", "east", "north"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError"], ["legacy"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError", "opt_evenOdd"],
|
||||
["geoJson", "opt_proj", "opt_geodesic", "opt_evenOdd"], ["coords", "opt_proj"], ["coords", "opt_proj", "opt_geodesic", "opt_maxError"], ["opt_args"], ["expression", "opt_map"], ["opt_visParams", "opt_callback"], ["var_args"], ["params", "opt_callback"], ["opt_callback"], ["r", "g", "b"], ["params", "opt_callback"], ["params", "opt_callback"], ["geometry"], ["var_args"], ["var_args"], ["opt_visParams", "opt_callback"], ["opt_callback"], [], ["selectors", "opt_names"], ["args"], ["params", "opt_callback"],
|
||||
["params", "opt_callback"], ["list"], ["number"], ["obj", "opt_isCompound"], ["obj"], ["obj"], ["obj"], ["obj"], ["obj"], ["obj"], ["string"], []];
|
||||
[ee.ApiFunction.lookup, ee.ApiFunction._apply, ee.ApiFunction._call, module$contents$ee$batch_Export.table.toDrive, module$contents$ee$batch_Export.table.toFeatureView, module$contents$ee$batch_Export.image.toCloudStorage, module$contents$ee$batch_Export.table.toAsset, module$contents$ee$batch_Export.video.toDrive, module$contents$ee$batch_Export.classifier.toAsset, module$contents$ee$batch_Export.map.toCloudStorage, module$contents$ee$batch_Export.video.toCloudStorage, module$contents$ee$batch_Export.videoMap.toCloudStorage,
|
||||
module$contents$ee$batch_Export.image.toAsset, module$contents$ee$batch_Export.table.toCloudStorage, module$contents$ee$batch_Export.image.toDrive, ee.Collection.prototype.sort, ee.Collection.prototype.filterBounds, ee.Collection.prototype.limit, ee.Collection.prototype.map, ee.Collection.prototype.filter, ee.Collection.prototype.filterDate, ee.Collection.prototype.filterMetadata, ee.Collection.prototype.iterate, ee.ComputedObject.prototype.getInfo, ee.ComputedObject.prototype.serialize, ee.ComputedObject.prototype.aside,
|
||||
ee.ComputedObject.prototype.evaluate, ee.data.getWorkloadTag, ee.data.getList, ee.data.createAsset, ee.data.getAssetAcl, ee.data.listAssets, ee.data.getFeatureViewTilesKey, ee.data.listFeatures, ee.data.makeTableDownloadUrl, ee.data.getInfo, ee.data.getTableDownloadId, ee.data.makeDownloadUrl, ee.data.getThumbId, ee.data.getAssetRootQuota, ee.data.getDownloadId, ee.data.getVideoThumbId, ee.data.getFilmstripThumbId, ee.data.makeThumbUrl, ee.data.computeValue, ee.data.createAssetHome, ee.data.authenticateViaPopup,
|
||||
ee.data.getAssetRoots, ee.data.authenticateViaPrivateKey, ee.data.listImages, ee.data.setAssetProperties, ee.data.listBuckets, ee.data.setAssetAcl, ee.data.deleteAsset, ee.data.resetWorkloadTag, ee.data.cancelOperation, ee.data.listOperations, ee.data.getTaskList, ee.data.copyAsset, ee.data.updateAsset, ee.data.getTaskListWithLimit, ee.data.getAsset, ee.data.renameAsset, ee.data.newTaskId, ee.data.cancelTask, ee.data.authenticate, ee.data.createFolder, ee.data.getOperation, ee.data.setWorkloadTag,
|
||||
ee.data.getMapId, ee.data.startTableIngestion, ee.data.setDefaultWorkloadTag, ee.data.startProcessing, ee.data.updateTask, ee.data.getTileUrl, ee.data.authenticateViaOauth, ee.data.getTaskStatus, ee.data.startIngestion, ee.Date, ee.Deserializer.decodeCloudApi, ee.Deserializer.decode, ee.Deserializer.fromJSON, ee.Deserializer.fromCloudApiJSON, ee.Dictionary, ee.InitState, ee.apply, ee.Algorithms, ee.initialize, ee.call, ee.TILE_SIZE, ee.reset, ee.Element.prototype.set, ee.Encodable.SourceFrame,
|
||||
ee.Feature, ee.Feature.prototype.getMap, ee.Feature.prototype.getInfo, ee.FeatureCollection, ee.FeatureCollection.prototype.getInfo, ee.FeatureCollection.prototype.getDownloadURL, ee.FeatureCollection.prototype.getMap, ee.FeatureCollection.prototype.select, ee.Filter.lte, ee.Filter.gt, ee.Filter.lt, ee.Filter.and, ee.Filter.or, ee.Filter.gte, ee.Filter.date, ee.Filter.inList, ee.Filter, ee.Filter.prototype.not, ee.Filter.metadata, ee.Filter.eq, ee.Filter.neq, ee.Filter.bounds, ee.Function.prototype.apply,
|
||||
ee.Function.prototype.call, ee.Geometry.Rectangle, ee.Geometry.LineString, ee.Geometry.Polygon, ee.Geometry.prototype.toGeoJSON, ee.Geometry.prototype.toGeoJSONString, ee.Geometry.Point, ee.Geometry.BBox, ee.Geometry.LinearRing, ee.Geometry.prototype.serialize, ee.Geometry.MultiPolygon, ee.Geometry, ee.Geometry.MultiPoint, ee.Geometry.MultiLineString, ee.Image, ee.Image.prototype.expression, ee.Image.prototype.getMap, ee.Image.prototype.rename, ee.Image.prototype.getDownloadURL, ee.Image.prototype.getInfo,
|
||||
ee.Image.rgb, ee.Image.prototype.getThumbURL, ee.Image.prototype.getThumbId, ee.Image.prototype.clip, ee.Image.prototype.select, ee.Image.cat, ee.ImageCollection.prototype.getMap, ee.ImageCollection.prototype.getInfo, ee.ImageCollection.prototype.first, ee.ImageCollection.prototype.select, ee.ImageCollection, ee.ImageCollection.prototype.getFilmstripThumbURL, ee.ImageCollection.prototype.getVideoThumbURL, ee.List, ee.Number, ee.Serializer.encode, ee.Serializer.toJSON, ee.Serializer.encodeCloudApiPretty,
|
||||
ee.Serializer.encodeCloudApi, ee.Serializer.toReadableJSON, ee.Serializer.toCloudApiJSON, ee.Serializer.toReadableCloudApiJSON, ee.String, ee.Terrain].forEach(function(fn, i) {
|
||||
fn && (exportedFnInfo[fn.toString()] = {name:orderedFnNames[i], paramNames:orderedParamLists[i]});
|
||||
});
|
||||
goog.global.EXPORTED_FN_INFO = exportedFnInfo;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@google/earthengine",
|
||||
"version": "0.1.368",
|
||||
"version": "0.1.369",
|
||||
"description": "JavaScript client for Google Earth Engine API.",
|
||||
"author": "Google LLC",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@ -25,7 +25,7 @@ const {PromiseRequestService} = goog.require('eeapiclient.promise_request_servic
|
||||
/** @namespace */
|
||||
const apiclient = {};
|
||||
|
||||
const API_CLIENT_VERSION = '0.1.368';
|
||||
const API_CLIENT_VERSION = '0.1.369';
|
||||
|
||||
exports.VERSION = apiVersion.VERSION;
|
||||
exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
|
||||
@ -60,6 +60,19 @@ class Call {
|
||||
this.requestService = new EERequestService(!callback, retries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures partial error detection for this Call.
|
||||
*
|
||||
* @param {function(!Object):boolean=} detectPartialError Checks if response
|
||||
* JSON should be returned directly instead of throwing an error.
|
||||
* Needed for Operations. See https://google.aip.dev/193#partial-errors
|
||||
* @return {!Call}
|
||||
*/
|
||||
withDetectPartialError(detectPartialError) {
|
||||
this.requestService.detectPartialError = detectPartialError;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a promise returned by an API call, to call the configured callback.
|
||||
* Also handles the "fake promise" returned in synchronous mode.
|
||||
@ -196,6 +209,8 @@ class EERequestService extends PromiseRequestService {
|
||||
constructor(sync = false, retries = undefined) {
|
||||
super();
|
||||
this.sync = sync;
|
||||
/** @type {function(!Object):boolean|undefined} */
|
||||
this.detectPartialError = undefined;
|
||||
|
||||
if (retries != null) {
|
||||
this.retries = retries;
|
||||
@ -229,7 +244,8 @@ class EERequestService extends PromiseRequestService {
|
||||
const body = params.body ? JSON.stringify(params.body) : undefined;
|
||||
if (this.sync) {
|
||||
const raw = apiclient.send(
|
||||
url, args, undefined, params.httpMethod, body, this.retries);
|
||||
url, args, undefined, params.httpMethod, body, this.retries,
|
||||
this.detectPartialError);
|
||||
const value = responseCtor ? deserialize(responseCtor, raw) : raw;
|
||||
// Converts a value into an "instant" promise, with a then method that
|
||||
// immediately applies a function and builds a new thenable of the result.
|
||||
@ -246,7 +262,8 @@ class EERequestService extends PromiseRequestService {
|
||||
}
|
||||
};
|
||||
apiclient.send(
|
||||
url, args, resolveOrReject, params.httpMethod, body, this.retries);
|
||||
url, args, resolveOrReject, params.httpMethod, body, this.retries,
|
||||
this.detectPartialError);
|
||||
});
|
||||
return value.then(r => responseCtor ? deserialize(responseCtor, r) : r);
|
||||
}
|
||||
@ -272,6 +289,22 @@ class BatchCall extends Call {
|
||||
constructor(callback) {
|
||||
super(callback);
|
||||
this.requestService = new BatchRequestService();
|
||||
/** @type {function(!Object):boolean|undefined} */
|
||||
this.detectPartialError = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures partial error detection for this BatchCall.
|
||||
*
|
||||
* @param {function(!Object):boolean=} detectPartialError Checks if response
|
||||
* JSON should be returned directly instead of throwing an error.
|
||||
* Needed for Operations. See https://google.aip.dev/193#partial-errors
|
||||
* @return {!BatchCall}
|
||||
* @override
|
||||
*/
|
||||
withDetectPartialError(detectPartialError) {
|
||||
this.detectPartialError = detectPartialError;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -315,11 +348,14 @@ class BatchCall extends Call {
|
||||
if (this.callback) {
|
||||
const callback = (result, err = undefined) =>
|
||||
this.callback(err ? result : deserializeResponses(result), err);
|
||||
apiclient.send(batchUrl, null, callback, multipart, body);
|
||||
apiclient.send(
|
||||
batchUrl, null, callback, multipart, body, undefined,
|
||||
this.detectPartialError);
|
||||
return null;
|
||||
}
|
||||
return deserializeResponses(
|
||||
apiclient.send(batchUrl, null, undefined, multipart, body));
|
||||
return deserializeResponses(apiclient.send(
|
||||
batchUrl, null, undefined, multipart, body, undefined,
|
||||
this.detectPartialError));
|
||||
}
|
||||
}
|
||||
|
||||
@ -769,11 +805,13 @@ apiclient.isInitialized = function() {
|
||||
* is POST. If this starts with 'multipart', used as content type instead.
|
||||
* @param {string=} body The payload for POST or multipart requests.
|
||||
* @param {number=} retries Overrides the default max retries value.
|
||||
* @param {function(!Object):boolean=} detectPartialError Checks if response
|
||||
* JSON should be returned directly instead of throwing an error.
|
||||
* @return {?Object} The data object returned by the API call, or null if a
|
||||
* callback was specified.
|
||||
*/
|
||||
apiclient.send = function(
|
||||
path, params, callback, method, body, retries) {
|
||||
path, params, callback, method, body, retries, detectPartialError) {
|
||||
// Make sure we never perform API calls before initialization.
|
||||
apiclient.initialize();
|
||||
|
||||
@ -859,7 +897,8 @@ apiclient.send = function(
|
||||
// Send an asynchronous request.
|
||||
const request =
|
||||
apiclient.buildAsyncRequest_(
|
||||
url, callback, method, requestData, headers, retries);
|
||||
url, callback, method, requestData, headers, retries,
|
||||
detectPartialError);
|
||||
|
||||
apiclient.requestQueue_.push(request);
|
||||
apiclient.RequestThrottle_.fire();
|
||||
@ -904,7 +943,8 @@ apiclient.send = function(
|
||||
// implement getResponseHeader when synchronous.
|
||||
return null;
|
||||
}
|
||||
}, xmlHttp.responseText, profileHookAtCallTime, undefined, url, method);
|
||||
}, xmlHttp.responseText, profileHookAtCallTime, undefined, url, method,
|
||||
detectPartialError);
|
||||
}
|
||||
};
|
||||
|
||||
@ -920,11 +960,13 @@ apiclient.send = function(
|
||||
* @param {?string} content The content of the request.
|
||||
* @param {!Object<string,string>} headers The headers to send with the request.
|
||||
* @param {number=} retries Overrides the default max retries value.
|
||||
* @param {function(!Object):boolean=} detectPartialError Checks if response
|
||||
* JSON should be returned directly instead of throwing an error.
|
||||
* @return {!apiclient.NetworkRequest_} The async request.
|
||||
* @private
|
||||
*/
|
||||
apiclient.buildAsyncRequest_ = function(
|
||||
url, callback, method, content, headers, retries) {
|
||||
url, callback, method, content, headers, retries, detectPartialError) {
|
||||
let retryCount = 0;
|
||||
const request = {
|
||||
url: url,
|
||||
@ -948,7 +990,8 @@ apiclient.buildAsyncRequest_ = function(
|
||||
|
||||
return apiclient.handleResponse_(
|
||||
xhrIo.getStatus(), goog.bind(xhrIo.getResponseHeader, xhrIo),
|
||||
xhrIo.getResponseText(), profileHookAtCallTime, callback, url, method);
|
||||
xhrIo.getResponseText(), profileHookAtCallTime, callback, url, method,
|
||||
detectPartialError);
|
||||
};
|
||||
request.callback = wrappedCallback;
|
||||
|
||||
@ -992,13 +1035,15 @@ apiclient.withProfiling = function(hook, body, thisObject) {
|
||||
* execute if the request is asynchronous.
|
||||
* @param {string=} url The request's URL.
|
||||
* @param {string=} method The request's HTTP method.
|
||||
* @param {function(!Object):boolean=} detectPartialError Checks if response
|
||||
* JSON should be returned directly instead of throwing an error.
|
||||
* @return {?Object} The response data, if the request is synchronous,
|
||||
* otherwise null, if the request is asynchronous.
|
||||
* @private
|
||||
*/
|
||||
apiclient.handleResponse_ = function(
|
||||
status, getResponseHeader, responseText, profileHook, callback, url,
|
||||
method) {
|
||||
method, detectPartialError) {
|
||||
// Only attempt to get the profile response header if we have a hook.
|
||||
const profileId =
|
||||
profileHook ? getResponseHeader(apiclient.PROFILE_HEADER) : '';
|
||||
@ -1009,7 +1054,8 @@ apiclient.handleResponse_ = function(
|
||||
try {
|
||||
const response = JSON.parse(body);
|
||||
if (goog.isObject(response)) {
|
||||
if ('error' in response && 'message' in response['error']) {
|
||||
if ('error' in response && 'message' in response['error'] &&
|
||||
!(detectPartialError && detectPartialError(response))) {
|
||||
return response['error']['message'];
|
||||
}
|
||||
}
|
||||
@ -1035,9 +1081,6 @@ apiclient.handleResponse_ = function(
|
||||
const response = parseJson(responseText);
|
||||
if (response.parsed) {
|
||||
data = response.parsed;
|
||||
if (data === undefined) {
|
||||
errorMessage = 'Malformed response: ' + responseText;
|
||||
}
|
||||
} else {
|
||||
errorMessage = response;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* This class manages the algorithm dictionary and creates JavaScript functions
|
||||
* to apply each EE algorithm.
|
||||
*
|
||||
* @author maxus@google.com (Max Shawabkeh)
|
||||
*/
|
||||
|
||||
goog.provide('ee.ApiFunction');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview Base class for ImageCollection and FeatureCollection.
|
||||
* This class is never intended to be instantiated by the user.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Collection');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview A representation of a computed earthengine object.
|
||||
*
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.ComputedObject');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview An object representing a custom EE Function.
|
||||
* @author maxus@google.com (Max Shawabkeh)
|
||||
*/
|
||||
|
||||
goog.provide('ee.CustomFunction');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview Singleton for all of the library's communication
|
||||
* with the Earth Engine API.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
* @suppress {missingRequire} TODO(user): this shouldn't be needed
|
||||
* @suppress {useOfGoogProvide} TODO(user): Convert to goog.module.
|
||||
*/
|
||||
@ -75,6 +76,7 @@ goog.require('goog.singleton');
|
||||
goog.requireType('ee.Collection');
|
||||
goog.requireType('ee.ComputedObject');
|
||||
goog.requireType('ee.Element');
|
||||
goog.requireType('ee.Encodable');
|
||||
goog.requireType('ee.Image');
|
||||
goog.requireType('ee.data.images');
|
||||
goog.requireType('proto.google.protobuf.Value');
|
||||
@ -556,10 +558,12 @@ ee.data.listFeatures = function(asset, params, opt_callback) {
|
||||
*/
|
||||
ee.data.computeValue = function(obj, opt_callback) {
|
||||
const serializer = new ee.Serializer(true);
|
||||
const expression = ee.data.expressionAugmenter_(
|
||||
ee.Serializer.encodeCloudApiExpressionWithSerializer(
|
||||
serializer, obj, /* unboundName= */ undefined));
|
||||
const request = {expression};
|
||||
const expression = ee.Serializer.encodeCloudApiExpressionWithSerializer(
|
||||
serializer, obj, /* unboundName= */ undefined);
|
||||
let extraMetadata = {};
|
||||
const request = {
|
||||
expression: ee.data.expressionAugmenter_(expression, extraMetadata)
|
||||
};
|
||||
const workloadTag = ee.data.getWorkloadTag();
|
||||
if (workloadTag) {
|
||||
request.workloadTag = workloadTag;
|
||||
@ -961,7 +965,7 @@ ee.data.makeTableDownloadUrl = function(id) {
|
||||
* returned by ee.data.startProcessing and other batch methods.
|
||||
*
|
||||
* @param {number=} opt_count The number of IDs to generate, one by default.
|
||||
* @param {function(!Array.<string>, string=)=} opt_callback An optional
|
||||
* @param {function(?Array.<string>, string=)=} opt_callback An optional
|
||||
* callback. If not supplied, the call is made synchronously.
|
||||
* @return {?Array.<string>} An array containing generated ID strings, or null
|
||||
* if a callback is specified.
|
||||
@ -979,6 +983,16 @@ ee.data.newTaskId = function(opt_count, opt_callback) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Indicator function to determine if a response is an operation error.
|
||||
* @param {!Object} response Response from a JSON API call.
|
||||
* @return {boolean}
|
||||
*/
|
||||
ee.data.isOperationError_ = function(response) {
|
||||
return response['name'] && response['done'] && response['error'];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve status of one or more long-running tasks.
|
||||
*
|
||||
@ -997,13 +1011,16 @@ ee.data.getTaskStatus = function(taskId, opt_callback) {
|
||||
ee.rpc_convert.taskIdToOperationName);
|
||||
if (opNames.length === 1) {
|
||||
const getResponse = (op) => [ee.rpc_convert.operationToTask(op)];
|
||||
const call = new ee.apiclient.Call(opt_callback);
|
||||
// Return operation and don't throw error if operation itself had an error.
|
||||
const call = new ee.apiclient.Call(opt_callback)
|
||||
.withDetectPartialError(ee.data.isOperationError_);
|
||||
return call.handle(call.operations().get(opNames[0]).then(getResponse));
|
||||
}
|
||||
const getResponse = (data) =>
|
||||
opNames.map(id => ee.rpc_convert.operationToTask(data[id]));
|
||||
|
||||
const call = new ee.apiclient.BatchCall(opt_callback);
|
||||
const call = new ee.apiclient.BatchCall(opt_callback)
|
||||
.withDetectPartialError(ee.data.isOperationError_);
|
||||
const operations = call.operations();
|
||||
return call.send(opNames.map(op => [op, operations.get(op)]), getResponse);
|
||||
};
|
||||
@ -1171,10 +1188,13 @@ ee.data.getOperation = function(operationName, opt_callback) {
|
||||
const opNames = ee.data.makeStringArray_(operationName)
|
||||
.map(ee.rpc_convert.taskIdToOperationName);
|
||||
if (!Array.isArray(operationName)) {
|
||||
const call = new ee.apiclient.Call(opt_callback);
|
||||
// Return operation and don't throw error if operation itself had an error.
|
||||
const call = new ee.apiclient.Call(opt_callback)
|
||||
.withDetectPartialError(ee.data.isOperationError_);
|
||||
return call.handle(call.operations().get(opNames[0]));
|
||||
}
|
||||
const call = new ee.apiclient.BatchCall(opt_callback);
|
||||
const call = new ee.apiclient.BatchCall(opt_callback)
|
||||
.withDetectPartialError(ee.data.isOperationError_);
|
||||
const operations = call.operations();
|
||||
return call.send(opNames.map(op => [op, operations.get(op)]));
|
||||
};
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* We don't autogenerate this class because we want the constructor
|
||||
* to promote by pushing things through the server-side Date() function.
|
||||
*
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Date');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview A deserializer that decodes EE object trees from JSON DAGs.
|
||||
*
|
||||
* @author maxus@google.com (Max Shawabkeh)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Deserializer');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview A wrapper for dicts.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Dictionary');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview Initialization and convenience functions for the EE library.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview Base class for Image, Feature and Collection.
|
||||
* This class is never intended to be instantiated by the user.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Element');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview An interface implemented by serializable objects.
|
||||
* @author maxus@google.com (Max Shawabkeh)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Encodable');
|
||||
@ -43,7 +44,6 @@ ee.Encodable.Serializer;
|
||||
*/
|
||||
ee.Encodable.prototype.encodeCloudValue = goog.abstractMethod;
|
||||
|
||||
|
||||
/**
|
||||
* Holds utility functions to build javascript protocol buffer objects.
|
||||
*/
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview An object representing EE Features.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Feature');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview Representation of an Earth Engine FeatureCollection.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.FeatureCollection');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview Collection filters.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*
|
||||
* new Filter('time', low, high)
|
||||
* .bounds(ring)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview A base class for EE Functions.
|
||||
* @author maxus@google.com (Max Shawabkeh)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Function');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview An object representing EE Geometries.
|
||||
* @author maxus@google.com (Max Shawabkeh)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Geometry');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview A representation of an earth engine image.
|
||||
* See: https://sites.google.com/site/earthengineapidocs for more details.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Image');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview Javascript representation for an Earth Engine ImageCollection.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.ImageCollection');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview A wrapper for Lists.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.List');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview A wrapper for numbers.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Number');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview A serializer that encodes EE object trees as JSON DAGs.
|
||||
*
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Serializer');
|
||||
@ -68,6 +69,12 @@ ee.Serializer = function(opt_isCompound) {
|
||||
*/
|
||||
this.hashes_ = new WeakMap();
|
||||
|
||||
/**
|
||||
* A map of ValueNodes to SourceFrames.
|
||||
* @private @const
|
||||
*/
|
||||
this.sourceNodeMap_ = new WeakMap();
|
||||
|
||||
/**
|
||||
* Provides a name for unbound variables in objects. Unbound variables are
|
||||
* otherwise disallowed. See Count Functions usage in customfunction.js.
|
||||
@ -322,7 +329,6 @@ ee.Serializer.encodeCloudApiExpressionWithSerializer = function(
|
||||
return serializer.encodeForCloudApi_(obj);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes an object to a "pretty" JSON representation, in Cloud API format.
|
||||
* @param {*} obj The object to Serialize.
|
||||
@ -406,8 +412,9 @@ ee.Serializer.prototype.encodeForCloudApi_ = function(obj) {
|
||||
// Encode the object tree, storing each node in the scope table.
|
||||
const result = this.makeReference(obj);
|
||||
// Lift constants, and expand references.
|
||||
return new ExpressionOptimizer(result, this.scope_, this.isCompound_)
|
||||
.optimize();
|
||||
return new ExpressionOptimizer(
|
||||
result, this.scope_, this.isCompound_, this.sourceNodeMap_)
|
||||
.optimize();
|
||||
} finally {
|
||||
// Clear state in case of future encoding.
|
||||
this.hashes_ = new WeakMap();
|
||||
@ -460,7 +467,8 @@ ee.Serializer.prototype.makeReference = function(obj) {
|
||||
'Date', {'value': ee.rpc_node.constant(millis)}));
|
||||
} else if (obj instanceof ee.Encodable) {
|
||||
// Some objects know how to encode themselves.
|
||||
return makeRef(obj.encodeCloudValue(this));
|
||||
const value = obj.encodeCloudValue(this);
|
||||
return makeRef(value);
|
||||
} else if (Array.isArray(obj)) {
|
||||
// Convince the type checker that the array is actually an array.
|
||||
const asArray = /** @type {!Array} */(/** @type {*} */(obj));
|
||||
@ -493,8 +501,9 @@ class ExpressionOptimizer {
|
||||
* @param {!Array<!Array<string|!ee.api.ValueNode|?>>} values
|
||||
* @param {boolean} isCompound If true, optimize shared references;
|
||||
* otherwise, expand all references.
|
||||
* @param {!WeakMap} sourceNodeMap A map of ValueNodes to SourceFrames.
|
||||
*/
|
||||
constructor(rootReference, values, isCompound) {
|
||||
constructor(rootReference, values, isCompound, sourceNodeMap) {
|
||||
/** @type {string} */
|
||||
this.rootReference = rootReference;
|
||||
|
||||
@ -513,9 +522,14 @@ class ExpressionOptimizer {
|
||||
|
||||
/** @type {number} */
|
||||
this.nextMappedRef = 0;
|
||||
|
||||
/** @type {!WeakMap} */
|
||||
this.sourceNodeMap = sourceNodeMap;
|
||||
}
|
||||
|
||||
/** @return {!ee.api.Expression} */
|
||||
/**
|
||||
* @return {!ee.api.Expression}
|
||||
*/
|
||||
optimize() {
|
||||
const result = this.optimizeReference(this.rootReference);
|
||||
return new ee.api.Expression({
|
||||
@ -551,56 +565,78 @@ class ExpressionOptimizer {
|
||||
|
||||
const isConst = (v) => v.constantValue !== null;
|
||||
const serializeConst = (v) => v === ee.apiclient.NULL_VALUE ? null : v;
|
||||
// Ensure that any derived ValueNode from a parent node is associated with
|
||||
// its parent's source frame, if available, in order to make sure that the
|
||||
// final, top-level ValueNodes in the expression are contained in the
|
||||
// sourceNodeMap. If the optimizer encounters duplicate ValueNodes, it will
|
||||
// retain the reference to the first one found.
|
||||
const storeInSourceMap = (parentValue, valueNode) => {
|
||||
if (this.sourceNodeMap && this.sourceNodeMap.has(parentValue) &&
|
||||
!this.sourceNodeMap.has(valueNode)) {
|
||||
this.sourceNodeMap.set(valueNode, this.sourceNodeMap.get(parentValue));
|
||||
}
|
||||
return valueNode;
|
||||
};
|
||||
|
||||
if (isConst(value) || value.integerValue != null ||
|
||||
value.bytesValue != null || value.argumentReference != null) {
|
||||
return value;
|
||||
} else if (value.valueReference != null) {
|
||||
const val = this.values[value.valueReference];
|
||||
const referencedValue = this.values[value.valueReference];
|
||||
|
||||
if (this.referenceCounts === null || (depth < DEPTH_LIMIT &&
|
||||
this.referenceCounts[value.valueReference] === 1)) {
|
||||
return this.optimizeValue(val, depth);
|
||||
} else if (ExpressionOptimizer.isAlwaysLiftable(val)) {
|
||||
return val;
|
||||
const optimized = this.optimizeValue(referencedValue, depth);
|
||||
return storeInSourceMap(value, optimized);
|
||||
} else if (ExpressionOptimizer.isAlwaysLiftable(referencedValue)) {
|
||||
return storeInSourceMap(value, referencedValue);
|
||||
} else {
|
||||
return ee.rpc_node.reference(
|
||||
this.optimizeReference(value.valueReference));
|
||||
const optimized =
|
||||
ee.rpc_node.reference(this.optimizeReference(value.valueReference));
|
||||
return storeInSourceMap(value, optimized);
|
||||
}
|
||||
} else if (value.arrayValue != null) {
|
||||
const arr = value.arrayValue.values.map(
|
||||
v => this.optimizeValue(v, depth + 3));
|
||||
return arr.every(isConst)
|
||||
? ee.rpc_node.constant(arr.map(v => serializeConst(v.constantValue)))
|
||||
: ee.rpc_node.array(arr);
|
||||
const optimized =
|
||||
(arr.every(isConst) ? ee.rpc_node.constant(arr.map(
|
||||
v => serializeConst(v.constantValue))) :
|
||||
ee.rpc_node.array(arr));
|
||||
return storeInSourceMap(value, optimized);
|
||||
} else if (value.dictionaryValue != null) {
|
||||
const values = {};
|
||||
let constantValues = {};
|
||||
for (const [k, v] of Object.entries(value.dictionaryValue.values || {})) {
|
||||
values[k] = this.optimizeValue(
|
||||
/** @type {!ee.api.ValueNode} */(v), depth + 3);
|
||||
/** @type {!ee.api.ValueNode} */ (v), depth + 3);
|
||||
if (constantValues !== null && isConst(values[k])) {
|
||||
constantValues[k] = serializeConst(values[k].constantValue);
|
||||
} else {
|
||||
constantValues = null;
|
||||
}
|
||||
}
|
||||
return constantValues !== null
|
||||
? ee.rpc_node.constant(constantValues)
|
||||
: ee.rpc_node.dictionary(values);
|
||||
if (constantValues !== null) {
|
||||
return storeInSourceMap(value, ee.rpc_node.constant(constantValues));
|
||||
} else {
|
||||
return storeInSourceMap(values, ee.rpc_node.dictionary(values));
|
||||
}
|
||||
} else if (value.functionDefinitionValue != null) {
|
||||
const def = value.functionDefinitionValue;
|
||||
return ee.rpc_node.functionDefinition(
|
||||
const optimized = ee.rpc_node.functionDefinition(
|
||||
def.argumentNames || [], this.optimizeReference(def.body || ''));
|
||||
return storeInSourceMap(value, optimized);
|
||||
} else if (value.functionInvocationValue != null) {
|
||||
const inv = value.functionInvocationValue;
|
||||
const args = {};
|
||||
for (const k of Object.keys(inv.arguments || {})) {
|
||||
args[k] = this.optimizeValue(inv.arguments[k], depth + 3);
|
||||
}
|
||||
return inv.functionName
|
||||
? ee.rpc_node.functionByName(inv.functionName, args)
|
||||
: ee.rpc_node.functionByReference(
|
||||
this.optimizeReference(inv.functionReference || ''), args);
|
||||
const optimized =
|
||||
(inv.functionName ?
|
||||
ee.rpc_node.functionByName(inv.functionName, args) :
|
||||
ee.rpc_node.functionByReference(
|
||||
this.optimizeReference(inv.functionReference || ''), args));
|
||||
return storeInSourceMap(value, optimized);
|
||||
}
|
||||
throw Error('Can\'t optimize value: ' + value);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview A wrapper for strings.
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
*/
|
||||
|
||||
goog.provide('ee.String');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @fileoverview A class to generate the ee.Terrain namespace.
|
||||
*
|
||||
* @author gorelick@google.com (Noel Gorelick)
|
||||
* @suppress {useOfGoogProvide}
|
||||
*/
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @fileoverview A set of utilities to work with EE types.
|
||||
* @author maxus@google.com (Max Shawabkeh)
|
||||
*/
|
||||
|
||||
goog.provide('ee.Types');
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""The EE Python library."""
|
||||
|
||||
__version__ = '0.1.368'
|
||||
__version__ = '0.1.369'
|
||||
|
||||
# Using lowercase function naming to match the JavaScript names.
|
||||
# pylint: disable=g-bad-name
|
||||
|
||||
@ -17,6 +17,7 @@ to apply each EE algorithm.
|
||||
import copy
|
||||
import keyword
|
||||
import re
|
||||
from typing import Any, Dict, Optional, Type
|
||||
|
||||
from ee import computedobject
|
||||
from ee import data
|
||||
@ -28,6 +29,7 @@ from ee import function
|
||||
|
||||
class ApiFunction(function.Function):
|
||||
"""An object representing an EE API Function."""
|
||||
_signature: Dict[str, Any]
|
||||
|
||||
# A dictionary of functions defined by the API server.
|
||||
_api = {}
|
||||
@ -36,7 +38,7 @@ class ApiFunction(function.Function):
|
||||
# a function so far using importApi().
|
||||
_bound_signatures = set()
|
||||
|
||||
def __init__(self, name, opt_signature=None):
|
||||
def __init__(self, name: str, opt_signature: Optional[Dict[str, Any]] = None):
|
||||
"""Creates a function defined by the EE API.
|
||||
|
||||
Args:
|
||||
@ -57,14 +59,14 @@ class ApiFunction(function.Function):
|
||||
|
||||
# For Python 3, __hash__ is needed because __eq__ is defined.
|
||||
# See https://docs.python.org/3/reference/datamodel.html#object.__hash__
|
||||
def __hash__(self):
|
||||
def __hash__(self) -> int:
|
||||
return hash(computedobject.ComputedObject.freeze(self.getSignature()))
|
||||
|
||||
def __ne__(self, other):
|
||||
def __ne__(self, other: Any) -> bool:
|
||||
return not self.__eq__(other)
|
||||
|
||||
@classmethod
|
||||
def call_(cls, name, *args, **kwargs):
|
||||
def call_(cls, name: str, *args: Any, **kwargs: Any) -> Any:
|
||||
"""Call a named API function with positional and keyword arguments.
|
||||
|
||||
Args:
|
||||
@ -79,7 +81,7 @@ class ApiFunction(function.Function):
|
||||
return cls.lookup(name).call(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def apply_(cls, name, named_args):
|
||||
def apply_(cls, name: str, named_args: Dict[str, Any]) -> Any:
|
||||
"""Call a named API function with a dictionary of named arguments.
|
||||
|
||||
Args:
|
||||
@ -100,26 +102,27 @@ class ApiFunction(function.Function):
|
||||
del encoder # Unused.
|
||||
return {'functionName': self._signature['name']}
|
||||
|
||||
def getSignature(self):
|
||||
def getSignature(self) -> Dict[str, Any]:
|
||||
"""Returns a description of the interface provided by this function."""
|
||||
return self._signature
|
||||
|
||||
@classmethod
|
||||
def allSignatures(cls):
|
||||
def allSignatures(cls) -> Dict[str, Dict[str, Any]]:
|
||||
"""Returns a map from the name to signature for all API functions."""
|
||||
cls.initialize()
|
||||
return dict([(name, func.getSignature())
|
||||
for name, func in cls._api.items()])
|
||||
|
||||
@classmethod
|
||||
def unboundFunctions(cls):
|
||||
def unboundFunctions(cls) -> Dict[str, Any]:
|
||||
"""Returns the functions that have not been bound using importApi() yet."""
|
||||
cls.initialize()
|
||||
return dict([(name, func) for name, func in cls._api.items()
|
||||
if name not in cls._bound_signatures])
|
||||
|
||||
# TODO(user): Any -> 'ApiFunction' for the return type.
|
||||
@classmethod
|
||||
def lookup(cls, name):
|
||||
def lookup(cls, name: str) -> Any:
|
||||
"""Looks up an API function by name.
|
||||
|
||||
Args:
|
||||
@ -129,13 +132,14 @@ class ApiFunction(function.Function):
|
||||
The requested ApiFunction.
|
||||
"""
|
||||
result = cls.lookupInternal(name)
|
||||
# TODO(user): name -> result?
|
||||
if not name:
|
||||
raise ee_exception.EEException(
|
||||
'Unknown built-in function name: %s' % name)
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def lookupInternal(cls, name):
|
||||
def lookupInternal(cls, name: str) -> Optional['ApiFunction']:
|
||||
"""Looks up an API function by name.
|
||||
|
||||
Args:
|
||||
@ -168,7 +172,13 @@ class ApiFunction(function.Function):
|
||||
cls._bound_signatures = set()
|
||||
|
||||
@classmethod
|
||||
def importApi(cls, target, prefix, type_name, opt_prepend=None):
|
||||
def importApi(
|
||||
cls,
|
||||
target: Any,
|
||||
prefix: str,
|
||||
type_name: str,
|
||||
opt_prepend: Optional[str] = None,
|
||||
) -> None:
|
||||
"""Adds all API functions that begin with a given prefix to a target class.
|
||||
|
||||
Args:
|
||||
@ -233,7 +243,7 @@ class ApiFunction(function.Function):
|
||||
setattr(target, fname, bound_function)
|
||||
|
||||
@staticmethod
|
||||
def clearApi(target):
|
||||
def clearApi(target: Type[Any]) -> None:
|
||||
"""Removes all methods added by importApi() from a target class.
|
||||
|
||||
Args:
|
||||
|
||||
@ -6,6 +6,8 @@ import json
|
||||
import os
|
||||
from typing import Any, Dict, Iterable, Optional
|
||||
|
||||
from googleapiclient import discovery
|
||||
|
||||
import ee
|
||||
from ee import _cloud_api_utils
|
||||
import unittest
|
||||
@ -96,7 +98,7 @@ class ApiTestCase(unittest.TestCase):
|
||||
return {'docid': '5', 'token': '6'}
|
||||
|
||||
|
||||
def _GenerateCloudApiResource(mock_http: Any, raw: Any) -> Any:
|
||||
def _GenerateCloudApiResource(mock_http: Any, raw: Any) -> discovery.Resource:
|
||||
"""Returns a Cloud API resource for testing."""
|
||||
discovery_doc_path = os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)),
|
||||
|
||||
@ -17,7 +17,7 @@ import re
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any, Dict, List, Sequence, Tuple, Union
|
||||
import urllib.parse
|
||||
|
||||
# Prevent TensorFlow from logging anything at the native level.
|
||||
@ -114,7 +114,7 @@ SAVED_MODEL_MAX_SIZE = 400 * 1024 * 1024
|
||||
DEFAULT_VARIABLES_PREFIX = '/variables/variables'
|
||||
|
||||
|
||||
def _add_wait_arg(parser):
|
||||
def _add_wait_arg(parser: argparse.ArgumentParser) -> None:
|
||||
parser.add_argument(
|
||||
'--wait', '-w', nargs='?', default=-1, type=int, const=sys.maxsize,
|
||||
help=('Wait for the task to finish,'
|
||||
@ -123,13 +123,15 @@ def _add_wait_arg(parser):
|
||||
' task in the background, and returns immediately.'))
|
||||
|
||||
|
||||
def _add_overwrite_arg(parser):
|
||||
def _add_overwrite_arg(parser: argparse.ArgumentParser) -> None:
|
||||
parser.add_argument(
|
||||
'--force', '-f', action='store_true',
|
||||
help='Overwrite any existing version of the asset.')
|
||||
|
||||
|
||||
def _upload(args, request, ingestion_function):
|
||||
def _upload(
|
||||
args: argparse.Namespace, request: Dict[str, Any], ingestion_function: Any
|
||||
) -> None:
|
||||
if 0 <= args.wait < 10:
|
||||
raise ee.EEException('Wait time should be at least 10 seconds.')
|
||||
request_id = ee.data.newTaskId()[0]
|
||||
@ -141,7 +143,7 @@ def _upload(args, request, ingestion_function):
|
||||
|
||||
|
||||
# Argument types
|
||||
def _comma_separated_strings(string):
|
||||
def _comma_separated_strings(string: str) -> List[str]:
|
||||
"""Parses an input consisting of comma-separated strings."""
|
||||
error_msg = 'Argument should be a comma-separated list of strings: {}'
|
||||
values = string.split(',')
|
||||
@ -150,7 +152,7 @@ def _comma_separated_strings(string):
|
||||
return values
|
||||
|
||||
|
||||
def _comma_separated_numbers(string):
|
||||
def _comma_separated_numbers(string: str) -> List[float]:
|
||||
"""Parses an input consisting of comma-separated numbers."""
|
||||
error_msg = 'Argument should be a comma-separated list of numbers: {}'
|
||||
values = string.split(',')
|
||||
@ -169,7 +171,7 @@ def _comma_separated_numbers(string):
|
||||
return numbervalues
|
||||
|
||||
|
||||
def _comma_separated_pyramiding_policies(string):
|
||||
def _comma_separated_pyramiding_policies(string: str) -> List[str]:
|
||||
"""Parses an input consisting of comma-separated pyramiding policies."""
|
||||
error_msg = ('Argument should be a comma-separated list of: '
|
||||
'{{"mean", "sample", "min", "max", "mode"}}: {}')
|
||||
@ -185,7 +187,7 @@ def _comma_separated_pyramiding_policies(string):
|
||||
return redvalues
|
||||
|
||||
|
||||
def _decode_number(string):
|
||||
def _decode_number(string: str) -> float:
|
||||
"""Decodes a number from a command line argument."""
|
||||
try:
|
||||
return float(string)
|
||||
@ -194,25 +196,25 @@ def _decode_number(string):
|
||||
'Invalid value for property of type "number": "%s".' % string)
|
||||
|
||||
|
||||
def _timestamp_ms_for_datetime(datetime_obj):
|
||||
def _timestamp_ms_for_datetime(datetime_obj: datetime.datetime) -> int:
|
||||
"""Returns time since the epoch in ms for the given UTC datetime object."""
|
||||
return (
|
||||
int(calendar.timegm(datetime_obj.timetuple()) * 1000) +
|
||||
datetime_obj.microsecond / 1000)
|
||||
datetime_obj.microsecond // 1000)
|
||||
|
||||
|
||||
def _cloud_timestamp_for_timestamp_ms(timestamp_ms):
|
||||
def _cloud_timestamp_for_timestamp_ms(timestamp_ms: float) -> str:
|
||||
"""Returns a Cloud-formatted date for the given millisecond timestamp."""
|
||||
# Desired format is like '2003-09-07T19:30:12.345Z'
|
||||
return datetime.datetime.utcfromtimestamp(
|
||||
timestamp_ms / 1000.0).isoformat() + 'Z'
|
||||
|
||||
|
||||
def _parse_millis(millis):
|
||||
def _parse_millis(millis: float) -> datetime.datetime:
|
||||
return datetime.datetime.fromtimestamp(millis / 1000)
|
||||
|
||||
|
||||
def _decode_date(string):
|
||||
def _decode_date(string: str) -> Union[float, str]:
|
||||
"""Decodes a date from a command line argument, returning msec since epoch".
|
||||
|
||||
Args:
|
||||
@ -245,7 +247,7 @@ def _decode_date(string):
|
||||
'Invalid value for property of type "date": "%s".' % string)
|
||||
|
||||
|
||||
def _decode_property(string):
|
||||
def _decode_property(string: str) -> Tuple[str, Any]:
|
||||
"""Decodes a general key-value property from a command-line argument.
|
||||
|
||||
Args:
|
||||
@ -319,7 +321,7 @@ def _decode_property_flags(args):
|
||||
return dict(property_list)
|
||||
|
||||
|
||||
def _check_valid_files(filenames):
|
||||
def _check_valid_files(filenames: Sequence[str]) -> None:
|
||||
"""Returns true if the given filenames are valid upload file URIs."""
|
||||
for filename in filenames:
|
||||
if not filename.startswith('gs://'):
|
||||
@ -536,7 +538,7 @@ class AclChCommand:
|
||||
self._remove_permission(permissions, group, 'group:')
|
||||
return permissions
|
||||
|
||||
def _apply_permissions(self, acl, permissions):
|
||||
def _apply_permissions(self, acl, permissions) -> None:
|
||||
"""Applies the given permission edits to the given acl."""
|
||||
for user, role in permissions.items():
|
||||
if self._is_all_users(user):
|
||||
@ -557,7 +559,7 @@ class AclChCommand:
|
||||
if user in acl[WRITERS]:
|
||||
acl[WRITERS].remove(user)
|
||||
|
||||
def _is_all_users(self, user):
|
||||
def _is_all_users(self, user: str) -> bool:
|
||||
"""Determines if a user name represents the special "all users" entity."""
|
||||
# We previously used "AllUsers" as the magic string to denote that we wanted
|
||||
# to apply some permission to everyone. However, Google Cloud convention for
|
||||
@ -820,8 +822,18 @@ class ListCommand:
|
||||
action='store_true',
|
||||
help='List folders recursively.')
|
||||
parser.add_argument(
|
||||
'--filter', '-f', default='', type=str,
|
||||
help='Filter string to pass to ee.ImageCollection.filter().')
|
||||
'--filter',
|
||||
'-f',
|
||||
default='',
|
||||
type=str,
|
||||
help=(
|
||||
'Filter string to use on a collection. Accepts property names'
|
||||
' "start_time", "end_time", "update_time", and "properties.foo"'
|
||||
' (where "foo" is any user-defined property). Example filter'
|
||||
' strings: properties.SCENE_ID="ABC";'
|
||||
' start_time>"2023-02-03T00:00:00+00:00"'
|
||||
),
|
||||
)
|
||||
|
||||
def run(
|
||||
self, args: argparse.Namespace, config: utils.CommandLineConfig
|
||||
@ -1629,26 +1641,6 @@ class UploadTableManifestCommand(_UploadManifestBase):
|
||||
super().run(args, config, ee.data.startTableIngestion)
|
||||
|
||||
|
||||
class LicensesCommand:
|
||||
"""Prints the name and license of all third party dependencies."""
|
||||
|
||||
name = 'licenses'
|
||||
|
||||
def __init__(self, parser: argparse.ArgumentParser):
|
||||
del parser # Unused.
|
||||
|
||||
def run(
|
||||
self, args: argparse.Namespace, config: utils.CommandLineConfig
|
||||
) -> None:
|
||||
del args # Unused.
|
||||
del config # Unused.
|
||||
print('The Earth Engine python client library uess the following opensource'
|
||||
' libraries.\n')
|
||||
license_path = os.path.join(os.path.dirname(__file__), 'licenses.txt')
|
||||
with open(license_path) as f:
|
||||
print(f.read())
|
||||
|
||||
|
||||
def _get_nodes(node_spec, source_flag_name):
|
||||
"""Extract a node mapping from a list or flag-specified JSON."""
|
||||
try:
|
||||
@ -1913,7 +1905,6 @@ EXTERNAL_COMMANDS = [
|
||||
CopyCommand,
|
||||
CreateCommand,
|
||||
ListCommand,
|
||||
LicensesCommand,
|
||||
SizeCommand,
|
||||
MoveCommand,
|
||||
ModelCommand,
|
||||
|
||||
@ -19,7 +19,7 @@ from ee.cli import utils
|
||||
|
||||
|
||||
class CommandDispatcher(commands.Dispatcher):
|
||||
name = 'main'
|
||||
name: str = 'main'
|
||||
COMMANDS = commands.EXTERNAL_COMMANDS
|
||||
|
||||
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
-- Httplib2 --
|
||||
|
||||
Httplib2 Software License
|
||||
|
||||
Copyright (c) 2006 by Joe Gregorio
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@ -7,14 +7,17 @@ This class is never intended to be instantiated by the user.
|
||||
# Using lowercase function naming to match the JavaScript names.
|
||||
# pylint: disable=g-bad-name
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
import datetime
|
||||
from typing import Any, Callable, Dict, Optional, Type, Union
|
||||
|
||||
from ee import apifunction
|
||||
from ee import deprecation
|
||||
from ee import ee_date
|
||||
from ee import ee_exception
|
||||
from ee import element
|
||||
from ee import filter as ee_filter
|
||||
from ee import function
|
||||
from ee import geometry as ee_geometry
|
||||
|
||||
|
||||
class Collection(element.Element):
|
||||
@ -50,7 +53,7 @@ class Collection(element.Element):
|
||||
apifunction.ApiFunction.clearApi(cls)
|
||||
cls._initialized = False
|
||||
|
||||
def filter(self, new_filter):
|
||||
def filter(self, new_filter: Union[str, ee_filter.Filter]) -> Any:
|
||||
"""Apply a filter to this collection.
|
||||
|
||||
Args:
|
||||
@ -65,7 +68,9 @@ class Collection(element.Element):
|
||||
'Collection.filter', self, new_filter))
|
||||
|
||||
@deprecation.CanUseDeprecated
|
||||
def filterMetadata(self, name, operator, value):
|
||||
def filterMetadata(
|
||||
self, name: str, operator: str, value: Union[int, str]
|
||||
) -> Any:
|
||||
"""Shortcut to add a metadata filter to a collection.
|
||||
|
||||
This is equivalent to self.filter(Filter().metadata(...)).
|
||||
@ -84,7 +89,9 @@ class Collection(element.Element):
|
||||
"""
|
||||
return self.filter(ee_filter.Filter.metadata_(name, operator, value))
|
||||
|
||||
def filterBounds(self, geometry):
|
||||
def filterBounds(
|
||||
self, geometry: Union[Dict[str, Any], ee_geometry.Geometry]
|
||||
) -> Any:
|
||||
"""Shortcut to add a geometry filter to a collection.
|
||||
|
||||
Items in the collection with a footprint that fails to intersect
|
||||
@ -105,7 +112,14 @@ class Collection(element.Element):
|
||||
"""
|
||||
return self.filter(ee_filter.Filter.geometry(geometry))
|
||||
|
||||
def filterDate(self, start, opt_end=None):
|
||||
# TODO(user): Any --> DateRange
|
||||
def filterDate(
|
||||
self,
|
||||
start: Union[datetime.datetime, ee_date.Date, int, str, Any],
|
||||
opt_end: Optional[
|
||||
Union[datetime.datetime, ee_date.Date, int, str, Any]
|
||||
] = None,
|
||||
) -> Any:
|
||||
"""Shortcut to filter a collection with a date range.
|
||||
|
||||
Items in the collection with a system:time_start property that doesn't
|
||||
@ -168,7 +182,10 @@ class Collection(element.Element):
|
||||
return self._cast(
|
||||
apifunction.ApiFunction.apply_('Collection.limit', args))
|
||||
|
||||
def sort(self, prop, opt_ascending=None):
|
||||
# TODO(user): Make opt_ascending default to True
|
||||
def sort(
|
||||
self, prop: str, opt_ascending: Optional[bool] = None
|
||||
) -> Any:
|
||||
"""Sort a collection by the specified property.
|
||||
|
||||
Args:
|
||||
@ -190,11 +207,16 @@ class Collection(element.Element):
|
||||
return 'Collection'
|
||||
|
||||
@staticmethod
|
||||
def elementType():
|
||||
def elementType() -> Type[element.Element]:
|
||||
"""Returns the type of the collection's elements."""
|
||||
return element.Element
|
||||
|
||||
def map(self, algorithm, opt_dropNulls=None):
|
||||
# TODO(user): Can opt_dropNulls default to False?
|
||||
def map(
|
||||
self,
|
||||
algorithm: Callable[[Any], Any],
|
||||
opt_dropNulls: Optional[bool] = None,
|
||||
) -> Any:
|
||||
"""Maps an algorithm over a collection.
|
||||
|
||||
Args:
|
||||
@ -217,7 +239,9 @@ class Collection(element.Element):
|
||||
return self._cast(apifunction.ApiFunction.call_(
|
||||
'Collection.map', self, with_cast, opt_dropNulls))
|
||||
|
||||
def iterate(self, algorithm, first=None):
|
||||
def iterate(
|
||||
self, algorithm: Callable[[Any, Any], Any], first: Optional[Any] = None
|
||||
) -> Any:
|
||||
"""Iterates over a collection with an algorithm.
|
||||
|
||||
Applies a user-supplied function to each element of a collection. The
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""An object representing a custom EE Function."""
|
||||
|
||||
from typing import Any, Callable, Dict, Optional
|
||||
|
||||
from ee import computedobject
|
||||
from ee import ee_exception
|
||||
from ee import ee_types
|
||||
@ -16,8 +18,10 @@ from ee import serializer
|
||||
# definition, if that hasn't happened yet).
|
||||
class CustomFunction(function.Function, encodable.Encodable):
|
||||
"""An object representing a custom EE Function."""
|
||||
_body: Any
|
||||
_signature: Dict[str, Any]
|
||||
|
||||
def __init__(self, signature, body):
|
||||
def __init__(self, signature: Dict[str, Any], body: Any):
|
||||
"""Creates a function defined by a given expression with unbound variables.
|
||||
|
||||
The expression is created by evaluating the given function
|
||||
@ -42,14 +46,14 @@ class CustomFunction(function.Function, encodable.Encodable):
|
||||
# The expression to evaluate.
|
||||
self._body = body(*variables)
|
||||
|
||||
def encode(self, encoder):
|
||||
def encode(self, encoder: Callable[[Any], Any]) -> Dict[str, Any]:
|
||||
return {
|
||||
'type': 'Function',
|
||||
'argumentNames': [x['name'] for x in self._signature['args']],
|
||||
'body': encoder(self._body)
|
||||
}
|
||||
|
||||
def encode_cloud_value(self, encoder):
|
||||
def encode_cloud_value(self, encoder: Callable[[Any], Any]) -> Dict[str, Any]:
|
||||
return {
|
||||
'functionDefinitionValue': {
|
||||
'argumentNames': [x['name'] for x in self._signature['args']],
|
||||
@ -57,18 +61,20 @@ class CustomFunction(function.Function, encodable.Encodable):
|
||||
}
|
||||
}
|
||||
|
||||
def encode_invocation(self, encoder):
|
||||
def encode_invocation(self, encoder: Callable[[Any], Any]) -> Dict[str, Any]:
|
||||
return self.encode(encoder)
|
||||
|
||||
def encode_cloud_invocation(self, encoder):
|
||||
def encode_cloud_invocation(
|
||||
self, encoder: Callable[[Any], Any]
|
||||
) -> Dict[str, Any]:
|
||||
return {'functionReference': encoder(self)}
|
||||
|
||||
def getSignature(self):
|
||||
def getSignature(self) -> Dict[str, Any]:
|
||||
"""Returns a description of the interface provided by this function."""
|
||||
return self._signature
|
||||
|
||||
@staticmethod
|
||||
def variable(type_name, name):
|
||||
def variable(type_name: Optional[str], name: str) -> Any:
|
||||
"""Returns a placeholder variable with a given name and EE type.
|
||||
|
||||
Args:
|
||||
@ -88,7 +94,9 @@ class CustomFunction(function.Function, encodable.Encodable):
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def create(func, return_type, arg_types):
|
||||
def create(
|
||||
func: Callable[[Any], Any], return_type: Any, arg_types: Any
|
||||
) -> 'CustomFunction':
|
||||
"""Creates a CustomFunction.
|
||||
|
||||
The result calls a given native function with the specified return type and
|
||||
@ -105,7 +113,7 @@ class CustomFunction(function.Function, encodable.Encodable):
|
||||
The constructed CustomFunction.
|
||||
"""
|
||||
|
||||
def StringifyType(t):
|
||||
def StringifyType(t: Any) -> str:
|
||||
return t if isinstance(t, str) else ee_types.classToName(t)
|
||||
|
||||
args = [{'name': None, 'type': StringifyType(i)} for i in arg_types]
|
||||
@ -117,7 +125,7 @@ class CustomFunction(function.Function, encodable.Encodable):
|
||||
return CustomFunction(signature, func)
|
||||
|
||||
@staticmethod
|
||||
def _resolveNamelessArgs(signature, variables, body):
|
||||
def _resolveNamelessArgs(signature: Any, variables: Any, body: Any) -> Any:
|
||||
"""Deterministically generates names for unnamed variables.
|
||||
|
||||
The names are based on the body of the function.
|
||||
@ -142,11 +150,12 @@ class CustomFunction(function.Function, encodable.Encodable):
|
||||
|
||||
# Generate the name base by counting the number of custom functions
|
||||
# within the body.
|
||||
def CountFunctions(expression):
|
||||
def CountFunctions(expression: Any) -> int:
|
||||
"""Counts the number of custom functions in a serialized expression."""
|
||||
def CountNodes(nodes):
|
||||
def CountNodes(nodes: Any) -> int:
|
||||
return sum([CountNode(node) for node in nodes])
|
||||
def CountNode(node):
|
||||
|
||||
def CountNode(node: Any) -> int:
|
||||
if 'functionDefinitionValue' in node:
|
||||
return 1
|
||||
elif 'arrayValue' in node:
|
||||
|
||||
@ -40,7 +40,7 @@ SCOPES = [
|
||||
'https://www.googleapis.com/auth/devstorage.full_control'
|
||||
]
|
||||
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob' # Prompts user to copy-paste code
|
||||
TOKEN_URI = 'https://accounts.google.com/o/oauth2/token'
|
||||
TOKEN_URI = 'https://oauth2.googleapis.com/token'
|
||||
AUTH_URI = 'https://accounts.google.com/o/oauth2/auth'
|
||||
|
||||
AUTH_PAGE_URL = 'https://code.earthengine.google.com/client-auth'
|
||||
|
||||
@ -61,8 +61,8 @@ class Serializer:
|
||||
"""
|
||||
self.unbound_name = unbound_name
|
||||
|
||||
self._is_compound = bool(is_compound)
|
||||
self._for_cloud_api = bool(for_cloud_api)
|
||||
self._is_compound = is_compound
|
||||
self._for_cloud_api = for_cloud_api
|
||||
self._scope = []
|
||||
self._encoded = {}
|
||||
self._hashcache = {}
|
||||
|
||||
@ -1,152 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Overview\n",
|
||||
"This notebook guides you through process of testing if the Jupyter Notebook server is authorized to access the Earth Engine servers, and provides a way to authorize the server, if needed."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Testing if the Jupyter Notebook server is authorized to access Earth Engine\n",
|
||||
"\n",
|
||||
"To begin, first verify that you can import the Earth Engine Python API package by running the following cell."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import ee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Next, try to initialize the `ee` Python package."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"try:\n",
|
||||
" ee.Initialize()\n",
|
||||
" print('The Earth Engine package initialized successfully!')\n",
|
||||
"except ee.EEException as e:\n",
|
||||
" print('The Earth Engine package failed to initialize!')\n",
|
||||
"except:\n",
|
||||
" print(\"Unexpected error:\", sys.exc_info()[0])\n",
|
||||
" raise"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"If the initialization succeeded, you can stop here. Congratulations! If not, continue on below..."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Authenticating to the Earth Engine servers"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"If the initialization process failed, you will need to authenticate the Jupyter Notebook server so that it can communicate with the Earth Engine servers. You can initiate the authentication process by running the following command.\n",
|
||||
"\n",
|
||||
"*Note that `earthengine authenticate` is a system command (rather than a Python command), and the cell uses the [%%bash cell magic](http://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-bash) in the first line of the cell to indicate that the cell contents should be executed using a bash shell.*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%%bash\n",
|
||||
"earthengine authenticate --quiet"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Once you have obtained an authorization code from the previous step, paste the code into the following cell and run it."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%%bash\n",
|
||||
"earthengine authenticate --authorization-code=PLACE_AUTH_CODE_HERE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Removing authentication credentials\n",
|
||||
"Authentication credentials are stored as a file in the user's configuration directory. If you need to remove the authentication credentials, run the following cell."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%%bash\n",
|
||||
"rm ~/.config/earthengine"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 2",
|
||||
"language": "python",
|
||||
"name": "python2"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
@ -6,14 +6,19 @@
|
||||
|
||||
import re
|
||||
|
||||
# pylint: disable=g-import-not-at-top,g-importing-member
|
||||
try:
|
||||
# if setuptools is available, use it to take advantage of its dependency
|
||||
# handling
|
||||
from setuptools import setup # pylint: disable=g-import-not-at-top
|
||||
from setuptools import setup
|
||||
except ImportError:
|
||||
# if setuptools is not available, use distutils (standard library). Users
|
||||
# will receive errors for missing packages
|
||||
from distutils.core import setup # pylint: disable=g-import-not-at-top
|
||||
# if setuptools is not available, use distutils. Users will receive errors
|
||||
# for missing packages
|
||||
# TODO(user): Remove the distutils backup.
|
||||
import warnings
|
||||
warnings.warn('distutils package is deprecated, to be removed in Python 3.12')
|
||||
from distutils.core import setup # pylint: disable=deprecated-module
|
||||
# pylint: enable=g-import-not-at-top,g-importing-member
|
||||
|
||||
|
||||
def GetVersion() -> str:
|
||||
@ -30,7 +35,6 @@ setup(
|
||||
packages=['ee', 'ee.cli'],
|
||||
package_data={
|
||||
'ee': ['tests/*.py', 'tests/*.json',],
|
||||
'ee.cli': ['licenses.txt'],
|
||||
},
|
||||
test_suite='ee/tests',
|
||||
python_requires='>=3.7',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user