Skip to content

Commit 2c15cef

Browse files
committed
Basic OGC API support
1 parent 4a180b6 commit 2c15cef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1098
-380
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ node_modules/
44

55
# Build related
66
/report.html
7-
/openeo.js
8-
/openeo.min.js
9-
/openeo.node.js
10-
/openeo.node.min.js
7+
/client.js
8+
/client.min.js
9+
/client.node.js
10+
/client.node.min.js
1111

1212
# Reports
1313
coverage/

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Class `OpenEO` renamed to `Client` (i.e. use `Client.connect` instead of `OpenEO.connect`)
13+
- Moved `makeLinksAbsolute` and `getLinKHref` to `Utils` class
14+
1015
## [2.8.0] - 2025-04-25
1116

1217
### Added

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To use it in a browser environment simply add the following code to your HTML fi
2121
<script src="https://cdn.jsdelivr.net/npm/axios@1/dist/axios.min.js"></script>
2222
<script src="https://cdn.jsdelivr.net/npm/oidc-client@1/dist/oidc-client.min.js"></script> <!-- Only required if you'd like to enable authentication via OpenID Connect -->
2323
<script src="https://cdn.jsdelivr.net/npm/multihashes@3/src/index.min.js"></script> <!-- Only required if you have checksums in the STAC metadata -->
24-
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/openeo.min.js"></script>
24+
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@3/client.min.js"></script>
2525
```
2626

2727
### NodeJS
@@ -30,7 +30,7 @@ To install it in a NodeJS environment run:
3030
`npm install @openeo/js-client`
3131

3232
Afterwards, you can import the package:
33-
`const { OpenEO } = require('@openeo/js-client');`
33+
`const { Client } = require('@openeo/js-client');`
3434

3535
### TypeScript
3636

@@ -40,7 +40,7 @@ To install it in a TypeScript environment run:
4040
`npm install @openeo/js-client`
4141

4242
Afterwards, you can import the package:
43-
`import { OpenEO } from '@openeo/js-client';`
43+
`import { Client } from '@openeo/js-client';`
4444

4545
### Examples
4646

@@ -63,7 +63,7 @@ More information can be found in the [documentation](https://open-eo.github.io/o
6363
Always make sure to adapt changes in the *.js files to the openeo.d.ts file.
6464
If changes are larger you may want to run `npm run tsd` and regenerate the declaration file and cherry-pick your changes from there.
6565

66-
Generate a build: `npm run build` (generates `openeo.js` and `openeo.min.js`)
66+
Generate a build: `npm run build` (generates `client.js` and `client.min.js`)
6767

6868
Generate the documentation to the `docs/` folder: `npm run docs`
6969

examples/node/discovery.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Import the JS client
2-
const { OpenEO } = require('@openeo/js-client');
2+
const { Client } = require('@openeo/js-client');
33

44
const url = "https://earthengine.openeo.org"; // Insert the openEO server URL here
55
let connection = null;
66

77
console.log('URL: ' + url);
8-
console.log('Client Version: ' + OpenEO.clientVersion());
8+
console.log('Client Version: ' + Client.clientVersion());
99

10-
OpenEO.connect(url)
10+
Client.connect(url)
1111
.then(c => {
1212
connection = c;
1313
return connection.capabilities();

examples/oidc/openid-connect-popup.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<script src="https://cdn.jsdelivr.net/npm/axios@1/dist/axios.min.js"></script>
99
<script src="https://cdn.jsdelivr.net/npm/oidc-client@1/dist/oidc-client.min.js"></script>
10-
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/openeo.min.js"></script>
10+
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/client.min.js"></script>
1111
<script type="text/javascript">
1212
const BACKEND = "https://example.openeo.org"; // TODO: Set the back-end to authenticate against
1313
const CLIENT_ID = ""; // TODO: Set the client id
@@ -22,7 +22,7 @@
2222

2323
try {
2424
// Connect to the back-end
25-
con = await OpenEO.connect(BACKEND);
25+
con = await Client.connect(BACKEND);
2626

2727
// Show whether OIDC is supported by the back-end
2828
var capabilities = con.capabilities();

examples/oidc/openid-connect-redirect.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<script src="https://cdn.jsdelivr.net/npm/axios@1/dist/axios.min.js"></script>
99
<script src="https://cdn.jsdelivr.net/npm/oidc-client@1/dist/oidc-client.min.js"></script>
10-
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/openeo.min.js"></script>
10+
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/client.min.js"></script>
1111
<script type="text/javascript">
1212
const BACKEND = "https://example.openeo.org"; // TODO: Set the back-end to authenticate against
1313
const CLIENT_ID = ""; // TODO: Set the client id
@@ -20,7 +20,7 @@
2020

2121
try {
2222
// Connect to the back-end
23-
con = await OpenEO.connect(BACKEND);
23+
con = await Client.connect(BACKEND);
2424

2525
// Show whether OIDC is supported by the back-end
2626
var capabilities = con.capabilities();

examples/typescript/discovery.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// import the JS client main part (OpenEO) for the actual functionality
1+
// import the JS client main part (Client) for the actual functionality
22
// and some classes (Connection, Capabilities) and types (Collections, Processes) for TypeScript stuff
3-
import { OpenEO, Connection, Capabilities, Collections, Processes } from '@openeo/js-client';
3+
import { Client, Connection, Capabilities, Collections, Processes } from '@openeo/js-client';
44

55
let url: string = "https://earthengine.openeo.org"; // Insert the openEO server URL here
66
let connection: Connection = null; // Reserve a variable for the connection and specify its type
77

88
console.log('URL: ' + url);
9-
console.log('Client Version: ' + OpenEO.clientVersion());
9+
console.log('Client Version: ' + Client.clientVersion());
1010

11-
OpenEO.connect(url)
11+
Client.connect(url)
1212
.then((c: Connection): Capabilities => { // specify parameter type and return type
1313
connection = c;
1414
return connection.capabilities();

examples/web/discovery.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
<meta charset="UTF-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<script src="https://cdn.jsdelivr.net/npm/axios@1/dist/axios.min.js"></script>
9-
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/openeo.min.js"></script>
9+
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@3/client.min.js"></script>
1010
<script type="text/javascript">
1111
var url = "https://earthengine.openeo.org"; // Insert the openEO server URL here
1212
var connection = null;
1313

1414
window.onload = function () {
1515
document.getElementById('url').innerText = url;
16-
document.getElementById('clientVersion').innerText = OpenEO.clientVersion();
16+
document.getElementById('clientVersion').innerText = Client.clientVersion();
1717

18-
OpenEO.connect(url)
18+
Client.connect(url)
1919
.then(c => {
2020
connection = c;
2121
return connection.capabilities();

examples/web/workflow.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
<meta charset="UTF-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<script src="https://cdn.jsdelivr.net/npm/axios@1/dist/axios.min.js"></script>
9-
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/openeo.min.js"></script>
9+
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@3/client.min.js"></script>
1010
<script type="text/javascript">
1111
async function run() {
1212
// Show the client version
13-
log("Client Version: " + OpenEO.clientVersion());
13+
log("Client Version: " + Client.clientVersion());
1414

1515
try {
1616
// Connect to the back-end
17-
var con = await OpenEO.connect("https://earthengine.openeo.org");
17+
var con = await Client.connect("https://earthengine.openeo.org");
1818

1919
// Show implemented API version of the back-end
2020
var capabilities = con.capabilities();

openeo.d.ts

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ProcessRegistry } from '@openeo/js-commons';
55
import { Readable } from 'stream';
66
import axios from 'axios';
77

8-
declare namespace OpenEO {
8+
declare namespace Client {
99
/**
1010
* The base class for authentication providers such as Basic and OpenID Connect.
1111
*
@@ -356,12 +356,6 @@ declare namespace OpenEO {
356356
* @throws {Error}
357357
*/
358358
protected validate(): void;
359-
/**
360-
* Initializes the class.
361-
*
362-
* @protected
363-
*/
364-
protected init(): void;
365359
/**
366360
* Returns the capabilities response as a JSON serializable representation of the data that is API compliant.
367361
*
@@ -2124,15 +2118,6 @@ declare namespace OpenEO {
21242118
* @type {ProcessRegistry}
21252119
*/
21262120
protected processes: ProcessRegistry;
2127-
/**
2128-
* Initializes the connection by requesting the capabilities.
2129-
*
2130-
* @async
2131-
* @protected
2132-
* @returns {Promise<Capabilities>} Capabilities
2133-
* @throws {Error}
2134-
*/
2135-
protected init(): Promise<Capabilities>;
21362121
/**
21372122
* Refresh the cache for processes.
21382123
*
@@ -2539,13 +2524,11 @@ declare namespace OpenEO {
25392524
*
25402525
* @async
25412526
* @param {Process} process - A user-defined process.
2542-
* @param {?string} [plan=null] - The billing plan to use for this computation.
2543-
* @param {?number} [budget=null] - The maximum budget allowed to spend for this computation.
25442527
* @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the processing request.
25452528
* @param {object.<string, *>} [additional={}] - Other parameters to pass for the batch job, e.g. `log_level`.
25462529
* @returns {Promise<SyncResult>} - An object with the data and some metadata.
25472530
*/
2548-
computeResult(process: Process, plan?: string | null, budget?: number | null, abortController?: AbortController | null, additional?: Record<string, any>): Promise<SyncResult>;
2531+
computeResult(process: Process, abortController?: AbortController | null, additional?: Record<string, any>): Promise<SyncResult>;
25492532
/**
25502533
* Executes a process synchronously and downloads to result the given path.
25512534
*
@@ -2646,23 +2629,16 @@ declare namespace OpenEO {
26462629
*/
26472630
getService(id: string): Promise<Service>;
26482631
/**
2649-
* Get the a link with the given rel type.
2632+
* Adds additional response details to the array.
26502633
*
2651-
* @protected
2652-
* @param {Array.<Link>} links - An array of links.
2653-
* @param {string|Array.<string>} rel - Relation type(s) to find.
2654-
* @returns {string | null}
2655-
* @throws {Error}
2656-
*/
2657-
protected _getLinkHref(links: Array<Link>, rel: string | Array<string>): string | null;
2658-
/**
2659-
* Makes all links in the list absolute.
2634+
* Adds links and federation:missing.
26602635
*
2661-
* @param {Array.<Link>} links - An array of links.
2662-
* @param {?string|AxiosResponse} [base=null] - The base url to use for relative links, or an response to derive the url from.
2663-
* @returns {Array.<Link>}
2636+
* @protected
2637+
* @param {Array.<*>} arr
2638+
* @param {object.<string, *>} response
2639+
* @returns {ResponseArray}
26642640
*/
2665-
makeLinksAbsolute(links: Array<Link>, base?: (string | AxiosResponse) | null): Array<Link>;
2641+
protected _toResponseArray(arr: Array<any>, response: object<string, any>): ResponseArray;
26662642
/**
26672643
* Sends a GET request.
26682644
*
@@ -2782,7 +2758,7 @@ declare namespace OpenEO {
27822758
*
27832759
* @hideconstructor
27842760
*/
2785-
export class OpenEO {
2761+
export class Client {
27862762
/**
27872763
* Connect to a back-end with version discovery (recommended).
27882764
*
@@ -2819,7 +2795,7 @@ declare namespace OpenEO {
28192795
*/
28202796
static clientVersion(): string;
28212797
}
2822-
export namespace OpenEO {
2798+
export namespace Client {
28232799
const Environment: Environment;
28242800
}
28252801

@@ -3171,4 +3147,4 @@ declare namespace OpenEO {
31713147
export type ValidationResult = any;
31723148
}
31733149

3174-
export = OpenEO;
3150+
export = Client;

0 commit comments

Comments
 (0)