@google/earthengine 1.7.9 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/earthengine",
3
- "version": "1.7.9",
3
+ "version": "1.7.12",
4
4
  "description": "JavaScript client for Google Earth Engine API.",
5
5
  "author": "Google LLC",
6
6
  "license": "Apache-2.0",
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.9';
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;
@@ -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] || null;
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
- goog.object.forEach(ee.ApiFunction.api_, function(apiFunc, name) {
248
- const parts = name.split('.');
249
- if (parts.length == 2 && parts[0] == prefix) {
250
- const fname = prepend + parts[1];
251
- const signature = apiFunc.getSignature();
252
-
253
- // Mark signatures as used.
254
- ee.ApiFunction.boundSignatures_[name] = true;
255
-
256
- // Decide whether this is a static or an instance function.
257
- let isInstance = false;
258
- if (signature['args'].length) {
259
- const firstArgType = signature['args'][0]['type'];
260
- isInstance = firstArgType != 'Object' &&
261
- ee.Types.isSubtype(firstArgType, typeName);
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
- if (fname in destination && !destination[fname]['signature']) {
268
- // Don't overwrite client-defined functions.
269
- return;
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
- // Add the actual function
273
- /**
274
- * @param {*} var_args
275
- * @return {!ee.ComputedObject}
276
- * @this {*}
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
 
@@ -130,7 +130,7 @@ ee.FloatTileOverlay =
130
130
 
131
131
  /** @return {number} The number of tiles successfully loaded. */
132
132
  getLoadedFloatTilesCount() {
133
- return this.floatTiles_.getCount();
133
+ return this.floatTiles_.size;
134
134
  }
135
135
 
136
136
  /**
@@ -135,7 +135,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
135
135
  this.opacity = opacity;
136
136
  this.tilesById.forEach(function(tile) {
137
137
  goog.style.setOpacity(tile.div, this.opacity);
138
- }, this);
138
+ }.bind(this));
139
139
  }
140
140
 
141
141
  /**
@@ -201,7 +201,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
201
201
  */
202
202
  releaseTile(tileDiv) {
203
203
  var tile = this.tilesById.get(tileDiv.id);
204
- this.tilesById.remove(tileDiv.id);
204
+ this.tilesById.delete(tileDiv.id);
205
205
  if (tile) {
206
206
  tile.abort();
207
207
  goog.dispose(tile);
@@ -283,7 +283,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
283
283
  * @private
284
284
  */
285
285
  getTileCountForStatus_(status) {
286
- return goog.array.count(this.tilesById.getValues(), function(tile) {
286
+ return goog.array.count([...this.tilesById.values()], function(tile) {
287
287
  return tile.getStatus() == status;
288
288
  });
289
289
  }
@@ -74,7 +74,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
74
74
  * @return {number} The number of requests in flight or pending send.
75
75
  */
76
76
  getOutstandingCount() {
77
- return this.requests_.getCount();
77
+ return this.requests_.size;
78
78
  }
79
79
 
80
80
  /**
@@ -160,7 +160,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
160
160
  * @private
161
161
  */
162
162
  releaseRequest_(request) {
163
- this.requests_.remove(request.getId());
163
+ this.requests_.delete(request.getId());
164
164
  if (request.getImageLoader()) {
165
165
  this.releaseObject_(request.getToken());
166
166
  request.getImageLoader().dispose();
@@ -189,7 +189,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
189
189
 
190
190
  // Call dispose on each request.
191
191
  var requests = this.requests_;
192
- goog.array.forEach(requests.getValues(), function(value) {
192
+ goog.array.forEach([...requests.values()], function(value) {
193
193
  value.dispose();
194
194
  });
195
195
  requests.clear();