Skip to content

Commit

Permalink
Fixing sync execution
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jan 21, 2025
1 parent 65430d0 commit 9079011
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ogc/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class OgcConnection extends Connection {
if (Array.isArray(spec.jobControlOptions) && spec.jobControlOptions.includes("async-execute")) {
mode = 'async';
}
return Boolean(spec && spec.ogcapi);
return Boolean(spec/* && spec.ogcapi*/);
});
let requestBody = Migrate.executeSync(openEO);
let requestBody = Migrate.executeSync(this, openEO);
let headers = {};
if (mode === 'async') {
headers.Prefer = 'respond-async';
Expand Down
7 changes: 4 additions & 3 deletions src/ogc/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,21 @@ class OgcMigrate {
* Executes an OGC API process synchronously.
*
* @todo Check whether implementation still works
* @param {Connection} connection
* @param {object} requestBody
* @returns {object}
*/
static executeSync(requestBody) {
static executeSync(connection, requestBody) {
const graph = Object.values(requestBody.process.process_graph);
const valid = graph.every(node => {
let spec = OgcMigrate.connection.processes.get(node.process_id);
let spec = connection.processes.get(node.process_id);
return Boolean(spec && (spec.ogcapi || spec.id === 'load_collection'));
});
if (!valid) {
throw new Error('Process must consist only of OGC Processes and Collections');
}

const parser = new PgParser(requestBody.process, OgcMigrate.connection.getBaseUrl());
const parser = new PgParser(requestBody.process, connection.getBaseUrl());
return parser.parse();
}

Expand Down

0 comments on commit 9079011

Please sign in to comment.