New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openeo/js-commons

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openeo/js-commons - npm Package Compare versions

Comparing version 0.4.7 to 0.5.0-alpha.1

285

dist/main.js
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("ajv"));
module.exports = factory((function webpackLoadOptionalExternalModule() { try { return require("ajv"); } catch(e) {} }()));
else if(typeof define === 'function' && define.amd)
define(["ajv"], factory);
else {
var a = typeof exports === 'object' ? factory(require("ajv")) : factory(root["ajv"]);
var a = typeof exports === 'object' ? factory((function webpackLoadOptionalExternalModule() { try { return require("ajv"); } catch(e) {} }())) : factory(root["ajv"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];

@@ -483,3 +483,6 @@ }

const ajv = __webpack_require__(12);
var ajv;
try {
ajv = __webpack_require__(12);
} catch(err) {}
const Utils = __webpack_require__(0);

@@ -500,6 +503,6 @@

'output-format': {type: 'string', validate: 'validateOutputFormat'},
'output-format-options': {type: 'array', validate: 'validateOutputFormatOptions'},
'output-format-options': {type: 'object', validate: 'validateOutputFormatOptions'},
'process-graph-id': {type: 'string', validate: 'validateProcessGraphId'},
'process-graph-variables': {type: 'array', validate: 'validateProcessGraphVariables'},
'proj-definition': {type: 'string', validate: 'validateProjDefinition'},
'process-graph-variables': {type: 'object', validate: 'validateProcessGraphVariables'},
'proj-definition': {type: 'string', validate: 'validateProjDefinition'}, // Proj is deprecated. Implement projjson and wkt2 instead
'raster-cube': {type: 'object', validate: 'validateRasterCube'},

@@ -515,2 +518,5 @@ 'temporal-interval': {type: 'array', validate: 'validateTemporalInterval'},

};
if (!ajv) {
throw "ajv not installed";
}
this.ajv = new ajv(ajvOptions);

