@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.d.mts
CHANGED
|
@@ -1416,6 +1416,128 @@ interface OAuthTokenResult {
|
|
|
1416
1416
|
/** Space-delimited list of scopes actually granted. */
|
|
1417
1417
|
scope: string;
|
|
1418
1418
|
}
|
|
1419
|
+
/**
|
|
1420
|
+
* The OpenID Connect discovery document, as served by `GET /auth/oauth/openid-configuration`.
|
|
1421
|
+
*
|
|
1422
|
+
* A relying party reads this once to learn the provider's endpoints and capabilities instead of
|
|
1423
|
+
* hard-coding them. The fields mirror the standard OIDC discovery metadata the backend advertises.
|
|
1424
|
+
*/
|
|
1425
|
+
interface OpenIdConfiguration {
|
|
1426
|
+
/** The issuer identifier that appears in id_token `iss`. */
|
|
1427
|
+
issuer: string;
|
|
1428
|
+
/** Where the authorization code is minted. */
|
|
1429
|
+
authorization_endpoint: string;
|
|
1430
|
+
/** Where a code is exchanged for tokens. */
|
|
1431
|
+
token_endpoint: string;
|
|
1432
|
+
/** Where the consented claims for an access token are read. */
|
|
1433
|
+
userinfo_endpoint: string;
|
|
1434
|
+
/** The JWKS URL whose public keys verify id_token signatures. */
|
|
1435
|
+
jwks_uri: string;
|
|
1436
|
+
/** Supported OAuth response types (e.g. `['code']`). */
|
|
1437
|
+
response_types_supported: string[];
|
|
1438
|
+
/** Supported grant types (e.g. `['authorization_code']`). */
|
|
1439
|
+
grant_types_supported: string[];
|
|
1440
|
+
/** Supported PKCE challenge methods (e.g. `['S256']`). */
|
|
1441
|
+
code_challenge_methods_supported: string[];
|
|
1442
|
+
/** id_token signing algorithms (e.g. `['ES256']`). */
|
|
1443
|
+
id_token_signing_alg_values_supported: string[];
|
|
1444
|
+
/** Requestable scopes (e.g. `['openid','profile','email','phone']`). */
|
|
1445
|
+
scopes_supported: string[];
|
|
1446
|
+
/** Subject identifier types (e.g. `['public']`). */
|
|
1447
|
+
subject_types_supported: string[];
|
|
1448
|
+
/** Supported client authentication methods at the token endpoint. */
|
|
1449
|
+
token_endpoint_auth_methods_supported: string[];
|
|
1450
|
+
}
|
|
1451
|
+
/** A single JSON Web Key, public parameters only (as served by the JWKS endpoint). */
|
|
1452
|
+
interface Jwk {
|
|
1453
|
+
/** Key type, e.g. `'EC'`. */
|
|
1454
|
+
kty: string;
|
|
1455
|
+
/** Intended use, e.g. `'sig'`. */
|
|
1456
|
+
use?: string;
|
|
1457
|
+
/** Algorithm, e.g. `'ES256'`. */
|
|
1458
|
+
alg?: string;
|
|
1459
|
+
/** Key id; matches the id_token header `kid`. */
|
|
1460
|
+
kid?: string;
|
|
1461
|
+
/** Curve for EC keys, e.g. `'P-256'`. */
|
|
1462
|
+
crv?: string;
|
|
1463
|
+
/** EC public x coordinate (base64url). */
|
|
1464
|
+
x?: string;
|
|
1465
|
+
/** EC public y coordinate (base64url). */
|
|
1466
|
+
y?: string;
|
|
1467
|
+
}
|
|
1468
|
+
/** The JWKS document: the set of public keys that verify provider-issued id_tokens. */
|
|
1469
|
+
interface Jwks {
|
|
1470
|
+
keys: Jwk[];
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* The OIDC userinfo claim set, from `GET /auth/oauth/userinfo`.
|
|
1474
|
+
*
|
|
1475
|
+
* `sub` is always present; the identity claims appear per the access token's granted scopes. Extra
|
|
1476
|
+
* claims the provider adds later are tolerated via the index signature rather than dropped.
|
|
1477
|
+
*/
|
|
1478
|
+
interface UserInfo {
|
|
1479
|
+
/** The stable subject identifier (the user id). Always present. */
|
|
1480
|
+
sub: string;
|
|
1481
|
+
/** Primary email, when the `email` scope was granted. */
|
|
1482
|
+
email?: string;
|
|
1483
|
+
/** Whether the email is verified, when present. */
|
|
1484
|
+
email_verified?: boolean;
|
|
1485
|
+
/** Display name, when the `profile` scope was granted. */
|
|
1486
|
+
name?: string;
|
|
1487
|
+
/** Avatar URL, when the `profile` scope was granted. */
|
|
1488
|
+
picture?: string;
|
|
1489
|
+
/** Phone number, when the `phone` scope was granted. */
|
|
1490
|
+
phone_number?: string;
|
|
1491
|
+
/** Additional provider claims are preserved rather than discarded. */
|
|
1492
|
+
[claim: string]: unknown;
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Input for recording a user's consent to a client's scopes (`POST /auth/oauth/consent`).
|
|
1496
|
+
*
|
|
1497
|
+
* Posted by the accounts consent screen before it retries the authorize call. `scope` is the OIDC
|
|
1498
|
+
* space-delimited scope string the user is granting this client.
|
|
1499
|
+
*/
|
|
1500
|
+
interface OAuthConsentInput {
|
|
1501
|
+
/** The relying party's registered client identifier. */
|
|
1502
|
+
client_id: string;
|
|
1503
|
+
/** Space-delimited scopes the user is granting this client. */
|
|
1504
|
+
scope: string;
|
|
1505
|
+
}
|
|
1506
|
+
/** A single live consent, as listed for an account-management view (`GET /auth/oauth/consents`). */
|
|
1507
|
+
interface OAuthConsent {
|
|
1508
|
+
/** The client the consent is for. */
|
|
1509
|
+
client_id: string;
|
|
1510
|
+
/** The client's display name, for showing in a "connected apps" list. */
|
|
1511
|
+
client_name: string;
|
|
1512
|
+
/** The scopes the user has granted this client. */
|
|
1513
|
+
scopes: string[];
|
|
1514
|
+
/** When the consent was granted (ISO 8601). */
|
|
1515
|
+
granted_at: string;
|
|
1516
|
+
}
|
|
1517
|
+
/** Result of revoking a consent (`DELETE /auth/oauth/consent/:clientId`). */
|
|
1518
|
+
interface OAuthConsentRevokeResult {
|
|
1519
|
+
ok: true;
|
|
1520
|
+
/** True when a live consent was actually revoked; false when there was nothing to revoke. */
|
|
1521
|
+
revoked: boolean;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* The authorize response when a `first_party_consent` client needs consent before a code is minted.
|
|
1525
|
+
*
|
|
1526
|
+
* A discriminated shape returned (with HTTP 200) by {@link OAuthModule.authorize} instead of
|
|
1527
|
+
* {@link OAuthAuthorizeResult}: no code was minted, and the accounts app should render a consent
|
|
1528
|
+
* screen for `scopes`, POST the consent, then retry authorize. Mirrors the `{ requires_2fa: true }`
|
|
1529
|
+
* convention on login.
|
|
1530
|
+
*/
|
|
1531
|
+
interface OAuthConsentRequired {
|
|
1532
|
+
/** Discriminant: consent is required before a code can be issued. */
|
|
1533
|
+
consent_required: true;
|
|
1534
|
+
/** The client requesting consent. */
|
|
1535
|
+
client_id: string;
|
|
1536
|
+
/** The client's display name, for the consent screen. */
|
|
1537
|
+
client_name: string;
|
|
1538
|
+
/** The scopes the user is being asked to grant. */
|
|
1539
|
+
scopes: string[];
|
|
1540
|
+
}
|
|
1419
1541
|
|
|
1420
1542
|
declare const CONDITIONS: readonly ["new", "like_new", "good", "fair"];
|
|
1421
1543
|
type Condition = typeof CONDITIONS[number];
|
|
@@ -2683,6 +2805,8 @@ declare class AuthModule {
|
|
|
2683
2805
|
}>;
|
|
2684
2806
|
}
|
|
2685
2807
|
|
|
2808
|
+
/** Narrows an {@link OAuthModule.authorize} result to the consent-required branch. */
|
|
2809
|
+
declare function isConsentRequired(result: OAuthAuthorizeResult | OAuthConsentRequired): result is OAuthConsentRequired;
|
|
2686
2810
|
/**
|
|
2687
2811
|
* Relying-party OAuth session hand-off.
|
|
2688
2812
|
*
|
|
@@ -2718,7 +2842,7 @@ declare class OAuthModule {
|
|
|
2718
2842
|
* })
|
|
2719
2843
|
* ```
|
|
2720
2844
|
*/
|
|
2721
|
-
authorize(input: OAuthAuthorizeInput, options?: RequestOptions): Promise<OAuthAuthorizeResult>;
|
|
2845
|
+
authorize(input: OAuthAuthorizeInput, options?: RequestOptions): Promise<OAuthAuthorizeResult | OAuthConsentRequired>;
|
|
2722
2846
|
/**
|
|
2723
2847
|
* Exchange a one-time authorization code for a token pair.
|
|
2724
2848
|
*
|
|
@@ -2745,6 +2869,71 @@ declare class OAuthModule {
|
|
|
2745
2869
|
* ```
|
|
2746
2870
|
*/
|
|
2747
2871
|
exchangeCode(input: OAuthTokenExchangeInput, options?: RequestOptions): Promise<OAuthTokenResult>;
|
|
2872
|
+
/**
|
|
2873
|
+
* Fetch the OpenID Connect discovery document.
|
|
2874
|
+
*
|
|
2875
|
+
* A relying party reads this to learn the provider's endpoints and capabilities (issuer, the
|
|
2876
|
+
* authorize/token/userinfo/jwks URLs, supported scopes, signing algorithms) rather than hard-
|
|
2877
|
+
* coding them. Public — no session required.
|
|
2878
|
+
*
|
|
2879
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2880
|
+
* @returns The discovery metadata
|
|
2881
|
+
*/
|
|
2882
|
+
discover(options?: RequestOptions): Promise<OpenIdConfiguration>;
|
|
2883
|
+
/**
|
|
2884
|
+
* Fetch the JWKS — the public keys that verify provider-issued id_token signatures.
|
|
2885
|
+
*
|
|
2886
|
+
* A relying party uses these (matched by the id_token header `kid`) to verify an id_token without
|
|
2887
|
+
* a shared secret. Public — no session required. Serves public key parameters only.
|
|
2888
|
+
*
|
|
2889
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2890
|
+
* @returns The JWKS document
|
|
2891
|
+
*/
|
|
2892
|
+
getJwks(options?: RequestOptions): Promise<Jwks>;
|
|
2893
|
+
/**
|
|
2894
|
+
* Fetch the userinfo claim set for the current session.
|
|
2895
|
+
*
|
|
2896
|
+
* Returns `sub` plus the identity claims the session's granted scopes allow. Requires an
|
|
2897
|
+
* authenticated session — the SDK attaches the bearer token automatically.
|
|
2898
|
+
*
|
|
2899
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2900
|
+
* @returns The userinfo claims
|
|
2901
|
+
*/
|
|
2902
|
+
userinfo(options?: RequestOptions): Promise<UserInfo>;
|
|
2903
|
+
/**
|
|
2904
|
+
* Record the current user's consent to a client's scopes.
|
|
2905
|
+
*
|
|
2906
|
+
* The accounts consent screen calls this (after the user approves) before retrying
|
|
2907
|
+
* {@link OAuthModule.authorize}, which then finds covering consent and mints a code. Requires an
|
|
2908
|
+
* authenticated session. Re-granting with a wider scope set supersedes the prior consent.
|
|
2909
|
+
*
|
|
2910
|
+
* @param input - The client and the space-delimited scopes being granted
|
|
2911
|
+
* @param options - Optional per-request options
|
|
2912
|
+
* @returns `{ ok: true }` on success
|
|
2913
|
+
* @throws {APIError} On `400 invalid_client` / `invalid_scope`, or `401` without a session
|
|
2914
|
+
*/
|
|
2915
|
+
grantConsent(input: OAuthConsentInput, options?: RequestOptions): Promise<{
|
|
2916
|
+
ok: true;
|
|
2917
|
+
}>;
|
|
2918
|
+
/**
|
|
2919
|
+
* Withdraw the current user's consent for a client (account-console self-service).
|
|
2920
|
+
*
|
|
2921
|
+
* @param clientId - The client to revoke consent for
|
|
2922
|
+
* @param options - Optional per-request options
|
|
2923
|
+
* @returns `{ ok: true, revoked }` — `revoked` is false when there was nothing live to revoke
|
|
2924
|
+
* @throws {APIError} On `401` without a session
|
|
2925
|
+
*/
|
|
2926
|
+
revokeConsent(clientId: string, options?: RequestOptions): Promise<OAuthConsentRevokeResult>;
|
|
2927
|
+
/**
|
|
2928
|
+
* List the current user's live consents, for a "connected apps" account-management view.
|
|
2929
|
+
*
|
|
2930
|
+
* @param options - Optional per-request options
|
|
2931
|
+
* @returns The live consents (client id + name, granted scopes, grant time)
|
|
2932
|
+
* @throws {APIError} On `401` without a session
|
|
2933
|
+
*/
|
|
2934
|
+
listConsents(options?: RequestOptions): Promise<{
|
|
2935
|
+
consents: OAuthConsent[];
|
|
2936
|
+
}>;
|
|
2748
2937
|
}
|
|
2749
2938
|
|
|
2750
2939
|
declare class ListingsModule {
|
|
@@ -3925,4 +4114,4 @@ declare class MitumbaClient {
|
|
|
3925
4114
|
isAuthenticated(): Promise<boolean>;
|
|
3926
4115
|
}
|
|
3927
4116
|
|
|
3928
|
-
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type KnownPaymentProvider, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportReason, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type ShareUrlOptions, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
4117
|
+
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type Jwk, type Jwks, type KnownPaymentProvider, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportReason, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type ShareUrlOptions, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserInfo, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -1416,6 +1416,128 @@ interface OAuthTokenResult {
|
|
|
1416
1416
|
/** Space-delimited list of scopes actually granted. */
|
|
1417
1417
|
scope: string;
|
|
1418
1418
|
}
|
|
1419
|
+
/**
|
|
1420
|
+
* The OpenID Connect discovery document, as served by `GET /auth/oauth/openid-configuration`.
|
|
1421
|
+
*
|
|
1422
|
+
* A relying party reads this once to learn the provider's endpoints and capabilities instead of
|
|
1423
|
+
* hard-coding them. The fields mirror the standard OIDC discovery metadata the backend advertises.
|
|
1424
|
+
*/
|
|
1425
|
+
interface OpenIdConfiguration {
|
|
1426
|
+
/** The issuer identifier that appears in id_token `iss`. */
|
|
1427
|
+
issuer: string;
|
|
1428
|
+
/** Where the authorization code is minted. */
|
|
1429
|
+
authorization_endpoint: string;
|
|
1430
|
+
/** Where a code is exchanged for tokens. */
|
|
1431
|
+
token_endpoint: string;
|
|
1432
|
+
/** Where the consented claims for an access token are read. */
|
|
1433
|
+
userinfo_endpoint: string;
|
|
1434
|
+
/** The JWKS URL whose public keys verify id_token signatures. */
|
|
1435
|
+
jwks_uri: string;
|
|
1436
|
+
/** Supported OAuth response types (e.g. `['code']`). */
|
|
1437
|
+
response_types_supported: string[];
|
|
1438
|
+
/** Supported grant types (e.g. `['authorization_code']`). */
|
|
1439
|
+
grant_types_supported: string[];
|
|
1440
|
+
/** Supported PKCE challenge methods (e.g. `['S256']`). */
|
|
1441
|
+
code_challenge_methods_supported: string[];
|
|
1442
|
+
/** id_token signing algorithms (e.g. `['ES256']`). */
|
|
1443
|
+
id_token_signing_alg_values_supported: string[];
|
|
1444
|
+
/** Requestable scopes (e.g. `['openid','profile','email','phone']`). */
|
|
1445
|
+
scopes_supported: string[];
|
|
1446
|
+
/** Subject identifier types (e.g. `['public']`). */
|
|
1447
|
+
subject_types_supported: string[];
|
|
1448
|
+
/** Supported client authentication methods at the token endpoint. */
|
|
1449
|
+
token_endpoint_auth_methods_supported: string[];
|
|
1450
|
+
}
|
|
1451
|
+
/** A single JSON Web Key, public parameters only (as served by the JWKS endpoint). */
|
|
1452
|
+
interface Jwk {
|
|
1453
|
+
/** Key type, e.g. `'EC'`. */
|
|
1454
|
+
kty: string;
|
|
1455
|
+
/** Intended use, e.g. `'sig'`. */
|
|
1456
|
+
use?: string;
|
|
1457
|
+
/** Algorithm, e.g. `'ES256'`. */
|
|
1458
|
+
alg?: string;
|
|
1459
|
+
/** Key id; matches the id_token header `kid`. */
|
|
1460
|
+
kid?: string;
|
|
1461
|
+
/** Curve for EC keys, e.g. `'P-256'`. */
|
|
1462
|
+
crv?: string;
|
|
1463
|
+
/** EC public x coordinate (base64url). */
|
|
1464
|
+
x?: string;
|
|
1465
|
+
/** EC public y coordinate (base64url). */
|
|
1466
|
+
y?: string;
|
|
1467
|
+
}
|
|
1468
|
+
/** The JWKS document: the set of public keys that verify provider-issued id_tokens. */
|
|
1469
|
+
interface Jwks {
|
|
1470
|
+
keys: Jwk[];
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* The OIDC userinfo claim set, from `GET /auth/oauth/userinfo`.
|
|
1474
|
+
*
|
|
1475
|
+
* `sub` is always present; the identity claims appear per the access token's granted scopes. Extra
|
|
1476
|
+
* claims the provider adds later are tolerated via the index signature rather than dropped.
|
|
1477
|
+
*/
|
|
1478
|
+
interface UserInfo {
|
|
1479
|
+
/** The stable subject identifier (the user id). Always present. */
|
|
1480
|
+
sub: string;
|
|
1481
|
+
/** Primary email, when the `email` scope was granted. */
|
|
1482
|
+
email?: string;
|
|
1483
|
+
/** Whether the email is verified, when present. */
|
|
1484
|
+
email_verified?: boolean;
|
|
1485
|
+
/** Display name, when the `profile` scope was granted. */
|
|
1486
|
+
name?: string;
|
|
1487
|
+
/** Avatar URL, when the `profile` scope was granted. */
|
|
1488
|
+
picture?: string;
|
|
1489
|
+
/** Phone number, when the `phone` scope was granted. */
|
|
1490
|
+
phone_number?: string;
|
|
1491
|
+
/** Additional provider claims are preserved rather than discarded. */
|
|
1492
|
+
[claim: string]: unknown;
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Input for recording a user's consent to a client's scopes (`POST /auth/oauth/consent`).
|
|
1496
|
+
*
|
|
1497
|
+
* Posted by the accounts consent screen before it retries the authorize call. `scope` is the OIDC
|
|
1498
|
+
* space-delimited scope string the user is granting this client.
|
|
1499
|
+
*/
|
|
1500
|
+
interface OAuthConsentInput {
|
|
1501
|
+
/** The relying party's registered client identifier. */
|
|
1502
|
+
client_id: string;
|
|
1503
|
+
/** Space-delimited scopes the user is granting this client. */
|
|
1504
|
+
scope: string;
|
|
1505
|
+
}
|
|
1506
|
+
/** A single live consent, as listed for an account-management view (`GET /auth/oauth/consents`). */
|
|
1507
|
+
interface OAuthConsent {
|
|
1508
|
+
/** The client the consent is for. */
|
|
1509
|
+
client_id: string;
|
|
1510
|
+
/** The client's display name, for showing in a "connected apps" list. */
|
|
1511
|
+
client_name: string;
|
|
1512
|
+
/** The scopes the user has granted this client. */
|
|
1513
|
+
scopes: string[];
|
|
1514
|
+
/** When the consent was granted (ISO 8601). */
|
|
1515
|
+
granted_at: string;
|
|
1516
|
+
}
|
|
1517
|
+
/** Result of revoking a consent (`DELETE /auth/oauth/consent/:clientId`). */
|
|
1518
|
+
interface OAuthConsentRevokeResult {
|
|
1519
|
+
ok: true;
|
|
1520
|
+
/** True when a live consent was actually revoked; false when there was nothing to revoke. */
|
|
1521
|
+
revoked: boolean;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* The authorize response when a `first_party_consent` client needs consent before a code is minted.
|
|
1525
|
+
*
|
|
1526
|
+
* A discriminated shape returned (with HTTP 200) by {@link OAuthModule.authorize} instead of
|
|
1527
|
+
* {@link OAuthAuthorizeResult}: no code was minted, and the accounts app should render a consent
|
|
1528
|
+
* screen for `scopes`, POST the consent, then retry authorize. Mirrors the `{ requires_2fa: true }`
|
|
1529
|
+
* convention on login.
|
|
1530
|
+
*/
|
|
1531
|
+
interface OAuthConsentRequired {
|
|
1532
|
+
/** Discriminant: consent is required before a code can be issued. */
|
|
1533
|
+
consent_required: true;
|
|
1534
|
+
/** The client requesting consent. */
|
|
1535
|
+
client_id: string;
|
|
1536
|
+
/** The client's display name, for the consent screen. */
|
|
1537
|
+
client_name: string;
|
|
1538
|
+
/** The scopes the user is being asked to grant. */
|
|
1539
|
+
scopes: string[];
|
|
1540
|
+
}
|
|
1419
1541
|
|
|
1420
1542
|
declare const CONDITIONS: readonly ["new", "like_new", "good", "fair"];
|
|
1421
1543
|
type Condition = typeof CONDITIONS[number];
|
|
@@ -2683,6 +2805,8 @@ declare class AuthModule {
|
|
|
2683
2805
|
}>;
|
|
2684
2806
|
}
|
|
2685
2807
|
|
|
2808
|
+
/** Narrows an {@link OAuthModule.authorize} result to the consent-required branch. */
|
|
2809
|
+
declare function isConsentRequired(result: OAuthAuthorizeResult | OAuthConsentRequired): result is OAuthConsentRequired;
|
|
2686
2810
|
/**
|
|
2687
2811
|
* Relying-party OAuth session hand-off.
|
|
2688
2812
|
*
|
|
@@ -2718,7 +2842,7 @@ declare class OAuthModule {
|
|
|
2718
2842
|
* })
|
|
2719
2843
|
* ```
|
|
2720
2844
|
*/
|
|
2721
|
-
authorize(input: OAuthAuthorizeInput, options?: RequestOptions): Promise<OAuthAuthorizeResult>;
|
|
2845
|
+
authorize(input: OAuthAuthorizeInput, options?: RequestOptions): Promise<OAuthAuthorizeResult | OAuthConsentRequired>;
|
|
2722
2846
|
/**
|
|
2723
2847
|
* Exchange a one-time authorization code for a token pair.
|
|
2724
2848
|
*
|
|
@@ -2745,6 +2869,71 @@ declare class OAuthModule {
|
|
|
2745
2869
|
* ```
|
|
2746
2870
|
*/
|
|
2747
2871
|
exchangeCode(input: OAuthTokenExchangeInput, options?: RequestOptions): Promise<OAuthTokenResult>;
|
|
2872
|
+
/**
|
|
2873
|
+
* Fetch the OpenID Connect discovery document.
|
|
2874
|
+
*
|
|
2875
|
+
* A relying party reads this to learn the provider's endpoints and capabilities (issuer, the
|
|
2876
|
+
* authorize/token/userinfo/jwks URLs, supported scopes, signing algorithms) rather than hard-
|
|
2877
|
+
* coding them. Public — no session required.
|
|
2878
|
+
*
|
|
2879
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2880
|
+
* @returns The discovery metadata
|
|
2881
|
+
*/
|
|
2882
|
+
discover(options?: RequestOptions): Promise<OpenIdConfiguration>;
|
|
2883
|
+
/**
|
|
2884
|
+
* Fetch the JWKS — the public keys that verify provider-issued id_token signatures.
|
|
2885
|
+
*
|
|
2886
|
+
* A relying party uses these (matched by the id_token header `kid`) to verify an id_token without
|
|
2887
|
+
* a shared secret. Public — no session required. Serves public key parameters only.
|
|
2888
|
+
*
|
|
2889
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2890
|
+
* @returns The JWKS document
|
|
2891
|
+
*/
|
|
2892
|
+
getJwks(options?: RequestOptions): Promise<Jwks>;
|
|
2893
|
+
/**
|
|
2894
|
+
* Fetch the userinfo claim set for the current session.
|
|
2895
|
+
*
|
|
2896
|
+
* Returns `sub` plus the identity claims the session's granted scopes allow. Requires an
|
|
2897
|
+
* authenticated session — the SDK attaches the bearer token automatically.
|
|
2898
|
+
*
|
|
2899
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2900
|
+
* @returns The userinfo claims
|
|
2901
|
+
*/
|
|
2902
|
+
userinfo(options?: RequestOptions): Promise<UserInfo>;
|
|
2903
|
+
/**
|
|
2904
|
+
* Record the current user's consent to a client's scopes.
|
|
2905
|
+
*
|
|
2906
|
+
* The accounts consent screen calls this (after the user approves) before retrying
|
|
2907
|
+
* {@link OAuthModule.authorize}, which then finds covering consent and mints a code. Requires an
|
|
2908
|
+
* authenticated session. Re-granting with a wider scope set supersedes the prior consent.
|
|
2909
|
+
*
|
|
2910
|
+
* @param input - The client and the space-delimited scopes being granted
|
|
2911
|
+
* @param options - Optional per-request options
|
|
2912
|
+
* @returns `{ ok: true }` on success
|
|
2913
|
+
* @throws {APIError} On `400 invalid_client` / `invalid_scope`, or `401` without a session
|
|
2914
|
+
*/
|
|
2915
|
+
grantConsent(input: OAuthConsentInput, options?: RequestOptions): Promise<{
|
|
2916
|
+
ok: true;
|
|
2917
|
+
}>;
|
|
2918
|
+
/**
|
|
2919
|
+
* Withdraw the current user's consent for a client (account-console self-service).
|
|
2920
|
+
*
|
|
2921
|
+
* @param clientId - The client to revoke consent for
|
|
2922
|
+
* @param options - Optional per-request options
|
|
2923
|
+
* @returns `{ ok: true, revoked }` — `revoked` is false when there was nothing live to revoke
|
|
2924
|
+
* @throws {APIError} On `401` without a session
|
|
2925
|
+
*/
|
|
2926
|
+
revokeConsent(clientId: string, options?: RequestOptions): Promise<OAuthConsentRevokeResult>;
|
|
2927
|
+
/**
|
|
2928
|
+
* List the current user's live consents, for a "connected apps" account-management view.
|
|
2929
|
+
*
|
|
2930
|
+
* @param options - Optional per-request options
|
|
2931
|
+
* @returns The live consents (client id + name, granted scopes, grant time)
|
|
2932
|
+
* @throws {APIError} On `401` without a session
|
|
2933
|
+
*/
|
|
2934
|
+
listConsents(options?: RequestOptions): Promise<{
|
|
2935
|
+
consents: OAuthConsent[];
|
|
2936
|
+
}>;
|
|
2748
2937
|
}
|
|
2749
2938
|
|
|
2750
2939
|
declare class ListingsModule {
|
|
@@ -3925,4 +4114,4 @@ declare class MitumbaClient {
|
|
|
3925
4114
|
isAuthenticated(): Promise<boolean>;
|
|
3926
4115
|
}
|
|
3927
4116
|
|
|
3928
|
-
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type KnownPaymentProvider, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportReason, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type ShareUrlOptions, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
4117
|
+
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type Jwk, type Jwks, type KnownPaymentProvider, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportReason, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type ShareUrlOptions, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserInfo, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
package/dist/index.js
CHANGED
|
@@ -679,6 +679,9 @@ var AuthModule = class {
|
|
|
679
679
|
};
|
|
680
680
|
|
|
681
681
|
// src/modules/oauth.ts
|
|
682
|
+
function isConsentRequired(result) {
|
|
683
|
+
return result.consent_required === true;
|
|
684
|
+
}
|
|
682
685
|
var OAuthModule = class {
|
|
683
686
|
constructor(client) {
|
|
684
687
|
this.client = client;
|
|
@@ -753,6 +756,83 @@ var OAuthModule = class {
|
|
|
753
756
|
});
|
|
754
757
|
return result;
|
|
755
758
|
}
|
|
759
|
+
/**
|
|
760
|
+
* Fetch the OpenID Connect discovery document.
|
|
761
|
+
*
|
|
762
|
+
* A relying party reads this to learn the provider's endpoints and capabilities (issuer, the
|
|
763
|
+
* authorize/token/userinfo/jwks URLs, supported scopes, signing algorithms) rather than hard-
|
|
764
|
+
* coding them. Public — no session required.
|
|
765
|
+
*
|
|
766
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
767
|
+
* @returns The discovery metadata
|
|
768
|
+
*/
|
|
769
|
+
async discover(options) {
|
|
770
|
+
return this.client.get("/auth/oauth/openid-configuration", void 0, options);
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Fetch the JWKS — the public keys that verify provider-issued id_token signatures.
|
|
774
|
+
*
|
|
775
|
+
* A relying party uses these (matched by the id_token header `kid`) to verify an id_token without
|
|
776
|
+
* a shared secret. Public — no session required. Serves public key parameters only.
|
|
777
|
+
*
|
|
778
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
779
|
+
* @returns The JWKS document
|
|
780
|
+
*/
|
|
781
|
+
async getJwks(options) {
|
|
782
|
+
return this.client.get("/auth/oauth/jwks.json", void 0, options);
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Fetch the userinfo claim set for the current session.
|
|
786
|
+
*
|
|
787
|
+
* Returns `sub` plus the identity claims the session's granted scopes allow. Requires an
|
|
788
|
+
* authenticated session — the SDK attaches the bearer token automatically.
|
|
789
|
+
*
|
|
790
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
791
|
+
* @returns The userinfo claims
|
|
792
|
+
*/
|
|
793
|
+
async userinfo(options) {
|
|
794
|
+
return this.client.get("/auth/oauth/userinfo", void 0, options);
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Record the current user's consent to a client's scopes.
|
|
798
|
+
*
|
|
799
|
+
* The accounts consent screen calls this (after the user approves) before retrying
|
|
800
|
+
* {@link OAuthModule.authorize}, which then finds covering consent and mints a code. Requires an
|
|
801
|
+
* authenticated session. Re-granting with a wider scope set supersedes the prior consent.
|
|
802
|
+
*
|
|
803
|
+
* @param input - The client and the space-delimited scopes being granted
|
|
804
|
+
* @param options - Optional per-request options
|
|
805
|
+
* @returns `{ ok: true }` on success
|
|
806
|
+
* @throws {APIError} On `400 invalid_client` / `invalid_scope`, or `401` without a session
|
|
807
|
+
*/
|
|
808
|
+
async grantConsent(input, options) {
|
|
809
|
+
return this.client.post("/auth/oauth/consent", input, options);
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Withdraw the current user's consent for a client (account-console self-service).
|
|
813
|
+
*
|
|
814
|
+
* @param clientId - The client to revoke consent for
|
|
815
|
+
* @param options - Optional per-request options
|
|
816
|
+
* @returns `{ ok: true, revoked }` — `revoked` is false when there was nothing live to revoke
|
|
817
|
+
* @throws {APIError} On `401` without a session
|
|
818
|
+
*/
|
|
819
|
+
async revokeConsent(clientId, options) {
|
|
820
|
+
return this.client.delete(
|
|
821
|
+
`/auth/oauth/consent/${encodeURIComponent(clientId)}`,
|
|
822
|
+
void 0,
|
|
823
|
+
options
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* List the current user's live consents, for a "connected apps" account-management view.
|
|
828
|
+
*
|
|
829
|
+
* @param options - Optional per-request options
|
|
830
|
+
* @returns The live consents (client id + name, granted scopes, grant time)
|
|
831
|
+
* @throws {APIError} On `401` without a session
|
|
832
|
+
*/
|
|
833
|
+
async listConsents(options) {
|
|
834
|
+
return this.client.get("/auth/oauth/consents", void 0, options);
|
|
835
|
+
}
|
|
756
836
|
};
|
|
757
837
|
|
|
758
838
|
// src/modules/listings.ts
|
|
@@ -2673,6 +2753,7 @@ exports.WholesaleModule = WholesaleModule;
|
|
|
2673
2753
|
exports.WishlistsModule = WishlistsModule;
|
|
2674
2754
|
exports.baleShareUrl = baleShareUrl;
|
|
2675
2755
|
exports.createTokenStore = createTokenStore;
|
|
2756
|
+
exports.isConsentRequired = isConsentRequired;
|
|
2676
2757
|
exports.isMessagingAPIError = isMessagingAPIError;
|
|
2677
2758
|
exports.listingShareUrl = listingShareUrl;
|
|
2678
2759
|
exports.storeShareUrl = storeShareUrl;
|