@radiantearth/stac-migrate 1.0.2 → 1.0.3

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/migrate.js +18 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A library to update STAC files to the latest version (**1.0.0** at the moment of writing). Supports updating **STAC versions 0.6.0 and later**.
4
4
 
5
- Version of this library: **1.0.2**
5
+ Version of this library: **1.0.3**
6
6
 
7
7
  ## Usage
8
8
 
package/migrate.js CHANGED
@@ -345,7 +345,15 @@ var Catalog = {
345
345
 
346
346
  _.ensure(catalog, 'stac_extensions', []) && DONE;
347
347
  V.before('0.8.0') && _.populateExtensions(catalog, 'catalog') && DONE;
348
- }
348
+ },
349
+
350
+ openeo(obj) {
351
+ _.rename(obj, 'api_version', 'openeo:api_version') && DONE;
352
+ _.rename(obj, 'backend_version', 'openeo:backend_version') && DONE;
353
+ _.rename(obj, 'production', 'openeo:production') && DONE;
354
+ _.rename(obj, 'endpoints', 'openeo:endpoints') && DONE;
355
+ _.rename(obj, 'billing', 'openeo:billing') && DONE;
356
+ },
349
357
 
350
358
  };
351
359
 
@@ -379,6 +387,8 @@ var Collection = {
379
387
  },
380
388
 
381
389
  extent(collection) {
390
+ _.ensure(collection, "extent", {});
391
+
382
392
  if (V.before('0.8.0')) {
383
393
  // Restructure spatial extent
384
394
  if (Array.isArray(collection.extent.spatial)) {
@@ -398,9 +408,14 @@ var Collection = {
398
408
  }
399
409
  }
400
410
 
411
+ _.ensure(collection.extent, "spatial", {});
412
+ _.ensure(collection.extent.spatial, "bbox", []);
413
+ _.ensure(collection.extent, "temporal", {});
414
+ _.ensure(collection.extent.temporal, "interval", []);
415
+
401
416
  if (V.before('1.0.0-rc.3')) {
402
417
  // The first extent in a Collection is always the overall extent, followed by more specific extents.
403
- if (Array.isArray(collection.extent.temporal.interval) && collection.extent.temporal.interval.length > 1) {
418
+ if (collection.extent.temporal.interval.length > 1) {
404
419
  let min, max;
405
420
  for(let interval of collection.extent.temporal.interval) {
406
421
  if (interval[0] === null) {
@@ -432,7 +447,7 @@ var Collection = {
432
447
  max ? _.toISOString(max) : null
433
448
  ]);
434
449
  }
435
- if (Array.isArray(collection.extent.spatial.bbox) && collection.extent.spatial.bbox.length > 1) {
450
+ if (collection.extent.spatial.bbox.length > 1) {
436
451
  let count = collection.extent.spatial.bbox.reduce((val, bbox) => Array.isArray(bbox) ? Math.max(bbox.length, val) : val, 4);
437
452
  if (count >= 4) {
438
453
  let union = new Array(count).fill(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radiantearth/stac-migrate",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A library to update STAC files to the latest version.",
5
5
  "main": "migrate.js",
6
6
  "bugs": {