@openeo/js-commons
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(window,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)r.d(i,s,function(t){return e[t]}.bind(null,s));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t,r){var i=r(8);class s{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static hasText(e){return"string"==typeof e&&e.length>0}static equals(e,t){return i(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const r={};return t.forEach(t=>r[t]=e[t]),r}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var r=Object.assign({},e);for(let e of t)delete r[e];return r}static mapObject(e,t){const r=Object.keys(e),i=new Array(r.length);return r.forEach((r,s)=>{i[s]=t(e[r],r,e)}),i}static mapObjectValues(e,t){e=Object(e);const r={};return Object.keys(e).forEach(i=>{r[i]=t(e[i],i,e)}),r}static unique(e,t=!1){return t?e.filter((e,t,r)=>r.findIndex(t=>s.equals(e,t))===t):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let r=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),r+=t.replace(/\/$/,"")),r}static replacePlaceholders(e,t={}){if("string"==typeof e&&s.isObject(t))for(var r in t){let i=t[r];e=e.replace("{"+r+"}",Array.isArray(i)?i.join("; "):i)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map(e=>{if(e.length>=3){const t=(e,t,r)=>t+" "+r.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e})).join(t)}static friendlyLinks(e,t=!0,r=["self"]){let i=[];if(!Array.isArray(e))return i;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&r.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=s.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),i.push(t));return t&&i.sort((e,t)=>s.compareStringCaseInsensitive(e.title,t.title)),i}}e.exports=s},function(e,t,r){const i=r(9);class s{static compare(e,t,r=null){return null!==r?i.compare(e,t,r):i(e,t)}static validate(e){return i.validate(e)}static findCompatible(e,t=!0,r=null,i=null){if(!Array.isArray(e)||0===e.length)return[];let a=e.filter(e=>{if("string"==typeof e.url&&s.validate(e.api_version)){let t=s.validate(r),a=s.validate(i);return t&&a?s.compare(e.api_version,r,">=")&&s.compare(e.api_version,i,"<="):t?s.compare(e.api_version,r,">="):!a||s.compare(e.api_version,i,"<=")}return!1});return 0===a.length?[]:a.sort((e,r)=>{let i=!0===e.production,a=!0===r.production;return t&&i!==a?i?-1:1:-1*s.compare(e.api_version,r.api_version)})}static findLatest(e,t=!0,r=null,i=null){let a=s.findCompatible(e,t,r,i);return a.length>0?a[0]:null}}e.exports=s},function(e,t,r){const i=r(0),s=r(1);e.exports=class{static migrateLinks(e,t,r="related"){return Array.isArray(e)?e.filter(e=>i.isObject(e)&&"string"==typeof e.href).map(e=>("string"!=typeof e.rel&&(e.rel=r),e)):[]}static migrateDiscoveryParameters(e,t){if(s.compare(t,"1.0.0-rc.2","<="))for(var r in e){if(!i.isObject(e[r])){delete e[r];continue}let t=e[r].type;"string"==typeof t&&(e[r].type=[t,"null"]);let s=e[r].example;void 0!==s&&(e[r].examples=[s],delete e[r].example)}return e}}},function(e,t,r){const i=r(0);class s{constructor(e,t=null,r){this.schema=e,void 0===this.schema.default&&(this.schema.default=r),this.parent=t}toJSON(){return Object.assign({},this.schema,{default:this.default()})}isAny(){return"any"===this.dataType()}isNull(){return"null"===this.schema.type}nullable(){return this.isNull()||this.isAny()}isEditable(){return!s.NON_EDITABLE.includes(this.dataType())}dataType(e=!1){let t=this.schema.type||"any";return e?t:this.schema.subtype||t}nativeDataType(){return this.dataType(!0)}isEnum(){return Array.isArray(this.schema.enum)&&this.schema.enum.length>0}getEnumChoices(){return this.isEnum()?this.schema.enum:[]}getCallbackParameters(){return Array.isArray(this.schema.parameters)?this.schema.parameters:[]}group(){return i.hasText(this.schema.group)?this.schema.group:s.DEFAULT_GROUP}title(){return i.hasText(this.schema.title)?this.schema.title:i.prettifyString(this.dataType())}description(){return i.hasText(this.schema.description)?this.schema.description:""}default(){return"function"==typeof this.schema.default?this.schema.default():this.schema.default}}s.DEFAULT_GROUP="Other",s.NON_EDITABLE=["raster-cube","vector-cube","labeled-array"],e.exports=s},function(e,t,r){const i=r(5),s=r(3),a=r(0);e.exports=class{constructor(e=null,t){if(a.isObject(e)||Array.isArray(e))if(this.unspecified=!1,this.schemas=i.normalizeJsonSchema(e,!0).map(e=>new s(e,this,t)),void 0===t){let e=this.schemas.map(e=>e.default()).filter(e=>void 0!==e);this.default=e[0]}else this.default=t;else this.unspecified=!0,this.schemas=[];this.refs=[]}toJSON(){return this.schemas.map(e=>e.toJSON())}isEditable(){return this.unspecified||this.schemas.filter(e=>e.isEditable()&&!e.isNull()).length>0}is(e){var t=this.dataTypes();return 1===t.length&&t[0]===e}nativeDataType(){return this.dataType(!0)}dataType(e=!1){var t=this.dataTypes(!0,e),r=t.indexOf("null");return 1===t.length?t[0]:2===t.length&&-1!==r?t[0===r?1:0]:"mixed"}dataTypes(e=!1,t=!1){var r=this.schemas.map(e=>e.dataType(t)).filter((e,t,r)=>r.indexOf(e)===t);return 0===r.length||r.includes("any")?["any"]:e?r:r.filter(e=>"null"!==e)}nullable(){return this.unspecified||this.schemas.filter(e=>e.nullable()).length>0}}},function(e,t,r){const i=r(0);class s{static normalizeJsonSchema(e,t=!1){e=i.isObject(e)?[e]:Array.isArray(e)?e:[];let r=[];for(let t of e)if(Array.isArray(t.allOf))r.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=i.omitFromObject(t,["oneOf","anyOf"]),s=t.oneOf||t.anyOf;for(let t of s)r.push(Object.assign({},e,t))}else r.push(t);if(!t)return r;e=[];for(let t of r)Array.isArray(t.type)?e=e.concat(t.type.map(e=>Object.assign({},t,{type:e}))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!i.isObject(e)||!e.schema)return[];let r,a=s.normalizeJsonSchema(e.schema);for(;r=t.shift();)a=a.map(e=>s.normalizeJsonSchema(s.getElementJsonSchema(e,r))),a=a.concat(...a);let n=[];for(let e of a)if(Array.isArray(e.parameters)){if(n.length>0&&!i.equals(n,e.parameters))throw new Error("Multiple schemas with different callback parameters found.");n=e.parameters}return n}static getCallbackParametersForProcess(e,t,r=[]){if(!i.isObject(e)||!Array.isArray(e.parameters))return[];let a=e.parameters.find(e=>e.name===t);return s.getCallbackParameters(a,r)}static getNativeTypesForJsonSchema(e,t=!1){if(i.isObject(e)&&Array.isArray(e.type)){let r=i.unique(e.type).filter(e=>s.JSON_SCHEMA_TYPES.includes(e));return r.length>0&&r.length<s.JSON_SCHEMA_TYPES.length?r:t?[]:s.JSON_SCHEMA_TYPES}return i.isObject(e)&&"string"==typeof e.type&&s.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:s.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let r=s.getNativeTypesForJsonSchema(e);if(i.isObject(e)&&r.includes("array")&&"string"!=typeof t){if(i.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&i.isObject(e.items[t]))return e.items[t];if(i.isObject(e.additionalItems))return e.additionalItems}}if(i.isObject(e)&&r.includes("object")){if(null!==t&&i.isObject(e.properties)&&i.isObject(e.properties[t]))return e.properties[t];if(i.isObject(e.additionalProperties))return e.additionalProperties}return{}}}s.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=s},function(e,t,r){const i=r(7),s=r(10),a=r(11),n=r(3),o=r(12),c=r(4),l=r(5),p=r(1),u=r(0);e.exports={MigrateCapabilities:i,MigrateCollections:s,MigrateProcesses:a,ProcessDataType:n,ProcessParameter:o,ProcessSchema:c,ProcessUtils:l,Versions:p,Utils:u}},function(e,t,r){const i=r(0),s=r(1),a=r(2);const n=["raster","vector","table","other"];function o(e,t){i.isObject(e)||(e={});for(let r in e)i.isObject(e[r].parameters)?e[r].parameters=a.migrateDiscoveryParameters(e[r].parameters,t):e[r].parameters={},Array.isArray(e[r].gis_data_types)?e[r].gis_data_types=e[r].gis_data_types.filter(e=>n.includes(e)):e[r].gis_data_types=[],void 0!==e[r].links&&(e[r].links=a.migrateLinks(e[r].links,t));return e}e.exports=class{static guessApiVersion(e){if(!i.isObject(e))return"0.0.0";if(s.validate(e.api_version))return e.api_version;if(s.validate(e.version))return e.version;if(Array.isArray(e.endpoints)){if(e.endpoints.find(e=>"/file_formats"===e.path||"/conformance"===e.path||"/files"===e.path))return"1.0.0";if(e.endpoints.find(e=>"/output_formats"===e.path||"/files/{user_id}"===e.path))return"0.4.2";if(!(e.backend_version||e.title||e.description||e.links))return"0.3.1"}return"0.0.0"}static convertCapabilitiesToLatestSpec(e,t=null,r=!0,n=!0,o="unknown",c="Unknown",l="0.0.0"){if(null===t&&(t=this.guessApiVersion(e)),"0.0.0"===t)return{};if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";let p=i.deepClone(e);return p.api_version=r?"1.0.0":t,i.isObject(p.billing)?p.billing=this.convertBillingToLatestSpec(p.billing,t):delete p.billing,p.endpoints=this.convertEndpointsToLatestSpec(p.endpoints,t,n),!r&&s.compare(t,"0.4.x","=")?p.stac_version="0.6.2":(r||"string"!=typeof p.stac_version)&&(p.stac_version="0.9.0"),"boolean"!=typeof p.production&&(p.production=!(!s.compare(t,"1.0.0-rc.1","=")&&!s.compare(t,"1.0.0-rc.2","="))),"string"!=typeof p.backend_version&&(p.backend_version=l),"string"!=typeof p.id&&(p.id=o),"string"!=typeof p.title&&(p.title=c),"string"!=typeof p.description&&(p.description=""),p.links=a.migrateLinks(p.links,t),p}static convertBillingToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return"string"!=typeof(e=i.isObject(e)?i.deepClone(e):{}).currency&&(e.currency=null),e}static convertEndpointsToLatestSpec(e,t,r=!1){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if(!Array.isArray(e))return[];if(e=i.deepClone(e),r){let r=s.compare(t,"0.4.x","="),i=s.compare(t,"1.0.0-rc.2","<"),n=function(e){let t="/process_graphs/{process_graph_id}",r=e.findIndex(e=>e.path===t);return r>=0?-1===e[r].methods.indexOf("PUT")&&e[r].methods.push("PUT"):e.push({path:t,methods:["PUT"]}),e};for(var a in e){let t=e[a];if(r)switch(t.path){case"/output_formats":t.path="/file_formats";break;case"/files/{user_id}":t.path="/files";break;case"/files/{user_id}/{path}":t.path="/files/{path}"}if(i)switch(t.path){case"/process_graphs":let r=t.methods.indexOf("POST");r>=0&&(t.methods.splice(r,1),n(e));break;case"/process_graphs/{process_graph_id}":let i=t.methods.indexOf("PATCH");i>=0&&(t.methods.splice(i,1),n(e))}}}return e}static convertOutputFormatsToLatestSpec(e,t){return this.convertFileFormatsToLatestSpec(e,t)}static convertFileFormatsToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return e=i.isObject(e)?i.deepClone(e):{},s.compare(t,"0.4.x","=")&&i.isObject(e)&&(e={output:e}),e.input=o(e.input,t),e.output=o(e.output,t),e}static convertServiceTypesToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if(!i.isObject(e))return{};e=i.deepClone(e);for(let r in e)i.isObject(e[r])||(e[r]={}),s.compare(t,"0.4.x","=")&&(delete e[r].attributes,i.isObject(e[r].parameters)&&(e[r].configuration=e[r].parameters),delete e[r].parameters,Array.isArray(e[r].variables)&&(e[r].process_parameters=e[r].variables.map(e=>{let t={name:e.variable_id,description:"string"==typeof e.description?e.description:"",schema:{type:["string"==typeof e.type?e.type:"string","null"]}};return void 0!==e.default&&(t.default=e.default),t})),delete e[r].variables),i.isObject(e[r].configuration)?e[r].configuration=a.migrateDiscoveryParameters(e[r].configuration,t):e[r].configuration={},Array.isArray(e[r].process_parameters)||(e[r].process_parameters=[]),void 0!==e[r].links&&(e[r].links=a.migrateLinks(e[r].links,t));return e}static convertUdfRuntimesToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if(!i.isObject(e))return{};e=i.deepClone(e);for(let r in e){if(s.compare(t,"0.4.x","=")){if(!i.isObject(e[r])){delete e[r];continue}null===e[r].description&&(e[r].description="")}"string"!=typeof e[r].type&&("string"==typeof e[r].docker?e[r].type="docker":e[r].type="language"),void 0!==e[r].links&&(e[r].links=a.migrateLinks(e[r].links,t))}return e}}},function(e,t,r){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,s,a;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(s=i;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(s of t.entries())if(!r.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],r.get(s[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(s of t.entries())if(!r.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((i=t.length)!=r.length)return!1;for(s=i;0!=s--;)if(t[s]!==r[s])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=i;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,a[s]))return!1;for(s=i;0!=s--;){var n=a[s];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}},function(e,t,r){var i,s,a;s=[],void 0===(a="function"==typeof(i=function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(e){var t,r,i=e.replace(/^v/,"").replace(/\+.*$/,""),s=(r="-",-1===(t=i).indexOf(r)?t.length:t.indexOf(r)),a=i.substring(0,s).split(".");return a.push(i.substring(s+1)),a}function r(e){return isNaN(Number(e))?e:Number(e)}function i(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!e.test(t))throw new Error("Invalid argument not valid semver ('"+t+"' received)")}function s(e,s){[e,s].forEach(i);for(var a=t(e),n=t(s),o=0;o<Math.max(a.length-1,n.length-1);o++){var c=parseInt(a[o]||0,10),l=parseInt(n[o]||0,10);if(c>l)return 1;if(l>c)return-1}var p=a[a.length-1],u=n[n.length-1];if(p&&u){var f=p.split(".").map(r),d=u.split(".").map(r);for(o=0;o<Math.max(f.length,d.length);o++){if(void 0===f[o]||"string"==typeof d[o]&&"number"==typeof f[o])return-1;if(void 0===d[o]||"string"==typeof f[o]&&"number"==typeof d[o])return 1;if(f[o]>d[o])return 1;if(d[o]>f[o])return-1}}else if(p||u)return p?-1:1;return 0}var a=[">",">=","=","<","<="],n={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return s.validate=function(t){return"string"==typeof t&&e.test(t)},s.compare=function(e,t,r){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===a.indexOf(e))throw new TypeError("Invalid operator, expected one of "+a.join("|"))}(r);var i=s(e,t);return n[r].indexOf(i)>-1},s})?i.apply(t,s):i)||(e.exports=a)},function(e,t,r){const i=r(0),s=r(1),a=r(2),n={cube:"datacube",eo:"eo",label:"label",pc:"pointcloud",proj:"projection",sar:"sar",sat:"sat",sci:"scientific",view:"view"},o={"item:license":"license","item:providers":"providers","eo:instrument":"instruments","eo:platform":"platform","eo:constellation":"constellation","eo:epsg":"proj:epsg","eo:off_nadir":"view:off_nadir","eo:azimuth":"view:azimuth","eo:sun_azimuth":"view:sun_azimuth","eo:sun_elevation":"view:sun_elevation","dtr:start_datetime":"start_datetime","dtr:end_datetime":"end_datetime","pc:schema":"pc:schemas","sar:type":"sar:product_type","sar:polarization":"sar:polarizations","sar:instrument":"instruments","sar:platform":"platform","sar:constellation":"constellation","sar:off_nadir":"sat:off_nadir_angle","sar:relative_orbit":"sat:relative_orbit","sar:pass_direction":"sat:orbit_state"},c=["cube:dimensions","sci:publications","sci:doi","sci:citation"],l=["spatial","temporal","bands","other"];class p{static convertCollectionsToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return e=i.deepClone(e),Array.isArray(e.collections)?e.collections=e.collections.map(e=>p.convertCollectionToLatestSpec(e,t)).filter(e=>"string"==typeof e.id):e.collections=[],e.links=a.migrateLinks(e.links,t),e}static convertCollectionToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";let r=i.deepClone(e);if("string"!=typeof r.id||0===r.id.length)return{};if(s.validate(r.stac_version)&&!s.compare(r.stac_version,"0.9.0","<")||(r.stac_version="0.9.0"),i.isObject(r.extent)||(r.extent={}),s.compare(t,"0.4.x","=")){if(Array.isArray(r.extent.spatial)&&(r.extent.spatial={bbox:[r.extent.spatial]}),Array.isArray(r.extent.temporal)&&(r.extent.temporal={interval:[r.extent.temporal]}),i.isObject(r.properties)){i.isObject(r.other_properties)||(r.other_properties={});for(let e in r.properties)r.other_properties[e]={values:[r.properties[e]]}}delete r.properties;let e=i.isObject(r.other_properties)?r.other_properties:{};for(let t in e){let s=e[t];i.isObject(s)&&(Array.isArray(s.extent)||Array.isArray(s.values))?Array.isArray(s.extent)?e[t]={min:s.extent[0],max:s.extent[1]}:-1===s.values.findIndex(e=>!Array.isArray(e))?s.values.length<=1?e[t]=s.values[0]:e[t]=s.values.reduce((e,t)=>e.concat(t)):e[t]=s.values:(void 0===r[t]&&(r[t]=s),delete e[t])}delete r.other_properties,i.isObject(r.summaries)||(r.summaries={});for(let t in e){let i=e[t];"sar:pass_direction"===t&&(i=i.map(e=>null===e?"geostationary":e)),("sar:resolution"===t||"sar:pixel_spacing"===t||"sar:looks"===t)&&Array.isArray(i)&&i.length>=2?(r.summaries[t+"_range"]=i.slice(0,1),r.summaries[t+"_azimuth"]=i.slice(1,2),i.length>2&&(r.summaries[t+"_equivalent_number"]=i.slice(2,3))):"string"==typeof o[t]?r.summaries[o[t]]=i:c.includes(t)&&Array.isArray(i)&&1===i.length?r[t]=i[0]:r.summaries[t]=i}}if("string"!=typeof r.description&&(r.description=""),i.isObject(r.extent.spatial)||(r.extent.spatial={}),i.isObject(r.extent.temporal)||(r.extent.temporal={}),"string"!=typeof r.license&&(r.license="proprietary"),i.isObject(r.summaries)||(r.summaries={}),i.isObject(r["cube:dimensions"]))for(var p in r["cube:dimensions"])i.isObject(r["cube:dimensions"][p])&&!l.includes(r["cube:dimensions"][p].type)&&(r["cube:dimensions"][p].type="other");else r["cube:dimensions"]={};r.links=a.migrateLinks(r.links);var u=Array.isArray(r.stac_extensions)?r.stac_extensions:[];for(var f in r){let e=null,t=f.split(":",1);"deprecated"===f||"version"===f?e="version":"string"==typeof n[t]&&(e=n[t]),null===e||u.includes(e)||u.push(e)}return u.sort(),r.stac_extensions=u,r}}e.exports=p},function(e,t,r){const i=r(0),s=r(1),a=r(2);class n{static convertProcessesToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return e=i.deepClone(e),Array.isArray(e.processes)?e.processes=e.processes.map(e=>n.convertProcessToLatestSpec(e,t)).filter(e=>"string"==typeof e.id):e.processes=[],e.links=a.migrateLinks(e.links,t),e}static convertProcessToLatestSpec(e,t){if(s.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if("string"!=typeof(e=i.deepClone(e)).id||0===e.id.length)return{};if(s.compare(t,"0.4.x","=")){if(!Array.isArray(e.parameter_order)||0===e.parameter_order.length){e.parameter_order=[];for(let t in e.parameters)e.parameter_order.push(t)}let t=[];for(let r of e.parameter_order){let s={name:r};i.isObject(e.parameters[r])&&Object.assign(s,e.parameters[r]),s.required||(s.optional=!0),delete s.required,t.push(s)}delete e.parameter_order,e.parameters=t}if("string"!=typeof e.description&&(e.description=""),Array.isArray(e.parameters))for(var r=e.parameters.length-1;r>=0;r--){let s=e.parameters[r];i.isObject(s)?("string"!=typeof s.description&&(s.description=""),e.parameters[r]=o(s,t)):e.parameters.splice(r,1)}else e.parameters=[];return i.isObject(e.returns)||(e.returns={}),e.returns=o(e.returns,t,!1),Array.isArray(e.examples)&&(e.examples=e.examples.filter(e=>i.isObject(e)&&i.isObject(e.arguments))),void 0!==e.links&&(e.links=a.migrateLinks(e.links,t)),e}}function o(e,t,r=!0){var i={};if(e.schema&&"object"==typeof e.schema&&(i=e.schema),s.compare(t,"0.4.x","=")){for(let t of["anyOf","oneOf"])if(Array.isArray(i[t])){r&&void 0!==i.default&&(e.default=i.default),i=i[t];break}let a=s.compare(t,"0.4.x")<=0&&void 0!==e.media_type,n=Array.isArray(i)?i:[i];for(let t of n)t=c(t),r&&void 0!==t.default&&(e.default=t.default,delete t.default),a&&(t.contentMediaType=e.media_type);a&&delete e.media_type}return s.compare(t,"0.4.x",">")&&void 0!==e.default&&(e.optional=!0),e.schema=i,e}function c(e){if(i.isObject(e)&&void 0!==e.type&&"string"==typeof e.format){switch(e.format){case"url":e.format="uri";break;case"proj-definition":e.deprecated=!0;break;case"callback":if(e.format="process-graph",i.isObject(e.parameters)){let t=[];for(let r in e.parameters){let i=e.parameters[r],s={name:r,description:"string"==typeof i.description?i.description:"",schema:i};t.push(s)}e.parameters=t}}e.subtype=e.format,["date-time","time","date","uri"].includes(e.format)||delete e.format}for(let t in e)e[t]&&"object"==typeof e[t]&&(e[t]=c(e[t]));return e}e.exports=n},function(e,t,r){const i=r(4);e.exports=class extends i{constructor(e){super(e.schema,e.default),Object.assign(this,e)}}}])})); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(window,(function(){return function(e){var t={};function r(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,s){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(r.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(s,i,function(t){return e[t]}.bind(null,i));return s},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t,r){var s=r(8);class i{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static hasText(e){return"string"==typeof e&&e.length>0}static equals(e,t){return s(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const r={};return t.forEach(t=>r[t]=e[t]),r}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var r=Object.assign({},e);for(let e of t)delete r[e];return r}static mapObject(e,t){const r=Object.keys(e),s=new Array(r.length);return r.forEach((r,i)=>{s[i]=t(e[r],r,e)}),s}static mapObjectValues(e,t){e=Object(e);const r={};return Object.keys(e).forEach(s=>{r[s]=t(e[s],s,e)}),r}static unique(e,t=!1){return t?e.filter((e,t,r)=>r.findIndex(t=>i.equals(e,t))===t):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let r=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),r+=t.replace(/\/$/,"")),r}static replacePlaceholders(e,t={}){if("string"==typeof e&&i.isObject(t))for(var r in t){let s=t[r];e=e.replace("{"+r+"}",Array.isArray(s)?s.join("; "):s)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map(e=>{if(e.length>=3){const t=(e,t,r)=>t+" "+r.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e})).join(t)}static friendlyLinks(e,t=!0,r=["self"]){let s=[];if(!Array.isArray(e))return s;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&r.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=i.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),s.push(t));return t&&s.sort((e,t)=>i.compareStringCaseInsensitive(e.title,t.title)),s}}e.exports=i},function(e,t,r){const s=r(9);class i{static compare(e,t,r=null){return null!==r?s.compare(e,t,r):s(e,t)}static validate(e){return s.validate(e)}static findCompatible(e,t=!0,r=null,s=null){if(!Array.isArray(e)||0===e.length)return[];let n=e.filter(e=>{if("string"==typeof e.url&&i.validate(e.api_version)){let t=i.validate(r),n=i.validate(s);return t&&n?i.compare(e.api_version,r,">=")&&i.compare(e.api_version,s,"<="):t?i.compare(e.api_version,r,">="):!n||i.compare(e.api_version,s,"<=")}return!1});return 0===n.length?[]:n.sort((e,r)=>{let s=!0===e.production,n=!0===r.production;return t&&s!==n?s?-1:1:-1*i.compare(e.api_version,r.api_version)})}static findLatest(e,t=!0,r=null,s=null){let n=i.findCompatible(e,t,r,s);return n.length>0?n[0]:null}}e.exports=i},function(e,t,r){const s=r(0),i=r(1);e.exports=class{static migrateLinks(e,t,r="related"){return Array.isArray(e)?e.filter(e=>s.isObject(e)&&"string"==typeof e.href).map(e=>("string"!=typeof e.rel&&(e.rel=r),e)):[]}static migrateDiscoveryParameters(e,t){if(i.compare(t,"1.0.0-rc.2","<="))for(var r in e){if(!s.isObject(e[r])){delete e[r];continue}let t=e[r].type;"string"==typeof t&&(e[r].type=[t,"null"]);let i=e[r].example;void 0!==i&&(e[r].examples=[i],delete e[r].example)}return e}}},function(e,t,r){const s=r(0);class i{constructor(e,t=null,r){this.schema=e,void 0===this.schema.default&&(this.schema.default=r),this.parent=t}toJSON(){return Object.assign({},this.schema,{default:this.default()})}isAny(){return"any"===this.dataType()}isNull(){return"null"===this.schema.type}nullable(){return this.isNull()||this.isAny()}isEditable(){return!i.NON_EDITABLE.includes(this.dataType())}dataType(e=!1){let t=this.schema.type||"any";return e?t:this.schema.subtype||t}nativeDataType(){return this.dataType(!0)}isEnum(){return Array.isArray(this.schema.enum)&&this.schema.enum.length>0}getEnumChoices(){return this.isEnum()?this.schema.enum:[]}getCallbackParameters(){return Array.isArray(this.schema.parameters)?this.schema.parameters:[]}group(){return s.hasText(this.schema.group)?this.schema.group:i.DEFAULT_GROUP}title(){return s.hasText(this.schema.title)?this.schema.title:s.prettifyString(this.dataType())}description(){return s.hasText(this.schema.description)?this.schema.description:""}default(){return"function"==typeof this.schema.default?this.schema.default():this.schema.default}}i.DEFAULT_GROUP="Other",i.NON_EDITABLE=["raster-cube","vector-cube","labeled-array"],e.exports=i},function(e,t,r){const s=r(5),i=r(3),n=r(0);e.exports=class{constructor(e=null,t){if(n.isObject(e)||Array.isArray(e))if(this.unspecified=!1,this.schemas=s.normalizeJsonSchema(e,!0).map(e=>new i(e,this,t)),void 0===t){let e=this.schemas.map(e=>e.default()).filter(e=>void 0!==e);this.default=e[0]}else this.default=t;else this.unspecified=!0,this.schemas=[];this.refs=[]}toJSON(){return this.schemas.map(e=>e.toJSON())}isEditable(){return this.unspecified||this.schemas.filter(e=>e.isEditable()&&!e.isNull()).length>0}is(e){var t=this.dataTypes();return 1===t.length&&t[0]===e}nativeDataType(){return this.dataType(!0)}dataType(e=!1){var t=this.dataTypes(!0,e),r=t.indexOf("null");return 1===t.length?t[0]:2===t.length&&-1!==r?t[0===r?1:0]:"mixed"}dataTypes(e=!1,t=!1){var r=this.schemas.map(e=>e.dataType(t)).filter((e,t,r)=>r.indexOf(e)===t);return 0===r.length||r.includes("any")?["any"]:e?r:r.filter(e=>"null"!==e)}nullable(){return this.unspecified||this.schemas.filter(e=>e.nullable()).length>0}}},function(e,t,r){const s=r(0);class i{static normalizeJsonSchema(e,t=!1){e=s.isObject(e)?[e]:Array.isArray(e)?e:[];let r=[];for(let t of e)if(Array.isArray(t.allOf))r.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=s.omitFromObject(t,["oneOf","anyOf"]),i=t.oneOf||t.anyOf;for(let t of i)r.push(Object.assign({},e,t))}else r.push(t);if(!t)return r;e=[];for(let t of r)Array.isArray(t.type)?e=e.concat(t.type.map(e=>Object.assign({},t,{type:e}))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!s.isObject(e)||!e.schema)return[];let r,n=i.normalizeJsonSchema(e.schema);for(;r=t.shift();)n=n.map(e=>i.normalizeJsonSchema(i.getElementJsonSchema(e,r))),n=n.concat(...n);let a=[];for(let e of n)if(Array.isArray(e.parameters)){if(a.length>0&&!s.equals(a,e.parameters))throw new Error("Multiple schemas with different callback parameters found.");a=e.parameters}return a}static getCallbackParametersForProcess(e,t,r=[]){if(!s.isObject(e)||!Array.isArray(e.parameters))return[];let n=e.parameters.find(e=>e.name===t);return i.getCallbackParameters(n,r)}static getNativeTypesForJsonSchema(e,t=!1){if(s.isObject(e)&&Array.isArray(e.type)){let r=s.unique(e.type).filter(e=>i.JSON_SCHEMA_TYPES.includes(e));return r.length>0&&r.length<i.JSON_SCHEMA_TYPES.length?r:t?[]:i.JSON_SCHEMA_TYPES}return s.isObject(e)&&"string"==typeof e.type&&i.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:i.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let r=i.getNativeTypesForJsonSchema(e);if(s.isObject(e)&&r.includes("array")&&"string"!=typeof t){if(s.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&s.isObject(e.items[t]))return e.items[t];if(s.isObject(e.additionalItems))return e.additionalItems}}if(s.isObject(e)&&r.includes("object")){if(null!==t&&s.isObject(e.properties)&&s.isObject(e.properties[t]))return e.properties[t];if(s.isObject(e.additionalProperties))return e.additionalProperties}return{}}}i.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=i},function(e,t,r){const s=r(7),i=r(10),n=r(11),a=r(3),o=r(12),c=r(4),l=r(5),p=r(13),u=r(1),f=r(0);e.exports={MigrateCapabilities:s,MigrateCollections:i,MigrateProcesses:n,ProcessDataType:a,ProcessParameter:o,ProcessSchema:c,ProcessUtils:l,ProcessRegistry:p,Versions:u,Utils:f}},function(e,t,r){const s=r(0),i=r(1),n=r(2);const a=["raster","vector","table","other"];function o(e,t){s.isObject(e)||(e={});for(let r in e)s.isObject(e[r].parameters)?e[r].parameters=n.migrateDiscoveryParameters(e[r].parameters,t):e[r].parameters={},Array.isArray(e[r].gis_data_types)?e[r].gis_data_types=e[r].gis_data_types.filter(e=>a.includes(e)):e[r].gis_data_types=[],void 0!==e[r].links&&(e[r].links=n.migrateLinks(e[r].links,t));return e}e.exports=class{static guessApiVersion(e){if(!s.isObject(e))return"0.0.0";if(i.validate(e.api_version))return e.api_version;if(i.validate(e.version))return e.version;if(Array.isArray(e.endpoints)){if(e.endpoints.find(e=>"/file_formats"===e.path||"/conformance"===e.path||"/files"===e.path))return"1.0.0";if(e.endpoints.find(e=>"/output_formats"===e.path||"/files/{user_id}"===e.path))return"0.4.2";if(!(e.backend_version||e.title||e.description||e.links))return"0.3.1"}return"0.0.0"}static convertCapabilitiesToLatestSpec(e,t=null,r=!0,a=!0,o="unknown",c="Unknown",l="0.0.0"){if(null===t&&(t=this.guessApiVersion(e)),"0.0.0"===t)return{};if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";let p=s.deepClone(e);return p.api_version=r?"1.0.0":t,s.isObject(p.billing)?p.billing=this.convertBillingToLatestSpec(p.billing,t):delete p.billing,p.endpoints=this.convertEndpointsToLatestSpec(p.endpoints,t,a),!r&&i.compare(t,"0.4.x","=")?p.stac_version="0.6.2":(r||"string"!=typeof p.stac_version)&&(p.stac_version="0.9.0"),"boolean"!=typeof p.production&&(p.production=!(!i.compare(t,"1.0.0-rc.1","=")&&!i.compare(t,"1.0.0-rc.2","="))),"string"!=typeof p.backend_version&&(p.backend_version=l),"string"!=typeof p.id&&(p.id=o),"string"!=typeof p.title&&(p.title=c),"string"!=typeof p.description&&(p.description=""),p.links=n.migrateLinks(p.links,t),p}static convertBillingToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return"string"!=typeof(e=s.isObject(e)?s.deepClone(e):{}).currency&&(e.currency=null),e}static convertEndpointsToLatestSpec(e,t,r=!1){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if(!Array.isArray(e))return[];if(e=s.deepClone(e),r){let r=i.compare(t,"0.4.x","="),s=i.compare(t,"1.0.0-rc.2","<"),a=function(e){let t="/process_graphs/{process_graph_id}",r=e.findIndex(e=>e.path===t);return r>=0?-1===e[r].methods.indexOf("PUT")&&e[r].methods.push("PUT"):e.push({path:t,methods:["PUT"]}),e};for(var n in e){let t=e[n];if(r)switch(t.path){case"/output_formats":t.path="/file_formats";break;case"/files/{user_id}":t.path="/files";break;case"/files/{user_id}/{path}":t.path="/files/{path}"}if(s)switch(t.path){case"/process_graphs":let r=t.methods.indexOf("POST");r>=0&&(t.methods.splice(r,1),a(e));break;case"/process_graphs/{process_graph_id}":let s=t.methods.indexOf("PATCH");s>=0&&(t.methods.splice(s,1),a(e))}}}return e}static convertOutputFormatsToLatestSpec(e,t){return this.convertFileFormatsToLatestSpec(e,t)}static convertFileFormatsToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return e=s.isObject(e)?s.deepClone(e):{},i.compare(t,"0.4.x","=")&&s.isObject(e)&&(e={output:e}),e.input=o(e.input,t),e.output=o(e.output,t),e}static convertServiceTypesToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if(!s.isObject(e))return{};e=s.deepClone(e);for(let r in e)s.isObject(e[r])||(e[r]={}),i.compare(t,"0.4.x","=")&&(delete e[r].attributes,s.isObject(e[r].parameters)&&(e[r].configuration=e[r].parameters),delete e[r].parameters,Array.isArray(e[r].variables)&&(e[r].process_parameters=e[r].variables.map(e=>{let t={name:e.variable_id,description:"string"==typeof e.description?e.description:"",schema:{type:["string"==typeof e.type?e.type:"string","null"]}};return void 0!==e.default&&(t.default=e.default),t})),delete e[r].variables),s.isObject(e[r].configuration)?e[r].configuration=n.migrateDiscoveryParameters(e[r].configuration,t):e[r].configuration={},Array.isArray(e[r].process_parameters)||(e[r].process_parameters=[]),void 0!==e[r].links&&(e[r].links=n.migrateLinks(e[r].links,t));return e}static convertUdfRuntimesToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if(!s.isObject(e))return{};e=s.deepClone(e);for(let r in e){if(i.compare(t,"0.4.x","=")){if(!s.isObject(e[r])){delete e[r];continue}null===e[r].description&&(e[r].description="")}"string"!=typeof e[r].type&&("string"==typeof e[r].docker?e[r].type="docker":e[r].type="language"),void 0!==e[r].links&&(e[r].links=n.migrateLinks(e[r].links,t))}return e}}},function(e,t,r){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var s,i,n;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(i=s;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(i of t.entries())if(!r.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],r.get(i[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(i of t.entries())if(!r.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((s=t.length)!=r.length)return!1;for(i=s;0!=i--;)if(t[i]!==r[i])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(n=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=s;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,n[i]))return!1;for(i=s;0!=i--;){var a=n[i];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},function(e,t,r){var s,i,n;i=[],void 0===(n="function"==typeof(s=function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(e){var t,r,s=e.replace(/^v/,"").replace(/\+.*$/,""),i=(r="-",-1===(t=s).indexOf(r)?t.length:t.indexOf(r)),n=s.substring(0,i).split(".");return n.push(s.substring(i+1)),n}function r(e){return isNaN(Number(e))?e:Number(e)}function s(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!e.test(t))throw new Error("Invalid argument not valid semver ('"+t+"' received)")}function i(e,i){[e,i].forEach(s);for(var n=t(e),a=t(i),o=0;o<Math.max(n.length-1,a.length-1);o++){var c=parseInt(n[o]||0,10),l=parseInt(a[o]||0,10);if(c>l)return 1;if(l>c)return-1}var p=n[n.length-1],u=a[a.length-1];if(p&&u){var f=p.split(".").map(r),d=u.split(".").map(r);for(o=0;o<Math.max(f.length,d.length);o++){if(void 0===f[o]||"string"==typeof d[o]&&"number"==typeof f[o])return-1;if(void 0===d[o]||"string"==typeof f[o]&&"number"==typeof d[o])return 1;if(f[o]>d[o])return 1;if(d[o]>f[o])return-1}}else if(p||u)return p?-1:1;return 0}var n=[">",">=","=","<","<="],a={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return i.validate=function(t){return"string"==typeof t&&e.test(t)},i.compare=function(e,t,r){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===n.indexOf(e))throw new TypeError("Invalid operator, expected one of "+n.join("|"))}(r);var s=i(e,t);return a[r].indexOf(s)>-1},i})?s.apply(t,i):s)||(e.exports=n)},function(e,t,r){const s=r(0),i=r(1),n=r(2),a={cube:"datacube",eo:"eo",label:"label",pc:"pointcloud",proj:"projection",sar:"sar",sat:"sat",sci:"scientific",view:"view"},o={"item:license":"license","item:providers":"providers","eo:instrument":"instruments","eo:platform":"platform","eo:constellation":"constellation","eo:epsg":"proj:epsg","eo:off_nadir":"view:off_nadir","eo:azimuth":"view:azimuth","eo:sun_azimuth":"view:sun_azimuth","eo:sun_elevation":"view:sun_elevation","dtr:start_datetime":"start_datetime","dtr:end_datetime":"end_datetime","pc:schema":"pc:schemas","sar:type":"sar:product_type","sar:polarization":"sar:polarizations","sar:instrument":"instruments","sar:platform":"platform","sar:constellation":"constellation","sar:off_nadir":"sat:off_nadir_angle","sar:relative_orbit":"sat:relative_orbit","sar:pass_direction":"sat:orbit_state"},c=["cube:dimensions","sci:publications","sci:doi","sci:citation"],l=["spatial","temporal","bands","other"];class p{static convertCollectionsToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return e=s.deepClone(e),Array.isArray(e.collections)?e.collections=e.collections.map(e=>p.convertCollectionToLatestSpec(e,t)).filter(e=>"string"==typeof e.id):e.collections=[],e.links=n.migrateLinks(e.links,t),e}static convertCollectionToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";let r=s.deepClone(e);if("string"!=typeof r.id||0===r.id.length)return{};if(i.validate(r.stac_version)&&!i.compare(r.stac_version,"0.9.0","<")||(r.stac_version="0.9.0"),s.isObject(r.extent)||(r.extent={}),i.compare(t,"0.4.x","=")){if(Array.isArray(r.extent.spatial)&&(r.extent.spatial={bbox:[r.extent.spatial]}),Array.isArray(r.extent.temporal)&&(r.extent.temporal={interval:[r.extent.temporal]}),s.isObject(r.properties)){s.isObject(r.other_properties)||(r.other_properties={});for(let e in r.properties)r.other_properties[e]={values:[r.properties[e]]}}delete r.properties;let e=s.isObject(r.other_properties)?r.other_properties:{};for(let t in e){let i=e[t];s.isObject(i)&&(Array.isArray(i.extent)||Array.isArray(i.values))?Array.isArray(i.extent)?e[t]={min:i.extent[0],max:i.extent[1]}:-1===i.values.findIndex(e=>!Array.isArray(e))?i.values.length<=1?e[t]=i.values[0]:e[t]=i.values.reduce((e,t)=>e.concat(t)):e[t]=i.values:(void 0===r[t]&&(r[t]=i),delete e[t])}delete r.other_properties,s.isObject(r.summaries)||(r.summaries={});for(let t in e){let s=e[t];"sar:pass_direction"===t&&(s=s.map(e=>null===e?"geostationary":e)),("sar:resolution"===t||"sar:pixel_spacing"===t||"sar:looks"===t)&&Array.isArray(s)&&s.length>=2?(r.summaries[t+"_range"]=s.slice(0,1),r.summaries[t+"_azimuth"]=s.slice(1,2),s.length>2&&(r.summaries[t+"_equivalent_number"]=s.slice(2,3))):"string"==typeof o[t]?r.summaries[o[t]]=s:c.includes(t)&&Array.isArray(s)&&1===s.length?r[t]=s[0]:r.summaries[t]=s}}if("string"!=typeof r.description&&(r.description=""),s.isObject(r.extent.spatial)||(r.extent.spatial={}),s.isObject(r.extent.temporal)||(r.extent.temporal={}),"string"!=typeof r.license&&(r.license="proprietary"),s.isObject(r.summaries)||(r.summaries={}),s.isObject(r["cube:dimensions"]))for(var p in r["cube:dimensions"])s.isObject(r["cube:dimensions"][p])&&!l.includes(r["cube:dimensions"][p].type)&&(r["cube:dimensions"][p].type="other");else r["cube:dimensions"]={};r.links=n.migrateLinks(r.links);var u=Array.isArray(r.stac_extensions)?r.stac_extensions:[];for(var f in r){let e=null,t=f.split(":",1);"deprecated"===f||"version"===f?e="version":"string"==typeof a[t]&&(e=a[t]),null===e||u.includes(e)||u.push(e)}return u.sort(),r.stac_extensions=u,r}}e.exports=p},function(e,t,r){const s=r(0),i=r(1),n=r(2);class a{static convertProcessesToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";return e=s.deepClone(e),Array.isArray(e.processes)?e.processes=e.processes.map(e=>a.convertProcessToLatestSpec(e,t)).filter(e=>"string"==typeof e.id):e.processes=[],e.links=n.migrateLinks(e.links,t),e}static convertProcessToLatestSpec(e,t){if(i.compare(t,"0.3.x","<="))throw"Migrating from API version 0.3.0 and older is not supported.";if("string"!=typeof(e=s.deepClone(e)).id||0===e.id.length)return{};if(i.compare(t,"0.4.x","=")){if(!Array.isArray(e.parameter_order)||0===e.parameter_order.length){e.parameter_order=[];for(let t in e.parameters)e.parameter_order.push(t)}let t=[];for(let r of e.parameter_order){let i={name:r};s.isObject(e.parameters[r])&&Object.assign(i,e.parameters[r]),i.required||(i.optional=!0),delete i.required,t.push(i)}delete e.parameter_order,e.parameters=t}if("string"!=typeof e.description&&(e.description=""),Array.isArray(e.parameters))for(var r=e.parameters.length-1;r>=0;r--){let i=e.parameters[r];s.isObject(i)?("string"!=typeof i.description&&(i.description=""),e.parameters[r]=o(i,t)):e.parameters.splice(r,1)}else e.parameters=[];return s.isObject(e.returns)||(e.returns={}),e.returns=o(e.returns,t,!1),Array.isArray(e.examples)&&(e.examples=e.examples.filter(e=>s.isObject(e)&&s.isObject(e.arguments))),void 0!==e.links&&(e.links=n.migrateLinks(e.links,t)),e}}function o(e,t,r=!0){var s={};if(e.schema&&"object"==typeof e.schema&&(s=e.schema),i.compare(t,"0.4.x","=")){for(let t of["anyOf","oneOf"])if(Array.isArray(s[t])){r&&void 0!==s.default&&(e.default=s.default),s=s[t];break}let n=i.compare(t,"0.4.x")<=0&&void 0!==e.media_type,a=Array.isArray(s)?s:[s];for(let t of a)t=c(t),r&&void 0!==t.default&&(e.default=t.default,delete t.default),n&&(t.contentMediaType=e.media_type);n&&delete e.media_type}return i.compare(t,"0.4.x",">")&&void 0!==e.default&&(e.optional=!0),e.schema=s,e}function c(e){if(s.isObject(e)&&void 0!==e.type&&"string"==typeof e.format){switch(e.format){case"url":e.format="uri";break;case"proj-definition":e.deprecated=!0;break;case"callback":if(e.format="process-graph",s.isObject(e.parameters)){let t=[];for(let r in e.parameters){let s=e.parameters[r],i={name:r,description:"string"==typeof s.description?s.description:"",schema:s};t.push(i)}e.parameters=t}}e.subtype=e.format,["date-time","time","date","uri"].includes(e.format)||delete e.format}for(let t in e)e[t]&&"object"==typeof e[t]&&(e[t]=c(e[t]));return e}e.exports=a},function(e,t,r){const s=r(4);e.exports=class extends s{constructor(e){super(e.schema,e.default),Object.assign(this,e)}}},function(e,t,r){const s=r(0);class i{constructor(e=[],t=!1){if(this.listeners=[],this.processes={},this.addNamespace=t,e instanceof i)for(let t in e.processes)this.addAll(e.processes[t]);else this.addAll(e)}onChange(e,t,r){for(let s of this.listeners)s(e,t,r)}addAll(e,t="backend"){for(var r in e)this.add(e[r],t,!1);this.onChange("addAll",e,t)}add(e,t="backend",r=!0){if(!s.isObject(e))throw new Error("Invalid process; not an object.");if("string"!=typeof e.id)throw new Error("Invalid process; no id specified.");if("string"!=typeof t)throw new Error("Invalid namespace; not a string.");this.processes[t]||(this.processes[t]={}),e=Object.assign(this.addNamespace?{namespace:t}:{},e),this.processes[t][e.id]=e,r&&this.onChange("add",e,t)}count(){return s.size(this.all())}all(){let e=[];for(let t in this.processes)e=e.concat(Object.values(this.processes[t]));return e}hasNamespace(e){return"string"==typeof e&&Boolean(this.processes[e])}namespaces(){return Object.keys(this.processes).sort()}namespace(e){if("string"!=typeof e)return[];let t=this.processes[e];return t?Object.values(t):[]}has(e,t=null){return Boolean(this.get(e,t))}get(e,t=null){return"string"!=typeof e?null:null===t?this.get(e,"user")||this.get(e,"backend"):this.processes[t]&&this.processes[t][e]||null}remove(e=null,t="user"){if("string"!=typeof t)return!1;if(this.processes[t]){if("string"!=typeof e)return delete this.processes[t],this.onChange("remove",null,t),!0;if(this.processes[t][e]){let r=this.processes[t][e];return delete this.processes[t][e],0===s.size(this.processes[t])&&delete this.processes[t],this.onChange("remove",r,t),!0}}return!1}}e.exports=i}])})); |
{ | ||
"name": "@openeo/js-commons", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"apiVersions": [ | ||
@@ -5,0 +5,0 @@ "0.4.x", |
@@ -5,8 +5,8 @@ # @openeo/js-commons | ||
The [master branch](https://github.com/Open-EO/openeo-api/tree/master) is the 'stable' version of library, which is currently version **1.3.0**. | ||
The [master branch](https://github.com/Open-EO/openeo-api/tree/master) is the 'stable' version of library, which is currently version **1.4.0**. | ||
The [draft branch](https://github.com/Open-EO/openeo-api/tree/draft) is where active development takes place. | ||
![Dependencies](https://img.shields.io/librariesio/release/npm/@openeo/js-commons) | ||
![Minified Size](https://img.shields.io/bundlephobia/min/@openeo/js-commons/1.3.0) | ||
![Minzipped Size](https://img.shields.io/bundlephobia/minzip/@openeo/js-commons/1.3.0) | ||
![Minified Size](https://img.shields.io/bundlephobia/min/@openeo/js-commons/1.4.0) | ||
![Minzipped Size](https://img.shields.io/bundlephobia/minzip/@openeo/js-commons/1.4.0) | ||
![Supported API Versions](https://img.shields.io/github/package-json/apiVersions/Open-Eo/openeo-js-commons/master) | ||
@@ -44,2 +44,2 @@ ![JS Commons Tests](https://github.com/Open-EO/openeo-js-commons/workflows/JS%20Commons%20Tests/badge.svg) | ||
More information can be found in the [**JS commons documentation**](https://open-eo.github.io/openeo-js-commons/1.3.0/). | ||
More information can be found in the [**JS commons documentation**](https://open-eo.github.io/openeo-js-commons/1.4.0/). |
@@ -10,2 +10,3 @@ // Migrations | ||
const ProcessUtils = require('./processUtils'); | ||
const ProcessRegistry = require('./processRegistry'); | ||
// Others | ||
@@ -23,4 +24,5 @@ const Versions = require('./versions'); | ||
ProcessUtils, | ||
ProcessRegistry, | ||
Versions, | ||
Utils, | ||
}; |
Sorry, the diff of this file is too big to display
198923
4408