@radiantearth/stac-migrate 1.5.0 → 1.6.0

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 +66 -66
  2. package/migrate.js +4 -12
  3. package/package.json +39 -39
package/README.md CHANGED
@@ -1,66 +1,66 @@
1
- # stac-migrate
2
-
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
-
5
- Version of this library: **1.5.0**
6
-
7
- ## Usage
8
-
9
- ### JavaScript / Node
10
-
11
- Add to your project with `npm install @radiantearth/stac-migrate --save`
12
-
13
- Import the library: `const Migrate = require('@radiantearth/stac-migrate');`
14
-
15
- * Migrate (auto-detection): `Migrate.stac(stac: object, updateVersionNumber: boolean = true) => object`<br />
16
- *This method does not migrate the Commons extension - use `Migrate.item` if you have used the Commons extension.*
17
- * Migrate a STAC Collection: `Migrate.collection(collection: object, updateVersionNumber: boolean = true) => object`
18
- * Migrate a STAC Catalog: `Migrate.catalog(catalog: object, updateVersionNumber: boolean = true) => object`
19
- * Migrate a STAC Item: `Migrate.item(item: object, collection: object = null, updateVersionNumber: boolean = true) => object`<br />
20
- *The `collection` parameter is only required to migrate the Commons extension. Otherwise, you don't need to pass this paramater.*
21
- * Migrate a STAC CollectionCollection: `Migrate.collectionCollection(apiCollections: object, updateVersionNumber: boolean = true) => object`
22
- * Migrate a STAC ItemCollection: `Migrate.itemCollection(apiItems: object, updateVersionNumber: boolean = true) => object`
23
-
24
- **Note:** All changes will be applied in-place! If you don't want the input object to change, make a deep clone before. If you don't have a library which supports this (e.g. [lodash](https://lodash.com/docs/4.17.15#cloneDeep)) you can simply use `var clone = JSON.parse(JSON.stringify(object));`.
25
-
26
- ### CLI
27
-
28
- You can also use the CLI to migrate a single file.
29
- The commands follow the different methods above and has the same "restrictions" as above.
30
-
31
- * Migrate (auto-detection, override): `npx stac-migrate <source_path>`
32
- * Migrate (auto-detection, save to a different file with 4 spaces indentation): `npx stac-migrate <source_path> --dest <dest_path> --indent 4`
33
- * Migrate a STAC Collection: `npx stac-migrate <source_path> <dest_path> --collection`
34
- * Migrate a STAC Catalog: `npx stac-migrate <source_path> <dest_path> --catalog`
35
- * Migrate a STAC Item: `npx stac-migrate <source_path> <dest_path> --item --collection_path <collection_path>`
36
- * Migrate a STAC Item Collection: `npx stac-migrate <source_path> <dest_path> --item_collection`
37
- * Migrate a STAC Collection Collection: `npx stac-migrate <source_path> <dest_path> --collecions`
38
-
39
- ## Supported Extensions
40
-
41
- * Checksum (legacy, use `Migrate.enableMultihash(require('multihashes'))` to enable conversion from pre-0.9 checksums - disabled by default to keep the bundle size low)
42
- * Classification 1.1.0
43
- * Collection Assets (legacy)
44
- * Commons (legacy)
45
- * Data Cube 2.1.0
46
- * Datetime Range (legacy)
47
- * Electro-Optical 1.0.0
48
- * File 1.0.0
49
- * (Item) Asset Definition 1.0.0
50
- * Label 1.0.1
51
- * Point Cloud 1.0.0
52
- * Procesing 1.1.0
53
- * Projection 1.0.0
54
- * Raster 1.1.0
55
- * SAR 1.0.0
56
- * Satellite 1.0.0
57
- * Scientific Citation 1.0.0
58
- * Single Item
59
- * Table 1.2.0
60
- * Timestamps 1.0.0
61
- * Versioning Indicators 1.0.0
62
- * View Geometry 1.0.0
63
-
64
- ## Development
65
-
66
- Run the tests: `npm test`
1
+ # stac-migrate
2
+
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
+
5
+ Version of this library: **1.6.0**
6
+
7
+ ## Usage
8
+
9
+ ### JavaScript / Node
10
+
11
+ Add to your project with `npm install @radiantearth/stac-migrate --save`
12
+
13
+ Import the library: `const Migrate = require('@radiantearth/stac-migrate');`
14
+
15
+ * Migrate (auto-detection): `Migrate.stac(stac: object, updateVersionNumber: boolean = true) => object`<br />
16
+ *This method does not migrate the Commons extension - use `Migrate.item` if you have used the Commons extension.*
17
+ * Migrate a STAC Collection: `Migrate.collection(collection: object, updateVersionNumber: boolean = true) => object`
18
+ * Migrate a STAC Catalog: `Migrate.catalog(catalog: object, updateVersionNumber: boolean = true) => object`
19
+ * Migrate a STAC Item: `Migrate.item(item: object, collection: object = null, updateVersionNumber: boolean = true) => object`<br />
20
+ *The `collection` parameter is only required to migrate the Commons extension. Otherwise, you don't need to pass this paramater.*
21
+ * Migrate a STAC CollectionCollection: `Migrate.collectionCollection(apiCollections: object, updateVersionNumber: boolean = true) => object`
22
+ * Migrate a STAC ItemCollection: `Migrate.itemCollection(apiItems: object, updateVersionNumber: boolean = true) => object`
23
+
24
+ **Note:** All changes will be applied in-place! If you don't want the input object to change, make a deep clone before. If you don't have a library which supports this (e.g. [lodash](https://lodash.com/docs/4.17.15#cloneDeep)) you can simply use `var clone = JSON.parse(JSON.stringify(object));`.
25
+
26
+ ### CLI
27
+
28
+ You can also use the CLI to migrate a single file.
29
+ The commands follow the different methods above and has the same "restrictions" as above.
30
+
31
+ * Migrate (auto-detection, override): `npx stac-migrate <source_path>`
32
+ * Migrate (auto-detection, save to a different file with 4 spaces indentation): `npx stac-migrate <source_path> --dest <dest_path> --indent 4`
33
+ * Migrate a STAC Collection: `npx stac-migrate <source_path> <dest_path> --collection`
34
+ * Migrate a STAC Catalog: `npx stac-migrate <source_path> <dest_path> --catalog`
35
+ * Migrate a STAC Item: `npx stac-migrate <source_path> <dest_path> --item --collection_path <collection_path>`
36
+ * Migrate a STAC Item Collection: `npx stac-migrate <source_path> <dest_path> --item_collection`
37
+ * Migrate a STAC Collection Collection: `npx stac-migrate <source_path> <dest_path> --collecions`
38
+
39
+ ## Supported Extensions
40
+
41
+ * Checksum (legacy, use `Migrate.enableMultihash(require('multihashes'))` to enable conversion from pre-0.9 checksums - disabled by default to keep the bundle size low)
42
+ * Classification 1.1.0
43
+ * Collection Assets (legacy)
44
+ * Commons (legacy)
45
+ * Data Cube 2.1.0
46
+ * Datetime Range (legacy)
47
+ * Electro-Optical 1.0.0
48
+ * File 1.0.0
49
+ * (Item) Asset Definition 1.0.0
50
+ * Label 1.0.1
51
+ * Point Cloud 1.0.0
52
+ * Procesing 1.1.0
53
+ * Projection 1.0.0
54
+ * Raster 1.1.0
55
+ * SAR 1.0.0
56
+ * Satellite 1.0.0
57
+ * Scientific Citation 1.0.0
58
+ * Single Item
59
+ * Table 1.2.0
60
+ * Timestamps 1.0.0
61
+ * Versioning Indicators 1.0.0
62
+ * View Geometry 1.0.0
63
+
64
+ ## Development
65
+
66
+ Run the tests: `npm test`
package/migrate.js CHANGED
@@ -406,14 +406,6 @@ var Catalog = {
406
406
  return catalog;
407
407
  },
408
408
 
409
- openeo(obj) {
410
- _.rename(obj, 'api_version', 'openeo:api_version') && DONE;
411
- _.rename(obj, 'backend_version', 'openeo:backend_version') && DONE;
412
- _.rename(obj, 'production', 'openeo:production') && DONE;
413
- _.rename(obj, 'endpoints', 'openeo:endpoints') && DONE;
414
- _.rename(obj, 'billing', 'openeo:billing') && DONE;
415
- },
416
-
417
409
  };
418
410
 
419
411
  var Collection = {
@@ -556,7 +548,7 @@ var Collection = {
556
548
  _.ensure(collection, 'summaries', {});
557
549
 
558
550
  // other_properties: An early version of the Collection summaries with a similar structure
559
- // Was mostly used in standalone collctions from openEO and GEE. Move other_properties to summaries.
551
+ // Was mostly used in standalone collections from openEO and GEE. Move other_properties to summaries.
560
552
  if (V.before('0.8.0') && _.isObject(collection.other_properties)) {
561
553
  for(let key in collection.other_properties) {
562
554
  let prop = collection.other_properties[key];
@@ -963,9 +955,9 @@ var Migrate = {
963
955
  else if (object.type === 'Collection' || (!object.type && _.isDefined(object.extent) && _.isDefined(object.license))) {
964
956
  return Migrate.collection(object, updateVersionNumber);
965
957
  }
966
- else if (!object.type && Array.isArray(object.collections)) {
958
+ else if (!object.type && Array.isArray(object.collections)) {
967
959
  return Migrate.collectionCollection(object, updateVersionNumber);
968
- }
960
+ }
969
961
  else {
970
962
  return Migrate.catalog(object, updateVersionNumber);
971
963
  }
@@ -977,4 +969,4 @@ var Migrate = {
977
969
 
978
970
  };
979
971
 
980
- module.exports = Migrate;
972
+ module.exports = Migrate;
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "@radiantearth/stac-migrate",
3
- "version": "1.5.0",
4
- "description": "A library to update STAC files to the latest version.",
5
- "main": "migrate.js",
6
- "bin": {
7
- "stac-migrate": "./bin/cli.js"
8
- },
9
- "bugs": {
10
- "url": "https://github.com/stac-utils/stac-migrate/issues"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/stac-utils/stac-migrate.git"
15
- },
16
- "author": "Radiant Earth Foundation <hello@radiant.earth>",
17
- "contributors": [
18
- {
19
- "name": "Matthias Mohr"
20
- }
21
- ],
22
- "license": "Apache-2.0",
23
- "dependencies": {
24
- "compare-versions": "^3.6.0",
25
- "multihashes": "^3.1.2",
26
- "yargs": "^17.6.2"
27
- },
28
- "devDependencies": {
29
- "jest": "^29.0.0",
30
- "jest-html-reporter": "^3.3.0"
31
- },
32
- "files": [
33
- "bin/cli.js",
34
- "migrate.js"
35
- ],
36
- "scripts": {
37
- "test": " jest"
38
- }
39
- }
1
+ {
2
+ "name": "@radiantearth/stac-migrate",
3
+ "version": "1.6.0",
4
+ "description": "A library to update STAC files to the latest version.",
5
+ "main": "migrate.js",
6
+ "bin": {
7
+ "stac-migrate": "./bin/cli.js"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/stac-utils/stac-migrate/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/stac-utils/stac-migrate.git"
15
+ },
16
+ "author": "Radiant Earth Foundation <hello@radiant.earth>",
17
+ "contributors": [
18
+ {
19
+ "name": "Matthias Mohr"
20
+ }
21
+ ],
22
+ "license": "Apache-2.0",
23
+ "dependencies": {
24
+ "compare-versions": "^3.6.0",
25
+ "multihashes": "^3.1.2",
26
+ "yargs": "^17.6.2"
27
+ },
28
+ "devDependencies": {
29
+ "jest": "^29.0.0",
30
+ "jest-html-reporter": "^3.3.0"
31
+ },
32
+ "files": [
33
+ "bin/cli.js",
34
+ "migrate.js"
35
+ ],
36
+ "scripts": {
37
+ "test": " jest"
38
+ }
39
+ }