@openeo/js-client 2.6.0 → 2.7.0

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 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.6.0** and supports **openEO API versions 1.x.x**.
7
+ The version of this client is **2.7.0** 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
 
@@ -18,7 +18,7 @@ An *experimental* Typescript declaration file is available so that you can use t
18
18
 
19
19
  To use it in a browser environment simply add the following code to your HTML file:
20
20
  ```html
21
- <script src="https://cdn.jsdelivr.net/npm/axios@0.21/dist/axios.min.js"></script>
21
+ <script src="https://cdn.jsdelivr.net/npm/axios@1/dist/axios.min.js"></script>
22
22
  <script src="https://cdn.jsdelivr.net/npm/oidc-client@1/dist/oidc-client.min.js"></script> <!-- Only required if you'd like to enable authentication via OpenID Connect -->
23
23
  <script src="https://cdn.jsdelivr.net/npm/multihashes@3/src/index.min.js"></script> <!-- Only required if you have checksums in the STAC metadata -->
24
24
  <script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/openeo.min.js"></script>
@@ -91,4 +91,4 @@ This package received major contributions from the following organizations:
91
91
 
92
92
  There is an interactive web-based editor for coding using the openEO API,
93
93
  which is based on the JavaScript client.
94
- See [https://github.com/Open-EO/openeo-web-editor](https://github.com/Open-EO/openeo-web-editor) for more details.
94
+ See [https://github.com/Open-EO/openeo-web-editor](https://github.com/Open-EO/openeo-web-editor) for more details.
package/openeo.d.ts CHANGED
@@ -197,6 +197,14 @@ declare module OpenEO {
197
197
  * @hideconstructor
198
198
  */
199
199
  export class Environment {
200
+ /**
201
+ * The axios instance to use for HTTP requests.
202
+ *
203
+ *
204
+ * @type {object}
205
+ * @static
206
+ */
207
+ static axios: object;
200
208
  /**
201
209
  * Returns the name of the Environment, `Node` or `Browser`.
202
210
  *
@@ -241,7 +249,7 @@ declare module OpenEO {
241
249
  * @param {string|Buffer} str - String to encode.
242
250
  * @returns {string} String encoded in Base64.
243
251
  */
244
- static base64encode(str: string|Buffer): string;
252
+ static base64encode(str: string | Buffer): string;
245
253
  /**
246
254
  * Detect the file name for the given data source.
247
255
  *
@@ -302,14 +310,14 @@ declare module OpenEO {
302
310
  username: string;
303
311
  /**
304
312
  * Authenticate with HTTP Basic.
305
- *
313
+ *
306
314
  * @async
307
- * @param {string} username
308
- * @param {string} password
315
+ * @param {string} username
316
+ * @param {string} password
309
317
  * @returns {Promise<void>}
310
318
  * @throws {Error}
311
319
  */
312
- login(username: string, password: string) : Promise<void>;
320
+ login(username: string, password: string): Promise<void>;
313
321
  }
314
322
  /**
315
323
  * Capabilities of a back-end.
@@ -395,6 +403,12 @@ declare module OpenEO {
395
403
  * @returns {Array.<Link>} Array of link objects (href, title, rel, type)
396
404
  */
397
405
  links(): Array<Link>;
406
+ /**
407
+ * Returns list of backends in the federation.
408
+ *
409
+ * @returns {Array.<FederationBackend>} Array of backends
410
+ */
411
+ listFederation(): Array<FederationBackend>;
398
412
  /**
399
413
  * Lists all supported features.
400
414
  *
@@ -806,9 +820,26 @@ declare module OpenEO {
806
820
  * @type {Connection}
807
821
  */
808
822
  protected connection: Connection;
809
- endpoint: string;
810
- lastId: string;
811
- level: string;
823
+ /**
824
+ * @protected
825
+ * @type {string}
826
+ */
827
+ protected endpoint: string;
828
+ /**
829
+ * @protected
830
+ * @type {string}
831
+ */
832
+ protected lastId: string;
833
+ /**
834
+ * @protected
835
+ * @type {?string}
836
+ */
837
+ protected level: string | null;
838
+ /**
839
+ * @protected
840
+ * @type {Set<string>}
841
+ */
842
+ protected missing: Set<string>;
812
843
  /**
813
844
  * Retrieves the next log entries since the last request.
814
845
  *
@@ -819,6 +850,16 @@ declare module OpenEO {
819
850
  * @returns {Promise<Array.<Log>>}
820
851
  */
821
852
  nextLogs(limit?: number): Promise<Array<Log>>;
853
+ /**
854
+ * Retrieves the backend identifiers that are (partially) missing in the logs.
855
+ *
856
+ * This is only filled after the first request using `nextLogs` or `next`.
857
+ *
858
+ * @returns {Array.<string>}
859
+ * @see {Logs#nextLogs}
860
+ * @see {Logs#next}
861
+ */
862
+ getMissingBackends(): Array<string>;
822
863
  /**
823
864
  * Retrieves the next log entries since the last request.
824
865
  *
@@ -1979,12 +2020,25 @@ declare module OpenEO {
1979
2020
  * List all collections available on the back-end.
1980
2021
  *
1981
2022
  * The collections returned always comply to the latest STAC version (currently 1.0.0).
2023
+ * This function adds a self link to the response if not present.
1982
2024
  *
1983
2025
  * @async
1984
2026
  * @returns {Promise<Collections>} A response compatible to the API specification.
1985
2027
  * @throws {Error}
1986
2028
  */
1987
2029
  listCollections(): Promise<Collections>;
2030
+ /**
2031
+ * Paginate through the collections available on the back-end.
2032
+ *
2033
+ * The collections returned always complies to the latest STAC version (currently 1.0.0).
2034
+ * This function adds a self link to the response if not present.
2035
+ *
2036
+ * @async
2037
+ * @param {?number} [limit=50] - The number of collections per request/page as integer. If `null`, requests all collections.
2038
+ * @yields {Promise<Collections>} A response compatible to the API specification.
2039
+ * @throws {Error}
2040
+ */
2041
+ paginateCollections(limit?: number | null): AsyncGenerator<any, void, unknown>;
1988
2042
  /**
1989
2043
  * Get further information about a single collection.
1990
2044
  *
@@ -1998,12 +2052,11 @@ declare module OpenEO {
1998
2052
  describeCollection(collectionId: string): Promise<Collection>;
1999
2053
  /**
2000
2054
  * Loads items for a specific image collection.
2055
+ *
2001
2056
  * May not be available for all collections.
2002
2057
  *
2003
2058
  * The items returned always comply to the latest STAC version (currently 1.0.0).
2004
2059
  *
2005
- * This is an experimental API and is subject to change.
2006
- *
2007
2060
  * @async
2008
2061
  * @param {string} collectionId - Collection ID to request items for.
2009
2062
  * @param {?Array.<number>} [spatialExtent=null] - Limits the items to the given bounding box in WGS84:
@@ -2035,7 +2088,7 @@ declare module OpenEO {
2035
2088
  */
2036
2089
  protected normalizeNamespace(namespace: string | null): string | null;
2037
2090
  /**
2038
- * List processes available on the back-end.
2091
+ * List all processes available on the back-end.
2039
2092
  *
2040
2093
  * Requests pre-defined processes by default.
2041
2094
  * Set the namespace parameter to request processes from a specific namespace.
@@ -2043,12 +2096,32 @@ declare module OpenEO {
2043
2096
  * Note: The list of namespaces can be retrieved by calling `listProcesses` without a namespace given.
2044
2097
  * The namespaces are then listed in the property `namespaces`.
2045
2098
  *
2099
+ * This function adds a self link to the response if not present.
2100
+ *
2046
2101
  * @async
2047
2102
  * @param {?string} [namespace=null] - Namespace of the processes (default to `null`, i.e. pre-defined processes). EXPERIMENTAL!
2048
2103
  * @returns {Promise<Processes>} - A response compatible to the API specification.
2049
2104
  * @throws {Error}
2050
2105
  */
2051
2106
  listProcesses(namespace?: string | null): Promise<Processes>;
2107
+ /**
2108
+ * Paginate through the processes available on the back-end.
2109
+ *
2110
+ * Requests pre-defined processes by default.
2111
+ * Set the namespace parameter to request processes from a specific namespace.
2112
+ *
2113
+ * Note: The list of namespaces can be retrieved by calling `listProcesses` without a namespace given.
2114
+ * The namespaces are then listed in the property `namespaces`.
2115
+ *
2116
+ * This function adds a self link to the response if not present.
2117
+ *
2118
+ * @async
2119
+ * @param {?string} [namespace=null] - Namespace of the processes (default to `null`, i.e. pre-defined processes). EXPERIMENTAL!
2120
+ * @param {?number} [limit=50] - The number of processes per request/page as integer. If `null`, requests all processes.
2121
+ * @yields {Promise<Processes>} - A response compatible to the API specification.
2122
+ * @throws {Error}
2123
+ */
2124
+ paginateProcesses(namespace?: string | null, limit?: number | null): AsyncGenerator<any, void, unknown>;
2052
2125
  /**
2053
2126
  * Get information about a single process.
2054
2127
  *
@@ -2198,13 +2271,22 @@ declare module OpenEO {
2198
2271
  */
2199
2272
  describeAccount(): Promise<UserAccount>;
2200
2273
  /**
2201
- * Lists all files from the user workspace.
2274
+ * List all files from the user workspace.
2202
2275
  *
2203
2276
  * @async
2204
2277
  * @returns {Promise<ResponseArray.<UserFile>>} A list of files.
2205
2278
  * @throws {Error}
2206
2279
  */
2207
2280
  listFiles(): Promise<ResponseArray<UserFile>>;
2281
+ /**
2282
+ * Paginate through the files from the user workspace.
2283
+ *
2284
+ * @async
2285
+ * @param {?number} [limit=50] - The number of files per request/page as integer. If `null`, requests all files.
2286
+ * @yields {Promise<ResponseArray.<UserFile>>} A list of files.
2287
+ * @throws {Error}
2288
+ */
2289
+ paginateFiles(limit?: number | null): AsyncGenerator<any, void, unknown>;
2208
2290
  /**
2209
2291
  * A callback that is executed on upload progress updates.
2210
2292
  *
@@ -2253,12 +2335,12 @@ declare module OpenEO {
2253
2335
  *
2254
2336
  * @async
2255
2337
  * @param {Process} process - User-defined process to validate.
2256
- * @returns {Promise<Array.<ApiError>>} errors - A list of API compatible error objects. A valid process returns an empty list.
2338
+ * @returns {Promise<ValidationResult>} errors - A list of API compatible error objects. A valid process returns an empty list.
2257
2339
  * @throws {Error}
2258
2340
  */
2259
- validateProcess(process: Process): Promise<Array<ApiError>>;
2341
+ validateProcess(process: Process): Promise<ValidationResult>;
2260
2342
  /**
2261
- * Lists all user-defined processes of the authenticated user.
2343
+ * List all user-defined processes of the authenticated user.
2262
2344
  *
2263
2345
  * @async
2264
2346
  * @param {Array.<UserProcess>} [oldProcesses=[]] - A list of existing user-defined processes to update.
@@ -2266,6 +2348,16 @@ declare module OpenEO {
2266
2348
  * @throws {Error}
2267
2349
  */
2268
2350
  listUserProcesses(oldProcesses?: Array<UserProcess>): Promise<ResponseArray<UserProcess>>;
2351
+ /**
2352
+ * Paginates through the user-defined processes of the authenticated user.
2353
+ *
2354
+ * @async
2355
+ * @param {?number} [limit=50] - The number of processes per request/page as integer. If `null`, requests all processes.
2356
+ * @param {Array.<UserProcess>} [oldProcesses=[]] - A list of existing user-defined processes to update.
2357
+ * @yields {Promise<ResponseArray.<UserProcess>>} A list of user-defined processes.
2358
+ * @throws {Error}
2359
+ */
2360
+ paginateUserProcesses(limit?: number | null, oldProcesses?: Array<UserProcess>): AsyncGenerator<any, void, unknown>;
2269
2361
  /**
2270
2362
  * Creates a new stored user-defined process at the back-end.
2271
2363
  *
@@ -2318,7 +2410,7 @@ declare module OpenEO {
2318
2410
  */
2319
2411
  downloadResult(process: Process, targetPath: string, plan?: string | null, budget?: number | null, abortController?: AbortController | null): Promise<void>;
2320
2412
  /**
2321
- * Lists all batch jobs of the authenticated user.
2413
+ * List all batch jobs of the authenticated user.
2322
2414
  *
2323
2415
  * @async
2324
2416
  * @param {Array.<Job>} [oldJobs=[]] - A list of existing jobs to update.
@@ -2326,6 +2418,16 @@ declare module OpenEO {
2326
2418
  * @throws {Error}
2327
2419
  */
2328
2420
  listJobs(oldJobs?: Array<Job>): Promise<ResponseArray<Job>>;
2421
+ /**
2422
+ * Paginate through the batch jobs of the authenticated user.
2423
+ *
2424
+ * @async
2425
+ * @param {?number} [limit=50] - The number of jobs per request/page as integer. If `null`, requests all jobs.
2426
+ * @param {Array.<Job>} [oldJobs=[]] - A list of existing jobs to update.
2427
+ * @yields {Promise<ResponseArray.<Job>>} A list of jobs.
2428
+ * @throws {Error}
2429
+ */
2430
+ paginateJobs(limit?: number | null, oldJobs?: Array<Job>): AsyncGenerator<any, void, unknown>;
2329
2431
  /**
2330
2432
  * Creates a new batch job at the back-end.
2331
2433
  *
@@ -2350,7 +2452,7 @@ declare module OpenEO {
2350
2452
  */
2351
2453
  getJob(id: string): Promise<Job>;
2352
2454
  /**
2353
- * Lists all secondary web services of the authenticated user.
2455
+ * List all secondary web services of the authenticated user.
2354
2456
  *
2355
2457
  * @async
2356
2458
  * @param {Array.<Service>} [oldServices=[]] - A list of existing services to update.
@@ -2358,6 +2460,16 @@ declare module OpenEO {
2358
2460
  * @throws {Error}
2359
2461
  */
2360
2462
  listServices(oldServices?: Array<Service>): Promise<ResponseArray<Job>>;
2463
+ /**
2464
+ * Paginate through the secondary web services of the authenticated user.
2465
+ *
2466
+ * @async
2467
+ * @param {?number} [limit=50] - The number of services per request/page as integer. If `null` (default), requests all services.
2468
+ * @param {Array.<Service>} [oldServices=[]] - A list of existing services to update.
2469
+ * @yields {Promise<ResponseArray.<Job>>} A list of services.
2470
+ * @throws {Error}
2471
+ */
2472
+ paginateServices(limit?: number | null, oldServices?: Array<Service>): AsyncGenerator<any, void, unknown>;
2361
2473
  /**
2362
2474
  * Creates a new secondary web service at the back-end.
2363
2475
  *
@@ -2392,9 +2504,10 @@ declare module OpenEO {
2392
2504
  * @protected
2393
2505
  * @param {Array.<*>} arr
2394
2506
  * @param {object.<string, *>} response
2507
+ * @param {string} selfUrl
2395
2508
  * @returns {ResponseArray}
2396
2509
  */
2397
- protected _toResponseArray(arr: Array<any>, response: object<string, any>): ResponseArray;
2510
+ protected _toResponseArray(arr: Array<any>, response: object<string, any>, selfUrl: string): ResponseArray;
2398
2511
  /**
2399
2512
  * Get the a link with the given rel type.
2400
2513
  *
@@ -2405,9 +2518,25 @@ declare module OpenEO {
2405
2518
  * @throws {Error}
2406
2519
  */
2407
2520
  protected _getLinkHref(links: Array<Link>, rel: string | Array<string>): string | null;
2521
+ /**
2522
+ * Get the URL of the next page from a response.
2523
+ *
2524
+ * @protected
2525
+ * @param {AxiosResponse} response
2526
+ * @returns {string | null}
2527
+ */
2528
+ protected _getNextLink(response: AxiosResponse): string | null;
2529
+ /**
2530
+ * Add a self link to the response if not present.
2531
+ *
2532
+ * @param {object} data - The body of the response as an object.
2533
+ * @param {string} selfUrl - The URL of the current request.
2534
+ * @returns {object} The modified object.
2535
+ */
2536
+ _addSelfLink(data: object, selfUrl: string): object;
2408
2537
  /**
2409
2538
  * Makes all links in the list absolute.
2410
- *
2539
+ *
2411
2540
  * @param {Array.<Link>} links - An array of links.
2412
2541
  * @param {?string|AxiosResponse} [base=null] - The base url to use for relative links, or an response to derive the url from.
2413
2542
  * @returns {Array.<Link>}
@@ -2486,11 +2615,11 @@ declare module OpenEO {
2486
2615
  download(url: string, authorize: boolean): Promise<Readable | Blob>;
2487
2616
  /**
2488
2617
  * Get the authorization header for requests.
2489
- *
2618
+ *
2490
2619
  * @protected
2491
2620
  * @returns {object.<string, string>}
2492
2621
  */
2493
- protected _getAuthHeaders() : object<string, string>;
2622
+ protected _getAuthHeaders(): object<string, string>;
2494
2623
  /**
2495
2624
  * Sends a HTTP request.
2496
2625
  *
@@ -2635,6 +2764,10 @@ declare module OpenEO {
2635
2764
  export type Collections = {
2636
2765
  collections: Array<Collection>;
2637
2766
  links: Array<Link>;
2767
+ /**
2768
+ * "federation:missing"] A list of backends from the federation that are missing in the response data.
2769
+ */
2770
+ "federation:missing": Array<string>;
2638
2771
  };
2639
2772
  export type Collection = object<string, any>;
2640
2773
  export type FileTypesAPI = {
@@ -2815,17 +2948,58 @@ declare module OpenEO {
2815
2948
  * EXPERIMENTAL!
2816
2949
  */
2817
2950
  namespaces: Array<string> | null;
2951
+ /**
2952
+ * "federation:missing"] A list of backends from the federation that are missing in the response data.
2953
+ */
2954
+ "federation:missing": Array<string>;
2818
2955
  };
2819
2956
  /**
2820
2957
  * An openEO processing chain.
2821
2958
  */
2822
2959
  export type Process = object<string, any>;
2960
+ /**
2961
+ * An array of backends in the federation.
2962
+ */
2963
+ export type FederationBackend = {
2964
+ /**
2965
+ * URL to the versioned API endpoint of the back-end.
2966
+ */
2967
+ url: string;
2968
+ /**
2969
+ * Name of the back-end.
2970
+ */
2971
+ title: string;
2972
+ /**
2973
+ * A description of the back-end and its specifics.
2974
+ */
2975
+ description: string;
2976
+ /**
2977
+ * Current status of the back-ends (online or offline).
2978
+ */
2979
+ status: string;
2980
+ /**
2981
+ * The time at which the status of the back-end was checked last, formatted as a RFC 3339 date-time.
2982
+ */
2983
+ last_status_check: string;
2984
+ /**
2985
+ * If the `status` is `offline`: The time at which the back-end was checked and available the last time. Otherwise, this is equal to the property `last_status_check`. Formatted as a RFC 3339 date-time.
2986
+ */
2987
+ last_successful_check: string;
2988
+ /**
2989
+ * Declares the back-end to be experimental.
2990
+ */
2991
+ experimental: boolean;
2992
+ /**
2993
+ * Declares the back-end to be deprecated.
2994
+ */
2995
+ deprecated: boolean;
2996
+ };
2823
2997
  /**
2824
2998
  * An array, but enriched with additional details from an openEO API response.
2825
2999
  *
2826
- * Adds two properties: `links` and `federation:missing`.
3000
+ * Adds three properties: `url`, `links` and `federation:missing`.
2827
3001
  */
2828
- export type ResponseArray = Array;
3002
+ export type ResponseArray = any;
2829
3003
  export type ServiceType = object<string, any>;
2830
3004
  export type SyncResult = {
2831
3005
  /**
@@ -2864,7 +3038,12 @@ declare module OpenEO {
2864
3038
  budget: number | null;
2865
3039
  links: Array<Link> | null;
2866
3040
  };
2867
-
3041
+ /**
3042
+ * An array, but enriched with additional details from an openEO API response.
3043
+ *
3044
+ * Adds the property `federation:backends`.
3045
+ */
3046
+ export type ValidationResult = any;
2868
3047
  }
2869
3048
 
2870
3049
  export = OpenEO;