@google/earthengine 1.7.10 → 1.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser.js +407 -375
- package/build/ee_api_js.js +361 -360
- package/build/ee_api_js_debug.js +384 -353
- package/build/ee_api_js_npm.js +407 -375
- package/build/main.js +407 -375
- package/package.json +1 -1
- package/src/apiclient.js +1 -1
- package/src/apifunction.js +56 -42
package/package.json
CHANGED
package/src/apiclient.js
CHANGED
|
@@ -24,7 +24,7 @@ const {trustedResourceUrl} = goog.require('safevalues.index');
|
|
|
24
24
|
/** @namespace */
|
|
25
25
|
const apiclient = {};
|
|
26
26
|
|
|
27
|
-
const API_CLIENT_VERSION = '1.7.
|
|
27
|
+
const API_CLIENT_VERSION = '1.7.12';
|
|
28
28
|
|
|
29
29
|
exports.VERSION = apiVersion.VERSION;
|
|
30
30
|
exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
|
package/src/apifunction.js
CHANGED
|
@@ -167,11 +167,11 @@ ee.ApiFunction.lookup = function(name) {
|
|
|
167
167
|
* Looks up an API function by name, but doesn't throw an error.
|
|
168
168
|
*
|
|
169
169
|
* @param {string} name The name of the function to get.
|
|
170
|
-
* @return {!ee.ApiFunction} The requested function or null if it's not found.
|
|
170
|
+
* @return {!ee.ApiFunction|null} The requested function or null if it's not found.
|
|
171
171
|
*/
|
|
172
172
|
ee.ApiFunction.lookupInternal = function(name) {
|
|
173
173
|
ee.ApiFunction.initialize();
|
|
174
|
-
return ee.ApiFunction.api_[name]
|
|
174
|
+
return ee.ApiFunction.api_.hasOwnProperty(name) ? ee.ApiFunction.api_[name] : null;
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
|
|
@@ -244,49 +244,63 @@ ee.ApiFunction.reset = function() {
|
|
|
244
244
|
ee.ApiFunction.importApi = function(target, prefix, typeName, opt_prepend) {
|
|
245
245
|
ee.ApiFunction.initialize();
|
|
246
246
|
const prepend = opt_prepend || '';
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
// Assume we have a constructor Function if we get an instance method.
|
|
264
|
-
const destination =
|
|
265
|
-
isInstance ? /** @type {!Function} */(target).prototype : target;
|
|
247
|
+
const api = ee.ApiFunction.api_;
|
|
248
|
+
for (const name in api) {
|
|
249
|
+
// "names" in API either look like:
|
|
250
|
+
// - `Array` (base constructor), or
|
|
251
|
+
// - `Array.method` (methods)
|
|
252
|
+
|
|
253
|
+
// Ignore properties inherited from the prototype chain.
|
|
254
|
+
if (!Object.prototype.hasOwnProperty.call(api, name)) {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
const apiFunc = api[name];
|
|
258
|
+
const parts = name.split('.'); // Should be api group and api method.
|
|
259
|
+
if (parts.length !== 2 || parts[0] !== prefix) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
266
262
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
263
|
+
const apiMethod = parts[1];
|
|
264
|
+
|
|
265
|
+
const fname = prepend + apiMethod;
|
|
266
|
+
const signature = apiFunc.getSignature();
|
|
267
|
+
|
|
268
|
+
// Mark signatures as used.
|
|
269
|
+
ee.ApiFunction.boundSignatures_[name] = true;
|
|
271
270
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
destination[fname] = function(var_args) {
|
|
279
|
-
return apiFunc.callOrApply(
|
|
280
|
-
isInstance ? this : undefined,
|
|
281
|
-
Array.prototype.slice.call(arguments, 0));
|
|
282
|
-
};
|
|
283
|
-
// Add a friendly formatting.
|
|
284
|
-
destination[fname].toString =
|
|
285
|
-
goog.bind(apiFunc.toString, apiFunc, fname, isInstance);
|
|
286
|
-
// Attach the signature object for documentation generators.
|
|
287
|
-
destination[fname]['signature'] = signature;
|
|
271
|
+
// Decide whether this is a static or an instance function.
|
|
272
|
+
let isInstance = false;
|
|
273
|
+
if (signature['args'].length) {
|
|
274
|
+
const firstArgType = signature['args'][0]['type'];
|
|
275
|
+
isInstance = firstArgType != 'Object' &&
|
|
276
|
+
ee.Types.isSubtype(firstArgType, typeName);
|
|
288
277
|
}
|
|
289
|
-
|
|
278
|
+
// Assume we have a constructor Function if we get an instance method.
|
|
279
|
+
const destination =
|
|
280
|
+
isInstance ? /** @type {!Function} */ (target).prototype : target;
|
|
281
|
+
|
|
282
|
+
if (fname in destination && !destination[fname]['signature']) {
|
|
283
|
+
// Don't overwrite client-defined functions.
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Add the actual function
|
|
288
|
+
/**
|
|
289
|
+
* @param {*} var_args
|
|
290
|
+
* @return {!ee.ComputedObject}
|
|
291
|
+
* @this {*}
|
|
292
|
+
**/
|
|
293
|
+
destination[fname] = function(var_args) {
|
|
294
|
+
return apiFunc.callOrApply(
|
|
295
|
+
isInstance ? this : undefined,
|
|
296
|
+
Array.prototype.slice.call(arguments, 0));
|
|
297
|
+
};
|
|
298
|
+
// Add a friendly formatting.
|
|
299
|
+
destination[fname].toString =
|
|
300
|
+
goog.bind(apiFunc.toString, apiFunc, fname, isInstance);
|
|
301
|
+
// Attach the signature object for documentation generators.
|
|
302
|
+
destination[fname]['signature'] = signature;
|
|
303
|
+
}
|
|
290
304
|
};
|
|
291
305
|
|
|
292
306
|
|