@securelend/sdk 0.1.0-beta.5 → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/index.d.mts +142 -4
- package/dist/index.d.ts +142 -4
- package/dist/index.js +1096 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1066 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1424 -205
- package/dist/types/index.d.ts +1424 -205
- package/dist/types/index.js +214 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +192 -1
- package/dist/types/index.mjs.map +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -43,6 +43,24 @@ const cards = await securelend.creditCards.compare({
|
|
|
43
43
|
});
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## Place to underwrite
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { SecureLend } from "@securelend/sdk";
|
|
50
|
+
|
|
51
|
+
const securelend = new SecureLend({ apiKey: process.env.SECURELEND_API_KEY });
|
|
52
|
+
|
|
53
|
+
const lead = await securelend.leads.create({
|
|
54
|
+
confirmed: true,
|
|
55
|
+
legalName: "Northwind LLC",
|
|
56
|
+
amount: 25000,
|
|
57
|
+
});
|
|
58
|
+
const ranked = await securelend.matches.list(lead.id);
|
|
59
|
+
const box = await securelend.creditBox.get();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The default comparison host stays `https://mcp.securelend.ai/mcp`. These methods call `https://securelend.ai`. Pass `apiBaseUrl` for a local API. A 404 from a flag-gated route throws `FeatureDisabledError`.
|
|
63
|
+
|
|
46
64
|
## Documentation
|
|
47
65
|
|
|
48
66
|
- [Full Documentation](https://docs.securelend.ai)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
|
-
import { SecureLendConfig, PersonalLoanSearchParams, LoanComparisonResponse, BusinessLoanSearchParams, MortgageSearchParams, AutoLoanSearchParams, StudentLoanSearchParams, BusinessBankingSearchSchema, BusinessBankingComparisonResponse, PersonalBankingSearchSchema, PersonalBankingComparisonResponse, SavingsSearchSchema, SavingsAccountComparisonResponse, BusinessCreditCardSearchParams, BusinessCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalCreditCardComparisonResponse, LoanPaymentParams, LoanCalculationResponse, MortgagePaymentParams, MortgageCalculationResponse, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, GetOfferParams, PersonalApplication, GetMultipleOffersParams, DisplayOfferFormParams, DisplayOfferFormResponse, TrackOfferStatusParams, TrackOfferStatusResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, SubmitDocumentsParams, SubmitDocumentsResponse } from './types/index.mjs';
|
|
3
|
-
export { Application, ApplicationProvider, ApplicationStatus, ApplicationType, AutoLenderAdapter, BankAccountOffer, BasisPoints, BusinessApplicant, BusinessApplication, BusinessBankingAdapter, BusinessBankingOffer, BusinessCreditCardAdapter, BusinessCreditCardOffer, BusinessLenderAdapter, CreateBusinessApplicationDTO, CreatePersonalApplicationDTO, CreditCardOffer, CreditTier, DateString, DocumentType, GenericApplication, Lender, LenderSearchCriteria, LoanOffer, Money, MortgageLenderAdapter, Percentage, PersonalApplicant, PersonalBankingAdapter, PersonalBankingOffer, PersonalCreditCardAdapter, PersonalCreditCardOffer, PersonalLenderAdapter, ProductType, ProviderStatus, SavingsAdapter, SavingsOffer, StudentLenderAdapter, anyOfferSchema, applicationProviderSchema, autoLoanSearchSchema, bankAccountOfferSchema, businessApplicantSchema, businessBankingComparisonResponseSchema, businessBankingOfferSchema, businessBankingSearchSchema, businessCreditCardComparisonResponseSchema, businessCreditCardOfferSchema, businessCreditCardSearchSchema, businessLoanSearchSchema, createBusinessApplicationSchema, createPersonalApplicationSchema, creditCardOfferSchema, displayOfferFormResponseSchema, displayOfferFormSchema, displayUploadDocumentsFormResponseSchema, displayUploadDocumentsFormSchema, documentTypeEnum, getMultipleOffersSchema, getOfferSchema, leaseVsPurchaseResponseSchema, leaseVsPurchaseSchema, loanComparisonResponseSchema, loanOfferSchema, loanPaymentResponseSchema, loanPaymentSchema, mortgagePaymentResponseSchema, mortgagePaymentSchema, mortgageSearchSchema, personalApplicantSchema, personalApplicationSchema, personalBankingComparisonResponseSchema, personalBankingOfferSchema, personalBankingSearchSchema, personalCreditCardComparisonResponseSchema, personalCreditCardOfferSchema, personalCreditCardSearchSchema, personalLoanSearchSchema, savingsComparisonResponseSchema, savingsOfferSchema, savingsSearchSchema, studentLoanSearchSchema, submitDocumentsResponseSchema, submitDocumentsSchema, trackOfferStatusResponseSchema, trackOfferStatusSchema } from './types/index.mjs';
|
|
4
|
-
import 'zod';
|
|
2
|
+
import { LeadCreateInput, RequestOptions, Lead, LeadListFilter, UploadFile, UploadResult, MatchList, PackageStartInput, PackageRecord, ConsentCreateInput, ShareConsent, ShareReceipt, OutcomeRecordInput, LeadOutcome, CreditBoxView, CreditBoxWriteInput, CreditBox, FeedbackSubmitInput, FeedbackCreated, FeedbackEvent, LiquidityQuery, LiquidityMetrics, SecureLendEvent, SecureLendConfig, PersonalLoanSearchParams, LoanComparisonResponse, BusinessLoanSearchParams, MortgageSearchParams, AutoLoanSearchParams, StudentLoanSearchParams, BusinessBankingSearchSchema, BusinessBankingComparisonResponse, PersonalBankingSearchSchema, PersonalBankingComparisonResponse, SavingsSearchSchema, SavingsAccountComparisonResponse, BusinessCreditCardSearchParams, BusinessCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalCreditCardComparisonResponse, LoanPaymentParams, LoanCalculationResponse, MortgagePaymentParams, MortgageCalculationResponse, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, GetOfferParams, PersonalApplication, GetMultipleOffersParams, DisplayOfferFormParams, DisplayOfferFormResponse, TrackOfferStatusParams, TrackOfferStatusResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, SubmitDocumentsParams, SubmitDocumentsResponse } from './types/index.mjs';
|
|
3
|
+
export { Application, ApplicationProvider, ApplicationStatus, ApplicationType, AutoLenderAdapter, BankAccountOffer, BasisPoints, BusinessApplicant, BusinessApplication, BusinessBankingAdapter, BusinessBankingOffer, BusinessCreditCardAdapter, BusinessCreditCardOffer, BusinessLenderAdapter, CreateBusinessApplicationDTO, CreatePersonalApplicationDTO, CreditCardOffer, CreditTier, DECLINE_REASON_CODES, DateString, DocumentType, EVENT_TYPES, FEEDBACK_TARGETS, FEEDBACK_TYPES, GenericApplication, Lender, LenderMatch, LenderSearchCriteria, LiquidityCell, LoanOffer, MatchComponents, Money, MortgageLenderAdapter, OUTCOME_STATES, Percentage, PersonalApplicant, PersonalBankingAdapter, PersonalBankingOffer, PersonalCreditCardAdapter, PersonalCreditCardOffer, PersonalLenderAdapter, ProductType, ProviderStatus, SHARE_SCOPES, SavingsAdapter, SavingsOffer, StudentLenderAdapter, anyOfferSchema, applicationProviderSchema, autoLoanSearchSchema, bankAccountOfferSchema, businessApplicantSchema, businessBankingComparisonResponseSchema, businessBankingOfferSchema, businessBankingSearchSchema, businessCreditCardComparisonResponseSchema, businessCreditCardOfferSchema, businessCreditCardSearchSchema, businessLoanSearchSchema, createBusinessApplicationSchema, createPersonalApplicationSchema, creditBoxSchema, creditBoxViewSchema, creditCardOfferSchema, displayOfferFormResponseSchema, displayOfferFormSchema, displayUploadDocumentsFormResponseSchema, displayUploadDocumentsFormSchema, documentTypeEnum, feedbackCreatedSchema, feedbackEventSchema, getMultipleOffersSchema, getOfferSchema, leadListSchema, leadOutcomeSchema, leadSchema, leaseVsPurchaseResponseSchema, leaseVsPurchaseSchema, lenderMatchSchema, liquidityCellSchema, liquidityReportSchema, loanComparisonResponseSchema, loanOfferSchema, loanPaymentResponseSchema, loanPaymentSchema, matchComponentsSchema, matchListSchema, mortgagePaymentResponseSchema, mortgagePaymentSchema, mortgageSearchSchema, packageSchema, personalApplicantSchema, personalApplicationSchema, personalBankingComparisonResponseSchema, personalBankingOfferSchema, personalBankingSearchSchema, personalCreditCardComparisonResponseSchema, personalCreditCardOfferSchema, personalCreditCardSearchSchema, personalLoanSearchSchema, savingsComparisonResponseSchema, savingsOfferSchema, savingsSearchSchema, secureLendEventSchema, shareConsentSchema, shareReceiptSchema, studentLoanSearchSchema, submitDocumentsResponseSchema, submitDocumentsSchema, trackOfferStatusResponseSchema, trackOfferStatusSchema, uploadResultSchema } from './types/index.mjs';
|
|
4
|
+
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
interface MCPClientConfig {
|
|
7
7
|
apiKey: string;
|
|
@@ -20,9 +20,135 @@ declare class MCPClient {
|
|
|
20
20
|
disableDebug(): void;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
interface FetchLike {
|
|
24
|
+
(input: string, init?: RequestInit): Promise<Response>;
|
|
25
|
+
}
|
|
26
|
+
interface RestClientOptions {
|
|
27
|
+
baseUrl: string;
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
fetchImpl?: FetchLike;
|
|
30
|
+
maxRetries?: number;
|
|
31
|
+
retryDelayMs?: number;
|
|
32
|
+
}
|
|
33
|
+
interface RestRequest<T> {
|
|
34
|
+
method: string;
|
|
35
|
+
path: string;
|
|
36
|
+
query?: Record<string, string | number | undefined>;
|
|
37
|
+
body?: unknown;
|
|
38
|
+
form?: FormData;
|
|
39
|
+
schema: z.ZodType<T>;
|
|
40
|
+
featureGated?: boolean;
|
|
41
|
+
idempotencyKey?: string;
|
|
42
|
+
}
|
|
43
|
+
declare class RestClient {
|
|
44
|
+
private apiKey;
|
|
45
|
+
private readonly baseUrl;
|
|
46
|
+
private readonly fetchImpl;
|
|
47
|
+
private readonly maxRetries;
|
|
48
|
+
private readonly retryDelayMs;
|
|
49
|
+
constructor(options: RestClientOptions);
|
|
50
|
+
setApiKey(apiKey: string): void;
|
|
51
|
+
send<T>(request: RestRequest<T>): Promise<T>;
|
|
52
|
+
private fetcher;
|
|
53
|
+
private url;
|
|
54
|
+
private init;
|
|
55
|
+
private read;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare class Leads {
|
|
59
|
+
private readonly rest;
|
|
60
|
+
constructor(rest: RestClient);
|
|
61
|
+
create(input: LeadCreateInput, options?: RequestOptions): Promise<Lead>;
|
|
62
|
+
list(filter?: LeadListFilter): Promise<Lead[]>;
|
|
63
|
+
get(id: string): Promise<Lead>;
|
|
64
|
+
uploadDocuments(enquiryId: string, files: UploadFile[], options?: RequestOptions): Promise<UploadResult[]>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare class Matches {
|
|
68
|
+
private readonly rest;
|
|
69
|
+
constructor(rest: RestClient);
|
|
70
|
+
list(leadId: string): Promise<MatchList>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class Packages {
|
|
74
|
+
private readonly rest;
|
|
75
|
+
constructor(rest: RestClient);
|
|
76
|
+
start(input: PackageStartInput): Promise<PackageRecord>;
|
|
77
|
+
read(id: string, options?: {
|
|
78
|
+
version?: number;
|
|
79
|
+
}): Promise<PackageRecord>;
|
|
80
|
+
private call;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class Consents {
|
|
84
|
+
private readonly rest;
|
|
85
|
+
constructor(rest: RestClient);
|
|
86
|
+
create(input: ConsentCreateInput, options?: RequestOptions): Promise<ShareConsent[]>;
|
|
87
|
+
list(leadId?: string): Promise<ShareConsent[]>;
|
|
88
|
+
revoke(id: string, options?: RequestOptions): Promise<ShareConsent>;
|
|
89
|
+
receipts(id?: string): Promise<ShareReceipt[]>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare class Outcomes {
|
|
93
|
+
private readonly rest;
|
|
94
|
+
constructor(rest: RestClient);
|
|
95
|
+
record(leadId: string, input: OutcomeRecordInput, options?: RequestOptions): Promise<LeadOutcome>;
|
|
96
|
+
list(leadId: string): Promise<LeadOutcome[]>;
|
|
97
|
+
signPayload(rawBody: string, secret: string): string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare class CreditBoxClient {
|
|
101
|
+
private readonly rest;
|
|
102
|
+
constructor(rest: RestClient);
|
|
103
|
+
get(): Promise<CreditBoxView>;
|
|
104
|
+
put(input: CreditBoxWriteInput | Record<string, unknown>, options?: RequestOptions): Promise<CreditBox>;
|
|
105
|
+
pause(input?: {
|
|
106
|
+
until?: string;
|
|
107
|
+
}, options?: RequestOptions): Promise<CreditBox>;
|
|
108
|
+
resume(options?: RequestOptions): Promise<CreditBox>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class Feedback {
|
|
112
|
+
private readonly rest;
|
|
113
|
+
constructor(rest: RestClient);
|
|
114
|
+
submit(event: FeedbackSubmitInput, options?: RequestOptions): Promise<FeedbackCreated>;
|
|
115
|
+
listForCase(caseId: string): Promise<FeedbackEvent[]>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare class Liquidity {
|
|
119
|
+
private readonly rest;
|
|
120
|
+
constructor(rest: RestClient);
|
|
121
|
+
get(query?: LiquidityQuery): Promise<LiquidityMetrics>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface VerifyWebhookOptions {
|
|
125
|
+
toleranceSec?: number;
|
|
126
|
+
nowMs?: number;
|
|
127
|
+
}
|
|
128
|
+
declare function signOutcomePayload(raw: string | Buffer, secret: string): string;
|
|
129
|
+
declare function signWebhook(raw: string | Buffer, secret: string, timestampSec?: number): string;
|
|
130
|
+
declare function verifyWebhook(rawBody: string | Buffer, signatureHeader: string | null | undefined, secret: string, options?: VerifyWebhookOptions): true;
|
|
131
|
+
declare function parseEvent(input: unknown): SecureLendEvent & {
|
|
132
|
+
data: Record<string, unknown>;
|
|
133
|
+
};
|
|
134
|
+
|
|
23
135
|
declare class SecureLend {
|
|
24
136
|
private mcpClient;
|
|
137
|
+
private rest;
|
|
25
138
|
readonly mcp: MCPClient["mcp"];
|
|
139
|
+
readonly leads: Leads;
|
|
140
|
+
readonly matches: Matches;
|
|
141
|
+
readonly packages: Packages;
|
|
142
|
+
readonly consents: Consents;
|
|
143
|
+
readonly outcomes: Outcomes;
|
|
144
|
+
readonly creditBox: CreditBoxClient;
|
|
145
|
+
readonly feedback: Feedback;
|
|
146
|
+
readonly liquidity: Liquidity;
|
|
147
|
+
readonly webhooks: {
|
|
148
|
+
verify: typeof verifyWebhook;
|
|
149
|
+
parseEvent: typeof parseEvent;
|
|
150
|
+
sign: typeof signWebhook;
|
|
151
|
+
};
|
|
26
152
|
constructor(config?: SecureLendConfig);
|
|
27
153
|
comparePersonalLoans(request: PersonalLoanSearchParams): Promise<LoanComparisonResponse>;
|
|
28
154
|
compareBusinessLoans(request: BusinessLoanSearchParams): Promise<LoanComparisonResponse>;
|
|
@@ -77,5 +203,17 @@ declare class NetworkError extends SecureLendError {
|
|
|
77
203
|
declare class ServerError extends SecureLendError {
|
|
78
204
|
constructor(message: string);
|
|
79
205
|
}
|
|
206
|
+
declare class FeatureDisabledError extends SecureLendError {
|
|
207
|
+
constructor(message?: string, details?: unknown);
|
|
208
|
+
}
|
|
209
|
+
declare class ConsentRequiredError extends SecureLendError {
|
|
210
|
+
constructor(message?: string, details?: unknown);
|
|
211
|
+
}
|
|
212
|
+
declare class InvalidTransitionError extends SecureLendError {
|
|
213
|
+
constructor(message?: string, details?: unknown);
|
|
214
|
+
}
|
|
215
|
+
declare class WebhookSignatureError extends SecureLendError {
|
|
216
|
+
constructor(message?: string, details?: unknown);
|
|
217
|
+
}
|
|
80
218
|
|
|
81
|
-
export { AuthenticationError, AutoLoanSearchParams, BusinessBankingComparisonResponse, BusinessBankingSearchSchema, BusinessCreditCardComparisonResponse, BusinessCreditCardSearchParams, BusinessLoanSearchParams, DisplayOfferFormParams, DisplayOfferFormResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, GetMultipleOffersParams, GetOfferParams, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, LoanCalculationResponse, LoanComparisonResponse, LoanPaymentParams, MortgageCalculationResponse, MortgagePaymentParams, MortgageSearchParams, NetworkError, NotFoundError, PersonalApplication, PersonalBankingComparisonResponse, PersonalBankingSearchSchema, PersonalCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalLoanSearchParams, RateLimitError, SavingsAccountComparisonResponse, SavingsSearchSchema, SecureLend, SecureLendConfig, SecureLendError, ServerError, StudentLoanSearchParams, SubmitDocumentsParams, SubmitDocumentsResponse, TrackOfferStatusParams, TrackOfferStatusResponse, ValidationError };
|
|
219
|
+
export { AuthenticationError, AutoLoanSearchParams, BusinessBankingComparisonResponse, BusinessBankingSearchSchema, BusinessCreditCardComparisonResponse, BusinessCreditCardSearchParams, BusinessLoanSearchParams, ConsentCreateInput, ConsentRequiredError, CreditBox, CreditBoxView, CreditBoxWriteInput, DisplayOfferFormParams, DisplayOfferFormResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, FeatureDisabledError, FeedbackCreated, FeedbackEvent, FeedbackSubmitInput, GetMultipleOffersParams, GetOfferParams, InvalidTransitionError, Lead, LeadCreateInput, LeadListFilter, LeadOutcome, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, LiquidityMetrics, LiquidityQuery, LoanCalculationResponse, LoanComparisonResponse, LoanPaymentParams, MatchList, MortgageCalculationResponse, MortgagePaymentParams, MortgageSearchParams, NetworkError, NotFoundError, OutcomeRecordInput, PackageRecord, PackageStartInput, PersonalApplication, PersonalBankingComparisonResponse, PersonalBankingSearchSchema, PersonalCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalLoanSearchParams, RateLimitError, RequestOptions, SavingsAccountComparisonResponse, SavingsSearchSchema, SecureLend, SecureLendConfig, SecureLendError, SecureLendEvent, ServerError, ShareConsent, ShareReceipt, StudentLoanSearchParams, SubmitDocumentsParams, SubmitDocumentsResponse, TrackOfferStatusParams, TrackOfferStatusResponse, UploadFile, UploadResult, ValidationError, WebhookSignatureError, parseEvent, signOutcomePayload, signWebhook, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
|
-
import { SecureLendConfig, PersonalLoanSearchParams, LoanComparisonResponse, BusinessLoanSearchParams, MortgageSearchParams, AutoLoanSearchParams, StudentLoanSearchParams, BusinessBankingSearchSchema, BusinessBankingComparisonResponse, PersonalBankingSearchSchema, PersonalBankingComparisonResponse, SavingsSearchSchema, SavingsAccountComparisonResponse, BusinessCreditCardSearchParams, BusinessCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalCreditCardComparisonResponse, LoanPaymentParams, LoanCalculationResponse, MortgagePaymentParams, MortgageCalculationResponse, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, GetOfferParams, PersonalApplication, GetMultipleOffersParams, DisplayOfferFormParams, DisplayOfferFormResponse, TrackOfferStatusParams, TrackOfferStatusResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, SubmitDocumentsParams, SubmitDocumentsResponse } from './types/index.js';
|
|
3
|
-
export { Application, ApplicationProvider, ApplicationStatus, ApplicationType, AutoLenderAdapter, BankAccountOffer, BasisPoints, BusinessApplicant, BusinessApplication, BusinessBankingAdapter, BusinessBankingOffer, BusinessCreditCardAdapter, BusinessCreditCardOffer, BusinessLenderAdapter, CreateBusinessApplicationDTO, CreatePersonalApplicationDTO, CreditCardOffer, CreditTier, DateString, DocumentType, GenericApplication, Lender, LenderSearchCriteria, LoanOffer, Money, MortgageLenderAdapter, Percentage, PersonalApplicant, PersonalBankingAdapter, PersonalBankingOffer, PersonalCreditCardAdapter, PersonalCreditCardOffer, PersonalLenderAdapter, ProductType, ProviderStatus, SavingsAdapter, SavingsOffer, StudentLenderAdapter, anyOfferSchema, applicationProviderSchema, autoLoanSearchSchema, bankAccountOfferSchema, businessApplicantSchema, businessBankingComparisonResponseSchema, businessBankingOfferSchema, businessBankingSearchSchema, businessCreditCardComparisonResponseSchema, businessCreditCardOfferSchema, businessCreditCardSearchSchema, businessLoanSearchSchema, createBusinessApplicationSchema, createPersonalApplicationSchema, creditCardOfferSchema, displayOfferFormResponseSchema, displayOfferFormSchema, displayUploadDocumentsFormResponseSchema, displayUploadDocumentsFormSchema, documentTypeEnum, getMultipleOffersSchema, getOfferSchema, leaseVsPurchaseResponseSchema, leaseVsPurchaseSchema, loanComparisonResponseSchema, loanOfferSchema, loanPaymentResponseSchema, loanPaymentSchema, mortgagePaymentResponseSchema, mortgagePaymentSchema, mortgageSearchSchema, personalApplicantSchema, personalApplicationSchema, personalBankingComparisonResponseSchema, personalBankingOfferSchema, personalBankingSearchSchema, personalCreditCardComparisonResponseSchema, personalCreditCardOfferSchema, personalCreditCardSearchSchema, personalLoanSearchSchema, savingsComparisonResponseSchema, savingsOfferSchema, savingsSearchSchema, studentLoanSearchSchema, submitDocumentsResponseSchema, submitDocumentsSchema, trackOfferStatusResponseSchema, trackOfferStatusSchema } from './types/index.js';
|
|
4
|
-
import 'zod';
|
|
2
|
+
import { LeadCreateInput, RequestOptions, Lead, LeadListFilter, UploadFile, UploadResult, MatchList, PackageStartInput, PackageRecord, ConsentCreateInput, ShareConsent, ShareReceipt, OutcomeRecordInput, LeadOutcome, CreditBoxView, CreditBoxWriteInput, CreditBox, FeedbackSubmitInput, FeedbackCreated, FeedbackEvent, LiquidityQuery, LiquidityMetrics, SecureLendEvent, SecureLendConfig, PersonalLoanSearchParams, LoanComparisonResponse, BusinessLoanSearchParams, MortgageSearchParams, AutoLoanSearchParams, StudentLoanSearchParams, BusinessBankingSearchSchema, BusinessBankingComparisonResponse, PersonalBankingSearchSchema, PersonalBankingComparisonResponse, SavingsSearchSchema, SavingsAccountComparisonResponse, BusinessCreditCardSearchParams, BusinessCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalCreditCardComparisonResponse, LoanPaymentParams, LoanCalculationResponse, MortgagePaymentParams, MortgageCalculationResponse, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, GetOfferParams, PersonalApplication, GetMultipleOffersParams, DisplayOfferFormParams, DisplayOfferFormResponse, TrackOfferStatusParams, TrackOfferStatusResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, SubmitDocumentsParams, SubmitDocumentsResponse } from './types/index.js';
|
|
3
|
+
export { Application, ApplicationProvider, ApplicationStatus, ApplicationType, AutoLenderAdapter, BankAccountOffer, BasisPoints, BusinessApplicant, BusinessApplication, BusinessBankingAdapter, BusinessBankingOffer, BusinessCreditCardAdapter, BusinessCreditCardOffer, BusinessLenderAdapter, CreateBusinessApplicationDTO, CreatePersonalApplicationDTO, CreditCardOffer, CreditTier, DECLINE_REASON_CODES, DateString, DocumentType, EVENT_TYPES, FEEDBACK_TARGETS, FEEDBACK_TYPES, GenericApplication, Lender, LenderMatch, LenderSearchCriteria, LiquidityCell, LoanOffer, MatchComponents, Money, MortgageLenderAdapter, OUTCOME_STATES, Percentage, PersonalApplicant, PersonalBankingAdapter, PersonalBankingOffer, PersonalCreditCardAdapter, PersonalCreditCardOffer, PersonalLenderAdapter, ProductType, ProviderStatus, SHARE_SCOPES, SavingsAdapter, SavingsOffer, StudentLenderAdapter, anyOfferSchema, applicationProviderSchema, autoLoanSearchSchema, bankAccountOfferSchema, businessApplicantSchema, businessBankingComparisonResponseSchema, businessBankingOfferSchema, businessBankingSearchSchema, businessCreditCardComparisonResponseSchema, businessCreditCardOfferSchema, businessCreditCardSearchSchema, businessLoanSearchSchema, createBusinessApplicationSchema, createPersonalApplicationSchema, creditBoxSchema, creditBoxViewSchema, creditCardOfferSchema, displayOfferFormResponseSchema, displayOfferFormSchema, displayUploadDocumentsFormResponseSchema, displayUploadDocumentsFormSchema, documentTypeEnum, feedbackCreatedSchema, feedbackEventSchema, getMultipleOffersSchema, getOfferSchema, leadListSchema, leadOutcomeSchema, leadSchema, leaseVsPurchaseResponseSchema, leaseVsPurchaseSchema, lenderMatchSchema, liquidityCellSchema, liquidityReportSchema, loanComparisonResponseSchema, loanOfferSchema, loanPaymentResponseSchema, loanPaymentSchema, matchComponentsSchema, matchListSchema, mortgagePaymentResponseSchema, mortgagePaymentSchema, mortgageSearchSchema, packageSchema, personalApplicantSchema, personalApplicationSchema, personalBankingComparisonResponseSchema, personalBankingOfferSchema, personalBankingSearchSchema, personalCreditCardComparisonResponseSchema, personalCreditCardOfferSchema, personalCreditCardSearchSchema, personalLoanSearchSchema, savingsComparisonResponseSchema, savingsOfferSchema, savingsSearchSchema, secureLendEventSchema, shareConsentSchema, shareReceiptSchema, studentLoanSearchSchema, submitDocumentsResponseSchema, submitDocumentsSchema, trackOfferStatusResponseSchema, trackOfferStatusSchema, uploadResultSchema } from './types/index.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
interface MCPClientConfig {
|
|
7
7
|
apiKey: string;
|
|
@@ -20,9 +20,135 @@ declare class MCPClient {
|
|
|
20
20
|
disableDebug(): void;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
interface FetchLike {
|
|
24
|
+
(input: string, init?: RequestInit): Promise<Response>;
|
|
25
|
+
}
|
|
26
|
+
interface RestClientOptions {
|
|
27
|
+
baseUrl: string;
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
fetchImpl?: FetchLike;
|
|
30
|
+
maxRetries?: number;
|
|
31
|
+
retryDelayMs?: number;
|
|
32
|
+
}
|
|
33
|
+
interface RestRequest<T> {
|
|
34
|
+
method: string;
|
|
35
|
+
path: string;
|
|
36
|
+
query?: Record<string, string | number | undefined>;
|
|
37
|
+
body?: unknown;
|
|
38
|
+
form?: FormData;
|
|
39
|
+
schema: z.ZodType<T>;
|
|
40
|
+
featureGated?: boolean;
|
|
41
|
+
idempotencyKey?: string;
|
|
42
|
+
}
|
|
43
|
+
declare class RestClient {
|
|
44
|
+
private apiKey;
|
|
45
|
+
private readonly baseUrl;
|
|
46
|
+
private readonly fetchImpl;
|
|
47
|
+
private readonly maxRetries;
|
|
48
|
+
private readonly retryDelayMs;
|
|
49
|
+
constructor(options: RestClientOptions);
|
|
50
|
+
setApiKey(apiKey: string): void;
|
|
51
|
+
send<T>(request: RestRequest<T>): Promise<T>;
|
|
52
|
+
private fetcher;
|
|
53
|
+
private url;
|
|
54
|
+
private init;
|
|
55
|
+
private read;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare class Leads {
|
|
59
|
+
private readonly rest;
|
|
60
|
+
constructor(rest: RestClient);
|
|
61
|
+
create(input: LeadCreateInput, options?: RequestOptions): Promise<Lead>;
|
|
62
|
+
list(filter?: LeadListFilter): Promise<Lead[]>;
|
|
63
|
+
get(id: string): Promise<Lead>;
|
|
64
|
+
uploadDocuments(enquiryId: string, files: UploadFile[], options?: RequestOptions): Promise<UploadResult[]>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare class Matches {
|
|
68
|
+
private readonly rest;
|
|
69
|
+
constructor(rest: RestClient);
|
|
70
|
+
list(leadId: string): Promise<MatchList>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class Packages {
|
|
74
|
+
private readonly rest;
|
|
75
|
+
constructor(rest: RestClient);
|
|
76
|
+
start(input: PackageStartInput): Promise<PackageRecord>;
|
|
77
|
+
read(id: string, options?: {
|
|
78
|
+
version?: number;
|
|
79
|
+
}): Promise<PackageRecord>;
|
|
80
|
+
private call;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class Consents {
|
|
84
|
+
private readonly rest;
|
|
85
|
+
constructor(rest: RestClient);
|
|
86
|
+
create(input: ConsentCreateInput, options?: RequestOptions): Promise<ShareConsent[]>;
|
|
87
|
+
list(leadId?: string): Promise<ShareConsent[]>;
|
|
88
|
+
revoke(id: string, options?: RequestOptions): Promise<ShareConsent>;
|
|
89
|
+
receipts(id?: string): Promise<ShareReceipt[]>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare class Outcomes {
|
|
93
|
+
private readonly rest;
|
|
94
|
+
constructor(rest: RestClient);
|
|
95
|
+
record(leadId: string, input: OutcomeRecordInput, options?: RequestOptions): Promise<LeadOutcome>;
|
|
96
|
+
list(leadId: string): Promise<LeadOutcome[]>;
|
|
97
|
+
signPayload(rawBody: string, secret: string): string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare class CreditBoxClient {
|
|
101
|
+
private readonly rest;
|
|
102
|
+
constructor(rest: RestClient);
|
|
103
|
+
get(): Promise<CreditBoxView>;
|
|
104
|
+
put(input: CreditBoxWriteInput | Record<string, unknown>, options?: RequestOptions): Promise<CreditBox>;
|
|
105
|
+
pause(input?: {
|
|
106
|
+
until?: string;
|
|
107
|
+
}, options?: RequestOptions): Promise<CreditBox>;
|
|
108
|
+
resume(options?: RequestOptions): Promise<CreditBox>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class Feedback {
|
|
112
|
+
private readonly rest;
|
|
113
|
+
constructor(rest: RestClient);
|
|
114
|
+
submit(event: FeedbackSubmitInput, options?: RequestOptions): Promise<FeedbackCreated>;
|
|
115
|
+
listForCase(caseId: string): Promise<FeedbackEvent[]>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare class Liquidity {
|
|
119
|
+
private readonly rest;
|
|
120
|
+
constructor(rest: RestClient);
|
|
121
|
+
get(query?: LiquidityQuery): Promise<LiquidityMetrics>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface VerifyWebhookOptions {
|
|
125
|
+
toleranceSec?: number;
|
|
126
|
+
nowMs?: number;
|
|
127
|
+
}
|
|
128
|
+
declare function signOutcomePayload(raw: string | Buffer, secret: string): string;
|
|
129
|
+
declare function signWebhook(raw: string | Buffer, secret: string, timestampSec?: number): string;
|
|
130
|
+
declare function verifyWebhook(rawBody: string | Buffer, signatureHeader: string | null | undefined, secret: string, options?: VerifyWebhookOptions): true;
|
|
131
|
+
declare function parseEvent(input: unknown): SecureLendEvent & {
|
|
132
|
+
data: Record<string, unknown>;
|
|
133
|
+
};
|
|
134
|
+
|
|
23
135
|
declare class SecureLend {
|
|
24
136
|
private mcpClient;
|
|
137
|
+
private rest;
|
|
25
138
|
readonly mcp: MCPClient["mcp"];
|
|
139
|
+
readonly leads: Leads;
|
|
140
|
+
readonly matches: Matches;
|
|
141
|
+
readonly packages: Packages;
|
|
142
|
+
readonly consents: Consents;
|
|
143
|
+
readonly outcomes: Outcomes;
|
|
144
|
+
readonly creditBox: CreditBoxClient;
|
|
145
|
+
readonly feedback: Feedback;
|
|
146
|
+
readonly liquidity: Liquidity;
|
|
147
|
+
readonly webhooks: {
|
|
148
|
+
verify: typeof verifyWebhook;
|
|
149
|
+
parseEvent: typeof parseEvent;
|
|
150
|
+
sign: typeof signWebhook;
|
|
151
|
+
};
|
|
26
152
|
constructor(config?: SecureLendConfig);
|
|
27
153
|
comparePersonalLoans(request: PersonalLoanSearchParams): Promise<LoanComparisonResponse>;
|
|
28
154
|
compareBusinessLoans(request: BusinessLoanSearchParams): Promise<LoanComparisonResponse>;
|
|
@@ -77,5 +203,17 @@ declare class NetworkError extends SecureLendError {
|
|
|
77
203
|
declare class ServerError extends SecureLendError {
|
|
78
204
|
constructor(message: string);
|
|
79
205
|
}
|
|
206
|
+
declare class FeatureDisabledError extends SecureLendError {
|
|
207
|
+
constructor(message?: string, details?: unknown);
|
|
208
|
+
}
|
|
209
|
+
declare class ConsentRequiredError extends SecureLendError {
|
|
210
|
+
constructor(message?: string, details?: unknown);
|
|
211
|
+
}
|
|
212
|
+
declare class InvalidTransitionError extends SecureLendError {
|
|
213
|
+
constructor(message?: string, details?: unknown);
|
|
214
|
+
}
|
|
215
|
+
declare class WebhookSignatureError extends SecureLendError {
|
|
216
|
+
constructor(message?: string, details?: unknown);
|
|
217
|
+
}
|
|
80
218
|
|
|
81
|
-
export { AuthenticationError, AutoLoanSearchParams, BusinessBankingComparisonResponse, BusinessBankingSearchSchema, BusinessCreditCardComparisonResponse, BusinessCreditCardSearchParams, BusinessLoanSearchParams, DisplayOfferFormParams, DisplayOfferFormResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, GetMultipleOffersParams, GetOfferParams, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, LoanCalculationResponse, LoanComparisonResponse, LoanPaymentParams, MortgageCalculationResponse, MortgagePaymentParams, MortgageSearchParams, NetworkError, NotFoundError, PersonalApplication, PersonalBankingComparisonResponse, PersonalBankingSearchSchema, PersonalCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalLoanSearchParams, RateLimitError, SavingsAccountComparisonResponse, SavingsSearchSchema, SecureLend, SecureLendConfig, SecureLendError, ServerError, StudentLoanSearchParams, SubmitDocumentsParams, SubmitDocumentsResponse, TrackOfferStatusParams, TrackOfferStatusResponse, ValidationError };
|
|
219
|
+
export { AuthenticationError, AutoLoanSearchParams, BusinessBankingComparisonResponse, BusinessBankingSearchSchema, BusinessCreditCardComparisonResponse, BusinessCreditCardSearchParams, BusinessLoanSearchParams, ConsentCreateInput, ConsentRequiredError, CreditBox, CreditBoxView, CreditBoxWriteInput, DisplayOfferFormParams, DisplayOfferFormResponse, DisplayUploadDocumentsFormParams, DisplayUploadDocumentsFormResponse, FeatureDisabledError, FeedbackCreated, FeedbackEvent, FeedbackSubmitInput, GetMultipleOffersParams, GetOfferParams, InvalidTransitionError, Lead, LeadCreateInput, LeadListFilter, LeadOutcome, LeaseVsPurchaseParams, LeaseVsPurchaseResponse, LiquidityMetrics, LiquidityQuery, LoanCalculationResponse, LoanComparisonResponse, LoanPaymentParams, MatchList, MortgageCalculationResponse, MortgagePaymentParams, MortgageSearchParams, NetworkError, NotFoundError, OutcomeRecordInput, PackageRecord, PackageStartInput, PersonalApplication, PersonalBankingComparisonResponse, PersonalBankingSearchSchema, PersonalCreditCardComparisonResponse, PersonalCreditCardSearchSchema, PersonalLoanSearchParams, RateLimitError, RequestOptions, SavingsAccountComparisonResponse, SavingsSearchSchema, SecureLend, SecureLendConfig, SecureLendError, SecureLendEvent, ServerError, ShareConsent, ShareReceipt, StudentLoanSearchParams, SubmitDocumentsParams, SubmitDocumentsResponse, TrackOfferStatusParams, TrackOfferStatusResponse, UploadFile, UploadResult, ValidationError, WebhookSignatureError, parseEvent, signOutcomePayload, signWebhook, verifyWebhook };
|