@@ -17,6 +17,7 @@ let SHORTCUTS = [
17
17
'item-assets' ,
18
18
'label' ,
19
19
'pointcloud' ,
20
+ 'processing' ,
20
21
'projection' ,
21
22
'sar' ,
22
23
'sat' ,
@@ -92,12 +93,12 @@ async function run() {
92
93
if ( Array . isArray ( json . collections ) ) {
93
94
entries = json . collections ;
94
95
isApiList = true ;
95
- console . log ( file + " is a /collections endpoint. Validating all " + entries . length + " collections, but ignoring the other parts of the response.\n" ) ;
96
+ console . log ( ` ${ file } is a /collections endpoint. Validating all ${ entries . length } collections, but ignoring the other parts of the response.\n` ) ;
96
97
}
97
98
else if ( Array . isArray ( json . features ) ) {
98
99
entries = json . features ;
99
100
isApiList = true ;
100
- console . log ( file + " is a /collections/:id/items endpoint. Validating all " + entries . length + " items, but ignoring the other parts of the response.\n" ) ;
101
+ console . log ( ` ${ file } is a /collections/:id/items endpoint. Validating all ${ entries . length } items, but ignoring the other parts of the response.\n` ) ;
101
102
}
102
103
else {
103
104
entries = [ json ] ;
@@ -111,16 +112,16 @@ async function run() {
111
112
id += " -> " + data . id ;
112
113
}
113
114
if ( typeof data . stac_version !== 'string' ) {
114
- console . error ( " -- " + id + " : Skipping; No STAC version found\n" ) ;
115
+ console . error ( ` -- ${ id } : Skipping; No STAC version found\n` ) ;
115
116
fileValid = false ;
116
117
continue ;
117
118
}
118
119
else if ( compareVersions ( data . stac_version , '1.0.0-beta.2' , '<' ) ) {
119
- console . error ( " -- " + id + " : Skipping; Can only validate STAC version >= 1.0.0-beta.2\n" ) ;
120
+ console . error ( ` -- ${ id } : Skipping; Can only validate STAC version >= 1.0.0-beta.2\n` ) ;
120
121
continue ;
121
122
}
122
123
else {
123
- console . log ( " -- " + id + " (" + data . stac_version + ")" ) ;
124
+ console . log ( ` -- ${ id } ( ${ data . stac_version } )` ) ;
124
125
}
125
126
126
127
let type ;
@@ -130,17 +131,17 @@ async function run() {
130
131
}
131
132
else if ( data . type === 'FeatureCollection' ) {
132
133
// type = 'itemcollection';
133
- console . warn ( " -- " + id + " : Skipping; STAC ItemCollections not supported yet\n" ) ;
134
+ console . warn ( ` -- ${ id } : Skipping; STAC ItemCollections not supported yet\n` ) ;
134
135
continue ;
135
136
}
136
137
else {
137
- console . error ( " -- " + id + ": ` type` is invalid; must be ` Feature`\n" ) ;
138
+ console . error ( ` -- ${ id } : ' type' is invalid; must be ' Feature'\n` ) ;
138
139
fileValid = false ;
139
140
continue ;
140
141
}
141
142
}
142
143
else {
143
- if ( typeof data . extent !== 'undefined' || data . license !== 'undefined' ) {
144
+ if ( typeof data . extent !== 'undefined' || typeof data . license !== 'undefined' ) {
144
145
type = 'collection' ;
145
146
146
147
}
@@ -161,7 +162,7 @@ async function run() {
161
162
let validate = await loadSchema ( ...loadArgs ) ;
162
163
let valid = validate ( data ) ;
163
164
if ( ! valid ) {
164
- console . log ( ' ---- ' + schema + " : invalid" ) ;
165
+ console . log ( ` ---- ${ schema } : invalid` ) ;
165
166
console . warn ( validate . errors ) ;
166
167
console . log ( "\n" ) ;
167
168
fileValid = false ;
@@ -171,11 +172,11 @@ async function run() {
171
172
}
172
173
}
173
174
else {
174
- console . info ( ' ---- ' + schema + " : valid" ) ;
175
+ console . log ( ` ---- ${ schema } : valid` ) ;
175
176
}
176
177
} catch ( error ) {
177
178
fileValid = false ;
178
- console . error ( ' ---- ' + schema + ": " + error . message ) ;
179
+ console . error ( ` ---- ${ schema } : ${ error . message } ` ) ;
179
180
if ( DEBUG ) {
180
181
console . trace ( error ) ;
181
182
}
@@ -202,7 +203,7 @@ function isUrl(uri) {
202
203
let part = uri . match ( / ^ ( \w + ) : \/ \/ / i) ;
203
204
if ( part ) {
204
205
if ( ! SUPPORTED_PROTOCOLS . includes ( part [ 1 ] . toLowerCase ( ) ) ) {
205
- throw new Error ( ' Given protocol "' + part [ 1 ] + ' " is not supported.' ) ;
206
+ throw new Error ( ` Given protocol "${ part [ 1 ] } " is not supported.` ) ;
206
207
}
207
208
return true ;
208
209
}
@@ -213,7 +214,7 @@ async function readExamples(folder) {
213
214
var files = [ ] ;
214
215
for await ( let file of klaw ( folder ) ) {
215
216
let relPath = path . relative ( folder , file . path ) ;
216
- if ( relPath . includes ( path . sep + 'examples' + path . sep ) && path . extname ( relPath ) === ' .json' ) {
217
+ if ( relPath . match ( / ( ^ | \/ | \\ ) e x a m p l e s ( \/ | \\ ) [ ^ \/ \\ ] + \ .j s o n $ / i ) ) {
217
218
files . push ( file . path ) ;
218
219
}
219
220
}
@@ -224,7 +225,7 @@ async function loadSchema(baseUrl = null, version = null, shortcut = null) {
224
225
version = ( typeof version === 'string' ) ? "v" + version : "unversioned" ;
225
226
226
227
if ( typeof baseUrl !== 'string' ) {
227
- baseUrl = " https://schemas.stacspec.org/" + version ;
228
+ baseUrl = ` https://schemas.stacspec.org/${ version } ` ;
228
229
}
229
230
else {
230
231
baseUrl = baseUrl . replace ( / \\ / g, '/' ) . replace ( / \/ $ / , "" ) ;
@@ -233,14 +234,14 @@ async function loadSchema(baseUrl = null, version = null, shortcut = null) {
233
234
let url ;
234
235
let isExtension = false ;
235
236
if ( shortcut === 'item' || shortcut === 'catalog' || shortcut === 'collection' ) {
236
- url = baseUrl + "/" + shortcut + " -spec/json-schema/" + shortcut + " .json" ;
237
+ url = ` ${ baseUrl } / ${ shortcut } -spec/json-schema/${ shortcut } .json` ;
237
238
}
238
239
else if ( typeof shortcut === 'string' ) {
239
240
if ( shortcut === 'proj' ) {
240
241
// Capture a very common mistake and give a better explanation (see #4)
241
242
throw new Error ( "'stac_extensions' must contain 'projection instead of 'proj'." ) ;
242
243
}
243
- url = baseUrl + " /extensions/" + shortcut + " /json-schema/schema.json" ;
244
+ url = ` ${ baseUrl } /extensions/${ shortcut } /json-schema/schema.json` ;
244
245
isExtension = true ;
245
246
}
246
247
else {
@@ -271,7 +272,7 @@ async function loadSchema(baseUrl = null, version = null, shortcut = null) {
271
272
if ( DEBUG ) {
272
273
console . trace ( error ) ;
273
274
}
274
- throw new Error ( `Schema at '${ url } ' not found. Please ensure all entries in 'stac_extensions' are valid. ${ hint } ` ) ;
275
+ throw new Error ( `Schema at '${ url } ' not found. Please ensure all entries in 'stac_extensions' are valid.` ) ;
275
276
}
276
277
else {
277
278
throw error ;
0 commit comments