@@ -1243,2 +1249,6 @@ this.ajv.addKeyword('parameters', {

getNodeCount() {
return Utils.size(this.nodes);
}
getNodes() {

@@ -1401,20 +1411,23 @@ return this.nodes;

guessApiVersion(capabilties) {
if (typeof capabilties.version === 'string') {
return capabilties.version;
guessApiVersion(capabilities) {
if (typeof capabilities.api_version === 'string') {
return capabilities.api_version;
}
else if (typeof capabilties.api_version === 'string') {
return capabilties.api_version;
else if (typeof capabilities.version === 'string') {
return capabilities.version;
}
else if (capabilties.backend_version || capabilties.title || capabilties.description || capabilties.links) {
// Now we are really guessing
else if (Array.isArray(capabilities.endpoints) && capabilities.endpoints.filter(e => e.path === '/output_formats').length > 0) {
return "0.4";
}
else {
// This is a wild guess
else if (!capabilities.backend_version && !capabilities.title && !capabilities.description && !capabilities.links) {
return "0.3";
}
else { // Latest version
return "1.0";
}
},
// Always returns a copy of the input object
convertCapabilitiesToLatestSpec(originalCapabilities, version = null, title = "Unknown") {
convertCapabilitiesToLatestSpec(originalCapabilities, version = null, updateVersionNumber = true, title = "Unknown", backend_version = "Unknown") {
var capabilities = Object.assign({}, originalCapabilities);

@@ -1433,5 +1446,9 @@ if (version === null) {

// Convert billing plans
if (typeof capabilities.billing !== 'undefined') {
if (Utils.isObject(capabilities.billing)) {
capabilities.billing = this.convertBillingToLatestSpec(capabilities.billing, version);
}
else {
delete capabilities.billing;
}
// Convert endpoints

@@ -1441,7 +1458,7 @@ capabilities.endpoints = this.convertEndpointsToLatestSpec(capabilities.endpoints, version);

// Add missing fields with somewhat useful data
if (typeof capabilities.api_version !== 'string') {
capabilities.api_version = "0.4.2";
if (updateVersionNumber || typeof capabilities.api_version !== 'string') {
capabilities.api_version = "1.0.0";
}
if (typeof capabilities.backend_version !== 'string') {
capabilities.backend_version = "Unknown";
capabilities.backend_version = backend_version;
}

@@ -1452,4 +1469,7 @@ if (typeof capabilities.title !== 'string') {

if (typeof capabilities.description !== 'string') {
capabilities.description = "No description provided.";
capabilities.description = "";
}
if (!Array.isArray(capabilities.links)) {
capabilities.links = [];
}

@@ -1494,11 +1514,28 @@ return capabilities;

// Alias for convertFileFormatsToLatestSpec
convertOutputFormatsToLatestSpec(originalFormats, version) {
return this.convertFileFormatsToLatestSpec(originalFormats, version);
},
// Always returns a copy of the input object
convertOutputFormatsToLatestSpec(originalFormats, version) {
convertFileFormatsToLatestSpec(originalFormats, version) {
var formats = Object.assign({}, originalFormats);
// convert v0.3 output formats to v0.4 format
if (Utils.compareVersion(version, "0.3.x") === 0) {
if (typeof formats.formats === 'object' && formats.formats !== null) {
return formats.formats;
}
if (Utils.compareVersion(version, "0.3.x") === 0 && Utils.isObject(formats.formats)) {
formats = formats.formats;
}
if (Utils.compareVersion(version, "0.4.x") <= 0 && Utils.isObject(formats)) {
formats = {
output: formats
};
}
if (!Utils.isObject(formats.input)) {
formats.input = {};
}
if (!Utils.isObject(formats.output)) {
formats.output = {};
}
return formats;

@@ -1510,5 +1547,5 @@ },

var types = Object.assign({}, originalTypes);
// convert v0.3 service types to v0.4 format
if (Utils.compareVersion(version, "0.3.x") === 0) {
// Nothing to do as nothing has changed.
// Nothing to do as nothing has changed in 0.3 and 0.4.
if (Utils.compareVersion(version, "0.4.x") > 0) {
// Add future changes here.
}

@@ -1521,4 +1558,5 @@ return types;

var runtimes = Object.assign({}, originalRuntimes);
if (Utils.compareVersion(version, "0.3.x") === 0) {
// Nothing to do, was not supported in 0.3.
// Nothing to do, was not supported in 0.3 and nothing changed in 0.4.
if (Utils.compareVersion(version, "0.4.x") > 0) {
// Add future changes here.
}

@@ -1658,13 +1696,10 @@ return runtimes;

guessCollectionSpecVersion(c) {
var version = "0.4";
// Try to guess a version
if (typeof c.id === 'undefined' && typeof c.name !== 'undefined') { // No id defined, probably v0.3
version = "0.3";
// Always returns a copy of the input collection object
convertCollectionToLatestSpec(originalCollection, version) {
if (!version || typeof version !== 'string') {
throw new Error("No version specified");
}
return version;
},
// Always returns a copy of the input collection object
convertCollectionToLatestSpec(originalCollection, version = null) {
if (Utils.compareVersion(version, "0.5.x") >= 0) {
throw "Migrating collections from API version 0.4.0 is not supported yet";
}
var collection = Object.assign({}, originalCollection);

@@ -1674,5 +1709,2 @@ if (!Object.keys(collection).length) {

}
if (version === null) {
version = this.guessCollectionSpecVersion(collection);
}
// convert v0.3 processes to v0.4 format

@@ -1735,40 +1767,44 @@ if (Utils.compareVersion(version, "0.3.x") === 0) {

guessProcessSpecVersion(p) {
var version = "0.4";
// Try to guess a version
if (typeof p.id === 'undefined' && typeof p.name !== 'undefined') { // No id defined, probably v0.3
version = "0.3";
// Always returns a copy of the input process object
convertProcessToLatestSpec(originalProcess, version) {
if (!version || typeof version !== 'string') {
throw new Error("No version specified");
}
return version;
},
// Always returns a copy of the input process object
convertProcessToLatestSpec(originalProcess, version = null) {
// Make sure we don't alter the original object
var process = Object.assign({}, originalProcess);
if (version === null) {
version = this.guessProcessSpecVersion(process);
}
// convert v0.3 processes to v0.4 format
if (Utils.compareVersion(version, "0.3.x") === 0) {
// name => id
let isVersion03 = Utils.compareVersion(version, "0.3.x") === 0;
// name => id
if (isVersion03) {
process.id = process.name;
delete process.name;
}
// mime_type => media_type
if (typeof process.parameters === 'object') {
for(var key in process.parameters) {
if (typeof process.parameters[key].mime_type !== 'undefined') {
var param = Object.assign({}, process.parameters[key]);
param.media_type = param.mime_type;
delete param.mime_type;
process.parameters[key] = param;
}
}
// If process has no id => seems to be an invalid process, abort
if (typeof process.id !== 'string' || process.id.length === 0) {
return {};
}
// Set required field description if not a string
if (typeof process.description !== 'string') {
process.description = "";
}
// Parameters
if (Utils.isObject(process.parameters)) {
for(var key in process.parameters) {
process.parameters[key] = upgradeParamAndReturn(process.parameters[key], version);
}
if (typeof process.returns === 'object' && typeof process.returns.mime_type !== 'undefined') {
process.returns.media_type = process.returns.mime_type;
delete process.returns.mime_type;
}
}
else {
process.parameters = {};
}
// Return value
process.returns = upgradeParamAndReturn(process.returns, version);
if (isVersion03) {
// exception object
if (typeof process.exceptions === 'object') {
if (Utils.isObject(process.exceptions)) {
for(let key in process.exceptions) {

@@ -1784,3 +1820,3 @@ var e = process.exceptions[key];

// examples object
if (typeof process.examples === 'object') {
if (Utils.isObject(process.examples)) {
var examples = [];

@@ -1802,3 +1838,3 @@ for(let key in process.examples) {

// Fill parameter order
if (typeof process.parameters === 'object' && !Array.isArray(process.parameter_order)) {
if (typeof process.parameters === 'object' && !Array.isArray(process.parameter_order)) {
var parameter_order = Object.keys(process.parameters);

@@ -1808,4 +1844,5 @@ if (parameter_order.length > 1) {

}
}
}
}
return process;

@@ -1815,3 +1852,77 @@ }

};
function upgradeParamAndReturn(obj, version) {
// Not an object => return minimum required fields
if (!Utils.isObject(obj)) {
return {
description: "",
schema: {}
};
}
var param = Object.assign({}, obj);
// v0.3 => v0.4: mime_type => media_type
if (Utils.compareVersion(version, "0.3.x") === 0 && typeof param.mime_type !== 'undefined') {
param.media_type = param.mime_type;
delete param.mime_type;
}
// Set required fields if not valid yet
if (typeof param.description !== 'string') {
param.description = "";
}
if (typeof param.schema !== 'object' || !param.schema) {
param.schema = {};
}
if (Utils.compareVersion(version, "0.4.x") <= 0) {
// Remove anyOf/oneOf wrapper
for(var type in {anyOf: null, oneOf: null}) {
if (Array.isArray(param.schema[type])) {
if (typeof param.schema.default !== 'undefined') {
param.default = param.schema.default;
}
param.schema = param.schema[type];
break;
}
}
// Remove default value from schema, add on parameter-level instead
var moveMediaType = (Utils.compareVersion(version, "0.4.x") <= 0 && typeof param.media_type !== 'undefined');
var schemas = Array.isArray(param.schema) ? param.schema : [param.schema];
for(var i in schemas) {
if (typeof schemas[i].default !== 'undefined') {
param.default = schemas[i].default;
delete schemas[i].default;
}
// v0.3 => v0.4: mime_type => media_type
if (moveMediaType) {
schemas[i].contentMediaType = param.media_type;
}
renameFormat(schemas[i]);
}
// Remove the media type, has been moved to JSON Schema above.
if (moveMediaType) {
delete param.media_type;
}
}
return param;
}
function renameFormat(schema) {
for(var i in schema) {
if (i === 'format') {
schema.subtype = schema.format;
if (!['date-time', 'time', 'date', 'uri'].includes(schema.format)) {
delete schema.format;
}
}
else if (schema[i] && typeof schema[i] === 'object') {
renameFormat(schema[i]);
}
}
}
module.exports = MigrateProcesses;

@@ -1823,2 +1934,3 @@

if(typeof __WEBPACK_EXTERNAL_MODULE__12__ === 'undefined') {var e = new Error("Cannot find module 'ajv'"); e.code = 'MODULE_NOT_FOUND'; throw e;}
module.exports = __WEBPACK_EXTERNAL_MODULE__12__;

@@ -1889,11 +2001,11 @@

'get /processes',
'get /output_formats'
'get /file_formats'
],
'Authenticate with HTTP Basic': [ // TODO: Remove later because this auth method should not be used
'get /credentials/basic',
// 'get /me' // not necessarily needed (just outputs metadata)
// 'get /me' // not necessarily needed (just outputs metadata)
],
'Authenticate with OpenID Connect': [ // TODO: Remove later because the user doesn't care HOW the auth works
'get /credentials/oidc',
// 'get /me' // not necessarily needed (just outputs metadata)
// 'get /me' // not necessarily needed (just outputs metadata)
],

@@ -1904,7 +2016,8 @@ 'Batch processing': [

'get /jobs/{}',
// 'patch /jobs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
// 'patch /jobs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
'delete /jobs/{}',
'get /jobs/{}/logs',
'get /jobs/{}/results',
'post /jobs/{}/results',
// 'delete /jobs/{}/results' // not necessarily needed (can be deleted by deleting the entire job)
// 'delete /jobs/{}/results' // not necessarily needed (can be deleted by deleting the entire job)
],

@@ -1922,4 +2035,5 @@ 'Estimate processing costs': [

'get /services/{}',
// 'patch /services/{}', // not necessarily needed (can be achieved by deleting and re-creating)
// 'patch /services/{}', // not necessarily needed (can be achieved by deleting and re-creating)
'delete /services/{}',
'get /services/{}/logs'
],

@@ -1936,3 +2050,3 @@ 'File storage': [

'get /process_graphs/{}',
// 'patch /process_graphs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
// 'patch /process_graphs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
'delete /process_graphs/{}'

@@ -1954,2 +2068,5 @@ ],

'post /preview': ["0.3.*"]
},
'get /file_formats': {
'get /output_formats': ["0.3.*", "0.4.*"]
}

@@ -1956,0 +2073,0 @@ },

@@ -1,1 +0,1 @@

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("ajv"));else if("function"==typeof define&&define.amd)define(["ajv"],t);else{var r="object"==typeof exports?t(require("ajv")):t(e.ajv);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(window,function(e){return function(e){var t={};function r(s){if(t[s])return t[s].exports;var a=t[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,r),a.l=!0,a.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 a in e)r.d(s,a,function(t){return e[t]}.bind(null,a));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=7)}([function(e,t,r){const s=r(9);var a={compareVersion(e,t){try{return s(e,t)}catch(e){return null}},isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),size:e=>"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0,replacePlaceholders(e,t={}){if("string"==typeof e&&this.isObject(t))for(var r in t)e=e.replace("{"+r+"}",t[r]);return e}};e.exports=a},function(e,t,r){const s=r(0),a={MultipleResultNodes:"Multiple result nodes specified for process graph.",StartNodeMissing:"No start nodes found for process graph.",ResultNodeMissing:"No result node found for process graph.",MultipleResultNodesCallback:"Multiple result nodes specified for the callback in the process '{process_id}' (node: '{node_id}').",StartNodeMissingCallback:"No start nodes found for the callback in the process '{process_id}' (node: '{node_id}')'.",ResultNodeMissingCallback:"No result node found for the callback in the process '{process_id}' (node: '{node_id}').",ReferencedNodeMissing:"Referenced node '{node_id}' doesn't exist.",NodeIdInvalid:"Invalid node id specified in process graph.",NodeInvalid:"Process graph node '{node_id}' is not a valid object.",ProcessIdMissing:"Process graph node '{node_id}' doesn't contain a process id.",CallbackArgumentInvalid:"Invalid callback argument '{argument}' requested in the process '{process_id}' (node: '{node_id}').",ProcessUnsupported:"Process '{process}' is not supported.",ProcessArgumentUnsupported:"Process '{process}' does not support argument '{argument}'.",ProcessArgumentRequired:"Process '{process}' requires argument '{argument}'.",ProcessArgumentInvalid:"The argument '{argument}' in process '{process}' is invalid: {reason}",VariableValueMissing:"No value specified for process graph variable '{variable_id}'.",VariableDefaultValueTypeInvalid:"The default value specified for the process graph variable '{variable_id}' is not of type '{type}'.",VariableValueTypeInvalid:"The value specified for the process graph variable '{variable_id}' is not of type '{type}'.",VariableIdInvalid:"A specified variable ID is not valid.",VariableTypeInvalid:"The data type specified for the process graph variable '{variable_id}' is invalid. Must be one of: string, boolean, number, array or object."};e.exports=class extends Error{constructor(e,t={}){super(),this.variables=t,"string"==typeof a[e]?(this.code=e,this.message=s.replacePlaceholders(a[e],t)):(this.code=e.replace(/[^\w\d]+/g,""),this.message=e)}toJSON(){return{code:this.code,message:this.message}}}},function(e,t,r){const s=r(1),a=r(0);e.exports=class e{constructor(e,t,r){if("string"!=typeof t||0===t.length)throw new s("NodeIdInvalid");if(!a.isObject(e))throw new s("NodeInvalid",{node_id:t});if("string"!=typeof e.process_id)throw new s("ProcessIdMissing",{node_id:t});this.id=t,this.processGraph=r,this.process_id=e.process_id,this.arguments=a.isObject(e.arguments)?JSON.parse(JSON.stringify(e.arguments)):{},this.description=e.description||null,this.isResultNode=e.result||!1,this.expectsFrom=[],this.passesTo=[],this.result=null,this.resultsAvailableFrom=[]}getProcessGraph(){return this.processGraph}getArgumentNames(){return Object.keys(this.arguments)}hasArgument(e){return e in this.arguments}getArgumentType(t){return e.getType(this.arguments[t])}getRawArgument(e){return this.arguments[e]}getRawArgumentValue(t){var r=this.arguments[t];switch(e.getType(r)){case"result":return r.from_node;case"callback":return r.callback;case"callback-argument":return r.from_argument;default:return r}}getArgument(e,t){return void 0===this.arguments[e]?t:this.processArgument(this.arguments[e])}processArgument(t){switch(e.getType(t)){case"result":return this.processGraph.getNode(t.from_node).getResult();case"callback":return t.callback;case"callback-argument":return this.processGraph.getParameter(t.from_argument);case"variable":return this.processGraph.getVariableValue(t.variable_id);case"array":case"object":for(var r in t)t[r]=this.processArgument(t[r]);return t;default:return t}}static getType(e,t="null"){return"object"==typeof e?null===e?t:Array.isArray(e)?"array":e.hasOwnProperty("callback")?"callback":e.hasOwnProperty("variable_id")?"variable":e.hasOwnProperty("from_node")?"result":e.hasOwnProperty("from_argument")?"callback-argument":"object":typeof e}isStartNode(){return 0===this.expectsFrom.length}addPreviousNode(e){this.expectsFrom.push(e)}getPreviousNodes(){return this.expectsFrom}addNextNode(e){this.passesTo.push(e)}getNextNodes(){return this.passesTo}reset(){this.result=null,this.resultsAvailableFrom=[]}setDescription(e){this.description="string"==typeof e?e:null}setResult(e){this.result=e}getResult(){return this.result}solveDependency(e){return null!==e&&this.expectsFrom.includes(e)&&this.resultsAvailableFrom.push(e),this.expectsFrom.length===this.resultsAvailableFrom.length}}},function(e,t,r){const s=r(4),a=r(1),i=r(2),o=r(5);e.exports=class{constructor(e,t=null){this.schema=e,this.jsonSchema=null===t?new s:t}async validate(e){var t=e.getArgumentNames().filter(e=>void 0===this.schema.parameters[e]);if(t.length>0)throw new a("ProcessArgumentUnsupported",{process:this.schema.id,argument:t[0]});for(let t in this.schema.parameters){let r=this.schema.parameters[t],s=e.getRawArgument(t);if(await this.validateArgument(s,e,t,r))continue;let i=await this.jsonSchema.validateJson(s,r.schema);if(i.length>0)throw new a("ProcessArgumentInvalid",{process:this.schema.id,argument:t,reason:i.join("; ")})}}async validateArgument(e,t,r,n){let c=i.getType(e);if(e instanceof o)return await e.validate(!0),!0;switch(c){case"undefined":if(n.required)throw new a("ProcessArgumentRequired",{process:this.schema.id,argument:r});return!0;case"callback-argument":var l=t.getProcessGraph().getCallbackParameters();return s.isSchemaCompatible(n.schema,l[e.from_argument]);case"variable":var p={type:e.type||"string"};return s.isSchemaCompatible(n.schema,p);case"result":try{var d=t.getProcessGraph(),u=d.getNode(e.from_node).process_id,h=d.getProcess(u);return s.isSchemaCompatible(n.schema,h.schema.returns.schema)}catch(e){}break;case"array":case"object":return!0}return!1}async execute(){throw"execute not implemented yet"}test(){throw"test not implemented yet"}}},function(e,t,r){const s=r(12),a=r(0);e.exports=class e{constructor(){this.typeHints={"band-name":{type:"string",validate:"validateBandName"},"bounding-box":{type:"object",validate:"validateBoundingBox"},callback:{type:"object",validate:"validateCallback"},"collection-id":{type:"string",validate:"validateCollectionId"},"epsg-code":{type:"integer",validate:"validateEpsgCode"},geojson:{type:"object",validate:"validateGeoJson"},"job-id":{type:"string",validate:"validateJobId"},kernel:{type:"array",validate:"validateKernel"},"output-format":{type:"string",validate:"validateOutputFormat"},"output-format-options":{type:"array",validate:"validateOutputFormatOptions"},"process-graph-id":{type:"string",validate:"validateProcessGraphId"},"process-graph-variables":{type:"array",validate:"validateProcessGraphVariables"},"proj-definition":{type:"string",validate:"validateProjDefinition"},"raster-cube":{type:"object",validate:"validateRasterCube"},"temporal-interval":{type:"array",validate:"validateTemporalInterval"},"temporal-intervals":{type:"array",validate:"validateTemporalIntervals"},"vector-cube":{type:"object",validate:"validateVectorCube"}};var e={schemaId:"auto",format:"full",unknownFormats:Object.keys(this.typeHints)};this.ajv=new s(e),this.ajv.addKeyword("parameters",{dependencies:["type","format"],metaSchema:{type:"object",additionalProperties:{type:"object"}},valid:!0,errors:!0}),this.ajv.addKeyword("typehint",{dependencies:["type"],validate:async(e,t,r)=>{if("object"==typeof this.typeHints[e]){var s=this.typeHints[e];if(s.type===r.type||Array.isArray(r.type)&&r.type.includes(s.type))return await this[s.validate](t)}return!1},async:!0,errors:!0}),this.outputFormats=null,this.geoJsonValidator=null}fixSchemaFormat(e){for(var t in e)"format"===t&&"string"==typeof e[t]&&Object.keys(this.typeHints).includes(e[t])&&(e.typehint=e[t]),e[t]&&"object"==typeof e[t]&&(e[t]=this.fixSchemaFormat(e[t]));return e}fixSchema(e){return void 0===(e=JSON.parse(JSON.stringify(e))).$schema&&(e.$schema="http://json-schema.org/draft-07/schema#"),e=this.fixSchemaFormat(e)}async validateJson(e,t){(t=this.fixSchema(t)).$async=!0;try{return await this.ajv.validate(t,e),[]}catch(e){if(Array.isArray(e.errors))return e.errors.map(e=>e.message);throw e}}validateJsonSchema(e){return e=JSON.parse(JSON.stringify(e)),e=this.fixSchema(e),this.ajv.compile(e).errors||[]}setGeoJsonSchema(e){var t=new s;this.geoJsonValidator=t.compile(e)}setOutputFormats(e){for(var t in this.outputFormats={},e)this.outputFormats[t.toUpperCase()]=e[t]}async validateBandName(){return!0}async validateBoundingBox(){return!0}async validateCallback(){return!0}async validateCollectionId(){return!0}async validateEpsgCode(e){if(e>=2e3)return!0;throw new s.ValidationError([{message:"Invalid EPSG code specified."}])}validateGeoJsonSimple(e){if(!a.isObject(e))throw new s.ValidationError([{message:"Invalid GeoJSON specified (not an object)."}]);if("string"!=typeof e.type)throw new s.ValidationError([{message:"Invalid GeoJSON specified (no type property)."}]);switch(e.type){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":if(!Array.isArray(e.coordinates))throw new s.ValidationError([{message:"Invalid GeoJSON specified (Geometry has no valid coordinates member)."}]);return!0;case"GeometryCollection":if(!Array.isArray(e.geometries))throw new s.ValidationError([{message:"Invalid GeoJSON specified (GeometryCollection has no valid geometries member)."}]);return!0;case"Feature":if(null!==e.geometry&&!a.isObject(e.geometry))throw new s.ValidationError([{message:"Invalid GeoJSON specified (Feature has no valid geometry member)."}]);if(null!==e.properties&&!a.isObject(e.properties))throw new s.ValidationError([{message:"Invalid GeoJSON specified (Feature has no valid properties member)."}]);return!0;case"FeatureCollection":if(!Array.isArray(e.features))throw new s.ValidationError([{message:"Invalid GeoJSON specified (FeatureCollection has no valid features member)."}]);return!0;default:throw new s.ValidationError([{message:"Invalid GeoJSON type specified."}])}}async validateGeoJson(e){if(null!==this.geoJsonValidator){if(!this.geoJsonValidator(e))throw new s.ValidationError(this.geoJsonValidator.errors);return!0}return this.validateGeoJsonSimple(e)}async validateJobId(){return!0}async validateKernel(){return!0}async validateOutputFormat(e){if(a.isObject(this.outputFormats)&&!(e.toUpperCase()in this.outputFormats))throw new s.ValidationError([{message:"Output format not supported."}]);return!0}async validateOutputFormatOptions(){return!0}async validateProcessGraphId(){return!0}async validateProcessGraphVariables(){return!0}async validateProjDefinition(e){if(!e.toLowerCase().includes("+proj"))throw new s.ValidationError([{message:"Invalid PROJ string specified (doesn't contain '+proj')."}]);return!0}async validateRasterCube(){return!0}async validateTemporalInterval(){return!0}async validateTemporalIntervals(e){return 0===e.filter(e=>!this.validateTemporalInterval(e)).length}async validateVectorCube(){return!0}static isSchemaCompatible(t,r,s=!1,i=!1){var o=this._convertSchemaToArray(t),n=this._convertSchemaToArray(r);return o.filter(t=>{for(var r in n){var o=n[r];if("string"!=typeof t.type||!s&&"string"!=typeof o.type)return!0;if(t.type===o.type||i&&("array"===t.type||"object"===t.type)||"number"===t.type&&"integer"===o.type||!s&&"integer"===t.type&&"number"===o.type)if("array"===t.type&&a.isObject(t.items)&&a.isObject(o.items)){if(i&&e.isSchemaCompatible(t.items,o,s))return!0;if(e.isSchemaCompatible(t.items,o.items,s))return!0}else{if("object"===t.type&&a.isObject(t.properties)&&a.isObject(o.properties))return!0;if(!(s||"string"==typeof t.format&&"string"==typeof o.format))return!0;if("string"!=typeof t.format)return!0;if(t.format===o.format)return!0}}return!1}).length>0}static _convertSchemaToArray(e){return e.oneOf||e.anyOf?e.oneOf||e.anyOf:Array.isArray(e.type)?e.type.map(t=>Object.assign({},e,{type:t})):[e]}static async getTypeForValue(t,r){var s=new e,a=[];for(var i in t){0===(await s.validateJson(r,t[i])).length&&a.push(String(i))}return a.length>1?a:a[0]}}},function(e,t,r){const s=r(6),a=r(1),i=r(2),o=r(0),n=["string","number","boolean","array","object"];e.exports=class e{constructor(e,t){this.json=e,this.processRegistry=t,this.nodes={},this.startNodes={},this.resultNode=null,this.childrenProcessGraphs=[],this.parentNode=null,this.parentProcessId=null,this.parentParameterName=null,this.variables={},this.parsed=!1,this.validated=!1,this.errors=new s,this.parameters={}}toJSON(){return this.json}createNodeInstance(e,t,r){return new i(e,t,r)}createProcessGraphInstance(t){return new e(t,this.processRegistry)}setParent(e,t){e instanceof i?(this.parentNode=e,this.parentProcessId=e.process_id):(this.parentNode=null,this.parentProcessId=e),this.parentParameterName=t}isValid(){return this.validated&&0===this.errors.count()}addError(e){this.errors.add(e)}parse(){if(!this.parsed){for(let e in this.json)this.nodes[e]=this.createNodeInstance(this.json[e],e,this);var e=e=>this.parentProcessId?new a(e+"Callback",{process_id:this.parentProcessId,node_id:this.parentNode?this.parentNode.id:"N/A"}):new a(e);for(let r in this.nodes){var t=this.nodes[r];if(t.isResultNode){if(null!==this.resultNode)throw e("MultipleResultNodes");this.resultNode=t}this.parseArguments(r,t)}if(!this.findStartNodes())throw e("StartNodeMissing");if(null===this.resultNode)throw e("ResultNodeMissing");this.parsed=!0}}async validate(e=!0){if(this.validated)return null;this.validated=!0;try{this.parse()}catch(t){if(this.addError(t),e)throw t}return await this.validateNodes(this.getStartNodes(),e),this.errors}async execute(e=null){return await this.validate(),this.reset(),this.setParameters(e),await this.executeNodes(this.getStartNodes()),this.getResultNode()}async validateNodes(e,t,r=null){if(0!==e.length){var a=e.map(async e=>{if(e.solveDependency(r)){try{await this.validateNode(e)}catch(e){if(e instanceof s){if(this.errors.merge(e),t)throw e.first()}else if(this.addError(e),t)throw e}await this.validateNodes(e.getNextNodes(),t,e)}});await Promise.all(a)}}async validateNode(e){var t=this.getProcess(e);return await t.validate(e)}async executeNodes(e,t=null){if(0!==e.length){var r=e.map(async e=>{if(e.solveDependency(t)){var r=await this.executeNode(e);e.setResult(r),await this.executeNodes(e.getNextNodes(),e)}});return Promise.all(r)}}async executeNode(e){var t=this.getProcess(e);return await t.execute(e)}parseArguments(e,t,r){for(var s in void 0===r&&(r=t.arguments),r){var a=r[s];switch(i.getType(a)){case"result":this.connectNodes(t,a.from_node);break;case"variable":this.parseVariable(a);break;case"callback":a.callback=this.createProcessGraph(a.callback,t,s);break;case"callback-argument":this.parseCallbackArgument(t,a.from_argument);break;case"array":case"object":this.parseArguments(e,t,a)}}}parseCallbackArgument(e,t){var r=this.getCallbackParameters();if(!o.isObject(r)||!r.hasOwnProperty(t))throw new a("CallbackArgumentInvalid",{argument:t,node_id:e.id,process_id:e.process_id})}createProcessGraph(e,t,r){var s=this.createProcessGraphInstance(e);return s.setParent(t,r),s.parse(),this.childrenProcessGraphs.push(s),s}parseVariable(e){if("string"!=typeof e.variable_id)throw new a("VariableIdInvalid");var t={};if(void 0!==e.type&&!n.includes(e.type))throw new a("VariableTypeInvalid",e);t.type=void 0!==e.type?e.type:"string";var r=i.getType(e.default);if("undefined"!==r){if(r!==t.type)throw new a("VariableDefaultValueTypeInvalid",e);t.value=e.default}}setParameters(e){"object"==typeof e&&null!==e&&(this.parameters=e)}getParameter(e){return this.parameters[e]}setVariableValues(e){for(var t in e)this.setVariable(t,e[t])}setVariableValue(e,t){"object"!=typeof this.variables[e]&&(this.variables[e]={}),this.variables[e].value=t}getVariableValue(e){var t=this.variables[e];if("object"!=typeof t||void 0===t.value)throw new a("VariableValueMissing",{variable_id:e});if(i.getType(t.value)!==t.type)throw new a("VariableValueTypeInvalid",{variable_id:e,type:t.type});return this.variables[e].value}connectNodes(e,t){var r=this.nodes[t];if(void 0===r)throw new a("ReferencedNodeMissing",{node_id:t});e.addPreviousNode(r),r.addNextNode(e)}findStartNodes(){var e=!1;for(var t in this.nodes){var r=this.nodes[t];r.isStartNode()&&(this.startNodes[t]=r,e=!0)}return e}reset(){for(var e in this.nodes)this.nodes[e].reset();this.childrenProcessGraphs.forEach(e=>e.reset())}getResultNode(){return this.resultNode}getStartNodes(){return Object.values(this.startNodes)}getStartNodeIds(){return Object.keys(this.startNodes)}getNode(e){return this.nodes[e]}getNodes(){return this.nodes}getErrors(){return this.errors}getProcess(e){var t=this.processRegistry.get(e.process_id);if(null===t)throw new a("ProcessUnsupported",{process:e.process_id});return t}getParentProcess(){return this.processRegistry.get(this.parentProcessId)}getCallbackParameters(){var e=this.getParentProcess();if(!this.parentParameterName||!e)return{};var t=e.schema.parameters[this.parentParameterName].schema;if(o.isObject(t.parameters))return t.parameters;var r={},s=t.anyOf||t.oneOf||t.allOf;if(Array.isArray(s))for(let e in s){var a=s[e];o.isObject(a.parameters)&&Object.assign(r,a.parameters)}return r}}},function(e,t){e.exports=class{constructor(){this.errors=[]}first(){return this.errors[0]||null}last(){return this.errors[this.errors.length-1]||null}merge(e){this.errors=this.errors.concat(e.getAll())}add(e){this.errors.push(e)}count(){return this.errors.length}toJSON(){return this.errors.map(e=>"function"==typeof e.toJSON?e.toJSON():{code:"InternalError",message:e.message})}getMessage(){var e="";for(var t in this.errors)e+=parseInt(t,10)+1+". "+this.errors[t].message+"\r\n";return e.trim()}getAll(){return this.errors}}},function(e,t,r){const s=r(8),a=r(10),i=r(11),o=r(3),n=r(4),c=r(5),l=r(1),p=r(2),d=r(13),u=r(6),h=r(14),f=r(0);e.exports={MigrateCapabilities:s,MigrateCollections:a,MigrateProcesses:i,BaseProcess:o,JsonSchemaValidator:n,ProcessGraph:c,ProcessGraphError:l,ProcessGraphNode:p,ProcessRegistry:d,ErrorList:u,FeatureList:h,Utils:f}},function(e,t,r){const s=r(0);var a={guessApiVersion:e=>"string"==typeof e.version?e.version:"string"==typeof e.api_version?e.api_version:e.backend_version||e.title||e.description||e.links?"0.4":"0.3",convertCapabilitiesToLatestSpec(e,t=null,r="Unknown"){var a=Object.assign({},e);return null===t&&(t=this.guessApiVersion(a)),0===s.compareVersion(t,"0.3.x")&&void 0!==a.version&&delete a.version,void 0!==a.billing&&(a.billing=this.convertBillingToLatestSpec(a.billing,t)),a.endpoints=this.convertEndpointsToLatestSpec(a.endpoints,t),"string"!=typeof a.api_version&&(a.api_version="0.4.2"),"string"!=typeof a.backend_version&&(a.backend_version="Unknown"),"string"!=typeof a.title&&(a.title=r),"string"!=typeof a.description&&(a.description="No description provided."),a},convertBillingToLatestSpec(e,t){var r=Object.assign({},e);return 0===s.compareVersion(t,"0.3.x")&&Array.isArray(r.plans)&&(r.plans=r.plans.map(e=>("boolean"!=typeof e.paid&&(e.paid=!0,"string"==typeof e.name&&e.name.toLowerCase().includes("free")&&(e.paid=!1)),e))),r},convertEndpointsToLatestSpec(e,t){var r=[];return Array.isArray(e)&&(r=e.slice(0)),s.compareVersion(t,"0.3.x"),r},convertOutputFormatsToLatestSpec(e,t){var r=Object.assign({},e);return 0===s.compareVersion(t,"0.3.x")&&"object"==typeof r.formats&&null!==r.formats?r.formats:r},convertServiceTypesToLatestSpec(e,t){var r=Object.assign({},e);return s.compareVersion(t,"0.3.x"),r},convertUdfRuntimesToLatestSpec(e,t){var r=Object.assign({},e);return s.compareVersion(t,"0.3.x"),r}};e.exports=a},function(e,t,r){var s,a,i;a=[],void 0===(i="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(/\+.*$/,""),a=(r="-",-1===(t=s).indexOf(r)?t.length:t.indexOf(r)),i=s.substring(0,a).split(".");return i.push(s.substring(a+1)),i}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 a(e,a){[e,a].forEach(s);for(var i=t(e),o=t(a),n=0;n<Math.max(i.length-1,o.length-1);n++){var c=parseInt(i[n]||0,10),l=parseInt(o[n]||0,10);if(c>l)return 1;if(l>c)return-1}var p=i[i.length-1],d=o[o.length-1];if(p&&d){var u=p.split(".").map(r),h=d.split(".").map(r);for(n=0;n<Math.max(u.length,h.length);n++){if(void 0===u[n]||"string"==typeof h[n]&&"number"==typeof u[n])return-1;if(void 0===h[n]||"string"==typeof u[n]&&"number"==typeof h[n])return 1;if(u[n]>h[n])return 1;if(h[n]>u[n])return-1}}else if(p||d)return p?-1:1;return 0}var i=[">",">=","=","<","<="];return a.compare=function(e,t,r){switch(function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===i.indexOf(e))throw new TypeError("Invalid operator, expected one of "+i.join("|"))}(r),r){case">":return a(e,t)>0;case">=":return a(e,t)>=0;case"<":return a(e,t)<0;case"<=":return a(e,t)<=0;default:return 0===a(e,t)}},a})?s.apply(t,a):s)||(e.exports=i)},function(e,t,r){const s=r(0);var a={guessCollectionSpecVersion(e){var t="0.4";return void 0===e.id&&void 0!==e.name&&(t="0.3"),t},convertCollectionToLatestSpec(e,t=null){var r=Object.assign({},e);if(!Object.keys(r).length)return r;if(null===t&&(t=this.guessCollectionSpecVersion(r)),0===s.compareVersion(t,"0.3.x")){if(r.id=r.name,delete r.name,r.stac_version="0.6.1",Array.isArray(r.provider)&&(r.providers=r.provider,delete r.provider),"object"!=typeof r.properties&&(r.properties={}),null!==r["eo:bands"]&&"object"==typeof r["eo:bands"]&&!Array.isArray(r["eo:bands"])){var a=[];for(let e in r["eo:bands"]){var i=Object.assign({},r["eo:bands"][e]);i.name=e,void 0!==i.resolution&&void 0===i.gsd&&(i.gsd=i.resolution,delete i.resolution),void 0!==i.wavelength&&void 0===i.center_wavelength&&(i.center_wavelength=i.wavelength,delete i.wavelength),a.push(i)}r["eo:bands"]=a}for(let e in r)e.includes(":")&&(r.properties[e]=r[e],delete r[e])}return r}};e.exports=a},function(e,t,r){const s=r(0);var a={guessProcessSpecVersion(e){var t="0.4";return void 0===e.id&&void 0!==e.name&&(t="0.3"),t},convertProcessToLatestSpec(e,t=null){var r=Object.assign({},e);if(null===t&&(t=this.guessProcessSpecVersion(r)),0===s.compareVersion(t,"0.3.x")){if(r.id=r.name,delete r.name,"object"==typeof r.parameters)for(var a in r.parameters)if(void 0!==r.parameters[a].mime_type){var i=Object.assign({},r.parameters[a]);i.media_type=i.mime_type,delete i.mime_type,r.parameters[a]=i}if("object"==typeof r.returns&&void 0!==r.returns.mime_type&&(r.returns.media_type=r.returns.mime_type,delete r.returns.mime_type),"object"==typeof r.exceptions)for(let e in r.exceptions){var o=r.exceptions[e];void 0===o.message&&(r.exceptions[e]=Object.assign({},o,{message:o.description}))}if("object"==typeof r.examples){var n=[];for(let e in r.examples){var c=r.examples[e],l={title:c.summary||e,description:c.description};c.process_graph&&(l.process_graph=c.process_graph),n.push(l)}r.examples=n}if("object"==typeof r.parameters&&!Array.isArray(r.parameter_order)){var p=Object.keys(r.parameters);p.length>1&&(r.parameter_order=p)}}return r}};e.exports=a},function(t,r){t.exports=e},function(e,t,r){const s=r(3),a=r(0);e.exports=class{constructor(){this.processes={}}addFromResponse(e){for(var t in e.processes)this.add(e.processes[t])}add(e){this.processes[e.id]=new s(e)}count(){return a.size(this.processes)}get(e){if("string"==typeof e){var t=e.toLowerCase();if(void 0!==this.processes[t])return this.processes[t]}return null}getSchema(e){var t=this.get(e);return null!==t?t.schema:null}getProcessSchemas(){return Object.values(this.processes).map(e=>e.schema)}}},function(e,t,r){const s=r(0);var a={features:{"Basic functionality":["get /collections","get /collections/{}","get /processes","get /output_formats"],"Authenticate with HTTP Basic":["get /credentials/basic"],"Authenticate with OpenID Connect":["get /credentials/oidc"],"Batch processing":["get /jobs","post /jobs","get /jobs/{}","delete /jobs/{}","get /jobs/{}/results","post /jobs/{}/results"],"Estimate processing costs":["get /jobs/{}/estimate"],"Preview processing results":["post /result"],"Secondary web services":["get /service_types","get /services","post /services","get /services/{}","delete /services/{}"],"File storage":["get /files/{}","get /files/{}/{}","put /files/{}/{}","delete /files/{}/{}"],"Stored process graphs":["get /process_graphs","post /process_graphs","get /process_graphs/{}","delete /process_graphs/{}"],"Validate process graphs":["post /validation"],"Notifications and monitoring":["get /subscription"],"User defined functions (UDF)":["get /udf_runtimes"]},legacyFeatures:{"post /result":{"post /preview":["0.3.*"]}},getListForVersion(e){var t={};for(var r in this.features)for(var s in t[r]=[],this.features[r]){var a=this.findLegacyEndpoint(e,this.features[r][s]);t[r].push(a)}return t},findLegacyEndpoint(e,t,r=null){if(null!==r&&(t=this.endpointToString(r,t)),"object"==typeof this.legacyFeatures[t]){var a=this.legacyFeatures[t];for(var i in a)for(var o in a[i]){var n=a[i][o];if(0===s.compareVersion(e,n))return i}}return t},getFeatures(){return Object.keys(this.features)},getFeatureCount(){return Object.keys(this.features).length},endpointsToStringList(e){var t=[];for(let r in e)for(let s in e[r].methods)t.push(this.endpointToString(e[r].methods[s],e[r].path));return t},endpointToString:(e,t)=>(e+" "+t.replace(/{[^}]+}/g,"{}")).toLowerCase(),getReport(e,t,r=!0){var s=0,a=r?this.endpointsToStringList(e):e,i=this.getListForVersion(t);return Object.keys(i).forEach(e=>{let t=i[e];switch(t.filter(e=>!a.includes(e)).length){case 0:i[e]=2,s++;break;case t.length:i[e]=0;break;default:i[e]=1}}),{count:s,list:i}}};e.exports=a}])});
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(function(){try{return require("ajv")}catch(e){}}());else if("function"==typeof define&&define.amd)define(["ajv"],t);else{var r="object"==typeof exports?t(function(){try{return require("ajv")}catch(e){}}()):t(e.ajv);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(window,function(e){return function(e){var t={};function r(s){if(t[s])return t[s].exports;var a=t[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,r),a.l=!0,a.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 a in e)r.d(s,a,function(t){return e[t]}.bind(null,a));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=7)}([function(e,t,r){const s=r(9);var a={compareVersion(e,t){try{return s(e,t)}catch(e){return null}},isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),size:e=>"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0,replacePlaceholders(e,t={}){if("string"==typeof e&&this.isObject(t))for(var r in t)e=e.replace("{"+r+"}",t[r]);return e}};e.exports=a},function(e,t,r){const s=r(0),a={MultipleResultNodes:"Multiple result nodes specified for process graph.",StartNodeMissing:"No start nodes found for process graph.",ResultNodeMissing:"No result node found for process graph.",MultipleResultNodesCallback:"Multiple result nodes specified for the callback in the process '{process_id}' (node: '{node_id}').",StartNodeMissingCallback:"No start nodes found for the callback in the process '{process_id}' (node: '{node_id}')'.",ResultNodeMissingCallback:"No result node found for the callback in the process '{process_id}' (node: '{node_id}').",ReferencedNodeMissing:"Referenced node '{node_id}' doesn't exist.",NodeIdInvalid:"Invalid node id specified in process graph.",NodeInvalid:"Process graph node '{node_id}' is not a valid object.",ProcessIdMissing:"Process graph node '{node_id}' doesn't contain a process id.",CallbackArgumentInvalid:"Invalid callback argument '{argument}' requested in the process '{process_id}' (node: '{node_id}').",ProcessUnsupported:"Process '{process}' is not supported.",ProcessArgumentUnsupported:"Process '{process}' does not support argument '{argument}'.",ProcessArgumentRequired:"Process '{process}' requires argument '{argument}'.",ProcessArgumentInvalid:"The argument '{argument}' in process '{process}' is invalid: {reason}",VariableValueMissing:"No value specified for process graph variable '{variable_id}'.",VariableDefaultValueTypeInvalid:"The default value specified for the process graph variable '{variable_id}' is not of type '{type}'.",VariableValueTypeInvalid:"The value specified for the process graph variable '{variable_id}' is not of type '{type}'.",VariableIdInvalid:"A specified variable ID is not valid.",VariableTypeInvalid:"The data type specified for the process graph variable '{variable_id}' is invalid. Must be one of: string, boolean, number, array or object."};e.exports=class extends Error{constructor(e,t={}){super(),this.variables=t,"string"==typeof a[e]?(this.code=e,this.message=s.replacePlaceholders(a[e],t)):(this.code=e.replace(/[^\w\d]+/g,""),this.message=e)}toJSON(){return{code:this.code,message:this.message}}}},function(e,t,r){const s=r(1),a=r(0);e.exports=class e{constructor(e,t,r){if("string"!=typeof t||0===t.length)throw new s("NodeIdInvalid");if(!a.isObject(e))throw new s("NodeInvalid",{node_id:t});if("string"!=typeof e.process_id)throw new s("ProcessIdMissing",{node_id:t});this.id=t,this.processGraph=r,this.process_id=e.process_id,this.arguments=a.isObject(e.arguments)?JSON.parse(JSON.stringify(e.arguments)):{},this.description=e.description||null,this.isResultNode=e.result||!1,this.expectsFrom=[],this.passesTo=[],this.result=null,this.resultsAvailableFrom=[]}getProcessGraph(){return this.processGraph}getArgumentNames(){return Object.keys(this.arguments)}hasArgument(e){return e in this.arguments}getArgumentType(t){return e.getType(this.arguments[t])}getRawArgument(e){return this.arguments[e]}getRawArgumentValue(t){var r=this.arguments[t];switch(e.getType(r)){case"result":return r.from_node;case"callback":return r.callback;case"callback-argument":return r.from_argument;default:return r}}getArgument(e,t){return void 0===this.arguments[e]?t:this.processArgument(this.arguments[e])}processArgument(t){switch(e.getType(t)){case"result":return this.processGraph.getNode(t.from_node).getResult();case"callback":return t.callback;case"callback-argument":return this.processGraph.getParameter(t.from_argument);case"variable":return this.processGraph.getVariableValue(t.variable_id);case"array":case"object":for(var r in t)t[r]=this.processArgument(t[r]);return t;default:return t}}static getType(e,t="null"){return"object"==typeof e?null===e?t:Array.isArray(e)?"array":e.hasOwnProperty("callback")?"callback":e.hasOwnProperty("variable_id")?"variable":e.hasOwnProperty("from_node")?"result":e.hasOwnProperty("from_argument")?"callback-argument":"object":typeof e}isStartNode(){return 0===this.expectsFrom.length}addPreviousNode(e){this.expectsFrom.push(e)}getPreviousNodes(){return this.expectsFrom}addNextNode(e){this.passesTo.push(e)}getNextNodes(){return this.passesTo}reset(){this.result=null,this.resultsAvailableFrom=[]}setDescription(e){this.description="string"==typeof e?e:null}setResult(e){this.result=e}getResult(){return this.result}solveDependency(e){return null!==e&&this.expectsFrom.includes(e)&&this.resultsAvailableFrom.push(e),this.expectsFrom.length===this.resultsAvailableFrom.length}}},function(e,t,r){const s=r(4),a=r(1),i=r(2),o=r(5);e.exports=class{constructor(e,t=null){this.schema=e,this.jsonSchema=null===t?new s:t}async validate(e){var t=e.getArgumentNames().filter(e=>void 0===this.schema.parameters[e]);if(t.length>0)throw new a("ProcessArgumentUnsupported",{process:this.schema.id,argument:t[0]});for(let t in this.schema.parameters){let r=this.schema.parameters[t],s=e.getRawArgument(t);if(await this.validateArgument(s,e,t,r))continue;let i=await this.jsonSchema.validateJson(s,r.schema);if(i.length>0)throw new a("ProcessArgumentInvalid",{process:this.schema.id,argument:t,reason:i.join("; ")})}}async validateArgument(e,t,r,n){let c=i.getType(e);if(e instanceof o)return await e.validate(!0),!0;switch(c){case"undefined":if(n.required)throw new a("ProcessArgumentRequired",{process:this.schema.id,argument:r});return!0;case"callback-argument":var l=t.getProcessGraph().getCallbackParameters();return s.isSchemaCompatible(n.schema,l[e.from_argument]);case"variable":var p={type:e.type||"string"};return s.isSchemaCompatible(n.schema,p);case"result":try{var d=t.getProcessGraph(),u=d.getNode(e.from_node).process_id,h=d.getProcess(u);return s.isSchemaCompatible(n.schema,h.schema.returns.schema)}catch(e){}break;case"array":case"object":return!0}return!1}async execute(){throw"execute not implemented yet"}test(){throw"test not implemented yet"}}},function(e,t,r){var s;try{s=r(12)}catch(e){}const a=r(0);e.exports=class e{constructor(){this.typeHints={"band-name":{type:"string",validate:"validateBandName"},"bounding-box":{type:"object",validate:"validateBoundingBox"},callback:{type:"object",validate:"validateCallback"},"collection-id":{type:"string",validate:"validateCollectionId"},"epsg-code":{type:"integer",validate:"validateEpsgCode"},geojson:{type:"object",validate:"validateGeoJson"},"job-id":{type:"string",validate:"validateJobId"},kernel:{type:"array",validate:"validateKernel"},"output-format":{type:"string",validate:"validateOutputFormat"},"output-format-options":{type:"object",validate:"validateOutputFormatOptions"},"process-graph-id":{type:"string",validate:"validateProcessGraphId"},"process-graph-variables":{type:"object",validate:"validateProcessGraphVariables"},"proj-definition":{type:"string",validate:"validateProjDefinition"},"raster-cube":{type:"object",validate:"validateRasterCube"},"temporal-interval":{type:"array",validate:"validateTemporalInterval"},"temporal-intervals":{type:"array",validate:"validateTemporalIntervals"},"vector-cube":{type:"object",validate:"validateVectorCube"}};var e={schemaId:"auto",format:"full",unknownFormats:Object.keys(this.typeHints)};if(!s)throw"ajv not installed";this.ajv=new s(e),this.ajv.addKeyword("parameters",{dependencies:["type","format"],metaSchema:{type:"object",additionalProperties:{type:"object"}},valid:!0,errors:!0}),this.ajv.addKeyword("typehint",{dependencies:["type"],validate:async(e,t,r)=>{if("object"==typeof this.typeHints[e]){var s=this.typeHints[e];if(s.type===r.type||Array.isArray(r.type)&&r.type.includes(s.type))return await this[s.validate](t)}return!1},async:!0,errors:!0}),this.outputFormats=null,this.geoJsonValidator=null}fixSchemaFormat(e){for(var t in e)"format"===t&&"string"==typeof e[t]&&Object.keys(this.typeHints).includes(e[t])&&(e.typehint=e[t]),e[t]&&"object"==typeof e[t]&&(e[t]=this.fixSchemaFormat(e[t]));return e}fixSchema(e){return void 0===(e=JSON.parse(JSON.stringify(e))).$schema&&(e.$schema="http://json-schema.org/draft-07/schema#"),e=this.fixSchemaFormat(e)}async validateJson(e,t){(t=this.fixSchema(t)).$async=!0;try{return await this.ajv.validate(t,e),[]}catch(e){if(Array.isArray(e.errors))return e.errors.map(e=>e.message);throw e}}validateJsonSchema(e){return e=JSON.parse(JSON.stringify(e)),e=this.fixSchema(e),this.ajv.compile(e).errors||[]}setGeoJsonSchema(e){var t=new s;this.geoJsonValidator=t.compile(e)}setOutputFormats(e){for(var t in this.outputFormats={},e)this.outputFormats[t.toUpperCase()]=e[t]}async validateBandName(){return!0}async validateBoundingBox(){return!0}async validateCallback(){return!0}async validateCollectionId(){return!0}async validateEpsgCode(e){if(e>=2e3)return!0;throw new s.ValidationError([{message:"Invalid EPSG code specified."}])}validateGeoJsonSimple(e){if(!a.isObject(e))throw new s.ValidationError([{message:"Invalid GeoJSON specified (not an object)."}]);if("string"!=typeof e.type)throw new s.ValidationError([{message:"Invalid GeoJSON specified (no type property)."}]);switch(e.type){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":if(!Array.isArray(e.coordinates))throw new s.ValidationError([{message:"Invalid GeoJSON specified (Geometry has no valid coordinates member)."}]);return!0;case"GeometryCollection":if(!Array.isArray(e.geometries))throw new s.ValidationError([{message:"Invalid GeoJSON specified (GeometryCollection has no valid geometries member)."}]);return!0;case"Feature":if(null!==e.geometry&&!a.isObject(e.geometry))throw new s.ValidationError([{message:"Invalid GeoJSON specified (Feature has no valid geometry member)."}]);if(null!==e.properties&&!a.isObject(e.properties))throw new s.ValidationError([{message:"Invalid GeoJSON specified (Feature has no valid properties member)."}]);return!0;case"FeatureCollection":if(!Array.isArray(e.features))throw new s.ValidationError([{message:"Invalid GeoJSON specified (FeatureCollection has no valid features member)."}]);return!0;default:throw new s.ValidationError([{message:"Invalid GeoJSON type specified."}])}}async validateGeoJson(e){if(null!==this.geoJsonValidator){if(!this.geoJsonValidator(e))throw new s.ValidationError(this.geoJsonValidator.errors);return!0}return this.validateGeoJsonSimple(e)}async validateJobId(){return!0}async validateKernel(){return!0}async validateOutputFormat(e){if(a.isObject(this.outputFormats)&&!(e.toUpperCase()in this.outputFormats))throw new s.ValidationError([{message:"Output format not supported."}]);return!0}async validateOutputFormatOptions(){return!0}async validateProcessGraphId(){return!0}async validateProcessGraphVariables(){return!0}async validateProjDefinition(e){if(!e.toLowerCase().includes("+proj"))throw new s.ValidationError([{message:"Invalid PROJ string specified (doesn't contain '+proj')."}]);return!0}async validateRasterCube(){return!0}async validateTemporalInterval(){return!0}async validateTemporalIntervals(e){return 0===e.filter(e=>!this.validateTemporalInterval(e)).length}async validateVectorCube(){return!0}static isSchemaCompatible(t,r,s=!1,i=!1){var o=this._convertSchemaToArray(t),n=this._convertSchemaToArray(r);return o.filter(t=>{for(var r in n){var o=n[r];if("string"!=typeof t.type||!s&&"string"!=typeof o.type)return!0;if(t.type===o.type||i&&("array"===t.type||"object"===t.type)||"number"===t.type&&"integer"===o.type||!s&&"integer"===t.type&&"number"===o.type)if("array"===t.type&&a.isObject(t.items)&&a.isObject(o.items)){if(i&&e.isSchemaCompatible(t.items,o,s))return!0;if(e.isSchemaCompatible(t.items,o.items,s))return!0}else{if("object"===t.type&&a.isObject(t.properties)&&a.isObject(o.properties))return!0;if(!(s||"string"==typeof t.format&&"string"==typeof o.format))return!0;if("string"!=typeof t.format)return!0;if(t.format===o.format)return!0}}return!1}).length>0}static _convertSchemaToArray(e){return e.oneOf||e.anyOf?e.oneOf||e.anyOf:Array.isArray(e.type)?e.type.map(t=>Object.assign({},e,{type:t})):[e]}static async getTypeForValue(t,r){var s=new e,a=[];for(var i in t){0===(await s.validateJson(r,t[i])).length&&a.push(String(i))}return a.length>1?a:a[0]}}},function(e,t,r){const s=r(6),a=r(1),i=r(2),o=r(0),n=["string","number","boolean","array","object"];e.exports=class e{constructor(e,t){this.json=e,this.processRegistry=t,this.nodes={},this.startNodes={},this.resultNode=null,this.childrenProcessGraphs=[],this.parentNode=null,this.parentProcessId=null,this.parentParameterName=null,this.variables={},this.parsed=!1,this.validated=!1,this.errors=new s,this.parameters={}}toJSON(){return this.json}createNodeInstance(e,t,r){return new i(e,t,r)}createProcessGraphInstance(t){return new e(t,this.processRegistry)}setParent(e,t){e instanceof i?(this.parentNode=e,this.parentProcessId=e.process_id):(this.parentNode=null,this.parentProcessId=e),this.parentParameterName=t}isValid(){return this.validated&&0===this.errors.count()}addError(e){this.errors.add(e)}parse(){if(!this.parsed){for(let e in this.json)this.nodes[e]=this.createNodeInstance(this.json[e],e,this);var e=e=>this.parentProcessId?new a(e+"Callback",{process_id:this.parentProcessId,node_id:this.parentNode?this.parentNode.id:"N/A"}):new a(e);for(let r in this.nodes){var t=this.nodes[r];if(t.isResultNode){if(null!==this.resultNode)throw e("MultipleResultNodes");this.resultNode=t}this.parseArguments(r,t)}if(!this.findStartNodes())throw e("StartNodeMissing");if(null===this.resultNode)throw e("ResultNodeMissing");this.parsed=!0}}async validate(e=!0){if(this.validated)return null;this.validated=!0;try{this.parse()}catch(t){if(this.addError(t),e)throw t}return await this.validateNodes(this.getStartNodes(),e),this.errors}async execute(e=null){return await this.validate(),this.reset(),this.setParameters(e),await this.executeNodes(this.getStartNodes()),this.getResultNode()}async validateNodes(e,t,r=null){if(0!==e.length){var a=e.map(async e=>{if(e.solveDependency(r)){try{await this.validateNode(e)}catch(e){if(e instanceof s){if(this.errors.merge(e),t)throw e.first()}else if(this.addError(e),t)throw e}await this.validateNodes(e.getNextNodes(),t,e)}});await Promise.all(a)}}async validateNode(e){var t=this.getProcess(e);return await t.validate(e)}async executeNodes(e,t=null){if(0!==e.length){var r=e.map(async e=>{if(e.solveDependency(t)){var r=await this.executeNode(e);e.setResult(r),await this.executeNodes(e.getNextNodes(),e)}});return Promise.all(r)}}async executeNode(e){var t=this.getProcess(e);return await t.execute(e)}parseArguments(e,t,r){for(var s in void 0===r&&(r=t.arguments),r){var a=r[s];switch(i.getType(a)){case"result":this.connectNodes(t,a.from_node);break;case"variable":this.parseVariable(a);break;case"callback":a.callback=this.createProcessGraph(a.callback,t,s);break;case"callback-argument":this.parseCallbackArgument(t,a.from_argument);break;case"array":case"object":this.parseArguments(e,t,a)}}}parseCallbackArgument(e,t){var r=this.getCallbackParameters();if(!o.isObject(r)||!r.hasOwnProperty(t))throw new a("CallbackArgumentInvalid",{argument:t,node_id:e.id,process_id:e.process_id})}createProcessGraph(e,t,r){var s=this.createProcessGraphInstance(e);return s.setParent(t,r),s.parse(),this.childrenProcessGraphs.push(s),s}parseVariable(e){if("string"!=typeof e.variable_id)throw new a("VariableIdInvalid");var t={};if(void 0!==e.type&&!n.includes(e.type))throw new a("VariableTypeInvalid",e);t.type=void 0!==e.type?e.type:"string";var r=i.getType(e.default);if("undefined"!==r){if(r!==t.type)throw new a("VariableDefaultValueTypeInvalid",e);t.value=e.default}}setParameters(e){"object"==typeof e&&null!==e&&(this.parameters=e)}getParameter(e){return this.parameters[e]}setVariableValues(e){for(var t in e)this.setVariable(t,e[t])}setVariableValue(e,t){"object"!=typeof this.variables[e]&&(this.variables[e]={}),this.variables[e].value=t}getVariableValue(e){var t=this.variables[e];if("object"!=typeof t||void 0===t.value)throw new a("VariableValueMissing",{variable_id:e});if(i.getType(t.value)!==t.type)throw new a("VariableValueTypeInvalid",{variable_id:e,type:t.type});return this.variables[e].value}connectNodes(e,t){var r=this.nodes[t];if(void 0===r)throw new a("ReferencedNodeMissing",{node_id:t});e.addPreviousNode(r),r.addNextNode(e)}findStartNodes(){var e=!1;for(var t in this.nodes){var r=this.nodes[t];r.isStartNode()&&(this.startNodes[t]=r,e=!0)}return e}reset(){for(var e in this.nodes)this.nodes[e].reset();this.childrenProcessGraphs.forEach(e=>e.reset())}getResultNode(){return this.resultNode}getStartNodes(){return Object.values(this.startNodes)}getStartNodeIds(){return Object.keys(this.startNodes)}getNode(e){return this.nodes[e]}getNodeCount(){return o.size(this.nodes)}getNodes(){return this.nodes}getErrors(){return this.errors}getProcess(e){var t=this.processRegistry.get(e.process_id);if(null===t)throw new a("ProcessUnsupported",{process:e.process_id});return t}getParentProcess(){return this.processRegistry.get(this.parentProcessId)}getCallbackParameters(){var e=this.getParentProcess();if(!this.parentParameterName||!e)return{};var t=e.schema.parameters[this.parentParameterName].schema;if(o.isObject(t.parameters))return t.parameters;var r={},s=t.anyOf||t.oneOf||t.allOf;if(Array.isArray(s))for(let e in s){var a=s[e];o.isObject(a.parameters)&&Object.assign(r,a.parameters)}return r}}},function(e,t){e.exports=class{constructor(){this.errors=[]}first(){return this.errors[0]||null}last(){return this.errors[this.errors.length-1]||null}merge(e){this.errors=this.errors.concat(e.getAll())}add(e){this.errors.push(e)}count(){return this.errors.length}toJSON(){return this.errors.map(e=>"function"==typeof e.toJSON?e.toJSON():{code:"InternalError",message:e.message})}getMessage(){var e="";for(var t in this.errors)e+=parseInt(t,10)+1+". "+this.errors[t].message+"\r\n";return e.trim()}getAll(){return this.errors}}},function(e,t,r){const s=r(8),a=r(10),i=r(11),o=r(3),n=r(4),c=r(5),l=r(1),p=r(2),d=r(13),u=r(6),h=r(14),f=r(0);e.exports={MigrateCapabilities:s,MigrateCollections:a,MigrateProcesses:i,BaseProcess:o,JsonSchemaValidator:n,ProcessGraph:c,ProcessGraphError:l,ProcessGraphNode:p,ProcessRegistry:d,ErrorList:u,FeatureList:h,Utils:f}},function(e,t,r){const s=r(0);var a={guessApiVersion:e=>"string"==typeof e.api_version?e.api_version:"string"==typeof e.version?e.version:Array.isArray(e.endpoints)&&e.endpoints.filter(e=>"/output_formats"===e.path).length>0?"0.4":e.backend_version||e.title||e.description||e.links?"1.0":"0.3",convertCapabilitiesToLatestSpec(e,t=null,r=!0,a="Unknown",i="Unknown"){var o=Object.assign({},e);return null===t&&(t=this.guessApiVersion(o)),0===s.compareVersion(t,"0.3.x")&&void 0!==o.version&&delete o.version,s.isObject(o.billing)?o.billing=this.convertBillingToLatestSpec(o.billing,t):delete o.billing,o.endpoints=this.convertEndpointsToLatestSpec(o.endpoints,t),(r||"string"!=typeof o.api_version)&&(o.api_version="1.0.0"),"string"!=typeof o.backend_version&&(o.backend_version=i),"string"!=typeof o.title&&(o.title=a),"string"!=typeof o.description&&(o.description=""),Array.isArray(o.links)||(o.links=[]),o},convertBillingToLatestSpec(e,t){var r=Object.assign({},e);return 0===s.compareVersion(t,"0.3.x")&&Array.isArray(r.plans)&&(r.plans=r.plans.map(e=>("boolean"!=typeof e.paid&&(e.paid=!0,"string"==typeof e.name&&e.name.toLowerCase().includes("free")&&(e.paid=!1)),e))),r},convertEndpointsToLatestSpec(e,t){var r=[];return Array.isArray(e)&&(r=e.slice(0)),s.compareVersion(t,"0.3.x"),r},convertOutputFormatsToLatestSpec(e,t){return this.convertFileFormatsToLatestSpec(e,t)},convertFileFormatsToLatestSpec(e,t){var r=Object.assign({},e);return 0===s.compareVersion(t,"0.3.x")&&s.isObject(r.formats)&&(r=r.formats),s.compareVersion(t,"0.4.x")<=0&&s.isObject(r)&&(r={output:r}),s.isObject(r.input)||(r.input={}),s.isObject(r.output)||(r.output={}),r},convertServiceTypesToLatestSpec(e,t){var r=Object.assign({},e);return s.compareVersion(t,"0.4.x"),r},convertUdfRuntimesToLatestSpec(e,t){var r=Object.assign({},e);return s.compareVersion(t,"0.4.x"),r}};e.exports=a},function(e,t,r){var s,a,i;a=[],void 0===(i="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(/\+.*$/,""),a=(r="-",-1===(t=s).indexOf(r)?t.length:t.indexOf(r)),i=s.substring(0,a).split(".");return i.push(s.substring(a+1)),i}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 a(e,a){[e,a].forEach(s);for(var i=t(e),o=t(a),n=0;n<Math.max(i.length-1,o.length-1);n++){var c=parseInt(i[n]||0,10),l=parseInt(o[n]||0,10);if(c>l)return 1;if(l>c)return-1}var p=i[i.length-1],d=o[o.length-1];if(p&&d){var u=p.split(".").map(r),h=d.split(".").map(r);for(n=0;n<Math.max(u.length,h.length);n++){if(void 0===u[n]||"string"==typeof h[n]&&"number"==typeof u[n])return-1;if(void 0===h[n]||"string"==typeof u[n]&&"number"==typeof h[n])return 1;if(u[n]>h[n])return 1;if(h[n]>u[n])return-1}}else if(p||d)return p?-1:1;return 0}var i=[">",">=","=","<","<="];return a.compare=function(e,t,r){switch(function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===i.indexOf(e))throw new TypeError("Invalid operator, expected one of "+i.join("|"))}(r),r){case">":return a(e,t)>0;case">=":return a(e,t)>=0;case"<":return a(e,t)<0;case"<=":return a(e,t)<=0;default:return 0===a(e,t)}},a})?s.apply(t,a):s)||(e.exports=i)},function(e,t,r){const s=r(0);var a={convertCollectionToLatestSpec(e,t){if(!t||"string"!=typeof t)throw new Error("No version specified");if(s.compareVersion(t,"0.5.x")>=0)throw"Migrating collections from API version 0.4.0 is not supported yet";var r=Object.assign({},e);if(!Object.keys(r).length)return r;if(0===s.compareVersion(t,"0.3.x")){if(r.id=r.name,delete r.name,r.stac_version="0.6.1",Array.isArray(r.provider)&&(r.providers=r.provider,delete r.provider),"object"!=typeof r.properties&&(r.properties={}),null!==r["eo:bands"]&&"object"==typeof r["eo:bands"]&&!Array.isArray(r["eo:bands"])){var a=[];for(let e in r["eo:bands"]){var i=Object.assign({},r["eo:bands"][e]);i.name=e,void 0!==i.resolution&&void 0===i.gsd&&(i.gsd=i.resolution,delete i.resolution),void 0!==i.wavelength&&void 0===i.center_wavelength&&(i.center_wavelength=i.wavelength,delete i.wavelength),a.push(i)}r["eo:bands"]=a}for(let e in r)e.includes(":")&&(r.properties[e]=r[e],delete r[e])}return r}};e.exports=a},function(e,t,r){const s=r(0);var a={convertProcessToLatestSpec(e,t){if(!t||"string"!=typeof t)throw new Error("No version specified");var r=Object.assign({},e);let a=0===s.compareVersion(t,"0.3.x");if(a&&(r.id=r.name,delete r.name),"string"!=typeof r.id||0===r.id.length)return{};if("string"!=typeof r.description&&(r.description=""),s.isObject(r.parameters))for(var o in r.parameters)r.parameters[o]=i(r.parameters[o],t);else r.parameters={};if(r.returns=i(r.returns,t),a){if(s.isObject(r.exceptions))for(let e in r.exceptions){var n=r.exceptions[e];void 0===n.message&&(r.exceptions[e]=Object.assign({},n,{message:n.description}))}if(s.isObject(r.examples)){var c=[];for(let e in r.examples){var l=r.examples[e],p={title:l.summary||e,description:l.description};l.process_graph&&(p.process_graph=l.process_graph),c.push(p)}r.examples=c}if("object"==typeof r.parameters&&!Array.isArray(r.parameter_order)){var d=Object.keys(r.parameters);d.length>1&&(r.parameter_order=d)}}return r}};function i(e,t){if(!s.isObject(e))return{description:"",schema:{}};var r=Object.assign({},e);if(0===s.compareVersion(t,"0.3.x")&&void 0!==r.mime_type&&(r.media_type=r.mime_type,delete r.mime_type),"string"!=typeof r.description&&(r.description=""),"object"==typeof r.schema&&r.schema||(r.schema={}),s.compareVersion(t,"0.4.x")<=0){for(var a in{anyOf:null,oneOf:null})if(Array.isArray(r.schema[a])){void 0!==r.schema.default&&(r.default=r.schema.default),r.schema=r.schema[a];break}var i=s.compareVersion(t,"0.4.x")<=0&&void 0!==r.media_type,n=Array.isArray(r.schema)?r.schema:[r.schema];for(var c in n)void 0!==n[c].default&&(r.default=n[c].default,delete n[c].default),i&&(n[c].contentMediaType=r.media_type),o(n[c]);i&&delete r.media_type}return r}function o(e){for(var t in e)"format"===t?(e.subtype=e.format,["date-time","time","date","uri"].includes(e.format)||delete e.format):e[t]&&"object"==typeof e[t]&&o(e[t])}e.exports=a},function(t,r){if(void 0===e){var s=new Error("Cannot find module 'ajv'");throw s.code="MODULE_NOT_FOUND",s}t.exports=e},function(e,t,r){const s=r(3),a=r(0);e.exports=class{constructor(){this.processes={}}addFromResponse(e){for(var t in e.processes)this.add(e.processes[t])}add(e){this.processes[e.id]=new s(e)}count(){return a.size(this.processes)}get(e){if("string"==typeof e){var t=e.toLowerCase();if(void 0!==this.processes[t])return this.processes[t]}return null}getSchema(e){var t=this.get(e);return null!==t?t.schema:null}getProcessSchemas(){return Object.values(this.processes).map(e=>e.schema)}}},function(e,t,r){const s=r(0);var a={features:{"Basic functionality":["get /collections","get /collections/{}","get /processes","get /file_formats"],"Authenticate with HTTP Basic":["get /credentials/basic"],"Authenticate with OpenID Connect":["get /credentials/oidc"],"Batch processing":["get /jobs","post /jobs","get /jobs/{}","delete /jobs/{}","get /jobs/{}/logs","get /jobs/{}/results","post /jobs/{}/results"],"Estimate processing costs":["get /jobs/{}/estimate"],"Preview processing results":["post /result"],"Secondary web services":["get /service_types","get /services","post /services","get /services/{}","delete /services/{}","get /services/{}/logs"],"File storage":["get /files/{}","get /files/{}/{}","put /files/{}/{}","delete /files/{}/{}"],"Stored process graphs":["get /process_graphs","post /process_graphs","get /process_graphs/{}","delete /process_graphs/{}"],"Validate process graphs":["post /validation"],"Notifications and monitoring":["get /subscription"],"User defined functions (UDF)":["get /udf_runtimes"]},legacyFeatures:{"post /result":{"post /preview":["0.3.*"]},"get /file_formats":{"get /output_formats":["0.3.*","0.4.*"]}},getListForVersion(e){var t={};for(var r in this.features)for(var s in t[r]=[],this.features[r]){var a=this.findLegacyEndpoint(e,this.features[r][s]);t[r].push(a)}return t},findLegacyEndpoint(e,t,r=null){if(null!==r&&(t=this.endpointToString(r,t)),"object"==typeof this.legacyFeatures[t]){var a=this.legacyFeatures[t];for(var i in a)for(var o in a[i]){var n=a[i][o];if(0===s.compareVersion(e,n))return i}}return t},getFeatures(){return Object.keys(this.features)},getFeatureCount(){return Object.keys(this.features).length},endpointsToStringList(e){var t=[];for(let r in e)for(let s in e[r].methods)t.push(this.endpointToString(e[r].methods[s],e[r].path));return t},endpointToString:(e,t)=>(e+" "+t.replace(/{[^}]+}/g,"{}")).toLowerCase(),getReport(e,t,r=!0){var s=0,a=r?this.endpointsToStringList(e):e,i=this.getListForVersion(t);return Object.keys(i).forEach(e=>{let t=i[e];switch(t.filter(e=>!a.includes(e)).length){case 0:i[e]=2,s++;break;case t.length:i[e]=0;break;default:i[e]=1}}),{count:s,list:i}}};e.exports=a}])});
{
"name": "@openeo/js-commons",
"version": "0.4.7",
"version": "0.5.0-alpha.1",
"author": "openEO Consortium",

@@ -5,0 +5,0 @@ "contributors": [

@@ -6,3 +6,3 @@ # openeo-js-commons

This library's version is **0.4.5** and supports **openEO API version 0.4.x**. Legacy versions are available as releases.
This library's version is **0.5.0-alpha.1** and supports **openEO API version 1.0.x**. Legacy versions are available as releases.

@@ -16,3 +16,3 @@ ## Features

- Service Types
- Feature detection
- Back-end feature detection
- Process graph handling:

@@ -42,2 +42,2 @@ - Parsing a process graph

More information can be found in the [**JS commons documentation**](https://open-eo.github.io/openeo-js-commons/0.4.5/).
More information can be found in the [**JS commons documentation**](https://open-eo.github.io/openeo-js-commons/0.5.0-alpha.1/).

@@ -11,11 +11,11 @@ const Utils = require('./utils.js');

'get /processes',
'get /output_formats'
'get /file_formats'
],
'Authenticate with HTTP Basic': [ // TODO: Remove later because this auth method should not be used
'get /credentials/basic',
// 'get /me' // not necessarily needed (just outputs metadata)
// 'get /me' // not necessarily needed (just outputs metadata)
],
'Authenticate with OpenID Connect': [ // TODO: Remove later because the user doesn't care HOW the auth works
'get /credentials/oidc',
// 'get /me' // not necessarily needed (just outputs metadata)
// 'get /me' // not necessarily needed (just outputs metadata)
],

@@ -26,7 +26,8 @@ 'Batch processing': [

'get /jobs/{}',
// 'patch /jobs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
// 'patch /jobs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
'delete /jobs/{}',
'get /jobs/{}/logs',
'get /jobs/{}/results',
'post /jobs/{}/results',
// 'delete /jobs/{}/results' // not necessarily needed (can be deleted by deleting the entire job)
// 'delete /jobs/{}/results' // not necessarily needed (can be deleted by deleting the entire job)
],

@@ -44,4 +45,5 @@ 'Estimate processing costs': [

'get /services/{}',
// 'patch /services/{}', // not necessarily needed (can be achieved by deleting and re-creating)
// 'patch /services/{}', // not necessarily needed (can be achieved by deleting and re-creating)
'delete /services/{}',
'get /services/{}/logs'
],

@@ -58,3 +60,3 @@ 'File storage': [

'get /process_graphs/{}',
// 'patch /process_graphs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
// 'patch /process_graphs/{}', // not necessarily needed (can be achieved by deleting and re-creating)
'delete /process_graphs/{}'

@@ -76,2 +78,5 @@ ],

'post /preview': ["0.3.*"]
},
'get /file_formats': {
'get /output_formats': ["0.3.*", "0.4.*"]
}

@@ -78,0 +83,0 @@ },

@@ -5,20 +5,23 @@ const Utils = require('../utils.js');

guessApiVersion(capabilties) {
if (typeof capabilties.version === 'string') {
return capabilties.version;
guessApiVersion(capabilities) {
if (typeof capabilities.api_version === 'string') {
return capabilities.api_version;
}
else if (typeof capabilties.api_version === 'string') {
return capabilties.api_version;
else if (typeof capabilities.version === 'string') {
return capabilities.version;
}
else if (capabilties.backend_version || capabilties.title || capabilties.description || capabilties.links) {
// Now we are really guessing
else if (Array.isArray(capabilities.endpoints) && capabilities.endpoints.filter(e => e.path === '/output_formats').length > 0) {
return "0.4";
}
else {
// This is a wild guess
else if (!capabilities.backend_version && !capabilities.title && !capabilities.description && !capabilities.links) {
return "0.3";
}
else { // Latest version
return "1.0";
}
},
// Always returns a copy of the input object
convertCapabilitiesToLatestSpec(originalCapabilities, version = null, title = "Unknown") {
convertCapabilitiesToLatestSpec(originalCapabilities, version = null, updateVersionNumber = true, title = "Unknown", backend_version = "Unknown") {
var capabilities = Object.assign({}, originalCapabilities);

@@ -37,5 +40,9 @@ if (version === null) {

// Convert billing plans
if (typeof capabilities.billing !== 'undefined') {
if (Utils.isObject(capabilities.billing)) {
capabilities.billing = this.convertBillingToLatestSpec(capabilities.billing, version);
}
else {
delete capabilities.billing;
}
// Convert endpoints

@@ -45,7 +52,7 @@ capabilities.endpoints = this.convertEndpointsToLatestSpec(capabilities.endpoints, version);

// Add missing fields with somewhat useful data
if (typeof capabilities.api_version !== 'string') {
capabilities.api_version = "0.4.2";
if (updateVersionNumber || typeof capabilities.api_version !== 'string') {
capabilities.api_version = "1.0.0";
}
if (typeof capabilities.backend_version !== 'string') {
capabilities.backend_version = "Unknown";
capabilities.backend_version = backend_version;
}

@@ -56,4 +63,7 @@ if (typeof capabilities.title !== 'string') {

if (typeof capabilities.description !== 'string') {
capabilities.description = "No description provided.";
capabilities.description = "";
}
if (!Array.isArray(capabilities.links)) {
capabilities.links = [];
}

@@ -98,11 +108,28 @@ return capabilities;

// Alias for convertFileFormatsToLatestSpec
convertOutputFormatsToLatestSpec(originalFormats, version) {
return this.convertFileFormatsToLatestSpec(originalFormats, version);
},
// Always returns a copy of the input object
convertOutputFormatsToLatestSpec(originalFormats, version) {
convertFileFormatsToLatestSpec(originalFormats, version) {
var formats = Object.assign({}, originalFormats);
// convert v0.3 output formats to v0.4 format
if (Utils.compareVersion(version, "0.3.x") === 0) {
if (typeof formats.formats === 'object' && formats.formats !== null) {
return formats.formats;
}
if (Utils.compareVersion(version, "0.3.x") === 0 && Utils.isObject(formats.formats)) {
formats = formats.formats;
}
if (Utils.compareVersion(version, "0.4.x") <= 0 && Utils.isObject(formats)) {
formats = {
output: formats
};
}
if (!Utils.isObject(formats.input)) {
formats.input = {};
}
if (!Utils.isObject(formats.output)) {
formats.output = {};
}
return formats;

@@ -114,5 +141,5 @@ },

var types = Object.assign({}, originalTypes);
// convert v0.3 service types to v0.4 format
if (Utils.compareVersion(version, "0.3.x") === 0) {
// Nothing to do as nothing has changed.
// Nothing to do as nothing has changed in 0.3 and 0.4.
if (Utils.compareVersion(version, "0.4.x") > 0) {
// Add future changes here.
}

@@ -125,4 +152,5 @@ return types;

var runtimes = Object.assign({}, originalRuntimes);
if (Utils.compareVersion(version, "0.3.x") === 0) {
// Nothing to do, was not supported in 0.3.
// Nothing to do, was not supported in 0.3 and nothing changed in 0.4.
if (Utils.compareVersion(version, "0.4.x") > 0) {
// Add future changes here.
}

@@ -129,0 +157,0 @@ return runtimes;

@@ -5,13 +5,10 @@ const Utils = require('../utils.js');

guessCollectionSpecVersion(c) {
var version = "0.4";
// Try to guess a version
if (typeof c.id === 'undefined' && typeof c.name !== 'undefined') { // No id defined, probably v0.3
version = "0.3";
// Always returns a copy of the input collection object
convertCollectionToLatestSpec(originalCollection, version) {
if (!version || typeof version !== 'string') {
throw new Error("No version specified");
}
return version;
},
// Always returns a copy of the input collection object
convertCollectionToLatestSpec(originalCollection, version = null) {
if (Utils.compareVersion(version, "0.5.x") >= 0) {
throw "Migrating collections from API version 0.4.0 is not supported yet";
}
var collection = Object.assign({}, originalCollection);

@@ -21,5 +18,2 @@ if (!Object.keys(collection).length) {

}
if (version === null) {
version = this.guessCollectionSpecVersion(collection);
}
// convert v0.3 processes to v0.4 format

@@ -26,0 +20,0 @@ if (Utils.compareVersion(version, "0.3.x") === 0) {

@@ -5,40 +5,44 @@ const Utils = require('../utils.js');

guessProcessSpecVersion(p) {
var version = "0.4";
// Try to guess a version
if (typeof p.id === 'undefined' && typeof p.name !== 'undefined') { // No id defined, probably v0.3
version = "0.3";
// Always returns a copy of the input process object
convertProcessToLatestSpec(originalProcess, version) {
if (!version || typeof version !== 'string') {
throw new Error("No version specified");
}
return version;
},
// Always returns a copy of the input process object
convertProcessToLatestSpec(originalProcess, version = null) {
// Make sure we don't alter the original object
var process = Object.assign({}, originalProcess);
if (version === null) {
version = this.guessProcessSpecVersion(process);
}
// convert v0.3 processes to v0.4 format
if (Utils.compareVersion(version, "0.3.x") === 0) {
// name => id
let isVersion03 = Utils.compareVersion(version, "0.3.x") === 0;
// name => id
if (isVersion03) {
process.id = process.name;
delete process.name;
}
// mime_type => media_type
if (typeof process.parameters === 'object') {
for(var key in process.parameters) {
if (typeof process.parameters[key].mime_type !== 'undefined') {
var param = Object.assign({}, process.parameters[key]);
param.media_type = param.mime_type;
delete param.mime_type;
process.parameters[key] = param;
}
}
// If process has no id => seems to be an invalid process, abort
if (typeof process.id !== 'string' || process.id.length === 0) {
return {};
}
// Set required field description if not a string
if (typeof process.description !== 'string') {
process.description = "";
}
// Parameters
if (Utils.isObject(process.parameters)) {
for(var key in process.parameters) {
process.parameters[key] = upgradeParamAndReturn(process.parameters[key], version);
}
if (typeof process.returns === 'object' && typeof process.returns.mime_type !== 'undefined') {
process.returns.media_type = process.returns.mime_type;
delete process.returns.mime_type;
}
}
else {
process.parameters = {};
}
// Return value
process.returns = upgradeParamAndReturn(process.returns, version);
if (isVersion03) {
// exception object
if (typeof process.exceptions === 'object') {
if (Utils.isObject(process.exceptions)) {
for(let key in process.exceptions) {

@@ -54,3 +58,3 @@ var e = process.exceptions[key];

// examples object
if (typeof process.examples === 'object') {
if (Utils.isObject(process.examples)) {
var examples = [];

@@ -72,3 +76,3 @@ for(let key in process.examples) {

// Fill parameter order
if (typeof process.parameters === 'object' && !Array.isArray(process.parameter_order)) {
if (typeof process.parameters === 'object' && !Array.isArray(process.parameter_order)) {
var parameter_order = Object.keys(process.parameters);

@@ -78,4 +82,5 @@ if (parameter_order.length > 1) {

}
}
}
}
return process;

@@ -85,3 +90,77 @@ }

};
function upgradeParamAndReturn(obj, version) {
// Not an object => return minimum required fields
if (!Utils.isObject(obj)) {
return {
description: "",
schema: {}
};
}
var param = Object.assign({}, obj);
// v0.3 => v0.4: mime_type => media_type
if (Utils.compareVersion(version, "0.3.x") === 0 && typeof param.mime_type !== 'undefined') {
param.media_type = param.mime_type;
delete param.mime_type;
}
// Set required fields if not valid yet
if (typeof param.description !== 'string') {
param.description = "";
}
if (typeof param.schema !== 'object' || !param.schema) {
param.schema = {};
}
if (Utils.compareVersion(version, "0.4.x") <= 0) {
// Remove anyOf/oneOf wrapper
for(var type in {anyOf: null, oneOf: null}) {
if (Array.isArray(param.schema[type])) {
if (typeof param.schema.default !== 'undefined') {
param.default = param.schema.default;
}
param.schema = param.schema[type];
break;
}
}
// Remove default value from schema, add on parameter-level instead
var moveMediaType = (Utils.compareVersion(version, "0.4.x") <= 0 && typeof param.media_type !== 'undefined');
var schemas = Array.isArray(param.schema) ? param.schema : [param.schema];
for(var i in schemas) {
if (typeof schemas[i].default !== 'undefined') {
param.default = schemas[i].default;
delete schemas[i].default;
}
// v0.3 => v0.4: mime_type => media_type
if (moveMediaType) {
schemas[i].contentMediaType = param.media_type;
}
renameFormat(schemas[i]);
}
// Remove the media type, has been moved to JSON Schema above.
if (moveMediaType) {
delete param.media_type;
}
}
return param;
}
function renameFormat(schema) {
for(var i in schema) {
if (i === 'format') {
schema.subtype = schema.format;
if (!['date-time', 'time', 'date', 'uri'].includes(schema.format)) {
delete schema.format;
}
}
else if (schema[i] && typeof schema[i] === 'object') {
renameFormat(schema[i]);
}
}
}
module.exports = MigrateProcesses;

@@ -1,2 +0,5 @@

const ajv = require('ajv');
var ajv;
try {
ajv = require('ajv');
} catch(err) {}
const Utils = require('../utils');

@@ -17,6 +20,6 @@

'output-format': {type: 'string', validate: 'validateOutputFormat'},
'output-format-options': {type: 'array', validate: 'validateOutputFormatOptions'},
'output-format-options': {type: 'object', validate: 'validateOutputFormatOptions'},
'process-graph-id': {type: 'string', validate: 'validateProcessGraphId'},
'process-graph-variables': {type: 'array', validate: 'validateProcessGraphVariables'},
'proj-definition': {type: 'string', validate: 'validateProjDefinition'},
'process-graph-variables': {type: 'object', validate: 'validateProcessGraphVariables'},
'proj-definition': {type: 'string', validate: 'validateProjDefinition'}, // Proj is deprecated. Implement projjson and wkt2 instead
'raster-cube': {type: 'object', validate: 'validateRasterCube'},

@@ -32,2 +35,5 @@ 'temporal-interval': {type: 'array', validate: 'validateTemporalInterval'},

};
if (!ajv) {
throw "ajv not installed";
}
this.ajv = new ajv(ajvOptions);

@@ -34,0 +40,0 @@ this.ajv.addKeyword('parameters', {

@@ -354,2 +354,6 @@ const ErrorList = require('../errorlist');

getNodeCount() {
return Utils.size(this.nodes);
}
getNodes() {

@@ -356,0 +360,0 @@ return this.nodes;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc