-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathopeneo.d.ts
3049 lines (3045 loc) · 115 KB
/
openeo.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// <reference types="node" />
import { User, UserManager } from 'oidc-client';
import { ProcessRegistry } from '@openeo/js-commons';
import { Readable } from 'stream';
declare module OpenEO {
/**
* The base class for authentication providers such as Basic and OpenID Connect.
*
* @abstract
*/
export class AuthProvider {
/**
* Creates a new OidcProvider instance to authenticate using OpenID Connect.
*
* @param {string} type - The type of the authentication procedure as specified by the API, e.g. `oidc` or `basic`.
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
* @param {AuthProviderMeta} options - Options
*/
constructor(type: string, connection: Connection, options: AuthProviderMeta);
id: string;
title: string;
description: string;
type: string;
/**
* @protected
* @type {Connection}
*/
protected connection: Connection;
token: string;
/**
* Get an identifier for the auth provider (combination of the type + provider identifier).
*
* @returns {string}
*/
getId(): string;
/**
* Returns a display name for the authenticated user.
*
* @returns {string?} Name of the user or `null`
*/
getDisplayName(): string | null;
/**
* Returns the type of the authentication procedure as specified by the API, e.g. `oidc` or `basic`.
*
* @returns {string}
*/
getType(): string;
/**
* Returns the provider identifier, may not be available for all authentication methods.
*
* @returns {string}
*/
getProviderId(): string;
/**
* Returns the human-readable title for the authentication method / provider.
*
* @returns {string}
*/
getTitle(): string;
/**
* Returns the human-readable description for the authentication method / provider.
*
* @returns {string}
*/
getDescription(): string;
/**
* Returns the access token that is used as Bearer Token in API requests.
*
* Returns `null` if no access token has been set yet (i.e. not authenticated any longer).
*
* @returns {string | null}
*/
getToken(): string | null;
/**
* Sets the access token that is used as Bearer Token in API requests.
*
* Set to `null` to remove the access token.
*
* This also manages which auth provider is set for the connection.
*
* @param {?string} token
*/
setToken(token: string | null): void;
/**
* Abstract method that extending classes implement the login process with.
*
* @async
* @param {...*} args
* @throws {Error}
*/
login(...args: any[]): Promise<void>;
/**
* Logout from the established session.
*
* This is experimental and just removes the token for now.
* May need to be overridden by sub-classes.
*
* @async
*/
logout(): Promise<void>;
}
/**
* The base class for entities such as Job, Process Graph, Service etc.
*
* @abstract
*/
export class BaseEntity {
/**
* Creates an instance of this object.
*
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
* @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"]]`
*/
constructor(connection: Connection, properties?: Array<string | Array<string>>);
/**
* @protected
* @type {Connection}
*/
protected connection: Connection;
/**
* @protected
* @type {object.<string, string>}
*/
protected apiToClientNames: object<string, string>;
/**
* @protected
* @type {object.<string, string>}
*/
protected clientToApiNames: object<string, string>;
/**
* @protected
* @type {number}
*/
protected lastRefreshTime: number;
/**
* Additional (non-standardized) properties received from the API.
*
* @protected
* @type {object.<string, *>}
*/
protected extra: object<string, any>;
/**
* Returns a JSON serializable representation of the data that is API compliant.
*
* @returns {object.<string, *>}
*/
toJSON(): object<string, any>;
/**
* Converts the data from an API response into data suitable for our JS client models.
*
* @param {object.<string, *>} metadata - JSON object originating from an API response.
* @returns {BaseEntity} Returns the object itself.
*/
setAll(metadata: object<string, any>): BaseEntity;
/**
* Returns the age of the data in seconds.
*
* @returns {number} Age of the data in seconds as integer.
*/
getDataAge(): number;
/**
* Returns all data in the model.
*
* @returns {object.<string, *>}
*/
getAll(): object<string, any>;
/**
* Get a value from the additional data that is not part of the core model, i.e. from proprietary extensions.
*
* @param {string} name - Name of the property.
* @returns {*} The value, which could be of any type.
*/
get(name: string): any;
/**
* Converts the object to a valid objects for API requests.
*
* @param {object.<string, *>} parameters
* @returns {object.<string, *>}
* @protected
*/
protected _convertToRequest(parameters: object<string, any>): object<string, any>;
/**
* Checks whether a features is supported by the API.
*
* @param {string} feature
* @returns {boolean}
* @protected
* @see Capabilities#hasFeature
*/
protected _supports(feature: string): boolean;
}
/**
* Platform dependant utilities for the openEO JS Client.
*
* @hideconstructor
*/
export class Environment {
/**
* The axios instance to use for HTTP requests.
*
*
* @type {object}
* @static
*/
static axios: object;
/**
* Returns the name of the Environment, `Node` or `Browser`.
*
* @returns {string}
* @static
*/
static getName(): string;
/**
* Returns the URL of the Environment.
*
* @returns {string}
* @static
*/
static getUrl(): string;
/**
* Sets the URL of the Environment.
*
* @param {string} uri
* @static
*/
static setUrl(uri: string): void;
/**
* Handles errors from the API that are returned as Blobs/Streams.
*
* @ignore
* @static
* @param {Blob | Readable} error
* @returns {Promise<void>}
*/
static handleErrorResponse(error: Blob | Readable): Promise<void>;
/**
* Returns how binary responses from the servers are returned (`stream` or `blob`).
*
* @returns {string}
* @static
*/
static getResponseType(): string;
/**
* Encodes a string into Base64 encoding.
*
* @static
* @param {string|Buffer} str - String to encode.
* @returns {string} String encoded in Base64.
*/
static base64encode(str: string | Buffer): string;
/**
* Detect the file name for the given data source.
*
* @ignore
* @static
* @param {*} source - An object from a file upload form.
* @returns {string}
*/
static fileNameForUpload(source: any): string;
/**
* Get the data from the source that should be uploaded.
*
* @ignore
* @static
* @param {*} source - An object from a file upload form.
* @returns {*}
*/
static dataForUpload(source: any): any;
/**
* Downloads files to local storage and returns a list of file paths.
*
* Not supported in Browsers and only throws an Error!
*
* @static
* @param {Connection} con
* @param {Array.<object.<string, *>>} assets
* @param {string} targetFolder
* @throws {Error}
*/
static downloadResults(con: Connection, assets: Array<object<string, any>>, targetFolder: string): Promise<void>;
/**
* Streams data into a file (node) or offers data to download (browser).
*
* This method may fail with overly big data in browsers.
*
* @async
* @static
* @param {*} data - Data to save.
* @param {string} filename - File path to store the data at (node) or file name that is suggested to the user (browser).
* @returns {Promise<void>}
* @throws {Error}
* @see https://github.com/kennethjiang/js-file-download/blob/master/file-download.js
*/
static saveToFile(data: any, filename: string): Promise<void>;
}
/**
* The Authentication Provider for HTTP Basic.
*
* @augments AuthProvider
*/
export class BasicProvider extends AuthProvider {
/**
* Creates a new BasicProvider instance to authenticate using HTTP Basic.
*
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
*/
constructor(connection: Connection);
username: string;
/**
* Authenticate with HTTP Basic.
*
* @async
* @param {string} username
* @param {string} password
* @returns {Promise<void>}
* @throws {Error}
*/
login(username: string, password: string): Promise<void>;
}
/**
* Capabilities of a back-end.
*/
export class Capabilities {
/**
* Creates a new Capabilities object from an API-compatible JSON response.
*
* @param {object.<string, *>} data - A capabilities response compatible to the API specification for `GET /`.
* @throws {Error}
*/
constructor(data: object<string, any>);
/**
* @private
* @type {object.<string, *>}
*/
private data;
/**
* @private
* @ignore
* @type {object.<string, string>}
*/
private featureMap;
/**
* @private
* @type {Array.<string>}
*/
private features;
/**
* Validates the capabilities.
*
* Throws an error in case of an issue, otherwise just passes.
*
* @protected
* @throws {Error}
*/
protected validate(): void;
/**
* Initializes the class.
*
* @protected
*/
protected init(): void;
/**
* Returns the capabilities response as a JSON serializable representation of the data that is API compliant.
*
* @returns {object.<string, *>} - A reference to the capabilities response.
*/
toJSON(): object<string, any>;
/**
* Returns the openEO API version implemented by the back-end.
*
* @returns {string} openEO API version number.
*/
apiVersion(): string;
/**
* Returns the back-end version number.
*
* @returns {string} openEO back-end version number.
*/
backendVersion(): string;
/**
* Returns the back-end title.
*
* @returns {string} Title
*/
title(): string;
/**
* Returns the back-end description.
*
* @returns {string} Description
*/
description(): string;
/**
* Is the back-end suitable for use in production?
*
* @returns {boolean} true = stable/production, false = unstable
*/
isStable(): boolean;
/**
* Returns the links.
*
* @returns {Array.<Link>} Array of link objects (href, title, rel, type)
*/
links(): Array<Link>;
/**
* Returns list of backends in the federation.
*
* @returns {Array.<FederationBackend>} Array of backends
*/
listFederation(): Array<FederationBackend>;
/**
* Lists all supported features.
*
* @returns {Array.<string>} An array of supported features.
*/
listFeatures(): Array<string>;
/**
* Check whether a feature is supported by the back-end.
*
* @param {string} methodName - A feature name (corresponds to the JS client method names, see also the feature map for allowed values).
* @returns {boolean} `true` if the feature is supported, otherwise `false`.
*/
hasFeature(methodName: string): boolean;
/**
* Get the billing currency.
*
* @returns {string | null} The billing currency or `null` if not available.
*/
currency(): string | null;
/**
* List all billing plans.
*
* @returns {Array.<BillingPlan>} Billing plans
*/
listPlans(): Array<BillingPlan>;
/**
* Migrates a response, if required.
*
* @param {AxiosResponse} response
* @protected
* @returns {AxiosResponse}
*/
protected migrate(response: AxiosResponse): AxiosResponse;
}
/**
* The Authentication Provider for OpenID Connect.
*
* See the openid-connect-popup.html and openid-connect-redirect.html files in
* the `/examples/oidc` folder for usage examples in the browser.
*
* If you want to implement OIDC in a non-browser environment, you can override
* the OidcProvider or AuthProvider classes with custom behavior.
* In this case you must provide a function that creates your new class to the
* `Connection.setOidcProviderFactory()` method.
*
* @augments AuthProvider
* @see Connection#setOidcProviderFactory
*/
export class OidcProvider extends AuthProvider {
/**
* Checks whether the required OIDC client library `openid-client-js` is available.
*
* @static
* @returns {boolean}
*/
static isSupported(): boolean;
/**
* Finishes the OpenID Connect sign in (authentication) workflow.
*
* Must be called in the page that OpenID Connect redirects to after logging in.
*
* Supported only in Browser environments.
*
* @async
* @static
* @param {OidcProvider} provider - A OIDC provider to assign the user to.
* @param {object.<string, *>} [options={}] - Object with additional options.
* @returns {Promise<?User>} For uiMethod = 'redirect' only: OIDC User
* @throws {Error}
* @see https://github.com/IdentityModel/oidc-client-js/wiki#other-optional-settings
*/
static signinCallback(provider?: OidcProvider, options?: object<string, any>): Promise<User | null>;
/**
* Creates a new OidcProvider instance to authenticate using OpenID Connect.
*
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
* @param {OidcProviderMeta} options - OpenID Connect Provider details as returned by the API.
*/
constructor(connection: Connection, options: OidcProviderMeta);
manager: UserManager;
listeners: {};
/**
* The authenticated OIDC user.
*
* @type {User}
*/
user: Oidc.User;
/**
* The client ID to use for authentication.
*
* @type {string | null}
*/
clientId: string | null;
/**
* The grant type (flow) to use for this provider.
*
* Either "authorization_code+pkce" (default) or "implicit"
*
* @type {string}
*/
grant: string;
/**
* The issuer, i.e. the link to the identity provider.
*
* @type {string}
*/
issuer: string;
/**
* The scopes to be requested.
*
* @type {Array.<string>}
*/
scopes: Array<string>;
/**
* The scope that is used to request a refresh token.
*
* @type {string}
*/
refreshTokenScope: string;
/**
* Any additional links.
*
*
* @type {Array.<Link>}
*/
links: Array<Link>;
/**
* The default clients made available by the back-end.
*
* @type {Array.<OidcClient>}
*/
defaultClients: Array<OidcClient>;
/**
* The detected default Client.
*
* @type {OidcClient}
*/
defaultClient: OidcClient;
/**
* Adds a listener to one of the following events:
*
* - AccessTokenExpiring: Raised prior to the access token expiring.
* - AccessTokenExpired: Raised after the access token has expired.
* - SilentRenewError: Raised when the automatic silent renew has failed.
*
* @param {string} event
* @param {Function} callback
* @param {string} [scope="default"]
*/
addListener(event: string, callback: Function, scope?: string): void;
/**
* Removes the listener for the given event that has been set with addListener.
*
* @param {string} event
* @param {string} [scope="default"]
* @see OidcProvider#addListener
*/
removeListener(event: string, scope?: string): void;
/**
* Authenticate with OpenID Connect (OIDC).
*
* Supported only in Browser environments.
*
* @async
* @param {object.<string, *>} [options={}] - Object with authentication options.
* @param {boolean} [requestRefreshToken=false] - If set to `true`, adds a scope to request a refresh token.
* @returns {Promise<void>}
* @throws {Error}
* @see https://github.com/IdentityModel/oidc-client-js/wiki#other-optional-settings
* @see {OidcProvider#refreshTokenScope}
*/
login(options?: object<string, any>, requestRefreshToken?: boolean): Promise<void>;
/**
* Returns the options for the OIDC client library.
*
* Options can be overridden by custom options via the options parameter.
*
* @protected
* @param {object.<string, *>} options
* @param {boolean} [requestRefreshToken=false] - If set to `true`, adds a scope to request a refresh token.
* @returns {object.<string, *>}
* @see {OidcProvider#refreshTokenScope}
*/
protected getOptions(options?: object<string, any>, requestRefreshToken?: boolean): object<string, any>;
/**
* Get the response_type based on the grant type.
*
* @protected
* @returns {string}
* @throws {Error}
*/
protected getResponseType(): string;
/**
* Sets the grant type (flow) used for OIDC authentication.
*
* @param {string} grant - Grant Type
* @throws {Error}
*/
setGrant(grant: string): void;
/**
* Sets the Client ID for OIDC authentication.
*
* This may override a detected default client ID.
*
* @param {string | null} clientId
*/
setClientId(clientId: string | null): void;
/**
* Sets the OIDC User.
*
* @see https://github.com/IdentityModel/oidc-client-js/wiki#user
* @param {User | null} user - The OIDC User. Passing `null` resets OIDC authentication details.
*/
setUser(user: User | null): void;
/**
* Detects the default OIDC client ID for the given redirect URL.
*
* Sets the grant and client ID accordingly.
*
* @returns {OidcClient | null}
* @see OidcProvider#setGrant
* @see OidcProvider#setClientId
*/
detectDefaultClient(): OidcClient | null;
}
export namespace OidcProvider {
let uiMethod: string;
let redirectUrl: string;
let grants: Array<string>;
}
/**
* Manages the files types supported by the back-end.
*/
export class FileTypes {
/**
* Creates a new FileTypes object from an API-compatible JSON response.
*
* @param {FileTypesAPI} data - A capabilities response compatible to the API specification for `GET /file_formats`.
*/
constructor(data: FileTypesAPI);
/**
* @protected
* @type {FileTypesAPI}
*/
protected data: FileTypesAPI;
/**
* A list of backends from the federation that are missing in the response data.
*
* @public
* @type {Array.<string>}
*/
public 'federation:missing': Array<string>;
/**
* Returns the file types response as a JSON serializable representation of the data that is API compliant.
*
* @returns {FileTypesAPI}
*/
toJSON(): FileTypesAPI;
/**
* Returns the input file formats.
*
* @returns {object.<string, FileType>}
*/
getInputTypes(): object<string, FileType>;
/**
* Returns the output file formats.
*
* @returns {object.<string, FileType>}
*/
getOutputTypes(): object<string, FileType>;
/**
* Returns a single input file format for a given identifier.
*
* Returns null if no input file format was found for the given identifier.
*
* @param {string} type - Case-insensitive file format identifier
* @returns {FileType | null}
*/
getInputType(type: string): FileType | null;
/**
* Returns a single output file format for a given identifier.
*
* Returns null if no output file format was found for the given identifier.
*
* @param {string} type - Case-insensitive file format identifier
* @returns {FileType | null}
*/
getOutputType(type: string): FileType | null;
/**
* Get a file type object from the list of input or output file formats.
*
* @param {string} type - Identifier of the file type
* @param {string} io - Either `input` or `output`
* @returns {FileType | null}
* @protected
*/
protected _findType(type: string, io: string): FileType | null;
}
/**
* A File on the user workspace.
*
* @augments BaseEntity
*/
export class UserFile extends BaseEntity {
/**
* Creates an object representing a file on the user workspace.
*
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
* @param {string} path - The path to the file, relative to the user workspace and without user ID.
*/
constructor(connection: Connection, path: string);
/**
* Path to the file, relative to the user's directory.
* @readonly
* @public
* @type {string}
*/
public readonly path: string;
/**
* File size in bytes as integer.
* @readonly
* @public
* @type {number}
*/
public readonly size: number;
/**
* Date and time the file has lastly been modified, formatted as a RFC 3339 date-time.
* @readonly
* @public
* @type {string}
*/
public readonly modified: string;
/**
* Downloads a file from the user workspace into memory.
*
* This method has different behaviour depending on the environment.
* Returns a stream in a NodeJS environment or a Blob in a browser environment.
*
* @async
* @returns {Promise<Readable|Blob>} - Return value depends on the target and environment, see method description for details.
* @throws {Error}
*/
retrieveFile(): Promise<Readable | Blob>;
/**
* Downloads a file from the user workspace and saves it.
*
* This method has different behaviour depending on the environment.
* In a NodeJS environment writes the downloaded file to the target location on the file system.
* In a browser environment offers the file for downloading using the specified name (folders are not supported).
*
* @async
* @param {string} target - The target, see method description for details.
* @returns {Promise<Array.<string>|void>} - Return value depends on the target and environment, see method description for details.
* @throws {Error}
*/
downloadFile(target: string): Promise<Array<string> | void>;
/**
* A callback that is executed on upload progress updates.
*
* @callback uploadStatusCallback
* @param {number} percentCompleted - The percent (0-100) completed.
* @param {UserFile} file - The file object corresponding to the callback.
*/
/**
* Uploads a file to the user workspace.
* If a file with the name exists, overwrites it.
*
* This method has different behaviour depending on the environment.
* In a nodeJS environment the source must be a path to a file as string.
* In a browser environment the source must be an object from a file upload form.
*
* @async
* @param {*} source - The source, see method description for details.
* @param {?uploadStatusCallback} statusCallback - Optionally, a callback that is executed on upload progress updates.
* @param {?AbortController} [abortController=null] - An AbortController object that can be used to cancel the upload process.
* @returns {Promise<UserFile>}
* @throws {Error}
*/
uploadFile(source: any, statusCallback?: uploadStatusCallback | null, abortController?: AbortController | null): Promise<UserFile>;
/**
* Deletes the file from the user workspace.
*
* @async
* @throws {Error}
*/
deleteFile(): Promise<void>;
}
/**
* A callback that is executed on upload progress updates.
*/
type uploadStatusCallback = (percentCompleted: number, file: UserFile) => any;
namespace UserFile {
export { uploadStatusCallback };
}
/**
* Interface to loop through the logs.
*/
export class Logs {
/**
* Creates a new Logs instance to retrieve logs from a back-end.
*
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
* @param {string} endpoint - The relative endpoint to request the logs from, usually `/jobs/.../logs` or `/services/.../logs` with `...` being the actual job or service id.
* @param {?string} [level=null] - Minimum level of logs to return.
*/
constructor(connection: Connection, endpoint: string, level?: string | null);
/**
* @protected
* @type {Connection}
*/
protected connection: Connection;
/**
* @protected
* @type {string}
*/
protected endpoint: string;
/**
* @protected
* @type {string}
*/
protected lastId: string;
/**
* @protected
* @type {?string}
*/
protected level: string | null;
/**
* @protected
* @type {Set<string>}
*/
protected missing: Set<string>;
/**
* Retrieves the next log entries since the last request.
*
* Retrieves log entries only.
*
* @async
* @param {number} limit - The number of log entries to retrieve per request, as integer.
* @returns {Promise<Array.<Log>>}
*/
nextLogs(limit?: number): Promise<Array<Log>>;
/**
* Retrieves the backend identifiers that are (partially) missing in the logs.
*
* This is only filled after the first request using `nextLogs` or `next`.
*
* @returns {Array.<string>}
* @see {Logs#nextLogs}
* @see {Logs#next}
*/
getMissingBackends(): Array<string>;
/**
* Retrieves the next log entries since the last request.
*
* Retrieves the full response compliant to the API, including log entries and links.
*
* @async
* @param {number} limit - The number of log entries to retrieve per request, as integer.
* @returns {Promise<LogsAPI>}
*/
next(limit?: number): Promise<LogsAPI>;
}
/**
* A Batch Job.
*
* @augments BaseEntity
*/
export class Job extends BaseEntity {
/**
* Creates an object representing a batch job stored at the back-end.
*
* @param {Connection} connection - A Connection object representing an established connection to an openEO back-end.
* @param {string} jobId - The batch job ID.
*/
constructor(connection: Connection, jobId: string);
/**
* The identifier of the batch job.
* @public
* @readonly
* @type {string}
*/
public readonly id: string;
/**
* @public
* @readonly
* @type {?string}
*/
public readonly title: string | null;
/**
* @public
* @readonly
* @type {?string}
*/
public readonly description: string | null;
/**
* The process chain to be executed.
* @public
* @readonly
* @type {?Process}
*/
public readonly process: Process | null;
/**
* The current status of a batch job.
* One of "created", "queued", "running", "canceled", "finished" or "error".
* @public
* @readonly
* @type {?string}
*/
public readonly status: string | null;
/**
* Indicates the process of a running batch job in percent.
* @public
* @readonly
* @type {?number}
*/
public readonly progress: number | null;
/**
* Date and time of creation, formatted as a RFC 3339 date-time.
* @public
* @readonly
* @type {?string}
*/
public readonly created: string | null;
/**
* Date and time of the last status change, formatted as a RFC 3339 date-time.
* @public
* @readonly
* @type {?string}
*/
public readonly updated: string | null;
/**
* The billing plan to process and charge the batch job with.
* @public
* @readonly
* @type {?string}
*/
public readonly plan: string | null;
/**
* An amount of money or credits in the currency specified by the back-end.
* @public
* @readonly
* @type {?number}
*/
public readonly costs: number | null;
/**
* Maximum amount of costs the request is allowed to produce in the currency specified by the back-end.
* @public
* @readonly
* @type {?number}
*/
public readonly budget: number | null;
/**
* Updates the batch job data stored in this object by requesting the metadata from the back-end.
*
* @async
* @returns {Promise<Job>} The update job object (this).
* @throws {Error}
*/
describeJob(): Promise<Job>;
/**
* Modifies the batch job at the back-end and afterwards updates this object, too.
*
* @async
* @param {object} parameters - An object with properties to update, each of them is optional, but at least one of them must be specified. Additional properties can be set if the server supports them.
* @param {Process} parameters.process - A new process.
* @param {string} parameters.title - A new title.
* @param {string} parameters.description - A new description.
* @param {string} parameters.plan - A new plan.
* @param {number} parameters.budget - A new budget.
* @returns {Promise<Job>} The updated job object (this).
* @throws {Error}
*/
updateJob(parameters: {
process: Process;
title: string;
description: string;
plan: string;
budget: number;
}): Promise<Job>;
/**
* Deletes the batch job from the back-end.
*
* @async
* @throws {Error}
*/
deleteJob(): Promise<void>;
/**
* Calculate an estimate (potentially time/costs/volume) for a batch job.
*