@openeo/js-client 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/openeo.d.ts +51 -16
- package/openeo.js +110 -22
- package/openeo.min.js +1 -1
- package/package.json +1 -1
- package/src/baseentity.js +1 -1
- package/src/builder/builder.js +1 -1
- package/src/builder/node.js +1 -1
- package/src/connection.js +69 -21
- package/src/filetypes.js +8 -0
- package/src/oidcprovider.js +1 -1
- package/src/openeo.js +1 -1
- package/src/typedefs.js +12 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ JavaScript/TypeScript client for the openEO API.
|
|
|
4
4
|
|
|
5
5
|
* [Documentation](https://open-eo.github.io/openeo-js-client/latest/).
|
|
6
6
|
|
|
7
|
-
The version of this client is **2.
|
|
7
|
+
The version of this client is **2.5.1** and supports **openEO API versions 1.x.x**.
|
|
8
8
|
Legacy versions are available as releases.
|
|
9
9
|
See the [CHANGELOG](CHANGELOG.md) for recent changes.
|
|
10
10
|
|
package/openeo.d.ts
CHANGED
|
@@ -599,9 +599,17 @@ declare module OpenEO {
|
|
|
599
599
|
*/
|
|
600
600
|
constructor(data: FileTypesAPI);
|
|
601
601
|
/**
|
|
602
|
+
* @protected
|
|
602
603
|
* @type {FileTypesAPI}
|
|
603
604
|
*/
|
|
604
|
-
data: FileTypesAPI;
|
|
605
|
+
protected data: FileTypesAPI;
|
|
606
|
+
/**
|
|
607
|
+
* A list of backends from the federation that are missing in the response data.
|
|
608
|
+
*
|
|
609
|
+
* @public
|
|
610
|
+
* @type {Array.<string>}
|
|
611
|
+
*/
|
|
612
|
+
public 'federation:missing': Array<string>;
|
|
605
613
|
/**
|
|
606
614
|
* Returns the file types response as a JSON serializable representation of the data that is API compliant.
|
|
607
615
|
*
|
|
@@ -2151,10 +2159,10 @@ declare module OpenEO {
|
|
|
2151
2159
|
* Lists all files from the user workspace.
|
|
2152
2160
|
*
|
|
2153
2161
|
* @async
|
|
2154
|
-
* @returns {Promise<
|
|
2162
|
+
* @returns {Promise<ResponseArray.<UserFile>>} A list of files.
|
|
2155
2163
|
* @throws {Error}
|
|
2156
2164
|
*/
|
|
2157
|
-
listFiles(): Promise<
|
|
2165
|
+
listFiles(): Promise<ResponseArray<UserFile>>;
|
|
2158
2166
|
/**
|
|
2159
2167
|
* A callback that is executed on upload progress updates.
|
|
2160
2168
|
*
|
|
@@ -2211,10 +2219,11 @@ declare module OpenEO {
|
|
|
2211
2219
|
* Lists all user-defined processes of the authenticated user.
|
|
2212
2220
|
*
|
|
2213
2221
|
* @async
|
|
2214
|
-
* @
|
|
2222
|
+
* @param {Array.<UserProcess>} [oldProcesses=[]] - A list of existing user-defined processes to update.
|
|
2223
|
+
* @returns {Promise<ResponseArray.<UserProcess>>} A list of user-defined processes.
|
|
2215
2224
|
* @throws {Error}
|
|
2216
2225
|
*/
|
|
2217
|
-
listUserProcesses(): Promise<
|
|
2226
|
+
listUserProcesses(oldProcesses?: Array<UserProcess>): Promise<ResponseArray<UserProcess>>;
|
|
2218
2227
|
/**
|
|
2219
2228
|
* Creates a new stored user-defined process at the back-end.
|
|
2220
2229
|
*
|
|
@@ -2269,10 +2278,11 @@ declare module OpenEO {
|
|
|
2269
2278
|
* Lists all batch jobs of the authenticated user.
|
|
2270
2279
|
*
|
|
2271
2280
|
* @async
|
|
2272
|
-
* @
|
|
2281
|
+
* @param {Array.<Job>} [oldJobs=[]] - A list of existing jobs to update.
|
|
2282
|
+
* @returns {Promise<ResponseArray.<Job>>} A list of jobs.
|
|
2273
2283
|
* @throws {Error}
|
|
2274
2284
|
*/
|
|
2275
|
-
listJobs(): Promise<
|
|
2285
|
+
listJobs(oldJobs?: Array<Job>): Promise<ResponseArray<Job>>;
|
|
2276
2286
|
/**
|
|
2277
2287
|
* Creates a new batch job at the back-end.
|
|
2278
2288
|
*
|
|
@@ -2300,10 +2310,11 @@ declare module OpenEO {
|
|
|
2300
2310
|
* Lists all secondary web services of the authenticated user.
|
|
2301
2311
|
*
|
|
2302
2312
|
* @async
|
|
2303
|
-
* @
|
|
2313
|
+
* @param {Array.<Service>} [oldServices=[]] - A list of existing services to update.
|
|
2314
|
+
* @returns {Promise<ResponseArray.<Job>>} A list of services.
|
|
2304
2315
|
* @throws {Error}
|
|
2305
2316
|
*/
|
|
2306
|
-
listServices(): Promise<
|
|
2317
|
+
listServices(oldServices?: Array<Service>): Promise<ResponseArray<Job>>;
|
|
2307
2318
|
/**
|
|
2308
2319
|
* Creates a new secondary web service at the back-end.
|
|
2309
2320
|
*
|
|
@@ -2330,18 +2341,31 @@ declare module OpenEO {
|
|
|
2330
2341
|
* @throws {Error}
|
|
2331
2342
|
*/
|
|
2332
2343
|
getService(id: string): Promise<Service>;
|
|
2344
|
+
/**
|
|
2345
|
+
* Adds additional response details to the array.
|
|
2346
|
+
*
|
|
2347
|
+
* Adds links and federation:missing.
|
|
2348
|
+
*
|
|
2349
|
+
* @protected
|
|
2350
|
+
* @param {Array} arr
|
|
2351
|
+
* @param {object.<string, *>} response
|
|
2352
|
+
* @returns {ResponseArray}
|
|
2353
|
+
*/
|
|
2354
|
+
protected _toResponseArray(arr: any[], response: object<string, any>): any;
|
|
2333
2355
|
/**
|
|
2334
2356
|
* Get the a link with the given rel type.
|
|
2335
2357
|
*
|
|
2358
|
+
* @protected
|
|
2336
2359
|
* @param {Array.<Link>} links - An array of links.
|
|
2337
2360
|
* @param {string} rel - Relation type to find, defaults to `next`.
|
|
2338
2361
|
* @returns {string | null}
|
|
2339
2362
|
* @throws {Error}
|
|
2340
2363
|
*/
|
|
2341
|
-
_getLinkHref(links: Array<Link>, rel?: string): string | null;
|
|
2364
|
+
protected _getLinkHref(links: Array<Link>, rel?: string): string | null;
|
|
2342
2365
|
/**
|
|
2343
2366
|
* Sends a GET request.
|
|
2344
2367
|
*
|
|
2368
|
+
* @protected
|
|
2345
2369
|
* @async
|
|
2346
2370
|
* @param {string} path
|
|
2347
2371
|
* @param {object.<string, *>} query
|
|
@@ -2350,10 +2374,11 @@ declare module OpenEO {
|
|
|
2350
2374
|
* @throws {Error}
|
|
2351
2375
|
* @see https://github.com/axios/axios#request-config
|
|
2352
2376
|
*/
|
|
2353
|
-
_get(path: string, query: object<string, any>, responseType: string): Promise<AxiosResponse>;
|
|
2377
|
+
protected _get(path: string, query: object<string, any>, responseType: string): Promise<AxiosResponse>;
|
|
2354
2378
|
/**
|
|
2355
2379
|
* Sends a POST request.
|
|
2356
2380
|
*
|
|
2381
|
+
* @protected
|
|
2357
2382
|
* @async
|
|
2358
2383
|
* @param {string} path
|
|
2359
2384
|
* @param {*} body
|
|
@@ -2363,36 +2388,39 @@ declare module OpenEO {
|
|
|
2363
2388
|
* @throws {Error}
|
|
2364
2389
|
* @see https://github.com/axios/axios#request-config
|
|
2365
2390
|
*/
|
|
2366
|
-
_post(path: string, body: any, responseType: string, abortController?: AbortController | null): Promise<AxiosResponse>;
|
|
2391
|
+
protected _post(path: string, body: any, responseType: string, abortController?: AbortController | null): Promise<AxiosResponse>;
|
|
2367
2392
|
/**
|
|
2368
2393
|
* Sends a PUT request.
|
|
2369
2394
|
*
|
|
2395
|
+
* @protected
|
|
2370
2396
|
* @async
|
|
2371
2397
|
* @param {string} path
|
|
2372
2398
|
* @param {*} body
|
|
2373
2399
|
* @returns {Promise<AxiosResponse>}
|
|
2374
2400
|
* @throws {Error}
|
|
2375
2401
|
*/
|
|
2376
|
-
_put(path: string, body: any): Promise<AxiosResponse>;
|
|
2402
|
+
protected _put(path: string, body: any): Promise<AxiosResponse>;
|
|
2377
2403
|
/**
|
|
2378
2404
|
* Sends a PATCH request.
|
|
2379
2405
|
*
|
|
2406
|
+
* @protected
|
|
2380
2407
|
* @async
|
|
2381
2408
|
* @param {string} path
|
|
2382
2409
|
* @param {*} body
|
|
2383
2410
|
* @returns {Promise<AxiosResponse>}
|
|
2384
2411
|
* @throws {Error}
|
|
2385
2412
|
*/
|
|
2386
|
-
_patch(path: string, body: any): Promise<AxiosResponse>;
|
|
2413
|
+
protected _patch(path: string, body: any): Promise<AxiosResponse>;
|
|
2387
2414
|
/**
|
|
2388
2415
|
* Sends a DELETE request.
|
|
2389
2416
|
*
|
|
2417
|
+
* @protected
|
|
2390
2418
|
* @async
|
|
2391
2419
|
* @param {string} path
|
|
2392
2420
|
* @returns {Promise<AxiosResponse>}
|
|
2393
2421
|
* @throws {Error}
|
|
2394
2422
|
*/
|
|
2395
|
-
_delete(path: string): Promise<AxiosResponse>;
|
|
2423
|
+
protected _delete(path: string): Promise<AxiosResponse>;
|
|
2396
2424
|
/**
|
|
2397
2425
|
* Downloads data from a URL.
|
|
2398
2426
|
*
|
|
@@ -2416,6 +2444,7 @@ declare module OpenEO {
|
|
|
2416
2444
|
* Tries to smoothly handle error responses by providing an object for all response types,
|
|
2417
2445
|
* instead of Streams or Blobs for non-JSON response types.
|
|
2418
2446
|
*
|
|
2447
|
+
* @protected
|
|
2419
2448
|
* @async
|
|
2420
2449
|
* @param {object.<string, *>} options
|
|
2421
2450
|
* @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the request.
|
|
@@ -2423,7 +2452,7 @@ declare module OpenEO {
|
|
|
2423
2452
|
* @throws {Error}
|
|
2424
2453
|
* @see https://github.com/axios/axios
|
|
2425
2454
|
*/
|
|
2426
|
-
_send(options:
|
|
2455
|
+
protected _send(options: object<string, any>, abortController?: AbortController | null): Promise<AxiosResponse>;
|
|
2427
2456
|
}
|
|
2428
2457
|
namespace Connection {
|
|
2429
2458
|
export { oidcProviderFactoryFunction, uploadStatusCallback };
|
|
@@ -2732,6 +2761,12 @@ declare module OpenEO {
|
|
|
2732
2761
|
* An openEO processing chain.
|
|
2733
2762
|
*/
|
|
2734
2763
|
export type Process = object<string, any>;
|
|
2764
|
+
/**
|
|
2765
|
+
* An array, but enriched with additional details from an openEO API response.
|
|
2766
|
+
*
|
|
2767
|
+
* Adds two properties: `links` and `federation:missing`.
|
|
2768
|
+
*/
|
|
2769
|
+
export type ResponseArray = Array;
|
|
2735
2770
|
export type ServiceType = object<string, any>;
|
|
2736
2771
|
export type SyncResult = {
|
|
2737
2772
|
/**
|
package/openeo.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
var a = typeof exports === 'object' ? factory(require("Oidc"), require("axios"), (function webpackLoadOptionalExternalModule() { try { return require("multihashes"); } catch(e) {} }())) : factory(root["Oidc"], root["axios"], root["multihashes"]);
|
|
8
8
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
9
|
}
|
|
10
|
-
})(self,
|
|
10
|
+
})(self, (__WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__300__, __WEBPACK_EXTERNAL_MODULE__263__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
@@ -1263,7 +1263,15 @@ var Catalog = {
|
|
|
1263
1263
|
|
|
1264
1264
|
_.ensure(catalog, 'stac_extensions', []) && DONE;
|
|
1265
1265
|
V.before('0.8.0') && _.populateExtensions(catalog, 'catalog') && DONE;
|
|
1266
|
-
}
|
|
1266
|
+
},
|
|
1267
|
+
|
|
1268
|
+
openeo(obj) {
|
|
1269
|
+
_.rename(obj, 'api_version', 'openeo:api_version') && DONE;
|
|
1270
|
+
_.rename(obj, 'backend_version', 'openeo:backend_version') && DONE;
|
|
1271
|
+
_.rename(obj, 'production', 'openeo:production') && DONE;
|
|
1272
|
+
_.rename(obj, 'endpoints', 'openeo:endpoints') && DONE;
|
|
1273
|
+
_.rename(obj, 'billing', 'openeo:billing') && DONE;
|
|
1274
|
+
},
|
|
1267
1275
|
|
|
1268
1276
|
};
|
|
1269
1277
|
|
|
@@ -1297,6 +1305,8 @@ var Collection = {
|
|
|
1297
1305
|
},
|
|
1298
1306
|
|
|
1299
1307
|
extent(collection) {
|
|
1308
|
+
_.ensure(collection, "extent", {});
|
|
1309
|
+
|
|
1300
1310
|
if (V.before('0.8.0')) {
|
|
1301
1311
|
// Restructure spatial extent
|
|
1302
1312
|
if (Array.isArray(collection.extent.spatial)) {
|
|
@@ -1316,9 +1326,14 @@ var Collection = {
|
|
|
1316
1326
|
}
|
|
1317
1327
|
}
|
|
1318
1328
|
|
|
1329
|
+
_.ensure(collection.extent, "spatial", {});
|
|
1330
|
+
_.ensure(collection.extent.spatial, "bbox", []);
|
|
1331
|
+
_.ensure(collection.extent, "temporal", {});
|
|
1332
|
+
_.ensure(collection.extent.temporal, "interval", []);
|
|
1333
|
+
|
|
1319
1334
|
if (V.before('1.0.0-rc.3')) {
|
|
1320
1335
|
// The first extent in a Collection is always the overall extent, followed by more specific extents.
|
|
1321
|
-
if (
|
|
1336
|
+
if (collection.extent.temporal.interval.length > 1) {
|
|
1322
1337
|
let min, max;
|
|
1323
1338
|
for(let interval of collection.extent.temporal.interval) {
|
|
1324
1339
|
if (interval[0] === null) {
|
|
@@ -1350,7 +1365,7 @@ var Collection = {
|
|
|
1350
1365
|
max ? _.toISOString(max) : null
|
|
1351
1366
|
]);
|
|
1352
1367
|
}
|
|
1353
|
-
if (
|
|
1368
|
+
if (collection.extent.spatial.bbox.length > 1) {
|
|
1354
1369
|
let count = collection.extent.spatial.bbox.reduce((val, bbox) => Array.isArray(bbox) ? Math.max(bbox.length, val) : val, 4);
|
|
1355
1370
|
if (count >= 4) {
|
|
1356
1371
|
let union = new Array(count).fill(null);
|
|
@@ -1886,7 +1901,7 @@ class BaseEntity {
|
|
|
1886
1901
|
* Creates an instance of this object.
|
|
1887
1902
|
*
|
|
1888
1903
|
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
|
|
1889
|
-
* @param {Array} properties - A mapping from the API property names to the JS client property names (usually to convert between snake_case and camelCase), e.g. `["id", "title", ["process_graph", "processGraph"]]`
|
|
1904
|
+
* @param {Array.<string|Array.<string>>} properties - A mapping from the API property names to the JS client property names (usually to convert between snake_case and camelCase), e.g. `["id", "title", ["process_graph", "processGraph"]]`
|
|
1890
1905
|
*/
|
|
1891
1906
|
constructor(connection) {
|
|
1892
1907
|
let properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -2590,7 +2605,7 @@ class Builder {
|
|
|
2590
2605
|
/**
|
|
2591
2606
|
* Gets the callback parameter specifics from the parent process.
|
|
2592
2607
|
*
|
|
2593
|
-
* @returns {Array}
|
|
2608
|
+
* @returns {Array.<object.<string,*>>}
|
|
2594
2609
|
* @todo Should this also pass callback parameters from parents until root is reached?
|
|
2595
2610
|
*/
|
|
2596
2611
|
|
|
@@ -3084,7 +3099,7 @@ class BuilderNode {
|
|
|
3084
3099
|
/**
|
|
3085
3100
|
* Converts a sorted array of arguments to an object with the respective parameter names.
|
|
3086
3101
|
*
|
|
3087
|
-
* @param {Array} processArgs
|
|
3102
|
+
* @param {Array.<object.<string, *>>} processArgs
|
|
3088
3103
|
* @returns {object.<string, *>}
|
|
3089
3104
|
* @throws {Error}
|
|
3090
3105
|
*/
|
|
@@ -4413,10 +4428,12 @@ class Connection {
|
|
|
4413
4428
|
let fn = () => Promise.resolve();
|
|
4414
4429
|
|
|
4415
4430
|
if (namespace === 'user') {
|
|
4431
|
+
let userProcesses = this.processes.namespace('user');
|
|
4432
|
+
|
|
4416
4433
|
if (!this.isAuthenticated()) {
|
|
4417
4434
|
fn = () => this.processes.remove(null, 'user') ? Promise.resolve() : Promise.reject(new Error("Can't clear user processes"));
|
|
4418
4435
|
} else if (this.capabilities().hasFeature('listUserProcesses')) {
|
|
4419
|
-
fn = () => this.listUserProcesses();
|
|
4436
|
+
fn = () => this.listUserProcesses(userProcesses);
|
|
4420
4437
|
}
|
|
4421
4438
|
} else if (this.capabilities().hasFeature('listProcesses')) {
|
|
4422
4439
|
fn = () => this.listProcesses(namespace);
|
|
@@ -4546,7 +4563,7 @@ class Connection {
|
|
|
4546
4563
|
* 2. Lower left corner, coordinate axis 2
|
|
4547
4564
|
* 3. Upper right corner, coordinate axis 1
|
|
4548
4565
|
* 4. Upper right corner, coordinate axis 2
|
|
4549
|
-
* @param {?Array
|
|
4566
|
+
* @param {?Array} [temporalExtent=null] - Limits the items to the specified temporal interval.
|
|
4550
4567
|
* The interval has to be specified as an array with exactly two elements (start, end) and
|
|
4551
4568
|
* each must be either an RFC 3339 compatible string or a Date object.
|
|
4552
4569
|
* Also supports open intervals by setting one of the boundaries to `null`, but never both.
|
|
@@ -4945,14 +4962,15 @@ class Connection {
|
|
|
4945
4962
|
* Lists all files from the user workspace.
|
|
4946
4963
|
*
|
|
4947
4964
|
* @async
|
|
4948
|
-
* @returns {Promise<
|
|
4965
|
+
* @returns {Promise<ResponseArray.<UserFile>>} A list of files.
|
|
4949
4966
|
* @throws {Error}
|
|
4950
4967
|
*/
|
|
4951
4968
|
|
|
4952
4969
|
|
|
4953
4970
|
async listFiles() {
|
|
4954
4971
|
let response = await this._get('/files');
|
|
4955
|
-
|
|
4972
|
+
let files = response.data.files.map(f => new UserFile(this, f.path).setAll(f));
|
|
4973
|
+
return this._toResponseArray(files, response.data);
|
|
4956
4974
|
}
|
|
4957
4975
|
/**
|
|
4958
4976
|
* A callback that is executed on upload progress updates.
|
|
@@ -5057,22 +5075,36 @@ class Connection {
|
|
|
5057
5075
|
* Lists all user-defined processes of the authenticated user.
|
|
5058
5076
|
*
|
|
5059
5077
|
* @async
|
|
5060
|
-
* @
|
|
5078
|
+
* @param {Array.<UserProcess>} [oldProcesses=[]] - A list of existing user-defined processes to update.
|
|
5079
|
+
* @returns {Promise<ResponseArray.<UserProcess>>} A list of user-defined processes.
|
|
5061
5080
|
* @throws {Error}
|
|
5062
5081
|
*/
|
|
5063
5082
|
|
|
5064
5083
|
|
|
5065
5084
|
async listUserProcesses() {
|
|
5085
|
+
let oldProcesses = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5066
5086
|
let response = await this._get('/process_graphs');
|
|
5067
5087
|
|
|
5068
5088
|
if (!Utils.isObject(response.data) || !Array.isArray(response.data.processes)) {
|
|
5069
5089
|
throw new Error('Invalid response received for processes');
|
|
5070
|
-
} //
|
|
5090
|
+
} // Remove existing processes from cache
|
|
5091
|
+
|
|
5071
5092
|
|
|
5093
|
+
this.processes.remove(null, 'user'); // Update existing processes if needed
|
|
5094
|
+
|
|
5095
|
+
let newProcesses = response.data.processes.map(newProcess => {
|
|
5096
|
+
let process = oldProcesses.find(oldProcess => oldProcess.id === newProcess.id);
|
|
5097
|
+
|
|
5098
|
+
if (!process) {
|
|
5099
|
+
process = new UserProcess(this, newProcess.id);
|
|
5100
|
+
}
|
|
5072
5101
|
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5102
|
+
return process.setAll(newProcess);
|
|
5103
|
+
}); // Store plain JS variant (i.e. no Job objects involved) of processes in cache
|
|
5104
|
+
|
|
5105
|
+
let jsonProcesses = oldProcesses.length > 0 ? newProcesses.map(p => p.toJSON()) : response.data.processes;
|
|
5106
|
+
this.processes.addAll(jsonProcesses, 'user');
|
|
5107
|
+
return this._toResponseArray(newProcesses, response.data);
|
|
5076
5108
|
}
|
|
5077
5109
|
/**
|
|
5078
5110
|
* Creates a new stored user-defined process at the back-end.
|
|
@@ -5198,14 +5230,25 @@ class Connection {
|
|
|
5198
5230
|
* Lists all batch jobs of the authenticated user.
|
|
5199
5231
|
*
|
|
5200
5232
|
* @async
|
|
5201
|
-
* @
|
|
5233
|
+
* @param {Array.<Job>} [oldJobs=[]] - A list of existing jobs to update.
|
|
5234
|
+
* @returns {Promise<ResponseArray.<Job>>} A list of jobs.
|
|
5202
5235
|
* @throws {Error}
|
|
5203
5236
|
*/
|
|
5204
5237
|
|
|
5205
5238
|
|
|
5206
5239
|
async listJobs() {
|
|
5240
|
+
let oldJobs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5207
5241
|
let response = await this._get('/jobs');
|
|
5208
|
-
|
|
5242
|
+
let newJobs = response.data.jobs.map(newJob => {
|
|
5243
|
+
let job = oldJobs.find(oldJob => oldJob.id === newJob.id);
|
|
5244
|
+
|
|
5245
|
+
if (!job) {
|
|
5246
|
+
job = new Job(this, newJob.id);
|
|
5247
|
+
}
|
|
5248
|
+
|
|
5249
|
+
return job.setAll(newJob);
|
|
5250
|
+
});
|
|
5251
|
+
return this._toResponseArray(newJobs, response.data);
|
|
5209
5252
|
}
|
|
5210
5253
|
/**
|
|
5211
5254
|
* Creates a new batch job at the back-end.
|
|
@@ -5269,14 +5312,25 @@ class Connection {
|
|
|
5269
5312
|
* Lists all secondary web services of the authenticated user.
|
|
5270
5313
|
*
|
|
5271
5314
|
* @async
|
|
5272
|
-
* @
|
|
5315
|
+
* @param {Array.<Service>} [oldServices=[]] - A list of existing services to update.
|
|
5316
|
+
* @returns {Promise<ResponseArray.<Job>>} A list of services.
|
|
5273
5317
|
* @throws {Error}
|
|
5274
5318
|
*/
|
|
5275
5319
|
|
|
5276
5320
|
|
|
5277
5321
|
async listServices() {
|
|
5322
|
+
let oldServices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5278
5323
|
let response = await this._get('/services');
|
|
5279
|
-
|
|
5324
|
+
let newServices = response.data.services.map(newService => {
|
|
5325
|
+
let service = oldServices.find(oldService => oldService.id === newService.id);
|
|
5326
|
+
|
|
5327
|
+
if (!service) {
|
|
5328
|
+
service = new Service(this, newService.id);
|
|
5329
|
+
}
|
|
5330
|
+
|
|
5331
|
+
return service.setAll(newService);
|
|
5332
|
+
});
|
|
5333
|
+
return this._toResponseArray(newServices, response.data);
|
|
5280
5334
|
}
|
|
5281
5335
|
/**
|
|
5282
5336
|
* Creates a new secondary web service at the back-end.
|
|
@@ -5343,9 +5397,27 @@ class Connection {
|
|
|
5343
5397
|
let service = new Service(this, id);
|
|
5344
5398
|
return await service.describeService();
|
|
5345
5399
|
}
|
|
5400
|
+
/**
|
|
5401
|
+
* Adds additional response details to the array.
|
|
5402
|
+
*
|
|
5403
|
+
* Adds links and federation:missing.
|
|
5404
|
+
*
|
|
5405
|
+
* @protected
|
|
5406
|
+
* @param {Array.<*>} arr
|
|
5407
|
+
* @param {object.<string, *>} response
|
|
5408
|
+
* @returns {ResponseArray}
|
|
5409
|
+
*/
|
|
5410
|
+
|
|
5411
|
+
|
|
5412
|
+
_toResponseArray(arr, response) {
|
|
5413
|
+
arr.links = Array.isArray(response.links) ? response.links : [];
|
|
5414
|
+
arr['federation:missing'] = Array.isArray(response['federation:missing']) ? response['federation:missing'] : [];
|
|
5415
|
+
return arr;
|
|
5416
|
+
}
|
|
5346
5417
|
/**
|
|
5347
5418
|
* Get the a link with the given rel type.
|
|
5348
5419
|
*
|
|
5420
|
+
* @protected
|
|
5349
5421
|
* @param {Array.<Link>} links - An array of links.
|
|
5350
5422
|
* @param {string} rel - Relation type to find, defaults to `next`.
|
|
5351
5423
|
* @returns {string | null}
|
|
@@ -5369,6 +5441,7 @@ class Connection {
|
|
|
5369
5441
|
/**
|
|
5370
5442
|
* Sends a GET request.
|
|
5371
5443
|
*
|
|
5444
|
+
* @protected
|
|
5372
5445
|
* @async
|
|
5373
5446
|
* @param {string} path
|
|
5374
5447
|
* @param {object.<string, *>} query
|
|
@@ -5393,6 +5466,7 @@ class Connection {
|
|
|
5393
5466
|
/**
|
|
5394
5467
|
* Sends a POST request.
|
|
5395
5468
|
*
|
|
5469
|
+
* @protected
|
|
5396
5470
|
* @async
|
|
5397
5471
|
* @param {string} path
|
|
5398
5472
|
* @param {*} body
|
|
@@ -5417,6 +5491,7 @@ class Connection {
|
|
|
5417
5491
|
/**
|
|
5418
5492
|
* Sends a PUT request.
|
|
5419
5493
|
*
|
|
5494
|
+
* @protected
|
|
5420
5495
|
* @async
|
|
5421
5496
|
* @param {string} path
|
|
5422
5497
|
* @param {*} body
|
|
@@ -5435,6 +5510,7 @@ class Connection {
|
|
|
5435
5510
|
/**
|
|
5436
5511
|
* Sends a PATCH request.
|
|
5437
5512
|
*
|
|
5513
|
+
* @protected
|
|
5438
5514
|
* @async
|
|
5439
5515
|
* @param {string} path
|
|
5440
5516
|
* @param {*} body
|
|
@@ -5453,6 +5529,7 @@ class Connection {
|
|
|
5453
5529
|
/**
|
|
5454
5530
|
* Sends a DELETE request.
|
|
5455
5531
|
*
|
|
5532
|
+
* @protected
|
|
5456
5533
|
* @async
|
|
5457
5534
|
* @param {string} path
|
|
5458
5535
|
* @returns {Promise<AxiosResponse>}
|
|
@@ -5499,6 +5576,7 @@ class Connection {
|
|
|
5499
5576
|
* Tries to smoothly handle error responses by providing an object for all response types,
|
|
5500
5577
|
* instead of Streams or Blobs for non-JSON response types.
|
|
5501
5578
|
*
|
|
5579
|
+
* @protected
|
|
5502
5580
|
* @async
|
|
5503
5581
|
* @param {object.<string, *>} options
|
|
5504
5582
|
* @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the request.
|
|
@@ -5586,6 +5664,7 @@ class FileTypes {
|
|
|
5586
5664
|
*/
|
|
5587
5665
|
constructor(data) {
|
|
5588
5666
|
/**
|
|
5667
|
+
* @protected
|
|
5589
5668
|
* @type {FileTypesAPI}
|
|
5590
5669
|
*/
|
|
5591
5670
|
this.data = {
|
|
@@ -5606,6 +5685,15 @@ class FileTypes {
|
|
|
5606
5685
|
this.data[io][type.toUpperCase()] = data[io][type];
|
|
5607
5686
|
}
|
|
5608
5687
|
}
|
|
5688
|
+
/**
|
|
5689
|
+
* A list of backends from the federation that are missing in the response data.
|
|
5690
|
+
*
|
|
5691
|
+
* @public
|
|
5692
|
+
* @type {Array.<string>}
|
|
5693
|
+
*/
|
|
5694
|
+
|
|
5695
|
+
|
|
5696
|
+
this['federation:missing'] = data['federation:missing'];
|
|
5609
5697
|
}
|
|
5610
5698
|
/**
|
|
5611
5699
|
* Returns the file types response as a JSON serializable representation of the data that is API compliant.
|
|
@@ -6415,7 +6503,7 @@ class OidcProvider extends AuthProvider {
|
|
|
6415
6503
|
client_id: this.clientId,
|
|
6416
6504
|
redirect_uri: OidcProvider.redirectUrl,
|
|
6417
6505
|
authority: this.issuer.replace('/.well-known/openid-configuration', ''),
|
|
6418
|
-
scope,
|
|
6506
|
+
scope: scope.join(' '),
|
|
6419
6507
|
validateSubOnSilentRenew: true,
|
|
6420
6508
|
response_type,
|
|
6421
6509
|
response_mode: response_type.includes('code') ? 'query' : 'fragment'
|
|
@@ -6693,7 +6781,7 @@ class OpenEO {
|
|
|
6693
6781
|
|
|
6694
6782
|
|
|
6695
6783
|
static clientVersion() {
|
|
6696
|
-
return "2.
|
|
6784
|
+
return "2.5.1";
|
|
6697
6785
|
}
|
|
6698
6786
|
|
|
6699
6787
|
}
|
package/openeo.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("Oidc"),require("axios"),function(){try{return require("multihashes")}catch(e){}}());else if("function"==typeof define&&define.amd)define(["Oidc","axios","multihashes"],t);else{var s="object"==typeof exports?t(require("Oidc"),require("axios"),function(){try{return require("multihashes")}catch(e){}}()):t(e.Oidc,e.axios,e.multihashes);for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(self,(function(e,t,s){return r={545:(e,t,s)=>{const r=s(480);class i{constructor(e=[],t=!1){if(this.listeners=[],this.processes={},this.addNamespace=t,e instanceof i)for(let t in e.processes)this.addAll(e.processes[t]);else this.addAll(e)}onChange(e,t,s){for(let r of this.listeners)r(e,t,s)}addAll(e,t="backend"){for(var s in e)this.add(e[s],t,!1);this.onChange("addAll",e,t)}add(e,t="backend",s=!0){if(!r.isObject(e))throw new Error("Invalid process; not an object.");if("string"!=typeof e.id)throw new Error("Invalid process; no id specified.");if("string"!=typeof t)throw new Error("Invalid namespace; not a string.");this.processes[t]||(this.processes[t]={}),e=Object.assign(this.addNamespace?{namespace:t}:{},e),this.processes[t][e.id]=e,s&&this.onChange("add",e,t)}count(){return r.size(this.all())}all(){let e=[];for(let t in this.processes)e=e.concat(Object.values(this.processes[t]));return e}hasNamespace(e){return"string"==typeof e&&Boolean(this.processes[e])}namespaces(){return Object.keys(this.processes).sort()}namespace(e){if("string"!=typeof e)return[];let t=this.processes[e];return t?Object.values(t):[]}has(e,t=null){return Boolean(this.get(e,t))}get(e,t=null){return"string"!=typeof e?null:null===t?this.get(e,"user")||this.get(e,"backend"):this.processes[t]&&this.processes[t][e]||null}remove(e=null,t="user"){if("string"!=typeof t)return!1;if(this.processes[t]){if("string"!=typeof e)return delete this.processes[t],this.onChange("remove",null,t),!0;if(this.processes[t][e]){let s=this.processes[t][e];return delete this.processes[t][e],0===r.size(this.processes[t])&&delete this.processes[t],this.onChange("remove",s,t),!0}}return!1}}e.exports=i},905:(e,t,s)=>{const r=s(480);class i{static normalizeJsonSchema(e,t=!1){e=r.isObject(e)?[e]:Array.isArray(e)?e:[];let s=[];for(let t of e)if(Array.isArray(t.allOf))s.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=r.omitFromObject(t,["oneOf","anyOf"]),i=t.oneOf||t.anyOf;for(let t of i)s.push(Object.assign({},e,t))}else s.push(t);if(!t)return s;e=[];for(let t of s)Array.isArray(t.type)?e=e.concat(t.type.map((e=>Object.assign({},t,{type:e})))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!r.isObject(e)||!e.schema)return[];let s,n=i.normalizeJsonSchema(e.schema);for(;s=t.shift();)n=n.map((e=>i.normalizeJsonSchema(i.getElementJsonSchema(e,s)))),n=n.concat(...n);let a=[];for(let e of n)if(Array.isArray(e.parameters)){if(a.length>0&&!r.equals(a,e.parameters))throw new Error("Multiple schemas with different callback parameters found.");a=e.parameters}return a}static getCallbackParametersForProcess(e,t,s=[]){if(!r.isObject(e)||!Array.isArray(e.parameters))return[];let n=e.parameters.find((e=>e.name===t));return i.getCallbackParameters(n,s)}static getNativeTypesForJsonSchema(e,t=!1){if(r.isObject(e)&&Array.isArray(e.type)){let s=r.unique(e.type).filter((e=>i.JSON_SCHEMA_TYPES.includes(e)));return s.length>0&&s.length<i.JSON_SCHEMA_TYPES.length?s:t?[]:i.JSON_SCHEMA_TYPES}return r.isObject(e)&&"string"==typeof e.type&&i.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:i.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let s=i.getNativeTypesForJsonSchema(e);if(r.isObject(e)&&s.includes("array")&&"string"!=typeof t){if(r.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&r.isObject(e.items[t]))return e.items[t];if(r.isObject(e.additionalItems))return e.additionalItems}}if(r.isObject(e)&&s.includes("object")){if(null!==t&&r.isObject(e.properties)&&r.isObject(e.properties[t]))return e.properties[t];if(r.isObject(e.additionalProperties))return e.additionalProperties}return{}}}i.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=i},480:(e,t,s)=>{var r=s(991);class i{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static hasText(e){return"string"==typeof e&&e.length>0}static equals(e,t){return r(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const s={};return t.forEach((t=>s[t]=e[t])),s}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var s=Object.assign({},e);for(let e of t)delete s[e];return s}static mapObject(e,t){const s=Object.keys(e),r=new Array(s.length);return s.forEach(((s,i)=>{r[i]=t(e[s],s,e)})),r}static mapObjectValues(e,t){e=Object(e);const s={};return Object.keys(e).forEach((r=>{s[r]=t(e[r],r,e)})),s}static unique(e,t=!1){return t?e.filter(((e,t,s)=>s.findIndex((t=>i.equals(e,t)))===t)):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let s=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),s+=t.replace(/\/$/,"")),s}static replacePlaceholders(e,t={}){if("string"==typeof e&&i.isObject(t))for(var s in t){let r=t[s];e=e.replace("{"+s+"}",Array.isArray(r)?r.join("; "):r)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map((e=>{if(e.length>=3){const t=(e,t,s)=>t+" "+s.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e}))).join(t)}static friendlyLinks(e,t=!0,s=["self"]){let r=[];if(!Array.isArray(e))return r;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&s.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=i.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),r.push(t));return t&&r.sort(((e,t)=>i.compareStringCaseInsensitive(e.title,t.title))),r}}e.exports=i},956:(e,t,s)=>{const r=s(247);class i{static compare(e,t,s=null){return null!==s?r.compare(e,t,s):r(e,t)}static validate(e){return r.validate(e)}static findCompatible(e,t=!0,s=null,r=null){if(!Array.isArray(e)||0===e.length)return[];let n=e.filter((e=>{if("string"==typeof e.url&&i.validate(e.api_version)){let t=i.validate(s),n=i.validate(r);return t&&n?i.compare(e.api_version,s,">=")&&i.compare(e.api_version,r,"<="):t?i.compare(e.api_version,s,">="):!n||i.compare(e.api_version,r,"<=")}return!1}));return 0===n.length?[]:n.sort(((e,s)=>{let r=!0===e.production,n=!0===s.production;return t&&r!==n?r?-1:1:-1*i.compare(e.api_version,s.api_version)}))}static findLatest(e,t=!0,s=null,r=null){let n=i.findCompatible(e,t,s,r);return n.length>0?n[0]:null}}e.exports=i},19:(e,t,s)=>{var r=s(247);const i="1.0.0",n={datacube:"https://stac-extensions.github.io/datacube/v1.0.0/schema.json",eo:"https://stac-extensions.github.io/eo/v1.0.0/schema.json",file:"https://stac-extensions.github.io/file/v1.0.0/schema.json","item-assets":"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",label:"https://stac-extensions.github.io/label/v1.0.0/schema.json",pointcloud:"https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json",processing:"https://stac-extensions.github.io/processing/v1.0.0/schema.json",projection:"https://stac-extensions.github.io/projection/v1.0.0/schema.json",raster:"https://stac-extensions.github.io/raster/v1.0.0/schema.json",sar:"https://stac-extensions.github.io/sar/v1.0.0/schema.json",sat:"https://stac-extensions.github.io/sat/v1.0.0/schema.json",scientific:"https://stac-extensions.github.io/scientific/v1.0.0/schema.json",timestamps:"https://stac-extensions.github.io/timestamps/v1.0.0/schema.json",version:"https://stac-extensions.github.io/version/v1.0.0/schema.json",view:"https://stac-extensions.github.io/view/v1.0.0/schema.json"},a={itemAndCollection:{"cube:":n.datacube,"eo:":n.eo,"file:":n.file,"label:":n.label,"pc:":n.pointcloud,"processing:":n.processing,"proj:":n.projection,"raster:":n.raster,"sar:":n.sar,"sat:":n.sat,"sci:":n.scientific,"view:":n.view,version:n.version,deprecated:n.version,published:n.timestamps,expires:n.timestamps,unpublished:n.timestamps},catalog:{},collection:{item_assets:n["item-assets"]},item:{}};a.collection=Object.assign(a.collection,a.itemAndCollection),a.item=Object.assign(a.item,a.itemAndCollection);var o={version:i,set(e){e||(e="0.6.0"),o.version=e},before:e=>r.compare(o.version,e,"<")},l={type(e){let t=typeof e;if("object"===t){if(null===e)return"null";if(Array.isArray(e))return"array"}return t},is:(e,t)=>l.type(e)===t,isDefined:e=>void 0!==e,isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),rename:(e,t,s)=>void 0!==e[t]&&void 0===e[s]&&(e[s]=e[t],delete e[t],!0),toArray:(e,t)=>void 0!==e[t]&&!Array.isArray(e[t])&&(e[t]=[e[t]],!0),flattenArray(e,t,s,r=!1){if(Array.isArray(e[t])){for(let i in e[t])if("string"==typeof s[i]){let n=e[t][i];e[s[i]]=r?[n]:n}return delete e[t],!0}return!1},flattenOneElementArray:(e,t,s=!1)=>!(!s&&Array.isArray(e[t]))||1===e[t].length&&(e[t]=e[t][0],!0),removeFromArray(e,t,s){if(Array.isArray(e[t])){let r=e[t].indexOf(s);return r>-1&&e[t].splice(r,1),!0}return!1},addToArrayIfNotExists:(e,t,s)=>!!Array.isArray(e[t])&&(-1===e[t].indexOf(s)&&e[t].push(s),e[t].sort(),!0),ensure:(e,t,s)=>(l.type(s)!==l.type(e[t])&&(e[t]=s),!0),addExtension:(e,t)=>!l.isObject(e)||l.addToArrayIfNotExists(e,"stac_extensions",t)&&true,removeExtension:(e,t)=>!l.isObject(e)||l.removeFromArray(e,"stac_extensions",t)&&true,migrateExtensionShortnames(e){let t=Object.keys(n),s=Object.values(n);return l.mapValues(e,"stac_extensions",t,s)},populateExtensions(e,t){let s=[];"catalog"!=t&&"collection"!=t||s.push(e),"item"!=t&&"collection"!=t||!l.isObject(e.assets)||(s=s.concat(Object.values(e.assets))),"collection"==t&&l.isObject(e.item_assets)&&(s=s.concat(Object.values(e.item_assets))),"collection"==t&&l.isObject(e.summaries)&&(s=s.concat(Object.values(e.summaries))),"item"==t&&l.isObject(e.properties)&&s.push(e.properties);for(let r of s)Object.keys(r).forEach((s=>{let r=s.match(/^(\w+:|[^:]+$)/i);if(Array.isArray(r)){let s=a[t][r[0]];l.is(s,"string")&&l.addExtension(e,s)}}))},mapValues(e,t,s,r){let i=e=>{let t=s.indexOf(e);return t>=0?r[t]:e};return Array.isArray(e[t])?e[t]=e[t].map(i):void 0!==e[t]&&(e[t]=i(e[t])),!0},mapObject(e,t){for(let s in e)e[s]=t(e[s],s)},moveTo:(e,t,s,r=!1,i=!1)=>(condition=r?i?e=>Array.isArray(e):e=>Array.isArray(e)&&1===e.length:l.isDefined,!!condition(e[t])&&(s[t]=r&&!i?e[t][0]:e[t],delete e[t],!0)),runAll(e,t,s=null){for(let r in e)r.startsWith("migrate")||e[r](t,s)},toUTC(e,t){if("string"==typeof e[t])try{return e[t]=this.toISOString(e[t]),!0}catch(e){}return delete e[t],!1},toISOString:e=>(e instanceof Date||(e=new Date(e)),e.toISOString().replace(".000",""))},c={hexToUint8(e){if(0===e.length||e.length%2!=0)throw new Error(`The string "${e}" is not valid hex.`);return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},uint8ToHex:e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),toMultihash(e,t,r){if(!l.is(e[t],"string"))return!1;try{const i=s(263).encode(c.hexToUint8(e[t]),r);return e[t]=c.uint8ToHex(i),!0}catch(e){return console.warn(e),!1}}},u={migrate(e,t=!0){o.set(e.stac_version),t&&(e.stac_version=i),e.type="Catalog",o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"id",""),l.ensure(e,"description",""),l.ensure(e,"links",[]),l.runAll(u,e,e),l.ensure(e,"stac_extensions",[]),o.before("0.8.0")&&l.populateExtensions(e,"catalog")}},d={migrate(e,t=!0){u.migrate(e,t),e.type="Collection",o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"license","proprietary"),l.ensure(e,"extent",{spatial:{bbox:[]},temporal:{interval:[]}}),l.runAll(d,e,e),l.isObject(e.properties)&&(l.removeFromArray(e,"stac_extensions","commons"),delete e.properties),o.before("0.8.0")&&l.populateExtensions(e,"collection"),o.before("1.0.0-beta.1")&&l.mapValues(e,"stac_extensions",["assets"],["item-assets"])},extent(e){if(o.before("0.8.0")&&(Array.isArray(e.extent.spatial)&&(e.extent.spatial={bbox:[e.extent.spatial]}),Array.isArray(e.extent.temporal)&&(e.extent.temporal={interval:[e.extent.temporal]})),o.before("1.0.0-rc.3")){if(Array.isArray(e.extent.temporal.interval)&&e.extent.temporal.interval.length>1){let t,s;for(let r of e.extent.temporal.interval){if(null===r[0])t=null;else if("string"==typeof r[0]&&null!==t)try{let e=new Date(r[0]);(void 0===t||e<t)&&(t=e)}catch(e){}if(null===r[1])s=null;else if("string"==typeof r[1]&&null!==s)try{let e=new Date(r[1]);(void 0===s||e>s)&&(s=e)}catch(e){}}e.extent.temporal.interval.unshift([t?l.toISOString(t):null,s?l.toISOString(s):null])}if(Array.isArray(e.extent.spatial.bbox)&&e.extent.spatial.bbox.length>1){let t=e.extent.spatial.bbox.reduce(((e,t)=>Array.isArray(t)?Math.max(t.length,e):e),4);if(t>=4){let s=new Array(t).fill(null),r=t/2;for(let t of e.extent.spatial.bbox){if(!Array.isArray(t)||t.length<4)break;for(let e in t){let i=t[e];null===s[e]?s[e]=i:s[e]=e<r?Math.min(i,s[e]):Math.max(i,s[e])}}-1===s.findIndex((e=>null===e))&&e.extent.spatial.bbox.unshift(s)}}}},collectionAssets(e){o.before("1.0.0-rc.1")&&l.removeExtension(e,"collection-assets"),p.migrateAll(e)},itemAsset(e){o.before("1.0.0-beta.2")&&l.rename(e,"item_assets","assets"),p.migrateAll(e,"item_assets")},summaries(e){if(l.ensure(e,"summaries",{}),o.before("0.8.0")&&l.isObject(e.other_properties)){for(let t in e.other_properties){let s=e.other_properties[t];Array.isArray(s.extent)&&2===s.extent.length?e.summaries[t]={minimum:s.extent[0],maximum:s.extent[1]}:Array.isArray(s.values)&&(s.values.filter((e=>Array.isArray(e))).length===s.values.length?e.summaries[t]=s.values.reduce(((e,t)=>e.concat(t)),[]):e.summaries[t]=s.values)}delete e.other_properties}if(o.before("1.0.0-beta.1")&&l.isObject(e.properties)&&!e.links.find((e=>["child","item"].includes(e.rel))))for(let t in e.properties){let s=e.properties[t];Array.isArray(s)||(s=[s]),e.summaries[t]=s}o.before("1.0.0-rc.1")&&l.mapObject(e.summaries,(e=>(l.rename(e,"min","minimum"),l.rename(e,"max","maximum"),e))),f.migrate(e.summaries),l.moveTo(e.summaries,"sci:doi",e,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"sci:publications",e,!0,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"sci:citation",e,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"cube:dimensions",e,!0)&&l.addExtension(e,n.datacube),0===Object.keys(e.summaries).length&&delete e.summaries}},h={migrate(e,t=null,s=!0){o.set(e.stac_version),s&&(e.stac_version=i),o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"id",""),l.ensure(e,"type","Feature"),l.isObject(e.geometry)||(e.geometry=null),null!==e.geometry&&l.ensure(e,"bbox",[]),l.ensure(e,"properties",{}),l.ensure(e,"links",[]),l.ensure(e,"assets",{});let r=!1;l.isObject(t)&&l.isObject(t.properties)&&(l.removeFromArray(e,"stac_extensions","commons"),e.properties=Object.assign({},t.properties,e.properties),r=!0),l.runAll(h,e,e),f.migrate(e.properties,e),p.migrateAll(e),l.ensure(e,"stac_extensions",[]),(o.before("0.8.0")||r)&&l.populateExtensions(e,"item")}},p={migrateAll(e,t="assets"){for(let s in e[t])p.migrate(e[t][s],e)},migrate(e,t){l.runAll(p,e,t),f.migrate(e,t)},mediaTypes(e){l.is(e.type,"string")&&l.mapValues(e,"type",["image/vnd.stac.geotiff","image/vnd.stac.geotiff; cloud-optimized=true"],["image/tiff; application=geotiff","image/tiff; application=geotiff; profile=cloud-optimized"])},eo(e,t){let s=l.isObject(t.properties)&&Array.isArray(t.properties["eo:bands"])?t.properties["eo:bands"]:[];if(Array.isArray(e["eo:bands"]))for(let t in e["eo:bands"]){let r=e["eo:bands"][t];l.is(r,"number")&&l.isObject(s[r])?r=s[r]:l.isObject(r)||(r={}),e["eo:bands"][t]=r}}},f={migrate(e,t){l.runAll(f,e,t)},_commonMetadata(e){o.before("1.0.0-rc.3")&&(l.toUTC(e,"created"),l.toUTC(e,"updated"))},_timestamps(e){l.toUTC(e,"published"),l.toUTC(e,"expires"),l.toUTC(e,"unpublished")},_versioningIndicator(e){},checksum(e,t){o.before("0.9.0")&&(l.rename(e,"checksum:md5","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","md5"),l.rename(e,"checksum:sha1","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha1"),l.rename(e,"checksum:sha2","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha2-256"),l.rename(e,"checksum:sha3","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha3-256")),o.before("1.0.0-rc.1")&&l.rename(e,"checksum:multihash","file:checksum")&&l.addExtension(t,n.file)},cube(){},dtr(e,t){o.before("0.9.0")&&(l.rename(e,"dtr:start_datetime","start_datetime"),l.rename(e,"dtr:end_datetime","end_datetime"),l.removeExtension(t,"datetime-range"))},eo(e,t){o.before("0.9.0")&&(l.rename(e,"eo:epsg","proj:epsg")&&l.addExtension(t,n.projection),l.rename(e,"eo:platform","platform"),l.rename(e,"eo:instrument","instruments")&&l.toArray(e,"instruments"),l.rename(e,"eo:constellation","constellation"),l.rename(e,"eo:off_nadir","view:off_nadir")&&l.addExtension(t,n.view),l.rename(e,"eo:azimuth","view:azimuth")&&l.addExtension(t,n.view),l.rename(e,"eo:incidence_angle","view:incidence_angle")&&l.addExtension(t,n.view),l.rename(e,"eo:sun_azimuth","view:sun_azimuth")&&l.addExtension(t,n.view),l.rename(e,"eo:sun_elevation","view:sun_elevation")&&l.addExtension(t,n.view)),o.before("1.0.0-beta.1")&&l.rename(e,"eo:gsd","gsd")},label(e){o.before("0.8.0")&&(l.rename(e,"label:property","label:properties"),l.rename(e,"label:task","label:tasks"),l.rename(e,"label:overview","label:overviews")&&l.toArray(e,"label:overviews"),l.rename(e,"label:method","label:methods"),l.toArray(e,"label:classes"))},pc(e){o.before("0.8.0")&&l.rename(e,"pc:schema","pc:schemas")},proj(e){},sar(e,t){let s=!t;l.rename(e,"sar:incidence_angle","view:incidence_angle")&&l.addExtension(t,n.view),l.rename(e,"sar:pass_direction","sat:orbit_state")&&l.mapValues(e,"sat:orbit_state",[null],["geostationary"])&&l.addExtension(t,n.sat),o.before("0.7.0")&&(l.flattenArray(e,"sar:resolution",["sar:resolution_range","sar:resolution_azimuth"],s),l.flattenArray(e,"sar:pixel_spacing",["sar:pixel_spacing_range","sar:pixel_spacing_azimuth"],s),l.flattenArray(e,"sar:looks",["sar:looks_range","sar:looks_azimuth","sar:looks_equivalent_number"],s),l.rename(e,"sar:off_nadir","view:off_nadir")&&l.addExtension(t,n.view)),o.before("0.9.0")&&(l.rename(e,"sar:platform","platform"),l.rename(e,"sar:instrument","instruments")&&l.toArray(e,"instruments"),l.rename(e,"sar:constellation","constellation"),l.rename(e,"sar:type","sar:product_type"),l.rename(e,"sar:polarization","sar:polarizations"),l.flattenOneElementArray(e,"sar:absolute_orbit",s)&&l.rename(e,"sar:absolute_orbit","sat:absolute_orbit")&&l.addExtension(t,n.sat),l.flattenOneElementArray(e,"sar:relative_orbit",s)&&l.rename(e,"sar:relative_orbit","sat:relative_orbit")&&l.addExtension(t,n.sat))},sat(e){o.before("0.9.0")&&(l.rename(e,"sat:off_nadir_angle","sat:off_nadir"),l.rename(e,"sat:azimuth_angle","sat:azimuth"),l.rename(e,"sat:sun_azimuth_angle","sat:sun_azimuth"),l.rename(e,"sat:sun_elevation_angle","sat:sun_elevation"))},sci(e){},item(e){o.before("0.8.0")&&(l.rename(e,"item:license","license"),l.rename(e,"item:providers","providers"))},view(e){}},m={item:(e,t=null,s=!0)=>(h.migrate(e,t,s),e),catalog:(e,t=!0)=>(u.migrate(e,t),e),collection:(e,t=!0)=>(d.migrate(e,t),e),stac:(e,t=!0)=>"Feature"===e.type?m.item(e,null,t):"Collection"===e.type||l.isDefined(e.extent)||l.isDefined(e.license)?m.collection(e,t):m.catalog(e,t)};e.exports=m},439:e=>{e.exports=class{constructor(e,t,s){this.id=s.id||null,this.title=s.title||"",this.description=s.description||"",this.type=e,this.connection=t,this.token=null}getId(){let e=this.getType();return this.getProviderId().length>0&&(e+="."+this.getProviderId()),e}getType(){return this.type}getProviderId(){return"string"==typeof this.id?this.id:""}getTitle(){return this.title}getDescription(){return this.description}getToken(){return"string"==typeof this.token?this.getType()+"/"+this.getProviderId()+"/"+this.token:null}setToken(e){this.token=e,this.connection.emit("tokenChanged",e),null!==this.token?this.connection.setAuthProvider(this):this.connection.setAuthProvider(null)}async login(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];throw new Error("Not implemented.",t)}async logout(){this.setToken(null)}}},337:e=>{e.exports=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.connection=e,this.apiToClientNames={},this.clientToApiNames={},this.lastRefreshTime=0,this.extra={};for(let e in t){let s,r;Array.isArray(t[e])?(s=t[e][0],r=t[e][1]):(s=t[e],r=t[e]),this.apiToClientNames[s]=r,this.clientToApiNames[r]=s}}toJSON(){let e={};for(let t in this.clientToApiNames){let s=this.clientToApiNames[t];void 0!==this[t]&&(e[s]=this[t])}return Object.assign(e,this.extra)}setAll(e){for(let t in e)void 0===this.apiToClientNames[t]?this.extra[t]=e[t]:this[this.apiToClientNames[t]]=e[t];return this.lastRefreshTime=Date.now(),this}getDataAge(){return(Date.now()-this.lastRefreshTime)/1e3}getAll(){let e={};for(let t in this.apiToClientNames){let s=this.apiToClientNames[t];void 0!==this[s]&&(e[s]=this[s])}return Object.assign(e,this.extra)}get(e){return void 0!==this.extra[e]?this.extra[e]:null}_convertToRequest(e){let t={};for(let s in e)void 0===this.clientToApiNames[s]?t[s]=e[s]:t[this.clientToApiNames[s]]=e[s];return t}_supports(e){return this.connection.capabilities().hasFeature(e)}}},112:(e,t,s)=>{const r=s(56),i=s(480),n=s(439);e.exports=class extends n{constructor(e){super("basic",e,{id:null,title:"HTTP Basic",description:"Login with username and password using the method HTTP Basic."})}async login(e,t){let s=await this.connection._send({method:"get",responseType:"json",url:"/credentials/basic",headers:{Authorization:"Basic "+r.base64encode(e+":"+t)}});if(!i.isObject(s.data)||"string"!=typeof s.data.access_token)throw new Error("No access_token returned.");this.setToken(s.data.access_token)}}},56:e=>{e.exports=class{static getName(){return"Browser"}static getUrl(){return window.location.toString()}static setUrl(e){throw new Error("setUrl is not supported in a browser environment.")}static handleErrorResponse(e){return new Promise(((t,s)=>{let r=new FileReader;r.onerror=e=>{r.abort(),s(e.target.error)},r.onload=()=>{let e=r.result instanceof ArrayBuffer?String.fromCharCode.apply(null,new Uint16Array(r.result)):r.result,s="string"==typeof e?JSON.parse(e):e;t(s)},r.readAsText(e.response.data)}))}static getResponseType(){return"blob"}static base64encode(e){return btoa(e)}static fileNameForUpload(e){return e.name.split(/(\\|\/)/g).pop()}static dataForUpload(e){return e}static async downloadResults(e,t,s){throw new Error("downloadResults is not supported in a browser environment.")}static saveToFile(e,t){return new Promise(((s,r)=>{try{e instanceof Blob||(e=new Blob([e],{type:"application/octet-stream"}));let r=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=r,i.setAttribute("download",t||"download"),void 0===i.download&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r),s()}catch(e){console.error(e),r(e)}}))}}},966:(e,t,s)=>{const r=s(985),i=s(917),n=s(300).default,a=s(480),o=s(905),l=s(545),c=["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links"];class u{static async fromVersion(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t="https://processes.openeo.org/processes.json";return"string"==typeof e&&(t="https://processes.openeo.org/"+e+"/processes.json"),await u.fromURL(t)}static async fromURL(e){let t=await n(e);return new u(t.data)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(this.id=s,this.parent=t,this.parentNode=null,this.parentParameter=null,this.nodes={},this.idCounter={},this.callbackParameterCache={},this.parameters=void 0,this.processes=null,e instanceof l)this.processes=e;else if(a.isObject(e)&&Array.isArray(e.processes))this.processes=new l(e.processes);else{if(!Array.isArray(e))throw new Error("Processes are invalid; must be array or object according to the API.");this.processes=new l(e)}this.processes.all().forEach((e=>this.createFunction(e)))}createFunction(e){if(void 0!==this[e.id])throw new Error("Can't create function for process '"+e.id+"'. Already exists in Builder class.");this[e.id]=function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return this.process(e.id,s)}}addProcessSpec(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!a.isObject(e))throw new Error("Process '"+e.id+"' must be an object.");t||(t="backend"),this.processes.add(e,t),"backend"===t&&this.createFunction(e)}setParent(e,t){this.parentNode=e,this.parentParameter=t}createCallbackParameter(e){return this.callbackParameterCache[e]||(this.callbackParameterCache[e]=i.create(this,e)),this.callbackParameterCache[e]}getParentCallbackParameters(){let e=[];if(this.parentNode&&this.parentParameter)try{e=o.getCallbackParametersForProcess(this.parentNode.spec,this.parentParameter).map((e=>this.createCallbackParameter(e.name)))}catch(e){console.warn(e)}return e}addParameter(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0!==this.getParentCallbackParameters().find((t=>t.name===e.name)))return;let s=this;if(t)for(;s.parent;)s=s.parent;Array.isArray(s.parameters)||(s.parameters=[]);let r=s.parameters.findIndex((t=>t.name===e.name));-1!==r?Object.assign(s.parameters[r],e):s.parameters.push(e)}spec(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.processes.get(e,t)}math(e){let t=new(s(456))(e);return t.setBuilder(this),t.generate(!1)}supports(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Boolean(this.spec(e,t))}process(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=null;if(e.includes("@")){let t;[e,...t]=e.split("@"),i=t.join("@")}let n=new r(this,e,t,s,i);return this.nodes[n.id]=n,n}toJSON(){let e={process_graph:a.mapObjectValues(this.nodes,(e=>e.toJSON()))};return c.forEach((t=>{void 0!==this[t]&&(e[t]=this[t])})),e}generateId(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.replace("_","").substr(0,6),this.idCounter[e]?this.idCounter[e]++:this.idCounter[e]=1,e+this.idCounter[e]}}e.exports=u},456:(e,t,s)=>{const r=s(126),i=s(917),n=s(985);class a{constructor(e){let t=new r.Parser;this.tree=t.parse(e),this.builder=null}setBuilder(e){this.builder=e}generate(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.parseTree(this.tree);if(!(t instanceof n))throw new Error("Invalid formula specified.");return e&&(t.result=!0),t}parseTree(e){let t=Object.keys(e)[0];switch(t){case"Number":return parseFloat(e.Number);case"Identifier":return this.getRef(e.Identifier);case"Expression":return this.parseTree(e.Expression);case"FunctionCall":{let t=[];for(let s in e.FunctionCall.args)t.push(this.parseTree(e.FunctionCall.args[s]));return this.builder.process(e.FunctionCall.name,t)}case"Binary":return this.addOperatorProcess(e.Binary.operator,this.parseTree(e.Binary.left),this.parseTree(e.Binary.right));case"Unary":{let t=this.parseTree(e.Unary.expression);return"-"===e.Unary.operator?"number"==typeof t?-t:this.addOperatorProcess("*",-1,t):t}default:throw new Error("Operation "+t+" not supported.")}}getRef(e){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("string"==typeof e&&e.startsWith("#")){let t=e.substring(1);if(t in this.builder.nodes)return{from_node:t}}let t=this.builder.getParentCallbackParameters();if("string"==typeof e&&t.length>0){let s=e.match(/^\$+/),r=s?s[0].length:0;if(r>0&&t.length>=r){let s=e.substring(r);return t[r-1][s]}}let s=new i(e);return this.builder.addParameter(s),s}addOperatorProcess(e,t,s){let r=a.operatorMapping[e],i=this.builder.spec(r);if(r&&i){let n={};if(!Array.isArray(i.parameters)||i.parameters.length<2)throw new Error("Process for operator "+e+" must have at least two parameters");return n[i.parameters[0].name||"x"]=t,n[i.parameters[1].name||"y"]=s,this.builder.process(r,n)}throw new Error("Operator "+e+" not supported")}}a.operatorMapping={"-":"subtract","+":"add","/":"divide","*":"multiply","^":"power"},e.exports=a},985:(e,t,s)=>{const r=s(480),i=s(917);class n{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(this.parent=e,this.spec=this.parent.spec(t,i),!this.spec)throw new Error("Process doesn't exist: "+t);this.id=e.generateId(t),this.namespace=i,this.arguments=Array.isArray(s)?this.namedArguments(s):s,this._description=r,this.result=!1,this.addParametersToProcess(this.arguments)}namedArguments(e){if(e.length>(this.spec.parameters||[]).length)throw new Error("More arguments specified than parameters available.");let t={};if(Array.isArray(this.spec.parameters))for(let s=0;s<this.spec.parameters.length;s++)t[this.spec.parameters[s].name]=e[s];return t}addParametersToProcess(e){for(let t in e){let s=e[t];s instanceof i?r.isObject(s.spec.schema)&&this.parent.addParameter(s.spec):s instanceof n?this.addParametersToProcess(s.arguments):(Array.isArray(s)||r.isObject(s))&&this.addParametersToProcess(s)}}description(e){return void 0===e?this._description:(this._description=e,this)}exportArgument(e,t){const a=s(456);if(r.isObject(e)){if(e instanceof n||e instanceof i)return e.ref();if(e instanceof a){let s=this.createBuilder(this,t);return e.setBuilder(s),e.generate(),s.toJSON()}if(e instanceof Date)return e.toISOString();if("function"==typeof e.toJSON)return e.toJSON();{let s={};for(let r in e)void 0!==e[r]&&(s[r]=this.exportArgument(e[r],t));return s}}return Array.isArray(e)?e.map((e=>this.exportArgument(e)),t):"function"==typeof e?this.exportCallback(e,t):e}createBuilder(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=new(s(966))(this.parent.processes,this.parent);return null!==e&&null!==t&&r.setParent(e,t),r}exportCallback(e,t){let s=this.createBuilder(this,t),i=s.getParentCallbackParameters(),a=e.bind(s)(...i,s);if(Array.isArray(a)&&s.supports("array_create")?a=s.array_create(a):!r.isObject(a)&&s.supports("constant")&&(a=s.constant(a)),a instanceof n)return a.result=!0,s.toJSON();throw new Error("Callback must return BuilderNode")}toJSON(){let e={process_id:this.spec.id,arguments:{}};this.namespace&&(e.namespace=this.namespace);for(let t in this.arguments)void 0!==this.arguments[t]&&(e.arguments[t]=this.exportArgument(this.arguments[t],t));return"function"!=typeof this.description?e.description=this.description:"string"==typeof this._description&&(e.description=this._description),this.result&&(e.result=!0),e}ref(){return{from_node:this.id}}}e.exports=n},917:e=>{"use strict";class t{static create(e,s){let r=new t(s,null);if("undefined"!=typeof Proxy)return new Proxy(r,{nodeCache:{},get(t,s,i){if(!Reflect.has(t,s)){if(!this.nodeCache[s]){let t={data:r};"string"==typeof s&&s.match(/^(0|[1-9]\d*)$/)?t.index=parseInt(s,10):t.label=s,this.nodeCache[s]=e.process("array_element",t)}return this.nodeCache[s]}return Reflect.get(t,s,i)},set(e,t,s,r){if(!Reflect.has(e,t))throw new Error("Simplified array access is read-only");return Reflect.set(e,t,s,r)}});throw new Error("Simplified array access not supported, use array_element directly")}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;this.name=e,this.spec={name:e,schema:"string"==typeof t?{type:t}:t,description:s},void 0!==r&&(this.spec.optional=!0,this.spec.default=r)}toJSON(){return this.spec}ref(){return{from_parameter:this.name}}}e.exports=t},126:e=>{let t={Token:{Operator:"Operator",Identifier:"Identifier",Number:"Number"}};const s={"⁰":0,"¹":1,"²":2,"³":3,"⁴":4,"⁵":5,"⁶":6,"⁷":7,"⁸":8,"⁹":9},r=Object.keys(s).join("");t.Lexer=function(){let e="",s=0,i=0,n=0,a=t.Token;function o(){let t=i;return t<s?e.charAt(t):"\0"}function l(){let t="\0",r=i;return r<s&&(t=e.charAt(r),i+=1),t}function c(e){return"\t"===e||" "===e||" "===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function d(e){return e>="0"&&e<="9"}function h(e,t){return{type:e,value:t,start:n,end:i-1}}function p(e){return"-"===e||"."===e||"~"===e||"@"===e}function f(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"_"===e||u(e)||d(e)||t&&p(e)}function m(){let e;if(function(){let e;for(;i<s&&(e=o(),c(e));)l()}(),!(i>=s)){if(n=i,e=function(){let e,t;if(e=o(),d(e)||"."===e){if(t="","."!==e)for(t=l();e=o(),d(e);)t+=l();if("."===e)for(t+=l();e=o(),d(e);)t+=l();if("e"===e||"E"===e){if(t+=l(),e=o(),"+"!==e&&"-"!==e&&!d(e))throw e="character "+e,i>=s&&(e="<end>"),new SyntaxError("Unexpected "+e+" after the exponent sign");for(t+=l();e=o(),d(e);)t+=l()}if("."===t)throw new SyntaxError("Expecting decimal digits after the dot sign");return h(a.Number,t)}}(),void 0!==e)return e;if(e=function(){let e=o();if(("+-*/()^,"+r).indexOf(e)>=0)return h(a.Operator,l())}(),void 0!==e)return e;if(e=function(){let e=o();if("_"!==(t=e)&&"#"!==t&&"$"!==t&&!u(t))return;var t;let s=l(),r=!1;for(;;){let t=o();if("$"===e)"$"!==t&&(e="");else if("@"===t)r=!0;else if(!f(t,r))break;s+=l()}return h(a.Identifier,s)}(),void 0!==e)return e;throw new SyntaxError("Unknown token from character "+o())}}return{reset:function(t){e=t,s=t.length,i=0},next:m,peek:function(){let e,t=i;try{e=m(),delete e.start,delete e.end}catch(t){e=void 0}return i=t,e}}},t.Parser=function(){let e=new t.Lexer,i=t.Token;function n(e,t){return void 0!==e&&e.type===i.Operator&&t.includes(e.value)}function a(){let t,s=e.peek();return n(s,"-+")?(s=e.next(),t=a(),{Unary:{operator:s.value,expression:t}}):function(){let t,s=e.peek();if(void 0===s)throw new SyntaxError("Unexpected termination of expression");if(s.type===i.Identifier)return s=e.next(),n(e.peek(),"(")?function(t){let s=[],r=e.next();if(!n(r,"("))throw new SyntaxError('Expecting ( in a function call "'+t+'"');if(r=e.peek(),n(r,")")||(s=function(){let t,s,r=[];for(;s=c(),void 0!==s&&(r.push(s),t=e.peek(),n(t,","));)e.next();return r}()),r=e.next(),!n(r,")"))throw new SyntaxError('Expecting ) in a function call "'+t+'"');return{FunctionCall:{name:t,args:s}}}(s.value):{Identifier:s.value};if(s.type===i.Number)return s=e.next(),{Number:s.value};if(n(s,"(")){if(e.next(),t=c(),s=e.next(),!n(s,")"))throw new SyntaxError("Expecting )");return{Expression:t}}throw new SyntaxError("Parse error, can not process token "+s.value)}()}function o(){let t=a(),i=e.peek();for(;n(i,"^"+r);)i=e.next(),t={Binary:{operator:"^",left:t,right:"^"!==i.value?(o=i.value,"number"==typeof s[o]?{Number:s[o]}:null):a()}},i=e.peek();var o;return t}function l(){let t=o(),s=e.peek();for(;n(s,"*/");)s=e.next(),t={Binary:{operator:s.value,left:t,right:o()}},s=e.peek();return t}function c(){return function(){let t=l(),s=e.peek();for(;n(s,"+-");)s=e.next(),t={Binary:{operator:s.value,left:t,right:l()}},s=e.peek();return t}()}return{parse:function(t){e.reset(t);let s=c(),r=e.next();if(void 0!==r)throw new SyntaxError("Unexpected token "+r.value);return{Expression:s}}}},e.exports=t},11:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e){if(!r.isObject(e))throw new Error("No capabilities retrieved.");if(!e.api_version)throw new Error("Invalid capabilities: No API version retrieved");if(!Array.isArray(e.endpoints))throw new Error("Invalid capabilities: No endpoints retrieved");this.data=e,this.features=this.data.endpoints.map((e=>e.methods.map((t=>(t+" "+e.path).toLowerCase())))).reduce(((e,t)=>e.concat(t)),[]),this.featureMap={capabilities:!0,listFileTypes:"get /file_formats",listServiceTypes:"get /service_types",listUdfRuntimes:"get /udf_runtimes",listCollections:"get /collections",describeCollection:"get /collections/{collection_id}",listCollectionItems:"get /collections/{collection_id}/items",listProcesses:"get /processes",describeProcess:"get /processes",listAuthProviders:!0,authenticateOIDC:"get /credentials/oidc",authenticateBasic:"get /credentials/basic",describeAccount:"get /me",listFiles:"get /files",getFile:"get /files",uploadFile:"put /files/{path}",downloadFile:"get /files/{path}",deleteFile:"delete /files/{path}",validateProcess:"post /validation",listUserProcesses:"get /process_graphs",describeUserProcess:"get /process_graphs/{process_graph_id}",getUserProcess:"get /process_graphs/{process_graph_id}",setUserProcess:"put /process_graphs/{process_graph_id}",replaceUserProcess:"put /process_graphs/{process_graph_id}",deleteUserProcess:"delete /process_graphs/{process_graph_id}",computeResult:"post /result",listJobs:"get /jobs",createJob:"post /jobs",listServices:"get /services",createService:"post /services",getJob:"get /jobs/{job_id}",describeJob:"get /jobs/{job_id}",updateJob:"patch /jobs/{job_id}",deleteJob:"delete /jobs/{job_id}",estimateJob:"get /jobs/{job_id}/estimate",debugJob:"get /jobs/{job_id}/logs",startJob:"post /jobs/{job_id}/results",stopJob:"delete /jobs/{job_id}/results",listResults:"get /jobs/{job_id}/results",downloadResults:"get /jobs/{job_id}/results",describeService:"get /services/{service_id}",getService:"get /services/{service_id}",updateService:"patch /services/{service_id}",deleteService:"delete /services/{service_id}",debugService:"get /services/{service_id}/logs"}}toJSON(){return this.data}apiVersion(){return this.data.api_version}backendVersion(){return this.data.backend_version}title(){return"string"==typeof this.data.title?this.data.title:""}description(){return"string"==typeof this.data.description?this.data.description:""}isStable(){return!0===this.data.production}links(){return Array.isArray(this.data.links)?this.data.links:[]}listFeatures(){let e=[];for(let t in this.featureMap)(!0===this.featureMap[t]||this.features.includes(this.featureMap[t]))&&e.push(t);return e.sort()}hasFeature(e){return!0===this.featureMap[e]||this.features.some((t=>t===this.featureMap[e]))}currency(){return r.isObject(this.data.billing)&&"string"==typeof this.data.billing.currency?this.data.billing.currency:null}listPlans(){if(r.isObject(this.data.billing)&&Array.isArray(this.data.billing.plans)){let e="string"==typeof this.data.billing.default_plan?this.data.billing.default_plan.toLowerCase():null;return this.data.billing.plans.map((t=>{let s={default:e===t.name.toLowerCase()};return Object.assign({},t,s)}))}return[]}}},398:(e,t,s)=>{const r=s(56),i=s(480),n=s(545),a=s(300).default,o=s(19),l=s(439),c=s(112),u=s(833),d=s(11),h=s(113),p=s(291),f=s(512),m=s(49),g=s(295),y=s(966),b=s(985);e.exports=class{constructor(e){var t=this;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.url=r,this.baseUrl=i.normalizeUrl(e),this.authProviderList=null,this.authProvider=null,this.capabilitiesObject=null,this.listeners={},this.options=s,this.processes=new n([],Boolean(s.addNamespaceToProcess)),this.processes.listeners.push((function(){for(var e=arguments.length,s=new Array(e),r=0;r<e;r++)s[r]=arguments[r];return t.emit("processesChanged",...s)}))}async init(){let e=await this._get("/");return this.capabilitiesObject=new d(e.data),this.capabilitiesObject}async refreshProcessCache(){if(0===this.processes.count())return;let e=this.processes.namespaces().map((e=>{let t=()=>Promise.resolve();return"user"===e?this.isAuthenticated()?this.capabilities().hasFeature("listUserProcesses")&&(t=()=>this.listUserProcesses()):t=()=>this.processes.remove(null,"user")?Promise.resolve():Promise.reject(new Error("Can't clear user processes")):this.capabilities().hasFeature("listProcesses")&&(t=()=>this.listProcesses(e)),t().catch((t=>console.warn(`Could not update processes for namespace '${e}' due to an error: ${t.message}`)))}));return await Promise.all(e)}getBaseUrl(){return this.baseUrl}getUrl(){return this.url||this.baseUrl}capabilities(){return this.capabilitiesObject}async listFileTypes(){let e=await this._get("/file_formats");return new h(e.data)}async listServiceTypes(){return(await this._get("/service_types")).data}async listUdfRuntimes(){return(await this._get("/udf_runtimes")).data}async listCollections(){let e=await this._get("/collections");return i.isObject(e.data)&&Array.isArray(e.data.collections)&&(e.data.collections=e.data.collections.map((e=>o.collection(e)))),e.data}async describeCollection(e){let t=await this._get("/collections/"+e);return o.collection(t.data)}async*listCollectionItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=1,a="/collections/"+e+"/items";for(;a;){let e={};1===n&&(Array.isArray(t)&&(e.bbox=t.join(",")),Array.isArray(s)&&(e.datetime=s.map((e=>e instanceof Date?e.toISOString():"string"==typeof e?e:"..")).join("/")),r>0&&(e.limit=r));let l=await this._get(a,e);i.isObject(l.data)&&Array.isArray(l.data.features)&&(l.data.features=l.data.features.map((e=>o.item(e)))),yield l.data,n++,a=this._getLinkHref(l.data.links)}}normalizeNamespace(e){const t=e.match(/^https?:\/\/.*\/processes\/(@?[\w\-.~:]+)\/?/i);return t&&t.length>1?t[1]:e}async listProcesses(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e||(e="backend");let t="backend"===e?"/processes":`/processes/${this.normalizeNamespace(e)}`,s=await this._get(t);if(!i.isObject(s.data)||!Array.isArray(s.data.processes))throw new Error("Invalid response received for processes");return this.processes.remove(null,e),this.processes.addAll(s.data.processes,e),Object.assign(s.data,{processes:this.processes.namespace(e)})}async describeProcess(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t||(t="backend"),"backend"===t)await this.listProcesses();else{let s=await this._get(`/processes/${this.normalizeNamespace(t)}/${e}`);if(!i.isObject(s.data)||"string"!=typeof s.data.id)throw new Error("Invalid response received for process");this.processes.add(s.data,t)}return this.processes.get(e,t)}async buildProcess(e){return await this.listProcesses(),new y(this.processes,null,e)}async listAuthProviders(){if(null!==this.authProviderList)return this.authProviderList;this.authProviderList=[];let e=this.capabilities();if(e.hasFeature("authenticateOIDC")){let e=await this._get("/credentials/oidc"),t=this.getOidcProviderFactory();if(i.isObject(e.data)&&Array.isArray(e.data.providers)&&"function"==typeof t)for(let s in e.data.providers){let r=t(e.data.providers[s]);r instanceof l&&this.authProviderList.push(r)}}return e.hasFeature("authenticateBasic")&&this.authProviderList.push(new c(this)),this.authProviderList}setOidcProviderFactory(e){this.oidcProviderFactory=e}getOidcProviderFactory(){return"function"==typeof this.oidcProviderFactory?this.oidcProviderFactory:u.isSupported()?e=>new u(this,e):null}async authenticateBasic(e,t){let s=new c(this);await s.login(e,t)}isAuthenticated(){return null!==this.authProvider}emit(e){if("function"==typeof this.listeners[e]){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];this.listeners[e](...s)}}on(e,t){this.listeners[e]=t}off(e){delete this.listeners[e]}getAuthProvider(){return this.authProvider}setAuthProvider(e){e!==this.authProvider&&(this.authProvider=e instanceof l?e:null,this.emit("authProviderChanged",this.authProvider),this.refreshProcessCache())}setAuthToken(e,t,s){let r=new l(e,this,{id:t,title:"Custom",description:""});return r.setToken(s),this.setAuthProvider(r),r}async describeAccount(){return(await this._get("/me")).data}async listFiles(){return(await this._get("/files")).data.files.map((e=>new p(this,e.path).setAll(e)))}async uploadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;null===t&&(t=r.fileNameForUpload(e));let n=await this.getFile(t);return await n.uploadFile(e,s,i)}async getFile(e){return new p(this,e)}_normalizeUserProcess(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e instanceof m?e=e.toJSON():e instanceof b?(e.result=!0,e=e.parent.toJSON()):i.isObject(e)&&!i.isObject(e.process_graph)&&(e={process_graph:e}),Object.assign({},t,{process:e})}async validateProcess(e){let t=await this._post("/validation",this._normalizeUserProcess(e).process);if(Array.isArray(t.data.errors))return t.data.errors;throw new Error("Invalid validation response received.")}async listUserProcesses(){let e=await this._get("/process_graphs");if(!i.isObject(e.data)||!Array.isArray(e.data.processes))throw new Error("Invalid response received for processes");return this.processes.remove(null,"user"),this.processes.addAll(e.data.processes,"user"),e.data.processes.map((e=>new m(this,e.id).setAll(e)))}async setUserProcess(e,t){let s=new m(this,e);return await s.replaceUserProcess(t)}async getUserProcess(e){let t=new m(this,e);return await t.describeUserProcess()}async computeResult(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=this._normalizeUserProcess(e,{plan:t,budget:s}),o=await this._post("/result",a,r.getResponseType(),n),l={data:o.data,costs:null,type:null,logs:[]};"number"==typeof o.headers["openeo-costs"]&&(l.costs=o.headers["openeo-costs"]),"string"==typeof o.headers["content-type"]&&(l.type=o.headers["content-type"]);let c=Array.isArray(o.headers.link)?o.headers.link:[o.headers.link];for(let e of c){if("string"!=typeof e)continue;let t=e.match(/^<([^>]+)>;\s?rel="monitor"/i);if(Array.isArray(t)&&t.length>1)try{let e=await this._get(t[1]);i.isObject(e.data)&&Array.isArray(e.data.logs)&&(l.logs=e.data.logs)}catch(e){console.warn(e)}}return l}async downloadResult(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=await this.computeResult(e,s,i,n);await r.saveToFile(a.data,t)}async listJobs(){return(await this._get("/jobs")).data.jobs.map((e=>new f(this,e.id).setAll(e)))}async createJob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};n=Object.assign({},n,{title:t,description:s,plan:r,budget:i});let a=this._normalizeUserProcess(e,n),o=await this._post("/jobs",a);if("string"!=typeof o.headers["openeo-identifier"])throw new Error("Response did not contain a Job ID. Job has likely been created, but may not show up yet.");let l=new f(this,o.headers["openeo-identifier"]).setAll(a);return this.capabilities().hasFeature("describeJob")?await l.describeJob():l}async getJob(e){let t=new f(this,e);return await t.describeJob()}async listServices(){return(await this._get("/services")).data.services.map((e=>new g(this,e.id).setAll(e)))}async createService(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},c=this._normalizeUserProcess(e,Object.assign({title:s,description:r,type:t,enabled:i,configuration:n,plan:a,budget:o},l)),u=await this._post("/services",c);if("string"!=typeof u.headers["openeo-identifier"])throw new Error("Response did not contain a Service ID. Service has likely been created, but may not show up yet.");let d=new g(this,u.headers["openeo-identifier"]).setAll(c);return this.capabilities().hasFeature("describeService")?d.describeService():d}async getService(e){let t=new g(this,e);return await t.describeService()}_getLinkHref(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"next";if(Array.isArray(e)){let s=e.find((e=>i.isObject(e)&&e.rel===t&&"string"==typeof e.href));if(s)return s.href}return null}async _get(e,t,s){return await this._send({method:"get",responseType:s,url:e,timeout:"/"===e?5e3:0,params:t})}async _post(e,t,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i={method:"post",responseType:s,url:e,data:t};return await this._send(i,r)}async _put(e,t){return await this._send({method:"put",url:e,data:t})}async _patch(e,t){return await this._send({method:"patch",url:e,data:t})}async _delete(e){return await this._send({method:"delete",url:e})}async download(e,t){return(await this._send({method:"get",responseType:r.getResponseType(),url:e,authorization:t})).data}async _send(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e.baseURL=this.baseUrl,!this.isAuthenticated()||void 0!==e.authorization&&!0!==e.authorization||(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+this.authProvider.getToken()),e.responseType||(e.responseType="json"),t&&(e.signal=t.signal);try{return await a(e)}catch(t){const s=e=>"string"==typeof e&&-1!==e.indexOf("/json"),n=(e,t)=>("string"==typeof t.message&&(e.message=t.message),e.code="string"==typeof t.code?t.code:"",e.id=t.id,e.links=Array.isArray(t.links)?t.links:[],e);if(i.isObject(t.response)&&i.isObject(t.response.data)&&(s(t.response.data.type)||i.isObject(t.response.headers)&&s(t.response.headers["content-type"]))){if(e.responseType!==r.getResponseType())throw n(t,t.response.data);try{throw n(t,await r.handleErrorResponse(t))}catch(e){console.error(e)}}throw t}}}},113:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e){if(this.data={input:{},output:{}},r.isObject(e))for(let t of["input","output"])for(let s in e[t])r.isObject(e[t])&&(this.data[t][s.toUpperCase()]=e[t][s])}toJSON(){return this.data}getInputTypes(){return this.data.input}getOutputTypes(){return this.data.output}getInputType(e){return this._findType(e,"input")}getOutputType(e){return this._findType(e,"output")}_findType(e,t){return(e=e.toUpperCase())in this.data[t]?this.data[t][e]:null}}},512:(e,t,s)=>{const r=s(56),i=s(337),n=s(345),a=s(480),o=s(19),l=["finished","canceled","error"];e.exports=class extends i{constructor(e,t){super(e,["id","title","description","process","status","progress","created","updated","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.status=void 0,this.progress=void 0,this.created=void 0,this.updated=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeJob(){let e=await this.connection._get("/jobs/"+this.id);return this.setAll(e.data)}async updateJob(e){return await this.connection._patch("/jobs/"+this.id,this._convertToRequest(e)),this._supports("describeJob")?await this.describeJob():this.setAll(e)}async deleteJob(){await this.connection._delete("/jobs/"+this.id)}async estimateJob(){return(await this.connection._get("/jobs/"+this.id+"/estimate")).data}debugJob(){return new n(this.connection,"/jobs/"+this.id+"/logs")}monitorJob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeJob"))throw new Error("Monitoring Jobs not supported by the back-end.");let i=this.status,n=null,a=null;r.hasFeature("debugJob")&&s&&(a=this.debugJob());let o=async()=>{this.getDataAge()>1&&await this.describeJob();let t=a?await a.nextLogs():[];(i!==this.status||t.length>0)&&e(this,t),i=this.status,l.includes(this.status)&&c()};setTimeout(o,0),n=setInterval(o,1e3*t);let c=()=>{n&&(clearInterval(n),n=null)};return c}async startJob(){return await this.connection._post("/jobs/"+this.id+"/results",{}),this._supports("describeJob")?await this.describeJob():this}async stopJob(){return await this.connection._delete("/jobs/"+this.id+"/results"),this._supports("describeJob")?await this.describeJob():this}async getResultsAsStac(){let e=await this.connection._get("/jobs/"+this.id+"/results");if(!a.isObject(e)||!a.isObject(e.data))throw new Error("Results received from the back-end are invalid");let t=o.stac(e.data);return a.isObject(t.assets)||(t.assets={}),"Feature"===t.type?"number"==typeof e.headers["openeo-costs"]&&(t.properties.costs=e.headers["openeo-costs"]):"number"==typeof e.headers["openeo-costs"]&&(t.costs=e.headers["openeo-costs"]),t}async listResults(){let e=await this.getResultsAsStac();return a.isObject(e.assets)?Object.values(e.assets):[]}async downloadResults(e){let t=await this.listResults();return await r.downloadResults(this.connection,t,e)}}},345:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e,t){this.connection=e,this.endpoint=t,this.lastId=""}async nextLogs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=await this.next(e);return Array.isArray(t.logs)?t.logs:[]}async next(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t={offset:this.lastId};e>0&&(t.limit=e);let s=await this.connection._get(this.endpoint,t);return Array.isArray(s.data.logs)&&s.data.logs.length>0?(s.data.logs=s.data.logs.filter((e=>r.isObject(e)&&"string"==typeof e.id)),this.lastId=s.data.logs[s.data.logs.length-1].id):s.data.logs=[],s.data.links=Array.isArray(s.data.links)?s.data.links:[],s.data}}},833:(e,t,s)=>{const r=s(480),i=s(439),n=s(56),a=s(6);class o extends i{static isSupported(){return r.isObject(a)&&Boolean(a.UserManager)}static async signinCallback(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n.getUrl();e||(e=new o(null,{}),e.setGrant(s.includes("?")?"authorization_code+pkce":"implicit"));let r=e.getOptions(t),i=new a.UserManager(r);return await i.signinCallback(s)}constructor(e,t){super("oidc",e,t),this.manager=null,this.listeners={},this.user=null,this.clientId=null,this.grant="authorization_code+pkce",this.issuer=t.issuer||"",this.scopes=Array.isArray(t.scopes)&&t.scopes.length>0?t.scopes:["openid"],this.refreshTokenScope="offline_access",this.links=Array.isArray(t.links)?t.links:[],this.defaultClients=Array.isArray(t.default_clients)?t.default_clients:[],this.defaultClient=this.detectDefaultClient()}addListener(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";this.manager.events[`add${e}`](t),this.listeners[`${s}:${e}`]=t}removeListener(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";this.manager.events[`remove${e}`](this.listeners[e]),delete this.listeners[`${t}:${e}`]}async login(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.issuer||"string"!=typeof this.issuer)throw new Error("No Issuer URL available for OpenID Connect");this.manager=new a.UserManager(this.getOptions(e,t)),this.addListener("UserLoaded",(async()=>this.setUser(await this.manager.getUser())),"js-client"),this.addListener("AccessTokenExpired",(()=>this.setUser(null)),"js-client"),"popup"===o.uiMethod?await this.manager.signinPopup():await this.manager.signinRedirect()}async logout(){if(null!==this.manager){try{"popup"===o.uiMethod?await this.manager.signoutPopup():await this.manager.signoutRedirect({post_logout_redirect_uri:n.getUrl()})}catch(e){console.warn(e)}super.logout(),this.removeListener("UserLoaded","js-client"),this.removeListener("AccessTokenExpired","js-client"),this.manager=null,this.setUser(null)}}getOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=this.getResponseType(),r=this.scopes.slice(0);return t&&!r.includes(this.refreshTokenScope)&&r.push(this.refreshTokenScope),Object.assign({client_id:this.clientId,redirect_uri:o.redirectUrl,authority:this.issuer.replace("/.well-known/openid-configuration",""),scope:r,validateSubOnSilentRenew:!0,response_type:s,response_mode:s.includes("code")?"query":"fragment"},e)}getResponseType(){switch(this.grant){case"authorization_code+pkce":return"code";case"implicit":return"token id_token";default:throw new Error("Grant Type not supported")}}setGrant(e){switch(e){case"authorization_code+pkce":case"implicit":this.grant=e;break;default:throw new Error("Grant Type not supported")}}setClientId(e){this.clientId=e}setUser(e){e?(this.user=e,this.setToken(e.access_token)):(this.user=null,this.setToken(null))}detectDefaultClient(){for(let e of o.grants){let t=this.defaultClients.find((t=>Boolean(t.grant_types.includes(e)&&Array.isArray(t.redirect_urls)&&t.redirect_urls.find((e=>e.startsWith(o.redirectUrl))))));if(t)return this.setGrant(e),this.setClientId(t.id),this.defaultClient=t,t}return null}}o.uiMethod="redirect",o.redirectUrl=n.getUrl().split("#")[0].split("?")[0].replace(/\/$/,""),o.grants=["authorization_code+pkce","implicit"],e.exports=o},213:(e,t,s)=>{const r=s(300).default,{AbortController:i}=s(779),n=s(480),a=s(956),o=s(398),l=s(512),c=s(345),u=s(291),d=s(49),h=s(295),p=s(439),f=s(112),m=s(833),g=s(11),y=s(113),b=s(966),v=s(985),w=s(917),A=s(456),_="1.0.0-rc.2",x="1.x.x";class j{static async connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n.normalizeUrl(e,"/.well-known/openeo"),i=e,o=null;try{if(o=await r.get(s,{timeout:5e3}),!n.isObject(o.data)||!Array.isArray(o.data.versions))throw new Error("Well-Known Document doesn't list any versions.")}catch(e){console.warn("Can't read well-known document, connecting directly to the specified URL as fallback mechanism. Reason: "+e.message)}if(n.isObject(o)){let e=a.findLatest(o.data.versions,!0,_,x);if(null===e)throw new Error("Server not supported. Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");i=e.url}let l=await j.connectDirect(i,t);return l.url=e,l}static async connectDirect(e){let t=new o(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),s=await t.init();if(a.compare(s.apiVersion(),_,"<")||a.compare(s.apiVersion(),x,">"))throw new Error("Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");return t}static clientVersion(){return"2.4.0"}}j.Environment=s(56),e.exports={AbortController:i,AuthProvider:p,BasicProvider:f,Capabilities:g,Connection:o,FileTypes:y,Job:l,Logs:c,OidcProvider:m,OpenEO:j,Service:h,UserFile:u,UserProcess:d,Builder:b,BuilderNode:v,Parameter:w,Formula:A}},295:(e,t,s)=>{const r=s(337),i=s(345);e.exports=class extends r{constructor(e,t){super(e,["id","title","description","process","url","type","enabled","configuration","attributes","created","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.url=void 0,this.type=void 0,this.enabled=void 0,this.configuration=void 0,this.attributes=void 0,this.created=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeService(){let e=await this.connection._get("/services/"+this.id);return this.setAll(e.data)}async updateService(e){return await this.connection._patch("/services/"+this.id,this._convertToRequest(e)),this._supports("describeService")?await this.describeService():this.setAll(e)}async deleteService(){await this.connection._delete("/services/"+this.id)}debugService(){return new i(this.connection,"/services/"+this.id+"/logs")}monitorService(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeService"))throw new Error("Monitoring Services not supported by the back-end.");let i=this.enabled,n=null,a=null;r.hasFeature("debugService")&&s&&(a=this.debugService());let o=async()=>{this.getDataAge()>1&&await this.describeService();let t=a?await a.nextLogs():[];(i!==this.enabled||t.length>0)&&e(this,t),i=this.enabled};return setTimeout(o,0),n=setInterval(o,1e3*t),()=>{n&&(clearInterval(n),n=null)}}}},291:(e,t,s)=>{const r=s(56),i=s(337);e.exports=class extends i{constructor(e,t){super(e,["path","size","modified"]),this.path=t,this.size=void 0,this.modified=void 0}async retrieveFile(){return await this.connection.download("/files/"+this.path,!0)}async downloadFile(e){let t=await this.connection.download("/files/"+this.path,!0);return await r.saveToFile(t,e)}async uploadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i={method:"put",url:"/files/"+this.path,data:r.dataForUpload(e),headers:{"Content-Type":"application/octet-stream"}};"function"==typeof t&&(i.onUploadProgress=e=>{let s=Math.round(100*e.loaded/e.total);t(s,this)});let n=await this.connection._send(i,s);return this.setAll(n.data)}async deleteFile(){await this.connection._delete("/files/"+this.path)}}},49:(e,t,s)=>{const r=s(337),i=s(480);e.exports=class extends r{constructor(e,t){super(e,["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links",["process_graph","processGraph"]]),this.id=t,this.summary=void 0,this.description=void 0,this.categories=void 0,this.parameters=void 0,this.returns=void 0,this.deprecated=void 0,this.experimental=void 0,this.exceptions=void 0,this.examples=void 0,this.links=void 0,this.processGraph=void 0}async describeUserProcess(){let e=await this.connection._get("/process_graphs/"+this.id);if(!i.isObject(e.data)||"string"!=typeof e.data.id)throw new Error("Invalid response received for user process");return this.connection.processes.add(e.data,"user"),this.setAll(e.data)}async replaceUserProcess(e){if(await this.connection._put("/process_graphs/"+this.id,this._convertToRequest(e)),this._supports("describeUserProcess"))return this.describeUserProcess();{let t=this.setAll(e);return this.connection.processes.add(t.toJSON(),"user"),t}}async deleteUserProcess(){await this.connection._delete("/process_graphs/"+this.id),this.connection.processes.remove(this.id,"user")}}},247:function(e,t){var s,r;void 0===(r="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,s,r=e.replace(/^v/,"").replace(/\+.*$/,""),i=(s="-",-1===(t=r).indexOf(s)?t.length:t.indexOf(s)),n=r.substring(0,i).split(".");return n.push(r.substring(i+1)),n}function s(e){return isNaN(Number(e))?e:Number(e)}function r(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 i(e,i){[e,i].forEach(r);for(var n=t(e),a=t(i),o=0;o<Math.max(n.length-1,a.length-1);o++){var l=parseInt(n[o]||0,10),c=parseInt(a[o]||0,10);if(l>c)return 1;if(c>l)return-1}var u=n[n.length-1],d=a[a.length-1];if(u&&d){var h=u.split(".").map(s),p=d.split(".").map(s);for(o=0;o<Math.max(h.length,p.length);o++){if(void 0===h[o]||"string"==typeof p[o]&&"number"==typeof h[o])return-1;if(void 0===p[o]||"string"==typeof h[o]&&"number"==typeof p[o])return 1;if(h[o]>p[o])return 1;if(p[o]>h[o])return-1}}else if(u||d)return u?-1:1;return 0}var n=[">",">=","=","<","<="],a={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return i.validate=function(t){return"string"==typeof t&&e.test(t)},i.compare=function(e,t,s){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===n.indexOf(e))throw new TypeError("Invalid operator, expected one of "+n.join("|"))}(s);var r=i(e,t);return a[s].indexOf(r)>-1},i})?s.apply(t,[]):s)||(e.exports=r)},991:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var r,i,n;if(Array.isArray(t)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(!e(t[i],s[i]))return!1;return!0}if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],s.get(i[0])))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(t[i]!==s[i])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(s,n[i]))return!1;for(i=r;0!=i--;){var a=n[i];if(!e(t[a],s[a]))return!1}return!0}return t!=t&&s!=s}},779:e=>{"use strict";const t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;if(!t)throw new Error("Unable to find global scope. Are you sure this is running in the browser?");if(!t.AbortController)throw new Error('Could not find "AbortController" in the global scope. You need to polyfill it first');e.exports.AbortController=t.AbortController},6:t=>{"use strict";t.exports=e},300:e=>{"use strict";e.exports=t},263:e=>{"use strict";if(void 0===s){var t=new Error("Cannot find module 'multihashes'");throw t.code="MODULE_NOT_FOUND",t}e.exports=s}},i={},function e(t){var s=i[t];if(void 0!==s)return s.exports;var n=i[t]={exports:{}};return r[t].call(n.exports,n,n.exports,e),n.exports}(213);var r,i}));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("Oidc"),require("axios"),function(){try{return require("multihashes")}catch(e){}}());else if("function"==typeof define&&define.amd)define(["Oidc","axios","multihashes"],t);else{var s="object"==typeof exports?t(require("Oidc"),require("axios"),function(){try{return require("multihashes")}catch(e){}}()):t(e.Oidc,e.axios,e.multihashes);for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(self,((e,t,s)=>{return r={545:(e,t,s)=>{const r=s(480);class i{constructor(e=[],t=!1){if(this.listeners=[],this.processes={},this.addNamespace=t,e instanceof i)for(let t in e.processes)this.addAll(e.processes[t]);else this.addAll(e)}onChange(e,t,s){for(let r of this.listeners)r(e,t,s)}addAll(e,t="backend"){for(var s in e)this.add(e[s],t,!1);this.onChange("addAll",e,t)}add(e,t="backend",s=!0){if(!r.isObject(e))throw new Error("Invalid process; not an object.");if("string"!=typeof e.id)throw new Error("Invalid process; no id specified.");if("string"!=typeof t)throw new Error("Invalid namespace; not a string.");this.processes[t]||(this.processes[t]={}),e=Object.assign(this.addNamespace?{namespace:t}:{},e),this.processes[t][e.id]=e,s&&this.onChange("add",e,t)}count(){return r.size(this.all())}all(){let e=[];for(let t in this.processes)e=e.concat(Object.values(this.processes[t]));return e}hasNamespace(e){return"string"==typeof e&&Boolean(this.processes[e])}namespaces(){return Object.keys(this.processes).sort()}namespace(e){if("string"!=typeof e)return[];let t=this.processes[e];return t?Object.values(t):[]}has(e,t=null){return Boolean(this.get(e,t))}get(e,t=null){return"string"!=typeof e?null:null===t?this.get(e,"user")||this.get(e,"backend"):this.processes[t]&&this.processes[t][e]||null}remove(e=null,t="user"){if("string"!=typeof t)return!1;if(this.processes[t]){if("string"!=typeof e)return delete this.processes[t],this.onChange("remove",null,t),!0;if(this.processes[t][e]){let s=this.processes[t][e];return delete this.processes[t][e],0===r.size(this.processes[t])&&delete this.processes[t],this.onChange("remove",s,t),!0}}return!1}}e.exports=i},905:(e,t,s)=>{const r=s(480);class i{static normalizeJsonSchema(e,t=!1){e=r.isObject(e)?[e]:Array.isArray(e)?e:[];let s=[];for(let t of e)if(Array.isArray(t.allOf))s.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=r.omitFromObject(t,["oneOf","anyOf"]),i=t.oneOf||t.anyOf;for(let t of i)s.push(Object.assign({},e,t))}else s.push(t);if(!t)return s;e=[];for(let t of s)Array.isArray(t.type)?e=e.concat(t.type.map((e=>Object.assign({},t,{type:e})))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!r.isObject(e)||!e.schema)return[];let s,n=i.normalizeJsonSchema(e.schema);for(;s=t.shift();)n=n.map((e=>i.normalizeJsonSchema(i.getElementJsonSchema(e,s)))),n=n.concat(...n);let a=[];for(let e of n)if(Array.isArray(e.parameters)){if(a.length>0&&!r.equals(a,e.parameters))throw new Error("Multiple schemas with different callback parameters found.");a=e.parameters}return a}static getCallbackParametersForProcess(e,t,s=[]){if(!r.isObject(e)||!Array.isArray(e.parameters))return[];let n=e.parameters.find((e=>e.name===t));return i.getCallbackParameters(n,s)}static getNativeTypesForJsonSchema(e,t=!1){if(r.isObject(e)&&Array.isArray(e.type)){let s=r.unique(e.type).filter((e=>i.JSON_SCHEMA_TYPES.includes(e)));return s.length>0&&s.length<i.JSON_SCHEMA_TYPES.length?s:t?[]:i.JSON_SCHEMA_TYPES}return r.isObject(e)&&"string"==typeof e.type&&i.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:i.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let s=i.getNativeTypesForJsonSchema(e);if(r.isObject(e)&&s.includes("array")&&"string"!=typeof t){if(r.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&r.isObject(e.items[t]))return e.items[t];if(r.isObject(e.additionalItems))return e.additionalItems}}if(r.isObject(e)&&s.includes("object")){if(null!==t&&r.isObject(e.properties)&&r.isObject(e.properties[t]))return e.properties[t];if(r.isObject(e.additionalProperties))return e.additionalProperties}return{}}}i.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=i},480:(e,t,s)=>{var r=s(991);class i{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static hasText(e){return"string"==typeof e&&e.length>0}static equals(e,t){return r(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const s={};return t.forEach((t=>s[t]=e[t])),s}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var s=Object.assign({},e);for(let e of t)delete s[e];return s}static mapObject(e,t){const s=Object.keys(e),r=new Array(s.length);return s.forEach(((s,i)=>{r[i]=t(e[s],s,e)})),r}static mapObjectValues(e,t){e=Object(e);const s={};return Object.keys(e).forEach((r=>{s[r]=t(e[r],r,e)})),s}static unique(e,t=!1){return t?e.filter(((e,t,s)=>s.findIndex((t=>i.equals(e,t)))===t)):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let s=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),s+=t.replace(/\/$/,"")),s}static replacePlaceholders(e,t={}){if("string"==typeof e&&i.isObject(t))for(var s in t){let r=t[s];e=e.replace("{"+s+"}",Array.isArray(r)?r.join("; "):r)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map((e=>{if(e.length>=3){const t=(e,t,s)=>t+" "+s.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e}))).join(t)}static friendlyLinks(e,t=!0,s=["self"]){let r=[];if(!Array.isArray(e))return r;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&s.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=i.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),r.push(t));return t&&r.sort(((e,t)=>i.compareStringCaseInsensitive(e.title,t.title))),r}}e.exports=i},956:(e,t,s)=>{const r=s(247);class i{static compare(e,t,s=null){return null!==s?r.compare(e,t,s):r(e,t)}static validate(e){return r.validate(e)}static findCompatible(e,t=!0,s=null,r=null){if(!Array.isArray(e)||0===e.length)return[];let n=e.filter((e=>{if("string"==typeof e.url&&i.validate(e.api_version)){let t=i.validate(s),n=i.validate(r);return t&&n?i.compare(e.api_version,s,">=")&&i.compare(e.api_version,r,"<="):t?i.compare(e.api_version,s,">="):!n||i.compare(e.api_version,r,"<=")}return!1}));return 0===n.length?[]:n.sort(((e,s)=>{let r=!0===e.production,n=!0===s.production;return t&&r!==n?r?-1:1:-1*i.compare(e.api_version,s.api_version)}))}static findLatest(e,t=!0,s=null,r=null){let n=i.findCompatible(e,t,s,r);return n.length>0?n[0]:null}}e.exports=i},19:(e,t,s)=>{var r=s(247);const i="1.0.0",n={datacube:"https://stac-extensions.github.io/datacube/v1.0.0/schema.json",eo:"https://stac-extensions.github.io/eo/v1.0.0/schema.json",file:"https://stac-extensions.github.io/file/v1.0.0/schema.json","item-assets":"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",label:"https://stac-extensions.github.io/label/v1.0.0/schema.json",pointcloud:"https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json",processing:"https://stac-extensions.github.io/processing/v1.0.0/schema.json",projection:"https://stac-extensions.github.io/projection/v1.0.0/schema.json",raster:"https://stac-extensions.github.io/raster/v1.0.0/schema.json",sar:"https://stac-extensions.github.io/sar/v1.0.0/schema.json",sat:"https://stac-extensions.github.io/sat/v1.0.0/schema.json",scientific:"https://stac-extensions.github.io/scientific/v1.0.0/schema.json",timestamps:"https://stac-extensions.github.io/timestamps/v1.0.0/schema.json",version:"https://stac-extensions.github.io/version/v1.0.0/schema.json",view:"https://stac-extensions.github.io/view/v1.0.0/schema.json"},a={itemAndCollection:{"cube:":n.datacube,"eo:":n.eo,"file:":n.file,"label:":n.label,"pc:":n.pointcloud,"processing:":n.processing,"proj:":n.projection,"raster:":n.raster,"sar:":n.sar,"sat:":n.sat,"sci:":n.scientific,"view:":n.view,version:n.version,deprecated:n.version,published:n.timestamps,expires:n.timestamps,unpublished:n.timestamps},catalog:{},collection:{item_assets:n["item-assets"]},item:{}};a.collection=Object.assign(a.collection,a.itemAndCollection),a.item=Object.assign(a.item,a.itemAndCollection);var o={version:i,set(e){e||(e="0.6.0"),o.version=e},before:e=>r.compare(o.version,e,"<")},l={type(e){let t=typeof e;if("object"===t){if(null===e)return"null";if(Array.isArray(e))return"array"}return t},is:(e,t)=>l.type(e)===t,isDefined:e=>void 0!==e,isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),rename:(e,t,s)=>void 0!==e[t]&&void 0===e[s]&&(e[s]=e[t],delete e[t],!0),toArray:(e,t)=>void 0!==e[t]&&!Array.isArray(e[t])&&(e[t]=[e[t]],!0),flattenArray(e,t,s,r=!1){if(Array.isArray(e[t])){for(let i in e[t])if("string"==typeof s[i]){let n=e[t][i];e[s[i]]=r?[n]:n}return delete e[t],!0}return!1},flattenOneElementArray:(e,t,s=!1)=>!(!s&&Array.isArray(e[t]))||1===e[t].length&&(e[t]=e[t][0],!0),removeFromArray(e,t,s){if(Array.isArray(e[t])){let r=e[t].indexOf(s);return r>-1&&e[t].splice(r,1),!0}return!1},addToArrayIfNotExists:(e,t,s)=>!!Array.isArray(e[t])&&(-1===e[t].indexOf(s)&&e[t].push(s),e[t].sort(),!0),ensure:(e,t,s)=>(l.type(s)!==l.type(e[t])&&(e[t]=s),!0),addExtension:(e,t)=>!l.isObject(e)||l.addToArrayIfNotExists(e,"stac_extensions",t)&&true,removeExtension:(e,t)=>!l.isObject(e)||l.removeFromArray(e,"stac_extensions",t)&&true,migrateExtensionShortnames(e){let t=Object.keys(n),s=Object.values(n);return l.mapValues(e,"stac_extensions",t,s)},populateExtensions(e,t){let s=[];"catalog"!=t&&"collection"!=t||s.push(e),"item"!=t&&"collection"!=t||!l.isObject(e.assets)||(s=s.concat(Object.values(e.assets))),"collection"==t&&l.isObject(e.item_assets)&&(s=s.concat(Object.values(e.item_assets))),"collection"==t&&l.isObject(e.summaries)&&(s=s.concat(Object.values(e.summaries))),"item"==t&&l.isObject(e.properties)&&s.push(e.properties);for(let r of s)Object.keys(r).forEach((s=>{let r=s.match(/^(\w+:|[^:]+$)/i);if(Array.isArray(r)){let s=a[t][r[0]];l.is(s,"string")&&l.addExtension(e,s)}}))},mapValues(e,t,s,r){let i=e=>{let t=s.indexOf(e);return t>=0?r[t]:e};return Array.isArray(e[t])?e[t]=e[t].map(i):void 0!==e[t]&&(e[t]=i(e[t])),!0},mapObject(e,t){for(let s in e)e[s]=t(e[s],s)},moveTo:(e,t,s,r=!1,i=!1)=>(condition=r?i?e=>Array.isArray(e):e=>Array.isArray(e)&&1===e.length:l.isDefined,!!condition(e[t])&&(s[t]=r&&!i?e[t][0]:e[t],delete e[t],!0)),runAll(e,t,s=null){for(let r in e)r.startsWith("migrate")||e[r](t,s)},toUTC(e,t){if("string"==typeof e[t])try{return e[t]=this.toISOString(e[t]),!0}catch(e){}return delete e[t],!1},toISOString:e=>(e instanceof Date||(e=new Date(e)),e.toISOString().replace(".000",""))},c={hexToUint8(e){if(0===e.length||e.length%2!=0)throw new Error(`The string "${e}" is not valid hex.`);return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},uint8ToHex:e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),toMultihash(e,t,r){if(!l.is(e[t],"string"))return!1;try{const i=s(263).encode(c.hexToUint8(e[t]),r);return e[t]=c.uint8ToHex(i),!0}catch(e){return console.warn(e),!1}}},u={migrate(e,t=!0){o.set(e.stac_version),t&&(e.stac_version=i),e.type="Catalog",o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"id",""),l.ensure(e,"description",""),l.ensure(e,"links",[]),l.runAll(u,e,e),l.ensure(e,"stac_extensions",[]),o.before("0.8.0")&&l.populateExtensions(e,"catalog")},openeo(e){l.rename(e,"api_version","openeo:api_version"),l.rename(e,"backend_version","openeo:backend_version"),l.rename(e,"production","openeo:production"),l.rename(e,"endpoints","openeo:endpoints"),l.rename(e,"billing","openeo:billing")}},d={migrate(e,t=!0){u.migrate(e,t),e.type="Collection",o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"license","proprietary"),l.ensure(e,"extent",{spatial:{bbox:[]},temporal:{interval:[]}}),l.runAll(d,e,e),l.isObject(e.properties)&&(l.removeFromArray(e,"stac_extensions","commons"),delete e.properties),o.before("0.8.0")&&l.populateExtensions(e,"collection"),o.before("1.0.0-beta.1")&&l.mapValues(e,"stac_extensions",["assets"],["item-assets"])},extent(e){if(l.ensure(e,"extent",{}),o.before("0.8.0")&&(Array.isArray(e.extent.spatial)&&(e.extent.spatial={bbox:[e.extent.spatial]}),Array.isArray(e.extent.temporal)&&(e.extent.temporal={interval:[e.extent.temporal]})),l.ensure(e.extent,"spatial",{}),l.ensure(e.extent.spatial,"bbox",[]),l.ensure(e.extent,"temporal",{}),l.ensure(e.extent.temporal,"interval",[]),o.before("1.0.0-rc.3")){if(e.extent.temporal.interval.length>1){let t,s;for(let r of e.extent.temporal.interval){if(null===r[0])t=null;else if("string"==typeof r[0]&&null!==t)try{let e=new Date(r[0]);(void 0===t||e<t)&&(t=e)}catch(e){}if(null===r[1])s=null;else if("string"==typeof r[1]&&null!==s)try{let e=new Date(r[1]);(void 0===s||e>s)&&(s=e)}catch(e){}}e.extent.temporal.interval.unshift([t?l.toISOString(t):null,s?l.toISOString(s):null])}if(e.extent.spatial.bbox.length>1){let t=e.extent.spatial.bbox.reduce(((e,t)=>Array.isArray(t)?Math.max(t.length,e):e),4);if(t>=4){let s=new Array(t).fill(null),r=t/2;for(let t of e.extent.spatial.bbox){if(!Array.isArray(t)||t.length<4)break;for(let e in t){let i=t[e];null===s[e]?s[e]=i:s[e]=e<r?Math.min(i,s[e]):Math.max(i,s[e])}}-1===s.findIndex((e=>null===e))&&e.extent.spatial.bbox.unshift(s)}}}},collectionAssets(e){o.before("1.0.0-rc.1")&&l.removeExtension(e,"collection-assets"),p.migrateAll(e)},itemAsset(e){o.before("1.0.0-beta.2")&&l.rename(e,"item_assets","assets"),p.migrateAll(e,"item_assets")},summaries(e){if(l.ensure(e,"summaries",{}),o.before("0.8.0")&&l.isObject(e.other_properties)){for(let t in e.other_properties){let s=e.other_properties[t];Array.isArray(s.extent)&&2===s.extent.length?e.summaries[t]={minimum:s.extent[0],maximum:s.extent[1]}:Array.isArray(s.values)&&(s.values.filter((e=>Array.isArray(e))).length===s.values.length?e.summaries[t]=s.values.reduce(((e,t)=>e.concat(t)),[]):e.summaries[t]=s.values)}delete e.other_properties}if(o.before("1.0.0-beta.1")&&l.isObject(e.properties)&&!e.links.find((e=>["child","item"].includes(e.rel))))for(let t in e.properties){let s=e.properties[t];Array.isArray(s)||(s=[s]),e.summaries[t]=s}o.before("1.0.0-rc.1")&&l.mapObject(e.summaries,(e=>(l.rename(e,"min","minimum"),l.rename(e,"max","maximum"),e))),f.migrate(e.summaries),l.moveTo(e.summaries,"sci:doi",e,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"sci:publications",e,!0,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"sci:citation",e,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"cube:dimensions",e,!0)&&l.addExtension(e,n.datacube),0===Object.keys(e.summaries).length&&delete e.summaries}},h={migrate(e,t=null,s=!0){o.set(e.stac_version),s&&(e.stac_version=i),o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"id",""),l.ensure(e,"type","Feature"),l.isObject(e.geometry)||(e.geometry=null),null!==e.geometry&&l.ensure(e,"bbox",[]),l.ensure(e,"properties",{}),l.ensure(e,"links",[]),l.ensure(e,"assets",{});let r=!1;l.isObject(t)&&l.isObject(t.properties)&&(l.removeFromArray(e,"stac_extensions","commons"),e.properties=Object.assign({},t.properties,e.properties),r=!0),l.runAll(h,e,e),f.migrate(e.properties,e),p.migrateAll(e),l.ensure(e,"stac_extensions",[]),(o.before("0.8.0")||r)&&l.populateExtensions(e,"item")}},p={migrateAll(e,t="assets"){for(let s in e[t])p.migrate(e[t][s],e)},migrate(e,t){l.runAll(p,e,t),f.migrate(e,t)},mediaTypes(e){l.is(e.type,"string")&&l.mapValues(e,"type",["image/vnd.stac.geotiff","image/vnd.stac.geotiff; cloud-optimized=true"],["image/tiff; application=geotiff","image/tiff; application=geotiff; profile=cloud-optimized"])},eo(e,t){let s=l.isObject(t.properties)&&Array.isArray(t.properties["eo:bands"])?t.properties["eo:bands"]:[];if(Array.isArray(e["eo:bands"]))for(let t in e["eo:bands"]){let r=e["eo:bands"][t];l.is(r,"number")&&l.isObject(s[r])?r=s[r]:l.isObject(r)||(r={}),e["eo:bands"][t]=r}}},f={migrate(e,t){l.runAll(f,e,t)},_commonMetadata(e){o.before("1.0.0-rc.3")&&(l.toUTC(e,"created"),l.toUTC(e,"updated"))},_timestamps(e){l.toUTC(e,"published"),l.toUTC(e,"expires"),l.toUTC(e,"unpublished")},_versioningIndicator(e){},checksum(e,t){o.before("0.9.0")&&(l.rename(e,"checksum:md5","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","md5"),l.rename(e,"checksum:sha1","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha1"),l.rename(e,"checksum:sha2","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha2-256"),l.rename(e,"checksum:sha3","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha3-256")),o.before("1.0.0-rc.1")&&l.rename(e,"checksum:multihash","file:checksum")&&l.addExtension(t,n.file)},cube(){},dtr(e,t){o.before("0.9.0")&&(l.rename(e,"dtr:start_datetime","start_datetime"),l.rename(e,"dtr:end_datetime","end_datetime"),l.removeExtension(t,"datetime-range"))},eo(e,t){o.before("0.9.0")&&(l.rename(e,"eo:epsg","proj:epsg")&&l.addExtension(t,n.projection),l.rename(e,"eo:platform","platform"),l.rename(e,"eo:instrument","instruments")&&l.toArray(e,"instruments"),l.rename(e,"eo:constellation","constellation"),l.rename(e,"eo:off_nadir","view:off_nadir")&&l.addExtension(t,n.view),l.rename(e,"eo:azimuth","view:azimuth")&&l.addExtension(t,n.view),l.rename(e,"eo:incidence_angle","view:incidence_angle")&&l.addExtension(t,n.view),l.rename(e,"eo:sun_azimuth","view:sun_azimuth")&&l.addExtension(t,n.view),l.rename(e,"eo:sun_elevation","view:sun_elevation")&&l.addExtension(t,n.view)),o.before("1.0.0-beta.1")&&l.rename(e,"eo:gsd","gsd")},label(e){o.before("0.8.0")&&(l.rename(e,"label:property","label:properties"),l.rename(e,"label:task","label:tasks"),l.rename(e,"label:overview","label:overviews")&&l.toArray(e,"label:overviews"),l.rename(e,"label:method","label:methods"),l.toArray(e,"label:classes"))},pc(e){o.before("0.8.0")&&l.rename(e,"pc:schema","pc:schemas")},proj(e){},sar(e,t){let s=!t;l.rename(e,"sar:incidence_angle","view:incidence_angle")&&l.addExtension(t,n.view),l.rename(e,"sar:pass_direction","sat:orbit_state")&&l.mapValues(e,"sat:orbit_state",[null],["geostationary"])&&l.addExtension(t,n.sat),o.before("0.7.0")&&(l.flattenArray(e,"sar:resolution",["sar:resolution_range","sar:resolution_azimuth"],s),l.flattenArray(e,"sar:pixel_spacing",["sar:pixel_spacing_range","sar:pixel_spacing_azimuth"],s),l.flattenArray(e,"sar:looks",["sar:looks_range","sar:looks_azimuth","sar:looks_equivalent_number"],s),l.rename(e,"sar:off_nadir","view:off_nadir")&&l.addExtension(t,n.view)),o.before("0.9.0")&&(l.rename(e,"sar:platform","platform"),l.rename(e,"sar:instrument","instruments")&&l.toArray(e,"instruments"),l.rename(e,"sar:constellation","constellation"),l.rename(e,"sar:type","sar:product_type"),l.rename(e,"sar:polarization","sar:polarizations"),l.flattenOneElementArray(e,"sar:absolute_orbit",s)&&l.rename(e,"sar:absolute_orbit","sat:absolute_orbit")&&l.addExtension(t,n.sat),l.flattenOneElementArray(e,"sar:relative_orbit",s)&&l.rename(e,"sar:relative_orbit","sat:relative_orbit")&&l.addExtension(t,n.sat))},sat(e){o.before("0.9.0")&&(l.rename(e,"sat:off_nadir_angle","sat:off_nadir"),l.rename(e,"sat:azimuth_angle","sat:azimuth"),l.rename(e,"sat:sun_azimuth_angle","sat:sun_azimuth"),l.rename(e,"sat:sun_elevation_angle","sat:sun_elevation"))},sci(e){},item(e){o.before("0.8.0")&&(l.rename(e,"item:license","license"),l.rename(e,"item:providers","providers"))},view(e){}},m={item:(e,t=null,s=!0)=>(h.migrate(e,t,s),e),catalog:(e,t=!0)=>(u.migrate(e,t),e),collection:(e,t=!0)=>(d.migrate(e,t),e),stac:(e,t=!0)=>"Feature"===e.type?m.item(e,null,t):"Collection"===e.type||l.isDefined(e.extent)||l.isDefined(e.license)?m.collection(e,t):m.catalog(e,t)};e.exports=m},439:e=>{e.exports=class{constructor(e,t,s){this.id=s.id||null,this.title=s.title||"",this.description=s.description||"",this.type=e,this.connection=t,this.token=null}getId(){let e=this.getType();return this.getProviderId().length>0&&(e+="."+this.getProviderId()),e}getType(){return this.type}getProviderId(){return"string"==typeof this.id?this.id:""}getTitle(){return this.title}getDescription(){return this.description}getToken(){return"string"==typeof this.token?this.getType()+"/"+this.getProviderId()+"/"+this.token:null}setToken(e){this.token=e,this.connection.emit("tokenChanged",e),null!==this.token?this.connection.setAuthProvider(this):this.connection.setAuthProvider(null)}async login(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];throw new Error("Not implemented.",t)}async logout(){this.setToken(null)}}},337:e=>{e.exports=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.connection=e,this.apiToClientNames={},this.clientToApiNames={},this.lastRefreshTime=0,this.extra={};for(let e in t){let s,r;Array.isArray(t[e])?(s=t[e][0],r=t[e][1]):(s=t[e],r=t[e]),this.apiToClientNames[s]=r,this.clientToApiNames[r]=s}}toJSON(){let e={};for(let t in this.clientToApiNames){let s=this.clientToApiNames[t];void 0!==this[t]&&(e[s]=this[t])}return Object.assign(e,this.extra)}setAll(e){for(let t in e)void 0===this.apiToClientNames[t]?this.extra[t]=e[t]:this[this.apiToClientNames[t]]=e[t];return this.lastRefreshTime=Date.now(),this}getDataAge(){return(Date.now()-this.lastRefreshTime)/1e3}getAll(){let e={};for(let t in this.apiToClientNames){let s=this.apiToClientNames[t];void 0!==this[s]&&(e[s]=this[s])}return Object.assign(e,this.extra)}get(e){return void 0!==this.extra[e]?this.extra[e]:null}_convertToRequest(e){let t={};for(let s in e)void 0===this.clientToApiNames[s]?t[s]=e[s]:t[this.clientToApiNames[s]]=e[s];return t}_supports(e){return this.connection.capabilities().hasFeature(e)}}},112:(e,t,s)=>{const r=s(56),i=s(480),n=s(439);e.exports=class extends n{constructor(e){super("basic",e,{id:null,title:"HTTP Basic",description:"Login with username and password using the method HTTP Basic."})}async login(e,t){let s=await this.connection._send({method:"get",responseType:"json",url:"/credentials/basic",headers:{Authorization:"Basic "+r.base64encode(e+":"+t)}});if(!i.isObject(s.data)||"string"!=typeof s.data.access_token)throw new Error("No access_token returned.");this.setToken(s.data.access_token)}}},56:e=>{e.exports=class{static getName(){return"Browser"}static getUrl(){return window.location.toString()}static setUrl(e){throw new Error("setUrl is not supported in a browser environment.")}static handleErrorResponse(e){return new Promise(((t,s)=>{let r=new FileReader;r.onerror=e=>{r.abort(),s(e.target.error)},r.onload=()=>{let e=r.result instanceof ArrayBuffer?String.fromCharCode.apply(null,new Uint16Array(r.result)):r.result,s="string"==typeof e?JSON.parse(e):e;t(s)},r.readAsText(e.response.data)}))}static getResponseType(){return"blob"}static base64encode(e){return btoa(e)}static fileNameForUpload(e){return e.name.split(/(\\|\/)/g).pop()}static dataForUpload(e){return e}static async downloadResults(e,t,s){throw new Error("downloadResults is not supported in a browser environment.")}static saveToFile(e,t){return new Promise(((s,r)=>{try{e instanceof Blob||(e=new Blob([e],{type:"application/octet-stream"}));let r=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=r,i.setAttribute("download",t||"download"),void 0===i.download&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r),s()}catch(e){console.error(e),r(e)}}))}}},966:(e,t,s)=>{const r=s(985),i=s(917),n=s(300).default,a=s(480),o=s(905),l=s(545),c=["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links"];class u{static async fromVersion(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t="https://processes.openeo.org/processes.json";return"string"==typeof e&&(t="https://processes.openeo.org/"+e+"/processes.json"),await u.fromURL(t)}static async fromURL(e){let t=await n(e);return new u(t.data)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(this.id=s,this.parent=t,this.parentNode=null,this.parentParameter=null,this.nodes={},this.idCounter={},this.callbackParameterCache={},this.parameters=void 0,this.processes=null,e instanceof l)this.processes=e;else if(a.isObject(e)&&Array.isArray(e.processes))this.processes=new l(e.processes);else{if(!Array.isArray(e))throw new Error("Processes are invalid; must be array or object according to the API.");this.processes=new l(e)}this.processes.all().forEach((e=>this.createFunction(e)))}createFunction(e){if(void 0!==this[e.id])throw new Error("Can't create function for process '"+e.id+"'. Already exists in Builder class.");this[e.id]=function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return this.process(e.id,s)}}addProcessSpec(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!a.isObject(e))throw new Error("Process '"+e.id+"' must be an object.");t||(t="backend"),this.processes.add(e,t),"backend"===t&&this.createFunction(e)}setParent(e,t){this.parentNode=e,this.parentParameter=t}createCallbackParameter(e){return this.callbackParameterCache[e]||(this.callbackParameterCache[e]=i.create(this,e)),this.callbackParameterCache[e]}getParentCallbackParameters(){let e=[];if(this.parentNode&&this.parentParameter)try{e=o.getCallbackParametersForProcess(this.parentNode.spec,this.parentParameter).map((e=>this.createCallbackParameter(e.name)))}catch(e){console.warn(e)}return e}addParameter(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0!==this.getParentCallbackParameters().find((t=>t.name===e.name)))return;let s=this;if(t)for(;s.parent;)s=s.parent;Array.isArray(s.parameters)||(s.parameters=[]);let r=s.parameters.findIndex((t=>t.name===e.name));-1!==r?Object.assign(s.parameters[r],e):s.parameters.push(e)}spec(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.processes.get(e,t)}math(e){let t=new(s(456))(e);return t.setBuilder(this),t.generate(!1)}supports(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Boolean(this.spec(e,t))}process(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=null;if(e.includes("@")){let t;[e,...t]=e.split("@"),i=t.join("@")}let n=new r(this,e,t,s,i);return this.nodes[n.id]=n,n}toJSON(){let e={process_graph:a.mapObjectValues(this.nodes,(e=>e.toJSON()))};return c.forEach((t=>{void 0!==this[t]&&(e[t]=this[t])})),e}generateId(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.replace("_","").substr(0,6),this.idCounter[e]?this.idCounter[e]++:this.idCounter[e]=1,e+this.idCounter[e]}}e.exports=u},456:(e,t,s)=>{const r=s(126),i=s(917),n=s(985);class a{constructor(e){let t=new r.Parser;this.tree=t.parse(e),this.builder=null}setBuilder(e){this.builder=e}generate(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.parseTree(this.tree);if(!(t instanceof n))throw new Error("Invalid formula specified.");return e&&(t.result=!0),t}parseTree(e){let t=Object.keys(e)[0];switch(t){case"Number":return parseFloat(e.Number);case"Identifier":return this.getRef(e.Identifier);case"Expression":return this.parseTree(e.Expression);case"FunctionCall":{let t=[];for(let s in e.FunctionCall.args)t.push(this.parseTree(e.FunctionCall.args[s]));return this.builder.process(e.FunctionCall.name,t)}case"Binary":return this.addOperatorProcess(e.Binary.operator,this.parseTree(e.Binary.left),this.parseTree(e.Binary.right));case"Unary":{let t=this.parseTree(e.Unary.expression);return"-"===e.Unary.operator?"number"==typeof t?-t:this.addOperatorProcess("*",-1,t):t}default:throw new Error("Operation "+t+" not supported.")}}getRef(e){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("string"==typeof e&&e.startsWith("#")){let t=e.substring(1);if(t in this.builder.nodes)return{from_node:t}}let t=this.builder.getParentCallbackParameters();if("string"==typeof e&&t.length>0){let s=e.match(/^\$+/),r=s?s[0].length:0;if(r>0&&t.length>=r){let s=e.substring(r);return t[r-1][s]}}let s=new i(e);return this.builder.addParameter(s),s}addOperatorProcess(e,t,s){let r=a.operatorMapping[e],i=this.builder.spec(r);if(r&&i){let n={};if(!Array.isArray(i.parameters)||i.parameters.length<2)throw new Error("Process for operator "+e+" must have at least two parameters");return n[i.parameters[0].name||"x"]=t,n[i.parameters[1].name||"y"]=s,this.builder.process(r,n)}throw new Error("Operator "+e+" not supported")}}a.operatorMapping={"-":"subtract","+":"add","/":"divide","*":"multiply","^":"power"},e.exports=a},985:(e,t,s)=>{const r=s(480),i=s(917);class n{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(this.parent=e,this.spec=this.parent.spec(t,i),!this.spec)throw new Error("Process doesn't exist: "+t);this.id=e.generateId(t),this.namespace=i,this.arguments=Array.isArray(s)?this.namedArguments(s):s,this._description=r,this.result=!1,this.addParametersToProcess(this.arguments)}namedArguments(e){if(e.length>(this.spec.parameters||[]).length)throw new Error("More arguments specified than parameters available.");let t={};if(Array.isArray(this.spec.parameters))for(let s=0;s<this.spec.parameters.length;s++)t[this.spec.parameters[s].name]=e[s];return t}addParametersToProcess(e){for(let t in e){let s=e[t];s instanceof i?r.isObject(s.spec.schema)&&this.parent.addParameter(s.spec):s instanceof n?this.addParametersToProcess(s.arguments):(Array.isArray(s)||r.isObject(s))&&this.addParametersToProcess(s)}}description(e){return void 0===e?this._description:(this._description=e,this)}exportArgument(e,t){const a=s(456);if(r.isObject(e)){if(e instanceof n||e instanceof i)return e.ref();if(e instanceof a){let s=this.createBuilder(this,t);return e.setBuilder(s),e.generate(),s.toJSON()}if(e instanceof Date)return e.toISOString();if("function"==typeof e.toJSON)return e.toJSON();{let s={};for(let r in e)void 0!==e[r]&&(s[r]=this.exportArgument(e[r],t));return s}}return Array.isArray(e)?e.map((e=>this.exportArgument(e)),t):"function"==typeof e?this.exportCallback(e,t):e}createBuilder(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=new(s(966))(this.parent.processes,this.parent);return null!==e&&null!==t&&r.setParent(e,t),r}exportCallback(e,t){let s=this.createBuilder(this,t),i=s.getParentCallbackParameters(),a=e.bind(s)(...i,s);if(Array.isArray(a)&&s.supports("array_create")?a=s.array_create(a):!r.isObject(a)&&s.supports("constant")&&(a=s.constant(a)),a instanceof n)return a.result=!0,s.toJSON();throw new Error("Callback must return BuilderNode")}toJSON(){let e={process_id:this.spec.id,arguments:{}};this.namespace&&(e.namespace=this.namespace);for(let t in this.arguments)void 0!==this.arguments[t]&&(e.arguments[t]=this.exportArgument(this.arguments[t],t));return"function"!=typeof this.description?e.description=this.description:"string"==typeof this._description&&(e.description=this._description),this.result&&(e.result=!0),e}ref(){return{from_node:this.id}}}e.exports=n},917:e=>{"use strict";class t{static create(e,s){let r=new t(s,null);if("undefined"!=typeof Proxy)return new Proxy(r,{nodeCache:{},get(t,s,i){if(!Reflect.has(t,s)){if(!this.nodeCache[s]){let t={data:r};"string"==typeof s&&s.match(/^(0|[1-9]\d*)$/)?t.index=parseInt(s,10):t.label=s,this.nodeCache[s]=e.process("array_element",t)}return this.nodeCache[s]}return Reflect.get(t,s,i)},set(e,t,s,r){if(!Reflect.has(e,t))throw new Error("Simplified array access is read-only");return Reflect.set(e,t,s,r)}});throw new Error("Simplified array access not supported, use array_element directly")}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;this.name=e,this.spec={name:e,schema:"string"==typeof t?{type:t}:t,description:s},void 0!==r&&(this.spec.optional=!0,this.spec.default=r)}toJSON(){return this.spec}ref(){return{from_parameter:this.name}}}e.exports=t},126:e=>{let t={Token:{Operator:"Operator",Identifier:"Identifier",Number:"Number"}};const s={"⁰":0,"¹":1,"²":2,"³":3,"⁴":4,"⁵":5,"⁶":6,"⁷":7,"⁸":8,"⁹":9},r=Object.keys(s).join("");t.Lexer=function(){let e="",s=0,i=0,n=0,a=t.Token;function o(){let t=i;return t<s?e.charAt(t):"\0"}function l(){let t="\0",r=i;return r<s&&(t=e.charAt(r),i+=1),t}function c(e){return"\t"===e||" "===e||" "===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function d(e){return e>="0"&&e<="9"}function h(e,t){return{type:e,value:t,start:n,end:i-1}}function p(e){return"-"===e||"."===e||"~"===e||"@"===e}function f(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"_"===e||u(e)||d(e)||t&&p(e)}function m(){let e;if(function(){let e;for(;i<s&&(e=o(),c(e));)l()}(),!(i>=s)){if(n=i,e=function(){let e,t;if(e=o(),d(e)||"."===e){if(t="","."!==e)for(t=l();e=o(),d(e);)t+=l();if("."===e)for(t+=l();e=o(),d(e);)t+=l();if("e"===e||"E"===e){if(t+=l(),e=o(),"+"!==e&&"-"!==e&&!d(e))throw e="character "+e,i>=s&&(e="<end>"),new SyntaxError("Unexpected "+e+" after the exponent sign");for(t+=l();e=o(),d(e);)t+=l()}if("."===t)throw new SyntaxError("Expecting decimal digits after the dot sign");return h(a.Number,t)}}(),void 0!==e)return e;if(e=function(){let e=o();if(("+-*/()^,"+r).indexOf(e)>=0)return h(a.Operator,l())}(),void 0!==e)return e;if(e=function(){let e=o();if("_"!==(t=e)&&"#"!==t&&"$"!==t&&!u(t))return;var t;let s=l(),r=!1;for(;;){let t=o();if("$"===e)"$"!==t&&(e="");else if("@"===t)r=!0;else if(!f(t,r))break;s+=l()}return h(a.Identifier,s)}(),void 0!==e)return e;throw new SyntaxError("Unknown token from character "+o())}}return{reset:function(t){e=t,s=t.length,i=0},next:m,peek:function(){let e,t=i;try{e=m(),delete e.start,delete e.end}catch(t){e=void 0}return i=t,e}}},t.Parser=function(){let e=new t.Lexer,i=t.Token;function n(e,t){return void 0!==e&&e.type===i.Operator&&t.includes(e.value)}function a(){let t,s=e.peek();return n(s,"-+")?(s=e.next(),t=a(),{Unary:{operator:s.value,expression:t}}):function(){let t,s=e.peek();if(void 0===s)throw new SyntaxError("Unexpected termination of expression");if(s.type===i.Identifier)return s=e.next(),n(e.peek(),"(")?function(t){let s=[],r=e.next();if(!n(r,"("))throw new SyntaxError('Expecting ( in a function call "'+t+'"');if(r=e.peek(),n(r,")")||(s=function(){let t,s,r=[];for(;s=c(),void 0!==s&&(r.push(s),t=e.peek(),n(t,","));)e.next();return r}()),r=e.next(),!n(r,")"))throw new SyntaxError('Expecting ) in a function call "'+t+'"');return{FunctionCall:{name:t,args:s}}}(s.value):{Identifier:s.value};if(s.type===i.Number)return s=e.next(),{Number:s.value};if(n(s,"(")){if(e.next(),t=c(),s=e.next(),!n(s,")"))throw new SyntaxError("Expecting )");return{Expression:t}}throw new SyntaxError("Parse error, can not process token "+s.value)}()}function o(){let t=a(),i=e.peek();for(;n(i,"^"+r);)i=e.next(),t={Binary:{operator:"^",left:t,right:"^"!==i.value?(o=i.value,"number"==typeof s[o]?{Number:s[o]}:null):a()}},i=e.peek();var o;return t}function l(){let t=o(),s=e.peek();for(;n(s,"*/");)s=e.next(),t={Binary:{operator:s.value,left:t,right:o()}},s=e.peek();return t}function c(){return function(){let t=l(),s=e.peek();for(;n(s,"+-");)s=e.next(),t={Binary:{operator:s.value,left:t,right:l()}},s=e.peek();return t}()}return{parse:function(t){e.reset(t);let s=c(),r=e.next();if(void 0!==r)throw new SyntaxError("Unexpected token "+r.value);return{Expression:s}}}},e.exports=t},11:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e){if(!r.isObject(e))throw new Error("No capabilities retrieved.");if(!e.api_version)throw new Error("Invalid capabilities: No API version retrieved");if(!Array.isArray(e.endpoints))throw new Error("Invalid capabilities: No endpoints retrieved");this.data=e,this.features=this.data.endpoints.map((e=>e.methods.map((t=>(t+" "+e.path).toLowerCase())))).reduce(((e,t)=>e.concat(t)),[]),this.featureMap={capabilities:!0,listFileTypes:"get /file_formats",listServiceTypes:"get /service_types",listUdfRuntimes:"get /udf_runtimes",listCollections:"get /collections",describeCollection:"get /collections/{collection_id}",listCollectionItems:"get /collections/{collection_id}/items",listProcesses:"get /processes",describeProcess:"get /processes",listAuthProviders:!0,authenticateOIDC:"get /credentials/oidc",authenticateBasic:"get /credentials/basic",describeAccount:"get /me",listFiles:"get /files",getFile:"get /files",uploadFile:"put /files/{path}",downloadFile:"get /files/{path}",deleteFile:"delete /files/{path}",validateProcess:"post /validation",listUserProcesses:"get /process_graphs",describeUserProcess:"get /process_graphs/{process_graph_id}",getUserProcess:"get /process_graphs/{process_graph_id}",setUserProcess:"put /process_graphs/{process_graph_id}",replaceUserProcess:"put /process_graphs/{process_graph_id}",deleteUserProcess:"delete /process_graphs/{process_graph_id}",computeResult:"post /result",listJobs:"get /jobs",createJob:"post /jobs",listServices:"get /services",createService:"post /services",getJob:"get /jobs/{job_id}",describeJob:"get /jobs/{job_id}",updateJob:"patch /jobs/{job_id}",deleteJob:"delete /jobs/{job_id}",estimateJob:"get /jobs/{job_id}/estimate",debugJob:"get /jobs/{job_id}/logs",startJob:"post /jobs/{job_id}/results",stopJob:"delete /jobs/{job_id}/results",listResults:"get /jobs/{job_id}/results",downloadResults:"get /jobs/{job_id}/results",describeService:"get /services/{service_id}",getService:"get /services/{service_id}",updateService:"patch /services/{service_id}",deleteService:"delete /services/{service_id}",debugService:"get /services/{service_id}/logs"}}toJSON(){return this.data}apiVersion(){return this.data.api_version}backendVersion(){return this.data.backend_version}title(){return"string"==typeof this.data.title?this.data.title:""}description(){return"string"==typeof this.data.description?this.data.description:""}isStable(){return!0===this.data.production}links(){return Array.isArray(this.data.links)?this.data.links:[]}listFeatures(){let e=[];for(let t in this.featureMap)(!0===this.featureMap[t]||this.features.includes(this.featureMap[t]))&&e.push(t);return e.sort()}hasFeature(e){return!0===this.featureMap[e]||this.features.some((t=>t===this.featureMap[e]))}currency(){return r.isObject(this.data.billing)&&"string"==typeof this.data.billing.currency?this.data.billing.currency:null}listPlans(){if(r.isObject(this.data.billing)&&Array.isArray(this.data.billing.plans)){let e="string"==typeof this.data.billing.default_plan?this.data.billing.default_plan.toLowerCase():null;return this.data.billing.plans.map((t=>{let s={default:e===t.name.toLowerCase()};return Object.assign({},t,s)}))}return[]}}},398:(e,t,s)=>{const r=s(56),i=s(480),n=s(545),a=s(300).default,o=s(19),l=s(439),c=s(112),u=s(833),d=s(11),h=s(113),p=s(291),f=s(512),m=s(49),g=s(295),y=s(966),b=s(985);e.exports=class{constructor(e){var t=this;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.url=r,this.baseUrl=i.normalizeUrl(e),this.authProviderList=null,this.authProvider=null,this.capabilitiesObject=null,this.listeners={},this.options=s,this.processes=new n([],Boolean(s.addNamespaceToProcess)),this.processes.listeners.push((function(){for(var e=arguments.length,s=new Array(e),r=0;r<e;r++)s[r]=arguments[r];return t.emit("processesChanged",...s)}))}async init(){let e=await this._get("/");return this.capabilitiesObject=new d(e.data),this.capabilitiesObject}async refreshProcessCache(){if(0===this.processes.count())return;let e=this.processes.namespaces().map((e=>{let t=()=>Promise.resolve();if("user"===e){let e=this.processes.namespace("user");this.isAuthenticated()?this.capabilities().hasFeature("listUserProcesses")&&(t=()=>this.listUserProcesses(e)):t=()=>this.processes.remove(null,"user")?Promise.resolve():Promise.reject(new Error("Can't clear user processes"))}else this.capabilities().hasFeature("listProcesses")&&(t=()=>this.listProcesses(e));return t().catch((t=>console.warn(`Could not update processes for namespace '${e}' due to an error: ${t.message}`)))}));return await Promise.all(e)}getBaseUrl(){return this.baseUrl}getUrl(){return this.url||this.baseUrl}capabilities(){return this.capabilitiesObject}async listFileTypes(){let e=await this._get("/file_formats");return new h(e.data)}async listServiceTypes(){return(await this._get("/service_types")).data}async listUdfRuntimes(){return(await this._get("/udf_runtimes")).data}async listCollections(){let e=await this._get("/collections");return i.isObject(e.data)&&Array.isArray(e.data.collections)&&(e.data.collections=e.data.collections.map((e=>o.collection(e)))),e.data}async describeCollection(e){let t=await this._get("/collections/"+e);return o.collection(t.data)}async*listCollectionItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=1,a="/collections/"+e+"/items";for(;a;){let e={};1===n&&(Array.isArray(t)&&(e.bbox=t.join(",")),Array.isArray(s)&&(e.datetime=s.map((e=>e instanceof Date?e.toISOString():"string"==typeof e?e:"..")).join("/")),r>0&&(e.limit=r));let l=await this._get(a,e);i.isObject(l.data)&&Array.isArray(l.data.features)&&(l.data.features=l.data.features.map((e=>o.item(e)))),yield l.data,n++,a=this._getLinkHref(l.data.links)}}normalizeNamespace(e){const t=e.match(/^https?:\/\/.*\/processes\/(@?[\w\-.~:]+)\/?/i);return t&&t.length>1?t[1]:e}async listProcesses(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e||(e="backend");let t="backend"===e?"/processes":`/processes/${this.normalizeNamespace(e)}`,s=await this._get(t);if(!i.isObject(s.data)||!Array.isArray(s.data.processes))throw new Error("Invalid response received for processes");return this.processes.remove(null,e),this.processes.addAll(s.data.processes,e),Object.assign(s.data,{processes:this.processes.namespace(e)})}async describeProcess(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t||(t="backend"),"backend"===t)await this.listProcesses();else{let s=await this._get(`/processes/${this.normalizeNamespace(t)}/${e}`);if(!i.isObject(s.data)||"string"!=typeof s.data.id)throw new Error("Invalid response received for process");this.processes.add(s.data,t)}return this.processes.get(e,t)}async buildProcess(e){return await this.listProcesses(),new y(this.processes,null,e)}async listAuthProviders(){if(null!==this.authProviderList)return this.authProviderList;this.authProviderList=[];let e=this.capabilities();if(e.hasFeature("authenticateOIDC")){let e=await this._get("/credentials/oidc"),t=this.getOidcProviderFactory();if(i.isObject(e.data)&&Array.isArray(e.data.providers)&&"function"==typeof t)for(let s in e.data.providers){let r=t(e.data.providers[s]);r instanceof l&&this.authProviderList.push(r)}}return e.hasFeature("authenticateBasic")&&this.authProviderList.push(new c(this)),this.authProviderList}setOidcProviderFactory(e){this.oidcProviderFactory=e}getOidcProviderFactory(){return"function"==typeof this.oidcProviderFactory?this.oidcProviderFactory:u.isSupported()?e=>new u(this,e):null}async authenticateBasic(e,t){let s=new c(this);await s.login(e,t)}isAuthenticated(){return null!==this.authProvider}emit(e){if("function"==typeof this.listeners[e]){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];this.listeners[e](...s)}}on(e,t){this.listeners[e]=t}off(e){delete this.listeners[e]}getAuthProvider(){return this.authProvider}setAuthProvider(e){e!==this.authProvider&&(this.authProvider=e instanceof l?e:null,this.emit("authProviderChanged",this.authProvider),this.refreshProcessCache())}setAuthToken(e,t,s){let r=new l(e,this,{id:t,title:"Custom",description:""});return r.setToken(s),this.setAuthProvider(r),r}async describeAccount(){return(await this._get("/me")).data}async listFiles(){let e=await this._get("/files"),t=e.data.files.map((e=>new p(this,e.path).setAll(e)));return this._toResponseArray(t,e.data)}async uploadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;null===t&&(t=r.fileNameForUpload(e));let n=await this.getFile(t);return await n.uploadFile(e,s,i)}async getFile(e){return new p(this,e)}_normalizeUserProcess(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e instanceof m?e=e.toJSON():e instanceof b?(e.result=!0,e=e.parent.toJSON()):i.isObject(e)&&!i.isObject(e.process_graph)&&(e={process_graph:e}),Object.assign({},t,{process:e})}async validateProcess(e){let t=await this._post("/validation",this._normalizeUserProcess(e).process);if(Array.isArray(t.data.errors))return t.data.errors;throw new Error("Invalid validation response received.")}async listUserProcesses(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=await this._get("/process_graphs");if(!i.isObject(t.data)||!Array.isArray(t.data.processes))throw new Error("Invalid response received for processes");this.processes.remove(null,"user");let s=t.data.processes.map((t=>{let s=e.find((e=>e.id===t.id));return s||(s=new m(this,t.id)),s.setAll(t)})),r=e.length>0?s.map((e=>e.toJSON())):t.data.processes;return this.processes.addAll(r,"user"),this._toResponseArray(s,t.data)}async setUserProcess(e,t){let s=new m(this,e);return await s.replaceUserProcess(t)}async getUserProcess(e){let t=new m(this,e);return await t.describeUserProcess()}async computeResult(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=this._normalizeUserProcess(e,{plan:t,budget:s}),o=await this._post("/result",a,r.getResponseType(),n),l={data:o.data,costs:null,type:null,logs:[]};"number"==typeof o.headers["openeo-costs"]&&(l.costs=o.headers["openeo-costs"]),"string"==typeof o.headers["content-type"]&&(l.type=o.headers["content-type"]);let c=Array.isArray(o.headers.link)?o.headers.link:[o.headers.link];for(let e of c){if("string"!=typeof e)continue;let t=e.match(/^<([^>]+)>;\s?rel="monitor"/i);if(Array.isArray(t)&&t.length>1)try{let e=await this._get(t[1]);i.isObject(e.data)&&Array.isArray(e.data.logs)&&(l.logs=e.data.logs)}catch(e){console.warn(e)}}return l}async downloadResult(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=await this.computeResult(e,s,i,n);await r.saveToFile(a.data,t)}async listJobs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=await this._get("/jobs"),s=t.data.jobs.map((t=>{let s=e.find((e=>e.id===t.id));return s||(s=new f(this,t.id)),s.setAll(t)}));return this._toResponseArray(s,t.data)}async createJob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};n=Object.assign({},n,{title:t,description:s,plan:r,budget:i});let a=this._normalizeUserProcess(e,n),o=await this._post("/jobs",a);if("string"!=typeof o.headers["openeo-identifier"])throw new Error("Response did not contain a Job ID. Job has likely been created, but may not show up yet.");let l=new f(this,o.headers["openeo-identifier"]).setAll(a);return this.capabilities().hasFeature("describeJob")?await l.describeJob():l}async getJob(e){let t=new f(this,e);return await t.describeJob()}async listServices(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=await this._get("/services"),s=t.data.services.map((t=>{let s=e.find((e=>e.id===t.id));return s||(s=new g(this,t.id)),s.setAll(t)}));return this._toResponseArray(s,t.data)}async createService(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},c=this._normalizeUserProcess(e,Object.assign({title:s,description:r,type:t,enabled:i,configuration:n,plan:a,budget:o},l)),u=await this._post("/services",c);if("string"!=typeof u.headers["openeo-identifier"])throw new Error("Response did not contain a Service ID. Service has likely been created, but may not show up yet.");let d=new g(this,u.headers["openeo-identifier"]).setAll(c);return this.capabilities().hasFeature("describeService")?d.describeService():d}async getService(e){let t=new g(this,e);return await t.describeService()}_toResponseArray(e,t){return e.links=Array.isArray(t.links)?t.links:[],e["federation:missing"]=Array.isArray(t["federation:missing"])?t["federation:missing"]:[],e}_getLinkHref(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"next";if(Array.isArray(e)){let s=e.find((e=>i.isObject(e)&&e.rel===t&&"string"==typeof e.href));if(s)return s.href}return null}async _get(e,t,s){return await this._send({method:"get",responseType:s,url:e,timeout:"/"===e?5e3:0,params:t})}async _post(e,t,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i={method:"post",responseType:s,url:e,data:t};return await this._send(i,r)}async _put(e,t){return await this._send({method:"put",url:e,data:t})}async _patch(e,t){return await this._send({method:"patch",url:e,data:t})}async _delete(e){return await this._send({method:"delete",url:e})}async download(e,t){return(await this._send({method:"get",responseType:r.getResponseType(),url:e,authorization:t})).data}async _send(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e.baseURL=this.baseUrl,!this.isAuthenticated()||void 0!==e.authorization&&!0!==e.authorization||(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+this.authProvider.getToken()),e.responseType||(e.responseType="json"),t&&(e.signal=t.signal);try{return await a(e)}catch(t){const s=e=>"string"==typeof e&&-1!==e.indexOf("/json"),n=(e,t)=>("string"==typeof t.message&&(e.message=t.message),e.code="string"==typeof t.code?t.code:"",e.id=t.id,e.links=Array.isArray(t.links)?t.links:[],e);if(i.isObject(t.response)&&i.isObject(t.response.data)&&(s(t.response.data.type)||i.isObject(t.response.headers)&&s(t.response.headers["content-type"]))){if(e.responseType!==r.getResponseType())throw n(t,t.response.data);try{throw n(t,await r.handleErrorResponse(t))}catch(e){console.error(e)}}throw t}}}},113:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e){if(this.data={input:{},output:{}},r.isObject(e)){for(let t of["input","output"])for(let s in e[t])r.isObject(e[t])&&(this.data[t][s.toUpperCase()]=e[t][s]);this["federation:missing"]=e["federation:missing"]}}toJSON(){return this.data}getInputTypes(){return this.data.input}getOutputTypes(){return this.data.output}getInputType(e){return this._findType(e,"input")}getOutputType(e){return this._findType(e,"output")}_findType(e,t){return(e=e.toUpperCase())in this.data[t]?this.data[t][e]:null}}},512:(e,t,s)=>{const r=s(56),i=s(337),n=s(345),a=s(480),o=s(19),l=["finished","canceled","error"];e.exports=class extends i{constructor(e,t){super(e,["id","title","description","process","status","progress","created","updated","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.status=void 0,this.progress=void 0,this.created=void 0,this.updated=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeJob(){let e=await this.connection._get("/jobs/"+this.id);return this.setAll(e.data)}async updateJob(e){return await this.connection._patch("/jobs/"+this.id,this._convertToRequest(e)),this._supports("describeJob")?await this.describeJob():this.setAll(e)}async deleteJob(){await this.connection._delete("/jobs/"+this.id)}async estimateJob(){return(await this.connection._get("/jobs/"+this.id+"/estimate")).data}debugJob(){return new n(this.connection,"/jobs/"+this.id+"/logs")}monitorJob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeJob"))throw new Error("Monitoring Jobs not supported by the back-end.");let i=this.status,n=null,a=null;r.hasFeature("debugJob")&&s&&(a=this.debugJob());let o=async()=>{this.getDataAge()>1&&await this.describeJob();let t=a?await a.nextLogs():[];(i!==this.status||t.length>0)&&e(this,t),i=this.status,l.includes(this.status)&&c()};setTimeout(o,0),n=setInterval(o,1e3*t);let c=()=>{n&&(clearInterval(n),n=null)};return c}async startJob(){return await this.connection._post("/jobs/"+this.id+"/results",{}),this._supports("describeJob")?await this.describeJob():this}async stopJob(){return await this.connection._delete("/jobs/"+this.id+"/results"),this._supports("describeJob")?await this.describeJob():this}async getResultsAsStac(){let e=await this.connection._get("/jobs/"+this.id+"/results");if(!a.isObject(e)||!a.isObject(e.data))throw new Error("Results received from the back-end are invalid");let t=o.stac(e.data);return a.isObject(t.assets)||(t.assets={}),"Feature"===t.type?"number"==typeof e.headers["openeo-costs"]&&(t.properties.costs=e.headers["openeo-costs"]):"number"==typeof e.headers["openeo-costs"]&&(t.costs=e.headers["openeo-costs"]),t}async listResults(){let e=await this.getResultsAsStac();return a.isObject(e.assets)?Object.values(e.assets):[]}async downloadResults(e){let t=await this.listResults();return await r.downloadResults(this.connection,t,e)}}},345:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e,t){this.connection=e,this.endpoint=t,this.lastId=""}async nextLogs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=await this.next(e);return Array.isArray(t.logs)?t.logs:[]}async next(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t={offset:this.lastId};e>0&&(t.limit=e);let s=await this.connection._get(this.endpoint,t);return Array.isArray(s.data.logs)&&s.data.logs.length>0?(s.data.logs=s.data.logs.filter((e=>r.isObject(e)&&"string"==typeof e.id)),this.lastId=s.data.logs[s.data.logs.length-1].id):s.data.logs=[],s.data.links=Array.isArray(s.data.links)?s.data.links:[],s.data}}},833:(e,t,s)=>{const r=s(480),i=s(439),n=s(56),a=s(6);class o extends i{static isSupported(){return r.isObject(a)&&Boolean(a.UserManager)}static async signinCallback(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n.getUrl();e||(e=new o(null,{}),e.setGrant(s.includes("?")?"authorization_code+pkce":"implicit"));let r=e.getOptions(t),i=new a.UserManager(r);return await i.signinCallback(s)}constructor(e,t){super("oidc",e,t),this.manager=null,this.listeners={},this.user=null,this.clientId=null,this.grant="authorization_code+pkce",this.issuer=t.issuer||"",this.scopes=Array.isArray(t.scopes)&&t.scopes.length>0?t.scopes:["openid"],this.refreshTokenScope="offline_access",this.links=Array.isArray(t.links)?t.links:[],this.defaultClients=Array.isArray(t.default_clients)?t.default_clients:[],this.defaultClient=this.detectDefaultClient()}addListener(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";this.manager.events[`add${e}`](t),this.listeners[`${s}:${e}`]=t}removeListener(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";this.manager.events[`remove${e}`](this.listeners[e]),delete this.listeners[`${t}:${e}`]}async login(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.issuer||"string"!=typeof this.issuer)throw new Error("No Issuer URL available for OpenID Connect");this.manager=new a.UserManager(this.getOptions(e,t)),this.addListener("UserLoaded",(async()=>this.setUser(await this.manager.getUser())),"js-client"),this.addListener("AccessTokenExpired",(()=>this.setUser(null)),"js-client"),"popup"===o.uiMethod?await this.manager.signinPopup():await this.manager.signinRedirect()}async logout(){if(null!==this.manager){try{"popup"===o.uiMethod?await this.manager.signoutPopup():await this.manager.signoutRedirect({post_logout_redirect_uri:n.getUrl()})}catch(e){console.warn(e)}super.logout(),this.removeListener("UserLoaded","js-client"),this.removeListener("AccessTokenExpired","js-client"),this.manager=null,this.setUser(null)}}getOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=this.getResponseType(),r=this.scopes.slice(0);return t&&!r.includes(this.refreshTokenScope)&&r.push(this.refreshTokenScope),Object.assign({client_id:this.clientId,redirect_uri:o.redirectUrl,authority:this.issuer.replace("/.well-known/openid-configuration",""),scope:r.join(" "),validateSubOnSilentRenew:!0,response_type:s,response_mode:s.includes("code")?"query":"fragment"},e)}getResponseType(){switch(this.grant){case"authorization_code+pkce":return"code";case"implicit":return"token id_token";default:throw new Error("Grant Type not supported")}}setGrant(e){switch(e){case"authorization_code+pkce":case"implicit":this.grant=e;break;default:throw new Error("Grant Type not supported")}}setClientId(e){this.clientId=e}setUser(e){e?(this.user=e,this.setToken(e.access_token)):(this.user=null,this.setToken(null))}detectDefaultClient(){for(let e of o.grants){let t=this.defaultClients.find((t=>Boolean(t.grant_types.includes(e)&&Array.isArray(t.redirect_urls)&&t.redirect_urls.find((e=>e.startsWith(o.redirectUrl))))));if(t)return this.setGrant(e),this.setClientId(t.id),this.defaultClient=t,t}return null}}o.uiMethod="redirect",o.redirectUrl=n.getUrl().split("#")[0].split("?")[0].replace(/\/$/,""),o.grants=["authorization_code+pkce","implicit"],e.exports=o},213:(e,t,s)=>{const r=s(300).default,{AbortController:i}=s(779),n=s(480),a=s(956),o=s(398),l=s(512),c=s(345),u=s(291),d=s(49),h=s(295),p=s(439),f=s(112),m=s(833),g=s(11),y=s(113),b=s(966),v=s(985),w=s(917),A=s(456),_="1.0.0-rc.2",x="1.x.x";class j{static async connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n.normalizeUrl(e,"/.well-known/openeo"),i=e,o=null;try{if(o=await r.get(s,{timeout:5e3}),!n.isObject(o.data)||!Array.isArray(o.data.versions))throw new Error("Well-Known Document doesn't list any versions.")}catch(e){console.warn("Can't read well-known document, connecting directly to the specified URL as fallback mechanism. Reason: "+e.message)}if(n.isObject(o)){let e=a.findLatest(o.data.versions,!0,_,x);if(null===e)throw new Error("Server not supported. Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");i=e.url}let l=await j.connectDirect(i,t);return l.url=e,l}static async connectDirect(e){let t=new o(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),s=await t.init();if(a.compare(s.apiVersion(),_,"<")||a.compare(s.apiVersion(),x,">"))throw new Error("Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");return t}static clientVersion(){return"2.5.1"}}j.Environment=s(56),e.exports={AbortController:i,AuthProvider:p,BasicProvider:f,Capabilities:g,Connection:o,FileTypes:y,Job:l,Logs:c,OidcProvider:m,OpenEO:j,Service:h,UserFile:u,UserProcess:d,Builder:b,BuilderNode:v,Parameter:w,Formula:A}},295:(e,t,s)=>{const r=s(337),i=s(345);e.exports=class extends r{constructor(e,t){super(e,["id","title","description","process","url","type","enabled","configuration","attributes","created","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.url=void 0,this.type=void 0,this.enabled=void 0,this.configuration=void 0,this.attributes=void 0,this.created=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeService(){let e=await this.connection._get("/services/"+this.id);return this.setAll(e.data)}async updateService(e){return await this.connection._patch("/services/"+this.id,this._convertToRequest(e)),this._supports("describeService")?await this.describeService():this.setAll(e)}async deleteService(){await this.connection._delete("/services/"+this.id)}debugService(){return new i(this.connection,"/services/"+this.id+"/logs")}monitorService(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeService"))throw new Error("Monitoring Services not supported by the back-end.");let i=this.enabled,n=null,a=null;r.hasFeature("debugService")&&s&&(a=this.debugService());let o=async()=>{this.getDataAge()>1&&await this.describeService();let t=a?await a.nextLogs():[];(i!==this.enabled||t.length>0)&&e(this,t),i=this.enabled};return setTimeout(o,0),n=setInterval(o,1e3*t),()=>{n&&(clearInterval(n),n=null)}}}},291:(e,t,s)=>{const r=s(56),i=s(337);e.exports=class extends i{constructor(e,t){super(e,["path","size","modified"]),this.path=t,this.size=void 0,this.modified=void 0}async retrieveFile(){return await this.connection.download("/files/"+this.path,!0)}async downloadFile(e){let t=await this.connection.download("/files/"+this.path,!0);return await r.saveToFile(t,e)}async uploadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i={method:"put",url:"/files/"+this.path,data:r.dataForUpload(e),headers:{"Content-Type":"application/octet-stream"}};"function"==typeof t&&(i.onUploadProgress=e=>{let s=Math.round(100*e.loaded/e.total);t(s,this)});let n=await this.connection._send(i,s);return this.setAll(n.data)}async deleteFile(){await this.connection._delete("/files/"+this.path)}}},49:(e,t,s)=>{const r=s(337),i=s(480);e.exports=class extends r{constructor(e,t){super(e,["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links",["process_graph","processGraph"]]),this.id=t,this.summary=void 0,this.description=void 0,this.categories=void 0,this.parameters=void 0,this.returns=void 0,this.deprecated=void 0,this.experimental=void 0,this.exceptions=void 0,this.examples=void 0,this.links=void 0,this.processGraph=void 0}async describeUserProcess(){let e=await this.connection._get("/process_graphs/"+this.id);if(!i.isObject(e.data)||"string"!=typeof e.data.id)throw new Error("Invalid response received for user process");return this.connection.processes.add(e.data,"user"),this.setAll(e.data)}async replaceUserProcess(e){if(await this.connection._put("/process_graphs/"+this.id,this._convertToRequest(e)),this._supports("describeUserProcess"))return this.describeUserProcess();{let t=this.setAll(e);return this.connection.processes.add(t.toJSON(),"user"),t}}async deleteUserProcess(){await this.connection._delete("/process_graphs/"+this.id),this.connection.processes.remove(this.id,"user")}}},247:function(e,t){var s,r;void 0===(r="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,s,r=e.replace(/^v/,"").replace(/\+.*$/,""),i=(s="-",-1===(t=r).indexOf(s)?t.length:t.indexOf(s)),n=r.substring(0,i).split(".");return n.push(r.substring(i+1)),n}function s(e){return isNaN(Number(e))?e:Number(e)}function r(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 i(e,i){[e,i].forEach(r);for(var n=t(e),a=t(i),o=0;o<Math.max(n.length-1,a.length-1);o++){var l=parseInt(n[o]||0,10),c=parseInt(a[o]||0,10);if(l>c)return 1;if(c>l)return-1}var u=n[n.length-1],d=a[a.length-1];if(u&&d){var h=u.split(".").map(s),p=d.split(".").map(s);for(o=0;o<Math.max(h.length,p.length);o++){if(void 0===h[o]||"string"==typeof p[o]&&"number"==typeof h[o])return-1;if(void 0===p[o]||"string"==typeof h[o]&&"number"==typeof p[o])return 1;if(h[o]>p[o])return 1;if(p[o]>h[o])return-1}}else if(u||d)return u?-1:1;return 0}var n=[">",">=","=","<","<="],a={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return i.validate=function(t){return"string"==typeof t&&e.test(t)},i.compare=function(e,t,s){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===n.indexOf(e))throw new TypeError("Invalid operator, expected one of "+n.join("|"))}(s);var r=i(e,t);return a[s].indexOf(r)>-1},i})?s.apply(t,[]):s)||(e.exports=r)},991:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var r,i,n;if(Array.isArray(t)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(!e(t[i],s[i]))return!1;return!0}if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],s.get(i[0])))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(t[i]!==s[i])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(s,n[i]))return!1;for(i=r;0!=i--;){var a=n[i];if(!e(t[a],s[a]))return!1}return!0}return t!=t&&s!=s}},779:e=>{"use strict";const t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;if(!t)throw new Error("Unable to find global scope. Are you sure this is running in the browser?");if(!t.AbortController)throw new Error('Could not find "AbortController" in the global scope. You need to polyfill it first');e.exports.AbortController=t.AbortController},6:t=>{"use strict";t.exports=e},300:e=>{"use strict";e.exports=t},263:e=>{"use strict";if(void 0===s){var t=new Error("Cannot find module 'multihashes'");throw t.code="MODULE_NOT_FOUND",t}e.exports=s}},i={},function e(t){var s=i[t];if(void 0!==s)return s.exports;var n=i[t]={exports:{}};return r[t].call(n.exports,n,n.exports,e),n.exports}(213);var r,i}));
|
package/package.json
CHANGED
package/src/baseentity.js
CHANGED
|
@@ -9,7 +9,7 @@ class BaseEntity {
|
|
|
9
9
|
* Creates an instance of this object.
|
|
10
10
|
*
|
|
11
11
|
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
|
|
12
|
-
* @param {Array} properties - A mapping from the API property names to the JS client property names (usually to convert between snake_case and camelCase), e.g. `["id", "title", ["process_graph", "processGraph"]]`
|
|
12
|
+
* @param {Array.<string|Array.<string>>} properties - A mapping from the API property names to the JS client property names (usually to convert between snake_case and camelCase), e.g. `["id", "title", ["process_graph", "processGraph"]]`
|
|
13
13
|
*/
|
|
14
14
|
constructor(connection, properties = []) {
|
|
15
15
|
/**
|
package/src/builder/builder.js
CHANGED
|
@@ -251,7 +251,7 @@ class Builder {
|
|
|
251
251
|
/**
|
|
252
252
|
* Gets the callback parameter specifics from the parent process.
|
|
253
253
|
*
|
|
254
|
-
* @returns {Array}
|
|
254
|
+
* @returns {Array.<object.<string,*>>}
|
|
255
255
|
* @todo Should this also pass callback parameters from parents until root is reached?
|
|
256
256
|
*/
|
|
257
257
|
getParentCallbackParameters() {
|
package/src/builder/node.js
CHANGED
|
@@ -63,7 +63,7 @@ class BuilderNode {
|
|
|
63
63
|
/**
|
|
64
64
|
* Converts a sorted array of arguments to an object with the respective parameter names.
|
|
65
65
|
*
|
|
66
|
-
* @param {Array} processArgs
|
|
66
|
+
* @param {Array.<object.<string, *>>} processArgs
|
|
67
67
|
* @returns {object.<string, *>}
|
|
68
68
|
* @throws {Error}
|
|
69
69
|
*/
|
package/src/connection.js
CHANGED
|
@@ -119,11 +119,12 @@ class Connection {
|
|
|
119
119
|
let promises = this.processes.namespaces().map(namespace => {
|
|
120
120
|
let fn = () => Promise.resolve();
|
|
121
121
|
if (namespace === 'user') {
|
|
122
|
+
let userProcesses = this.processes.namespace('user');
|
|
122
123
|
if (!this.isAuthenticated()) {
|
|
123
124
|
fn = () => (this.processes.remove(null, 'user') ? Promise.resolve() : Promise.reject(new Error("Can't clear user processes")));
|
|
124
125
|
}
|
|
125
126
|
else if (this.capabilities().hasFeature('listUserProcesses')) {
|
|
126
|
-
fn = () => this.listUserProcesses();
|
|
127
|
+
fn = () => this.listUserProcesses(userProcesses);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
else if (this.capabilities().hasFeature('listProcesses')) {
|
|
@@ -244,7 +245,7 @@ class Connection {
|
|
|
244
245
|
* 2. Lower left corner, coordinate axis 2
|
|
245
246
|
* 3. Upper right corner, coordinate axis 1
|
|
246
247
|
* 4. Upper right corner, coordinate axis 2
|
|
247
|
-
* @param {?Array
|
|
248
|
+
* @param {?Array} [temporalExtent=null] - Limits the items to the specified temporal interval.
|
|
248
249
|
* The interval has to be specified as an array with exactly two elements (start, end) and
|
|
249
250
|
* each must be either an RFC 3339 compatible string or a Date object.
|
|
250
251
|
* Also supports open intervals by setting one of the boundaries to `null`, but never both.
|
|
@@ -607,14 +608,15 @@ class Connection {
|
|
|
607
608
|
* Lists all files from the user workspace.
|
|
608
609
|
*
|
|
609
610
|
* @async
|
|
610
|
-
* @returns {Promise<
|
|
611
|
+
* @returns {Promise<ResponseArray.<UserFile>>} A list of files.
|
|
611
612
|
* @throws {Error}
|
|
612
613
|
*/
|
|
613
614
|
async listFiles() {
|
|
614
615
|
let response = await this._get('/files');
|
|
615
|
-
|
|
616
|
+
let files = response.data.files.map(
|
|
616
617
|
f => new UserFile(this, f.path).setAll(f)
|
|
617
618
|
);
|
|
619
|
+
return this._toResponseArray(files, response.data);
|
|
618
620
|
}
|
|
619
621
|
|
|
620
622
|
/**
|
|
@@ -708,23 +710,34 @@ class Connection {
|
|
|
708
710
|
* Lists all user-defined processes of the authenticated user.
|
|
709
711
|
*
|
|
710
712
|
* @async
|
|
711
|
-
* @
|
|
713
|
+
* @param {Array.<UserProcess>} [oldProcesses=[]] - A list of existing user-defined processes to update.
|
|
714
|
+
* @returns {Promise<ResponseArray.<UserProcess>>} A list of user-defined processes.
|
|
712
715
|
* @throws {Error}
|
|
713
716
|
*/
|
|
714
|
-
async listUserProcesses() {
|
|
717
|
+
async listUserProcesses(oldProcesses = []) {
|
|
715
718
|
let response = await this._get('/process_graphs');
|
|
716
719
|
|
|
717
720
|
if (!Utils.isObject(response.data) || !Array.isArray(response.data.processes)) {
|
|
718
721
|
throw new Error('Invalid response received for processes');
|
|
719
722
|
}
|
|
720
723
|
|
|
721
|
-
//
|
|
724
|
+
// Remove existing processes from cache
|
|
722
725
|
this.processes.remove(null, 'user');
|
|
723
|
-
this.processes.addAll(response.data.processes, 'user');
|
|
724
726
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
727
|
+
// Update existing processes if needed
|
|
728
|
+
let newProcesses = response.data.processes.map(newProcess => {
|
|
729
|
+
let process = oldProcesses.find(oldProcess => oldProcess.id === newProcess.id);
|
|
730
|
+
if (!process) {
|
|
731
|
+
process = new UserProcess(this, newProcess.id);
|
|
732
|
+
}
|
|
733
|
+
return process.setAll(newProcess);
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
// Store plain JS variant (i.e. no Job objects involved) of processes in cache
|
|
737
|
+
let jsonProcesses = oldProcesses.length > 0 ? newProcesses.map(p => p.toJSON()) : response.data.processes;
|
|
738
|
+
this.processes.addAll(jsonProcesses, 'user');
|
|
739
|
+
|
|
740
|
+
return this._toResponseArray(newProcesses, response.data);
|
|
728
741
|
}
|
|
729
742
|
|
|
730
743
|
/**
|
|
@@ -838,14 +851,20 @@ class Connection {
|
|
|
838
851
|
* Lists all batch jobs of the authenticated user.
|
|
839
852
|
*
|
|
840
853
|
* @async
|
|
841
|
-
* @
|
|
854
|
+
* @param {Array.<Job>} [oldJobs=[]] - A list of existing jobs to update.
|
|
855
|
+
* @returns {Promise<ResponseArray.<Job>>} A list of jobs.
|
|
842
856
|
* @throws {Error}
|
|
843
857
|
*/
|
|
844
|
-
async listJobs() {
|
|
858
|
+
async listJobs(oldJobs = []) {
|
|
845
859
|
let response = await this._get('/jobs');
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
860
|
+
let newJobs = response.data.jobs.map(newJob => {
|
|
861
|
+
let job = oldJobs.find(oldJob => oldJob.id === newJob.id);
|
|
862
|
+
if (!job) {
|
|
863
|
+
job = new Job(this, newJob.id);
|
|
864
|
+
}
|
|
865
|
+
return job.setAll(newJob);
|
|
866
|
+
});
|
|
867
|
+
return this._toResponseArray(newJobs, response.data);
|
|
849
868
|
}
|
|
850
869
|
|
|
851
870
|
/**
|
|
@@ -899,14 +918,20 @@ class Connection {
|
|
|
899
918
|
* Lists all secondary web services of the authenticated user.
|
|
900
919
|
*
|
|
901
920
|
* @async
|
|
902
|
-
* @
|
|
921
|
+
* @param {Array.<Service>} [oldServices=[]] - A list of existing services to update.
|
|
922
|
+
* @returns {Promise<ResponseArray.<Job>>} A list of services.
|
|
903
923
|
* @throws {Error}
|
|
904
924
|
*/
|
|
905
|
-
async listServices() {
|
|
925
|
+
async listServices(oldServices = []) {
|
|
906
926
|
let response = await this._get('/services');
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
927
|
+
let newServices = response.data.services.map(newService => {
|
|
928
|
+
let service = oldServices.find(oldService => oldService.id === newService.id);
|
|
929
|
+
if (!service) {
|
|
930
|
+
service = new Service(this, newService.id);
|
|
931
|
+
}
|
|
932
|
+
return service.setAll(newService);
|
|
933
|
+
});
|
|
934
|
+
return this._toResponseArray(newServices, response.data);
|
|
910
935
|
}
|
|
911
936
|
|
|
912
937
|
/**
|
|
@@ -961,9 +986,26 @@ class Connection {
|
|
|
961
986
|
return await service.describeService();
|
|
962
987
|
}
|
|
963
988
|
|
|
989
|
+
/**
|
|
990
|
+
* Adds additional response details to the array.
|
|
991
|
+
*
|
|
992
|
+
* Adds links and federation:missing.
|
|
993
|
+
*
|
|
994
|
+
* @protected
|
|
995
|
+
* @param {Array.<*>} arr
|
|
996
|
+
* @param {object.<string, *>} response
|
|
997
|
+
* @returns {ResponseArray}
|
|
998
|
+
*/
|
|
999
|
+
_toResponseArray(arr, response) {
|
|
1000
|
+
arr.links = Array.isArray(response.links) ? response.links : [];
|
|
1001
|
+
arr['federation:missing'] = Array.isArray(response['federation:missing']) ? response['federation:missing'] : [];
|
|
1002
|
+
return arr;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
964
1005
|
/**
|
|
965
1006
|
* Get the a link with the given rel type.
|
|
966
1007
|
*
|
|
1008
|
+
* @protected
|
|
967
1009
|
* @param {Array.<Link>} links - An array of links.
|
|
968
1010
|
* @param {string} rel - Relation type to find, defaults to `next`.
|
|
969
1011
|
* @returns {string | null}
|
|
@@ -982,6 +1024,7 @@ class Connection {
|
|
|
982
1024
|
/**
|
|
983
1025
|
* Sends a GET request.
|
|
984
1026
|
*
|
|
1027
|
+
* @protected
|
|
985
1028
|
* @async
|
|
986
1029
|
* @param {string} path
|
|
987
1030
|
* @param {object.<string, *>} query
|
|
@@ -1005,6 +1048,7 @@ class Connection {
|
|
|
1005
1048
|
/**
|
|
1006
1049
|
* Sends a POST request.
|
|
1007
1050
|
*
|
|
1051
|
+
* @protected
|
|
1008
1052
|
* @async
|
|
1009
1053
|
* @param {string} path
|
|
1010
1054
|
* @param {*} body
|
|
@@ -1027,6 +1071,7 @@ class Connection {
|
|
|
1027
1071
|
/**
|
|
1028
1072
|
* Sends a PUT request.
|
|
1029
1073
|
*
|
|
1074
|
+
* @protected
|
|
1030
1075
|
* @async
|
|
1031
1076
|
* @param {string} path
|
|
1032
1077
|
* @param {*} body
|
|
@@ -1044,6 +1089,7 @@ class Connection {
|
|
|
1044
1089
|
/**
|
|
1045
1090
|
* Sends a PATCH request.
|
|
1046
1091
|
*
|
|
1092
|
+
* @protected
|
|
1047
1093
|
* @async
|
|
1048
1094
|
* @param {string} path
|
|
1049
1095
|
* @param {*} body
|
|
@@ -1061,6 +1107,7 @@ class Connection {
|
|
|
1061
1107
|
/**
|
|
1062
1108
|
* Sends a DELETE request.
|
|
1063
1109
|
*
|
|
1110
|
+
* @protected
|
|
1064
1111
|
* @async
|
|
1065
1112
|
* @param {string} path
|
|
1066
1113
|
* @returns {Promise<AxiosResponse>}
|
|
@@ -1105,6 +1152,7 @@ class Connection {
|
|
|
1105
1152
|
* Tries to smoothly handle error responses by providing an object for all response types,
|
|
1106
1153
|
* instead of Streams or Blobs for non-JSON response types.
|
|
1107
1154
|
*
|
|
1155
|
+
* @protected
|
|
1108
1156
|
* @async
|
|
1109
1157
|
* @param {object.<string, *>} options
|
|
1110
1158
|
* @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the request.
|
package/src/filetypes.js
CHANGED
|
@@ -12,6 +12,7 @@ class FileTypes {
|
|
|
12
12
|
*/
|
|
13
13
|
constructor(data) {
|
|
14
14
|
/**
|
|
15
|
+
* @protected
|
|
15
16
|
* @type {FileTypesAPI}
|
|
16
17
|
*/
|
|
17
18
|
this.data = {
|
|
@@ -29,6 +30,13 @@ class FileTypes {
|
|
|
29
30
|
this.data[io][type.toUpperCase()] = data[io][type];
|
|
30
31
|
}
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A list of backends from the federation that are missing in the response data.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
* @type {Array.<string>}
|
|
38
|
+
*/
|
|
39
|
+
this['federation:missing'] = data['federation:missing'];
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
/**
|
package/src/oidcprovider.js
CHANGED
|
@@ -241,7 +241,7 @@ class OidcProvider extends AuthProvider {
|
|
|
241
241
|
client_id: this.clientId,
|
|
242
242
|
redirect_uri: OidcProvider.redirectUrl,
|
|
243
243
|
authority: this.issuer.replace('/.well-known/openid-configuration', ''),
|
|
244
|
-
scope,
|
|
244
|
+
scope: scope.join(' '),
|
|
245
245
|
validateSubOnSilentRenew: true,
|
|
246
246
|
response_type,
|
|
247
247
|
response_mode: response_type.includes('code') ? 'query' : 'fragment'
|
package/src/openeo.js
CHANGED
package/src/typedefs.js
CHANGED
|
@@ -193,6 +193,18 @@
|
|
|
193
193
|
* @type {object.<string, *>}
|
|
194
194
|
*/
|
|
195
195
|
|
|
196
|
+
/**
|
|
197
|
+
* An array, but enriched with additional details from an openEO API response.
|
|
198
|
+
*
|
|
199
|
+
* Adds two properties: `links` and `federation:missing`.
|
|
200
|
+
*
|
|
201
|
+
* @typedef ResponseArray
|
|
202
|
+
* @augments Array
|
|
203
|
+
* @type {Array.<*>}
|
|
204
|
+
* @property {Array.<Link>} links A list of related links.
|
|
205
|
+
* @property {Array.<string>} federation:missing A list of backends from the federation that are missing in the response data.
|
|
206
|
+
*/
|
|
207
|
+
|
|
196
208
|
/**
|
|
197
209
|
* @typedef ServiceType
|
|
198
210
|
* @type {object.<string, *>}
|