Skip to content

Commit cf289db

Browse files
committed
OGC API draft
1 parent 30cd63c commit cf289db

Some content is hidden

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

43 files changed

+835
-672
lines changed

.gitignore

+4-4
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

+5
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.6.0] - 2024-07-11
1116

1217
### Added

README.md

+4-4
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@0.21/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

+3-3
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

+2-2
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

+2-2
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

+4-4
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

+3-3
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

+3-3
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

+5-40
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { User, UserManager } from 'oidc-client';
44
import { ProcessRegistry } from '@openeo/js-commons';
55
import { Readable } from 'stream';
66

7-
declare module OpenEO {
7+
declare module Client {
88
/**
99
* The base class for authentication providers such as Basic and OpenID Connect.
1010
*
@@ -347,12 +347,6 @@ declare module OpenEO {
347347
* @throws {Error}
348348
*/
349349
protected validate(): void;
350-
/**
351-
* Initializes the class.
352-
*
353-
* @protected
354-
*/
355-
protected init(): void;
356350
/**
357351
* Returns the capabilities response as a JSON serializable representation of the data that is API compliant.
358352
*
@@ -1922,15 +1916,6 @@ declare module OpenEO {
19221916
* @type {ProcessRegistry}
19231917
*/
19241918
protected processes: ProcessRegistry;
1925-
/**
1926-
* Initializes the connection by requesting the capabilities.
1927-
*
1928-
* @async
1929-
* @protected
1930-
* @returns {Promise<Capabilities>} Capabilities
1931-
* @throws {Error}
1932-
*/
1933-
protected init(): Promise<Capabilities>;
19341919
/**
19351920
* Refresh the cache for processes.
19361921
*
@@ -2298,13 +2283,11 @@ declare module OpenEO {
22982283
*
22992284
* @async
23002285
* @param {Process} process - A user-defined process.
2301-
* @param {?string} [plan=null] - The billing plan to use for this computation.
2302-
* @param {?number} [budget=null] - The maximum budget allowed to spend for this computation.
23032286
* @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the processing request.
23042287
* @param {object.<string, *>} [additional={}] - Other parameters to pass for the batch job, e.g. `log_level`.
23052288
* @returns {Promise<SyncResult>} - An object with the data and some metadata.
23062289
*/
2307-
computeResult(process: Process, plan?: string | null, budget?: number | null, abortController?: AbortController | null, additional?: object<string, any>): Promise<SyncResult>;
2290+
computeResult(process: Process, abortController?: AbortController | null, additional?: object<string, any>): Promise<SyncResult>;
23082291
/**
23092292
* Executes a process synchronously and downloads to result the given path.
23102293
*
@@ -2401,24 +2384,6 @@ declare module OpenEO {
24012384
* @returns {ResponseArray}
24022385
*/
24032386
protected _toResponseArray(arr: Array<any>, response: object<string, any>): ResponseArray;
2404-
/**
2405-
* Get the a link with the given rel type.
2406-
*
2407-
* @protected
2408-
* @param {Array.<Link>} links - An array of links.
2409-
* @param {string|Array.<string>} rel - Relation type(s) to find.
2410-
* @returns {string | null}
2411-
* @throws {Error}
2412-
*/
2413-
protected _getLinkHref(links: Array<Link>, rel: string | Array<string>): string | null;
2414-
/**
2415-
* Makes all links in the list absolute.
2416-
*
2417-
* @param {Array.<Link>} links - An array of links.
2418-
* @param {?string|AxiosResponse} [base=null] - The base url to use for relative links, or an response to derive the url from.
2419-
* @returns {Array.<Link>}
2420-
*/
2421-
makeLinksAbsolute(links: Array<Link>, base?: (string | AxiosResponse) | null): Array<Link>;
24222387
/**
24232388
* Sends a GET request.
24242389
*
@@ -2538,7 +2503,7 @@ declare module OpenEO {
25382503
*
25392504
* @hideconstructor
25402505
*/
2541-
export class OpenEO {
2506+
export class Client {
25422507
/**
25432508
* Connect to a back-end with version discovery (recommended).
25442509
*
@@ -2575,7 +2540,7 @@ declare module OpenEO {
25752540
*/
25762541
static clientVersion(): string;
25772542
}
2578-
export namespace OpenEO {
2543+
export namespace Client {
25792544
const Environment: Environment;
25802545
}
25812546

@@ -2918,4 +2883,4 @@ declare module OpenEO {
29182883

29192884
}
29202885

2921-
export = OpenEO;
2886+
export = Client;

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openeo/js-client",
3-
"version": "2.6.0",
3+
"version": "3.0.0-alpha.1",
44
"author": "openEO Consortium",
55
"contributors": [
66
{
@@ -27,12 +27,12 @@
2727
"type": "github",
2828
"url": "https://github.com/sponsors/m-mohr"
2929
},
30-
"main": "src/openeo.js",
31-
"types": "openeo.d.ts",
30+
"main": "src/client.js",
31+
"types": "client.d.ts",
3232
"files": [
33-
"openeo.js",
34-
"openeo.d.ts",
35-
"openeo.min.js",
33+
"client.js",
34+
"client.d.ts",
35+
"client.min.js",
3636
"src/*"
3737
],
3838
"devDependencies": {

src/basicprovider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Environment = require('./env');
2-
const Utils = require('@openeo/js-commons/src/utils');
2+
const Utils = require('./utils');
33
const AuthProvider = require('./authprovider');
44

55
/**

src/builder/builder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const BuilderNode = require('./node');
22
const Parameter = require('./parameter');
33
const axios = require('axios');
4-
const Utils = require('@openeo/js-commons/src/utils');
4+
const Utils = require('../utils');
55
const ProcessUtils = require("@openeo/js-commons/src/processUtils");
66
const ProcessRegistry = require('@openeo/js-commons/src/processRegistry');
77

src/builder/node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Utils = require("@openeo/js-commons/src/utils");
1+
const Utils = require("../utils");
22
const Parameter = require("./parameter");
33

44
/**

0 commit comments

Comments
 (0)