@openeo/js-client 2.2.0 → 2.3.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
@@ -2,9 +2,9 @@
2
2
 
3
3
  JavaScript/TypeScript client for the openEO API.
4
4
 
5
- * [Documentation](https://open-eo.github.io/openeo-js-client/2.2.0/).
5
+ * [Documentation](https://open-eo.github.io/openeo-js-client/latest/).
6
6
 
7
- The version of this client is **2.2.0** and supports **openEO API versions 1.x.x**.
7
+ The version of this client is **2.3.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
 
@@ -20,6 +20,7 @@ To use it in a browser environment simply add the following code to your HTML fi
20
20
  ```html
21
21
  <script src="https://cdn.jsdelivr.net/npm/axios@0.21/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
+ <script src="https://cdn.jsdelivr.net/npm/multihashes@3/src/index.min.js"></script> <!-- Only required if you have checksums in the STAC metadata -->
23
24
  <script src="https://cdn.jsdelivr.net/npm/@openeo/js-client@2/openeo.min.js"></script>
24
25
  ```
25
26
 
@@ -53,7 +54,7 @@ In Node.js:
53
54
  In Typescript:
54
55
  * [Basic Discovery (promises)](examples/typescript/discovery.ts)
55
56
 
56
- More information can be found in the [documentation](https://open-eo.github.io/openeo-js-client/2.2.0/).
57
+ More information can be found in the [documentation](https://open-eo.github.io/openeo-js-client/latest/).
57
58
 
58
59
  ## Development
59
60
 
package/openeo.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  import { User, UserManager } from 'oidc-client';
4
4
  import { ProcessRegistry } from '@openeo/js-commons';
5
5
  import { Readable } from 'stream';
6
+ import { AbortController } from "node-abort-controller";
6
7
 
7
8
  declare module OpenEO {
8
9
  /**
@@ -708,10 +709,11 @@ declare module OpenEO {
708
709
  * @async
709
710
  * @param {*} source - The source, see method description for details.
710
711
  * @param {?uploadStatusCallback} statusCallback - Optionally, a callback that is executed on upload progress updates.
712
+ * @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the upload process.
711
713
  * @returns {Promise<UserFile>}
712
714
  * @throws {Error}
713
715
  */
714
- uploadFile(source: any, statusCallback?: uploadStatusCallback | null): Promise<UserFile>;
716
+ uploadFile(source: any, statusCallback?: uploadStatusCallback | null, abortController?: AbortController | null): Promise<UserFile>;
715
717
  /**
716
718
  * Deletes the file from the user workspace.
717
719
  *
@@ -720,13 +722,13 @@ declare module OpenEO {
720
722
  */
721
723
  deleteFile(): Promise<void>;
722
724
  }
723
- namespace UserFile {
724
- export { uploadStatusCallback };
725
- }
726
725
  /**
727
726
  * A callback that is executed on upload progress updates.
728
727
  */
729
728
  type uploadStatusCallback = (percentCompleted: number, file: UserFile) => any;
729
+ namespace UserFile {
730
+ export { uploadStatusCallback };
731
+ }
730
732
  /**
731
733
  * Interface to loop through the logs.
732
734
  */
@@ -1791,7 +1793,7 @@ declare module OpenEO {
1791
1793
  * @param {Options} [options={}] - Additional options for the connection.
1792
1794
  * @param {?string} [url=null] - User-provided URL of the backend connected to.
1793
1795
  */
1794
- constructor(baseUrl: string, options?: Options, url?: string);
1796
+ constructor(baseUrl: string, options?: Options, url?: string | null);
1795
1797
  /**
1796
1798
  * User-provided URL of the backend connected to.
1797
1799
  *
@@ -2133,10 +2135,11 @@ declare module OpenEO {
2133
2135
  * @param {*} source - The source, see method description for details.
2134
2136
  * @param {?string} [targetPath=null] - The target path on the server, relative to the user workspace. Defaults to the file name of the source file.
2135
2137
  * @param {?uploadStatusCallback} [statusCallback=null] - Optionally, a callback that is executed on upload progress updates.
2138
+ * @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the processing request.
2136
2139
  * @returns {Promise<UserFile>}
2137
2140
  * @throws {Error}
2138
2141
  */
2139
- uploadFile(source: any, targetPath?: string | null, statusCallback?: uploadStatusCallback | null): Promise<UserFile>;
2142
+ uploadFile(source: any, targetPath?: string | null, statusCallback?: uploadStatusCallback | null, abortController?: AbortController | null): Promise<UserFile>;
2140
2143
  /**
2141
2144
  * Opens a (existing or non-existing) file without reading any information or creating a new file at the back-end.
2142
2145
  *
@@ -2201,9 +2204,10 @@ declare module OpenEO {
2201
2204
  * @param {Process} process - A user-defined process.
2202
2205
  * @param {?string} [plan=null] - The billing plan to use for this computation.
2203
2206
  * @param {?number} [budget=null] - The maximum budget allowed to spend for this computation.
2207
+ * @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the processing request.
2204
2208
  * @returns {Promise<SyncResult>} - An object with the data and some metadata.
2205
2209
  */
2206
- computeResult(process: Process, plan?: string | null, budget?: number | null): Promise<SyncResult>;
2210
+ computeResult(process: Process, plan?: string | null, budget?: number | null, abortController?: AbortController | null): Promise<SyncResult>;
2207
2211
  /**
2208
2212
  * Executes a process synchronously and downloads to result the given path.
2209
2213
  *
@@ -2218,9 +2222,10 @@ declare module OpenEO {
2218
2222
  * @param {string} targetPath - The target, see method description for details.
2219
2223
  * @param {?string} [plan=null] - The billing plan to use for this computation.
2220
2224
  * @param {?number} [budget=null] - The maximum budget allowed to spend for this computation.
2225
+ * @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the processing request.
2221
2226
  * @throws {Error}
2222
2227
  */
2223
- downloadResult(process: Process, targetPath: string, plan?: string | null, budget?: number | null): Promise<void>;
2228
+ downloadResult(process: Process, targetPath: string, plan?: string | null, budget?: number | null, abortController?: AbortController | null): Promise<void>;
2224
2229
  /**
2225
2230
  * Lists all batch jobs of the authenticated user.
2226
2231
  *
@@ -2314,11 +2319,12 @@ declare module OpenEO {
2314
2319
  * @param {string} path
2315
2320
  * @param {*} body
2316
2321
  * @param {string} responseType - Response type according to axios, defaults to `json`.
2322
+ * @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the request.
2317
2323
  * @returns {Promise<AxiosResponse>}
2318
2324
  * @throws {Error}
2319
2325
  * @see https://github.com/axios/axios#request-config
2320
2326
  */
2321
- _post(path: string, body: any, responseType: string): Promise<AxiosResponse>;
2327
+ _post(path: string, body: any, responseType: string, abortController?: AbortController | null): Promise<AxiosResponse>;
2322
2328
  /**
2323
2329
  * Sends a PUT request.
2324
2330
  *
@@ -2373,11 +2379,12 @@ declare module OpenEO {
2373
2379
  *
2374
2380
  * @async
2375
2381
  * @param {object.<string, *>} options
2382
+ * @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the request.
2376
2383
  * @returns {Promise<AxiosResponse>}
2377
2384
  * @throws {Error}
2378
2385
  * @see https://github.com/axios/axios
2379
2386
  */
2380
- _send(options: any): Promise<AxiosResponse>;
2387
+ _send(options: any, abortController?: AbortController | null): Promise<AxiosResponse>;
2381
2388
  }
2382
2389
  namespace Connection {
2383
2390
  export { oidcProviderFactoryFunction, uploadStatusCallback };
@@ -2393,10 +2400,6 @@ declare module OpenEO {
2393
2400
  * May return `null` if the instance can't be created.
2394
2401
  */
2395
2402
  type oidcProviderFactoryFunction = (providerInfo: any) => AuthProvider | null;
2396
- /**
2397
- * A callback that is executed on upload progress updates.
2398
- */
2399
- type uploadStatusCallback = (percentCompleted: number) => any;
2400
2403
  /**
2401
2404
  * Main class to start with openEO. Allows to connect to a server.
2402
2405
  *