Skip to content

Commit 6438a02

Browse files
committed
Added a very simple process graph builder
1 parent 65ffa7c commit 6438a02

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

openeo.js

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ class Connection {
9494
.then(response => response.data);
9595
}
9696

97+
buildProcessGraph() {
98+
return this.listProcesses()
99+
.then(data => {
100+
var builder = {};
101+
for(let i in data.processes) {
102+
let process = data.processes[i];
103+
builder[process.name] = (options) => {
104+
options.process_id = process.name;
105+
return options;
106+
}
107+
}
108+
return builder;
109+
});
110+
}
111+
97112
authenticateOIDC(options = null) {
98113
return Promise.reject(new Error("Not implemented yet."));
99114
}
@@ -498,7 +513,7 @@ class Subscriptions {
498513

499514
_flushQueue() {
500515
if(this.socket.readyState === this.socket.OPEN) {
501-
for(var i in this.messageQueue) {
516+
for(let i in this.messageQueue) {
502517
this.socket.send(JSON.stringify(this.messageQueue[i]));
503518
}
504519

@@ -606,7 +621,7 @@ class Capabilities {
606621
};
607622

608623
// regex-ify to allow custom parameter names
609-
for (var key in clientMethodNameToAPIRequestMap) {
624+
for(let key in clientMethodNameToAPIRequestMap) {
610625
clientMethodNameToAPIRequestMap[key] = clientMethodNameToAPIRequestMap[key].replace(/{[^}]+}/, '{[^}]+}');
611626
}
612627

@@ -637,8 +652,8 @@ class BaseEntity {
637652
this.connection = connection;
638653
this.clientNames = {};
639654
this.extra = {};
640-
for(var i in properties) {
641-
var backend, client;
655+
for(let i in properties) {
656+
let backend, client;
642657
if (Array.isArray(properties[i])) {
643658
backend = properties[i][0];
644659
client = properties[i][1];
@@ -655,7 +670,7 @@ class BaseEntity {
655670
}
656671

657672
setAll(metadata) {
658-
for (var name in metadata) {
673+
for(let name in metadata) {
659674
if (typeof this.clientNames[name] === 'undefined') {
660675
this.extra[name] = metadata[name];
661676
}
@@ -668,8 +683,8 @@ class BaseEntity {
668683

669684
getAll() {
670685
var obj = {};
671-
for (var backend in this.clientNames) {
672-
var client = this.clientNames[backend];
686+
for(let backend in this.clientNames) {
687+
let client = this.clientNames[backend];
673688
obj[client] = this[client];
674689
}
675690
return Object.assign(obj, this.extra);
@@ -836,11 +851,11 @@ class Job extends BaseEntity {
836851

837852
var promises = [];
838853
var files = [];
839-
for(var i in list.links) {
840-
var link = list.links[i].href;
841-
var parsedUrl = url.parse(link);
842-
var targetPath = path.join(targetFolder, path.basename(parsedUrl.pathname));
843-
var p = this.connection.download(link, false)
854+
for(let i in list.links) {
855+
let link = list.links[i].href;
856+
let parsedUrl = url.parse(link);
857+
let targetPath = path.join(targetFolder, path.basename(parsedUrl.pathname));
858+
let p = this.connection.download(link, false)
844859
.then(response => this.connection._saveToFileNode(response.data, targetPath))
845860
.then(() => files.push(targetPath));
846861
promises.push(p);
@@ -933,7 +948,7 @@ else {
933948
});
934949
}
935950
else {
936-
for (let exportObjName in toExport) {
951+
for(let exportObjName in toExport) {
937952
window[exportObjName] = toExport[exportObjName];
938953
}
939954
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openeo/js-client",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"author": "openEO Consortium",
55
"contributors": [
66
{

0 commit comments

Comments
 (0)