vesant-sdk 1.7.0-dev.65f378a → 1.7.0-dev.6c2d9b8
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/compliance/index.js +6 -0
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +6 -0
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +6 -0
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +6 -0
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.js +6 -0
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +6 -0
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -1
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.js +6 -0
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +6 -0
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.js +6 -0
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +6 -0
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/risk-profile/index.js +6 -0
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +6 -0
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +6 -0
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +6 -0
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.js +6 -0
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +6 -0
- package/dist/tax/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { L as Logger } from './client-q9fN8Hhf.js';
|
|
2
2
|
export { A as AuthCredential, B as BaseClient, a as BaseClientConfig, C as CGSConfig, b as CircuitBreaker, c as CircuitBreakerConfig, d as CircuitBreakerState, e as CircuitBreakerStatus, f as RateLimitStatus, g as RateLimitTracker, h as RefreshingTokenProvider, i as RefreshingTokenProviderOptions, j as RequestInterceptor, R as RequestOptions, k as RequiredBaseClientConfig, l as RequiredCGSConfig, m as RequiredVesantConfig, S as StaticApiKeyProvider, T as TokenProvider, n as TokenProviderContext, V as VesantConfig } from './client-q9fN8Hhf.js';
|
|
3
|
-
|
|
3
|
+
import { a as PaginatedResponse } from './types-CBQRNL-l.js';
|
|
4
|
+
export { A as APIResponse, B as BlockReason, C as CustomerStatus, E as EntityType, b as ErrorResponse, L as LocationCompliance, P as PaginationParams, c as Reason, d as Result, R as RiskLevel, S as SuccessResponse, T as Timestamp, U as UUID, V as VerificationEventType } from './types-CBQRNL-l.js';
|
|
4
5
|
export { B as BaseWebhookEvent, C as ComplianceCheckFailedPayload, D as DecisionRecordedPayload, G as GeolocationBlockedPayload, a as GeolocationVerifiedPayload, I as InMemoryDedupStore, b as InMemoryDedupStoreOptions, K as KycStatusChangedPayload, L as LabelAppliedPayload, c as LocationRequestCompletedPayload, N as NotificationWebhookEvent, P as ProfileCreatedPayload, d as ProfileUpdatedPayload, R as RiskCategoryChangedPayload, e as RiskScoreChangedPayload, T as TaxReminderSentPayload, V as VerifyWebhookSignatureOptions, W as WebhookAnyHandler, f as WebhookDedupStore, g as WebhookEvent, h as WebhookEventHandler, i as WebhookEventType, j as WebhookHandler, k as WebhookHandlerConfig, l as WebhookMiddlewareOptions, m as WebhookNotification, n as createNextWebhookHandler, o as createWebhookMiddleware, v as verifyWebhookSignature } from './index-CPOrMRaH.js';
|
|
5
6
|
export { A as APIError, d as AlertFilters, e as AlertListResponse, f as AlertSeverity, g as AlertStatus, h as AlertType, C as CipherTextCustomerData, i as CipherTextOptions, j as CipherTextPayload, k as CipherTextReason, l as CipherTextResult, m as ComplianceCheckResponse, n as CreateGeofenceRuleRequest, o as CreateJurisdictionRequest, p as CreateLocationRequestRequest, q as DashboardMetrics, r as DecryptedCipherText, s as DeviceFingerprint, D as DeviceFingerprintRequest, t as DeviceTrustResult, u as GeoIPResult, v as GeofenceAction, w as GeofenceEvaluation, x as GeofenceRule, y as GeofenceRuleType, z as GeolocationAlert, G as GeolocationClient, B as GeolocationClientConfig, E as GeolocationConfigResponse, F as GeolocationRecord, J as JurisdictionConfig, H as LocationCaptureRequest, I as LocationCaptureResponse, a as LocationRequest, K as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, M as LocationRequestResult, N as LocationRequestStatus, O as LocationShareInfo, L as LocationVerification, R as ResendLocationRequestRequest, U as UpdateDeviceTrustRequest, P as UpdateGeofenceRuleRequest, Q as UpdateJurisdictionRequest, S as UseAlertsOptions, T as UseAlertsResult, W as UseGeolocationOptions, X as UseGeolocationResult, Y as UseLocationCaptureOptions, Z as UseLocationCaptureResult, _ as UseLocationRequestsOptions, $ as UseLocationRequestsResult, a0 as ValidateCipherTextRequest, V as ValidateCipherTextResponse, a1 as VerifyIPRequest } from './client-0NOPDnT0.js';
|
|
6
7
|
export { GpsIntegrityInput, GpsIntegrityOptions, GpsIntegrityResult, assessGpsIntegrity, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isCipherTextExpired, probeGeolocationPermission } from './geolocation/index.js';
|
|
@@ -11,6 +12,22 @@ export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as Compli
|
|
|
11
12
|
export { CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycHandoffSession, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.js';
|
|
12
13
|
export { CTPFormStatus, CTPTINStatus, ComplianceStats, ComplianceStatsFilters, CustomerTaxProfileDocuments, CustomerTaxProfileRecord, CustomerType, DocumentRequestBreakdown, EmailSendingMethod, EnableWithholdingInput, EnableWithholdingResponse, GlobalTaxRule, ReRequestTaxFormInput, RemindersRunResult, TINCheckResult, TINStatusBreakdown, TaxClient, TaxClientConfig, TaxRuleApprovalStatus, TaxRuleVersion, TaxRules, TransactionAction, TreatyCountry, TreatyCountryListResponse, UpdateTaxRulesInput, WFormCountBreakdown, WFormStatusBreakdown } from './tax/index.js';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Lazily walk every item across all pages of a paginated endpoint. `fetchPage`
|
|
17
|
+
* is called with a 1-based page number and must return a PaginatedResponse.
|
|
18
|
+
* Iteration advances until `total_pages` is reached, and stops early if a page
|
|
19
|
+
* returns no items (a guard against a runaway loop on an over-reported
|
|
20
|
+
* total_pages). Pages are fetched on demand as the consumer iterates.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* for await (const profile of paginate((page) => client.listProfiles({ page }))) {
|
|
24
|
+
* // ...
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
declare function paginate<T>(fetchPage: (page: number) => Promise<PaginatedResponse<T>>): AsyncGenerator<T, void, void>;
|
|
28
|
+
/** Collect every item from a paginated endpoint into a single array. */
|
|
29
|
+
declare function collectAll<T>(fetchPage: (page: number) => Promise<PaginatedResponse<T>>): Promise<T[]>;
|
|
30
|
+
|
|
14
31
|
/**
|
|
15
32
|
* Error hierarchy for Vesant SDK
|
|
16
33
|
*
|
|
@@ -68,4 +85,4 @@ declare const noopLogger: Logger;
|
|
|
68
85
|
*/
|
|
69
86
|
declare const SDK_VERSION = "1.7.0";
|
|
70
87
|
|
|
71
|
-
export { AuthenticationError, CGSError, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceError, Logger, NetworkError, RateLimitError, SDK_VERSION, ServiceUnavailableError, TimeoutError, ValidationError, VesantError, createConsoleLogger, noopLogger };
|
|
88
|
+
export { AuthenticationError, CGSError, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceError, Logger, NetworkError, PaginatedResponse, RateLimitError, SDK_VERSION, ServiceUnavailableError, TimeoutError, ValidationError, VesantError, collectAll, createConsoleLogger, noopLogger, paginate };
|
package/dist/index.js
CHANGED
|
@@ -380,6 +380,12 @@ var BaseClient = class {
|
|
|
380
380
|
if (!config.tenantId?.trim()) {
|
|
381
381
|
throw new ValidationError("tenantId is required and must be a non-empty string", ["tenantId"]);
|
|
382
382
|
}
|
|
383
|
+
if (typeof fetch === "undefined") {
|
|
384
|
+
throw new VesantError(
|
|
385
|
+
"The Vesant SDK requires a global fetch (Node.js >= 18). Upgrade Node or provide a fetch polyfill.",
|
|
386
|
+
"RUNTIME_UNSUPPORTED"
|
|
387
|
+
);
|
|
388
|
+
}
|
|
383
389
|
this.interceptors = config.interceptors || [];
|
|
384
390
|
this.logger = config.logger || createConsoleLogger();
|
|
385
391
|
let environment = config.environment;
|
|
@@ -724,6 +730,31 @@ var BaseClient = class {
|
|
|
724
730
|
}
|
|
725
731
|
};
|
|
726
732
|
|
|
733
|
+
// src/core/pagination.ts
|
|
734
|
+
async function* paginate(fetchPage) {
|
|
735
|
+
let page = 1;
|
|
736
|
+
let totalPages;
|
|
737
|
+
do {
|
|
738
|
+
const response = await fetchPage(page);
|
|
739
|
+
const items = response.data ?? [];
|
|
740
|
+
for (const item of items) {
|
|
741
|
+
yield item;
|
|
742
|
+
}
|
|
743
|
+
totalPages = response.total_pages ?? page;
|
|
744
|
+
if (items.length === 0) {
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
page += 1;
|
|
748
|
+
} while (page <= totalPages);
|
|
749
|
+
}
|
|
750
|
+
async function collectAll(fetchPage) {
|
|
751
|
+
const items = [];
|
|
752
|
+
for await (const item of paginate(fetchPage)) {
|
|
753
|
+
items.push(item);
|
|
754
|
+
}
|
|
755
|
+
return items;
|
|
756
|
+
}
|
|
757
|
+
|
|
727
758
|
// src/core/webhook-utils.ts
|
|
728
759
|
async function verifyWebhookSignature(payload, signature, secret, opts = {}) {
|
|
729
760
|
const signed = parseSignedTimestamp(signature);
|
|
@@ -3834,6 +3865,7 @@ exports.ValidationError = ValidationError;
|
|
|
3834
3865
|
exports.VesantError = VesantError;
|
|
3835
3866
|
exports.WebhookHandler = WebhookHandler;
|
|
3836
3867
|
exports.assessGpsIntegrity = assessGpsIntegrity;
|
|
3868
|
+
exports.collectAll = collectAll;
|
|
3837
3869
|
exports.createConsoleLogger = createConsoleLogger;
|
|
3838
3870
|
exports.createNextWebhookHandler = createNextWebhookHandler;
|
|
3839
3871
|
exports.createWebhookMiddleware = createWebhookMiddleware;
|
|
@@ -3842,6 +3874,7 @@ exports.generateCipherText = generateCipherText;
|
|
|
3842
3874
|
exports.gpsIntegrityInputFromPosition = gpsIntegrityInputFromPosition;
|
|
3843
3875
|
exports.isCipherTextExpired = isCipherTextExpired;
|
|
3844
3876
|
exports.noopLogger = noopLogger;
|
|
3877
|
+
exports.paginate = paginate;
|
|
3845
3878
|
exports.probeGeolocationPermission = probeGeolocationPermission;
|
|
3846
3879
|
exports.sdkReasons = sdkReasons;
|
|
3847
3880
|
exports.verifyWebhookSignature = verifyWebhookSignature;
|