@openeo/js-client 2.9.0 → 2.11.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.9.0** and supports **openEO API versions 1.x.x**.
7
+ The version of this client is **2.10.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
 
@@ -75,7 +75,7 @@ Run tests:
75
75
  * `npm test browser` (browser tests)
76
76
  * `npm test node` (node tests)
77
77
  * `npm test builder` (tests only the process builder)
78
- * `npm test earthengine` (full test suite using the Google Earth Engine back-end as server)
78
+ * `npm test test-api` (full test suite using the openeo-test-api back-end as server)
79
79
 
80
80
  # Contributions
81
81
 
package/openeo.d.ts CHANGED
@@ -70,6 +70,8 @@ declare namespace OpenEO {
70
70
  * Returns the access token that is used as Bearer Token in API requests.
71
71
  *
72
72
  * Returns `null` if no access token has been set yet (i.e. not authenticated any longer).
73
+ *
74
+ * Checks whether the server supports the JWT conformance class.
73
75
  *
74
76
  * @returns {string | null}
75
77
  */
@@ -84,6 +86,13 @@ declare namespace OpenEO {
84
86
  * @param {?string} token
85
87
  */
86
88
  setToken(token: string | null): void;
89
+ /**
90
+ * Tries to resume an existing session.
91
+ *
92
+ * @param {...any} args
93
+ * @returns {boolean} `true` if the session could be resumed, `false` otherwise
94
+ */
95
+ resume(...args: any[]): boolean;
87
96
  /**
88
97
  * Abstract method that extending classes implement the login process with.
89
98
  *
@@ -528,10 +537,18 @@ declare namespace OpenEO {
528
537
  * @type {string | null}
529
538
  */
530
539
  clientId: string | null;
540
+ /**
541
+ * The client secret to use for authentication.
542
+ *
543
+ * Only used for the `client_credentials` grant type.
544
+ *
545
+ * @type {string | null}
546
+ */
547
+ clientSecret: string | null;
531
548
  /**
532
549
  * The grant type (flow) to use for this provider.
533
550
  *
534
- * Either "authorization_code+pkce" (default) or "implicit"
551
+ * Either "authorization_code+pkce" (default), "implicit" or "client_credentials"
535
552
  *
536
553
  * @type {string}
537
554
  */
@@ -567,12 +584,27 @@ declare namespace OpenEO {
567
584
  * @type {Array.<OidcClient>}
568
585
  */
569
586
  defaultClients: Array<OidcClient>;
587
+ /**
588
+ * Additional parameters to include in authorization requests.
589
+ *
590
+ * As defined by the API, these parameters MUST be included when
591
+ * requesting the authorization endpoint.
592
+ *
593
+ * @type {object.<string, *>}
594
+ */
595
+ authorizationParameters: Record<string, any>;
570
596
  /**
571
597
  * The detected default Client.
572
598
  *
573
599
  * @type {OidcClient}
574
600
  */
575
601
  defaultClient: OidcClient;
602
+ /**
603
+ * The cached OpenID Connect well-known configuration document.
604
+ *
605
+ * @type {object.<string, *> | null}
606
+ */
607
+ wellKnownDocument: Record<string, any> | null;
576
608
  /**
577
609
  * Adds a listener to one of the following events:
578
610
  *
@@ -596,7 +628,8 @@ declare namespace OpenEO {
596
628
  /**
597
629
  * Authenticate with OpenID Connect (OIDC).
598
630
  *
599
- * Supported only in Browser environments.
631
+ * Supported in Browser environments for `authorization_code+pkce` and `implicit` grants.
632
+ * The `client_credentials` grant is supported in all environments.
600
633
  *
601
634
  * @async
602
635
  * @param {object.<string, *>} [options={}] - Object with authentication options.
@@ -607,6 +640,53 @@ declare namespace OpenEO {
607
640
  * @see {OidcProvider#refreshTokenScope}
608
641
  */
609
642
  login(options?: Record<string, any>, requestRefreshToken?: boolean): Promise<void>;
643
+ /**
644
+ * Authenticate using the OIDC Client Credentials grant.
645
+ *
646
+ * Requires `clientId` and `clientSecret` to be set.
647
+ * This flow does not use the oidc-client library and works in all environments.
648
+ *
649
+ * @async
650
+ * @protected
651
+ * @returns {Promise<void>}
652
+ * @throws {Error}
653
+ */
654
+ protected loginClientCredentials(): Promise<void>;
655
+ /**
656
+ * Retrieves the OpenID Connect well-known configuration document.
657
+ *
658
+ * @async
659
+ * @returns {Promise<object.<str, *>> | null} The well-known configuration document, or `null` if the issuer URL is not set.
660
+ */
661
+ getWellKnownDocument(): Promise<Record<string, any>> | null;
662
+ /**
663
+ * Discovers the token endpoint from the OpenID Connect issuer.
664
+ *
665
+ * @async
666
+ * @protected
667
+ * @returns {Promise<string>} The token endpoint URL.
668
+ * @throws {Error}
669
+ */
670
+ protected getTokenEndpoint(): Promise<string>;
671
+ /**
672
+ * Checks whether the OpenID Connect provider supports the Client Credentials grant.
673
+ *
674
+ * @async
675
+ * @returns {Promise<boolean|null>} `true` if the Client Credentials grant is supported, `false` otherwise. `null` if unknown.
676
+ */
677
+ supportsClientCredentials(): Promise<boolean | null>;
678
+ /**
679
+ * Restores a previously established OIDC session from storage.
680
+ *
681
+ * Not supported for the `client_credentials` grant as credentials
682
+ * are not persisted. Use `login()` to re-authenticate instead.
683
+ *
684
+ * @async
685
+ * @param {object.<string, *>} [options={}] - Additional options passed to the OIDC UserManager.
686
+ * @returns {Promise<boolean>} `true` if the session could be resumed, `false` otherwise.
687
+ * @see https://github.com/IdentityModel/oidc-client-js/wiki#usermanager
688
+ */
689
+ resume(options?: Record<string, any>): Promise<boolean>;
610
690
  /**
611
691
  * Returns the options for the OIDC client library.
612
692
  *
@@ -642,6 +722,14 @@ declare namespace OpenEO {
642
722
  * @param {string | null} clientId
643
723
  */
644
724
  setClientId(clientId: string | null): void;
725
+ /**
726
+ * Sets the Client Secret for OIDC authentication.
727
+ *
728
+ * Only used for the `client_credentials` grant type.
729
+ *
730
+ * @param {string | null} clientSecret
731
+ */
732
+ setClientSecret(clientSecret: string | null): void;
645
733
  /**
646
734
  * Sets the OIDC User.
647
735
  *