@wefunder/sdk 0.1.0-beta.10 → 0.1.0-beta.11
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.cjs +159 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +157 -28
- package/dist/index.js.map +1 -1
- package/examples_manifest.json +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -76,6 +76,16 @@ interface RefreshOptions extends OAuthHostOptions {
|
|
|
76
76
|
*/
|
|
77
77
|
declare function refreshToken(opts: RefreshOptions): Promise<TokenSet>;
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The token store failed to save a rotated token set. `tokens` is the rotated set that is NOT
|
|
81
|
+
* yet durable and NOT yet in use: the manager keeps it pending and retries the save on the next
|
|
82
|
+
* call (or persist it yourself and call `markPersisted()`). Until it is saved no request uses it,
|
|
83
|
+
* and the consumed refresh token is never reused either.
|
|
84
|
+
*/
|
|
85
|
+
declare class WefunderTokenPersistenceError extends Error {
|
|
86
|
+
readonly tokens: TokenSet;
|
|
87
|
+
constructor(tokens: TokenSet, cause: unknown);
|
|
88
|
+
}
|
|
79
89
|
/** Pluggable persistence for the rotating token set (DB row, secrets manager, etc.). */
|
|
80
90
|
interface TokenStore {
|
|
81
91
|
load?(): Promise<TokenSet | undefined> | TokenSet | undefined;
|
|
@@ -98,6 +108,35 @@ interface TokenManagerOptions extends OAuthHostOptions {
|
|
|
98
108
|
/** Refresh proactively when the access token is within this many ms of expiry. */
|
|
99
109
|
expiryLeewayMs?: number;
|
|
100
110
|
}
|
|
111
|
+
declare class TokenManager {
|
|
112
|
+
#private;
|
|
113
|
+
constructor(opts: TokenManagerOptions);
|
|
114
|
+
/** The durable, in-use token set. A rotated set that could not be persisted sits in `pendingTokens`. */
|
|
115
|
+
get current(): TokenSet;
|
|
116
|
+
/** True if the manager can recover an expired token (rotate a refresh token or re-mint). */
|
|
117
|
+
get canRefresh(): boolean;
|
|
118
|
+
/** A rotated set awaiting a successful `store.save` (see `WefunderTokenPersistenceError`). */
|
|
119
|
+
get pendingTokens(): TokenSet | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Tell the manager you persisted `tokens` (the set from a `WefunderTokenPersistenceError`)
|
|
122
|
+
* yourself. Publishes it only if it is still the pending set — a stale acknowledgment (the
|
|
123
|
+
* manager has since rotated again) is a no-op and returns false, so an older save can never
|
|
124
|
+
* publish a newer, unsaved set.
|
|
125
|
+
*/
|
|
126
|
+
markPersisted(tokens: TokenSet): Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Returns a valid access token, refreshing proactively if it's expired/near-expiry. If a
|
|
129
|
+
* rotated set is pending persistence, the save is retried first — no request uses an
|
|
130
|
+
* undurable token.
|
|
131
|
+
*/
|
|
132
|
+
getAccessToken(): Promise<string>;
|
|
133
|
+
/**
|
|
134
|
+
* Recover an expired/rejected token (e.g. after a 401): rotates the refresh token
|
|
135
|
+
* if there is one, otherwise re-mints (client_credentials). Coalesces concurrent
|
|
136
|
+
* calls into one network round-trip, then persists. Returns the new token set.
|
|
137
|
+
*/
|
|
138
|
+
refresh(): Promise<TokenSet>;
|
|
139
|
+
}
|
|
101
140
|
|
|
102
141
|
interface RetryOptions {
|
|
103
142
|
maxRetries?: number;
|
|
@@ -9469,6 +9508,10 @@ declare class Wefunder {
|
|
|
9469
9508
|
now?: () => number;
|
|
9470
9509
|
}): Promise<Wefunder>;
|
|
9471
9510
|
/** The live token set (e.g. to persist after construction). */
|
|
9511
|
+
/** A rotated set awaiting a successful save (see `WefunderTokenPersistenceError`). */
|
|
9512
|
+
get pendingTokens(): TokenSet | undefined;
|
|
9513
|
+
/** Acknowledge an out-of-band save of `tokens`; false if that set is no longer pending. */
|
|
9514
|
+
markPersisted(tokens: TokenSet): Promise<boolean>;
|
|
9472
9515
|
get tokens(): TokenSet;
|
|
9473
9516
|
/**
|
|
9474
9517
|
* Unwrap any generated op result (incl. `wf.raw.*`) the way the ergonomic
|
|
@@ -9651,4 +9694,4 @@ declare class WefunderAuthError extends WefunderError {
|
|
|
9651
9694
|
constructor(message: string);
|
|
9652
9695
|
}
|
|
9653
9696
|
|
|
9654
|
-
export { type AnonymizedAttribution, type ApproveSyndicateMemberData, type ApproveSyndicateMemberError, type ApproveSyndicateMemberErrors, type ApproveSyndicateMemberResponse, type ApproveSyndicateMemberResponses, type AttributedInvestmentListEnvelope, type AttributionCampaignAccess, type AttributionCampaignSummary, type AttributionCampaignSummaryListEnvelope, type AttributionMe, type AttributionMeEnvelope, type AttributionPartner, type AttributionStats, type AttributionStatsEnvelope, type AttributionUser, type AuditEvent, type AuditEventListEnvelope, type AuthorizationUrlOptions, type BulkInviteLinkCreateInput, type BulkInviteLinkEnvelope, type Campaign, type CampaignId, type CampaignListEnvelope, type ClientCredentialsOptions, type ClientOptions, type CloseSyndicateDealData, type CloseSyndicateDealError, type CloseSyndicateDealErrors, type CloseSyndicateDealResponse, type CloseSyndicateDealResponses, type CommentProposalEnvelope, type Company, type CompanyDisclosures, type CompanyDisclosuresEnvelope, type CompanyEnvelope, type CompanyPitch, type CompanyPitchEnvelope, type CompanyQuestion, type CompanyQuestionListEnvelope, type CompanyQuestionPerson, type CompanySearchResult, type CompanySearchResultListEnvelope, type CompanyTotals, type CompanyUpdate, type CompanyUpdateEnvelope, type CompanyUpdateListEnvelope, type ConnectedApp, type ConnectedAppListEnvelope, type ConnectedAppRevocation, type ConnectedAppRevocationEnvelope, type ConstructEventOptions, type ConvertibleNoteSecurity, type CreateInstallationData, type CreateInstallationError, type CreateInstallationErrors, type CreateInstallationResponse, type CreateInstallationResponses, type CreateInstallationTokenData, type CreateInstallationTokenError, type CreateInstallationTokenErrors, type CreateInstallationTokenResponse, type CreateInstallationTokenResponses, type CreateIntentData, type CreateIntentError, type CreateIntentErrors, type CreateIntentResponse, type CreateIntentResponses, type CreatePartnerInviteData, type CreatePartnerInviteError, type CreatePartnerInviteErrors, type CreatePartnerInviteResponse, type CreatePartnerInviteResponses, type CreateWebhookEndpointData, type CreateWebhookEndpointError, type CreateWebhookEndpointErrors, type CreateWebhookEndpointInput, type CreateWebhookEndpointResponse, type CreateWebhookEndpointResponses, type CreateWebhookSubscriptionData, type CreateWebhookSubscriptionError, type CreateWebhookSubscriptionErrors, type CreateWebhookSubscriptionResponse, type CreateWebhookSubscriptionResponses, type CurrentRaise, type Cursor, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_AUTHORIZE_BASE_URL, DEFAULT_OAUTH_BASE_URL, DEFAULT_TOKEN_BASE_URL, DEFAULT_TOLERANCE_SECONDS, type DealInvestor, type DealInvestorListEnvelope, type DebtSecurity, type DeleteWebhookEndpointData, type DeleteWebhookEndpointError, type DeleteWebhookEndpointErrors, type DeleteWebhookEndpointResponse, type DeleteWebhookEndpointResponses, type DeleteWebhookSubscriptionData, type DeleteWebhookSubscriptionError, type DeleteWebhookSubscriptionErrors, type DeleteWebhookSubscriptionResponse, type DeleteWebhookSubscriptionResponses, type DemoteSyndicateMemberData, type DemoteSyndicateMemberError, type DemoteSyndicateMemberErrors, type DemoteSyndicateMemberResponse, type DemoteSyndicateMemberResponses, type DisclosureDocument, type DisclosurePerson, type EligibleTargetListEnvelope, type EndDate, type EquitySecurity, type Error$1 as Error, type ExchangeCodeOptions, type Exemption, type ExportSyndicateMembersCsvData, type ExportSyndicateMembersCsvError, type ExportSyndicateMembersCsvErrors, type ExportSyndicateMembersCsvResponse, type ExportSyndicateMembersCsvResponses, type FinalizeSyndicateDealData, type FinalizeSyndicateDealError, type FinalizeSyndicateDealErrors, type FinalizeSyndicateDealResponse, type FinalizeSyndicateDealResponses, type FiscalYearFinancials, type FollowCompanyData, type FollowCompanyError, type FollowCompanyErrors, type FollowCompanyResponse, type FollowCompanyResponses, type FollowStateEnvelope, type FollowedCompany, type FollowedCompanyListEnvelope, type FullAttribution, type FundSecurity, type FundraiseId, type GetAttributionMeData, type GetAttributionMeError, type GetAttributionMeErrors, type GetAttributionMeResponse, type GetAttributionMeResponses, type GetAttributionStatsData, type GetAttributionStatsError, type GetAttributionStatsErrors, type GetAttributionStatsResponse, type GetAttributionStatsResponses, type GetCompanyData, type GetCompanyDisclosuresData, type GetCompanyDisclosuresError, type GetCompanyDisclosuresErrors, type GetCompanyDisclosuresResponse, type GetCompanyDisclosuresResponses, type GetCompanyError, type GetCompanyErrors, type GetCompanyPitchData, type GetCompanyPitchError, type GetCompanyPitchErrors, type GetCompanyPitchResponse, type GetCompanyPitchResponses, type GetCompanyResponse, type GetCompanyResponses, type GetCompanyUpdateData, type GetCompanyUpdateError, type GetCompanyUpdateErrors, type GetCompanyUpdateResponse, type GetCompanyUpdateResponses, type GetCurrentUserData, type GetCurrentUserError, type GetCurrentUserErrors, type GetCurrentUserResponse, type GetCurrentUserResponses, type GetInstallationData, type GetInstallationError, type GetInstallationErrors, type GetInstallationResponse, type GetInstallationResponses, type GetIntentData, type GetIntentError, type GetIntentErrors, type GetIntentResponse, type GetIntentResponses, type GetInvestmentData, type GetInvestmentError, type GetInvestmentErrors, type GetInvestmentResponse, type GetInvestmentResponses, type GetOfferingData, type GetOfferingError, type GetOfferingErrors, type GetOfferingResponse, type GetOfferingResponses, type GetOfferingStatsData, type GetOfferingStatsError, type GetOfferingStatsErrors, type GetOfferingStatsResponse, type GetOfferingStatsResponses, type GetPortfolioData, type GetPortfolioError, type GetPortfolioErrors, type GetPortfolioResponse, type GetPortfolioResponses, type GetSyndicateData, type GetSyndicateDealData, type GetSyndicateDealError, type GetSyndicateDealErrors, type GetSyndicateDealResponse, type GetSyndicateDealResponses, type GetSyndicateError, type GetSyndicateErrors, type GetSyndicatePortfolioData, type GetSyndicatePortfolioError, type GetSyndicatePortfolioErrors, type GetSyndicatePortfolioResponse, type GetSyndicatePortfolioResponses, type GetSyndicateResponse, type GetSyndicateResponses, type GetSyndicateStatisticsData, type GetSyndicateStatisticsError, type GetSyndicateStatisticsErrors, type GetSyndicateStatisticsResponse, type GetSyndicateStatisticsResponses, type GetWebhookEndpointData, type GetWebhookEndpointError, type GetWebhookEndpointErrors, type GetWebhookEndpointResponse, type GetWebhookEndpointResponses, type GetWebhookSubscriptionData, type GetWebhookSubscriptionError, type GetWebhookSubscriptionErrors, type GetWebhookSubscriptionResponse, type GetWebhookSubscriptionResponses, type HeadersLike, type HideSyndicateMemberData, type HideSyndicateMemberError, type HideSyndicateMemberErrors, type HideSyndicateMemberResponse, type HideSyndicateMemberResponses, type IdempotencyKey, type Installation, type InstallationEnvelope, type InstallationListEnvelope, type InstallationTokenEnvelope, type Intent, type IntentEnvelope, type IntentListEnvelope, type IntentPreviewEnvelope, type IntentReview, type IntentStatus, type Investment, type InvestmentChangeListEnvelope, type InvestmentChangedEventData, type InvestmentDeltaRecord, type InvestmentEnvelope, type InvestmentEventData, type InvestmentListEnvelope, type InvestmentSession, type InvestmentSessionCreateInput, type InvestmentSessionEnvelope, type InvestmentSessionEventData, type InvestmentSessionId, type InvestmentSessionListEnvelope, type InvestmentsFilters, type InvestmentsQuery, type Investor, type InvestorEnvelope, type InvestorListEnvelope, type InviteLink, type InviteLinkCreateInput, type InviteLinkEnvelope, type InviteLinkId, type InviteLinkListEnvelope, type InviteLinkUpdateInput, type InviteSyndicateMemberData, type InviteSyndicateMemberError, type InviteSyndicateMemberErrors, type InviteSyndicateMemberResponse, type InviteSyndicateMemberResponses, LEGACY_DELIVERY_ID_HEADER, LEGACY_EVENT_HEADER, LEGACY_SIGNATURE_HEADER, LEGACY_TIMESTAMP_HEADER, type ListActivityData, type ListActivityError, type ListActivityErrors, type ListActivityResponse, type ListActivityResponses, type ListAttributedInvestmentsData, type ListAttributedInvestmentsError, type ListAttributedInvestmentsErrors, type ListAttributedInvestmentsResponse, type ListAttributedInvestmentsResponses, type ListAttributionCampaignsData, type ListAttributionCampaignsError, type ListAttributionCampaignsErrors, type ListAttributionCampaignsResponse, type ListAttributionCampaignsResponses, type ListCampaignsData, type ListCampaignsError, type ListCampaignsErrors, type ListCampaignsResponse, type ListCampaignsResponses, type ListCompanyInvestmentChangesData, type ListCompanyInvestmentChangesError, type ListCompanyInvestmentChangesErrors, type ListCompanyInvestmentChangesResponse, type ListCompanyInvestmentChangesResponses, type ListCompanyQuestionsData, type ListCompanyQuestionsError, type ListCompanyQuestionsErrors, type ListCompanyQuestionsResponse, type ListCompanyQuestionsResponses, type ListCompanyUpdatesData, type ListCompanyUpdatesError, type ListCompanyUpdatesErrors, type ListCompanyUpdatesResponse, type ListCompanyUpdatesResponses, type ListConnectedAppsData, type ListConnectedAppsError, type ListConnectedAppsErrors, type ListConnectedAppsResponse, type ListConnectedAppsResponses, type ListEligibleInstallTargetsData, type ListEligibleInstallTargetsError, type ListEligibleInstallTargetsErrors, type ListEligibleInstallTargetsResponse, type ListEligibleInstallTargetsResponses, type ListFollowedCompaniesData, type ListFollowedCompaniesError, type ListFollowedCompaniesErrors, type ListFollowedCompaniesResponse, type ListFollowedCompaniesResponses, type ListInstallationsData, type ListInstallationsError, type ListInstallationsErrors, type ListInstallationsResponse, type ListInstallationsResponses, type ListIntentsData, type ListIntentsError, type ListIntentsErrors, type ListIntentsResponse, type ListIntentsResponses, type ListInvestmentsData, type ListInvestmentsError, type ListInvestmentsErrors, type ListInvestmentsResponse, type ListInvestmentsResponses, type ListMyCompaniesData, type ListMyCompaniesError, type ListMyCompaniesErrors, type ListMyCompaniesResponse, type ListMyCompaniesResponses, type ListOfferingsData, type ListOfferingsError, type ListOfferingsErrors, type ListOfferingsResponse, type ListOfferingsResponses, type ListPartnerInvitesData, type ListPartnerInvitesError, type ListPartnerInvitesErrors, type ListPartnerInvitesResponse, type ListPartnerInvitesResponses, type ListPortfolioPositionsData, type ListPortfolioPositionsError, type ListPortfolioPositionsErrors, type ListPortfolioPositionsResponse, type ListPortfolioPositionsResponses, type ListSyndicateDealInvestorsData, type ListSyndicateDealInvestorsError, type ListSyndicateDealInvestorsErrors, type ListSyndicateDealInvestorsResponse, type ListSyndicateDealInvestorsResponses, type ListSyndicateDealsData, type ListSyndicateDealsError, type ListSyndicateDealsErrors, type ListSyndicateDealsResponse, type ListSyndicateDealsResponses, type ListSyndicateMemberInvestmentsData, type ListSyndicateMemberInvestmentsError, type ListSyndicateMemberInvestmentsErrors, type ListSyndicateMemberInvestmentsResponse, type ListSyndicateMemberInvestmentsResponses, type ListSyndicateMembersData, type ListSyndicateMembersError, type ListSyndicateMembersErrors, type ListSyndicateMembersResponse, type ListSyndicateMembersResponses, type ListSyndicatePortfolioPositionsData, type ListSyndicatePortfolioPositionsError, type ListSyndicatePortfolioPositionsErrors, type ListSyndicatePortfolioPositionsResponse, type ListSyndicatePortfolioPositionsResponses, type ListSyndicatesData, type ListSyndicatesError, type ListSyndicatesErrors, type ListSyndicatesResponse, type ListSyndicatesResponses, type ListWebhookEndpointsData, type ListWebhookEndpointsError, type ListWebhookEndpointsErrors, type ListWebhookEndpointsResponse, type ListWebhookEndpointsResponses, type ListWebhookSubscriptionsData, type ListWebhookSubscriptionsError, type ListWebhookSubscriptionsErrors, type ListWebhookSubscriptionsResponse, type ListWebhookSubscriptionsResponses, type MarketingPartner, type MarketingPartnerEnvelope, type MemberId, type MemberInvestment, type MemberInvestmentListEnvelope, type Mode, type MyCompany, type MyCompanyListEnvelope, type OAuthHostOptions, type Offering, type OfferingEnvelope, type OfferingEventData, type OfferingListEnvelope, type OfferingSort, type OfferingStatsEnvelope, type OtherSecurity, type Page, type PageFetcher, type PaginationMeta, type ParsedSignatureHeader, type PartnerInvestment, type PartnerInvestmentEnvelope, type PartnerInvestmentId, type PartnerInvestmentListEnvelope, type PartnerInvestor, type PartnerInvestorListEnvelope, type PartnerInvite, type PartnerInviteEnvelope, type PartnerInviteListEnvelope, type PartnerWebhookEvent, type PartnerWebhookEventEnvelope, type PartnerWebhookSubscription, type PartnerWebhookSubscriptionCreateInput, type PartnerWebhookSubscriptionEnvelope, type PartnerWebhookSubscriptionListEnvelope, type PartnerWebhookSubscriptionWithSecret, type PartnerWebhookSubscriptionWithSecretEnvelope, type PastRound, type PerkTier, type PitchBlock, type Pkce, type PortfolioCompanyRef, type PortfolioFilters, type PortfolioHolding, type PortfolioPosition, type PortfolioPositionListEnvelope, type PortfolioPositionsFilters, type PortfolioPositionsQuery, type PortfolioSecurity, type PortfolioStatus, type PortfolioSummary, type PortfolioSummaryEnvelope, type PreviewIntentData, type PreviewIntentError, type PreviewIntentErrors, type PreviewIntentResponse, type PreviewIntentResponses, type PromoteSyndicateMemberData, type PromoteSyndicateMemberError, type PromoteSyndicateMemberErrors, type PromoteSyndicateMemberResponse, type PromoteSyndicateMemberResponses, REQUEST_ID_HEADER, type RawBody, type ReactivateWebhookSubscriptionData, type ReactivateWebhookSubscriptionError, type ReactivateWebhookSubscriptionErrors, type ReactivateWebhookSubscriptionResponse, type ReactivateWebhookSubscriptionResponses, type ReenableWebhookEndpointData, type ReenableWebhookEndpointError, type ReenableWebhookEndpointErrors, type ReenableWebhookEndpointResponse, type ReenableWebhookEndpointResponses, type RefreshOptions, type RegenerateWebhookSecretData, type RegenerateWebhookSecretError, type RegenerateWebhookSecretErrors, type RegenerateWebhookSecretResponse, type RegenerateWebhookSecretResponses, type RegisterAsPartnerData, type RegisterAsPartnerError, type RegisterAsPartnerErrors, type RegisterAsPartnerResponse, type RegisterAsPartnerResponses, type RemoveSyndicateMemberData, type RemoveSyndicateMemberError, type RemoveSyndicateMemberErrors, type ReorderSyndicateMembersData, type ReorderSyndicateMembersError, type ReorderSyndicateMembersErrors, type ReorderSyndicateMembersResponses, type ResendSyndicateInviteData, type ResendSyndicateInviteError, type ResendSyndicateInviteErrors, type ResendSyndicateInviteResponses, type RestoreSyndicateMemberData, type RestoreSyndicateMemberError, type RestoreSyndicateMemberErrors, type RestoreSyndicateMemberResponse, type RestoreSyndicateMemberResponses, type RevenueShareSecurity, type RevokeConnectedAppData, type RevokeConnectedAppError, type RevokeConnectedAppErrors, type RevokeConnectedAppResponse, type RevokeConnectedAppResponses, type RevokeInstallationData, type RevokeInstallationError, type RevokeInstallationErrors, type RevokeInstallationResponse, type RevokeInstallationResponses, type RevokePartnerInviteData, type RevokePartnerInviteError, type RevokePartnerInviteErrors, type RevokePartnerInviteResponse, type RevokePartnerInviteResponses, type RotateWebhookEndpointSecretData, type RotateWebhookEndpointSecretError, type RotateWebhookEndpointSecretErrors, type RotateWebhookEndpointSecretResponse, type RotateWebhookEndpointSecretResponses, SANDBOX_AUTHORIZE_BASE_URL, SIGNATURE_HEADER, type SafeSecurity, type SearchCompaniesData, type SearchCompaniesError, type SearchCompaniesErrors, type SearchCompaniesResponse, type SearchCompaniesResponses, type Security, type SecuritySummary, type SignWebhookOptions, type Spv, type SpvCancelIntentEnvelope, type SpvCloseIntentEnvelope, type SpvCreateInput, type SpvEnvelope, type SpvId, type SpvListEnvelope, type SpvMetrics, type SpvSettings, type SpvStatus, type SpvStatusEnvelope, type SpvTerms, type SpvWithMetaEnvelope, type StartDate, type Syndicate, type SyndicateDeal, type SyndicateDealCloseIntentEnvelope, type SyndicateDealDetailEnvelope, type SyndicateDealEnvelope, type SyndicateDealFinalizeIntentEnvelope, type SyndicateDealListEnvelope, type SyndicateDetailEnvelope, type SyndicateId, type SyndicateInvitationEventData, type SyndicateListEnvelope, type SyndicateMember, type SyndicateMemberEnvelope, type SyndicateMemberEventData, type SyndicateMemberListEnvelope, type SyndicatePortfolioSummaryEnvelope, type SyndicateStatistics, type SyndicateStatisticsEnvelope, type TagRef, type TargetCompanyInput, type TestWebhookEndpointData, type TestWebhookEndpointError, type TestWebhookEndpointErrors, type TestWebhookEndpointResponse, type TestWebhookEndpointResponses, type TestWebhookSubscriptionData, type TestWebhookSubscriptionError, type TestWebhookSubscriptionErrors, type TestWebhookSubscriptionResponse, type TestWebhookSubscriptionResponses, type TokenManagerOptions, type TokenSet, type TokenStore, type UnfollowCompanyData, type UnfollowCompanyError, type UnfollowCompanyErrors, type UnfollowCompanyResponse, type UnfollowCompanyResponses, type UnknownWebhookEvent, type UpdateSyndicateData, type UpdateSyndicateError, type UpdateSyndicateErrors, type UpdateSyndicateMemberData, type UpdateSyndicateMemberError, type UpdateSyndicateMemberErrors, type UpdateSyndicateMemberResponse, type UpdateSyndicateMemberResponses, type UpdateSyndicateResponse, type UpdateSyndicateResponses, type UpdateWebhookEndpointData, type UpdateWebhookEndpointError, type UpdateWebhookEndpointErrors, type UpdateWebhookEndpointInput, type UpdateWebhookEndpointResponse, type UpdateWebhookEndpointResponses, type User, type UserEnvelope, type UtmCampaign, type UtmSource, type ValidationError, type VerifyLegacyWebhookOptions, type VerifyWebhookOptions, type WebhookDelivery, type WebhookEndpoint, type WebhookEndpointEnvelope, type WebhookEndpointList, type WebhookEndpointListEnvelope, type WebhookEndpointRemoved, type WebhookEndpointTestResultEnvelope, type WebhookEvent, type WebhookEventDataMap, type WebhookEventName, type WebhookExternalId, type WebhookHandlers, type WebhookId, type WebhookInvestor, type WebhookInvestorTotals, type WebhookMode, type WebhookPersonRef, WebhookSignatureError, type WebhookSignatureFailure, type WebhookSubscription, type WebhookSubscriptionEnvelope, type WebhookSubscriptionId, type WebhookSubscriptionListEnvelope, type WebhookSubscriptionWithRecentDeliveriesEnvelope, type WebhookSubscriptionWithSecret2Envelope, type WebhookSubscriptionWithSecretEnvelope, type WebhookTestOutcome, type WebhookTestResult, type WebhookTestResultEnvelope, Wefunder, WefunderAuthError, WefunderError, type WefunderOptions, type WefunderRound, type WefunderVersion, checkWebhookSignature, clientCredentialsGrant, collect, computeWebhookSignature, constructEvent, constructEventFromRequest, createAuthorizationUrl, dispatchWebhook, exchangeCode, generatePkce, modeForToken, paginate, parseSignatureHeader, refreshToken, signWebhook, verifyWebhook };
|
|
9697
|
+
export { type AnonymizedAttribution, type ApproveSyndicateMemberData, type ApproveSyndicateMemberError, type ApproveSyndicateMemberErrors, type ApproveSyndicateMemberResponse, type ApproveSyndicateMemberResponses, type AttributedInvestmentListEnvelope, type AttributionCampaignAccess, type AttributionCampaignSummary, type AttributionCampaignSummaryListEnvelope, type AttributionMe, type AttributionMeEnvelope, type AttributionPartner, type AttributionStats, type AttributionStatsEnvelope, type AttributionUser, type AuditEvent, type AuditEventListEnvelope, type AuthorizationUrlOptions, type BulkInviteLinkCreateInput, type BulkInviteLinkEnvelope, type Campaign, type CampaignId, type CampaignListEnvelope, type ClientCredentialsOptions, type ClientOptions, type CloseSyndicateDealData, type CloseSyndicateDealError, type CloseSyndicateDealErrors, type CloseSyndicateDealResponse, type CloseSyndicateDealResponses, type CommentProposalEnvelope, type Company, type CompanyDisclosures, type CompanyDisclosuresEnvelope, type CompanyEnvelope, type CompanyPitch, type CompanyPitchEnvelope, type CompanyQuestion, type CompanyQuestionListEnvelope, type CompanyQuestionPerson, type CompanySearchResult, type CompanySearchResultListEnvelope, type CompanyTotals, type CompanyUpdate, type CompanyUpdateEnvelope, type CompanyUpdateListEnvelope, type ConnectedApp, type ConnectedAppListEnvelope, type ConnectedAppRevocation, type ConnectedAppRevocationEnvelope, type ConstructEventOptions, type ConvertibleNoteSecurity, type CreateInstallationData, type CreateInstallationError, type CreateInstallationErrors, type CreateInstallationResponse, type CreateInstallationResponses, type CreateInstallationTokenData, type CreateInstallationTokenError, type CreateInstallationTokenErrors, type CreateInstallationTokenResponse, type CreateInstallationTokenResponses, type CreateIntentData, type CreateIntentError, type CreateIntentErrors, type CreateIntentResponse, type CreateIntentResponses, type CreatePartnerInviteData, type CreatePartnerInviteError, type CreatePartnerInviteErrors, type CreatePartnerInviteResponse, type CreatePartnerInviteResponses, type CreateWebhookEndpointData, type CreateWebhookEndpointError, type CreateWebhookEndpointErrors, type CreateWebhookEndpointInput, type CreateWebhookEndpointResponse, type CreateWebhookEndpointResponses, type CreateWebhookSubscriptionData, type CreateWebhookSubscriptionError, type CreateWebhookSubscriptionErrors, type CreateWebhookSubscriptionResponse, type CreateWebhookSubscriptionResponses, type CurrentRaise, type Cursor, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_AUTHORIZE_BASE_URL, DEFAULT_OAUTH_BASE_URL, DEFAULT_TOKEN_BASE_URL, DEFAULT_TOLERANCE_SECONDS, type DealInvestor, type DealInvestorListEnvelope, type DebtSecurity, type DeleteWebhookEndpointData, type DeleteWebhookEndpointError, type DeleteWebhookEndpointErrors, type DeleteWebhookEndpointResponse, type DeleteWebhookEndpointResponses, type DeleteWebhookSubscriptionData, type DeleteWebhookSubscriptionError, type DeleteWebhookSubscriptionErrors, type DeleteWebhookSubscriptionResponse, type DeleteWebhookSubscriptionResponses, type DemoteSyndicateMemberData, type DemoteSyndicateMemberError, type DemoteSyndicateMemberErrors, type DemoteSyndicateMemberResponse, type DemoteSyndicateMemberResponses, type DisclosureDocument, type DisclosurePerson, type EligibleTargetListEnvelope, type EndDate, type EquitySecurity, type Error$1 as Error, type ExchangeCodeOptions, type Exemption, type ExportSyndicateMembersCsvData, type ExportSyndicateMembersCsvError, type ExportSyndicateMembersCsvErrors, type ExportSyndicateMembersCsvResponse, type ExportSyndicateMembersCsvResponses, type FinalizeSyndicateDealData, type FinalizeSyndicateDealError, type FinalizeSyndicateDealErrors, type FinalizeSyndicateDealResponse, type FinalizeSyndicateDealResponses, type FiscalYearFinancials, type FollowCompanyData, type FollowCompanyError, type FollowCompanyErrors, type FollowCompanyResponse, type FollowCompanyResponses, type FollowStateEnvelope, type FollowedCompany, type FollowedCompanyListEnvelope, type FullAttribution, type FundSecurity, type FundraiseId, type GetAttributionMeData, type GetAttributionMeError, type GetAttributionMeErrors, type GetAttributionMeResponse, type GetAttributionMeResponses, type GetAttributionStatsData, type GetAttributionStatsError, type GetAttributionStatsErrors, type GetAttributionStatsResponse, type GetAttributionStatsResponses, type GetCompanyData, type GetCompanyDisclosuresData, type GetCompanyDisclosuresError, type GetCompanyDisclosuresErrors, type GetCompanyDisclosuresResponse, type GetCompanyDisclosuresResponses, type GetCompanyError, type GetCompanyErrors, type GetCompanyPitchData, type GetCompanyPitchError, type GetCompanyPitchErrors, type GetCompanyPitchResponse, type GetCompanyPitchResponses, type GetCompanyResponse, type GetCompanyResponses, type GetCompanyUpdateData, type GetCompanyUpdateError, type GetCompanyUpdateErrors, type GetCompanyUpdateResponse, type GetCompanyUpdateResponses, type GetCurrentUserData, type GetCurrentUserError, type GetCurrentUserErrors, type GetCurrentUserResponse, type GetCurrentUserResponses, type GetInstallationData, type GetInstallationError, type GetInstallationErrors, type GetInstallationResponse, type GetInstallationResponses, type GetIntentData, type GetIntentError, type GetIntentErrors, type GetIntentResponse, type GetIntentResponses, type GetInvestmentData, type GetInvestmentError, type GetInvestmentErrors, type GetInvestmentResponse, type GetInvestmentResponses, type GetOfferingData, type GetOfferingError, type GetOfferingErrors, type GetOfferingResponse, type GetOfferingResponses, type GetOfferingStatsData, type GetOfferingStatsError, type GetOfferingStatsErrors, type GetOfferingStatsResponse, type GetOfferingStatsResponses, type GetPortfolioData, type GetPortfolioError, type GetPortfolioErrors, type GetPortfolioResponse, type GetPortfolioResponses, type GetSyndicateData, type GetSyndicateDealData, type GetSyndicateDealError, type GetSyndicateDealErrors, type GetSyndicateDealResponse, type GetSyndicateDealResponses, type GetSyndicateError, type GetSyndicateErrors, type GetSyndicatePortfolioData, type GetSyndicatePortfolioError, type GetSyndicatePortfolioErrors, type GetSyndicatePortfolioResponse, type GetSyndicatePortfolioResponses, type GetSyndicateResponse, type GetSyndicateResponses, type GetSyndicateStatisticsData, type GetSyndicateStatisticsError, type GetSyndicateStatisticsErrors, type GetSyndicateStatisticsResponse, type GetSyndicateStatisticsResponses, type GetWebhookEndpointData, type GetWebhookEndpointError, type GetWebhookEndpointErrors, type GetWebhookEndpointResponse, type GetWebhookEndpointResponses, type GetWebhookSubscriptionData, type GetWebhookSubscriptionError, type GetWebhookSubscriptionErrors, type GetWebhookSubscriptionResponse, type GetWebhookSubscriptionResponses, type HeadersLike, type HideSyndicateMemberData, type HideSyndicateMemberError, type HideSyndicateMemberErrors, type HideSyndicateMemberResponse, type HideSyndicateMemberResponses, type IdempotencyKey, type Installation, type InstallationEnvelope, type InstallationListEnvelope, type InstallationTokenEnvelope, type Intent, type IntentEnvelope, type IntentListEnvelope, type IntentPreviewEnvelope, type IntentReview, type IntentStatus, type Investment, type InvestmentChangeListEnvelope, type InvestmentChangedEventData, type InvestmentDeltaRecord, type InvestmentEnvelope, type InvestmentEventData, type InvestmentListEnvelope, type InvestmentSession, type InvestmentSessionCreateInput, type InvestmentSessionEnvelope, type InvestmentSessionEventData, type InvestmentSessionId, type InvestmentSessionListEnvelope, type InvestmentsFilters, type InvestmentsQuery, type Investor, type InvestorEnvelope, type InvestorListEnvelope, type InviteLink, type InviteLinkCreateInput, type InviteLinkEnvelope, type InviteLinkId, type InviteLinkListEnvelope, type InviteLinkUpdateInput, type InviteSyndicateMemberData, type InviteSyndicateMemberError, type InviteSyndicateMemberErrors, type InviteSyndicateMemberResponse, type InviteSyndicateMemberResponses, LEGACY_DELIVERY_ID_HEADER, LEGACY_EVENT_HEADER, LEGACY_SIGNATURE_HEADER, LEGACY_TIMESTAMP_HEADER, type ListActivityData, type ListActivityError, type ListActivityErrors, type ListActivityResponse, type ListActivityResponses, type ListAttributedInvestmentsData, type ListAttributedInvestmentsError, type ListAttributedInvestmentsErrors, type ListAttributedInvestmentsResponse, type ListAttributedInvestmentsResponses, type ListAttributionCampaignsData, type ListAttributionCampaignsError, type ListAttributionCampaignsErrors, type ListAttributionCampaignsResponse, type ListAttributionCampaignsResponses, type ListCampaignsData, type ListCampaignsError, type ListCampaignsErrors, type ListCampaignsResponse, type ListCampaignsResponses, type ListCompanyInvestmentChangesData, type ListCompanyInvestmentChangesError, type ListCompanyInvestmentChangesErrors, type ListCompanyInvestmentChangesResponse, type ListCompanyInvestmentChangesResponses, type ListCompanyQuestionsData, type ListCompanyQuestionsError, type ListCompanyQuestionsErrors, type ListCompanyQuestionsResponse, type ListCompanyQuestionsResponses, type ListCompanyUpdatesData, type ListCompanyUpdatesError, type ListCompanyUpdatesErrors, type ListCompanyUpdatesResponse, type ListCompanyUpdatesResponses, type ListConnectedAppsData, type ListConnectedAppsError, type ListConnectedAppsErrors, type ListConnectedAppsResponse, type ListConnectedAppsResponses, type ListEligibleInstallTargetsData, type ListEligibleInstallTargetsError, type ListEligibleInstallTargetsErrors, type ListEligibleInstallTargetsResponse, type ListEligibleInstallTargetsResponses, type ListFollowedCompaniesData, type ListFollowedCompaniesError, type ListFollowedCompaniesErrors, type ListFollowedCompaniesResponse, type ListFollowedCompaniesResponses, type ListInstallationsData, type ListInstallationsError, type ListInstallationsErrors, type ListInstallationsResponse, type ListInstallationsResponses, type ListIntentsData, type ListIntentsError, type ListIntentsErrors, type ListIntentsResponse, type ListIntentsResponses, type ListInvestmentsData, type ListInvestmentsError, type ListInvestmentsErrors, type ListInvestmentsResponse, type ListInvestmentsResponses, type ListMyCompaniesData, type ListMyCompaniesError, type ListMyCompaniesErrors, type ListMyCompaniesResponse, type ListMyCompaniesResponses, type ListOfferingsData, type ListOfferingsError, type ListOfferingsErrors, type ListOfferingsResponse, type ListOfferingsResponses, type ListPartnerInvitesData, type ListPartnerInvitesError, type ListPartnerInvitesErrors, type ListPartnerInvitesResponse, type ListPartnerInvitesResponses, type ListPortfolioPositionsData, type ListPortfolioPositionsError, type ListPortfolioPositionsErrors, type ListPortfolioPositionsResponse, type ListPortfolioPositionsResponses, type ListSyndicateDealInvestorsData, type ListSyndicateDealInvestorsError, type ListSyndicateDealInvestorsErrors, type ListSyndicateDealInvestorsResponse, type ListSyndicateDealInvestorsResponses, type ListSyndicateDealsData, type ListSyndicateDealsError, type ListSyndicateDealsErrors, type ListSyndicateDealsResponse, type ListSyndicateDealsResponses, type ListSyndicateMemberInvestmentsData, type ListSyndicateMemberInvestmentsError, type ListSyndicateMemberInvestmentsErrors, type ListSyndicateMemberInvestmentsResponse, type ListSyndicateMemberInvestmentsResponses, type ListSyndicateMembersData, type ListSyndicateMembersError, type ListSyndicateMembersErrors, type ListSyndicateMembersResponse, type ListSyndicateMembersResponses, type ListSyndicatePortfolioPositionsData, type ListSyndicatePortfolioPositionsError, type ListSyndicatePortfolioPositionsErrors, type ListSyndicatePortfolioPositionsResponse, type ListSyndicatePortfolioPositionsResponses, type ListSyndicatesData, type ListSyndicatesError, type ListSyndicatesErrors, type ListSyndicatesResponse, type ListSyndicatesResponses, type ListWebhookEndpointsData, type ListWebhookEndpointsError, type ListWebhookEndpointsErrors, type ListWebhookEndpointsResponse, type ListWebhookEndpointsResponses, type ListWebhookSubscriptionsData, type ListWebhookSubscriptionsError, type ListWebhookSubscriptionsErrors, type ListWebhookSubscriptionsResponse, type ListWebhookSubscriptionsResponses, type MarketingPartner, type MarketingPartnerEnvelope, type MemberId, type MemberInvestment, type MemberInvestmentListEnvelope, type Mode, type MyCompany, type MyCompanyListEnvelope, type OAuthHostOptions, type Offering, type OfferingEnvelope, type OfferingEventData, type OfferingListEnvelope, type OfferingSort, type OfferingStatsEnvelope, type OtherSecurity, type Page, type PageFetcher, type PaginationMeta, type ParsedSignatureHeader, type PartnerInvestment, type PartnerInvestmentEnvelope, type PartnerInvestmentId, type PartnerInvestmentListEnvelope, type PartnerInvestor, type PartnerInvestorListEnvelope, type PartnerInvite, type PartnerInviteEnvelope, type PartnerInviteListEnvelope, type PartnerWebhookEvent, type PartnerWebhookEventEnvelope, type PartnerWebhookSubscription, type PartnerWebhookSubscriptionCreateInput, type PartnerWebhookSubscriptionEnvelope, type PartnerWebhookSubscriptionListEnvelope, type PartnerWebhookSubscriptionWithSecret, type PartnerWebhookSubscriptionWithSecretEnvelope, type PastRound, type PerkTier, type PitchBlock, type Pkce, type PortfolioCompanyRef, type PortfolioFilters, type PortfolioHolding, type PortfolioPosition, type PortfolioPositionListEnvelope, type PortfolioPositionsFilters, type PortfolioPositionsQuery, type PortfolioSecurity, type PortfolioStatus, type PortfolioSummary, type PortfolioSummaryEnvelope, type PreviewIntentData, type PreviewIntentError, type PreviewIntentErrors, type PreviewIntentResponse, type PreviewIntentResponses, type PromoteSyndicateMemberData, type PromoteSyndicateMemberError, type PromoteSyndicateMemberErrors, type PromoteSyndicateMemberResponse, type PromoteSyndicateMemberResponses, REQUEST_ID_HEADER, type RawBody, type ReactivateWebhookSubscriptionData, type ReactivateWebhookSubscriptionError, type ReactivateWebhookSubscriptionErrors, type ReactivateWebhookSubscriptionResponse, type ReactivateWebhookSubscriptionResponses, type ReenableWebhookEndpointData, type ReenableWebhookEndpointError, type ReenableWebhookEndpointErrors, type ReenableWebhookEndpointResponse, type ReenableWebhookEndpointResponses, type RefreshOptions, type RegenerateWebhookSecretData, type RegenerateWebhookSecretError, type RegenerateWebhookSecretErrors, type RegenerateWebhookSecretResponse, type RegenerateWebhookSecretResponses, type RegisterAsPartnerData, type RegisterAsPartnerError, type RegisterAsPartnerErrors, type RegisterAsPartnerResponse, type RegisterAsPartnerResponses, type RemoveSyndicateMemberData, type RemoveSyndicateMemberError, type RemoveSyndicateMemberErrors, type ReorderSyndicateMembersData, type ReorderSyndicateMembersError, type ReorderSyndicateMembersErrors, type ReorderSyndicateMembersResponses, type ResendSyndicateInviteData, type ResendSyndicateInviteError, type ResendSyndicateInviteErrors, type ResendSyndicateInviteResponses, type RestoreSyndicateMemberData, type RestoreSyndicateMemberError, type RestoreSyndicateMemberErrors, type RestoreSyndicateMemberResponse, type RestoreSyndicateMemberResponses, type RevenueShareSecurity, type RevokeConnectedAppData, type RevokeConnectedAppError, type RevokeConnectedAppErrors, type RevokeConnectedAppResponse, type RevokeConnectedAppResponses, type RevokeInstallationData, type RevokeInstallationError, type RevokeInstallationErrors, type RevokeInstallationResponse, type RevokeInstallationResponses, type RevokePartnerInviteData, type RevokePartnerInviteError, type RevokePartnerInviteErrors, type RevokePartnerInviteResponse, type RevokePartnerInviteResponses, type RotateWebhookEndpointSecretData, type RotateWebhookEndpointSecretError, type RotateWebhookEndpointSecretErrors, type RotateWebhookEndpointSecretResponse, type RotateWebhookEndpointSecretResponses, SANDBOX_AUTHORIZE_BASE_URL, SIGNATURE_HEADER, type SafeSecurity, type SearchCompaniesData, type SearchCompaniesError, type SearchCompaniesErrors, type SearchCompaniesResponse, type SearchCompaniesResponses, type Security, type SecuritySummary, type SignWebhookOptions, type Spv, type SpvCancelIntentEnvelope, type SpvCloseIntentEnvelope, type SpvCreateInput, type SpvEnvelope, type SpvId, type SpvListEnvelope, type SpvMetrics, type SpvSettings, type SpvStatus, type SpvStatusEnvelope, type SpvTerms, type SpvWithMetaEnvelope, type StartDate, type Syndicate, type SyndicateDeal, type SyndicateDealCloseIntentEnvelope, type SyndicateDealDetailEnvelope, type SyndicateDealEnvelope, type SyndicateDealFinalizeIntentEnvelope, type SyndicateDealListEnvelope, type SyndicateDetailEnvelope, type SyndicateId, type SyndicateInvitationEventData, type SyndicateListEnvelope, type SyndicateMember, type SyndicateMemberEnvelope, type SyndicateMemberEventData, type SyndicateMemberListEnvelope, type SyndicatePortfolioSummaryEnvelope, type SyndicateStatistics, type SyndicateStatisticsEnvelope, type TagRef, type TargetCompanyInput, type TestWebhookEndpointData, type TestWebhookEndpointError, type TestWebhookEndpointErrors, type TestWebhookEndpointResponse, type TestWebhookEndpointResponses, type TestWebhookSubscriptionData, type TestWebhookSubscriptionError, type TestWebhookSubscriptionErrors, type TestWebhookSubscriptionResponse, type TestWebhookSubscriptionResponses, TokenManager, type TokenManagerOptions, type TokenSet, type TokenStore, type UnfollowCompanyData, type UnfollowCompanyError, type UnfollowCompanyErrors, type UnfollowCompanyResponse, type UnfollowCompanyResponses, type UnknownWebhookEvent, type UpdateSyndicateData, type UpdateSyndicateError, type UpdateSyndicateErrors, type UpdateSyndicateMemberData, type UpdateSyndicateMemberError, type UpdateSyndicateMemberErrors, type UpdateSyndicateMemberResponse, type UpdateSyndicateMemberResponses, type UpdateSyndicateResponse, type UpdateSyndicateResponses, type UpdateWebhookEndpointData, type UpdateWebhookEndpointError, type UpdateWebhookEndpointErrors, type UpdateWebhookEndpointInput, type UpdateWebhookEndpointResponse, type UpdateWebhookEndpointResponses, type User, type UserEnvelope, type UtmCampaign, type UtmSource, type ValidationError, type VerifyLegacyWebhookOptions, type VerifyWebhookOptions, type WebhookDelivery, type WebhookEndpoint, type WebhookEndpointEnvelope, type WebhookEndpointList, type WebhookEndpointListEnvelope, type WebhookEndpointRemoved, type WebhookEndpointTestResultEnvelope, type WebhookEvent, type WebhookEventDataMap, type WebhookEventName, type WebhookExternalId, type WebhookHandlers, type WebhookId, type WebhookInvestor, type WebhookInvestorTotals, type WebhookMode, type WebhookPersonRef, WebhookSignatureError, type WebhookSignatureFailure, type WebhookSubscription, type WebhookSubscriptionEnvelope, type WebhookSubscriptionId, type WebhookSubscriptionListEnvelope, type WebhookSubscriptionWithRecentDeliveriesEnvelope, type WebhookSubscriptionWithSecret2Envelope, type WebhookSubscriptionWithSecretEnvelope, type WebhookTestOutcome, type WebhookTestResult, type WebhookTestResultEnvelope, Wefunder, WefunderAuthError, WefunderError, type WefunderOptions, type WefunderRound, WefunderTokenPersistenceError, type WefunderVersion, checkWebhookSignature, clientCredentialsGrant, collect, computeWebhookSignature, constructEvent, constructEventFromRequest, createAuthorizationUrl, dispatchWebhook, exchangeCode, generatePkce, modeForToken, paginate, parseSignatureHeader, refreshToken, signWebhook, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,16 @@ interface RefreshOptions extends OAuthHostOptions {
|
|
|
76
76
|
*/
|
|
77
77
|
declare function refreshToken(opts: RefreshOptions): Promise<TokenSet>;
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The token store failed to save a rotated token set. `tokens` is the rotated set that is NOT
|
|
81
|
+
* yet durable and NOT yet in use: the manager keeps it pending and retries the save on the next
|
|
82
|
+
* call (or persist it yourself and call `markPersisted()`). Until it is saved no request uses it,
|
|
83
|
+
* and the consumed refresh token is never reused either.
|
|
84
|
+
*/
|
|
85
|
+
declare class WefunderTokenPersistenceError extends Error {
|
|
86
|
+
readonly tokens: TokenSet;
|
|
87
|
+
constructor(tokens: TokenSet, cause: unknown);
|
|
88
|
+
}
|
|
79
89
|
/** Pluggable persistence for the rotating token set (DB row, secrets manager, etc.). */
|
|
80
90
|
interface TokenStore {
|
|
81
91
|
load?(): Promise<TokenSet | undefined> | TokenSet | undefined;
|
|
@@ -98,6 +108,35 @@ interface TokenManagerOptions extends OAuthHostOptions {
|
|
|
98
108
|
/** Refresh proactively when the access token is within this many ms of expiry. */
|
|
99
109
|
expiryLeewayMs?: number;
|
|
100
110
|
}
|
|
111
|
+
declare class TokenManager {
|
|
112
|
+
#private;
|
|
113
|
+
constructor(opts: TokenManagerOptions);
|
|
114
|
+
/** The durable, in-use token set. A rotated set that could not be persisted sits in `pendingTokens`. */
|
|
115
|
+
get current(): TokenSet;
|
|
116
|
+
/** True if the manager can recover an expired token (rotate a refresh token or re-mint). */
|
|
117
|
+
get canRefresh(): boolean;
|
|
118
|
+
/** A rotated set awaiting a successful `store.save` (see `WefunderTokenPersistenceError`). */
|
|
119
|
+
get pendingTokens(): TokenSet | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Tell the manager you persisted `tokens` (the set from a `WefunderTokenPersistenceError`)
|
|
122
|
+
* yourself. Publishes it only if it is still the pending set — a stale acknowledgment (the
|
|
123
|
+
* manager has since rotated again) is a no-op and returns false, so an older save can never
|
|
124
|
+
* publish a newer, unsaved set.
|
|
125
|
+
*/
|
|
126
|
+
markPersisted(tokens: TokenSet): Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Returns a valid access token, refreshing proactively if it's expired/near-expiry. If a
|
|
129
|
+
* rotated set is pending persistence, the save is retried first — no request uses an
|
|
130
|
+
* undurable token.
|
|
131
|
+
*/
|
|
132
|
+
getAccessToken(): Promise<string>;
|
|
133
|
+
/**
|
|
134
|
+
* Recover an expired/rejected token (e.g. after a 401): rotates the refresh token
|
|
135
|
+
* if there is one, otherwise re-mints (client_credentials). Coalesces concurrent
|
|
136
|
+
* calls into one network round-trip, then persists. Returns the new token set.
|
|
137
|
+
*/
|
|
138
|
+
refresh(): Promise<TokenSet>;
|
|
139
|
+
}
|
|
101
140
|
|
|
102
141
|
interface RetryOptions {
|
|
103
142
|
maxRetries?: number;
|
|
@@ -9469,6 +9508,10 @@ declare class Wefunder {
|
|
|
9469
9508
|
now?: () => number;
|
|
9470
9509
|
}): Promise<Wefunder>;
|
|
9471
9510
|
/** The live token set (e.g. to persist after construction). */
|
|
9511
|
+
/** A rotated set awaiting a successful save (see `WefunderTokenPersistenceError`). */
|
|
9512
|
+
get pendingTokens(): TokenSet | undefined;
|
|
9513
|
+
/** Acknowledge an out-of-band save of `tokens`; false if that set is no longer pending. */
|
|
9514
|
+
markPersisted(tokens: TokenSet): Promise<boolean>;
|
|
9472
9515
|
get tokens(): TokenSet;
|
|
9473
9516
|
/**
|
|
9474
9517
|
* Unwrap any generated op result (incl. `wf.raw.*`) the way the ergonomic
|
|
@@ -9651,4 +9694,4 @@ declare class WefunderAuthError extends WefunderError {
|
|
|
9651
9694
|
constructor(message: string);
|
|
9652
9695
|
}
|
|
9653
9696
|
|
|
9654
|
-
export { type AnonymizedAttribution, type ApproveSyndicateMemberData, type ApproveSyndicateMemberError, type ApproveSyndicateMemberErrors, type ApproveSyndicateMemberResponse, type ApproveSyndicateMemberResponses, type AttributedInvestmentListEnvelope, type AttributionCampaignAccess, type AttributionCampaignSummary, type AttributionCampaignSummaryListEnvelope, type AttributionMe, type AttributionMeEnvelope, type AttributionPartner, type AttributionStats, type AttributionStatsEnvelope, type AttributionUser, type AuditEvent, type AuditEventListEnvelope, type AuthorizationUrlOptions, type BulkInviteLinkCreateInput, type BulkInviteLinkEnvelope, type Campaign, type CampaignId, type CampaignListEnvelope, type ClientCredentialsOptions, type ClientOptions, type CloseSyndicateDealData, type CloseSyndicateDealError, type CloseSyndicateDealErrors, type CloseSyndicateDealResponse, type CloseSyndicateDealResponses, type CommentProposalEnvelope, type Company, type CompanyDisclosures, type CompanyDisclosuresEnvelope, type CompanyEnvelope, type CompanyPitch, type CompanyPitchEnvelope, type CompanyQuestion, type CompanyQuestionListEnvelope, type CompanyQuestionPerson, type CompanySearchResult, type CompanySearchResultListEnvelope, type CompanyTotals, type CompanyUpdate, type CompanyUpdateEnvelope, type CompanyUpdateListEnvelope, type ConnectedApp, type ConnectedAppListEnvelope, type ConnectedAppRevocation, type ConnectedAppRevocationEnvelope, type ConstructEventOptions, type ConvertibleNoteSecurity, type CreateInstallationData, type CreateInstallationError, type CreateInstallationErrors, type CreateInstallationResponse, type CreateInstallationResponses, type CreateInstallationTokenData, type CreateInstallationTokenError, type CreateInstallationTokenErrors, type CreateInstallationTokenResponse, type CreateInstallationTokenResponses, type CreateIntentData, type CreateIntentError, type CreateIntentErrors, type CreateIntentResponse, type CreateIntentResponses, type CreatePartnerInviteData, type CreatePartnerInviteError, type CreatePartnerInviteErrors, type CreatePartnerInviteResponse, type CreatePartnerInviteResponses, type CreateWebhookEndpointData, type CreateWebhookEndpointError, type CreateWebhookEndpointErrors, type CreateWebhookEndpointInput, type CreateWebhookEndpointResponse, type CreateWebhookEndpointResponses, type CreateWebhookSubscriptionData, type CreateWebhookSubscriptionError, type CreateWebhookSubscriptionErrors, type CreateWebhookSubscriptionResponse, type CreateWebhookSubscriptionResponses, type CurrentRaise, type Cursor, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_AUTHORIZE_BASE_URL, DEFAULT_OAUTH_BASE_URL, DEFAULT_TOKEN_BASE_URL, DEFAULT_TOLERANCE_SECONDS, type DealInvestor, type DealInvestorListEnvelope, type DebtSecurity, type DeleteWebhookEndpointData, type DeleteWebhookEndpointError, type DeleteWebhookEndpointErrors, type DeleteWebhookEndpointResponse, type DeleteWebhookEndpointResponses, type DeleteWebhookSubscriptionData, type DeleteWebhookSubscriptionError, type DeleteWebhookSubscriptionErrors, type DeleteWebhookSubscriptionResponse, type DeleteWebhookSubscriptionResponses, type DemoteSyndicateMemberData, type DemoteSyndicateMemberError, type DemoteSyndicateMemberErrors, type DemoteSyndicateMemberResponse, type DemoteSyndicateMemberResponses, type DisclosureDocument, type DisclosurePerson, type EligibleTargetListEnvelope, type EndDate, type EquitySecurity, type Error$1 as Error, type ExchangeCodeOptions, type Exemption, type ExportSyndicateMembersCsvData, type ExportSyndicateMembersCsvError, type ExportSyndicateMembersCsvErrors, type ExportSyndicateMembersCsvResponse, type ExportSyndicateMembersCsvResponses, type FinalizeSyndicateDealData, type FinalizeSyndicateDealError, type FinalizeSyndicateDealErrors, type FinalizeSyndicateDealResponse, type FinalizeSyndicateDealResponses, type FiscalYearFinancials, type FollowCompanyData, type FollowCompanyError, type FollowCompanyErrors, type FollowCompanyResponse, type FollowCompanyResponses, type FollowStateEnvelope, type FollowedCompany, type FollowedCompanyListEnvelope, type FullAttribution, type FundSecurity, type FundraiseId, type GetAttributionMeData, type GetAttributionMeError, type GetAttributionMeErrors, type GetAttributionMeResponse, type GetAttributionMeResponses, type GetAttributionStatsData, type GetAttributionStatsError, type GetAttributionStatsErrors, type GetAttributionStatsResponse, type GetAttributionStatsResponses, type GetCompanyData, type GetCompanyDisclosuresData, type GetCompanyDisclosuresError, type GetCompanyDisclosuresErrors, type GetCompanyDisclosuresResponse, type GetCompanyDisclosuresResponses, type GetCompanyError, type GetCompanyErrors, type GetCompanyPitchData, type GetCompanyPitchError, type GetCompanyPitchErrors, type GetCompanyPitchResponse, type GetCompanyPitchResponses, type GetCompanyResponse, type GetCompanyResponses, type GetCompanyUpdateData, type GetCompanyUpdateError, type GetCompanyUpdateErrors, type GetCompanyUpdateResponse, type GetCompanyUpdateResponses, type GetCurrentUserData, type GetCurrentUserError, type GetCurrentUserErrors, type GetCurrentUserResponse, type GetCurrentUserResponses, type GetInstallationData, type GetInstallationError, type GetInstallationErrors, type GetInstallationResponse, type GetInstallationResponses, type GetIntentData, type GetIntentError, type GetIntentErrors, type GetIntentResponse, type GetIntentResponses, type GetInvestmentData, type GetInvestmentError, type GetInvestmentErrors, type GetInvestmentResponse, type GetInvestmentResponses, type GetOfferingData, type GetOfferingError, type GetOfferingErrors, type GetOfferingResponse, type GetOfferingResponses, type GetOfferingStatsData, type GetOfferingStatsError, type GetOfferingStatsErrors, type GetOfferingStatsResponse, type GetOfferingStatsResponses, type GetPortfolioData, type GetPortfolioError, type GetPortfolioErrors, type GetPortfolioResponse, type GetPortfolioResponses, type GetSyndicateData, type GetSyndicateDealData, type GetSyndicateDealError, type GetSyndicateDealErrors, type GetSyndicateDealResponse, type GetSyndicateDealResponses, type GetSyndicateError, type GetSyndicateErrors, type GetSyndicatePortfolioData, type GetSyndicatePortfolioError, type GetSyndicatePortfolioErrors, type GetSyndicatePortfolioResponse, type GetSyndicatePortfolioResponses, type GetSyndicateResponse, type GetSyndicateResponses, type GetSyndicateStatisticsData, type GetSyndicateStatisticsError, type GetSyndicateStatisticsErrors, type GetSyndicateStatisticsResponse, type GetSyndicateStatisticsResponses, type GetWebhookEndpointData, type GetWebhookEndpointError, type GetWebhookEndpointErrors, type GetWebhookEndpointResponse, type GetWebhookEndpointResponses, type GetWebhookSubscriptionData, type GetWebhookSubscriptionError, type GetWebhookSubscriptionErrors, type GetWebhookSubscriptionResponse, type GetWebhookSubscriptionResponses, type HeadersLike, type HideSyndicateMemberData, type HideSyndicateMemberError, type HideSyndicateMemberErrors, type HideSyndicateMemberResponse, type HideSyndicateMemberResponses, type IdempotencyKey, type Installation, type InstallationEnvelope, type InstallationListEnvelope, type InstallationTokenEnvelope, type Intent, type IntentEnvelope, type IntentListEnvelope, type IntentPreviewEnvelope, type IntentReview, type IntentStatus, type Investment, type InvestmentChangeListEnvelope, type InvestmentChangedEventData, type InvestmentDeltaRecord, type InvestmentEnvelope, type InvestmentEventData, type InvestmentListEnvelope, type InvestmentSession, type InvestmentSessionCreateInput, type InvestmentSessionEnvelope, type InvestmentSessionEventData, type InvestmentSessionId, type InvestmentSessionListEnvelope, type InvestmentsFilters, type InvestmentsQuery, type Investor, type InvestorEnvelope, type InvestorListEnvelope, type InviteLink, type InviteLinkCreateInput, type InviteLinkEnvelope, type InviteLinkId, type InviteLinkListEnvelope, type InviteLinkUpdateInput, type InviteSyndicateMemberData, type InviteSyndicateMemberError, type InviteSyndicateMemberErrors, type InviteSyndicateMemberResponse, type InviteSyndicateMemberResponses, LEGACY_DELIVERY_ID_HEADER, LEGACY_EVENT_HEADER, LEGACY_SIGNATURE_HEADER, LEGACY_TIMESTAMP_HEADER, type ListActivityData, type ListActivityError, type ListActivityErrors, type ListActivityResponse, type ListActivityResponses, type ListAttributedInvestmentsData, type ListAttributedInvestmentsError, type ListAttributedInvestmentsErrors, type ListAttributedInvestmentsResponse, type ListAttributedInvestmentsResponses, type ListAttributionCampaignsData, type ListAttributionCampaignsError, type ListAttributionCampaignsErrors, type ListAttributionCampaignsResponse, type ListAttributionCampaignsResponses, type ListCampaignsData, type ListCampaignsError, type ListCampaignsErrors, type ListCampaignsResponse, type ListCampaignsResponses, type ListCompanyInvestmentChangesData, type ListCompanyInvestmentChangesError, type ListCompanyInvestmentChangesErrors, type ListCompanyInvestmentChangesResponse, type ListCompanyInvestmentChangesResponses, type ListCompanyQuestionsData, type ListCompanyQuestionsError, type ListCompanyQuestionsErrors, type ListCompanyQuestionsResponse, type ListCompanyQuestionsResponses, type ListCompanyUpdatesData, type ListCompanyUpdatesError, type ListCompanyUpdatesErrors, type ListCompanyUpdatesResponse, type ListCompanyUpdatesResponses, type ListConnectedAppsData, type ListConnectedAppsError, type ListConnectedAppsErrors, type ListConnectedAppsResponse, type ListConnectedAppsResponses, type ListEligibleInstallTargetsData, type ListEligibleInstallTargetsError, type ListEligibleInstallTargetsErrors, type ListEligibleInstallTargetsResponse, type ListEligibleInstallTargetsResponses, type ListFollowedCompaniesData, type ListFollowedCompaniesError, type ListFollowedCompaniesErrors, type ListFollowedCompaniesResponse, type ListFollowedCompaniesResponses, type ListInstallationsData, type ListInstallationsError, type ListInstallationsErrors, type ListInstallationsResponse, type ListInstallationsResponses, type ListIntentsData, type ListIntentsError, type ListIntentsErrors, type ListIntentsResponse, type ListIntentsResponses, type ListInvestmentsData, type ListInvestmentsError, type ListInvestmentsErrors, type ListInvestmentsResponse, type ListInvestmentsResponses, type ListMyCompaniesData, type ListMyCompaniesError, type ListMyCompaniesErrors, type ListMyCompaniesResponse, type ListMyCompaniesResponses, type ListOfferingsData, type ListOfferingsError, type ListOfferingsErrors, type ListOfferingsResponse, type ListOfferingsResponses, type ListPartnerInvitesData, type ListPartnerInvitesError, type ListPartnerInvitesErrors, type ListPartnerInvitesResponse, type ListPartnerInvitesResponses, type ListPortfolioPositionsData, type ListPortfolioPositionsError, type ListPortfolioPositionsErrors, type ListPortfolioPositionsResponse, type ListPortfolioPositionsResponses, type ListSyndicateDealInvestorsData, type ListSyndicateDealInvestorsError, type ListSyndicateDealInvestorsErrors, type ListSyndicateDealInvestorsResponse, type ListSyndicateDealInvestorsResponses, type ListSyndicateDealsData, type ListSyndicateDealsError, type ListSyndicateDealsErrors, type ListSyndicateDealsResponse, type ListSyndicateDealsResponses, type ListSyndicateMemberInvestmentsData, type ListSyndicateMemberInvestmentsError, type ListSyndicateMemberInvestmentsErrors, type ListSyndicateMemberInvestmentsResponse, type ListSyndicateMemberInvestmentsResponses, type ListSyndicateMembersData, type ListSyndicateMembersError, type ListSyndicateMembersErrors, type ListSyndicateMembersResponse, type ListSyndicateMembersResponses, type ListSyndicatePortfolioPositionsData, type ListSyndicatePortfolioPositionsError, type ListSyndicatePortfolioPositionsErrors, type ListSyndicatePortfolioPositionsResponse, type ListSyndicatePortfolioPositionsResponses, type ListSyndicatesData, type ListSyndicatesError, type ListSyndicatesErrors, type ListSyndicatesResponse, type ListSyndicatesResponses, type ListWebhookEndpointsData, type ListWebhookEndpointsError, type ListWebhookEndpointsErrors, type ListWebhookEndpointsResponse, type ListWebhookEndpointsResponses, type ListWebhookSubscriptionsData, type ListWebhookSubscriptionsError, type ListWebhookSubscriptionsErrors, type ListWebhookSubscriptionsResponse, type ListWebhookSubscriptionsResponses, type MarketingPartner, type MarketingPartnerEnvelope, type MemberId, type MemberInvestment, type MemberInvestmentListEnvelope, type Mode, type MyCompany, type MyCompanyListEnvelope, type OAuthHostOptions, type Offering, type OfferingEnvelope, type OfferingEventData, type OfferingListEnvelope, type OfferingSort, type OfferingStatsEnvelope, type OtherSecurity, type Page, type PageFetcher, type PaginationMeta, type ParsedSignatureHeader, type PartnerInvestment, type PartnerInvestmentEnvelope, type PartnerInvestmentId, type PartnerInvestmentListEnvelope, type PartnerInvestor, type PartnerInvestorListEnvelope, type PartnerInvite, type PartnerInviteEnvelope, type PartnerInviteListEnvelope, type PartnerWebhookEvent, type PartnerWebhookEventEnvelope, type PartnerWebhookSubscription, type PartnerWebhookSubscriptionCreateInput, type PartnerWebhookSubscriptionEnvelope, type PartnerWebhookSubscriptionListEnvelope, type PartnerWebhookSubscriptionWithSecret, type PartnerWebhookSubscriptionWithSecretEnvelope, type PastRound, type PerkTier, type PitchBlock, type Pkce, type PortfolioCompanyRef, type PortfolioFilters, type PortfolioHolding, type PortfolioPosition, type PortfolioPositionListEnvelope, type PortfolioPositionsFilters, type PortfolioPositionsQuery, type PortfolioSecurity, type PortfolioStatus, type PortfolioSummary, type PortfolioSummaryEnvelope, type PreviewIntentData, type PreviewIntentError, type PreviewIntentErrors, type PreviewIntentResponse, type PreviewIntentResponses, type PromoteSyndicateMemberData, type PromoteSyndicateMemberError, type PromoteSyndicateMemberErrors, type PromoteSyndicateMemberResponse, type PromoteSyndicateMemberResponses, REQUEST_ID_HEADER, type RawBody, type ReactivateWebhookSubscriptionData, type ReactivateWebhookSubscriptionError, type ReactivateWebhookSubscriptionErrors, type ReactivateWebhookSubscriptionResponse, type ReactivateWebhookSubscriptionResponses, type ReenableWebhookEndpointData, type ReenableWebhookEndpointError, type ReenableWebhookEndpointErrors, type ReenableWebhookEndpointResponse, type ReenableWebhookEndpointResponses, type RefreshOptions, type RegenerateWebhookSecretData, type RegenerateWebhookSecretError, type RegenerateWebhookSecretErrors, type RegenerateWebhookSecretResponse, type RegenerateWebhookSecretResponses, type RegisterAsPartnerData, type RegisterAsPartnerError, type RegisterAsPartnerErrors, type RegisterAsPartnerResponse, type RegisterAsPartnerResponses, type RemoveSyndicateMemberData, type RemoveSyndicateMemberError, type RemoveSyndicateMemberErrors, type ReorderSyndicateMembersData, type ReorderSyndicateMembersError, type ReorderSyndicateMembersErrors, type ReorderSyndicateMembersResponses, type ResendSyndicateInviteData, type ResendSyndicateInviteError, type ResendSyndicateInviteErrors, type ResendSyndicateInviteResponses, type RestoreSyndicateMemberData, type RestoreSyndicateMemberError, type RestoreSyndicateMemberErrors, type RestoreSyndicateMemberResponse, type RestoreSyndicateMemberResponses, type RevenueShareSecurity, type RevokeConnectedAppData, type RevokeConnectedAppError, type RevokeConnectedAppErrors, type RevokeConnectedAppResponse, type RevokeConnectedAppResponses, type RevokeInstallationData, type RevokeInstallationError, type RevokeInstallationErrors, type RevokeInstallationResponse, type RevokeInstallationResponses, type RevokePartnerInviteData, type RevokePartnerInviteError, type RevokePartnerInviteErrors, type RevokePartnerInviteResponse, type RevokePartnerInviteResponses, type RotateWebhookEndpointSecretData, type RotateWebhookEndpointSecretError, type RotateWebhookEndpointSecretErrors, type RotateWebhookEndpointSecretResponse, type RotateWebhookEndpointSecretResponses, SANDBOX_AUTHORIZE_BASE_URL, SIGNATURE_HEADER, type SafeSecurity, type SearchCompaniesData, type SearchCompaniesError, type SearchCompaniesErrors, type SearchCompaniesResponse, type SearchCompaniesResponses, type Security, type SecuritySummary, type SignWebhookOptions, type Spv, type SpvCancelIntentEnvelope, type SpvCloseIntentEnvelope, type SpvCreateInput, type SpvEnvelope, type SpvId, type SpvListEnvelope, type SpvMetrics, type SpvSettings, type SpvStatus, type SpvStatusEnvelope, type SpvTerms, type SpvWithMetaEnvelope, type StartDate, type Syndicate, type SyndicateDeal, type SyndicateDealCloseIntentEnvelope, type SyndicateDealDetailEnvelope, type SyndicateDealEnvelope, type SyndicateDealFinalizeIntentEnvelope, type SyndicateDealListEnvelope, type SyndicateDetailEnvelope, type SyndicateId, type SyndicateInvitationEventData, type SyndicateListEnvelope, type SyndicateMember, type SyndicateMemberEnvelope, type SyndicateMemberEventData, type SyndicateMemberListEnvelope, type SyndicatePortfolioSummaryEnvelope, type SyndicateStatistics, type SyndicateStatisticsEnvelope, type TagRef, type TargetCompanyInput, type TestWebhookEndpointData, type TestWebhookEndpointError, type TestWebhookEndpointErrors, type TestWebhookEndpointResponse, type TestWebhookEndpointResponses, type TestWebhookSubscriptionData, type TestWebhookSubscriptionError, type TestWebhookSubscriptionErrors, type TestWebhookSubscriptionResponse, type TestWebhookSubscriptionResponses, type TokenManagerOptions, type TokenSet, type TokenStore, type UnfollowCompanyData, type UnfollowCompanyError, type UnfollowCompanyErrors, type UnfollowCompanyResponse, type UnfollowCompanyResponses, type UnknownWebhookEvent, type UpdateSyndicateData, type UpdateSyndicateError, type UpdateSyndicateErrors, type UpdateSyndicateMemberData, type UpdateSyndicateMemberError, type UpdateSyndicateMemberErrors, type UpdateSyndicateMemberResponse, type UpdateSyndicateMemberResponses, type UpdateSyndicateResponse, type UpdateSyndicateResponses, type UpdateWebhookEndpointData, type UpdateWebhookEndpointError, type UpdateWebhookEndpointErrors, type UpdateWebhookEndpointInput, type UpdateWebhookEndpointResponse, type UpdateWebhookEndpointResponses, type User, type UserEnvelope, type UtmCampaign, type UtmSource, type ValidationError, type VerifyLegacyWebhookOptions, type VerifyWebhookOptions, type WebhookDelivery, type WebhookEndpoint, type WebhookEndpointEnvelope, type WebhookEndpointList, type WebhookEndpointListEnvelope, type WebhookEndpointRemoved, type WebhookEndpointTestResultEnvelope, type WebhookEvent, type WebhookEventDataMap, type WebhookEventName, type WebhookExternalId, type WebhookHandlers, type WebhookId, type WebhookInvestor, type WebhookInvestorTotals, type WebhookMode, type WebhookPersonRef, WebhookSignatureError, type WebhookSignatureFailure, type WebhookSubscription, type WebhookSubscriptionEnvelope, type WebhookSubscriptionId, type WebhookSubscriptionListEnvelope, type WebhookSubscriptionWithRecentDeliveriesEnvelope, type WebhookSubscriptionWithSecret2Envelope, type WebhookSubscriptionWithSecretEnvelope, type WebhookTestOutcome, type WebhookTestResult, type WebhookTestResultEnvelope, Wefunder, WefunderAuthError, WefunderError, type WefunderOptions, type WefunderRound, type WefunderVersion, checkWebhookSignature, clientCredentialsGrant, collect, computeWebhookSignature, constructEvent, constructEventFromRequest, createAuthorizationUrl, dispatchWebhook, exchangeCode, generatePkce, modeForToken, paginate, parseSignatureHeader, refreshToken, signWebhook, verifyWebhook };
|
|
9697
|
+
export { type AnonymizedAttribution, type ApproveSyndicateMemberData, type ApproveSyndicateMemberError, type ApproveSyndicateMemberErrors, type ApproveSyndicateMemberResponse, type ApproveSyndicateMemberResponses, type AttributedInvestmentListEnvelope, type AttributionCampaignAccess, type AttributionCampaignSummary, type AttributionCampaignSummaryListEnvelope, type AttributionMe, type AttributionMeEnvelope, type AttributionPartner, type AttributionStats, type AttributionStatsEnvelope, type AttributionUser, type AuditEvent, type AuditEventListEnvelope, type AuthorizationUrlOptions, type BulkInviteLinkCreateInput, type BulkInviteLinkEnvelope, type Campaign, type CampaignId, type CampaignListEnvelope, type ClientCredentialsOptions, type ClientOptions, type CloseSyndicateDealData, type CloseSyndicateDealError, type CloseSyndicateDealErrors, type CloseSyndicateDealResponse, type CloseSyndicateDealResponses, type CommentProposalEnvelope, type Company, type CompanyDisclosures, type CompanyDisclosuresEnvelope, type CompanyEnvelope, type CompanyPitch, type CompanyPitchEnvelope, type CompanyQuestion, type CompanyQuestionListEnvelope, type CompanyQuestionPerson, type CompanySearchResult, type CompanySearchResultListEnvelope, type CompanyTotals, type CompanyUpdate, type CompanyUpdateEnvelope, type CompanyUpdateListEnvelope, type ConnectedApp, type ConnectedAppListEnvelope, type ConnectedAppRevocation, type ConnectedAppRevocationEnvelope, type ConstructEventOptions, type ConvertibleNoteSecurity, type CreateInstallationData, type CreateInstallationError, type CreateInstallationErrors, type CreateInstallationResponse, type CreateInstallationResponses, type CreateInstallationTokenData, type CreateInstallationTokenError, type CreateInstallationTokenErrors, type CreateInstallationTokenResponse, type CreateInstallationTokenResponses, type CreateIntentData, type CreateIntentError, type CreateIntentErrors, type CreateIntentResponse, type CreateIntentResponses, type CreatePartnerInviteData, type CreatePartnerInviteError, type CreatePartnerInviteErrors, type CreatePartnerInviteResponse, type CreatePartnerInviteResponses, type CreateWebhookEndpointData, type CreateWebhookEndpointError, type CreateWebhookEndpointErrors, type CreateWebhookEndpointInput, type CreateWebhookEndpointResponse, type CreateWebhookEndpointResponses, type CreateWebhookSubscriptionData, type CreateWebhookSubscriptionError, type CreateWebhookSubscriptionErrors, type CreateWebhookSubscriptionResponse, type CreateWebhookSubscriptionResponses, type CurrentRaise, type Cursor, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_AUTHORIZE_BASE_URL, DEFAULT_OAUTH_BASE_URL, DEFAULT_TOKEN_BASE_URL, DEFAULT_TOLERANCE_SECONDS, type DealInvestor, type DealInvestorListEnvelope, type DebtSecurity, type DeleteWebhookEndpointData, type DeleteWebhookEndpointError, type DeleteWebhookEndpointErrors, type DeleteWebhookEndpointResponse, type DeleteWebhookEndpointResponses, type DeleteWebhookSubscriptionData, type DeleteWebhookSubscriptionError, type DeleteWebhookSubscriptionErrors, type DeleteWebhookSubscriptionResponse, type DeleteWebhookSubscriptionResponses, type DemoteSyndicateMemberData, type DemoteSyndicateMemberError, type DemoteSyndicateMemberErrors, type DemoteSyndicateMemberResponse, type DemoteSyndicateMemberResponses, type DisclosureDocument, type DisclosurePerson, type EligibleTargetListEnvelope, type EndDate, type EquitySecurity, type Error$1 as Error, type ExchangeCodeOptions, type Exemption, type ExportSyndicateMembersCsvData, type ExportSyndicateMembersCsvError, type ExportSyndicateMembersCsvErrors, type ExportSyndicateMembersCsvResponse, type ExportSyndicateMembersCsvResponses, type FinalizeSyndicateDealData, type FinalizeSyndicateDealError, type FinalizeSyndicateDealErrors, type FinalizeSyndicateDealResponse, type FinalizeSyndicateDealResponses, type FiscalYearFinancials, type FollowCompanyData, type FollowCompanyError, type FollowCompanyErrors, type FollowCompanyResponse, type FollowCompanyResponses, type FollowStateEnvelope, type FollowedCompany, type FollowedCompanyListEnvelope, type FullAttribution, type FundSecurity, type FundraiseId, type GetAttributionMeData, type GetAttributionMeError, type GetAttributionMeErrors, type GetAttributionMeResponse, type GetAttributionMeResponses, type GetAttributionStatsData, type GetAttributionStatsError, type GetAttributionStatsErrors, type GetAttributionStatsResponse, type GetAttributionStatsResponses, type GetCompanyData, type GetCompanyDisclosuresData, type GetCompanyDisclosuresError, type GetCompanyDisclosuresErrors, type GetCompanyDisclosuresResponse, type GetCompanyDisclosuresResponses, type GetCompanyError, type GetCompanyErrors, type GetCompanyPitchData, type GetCompanyPitchError, type GetCompanyPitchErrors, type GetCompanyPitchResponse, type GetCompanyPitchResponses, type GetCompanyResponse, type GetCompanyResponses, type GetCompanyUpdateData, type GetCompanyUpdateError, type GetCompanyUpdateErrors, type GetCompanyUpdateResponse, type GetCompanyUpdateResponses, type GetCurrentUserData, type GetCurrentUserError, type GetCurrentUserErrors, type GetCurrentUserResponse, type GetCurrentUserResponses, type GetInstallationData, type GetInstallationError, type GetInstallationErrors, type GetInstallationResponse, type GetInstallationResponses, type GetIntentData, type GetIntentError, type GetIntentErrors, type GetIntentResponse, type GetIntentResponses, type GetInvestmentData, type GetInvestmentError, type GetInvestmentErrors, type GetInvestmentResponse, type GetInvestmentResponses, type GetOfferingData, type GetOfferingError, type GetOfferingErrors, type GetOfferingResponse, type GetOfferingResponses, type GetOfferingStatsData, type GetOfferingStatsError, type GetOfferingStatsErrors, type GetOfferingStatsResponse, type GetOfferingStatsResponses, type GetPortfolioData, type GetPortfolioError, type GetPortfolioErrors, type GetPortfolioResponse, type GetPortfolioResponses, type GetSyndicateData, type GetSyndicateDealData, type GetSyndicateDealError, type GetSyndicateDealErrors, type GetSyndicateDealResponse, type GetSyndicateDealResponses, type GetSyndicateError, type GetSyndicateErrors, type GetSyndicatePortfolioData, type GetSyndicatePortfolioError, type GetSyndicatePortfolioErrors, type GetSyndicatePortfolioResponse, type GetSyndicatePortfolioResponses, type GetSyndicateResponse, type GetSyndicateResponses, type GetSyndicateStatisticsData, type GetSyndicateStatisticsError, type GetSyndicateStatisticsErrors, type GetSyndicateStatisticsResponse, type GetSyndicateStatisticsResponses, type GetWebhookEndpointData, type GetWebhookEndpointError, type GetWebhookEndpointErrors, type GetWebhookEndpointResponse, type GetWebhookEndpointResponses, type GetWebhookSubscriptionData, type GetWebhookSubscriptionError, type GetWebhookSubscriptionErrors, type GetWebhookSubscriptionResponse, type GetWebhookSubscriptionResponses, type HeadersLike, type HideSyndicateMemberData, type HideSyndicateMemberError, type HideSyndicateMemberErrors, type HideSyndicateMemberResponse, type HideSyndicateMemberResponses, type IdempotencyKey, type Installation, type InstallationEnvelope, type InstallationListEnvelope, type InstallationTokenEnvelope, type Intent, type IntentEnvelope, type IntentListEnvelope, type IntentPreviewEnvelope, type IntentReview, type IntentStatus, type Investment, type InvestmentChangeListEnvelope, type InvestmentChangedEventData, type InvestmentDeltaRecord, type InvestmentEnvelope, type InvestmentEventData, type InvestmentListEnvelope, type InvestmentSession, type InvestmentSessionCreateInput, type InvestmentSessionEnvelope, type InvestmentSessionEventData, type InvestmentSessionId, type InvestmentSessionListEnvelope, type InvestmentsFilters, type InvestmentsQuery, type Investor, type InvestorEnvelope, type InvestorListEnvelope, type InviteLink, type InviteLinkCreateInput, type InviteLinkEnvelope, type InviteLinkId, type InviteLinkListEnvelope, type InviteLinkUpdateInput, type InviteSyndicateMemberData, type InviteSyndicateMemberError, type InviteSyndicateMemberErrors, type InviteSyndicateMemberResponse, type InviteSyndicateMemberResponses, LEGACY_DELIVERY_ID_HEADER, LEGACY_EVENT_HEADER, LEGACY_SIGNATURE_HEADER, LEGACY_TIMESTAMP_HEADER, type ListActivityData, type ListActivityError, type ListActivityErrors, type ListActivityResponse, type ListActivityResponses, type ListAttributedInvestmentsData, type ListAttributedInvestmentsError, type ListAttributedInvestmentsErrors, type ListAttributedInvestmentsResponse, type ListAttributedInvestmentsResponses, type ListAttributionCampaignsData, type ListAttributionCampaignsError, type ListAttributionCampaignsErrors, type ListAttributionCampaignsResponse, type ListAttributionCampaignsResponses, type ListCampaignsData, type ListCampaignsError, type ListCampaignsErrors, type ListCampaignsResponse, type ListCampaignsResponses, type ListCompanyInvestmentChangesData, type ListCompanyInvestmentChangesError, type ListCompanyInvestmentChangesErrors, type ListCompanyInvestmentChangesResponse, type ListCompanyInvestmentChangesResponses, type ListCompanyQuestionsData, type ListCompanyQuestionsError, type ListCompanyQuestionsErrors, type ListCompanyQuestionsResponse, type ListCompanyQuestionsResponses, type ListCompanyUpdatesData, type ListCompanyUpdatesError, type ListCompanyUpdatesErrors, type ListCompanyUpdatesResponse, type ListCompanyUpdatesResponses, type ListConnectedAppsData, type ListConnectedAppsError, type ListConnectedAppsErrors, type ListConnectedAppsResponse, type ListConnectedAppsResponses, type ListEligibleInstallTargetsData, type ListEligibleInstallTargetsError, type ListEligibleInstallTargetsErrors, type ListEligibleInstallTargetsResponse, type ListEligibleInstallTargetsResponses, type ListFollowedCompaniesData, type ListFollowedCompaniesError, type ListFollowedCompaniesErrors, type ListFollowedCompaniesResponse, type ListFollowedCompaniesResponses, type ListInstallationsData, type ListInstallationsError, type ListInstallationsErrors, type ListInstallationsResponse, type ListInstallationsResponses, type ListIntentsData, type ListIntentsError, type ListIntentsErrors, type ListIntentsResponse, type ListIntentsResponses, type ListInvestmentsData, type ListInvestmentsError, type ListInvestmentsErrors, type ListInvestmentsResponse, type ListInvestmentsResponses, type ListMyCompaniesData, type ListMyCompaniesError, type ListMyCompaniesErrors, type ListMyCompaniesResponse, type ListMyCompaniesResponses, type ListOfferingsData, type ListOfferingsError, type ListOfferingsErrors, type ListOfferingsResponse, type ListOfferingsResponses, type ListPartnerInvitesData, type ListPartnerInvitesError, type ListPartnerInvitesErrors, type ListPartnerInvitesResponse, type ListPartnerInvitesResponses, type ListPortfolioPositionsData, type ListPortfolioPositionsError, type ListPortfolioPositionsErrors, type ListPortfolioPositionsResponse, type ListPortfolioPositionsResponses, type ListSyndicateDealInvestorsData, type ListSyndicateDealInvestorsError, type ListSyndicateDealInvestorsErrors, type ListSyndicateDealInvestorsResponse, type ListSyndicateDealInvestorsResponses, type ListSyndicateDealsData, type ListSyndicateDealsError, type ListSyndicateDealsErrors, type ListSyndicateDealsResponse, type ListSyndicateDealsResponses, type ListSyndicateMemberInvestmentsData, type ListSyndicateMemberInvestmentsError, type ListSyndicateMemberInvestmentsErrors, type ListSyndicateMemberInvestmentsResponse, type ListSyndicateMemberInvestmentsResponses, type ListSyndicateMembersData, type ListSyndicateMembersError, type ListSyndicateMembersErrors, type ListSyndicateMembersResponse, type ListSyndicateMembersResponses, type ListSyndicatePortfolioPositionsData, type ListSyndicatePortfolioPositionsError, type ListSyndicatePortfolioPositionsErrors, type ListSyndicatePortfolioPositionsResponse, type ListSyndicatePortfolioPositionsResponses, type ListSyndicatesData, type ListSyndicatesError, type ListSyndicatesErrors, type ListSyndicatesResponse, type ListSyndicatesResponses, type ListWebhookEndpointsData, type ListWebhookEndpointsError, type ListWebhookEndpointsErrors, type ListWebhookEndpointsResponse, type ListWebhookEndpointsResponses, type ListWebhookSubscriptionsData, type ListWebhookSubscriptionsError, type ListWebhookSubscriptionsErrors, type ListWebhookSubscriptionsResponse, type ListWebhookSubscriptionsResponses, type MarketingPartner, type MarketingPartnerEnvelope, type MemberId, type MemberInvestment, type MemberInvestmentListEnvelope, type Mode, type MyCompany, type MyCompanyListEnvelope, type OAuthHostOptions, type Offering, type OfferingEnvelope, type OfferingEventData, type OfferingListEnvelope, type OfferingSort, type OfferingStatsEnvelope, type OtherSecurity, type Page, type PageFetcher, type PaginationMeta, type ParsedSignatureHeader, type PartnerInvestment, type PartnerInvestmentEnvelope, type PartnerInvestmentId, type PartnerInvestmentListEnvelope, type PartnerInvestor, type PartnerInvestorListEnvelope, type PartnerInvite, type PartnerInviteEnvelope, type PartnerInviteListEnvelope, type PartnerWebhookEvent, type PartnerWebhookEventEnvelope, type PartnerWebhookSubscription, type PartnerWebhookSubscriptionCreateInput, type PartnerWebhookSubscriptionEnvelope, type PartnerWebhookSubscriptionListEnvelope, type PartnerWebhookSubscriptionWithSecret, type PartnerWebhookSubscriptionWithSecretEnvelope, type PastRound, type PerkTier, type PitchBlock, type Pkce, type PortfolioCompanyRef, type PortfolioFilters, type PortfolioHolding, type PortfolioPosition, type PortfolioPositionListEnvelope, type PortfolioPositionsFilters, type PortfolioPositionsQuery, type PortfolioSecurity, type PortfolioStatus, type PortfolioSummary, type PortfolioSummaryEnvelope, type PreviewIntentData, type PreviewIntentError, type PreviewIntentErrors, type PreviewIntentResponse, type PreviewIntentResponses, type PromoteSyndicateMemberData, type PromoteSyndicateMemberError, type PromoteSyndicateMemberErrors, type PromoteSyndicateMemberResponse, type PromoteSyndicateMemberResponses, REQUEST_ID_HEADER, type RawBody, type ReactivateWebhookSubscriptionData, type ReactivateWebhookSubscriptionError, type ReactivateWebhookSubscriptionErrors, type ReactivateWebhookSubscriptionResponse, type ReactivateWebhookSubscriptionResponses, type ReenableWebhookEndpointData, type ReenableWebhookEndpointError, type ReenableWebhookEndpointErrors, type ReenableWebhookEndpointResponse, type ReenableWebhookEndpointResponses, type RefreshOptions, type RegenerateWebhookSecretData, type RegenerateWebhookSecretError, type RegenerateWebhookSecretErrors, type RegenerateWebhookSecretResponse, type RegenerateWebhookSecretResponses, type RegisterAsPartnerData, type RegisterAsPartnerError, type RegisterAsPartnerErrors, type RegisterAsPartnerResponse, type RegisterAsPartnerResponses, type RemoveSyndicateMemberData, type RemoveSyndicateMemberError, type RemoveSyndicateMemberErrors, type ReorderSyndicateMembersData, type ReorderSyndicateMembersError, type ReorderSyndicateMembersErrors, type ReorderSyndicateMembersResponses, type ResendSyndicateInviteData, type ResendSyndicateInviteError, type ResendSyndicateInviteErrors, type ResendSyndicateInviteResponses, type RestoreSyndicateMemberData, type RestoreSyndicateMemberError, type RestoreSyndicateMemberErrors, type RestoreSyndicateMemberResponse, type RestoreSyndicateMemberResponses, type RevenueShareSecurity, type RevokeConnectedAppData, type RevokeConnectedAppError, type RevokeConnectedAppErrors, type RevokeConnectedAppResponse, type RevokeConnectedAppResponses, type RevokeInstallationData, type RevokeInstallationError, type RevokeInstallationErrors, type RevokeInstallationResponse, type RevokeInstallationResponses, type RevokePartnerInviteData, type RevokePartnerInviteError, type RevokePartnerInviteErrors, type RevokePartnerInviteResponse, type RevokePartnerInviteResponses, type RotateWebhookEndpointSecretData, type RotateWebhookEndpointSecretError, type RotateWebhookEndpointSecretErrors, type RotateWebhookEndpointSecretResponse, type RotateWebhookEndpointSecretResponses, SANDBOX_AUTHORIZE_BASE_URL, SIGNATURE_HEADER, type SafeSecurity, type SearchCompaniesData, type SearchCompaniesError, type SearchCompaniesErrors, type SearchCompaniesResponse, type SearchCompaniesResponses, type Security, type SecuritySummary, type SignWebhookOptions, type Spv, type SpvCancelIntentEnvelope, type SpvCloseIntentEnvelope, type SpvCreateInput, type SpvEnvelope, type SpvId, type SpvListEnvelope, type SpvMetrics, type SpvSettings, type SpvStatus, type SpvStatusEnvelope, type SpvTerms, type SpvWithMetaEnvelope, type StartDate, type Syndicate, type SyndicateDeal, type SyndicateDealCloseIntentEnvelope, type SyndicateDealDetailEnvelope, type SyndicateDealEnvelope, type SyndicateDealFinalizeIntentEnvelope, type SyndicateDealListEnvelope, type SyndicateDetailEnvelope, type SyndicateId, type SyndicateInvitationEventData, type SyndicateListEnvelope, type SyndicateMember, type SyndicateMemberEnvelope, type SyndicateMemberEventData, type SyndicateMemberListEnvelope, type SyndicatePortfolioSummaryEnvelope, type SyndicateStatistics, type SyndicateStatisticsEnvelope, type TagRef, type TargetCompanyInput, type TestWebhookEndpointData, type TestWebhookEndpointError, type TestWebhookEndpointErrors, type TestWebhookEndpointResponse, type TestWebhookEndpointResponses, type TestWebhookSubscriptionData, type TestWebhookSubscriptionError, type TestWebhookSubscriptionErrors, type TestWebhookSubscriptionResponse, type TestWebhookSubscriptionResponses, TokenManager, type TokenManagerOptions, type TokenSet, type TokenStore, type UnfollowCompanyData, type UnfollowCompanyError, type UnfollowCompanyErrors, type UnfollowCompanyResponse, type UnfollowCompanyResponses, type UnknownWebhookEvent, type UpdateSyndicateData, type UpdateSyndicateError, type UpdateSyndicateErrors, type UpdateSyndicateMemberData, type UpdateSyndicateMemberError, type UpdateSyndicateMemberErrors, type UpdateSyndicateMemberResponse, type UpdateSyndicateMemberResponses, type UpdateSyndicateResponse, type UpdateSyndicateResponses, type UpdateWebhookEndpointData, type UpdateWebhookEndpointError, type UpdateWebhookEndpointErrors, type UpdateWebhookEndpointInput, type UpdateWebhookEndpointResponse, type UpdateWebhookEndpointResponses, type User, type UserEnvelope, type UtmCampaign, type UtmSource, type ValidationError, type VerifyLegacyWebhookOptions, type VerifyWebhookOptions, type WebhookDelivery, type WebhookEndpoint, type WebhookEndpointEnvelope, type WebhookEndpointList, type WebhookEndpointListEnvelope, type WebhookEndpointRemoved, type WebhookEndpointTestResultEnvelope, type WebhookEvent, type WebhookEventDataMap, type WebhookEventName, type WebhookExternalId, type WebhookHandlers, type WebhookId, type WebhookInvestor, type WebhookInvestorTotals, type WebhookMode, type WebhookPersonRef, WebhookSignatureError, type WebhookSignatureFailure, type WebhookSubscription, type WebhookSubscriptionEnvelope, type WebhookSubscriptionId, type WebhookSubscriptionListEnvelope, type WebhookSubscriptionWithRecentDeliveriesEnvelope, type WebhookSubscriptionWithSecret2Envelope, type WebhookSubscriptionWithSecretEnvelope, type WebhookTestOutcome, type WebhookTestResult, type WebhookTestResultEnvelope, Wefunder, WefunderAuthError, WefunderError, type WefunderOptions, type WefunderRound, WefunderTokenPersistenceError, type WefunderVersion, checkWebhookSignature, clientCredentialsGrant, collect, computeWebhookSignature, constructEvent, constructEventFromRequest, createAuthorizationUrl, dispatchWebhook, exchangeCode, generatePkce, modeForToken, paginate, parseSignatureHeader, refreshToken, signWebhook, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -1022,6 +1022,20 @@ var WefunderAuthError = class extends WefunderError {
|
|
|
1022
1022
|
};
|
|
1023
1023
|
|
|
1024
1024
|
// src/token-manager.ts
|
|
1025
|
+
var WefunderTokenPersistenceError = class extends Error {
|
|
1026
|
+
tokens;
|
|
1027
|
+
constructor(tokens, cause) {
|
|
1028
|
+
super(
|
|
1029
|
+
`Token store failed to save the rotated token set: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
1030
|
+
{ cause }
|
|
1031
|
+
);
|
|
1032
|
+
this.name = "WefunderTokenPersistenceError";
|
|
1033
|
+
this.tokens = tokens;
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
function sameTokenSet(a, b) {
|
|
1037
|
+
return a.accessToken === b.accessToken && a.refreshToken === b.refreshToken;
|
|
1038
|
+
}
|
|
1025
1039
|
var TokenManager = class {
|
|
1026
1040
|
#tokens;
|
|
1027
1041
|
#clientId;
|
|
@@ -1034,6 +1048,7 @@ var TokenManager = class {
|
|
|
1034
1048
|
#now;
|
|
1035
1049
|
#leeway;
|
|
1036
1050
|
#inflight;
|
|
1051
|
+
#pending;
|
|
1037
1052
|
constructor(opts) {
|
|
1038
1053
|
this.#tokens = opts.tokens;
|
|
1039
1054
|
this.#clientId = opts.clientId;
|
|
@@ -1046,15 +1061,40 @@ var TokenManager = class {
|
|
|
1046
1061
|
this.#now = opts.now ?? Date.now;
|
|
1047
1062
|
this.#leeway = opts.expiryLeewayMs ?? 3e4;
|
|
1048
1063
|
}
|
|
1064
|
+
/** The durable, in-use token set. A rotated set that could not be persisted sits in `pendingTokens`. */
|
|
1049
1065
|
get current() {
|
|
1050
1066
|
return this.#tokens;
|
|
1051
1067
|
}
|
|
1052
1068
|
/** True if the manager can recover an expired token (rotate a refresh token or re-mint). */
|
|
1053
1069
|
get canRefresh() {
|
|
1054
|
-
return Boolean(
|
|
1070
|
+
return Boolean(
|
|
1071
|
+
this.#tokens.refreshToken && this.#clientId || this.#reMint
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
/** A rotated set awaiting a successful `store.save` (see `WefunderTokenPersistenceError`). */
|
|
1075
|
+
get pendingTokens() {
|
|
1076
|
+
return this.#pending;
|
|
1055
1077
|
}
|
|
1056
|
-
/**
|
|
1078
|
+
/**
|
|
1079
|
+
* Tell the manager you persisted `tokens` (the set from a `WefunderTokenPersistenceError`)
|
|
1080
|
+
* yourself. Publishes it only if it is still the pending set — a stale acknowledgment (the
|
|
1081
|
+
* manager has since rotated again) is a no-op and returns false, so an older save can never
|
|
1082
|
+
* publish a newer, unsaved set.
|
|
1083
|
+
*/
|
|
1084
|
+
async markPersisted(tokens) {
|
|
1085
|
+
const pending = this.#pending;
|
|
1086
|
+
if (!pending || !sameTokenSet(pending, tokens)) return false;
|
|
1087
|
+
this.#pending = void 0;
|
|
1088
|
+
this.#tokens = pending;
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Returns a valid access token, refreshing proactively if it's expired/near-expiry. If a
|
|
1093
|
+
* rotated set is pending persistence, the save is retried first — no request uses an
|
|
1094
|
+
* undurable token.
|
|
1095
|
+
*/
|
|
1057
1096
|
async getAccessToken() {
|
|
1097
|
+
if (this.#pending) await this.refresh();
|
|
1058
1098
|
const { expiresAt } = this.#tokens;
|
|
1059
1099
|
if (expiresAt !== void 0 && this.#now() >= expiresAt - this.#leeway && this.canRefresh) {
|
|
1060
1100
|
await this.refresh();
|
|
@@ -1068,6 +1108,14 @@ var TokenManager = class {
|
|
|
1068
1108
|
*/
|
|
1069
1109
|
async refresh() {
|
|
1070
1110
|
if (this.#inflight) return this.#inflight;
|
|
1111
|
+
if (this.#pending) {
|
|
1112
|
+
this.#inflight = this.#publishPending();
|
|
1113
|
+
try {
|
|
1114
|
+
return await this.#inflight;
|
|
1115
|
+
} finally {
|
|
1116
|
+
this.#inflight = void 0;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1071
1119
|
const strategy = this.#recoveryStrategy();
|
|
1072
1120
|
if (!strategy) {
|
|
1073
1121
|
throw new WefunderAuthError(
|
|
@@ -1075,11 +1123,8 @@ var TokenManager = class {
|
|
|
1075
1123
|
);
|
|
1076
1124
|
}
|
|
1077
1125
|
this.#inflight = (async () => {
|
|
1078
|
-
|
|
1079
|
-
this.#
|
|
1080
|
-
await this.#store?.save(next);
|
|
1081
|
-
await this.#onTokenRefresh?.(next);
|
|
1082
|
-
return next;
|
|
1126
|
+
this.#pending = await strategy();
|
|
1127
|
+
return this.#publishPending();
|
|
1083
1128
|
})();
|
|
1084
1129
|
try {
|
|
1085
1130
|
return await this.#inflight;
|
|
@@ -1087,6 +1132,22 @@ var TokenManager = class {
|
|
|
1087
1132
|
this.#inflight = void 0;
|
|
1088
1133
|
}
|
|
1089
1134
|
}
|
|
1135
|
+
// Persist BEFORE publishing: no caller may use the rotated token until it is durable, and a
|
|
1136
|
+
// failed save must not leave the process working in memory but unable to reconnect after a
|
|
1137
|
+
// restart. On failure the set stays pending and WefunderTokenPersistenceError is thrown; the
|
|
1138
|
+
// next call retries the save.
|
|
1139
|
+
async #publishPending() {
|
|
1140
|
+
const tokens = this.#pending;
|
|
1141
|
+
try {
|
|
1142
|
+
await this.#store?.save(tokens);
|
|
1143
|
+
await this.#onTokenRefresh?.(tokens);
|
|
1144
|
+
} catch (err) {
|
|
1145
|
+
throw new WefunderTokenPersistenceError(tokens, err);
|
|
1146
|
+
}
|
|
1147
|
+
this.#pending = void 0;
|
|
1148
|
+
this.#tokens = tokens;
|
|
1149
|
+
return tokens;
|
|
1150
|
+
}
|
|
1090
1151
|
// Pick the recovery strategy: refresh_token rotation, else cc re-mint, else none.
|
|
1091
1152
|
#recoveryStrategy() {
|
|
1092
1153
|
const refreshTokenValue = this.#tokens.refreshToken;
|
|
@@ -1779,12 +1840,22 @@ var Wefunder = class _Wefunder {
|
|
|
1779
1840
|
});
|
|
1780
1841
|
}
|
|
1781
1842
|
/** The live token set (e.g. to persist after construction). */
|
|
1843
|
+
/** A rotated set awaiting a successful save (see `WefunderTokenPersistenceError`). */
|
|
1844
|
+
get pendingTokens() {
|
|
1845
|
+
return this.#tokens.pendingTokens;
|
|
1846
|
+
}
|
|
1847
|
+
/** Acknowledge an out-of-band save of `tokens`; false if that set is no longer pending. */
|
|
1848
|
+
markPersisted(tokens) {
|
|
1849
|
+
return this.#tokens.markPersisted(tokens);
|
|
1850
|
+
}
|
|
1782
1851
|
get tokens() {
|
|
1783
1852
|
return this.#tokens.current;
|
|
1784
1853
|
}
|
|
1785
1854
|
// ---- unwrap: turn the {data,error,response} result into data-or-throw ----
|
|
1786
1855
|
async #unwrap(p) {
|
|
1787
1856
|
const { data, error, response } = await p;
|
|
1857
|
+
if (error instanceof WefunderTokenPersistenceError || error instanceof WefunderError)
|
|
1858
|
+
throw error;
|
|
1788
1859
|
if (response && response.ok && error === void 0) return data;
|
|
1789
1860
|
const status = response?.status ?? 0;
|
|
1790
1861
|
const env = error ?? {};
|
|
@@ -1793,7 +1864,10 @@ var Wefunder = class _Wefunder {
|
|
|
1793
1864
|
type: env.error?.type ?? "api_error",
|
|
1794
1865
|
message: env.error?.message ?? response?.statusText ?? "Request failed",
|
|
1795
1866
|
// X-Wf-Request-Id header is primary (present even on non-JSON edge errors).
|
|
1796
|
-
requestId: requestIdFrom(
|
|
1867
|
+
requestId: requestIdFrom(
|
|
1868
|
+
response,
|
|
1869
|
+
env.error?.request_id ?? env.request_id
|
|
1870
|
+
),
|
|
1797
1871
|
details: env.error?.details,
|
|
1798
1872
|
remediation: env.error?.remediation
|
|
1799
1873
|
});
|
|
@@ -1829,11 +1903,16 @@ var Wefunder = class _Wefunder {
|
|
|
1829
1903
|
me: () => this.#unwrapData(getCurrentUser({ client: this.#client }))
|
|
1830
1904
|
};
|
|
1831
1905
|
offerings = {
|
|
1832
|
-
list: this.#page(
|
|
1906
|
+
list: this.#page(
|
|
1907
|
+
listOfferings
|
|
1908
|
+
),
|
|
1833
1909
|
all: (query) => paginate((cursor) => this.offerings.list({ ...query, cursor })),
|
|
1834
1910
|
collect: (query) => collect((cursor) => this.offerings.list({ ...query, cursor })),
|
|
1835
1911
|
get: (externalId) => this.#unwrapData(
|
|
1836
|
-
getOffering({
|
|
1912
|
+
getOffering({
|
|
1913
|
+
client: this.#client,
|
|
1914
|
+
path: { external_id: externalId }
|
|
1915
|
+
})
|
|
1837
1916
|
)
|
|
1838
1917
|
};
|
|
1839
1918
|
/**
|
|
@@ -1842,20 +1921,40 @@ var Wefunder = class _Wefunder {
|
|
|
1842
1921
|
* from your last page — it is always present — and resume from it next time.
|
|
1843
1922
|
*/
|
|
1844
1923
|
investments = {
|
|
1845
|
-
list: this.#page(
|
|
1846
|
-
|
|
1847
|
-
|
|
1924
|
+
list: this.#page(
|
|
1925
|
+
listInvestments
|
|
1926
|
+
),
|
|
1927
|
+
all: (query) => paginate(
|
|
1928
|
+
(cursor) => this.investments.list({
|
|
1929
|
+
...query,
|
|
1930
|
+
cursor
|
|
1931
|
+
})
|
|
1932
|
+
),
|
|
1933
|
+
collect: (query) => collect(
|
|
1934
|
+
(cursor) => this.investments.list({
|
|
1935
|
+
...query,
|
|
1936
|
+
cursor
|
|
1937
|
+
})
|
|
1938
|
+
),
|
|
1848
1939
|
/** The current record (not the published projection) for one investment (`inv_…`). */
|
|
1849
|
-
get: (id) => this.#unwrapData(
|
|
1940
|
+
get: (id) => this.#unwrapData(
|
|
1941
|
+
getInvestment({ client: this.#client, path: { id } })
|
|
1942
|
+
)
|
|
1850
1943
|
};
|
|
1851
1944
|
portfolio = {
|
|
1852
|
-
get: (query) => this.#unwrapData(
|
|
1945
|
+
get: (query) => this.#unwrapData(
|
|
1946
|
+
getPortfolio({ client: this.#client, query })
|
|
1947
|
+
),
|
|
1853
1948
|
positions: {
|
|
1854
1949
|
list: this.#page(
|
|
1855
1950
|
listPortfolioPositions
|
|
1856
1951
|
),
|
|
1857
|
-
all: (query) => paginate(
|
|
1858
|
-
|
|
1952
|
+
all: (query) => paginate(
|
|
1953
|
+
(cursor) => this.portfolio.positions.list({ ...query, cursor })
|
|
1954
|
+
),
|
|
1955
|
+
collect: (query) => collect(
|
|
1956
|
+
(cursor) => this.portfolio.positions.list({ ...query, cursor })
|
|
1957
|
+
)
|
|
1859
1958
|
}
|
|
1860
1959
|
};
|
|
1861
1960
|
campaigns = {
|
|
@@ -1864,17 +1963,25 @@ var Wefunder = class _Wefunder {
|
|
|
1864
1963
|
collect: () => collect((cursor) => this.campaigns.list({ cursor }))
|
|
1865
1964
|
};
|
|
1866
1965
|
syndicates = {
|
|
1867
|
-
list: this.#page(
|
|
1966
|
+
list: this.#page(
|
|
1967
|
+
listSyndicates
|
|
1968
|
+
),
|
|
1868
1969
|
all: (query) => paginate((cursor) => this.syndicates.list({ ...query, cursor })),
|
|
1869
|
-
get: (id) => this.#unwrapData(
|
|
1970
|
+
get: (id) => this.#unwrapData(
|
|
1971
|
+
getSyndicate({ client: this.#client, path: { id } })
|
|
1972
|
+
)
|
|
1870
1973
|
};
|
|
1871
1974
|
intents = {
|
|
1872
1975
|
list: this.#page(listIntents),
|
|
1873
1976
|
all: (query) => paginate((cursor) => this.intents.list({ ...query, cursor })),
|
|
1874
|
-
get: (id) => this.#unwrapData(
|
|
1977
|
+
get: (id) => this.#unwrapData(
|
|
1978
|
+
getIntent({ client: this.#client, path: { id } })
|
|
1979
|
+
)
|
|
1875
1980
|
};
|
|
1876
1981
|
attribution = {
|
|
1877
|
-
me: () => this.#unwrapData(
|
|
1982
|
+
me: () => this.#unwrapData(
|
|
1983
|
+
getAttributionMe({ client: this.#client })
|
|
1984
|
+
)
|
|
1878
1985
|
};
|
|
1879
1986
|
/**
|
|
1880
1987
|
* Webhook endpoints (`/webhook_endpoints`, scopes `read:webhooks` / `write:webhooks`).
|
|
@@ -1885,30 +1992,50 @@ var Wefunder = class _Wefunder {
|
|
|
1885
1992
|
*/
|
|
1886
1993
|
webhookEndpoints = {
|
|
1887
1994
|
/** All of your app's endpoints (secret omitted). `meta.quota` is the per-app limit. */
|
|
1888
|
-
list: () => this.#unwrap(
|
|
1995
|
+
list: () => this.#unwrap(
|
|
1996
|
+
listWebhookEndpoints({ client: this.#client })
|
|
1997
|
+
),
|
|
1889
1998
|
get: (id) => this.#unwrapData(
|
|
1890
|
-
getWebhookEndpoint({
|
|
1999
|
+
getWebhookEndpoint({
|
|
2000
|
+
client: this.#client,
|
|
2001
|
+
path: { external_id: id }
|
|
2002
|
+
})
|
|
1891
2003
|
),
|
|
1892
2004
|
/** Store `attributes.secret` from the result — it is never shown again. */
|
|
1893
|
-
create: (input) => this.#unwrapData(
|
|
2005
|
+
create: (input) => this.#unwrapData(
|
|
2006
|
+
createWebhookEndpoint({ client: this.#client, body: input })
|
|
2007
|
+
),
|
|
1894
2008
|
/** `events` replaces the subscription list wholesale (no merge); omit to leave unchanged. */
|
|
1895
2009
|
update: (id, input) => this.#unwrapData(
|
|
1896
|
-
updateWebhookEndpoint({
|
|
2010
|
+
updateWebhookEndpoint({
|
|
2011
|
+
client: this.#client,
|
|
2012
|
+
path: { external_id: id },
|
|
2013
|
+
body: input
|
|
2014
|
+
})
|
|
1897
2015
|
),
|
|
1898
2016
|
/** Stops deliveries immediately. Removal is permanent — create a new endpoint to resume. */
|
|
1899
2017
|
remove: (id) => this.#unwrapData(
|
|
1900
|
-
deleteWebhookEndpoint({
|
|
2018
|
+
deleteWebhookEndpoint({
|
|
2019
|
+
client: this.#client,
|
|
2020
|
+
path: { external_id: id }
|
|
2021
|
+
})
|
|
1901
2022
|
),
|
|
1902
2023
|
/**
|
|
1903
2024
|
* New secret (shown once). The old one keeps signing for a 24h overlap — deliveries
|
|
1904
2025
|
* carry a `v1` for both, and `constructEvent` accepts either.
|
|
1905
2026
|
*/
|
|
1906
2027
|
rotateSecret: (id) => this.#unwrapData(
|
|
1907
|
-
rotateWebhookEndpointSecret({
|
|
2028
|
+
rotateWebhookEndpointSecret({
|
|
2029
|
+
client: this.#client,
|
|
2030
|
+
path: { external_id: id }
|
|
2031
|
+
})
|
|
1908
2032
|
),
|
|
1909
2033
|
/** Recover an auto-disabled endpoint after fixing your server. Idempotent. */
|
|
1910
2034
|
reenable: (id) => this.#unwrapData(
|
|
1911
|
-
reenableWebhookEndpoint({
|
|
2035
|
+
reenableWebhookEndpoint({
|
|
2036
|
+
client: this.#client,
|
|
2037
|
+
path: { external_id: id }
|
|
2038
|
+
})
|
|
1912
2039
|
),
|
|
1913
2040
|
/**
|
|
1914
2041
|
* POST a real, signed example event at the endpoint (production envelope + signature)
|
|
@@ -2103,10 +2230,12 @@ export {
|
|
|
2103
2230
|
REQUEST_ID_HEADER,
|
|
2104
2231
|
SANDBOX_AUTHORIZE_BASE_URL,
|
|
2105
2232
|
SIGNATURE_HEADER,
|
|
2233
|
+
TokenManager,
|
|
2106
2234
|
WebhookSignatureError,
|
|
2107
2235
|
Wefunder,
|
|
2108
2236
|
WefunderAuthError,
|
|
2109
2237
|
WefunderError,
|
|
2238
|
+
WefunderTokenPersistenceError,
|
|
2110
2239
|
checkWebhookSignature,
|
|
2111
2240
|
clientCredentialsGrant,
|
|
2112
2241
|
collect,
|