@mitumba/sdk 5.1.0 → 5.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/dist/index.d.mts +191 -2
- package/dist/index.d.ts +191 -2
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -677,6 +677,9 @@ var AuthModule = class {
|
|
|
677
677
|
};
|
|
678
678
|
|
|
679
679
|
// src/modules/oauth.ts
|
|
680
|
+
function isConsentRequired(result) {
|
|
681
|
+
return result.consent_required === true;
|
|
682
|
+
}
|
|
680
683
|
var OAuthModule = class {
|
|
681
684
|
constructor(client) {
|
|
682
685
|
this.client = client;
|
|
@@ -751,6 +754,83 @@ var OAuthModule = class {
|
|
|
751
754
|
});
|
|
752
755
|
return result;
|
|
753
756
|
}
|
|
757
|
+
/**
|
|
758
|
+
* Fetch the OpenID Connect discovery document.
|
|
759
|
+
*
|
|
760
|
+
* A relying party reads this to learn the provider's endpoints and capabilities (issuer, the
|
|
761
|
+
* authorize/token/userinfo/jwks URLs, supported scopes, signing algorithms) rather than hard-
|
|
762
|
+
* coding them. Public — no session required.
|
|
763
|
+
*
|
|
764
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
765
|
+
* @returns The discovery metadata
|
|
766
|
+
*/
|
|
767
|
+
async discover(options) {
|
|
768
|
+
return this.client.get("/auth/oauth/openid-configuration", void 0, options);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Fetch the JWKS — the public keys that verify provider-issued id_token signatures.
|
|
772
|
+
*
|
|
773
|
+
* A relying party uses these (matched by the id_token header `kid`) to verify an id_token without
|
|
774
|
+
* a shared secret. Public — no session required. Serves public key parameters only.
|
|
775
|
+
*
|
|
776
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
777
|
+
* @returns The JWKS document
|
|
778
|
+
*/
|
|
779
|
+
async getJwks(options) {
|
|
780
|
+
return this.client.get("/auth/oauth/jwks.json", void 0, options);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Fetch the userinfo claim set for the current session.
|
|
784
|
+
*
|
|
785
|
+
* Returns `sub` plus the identity claims the session's granted scopes allow. Requires an
|
|
786
|
+
* authenticated session — the SDK attaches the bearer token automatically.
|
|
787
|
+
*
|
|
788
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
789
|
+
* @returns The userinfo claims
|
|
790
|
+
*/
|
|
791
|
+
async userinfo(options) {
|
|
792
|
+
return this.client.get("/auth/oauth/userinfo", void 0, options);
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Record the current user's consent to a client's scopes.
|
|
796
|
+
*
|
|
797
|
+
* The accounts consent screen calls this (after the user approves) before retrying
|
|
798
|
+
* {@link OAuthModule.authorize}, which then finds covering consent and mints a code. Requires an
|
|
799
|
+
* authenticated session. Re-granting with a wider scope set supersedes the prior consent.
|
|
800
|
+
*
|
|
801
|
+
* @param input - The client and the space-delimited scopes being granted
|
|
802
|
+
* @param options - Optional per-request options
|
|
803
|
+
* @returns `{ ok: true }` on success
|
|
804
|
+
* @throws {APIError} On `400 invalid_client` / `invalid_scope`, or `401` without a session
|
|
805
|
+
*/
|
|
806
|
+
async grantConsent(input, options) {
|
|
807
|
+
return this.client.post("/auth/oauth/consent", input, options);
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Withdraw the current user's consent for a client (account-console self-service).
|
|
811
|
+
*
|
|
812
|
+
* @param clientId - The client to revoke consent for
|
|
813
|
+
* @param options - Optional per-request options
|
|
814
|
+
* @returns `{ ok: true, revoked }` — `revoked` is false when there was nothing live to revoke
|
|
815
|
+
* @throws {APIError} On `401` without a session
|
|
816
|
+
*/
|
|
817
|
+
async revokeConsent(clientId, options) {
|
|
818
|
+
return this.client.delete(
|
|
819
|
+
`/auth/oauth/consent/${encodeURIComponent(clientId)}`,
|
|
820
|
+
void 0,
|
|
821
|
+
options
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* List the current user's live consents, for a "connected apps" account-management view.
|
|
826
|
+
*
|
|
827
|
+
* @param options - Optional per-request options
|
|
828
|
+
* @returns The live consents (client id + name, granted scopes, grant time)
|
|
829
|
+
* @throws {APIError} On `401` without a session
|
|
830
|
+
*/
|
|
831
|
+
async listConsents(options) {
|
|
832
|
+
return this.client.get("/auth/oauth/consents", void 0, options);
|
|
833
|
+
}
|
|
754
834
|
};
|
|
755
835
|
|
|
756
836
|
// src/modules/listings.ts
|
|
@@ -2631,6 +2711,6 @@ var MitumbaClient = class {
|
|
|
2631
2711
|
}
|
|
2632
2712
|
};
|
|
2633
2713
|
|
|
2634
|
-
export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DisputesModule, IDBTokenStore, LISTING_STATUSES, ListingsModule, MailerModule, MemoryTokenStore, MessagesModule, MitumbaClient, NotificationsModule, OAuthModule, ORDER_STATUSES, OrdersModule, PAYMENT_STATUSES, PayModule, RealtimeProtocolError, RealtimeUnavailableError, ReportsModule, ReviewsModule, SearchModule, SettingsModule, StoresModule, TWO_FACTOR_METHOD_TYPES, UploadsModule, VaziModule, WholesaleModule, WishlistsModule, baleShareUrl, createTokenStore, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
2714
|
+
export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DisputesModule, IDBTokenStore, LISTING_STATUSES, ListingsModule, MailerModule, MemoryTokenStore, MessagesModule, MitumbaClient, NotificationsModule, OAuthModule, ORDER_STATUSES, OrdersModule, PAYMENT_STATUSES, PayModule, RealtimeProtocolError, RealtimeUnavailableError, ReportsModule, ReviewsModule, SearchModule, SettingsModule, StoresModule, TWO_FACTOR_METHOD_TYPES, UploadsModule, VaziModule, WholesaleModule, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
2635
2715
|
//# sourceMappingURL=index.mjs.map
|
|
2636
2716
|
//# sourceMappingURL=index.mjs.map
|