@moveris/shared 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +114 -29
- package/dist/index.mjs +110 -29
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
type Verdict = 'live' | 'fake';
|
|
2
|
-
|
|
2
|
+
interface ModelEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
min_frames: number;
|
|
7
|
+
deprecated: boolean;
|
|
8
|
+
}
|
|
9
|
+
type ModelsResponse = ModelEntry[];
|
|
10
|
+
type FastCheckModel = '10' | '50' | '250' | 'hybrid-v2-10' | 'hybrid-v2-30' | 'hybrid-v2-50' | 'hybrid-v2-60' | 'hybrid-v2-90' | 'hybrid-v2-100' | 'hybrid-v2-125' | 'hybrid-v2-150' | 'hybrid-v2-250' | 'mixed-10' | 'mixed-30' | 'mixed-60' | 'mixed-90' | 'mixed-120' | 'mixed-150' | 'mixed-250' | 'mixed-10-v2' | 'mixed-30-v2' | 'mixed-60-v2' | 'mixed-90-v2' | 'mixed-120-v2' | (string & object);
|
|
3
11
|
type StreamingStatus = 'buffering' | 'complete';
|
|
4
12
|
type FrameSource = 'media' | 'live';
|
|
5
13
|
type JobStatus = 'queued' | 'processing' | 'complete' | 'failed';
|
|
@@ -172,6 +180,7 @@ interface ModelConfig {
|
|
|
172
180
|
minFrames: number;
|
|
173
181
|
recommendedFrames: number;
|
|
174
182
|
description: string;
|
|
183
|
+
deprecated: boolean;
|
|
175
184
|
}
|
|
176
185
|
declare const MODEL_CONFIGS: Record<FastCheckModel, ModelConfig>;
|
|
177
186
|
interface HybridModelConfig {
|
|
@@ -184,6 +193,8 @@ interface HybridModelConfig {
|
|
|
184
193
|
declare const HYBRID_MODEL_CONFIGS: Record<string, HybridModelConfig>;
|
|
185
194
|
declare function getMinFramesForModel(model: FastCheckModel): number;
|
|
186
195
|
declare function hasEnoughFrames(model: FastCheckModel, frameCount: number): boolean;
|
|
196
|
+
declare function isDeprecatedModel(model: FastCheckModel): boolean;
|
|
197
|
+
declare function getActiveModels(): ModelConfig[];
|
|
187
198
|
|
|
188
199
|
interface Frame {
|
|
189
200
|
index: number;
|
|
@@ -252,7 +263,7 @@ interface FrameQualityResult {
|
|
|
252
263
|
rejectionReason?: 'blur' | 'backlit' | 'low_light' | 'partial_face' | 'no_face' | 'too_close' | 'too_far' | 'misaligned';
|
|
253
264
|
}
|
|
254
265
|
declare const DEFAULT_BLUR_THRESHOLD = 100;
|
|
255
|
-
declare const BLUR_THRESHOLD_MOBILE =
|
|
266
|
+
declare const BLUR_THRESHOLD_MOBILE = 60;
|
|
256
267
|
declare const BACKLIT_RATIO_THRESHOLD = 0.6;
|
|
257
268
|
declare const LOW_LIGHT_THRESHOLD = 50;
|
|
258
269
|
declare const MIN_FACE_TOP_MARGIN = 0.1;
|
|
@@ -275,6 +286,8 @@ declare function rgbaToGrayscale(rgbaPixels: Uint8ClampedArray | number[]): numb
|
|
|
275
286
|
declare function calculateBrightness(rgbaPixels: Uint8ClampedArray | number[]): number;
|
|
276
287
|
declare function analyzeLighting(faceBrightness: number, backgroundBrightness: number): LightingAnalysis;
|
|
277
288
|
declare function isFaceFullyVisible(boundingBox: FaceBoundingBox, frameWidth: number, frameHeight: number): FaceVisibilityResult;
|
|
289
|
+
declare const OVAL_REGION_DESKTOP: OvalRegion;
|
|
290
|
+
declare const OVAL_REGION_MOBILE: OvalRegion;
|
|
278
291
|
declare const DEFAULT_OVAL_REGION: OvalRegion;
|
|
279
292
|
declare function isFaceInOval(faceBox: FaceBoundingBox, frameWidth: number, frameHeight: number, oval?: OvalRegion, tolerance?: number): FaceInOvalResult;
|
|
280
293
|
declare function calculateFaceAlignment(boundingBox: FaceBoundingBox, frameWidth: number, frameHeight: number): FaceAlignmentResult;
|
|
@@ -450,6 +463,7 @@ declare class LivenessClient {
|
|
|
450
463
|
private static extractCodeFromText;
|
|
451
464
|
private requestWithRetry;
|
|
452
465
|
health(): Promise<HealthResponse>;
|
|
466
|
+
getModels(): Promise<ModelEntry[]>;
|
|
453
467
|
queueStats(): Promise<QueueStatsResponse>;
|
|
454
468
|
fastCheck(frames: CapturedFrame[], options?: {
|
|
455
469
|
sessionId?: string;
|
|
@@ -546,6 +560,7 @@ declare const API_ENDPOINTS: {
|
|
|
546
560
|
declare const DEFAULT_ENDPOINT: "https://api.moveris.com";
|
|
547
561
|
declare const API_PATHS: {
|
|
548
562
|
readonly health: "/health";
|
|
563
|
+
readonly models: "/api/v1/models";
|
|
549
564
|
readonly fastCheck: "/api/v1/fast-check";
|
|
550
565
|
readonly fastCheckCrops: "/api/v1/fast-check-crops";
|
|
551
566
|
readonly fastCheckStream: "/api/v1/fast-check-stream";
|
|
@@ -606,8 +621,8 @@ declare function getApiErrorMessage(code: string | undefined, message?: string,
|
|
|
606
621
|
declare function isRetryableError(code: string | undefined): boolean;
|
|
607
622
|
|
|
608
623
|
declare const ALIGNMENT_THRESHOLD_CAPTURE = 0.6;
|
|
609
|
-
declare const ALIGNMENT_THRESHOLD_POOR = 0.
|
|
610
|
-
declare const ALIGNMENT_THRESHOLD_GOOD = 0.
|
|
624
|
+
declare const ALIGNMENT_THRESHOLD_POOR = 0.6;
|
|
625
|
+
declare const ALIGNMENT_THRESHOLD_GOOD = 0.6;
|
|
611
626
|
declare const ALIGNMENT_THRESHOLD_PERFECT = 0.85;
|
|
612
627
|
type OvalGuideState = 'no_face' | 'poor' | 'good' | 'perfect';
|
|
613
628
|
declare const OVAL_GUIDE_COLORS: {
|
|
@@ -749,4 +764,4 @@ declare function analyzeEyeRegionContrast(pixels: Uint8Array | Uint8ClampedArray
|
|
|
749
764
|
declare function detectSpecularHighlights(pixels: Uint8Array | Uint8ClampedArray, threshold?: number): number;
|
|
750
765
|
declare function checkEyeRegionQuality(pixels: Uint8Array | Uint8ClampedArray, thresholds?: EyeQualityThresholds): EyeRegionQuality;
|
|
751
766
|
|
|
752
|
-
export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, type DetectionResult, type DetectionSummary, type DetectorConfig, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_CROP_MULTIPLIER, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelType, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, decodeBase64, detectSpecularHighlights, encodeBase64, generateSessionId, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
|
767
|
+
export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, type DetectionResult, type DetectionSummary, type DetectorConfig, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_CROP_MULTIPLIER, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, decodeBase64, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
type Verdict = 'live' | 'fake';
|
|
2
|
-
|
|
2
|
+
interface ModelEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
min_frames: number;
|
|
7
|
+
deprecated: boolean;
|
|
8
|
+
}
|
|
9
|
+
type ModelsResponse = ModelEntry[];
|
|
10
|
+
type FastCheckModel = '10' | '50' | '250' | 'hybrid-v2-10' | 'hybrid-v2-30' | 'hybrid-v2-50' | 'hybrid-v2-60' | 'hybrid-v2-90' | 'hybrid-v2-100' | 'hybrid-v2-125' | 'hybrid-v2-150' | 'hybrid-v2-250' | 'mixed-10' | 'mixed-30' | 'mixed-60' | 'mixed-90' | 'mixed-120' | 'mixed-150' | 'mixed-250' | 'mixed-10-v2' | 'mixed-30-v2' | 'mixed-60-v2' | 'mixed-90-v2' | 'mixed-120-v2' | (string & object);
|
|
3
11
|
type StreamingStatus = 'buffering' | 'complete';
|
|
4
12
|
type FrameSource = 'media' | 'live';
|
|
5
13
|
type JobStatus = 'queued' | 'processing' | 'complete' | 'failed';
|
|
@@ -172,6 +180,7 @@ interface ModelConfig {
|
|
|
172
180
|
minFrames: number;
|
|
173
181
|
recommendedFrames: number;
|
|
174
182
|
description: string;
|
|
183
|
+
deprecated: boolean;
|
|
175
184
|
}
|
|
176
185
|
declare const MODEL_CONFIGS: Record<FastCheckModel, ModelConfig>;
|
|
177
186
|
interface HybridModelConfig {
|
|
@@ -184,6 +193,8 @@ interface HybridModelConfig {
|
|
|
184
193
|
declare const HYBRID_MODEL_CONFIGS: Record<string, HybridModelConfig>;
|
|
185
194
|
declare function getMinFramesForModel(model: FastCheckModel): number;
|
|
186
195
|
declare function hasEnoughFrames(model: FastCheckModel, frameCount: number): boolean;
|
|
196
|
+
declare function isDeprecatedModel(model: FastCheckModel): boolean;
|
|
197
|
+
declare function getActiveModels(): ModelConfig[];
|
|
187
198
|
|
|
188
199
|
interface Frame {
|
|
189
200
|
index: number;
|
|
@@ -252,7 +263,7 @@ interface FrameQualityResult {
|
|
|
252
263
|
rejectionReason?: 'blur' | 'backlit' | 'low_light' | 'partial_face' | 'no_face' | 'too_close' | 'too_far' | 'misaligned';
|
|
253
264
|
}
|
|
254
265
|
declare const DEFAULT_BLUR_THRESHOLD = 100;
|
|
255
|
-
declare const BLUR_THRESHOLD_MOBILE =
|
|
266
|
+
declare const BLUR_THRESHOLD_MOBILE = 60;
|
|
256
267
|
declare const BACKLIT_RATIO_THRESHOLD = 0.6;
|
|
257
268
|
declare const LOW_LIGHT_THRESHOLD = 50;
|
|
258
269
|
declare const MIN_FACE_TOP_MARGIN = 0.1;
|
|
@@ -275,6 +286,8 @@ declare function rgbaToGrayscale(rgbaPixels: Uint8ClampedArray | number[]): numb
|
|
|
275
286
|
declare function calculateBrightness(rgbaPixels: Uint8ClampedArray | number[]): number;
|
|
276
287
|
declare function analyzeLighting(faceBrightness: number, backgroundBrightness: number): LightingAnalysis;
|
|
277
288
|
declare function isFaceFullyVisible(boundingBox: FaceBoundingBox, frameWidth: number, frameHeight: number): FaceVisibilityResult;
|
|
289
|
+
declare const OVAL_REGION_DESKTOP: OvalRegion;
|
|
290
|
+
declare const OVAL_REGION_MOBILE: OvalRegion;
|
|
278
291
|
declare const DEFAULT_OVAL_REGION: OvalRegion;
|
|
279
292
|
declare function isFaceInOval(faceBox: FaceBoundingBox, frameWidth: number, frameHeight: number, oval?: OvalRegion, tolerance?: number): FaceInOvalResult;
|
|
280
293
|
declare function calculateFaceAlignment(boundingBox: FaceBoundingBox, frameWidth: number, frameHeight: number): FaceAlignmentResult;
|
|
@@ -450,6 +463,7 @@ declare class LivenessClient {
|
|
|
450
463
|
private static extractCodeFromText;
|
|
451
464
|
private requestWithRetry;
|
|
452
465
|
health(): Promise<HealthResponse>;
|
|
466
|
+
getModels(): Promise<ModelEntry[]>;
|
|
453
467
|
queueStats(): Promise<QueueStatsResponse>;
|
|
454
468
|
fastCheck(frames: CapturedFrame[], options?: {
|
|
455
469
|
sessionId?: string;
|
|
@@ -546,6 +560,7 @@ declare const API_ENDPOINTS: {
|
|
|
546
560
|
declare const DEFAULT_ENDPOINT: "https://api.moveris.com";
|
|
547
561
|
declare const API_PATHS: {
|
|
548
562
|
readonly health: "/health";
|
|
563
|
+
readonly models: "/api/v1/models";
|
|
549
564
|
readonly fastCheck: "/api/v1/fast-check";
|
|
550
565
|
readonly fastCheckCrops: "/api/v1/fast-check-crops";
|
|
551
566
|
readonly fastCheckStream: "/api/v1/fast-check-stream";
|
|
@@ -606,8 +621,8 @@ declare function getApiErrorMessage(code: string | undefined, message?: string,
|
|
|
606
621
|
declare function isRetryableError(code: string | undefined): boolean;
|
|
607
622
|
|
|
608
623
|
declare const ALIGNMENT_THRESHOLD_CAPTURE = 0.6;
|
|
609
|
-
declare const ALIGNMENT_THRESHOLD_POOR = 0.
|
|
610
|
-
declare const ALIGNMENT_THRESHOLD_GOOD = 0.
|
|
624
|
+
declare const ALIGNMENT_THRESHOLD_POOR = 0.6;
|
|
625
|
+
declare const ALIGNMENT_THRESHOLD_GOOD = 0.6;
|
|
611
626
|
declare const ALIGNMENT_THRESHOLD_PERFECT = 0.85;
|
|
612
627
|
type OvalGuideState = 'no_face' | 'poor' | 'good' | 'perfect';
|
|
613
628
|
declare const OVAL_GUIDE_COLORS: {
|
|
@@ -749,4 +764,4 @@ declare function analyzeEyeRegionContrast(pixels: Uint8Array | Uint8ClampedArray
|
|
|
749
764
|
declare function detectSpecularHighlights(pixels: Uint8Array | Uint8ClampedArray, threshold?: number): number;
|
|
750
765
|
declare function checkEyeRegionQuality(pixels: Uint8Array | Uint8ClampedArray, thresholds?: EyeQualityThresholds): EyeRegionQuality;
|
|
751
766
|
|
|
752
|
-
export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, type DetectionResult, type DetectionSummary, type DetectorConfig, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_CROP_MULTIPLIER, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelType, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, decodeBase64, detectSpecularHighlights, encodeBase64, generateSessionId, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
|
767
|
+
export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, type DetectionResult, type DetectionSummary, type DetectorConfig, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_CROP_MULTIPLIER, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, decodeBase64, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,8 @@ __export(index_exports, {
|
|
|
76
76
|
MODEL_CONFIGS: () => MODEL_CONFIGS,
|
|
77
77
|
OVAL_GUIDE_COLORS: () => OVAL_GUIDE_COLORS,
|
|
78
78
|
OVAL_GUIDE_STYLES: () => OVAL_GUIDE_STYLES,
|
|
79
|
+
OVAL_REGION_DESKTOP: () => OVAL_REGION_DESKTOP,
|
|
80
|
+
OVAL_REGION_MOBILE: () => OVAL_REGION_MOBILE,
|
|
79
81
|
RETRY_CONFIG: () => RETRY_CONFIG,
|
|
80
82
|
TARGET_FACE_PERCENTAGE_IN_CROP: () => TARGET_FACE_PERCENTAGE_IN_CROP,
|
|
81
83
|
analyzeBlur: () => analyzeBlur,
|
|
@@ -93,6 +95,7 @@ __export(index_exports, {
|
|
|
93
95
|
detectSpecularHighlights: () => detectSpecularHighlights,
|
|
94
96
|
encodeBase64: () => encodeBase64,
|
|
95
97
|
generateSessionId: () => generateSessionId,
|
|
98
|
+
getActiveModels: () => getActiveModels,
|
|
96
99
|
getApiErrorMessage: () => getApiErrorMessage,
|
|
97
100
|
getCaptureQualityFeedback: () => getCaptureQualityFeedback,
|
|
98
101
|
getEyeRegionBounds: () => getEyeRegionBounds,
|
|
@@ -101,6 +104,7 @@ __export(index_exports, {
|
|
|
101
104
|
getOvalGuideState: () => getOvalGuideState,
|
|
102
105
|
getStatusMessage: () => getStatusMessage,
|
|
103
106
|
hasEnoughFrames: () => hasEnoughFrames,
|
|
107
|
+
isDeprecatedModel: () => isDeprecatedModel,
|
|
104
108
|
isFaceCropFullyInFrame: () => isFaceCropFullyInFrame,
|
|
105
109
|
isFaceFullyVisible: () => isFaceFullyVisible,
|
|
106
110
|
isFaceInOval: () => isFaceInOval,
|
|
@@ -132,6 +136,7 @@ var API_ENDPOINTS = {
|
|
|
132
136
|
var DEFAULT_ENDPOINT = API_ENDPOINTS.production;
|
|
133
137
|
var API_PATHS = {
|
|
134
138
|
health: "/health",
|
|
139
|
+
models: "/api/v1/models",
|
|
135
140
|
fastCheck: "/api/v1/fast-check",
|
|
136
141
|
fastCheckCrops: "/api/v1/fast-check-crops",
|
|
137
142
|
fastCheckStream: "/api/v1/fast-check-stream",
|
|
@@ -419,6 +424,14 @@ var LivenessClient = class _LivenessClient {
|
|
|
419
424
|
async health() {
|
|
420
425
|
return this.request(API_PATHS.health);
|
|
421
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Fetch the full model registry from the API.
|
|
429
|
+
* Includes all models with their deprecated status.
|
|
430
|
+
* Use this instead of the local MODEL_CONFIGS for a live list.
|
|
431
|
+
*/
|
|
432
|
+
async getModels() {
|
|
433
|
+
return this.request(API_PATHS.models);
|
|
434
|
+
}
|
|
422
435
|
/**
|
|
423
436
|
* Get queue statistics
|
|
424
437
|
*/
|
|
@@ -868,117 +881,172 @@ var MODEL_CONFIGS = {
|
|
|
868
881
|
type: "10",
|
|
869
882
|
minFrames: 10,
|
|
870
883
|
recommendedFrames: 10,
|
|
871
|
-
description: "Fast model - 10 frames, quick verification"
|
|
884
|
+
description: "Fast model - 10 frames, quick verification",
|
|
885
|
+
deprecated: false
|
|
872
886
|
},
|
|
873
887
|
"50": {
|
|
874
888
|
type: "50",
|
|
875
889
|
minFrames: 50,
|
|
876
890
|
recommendedFrames: 50,
|
|
877
|
-
description: "Balanced model - 50 frames, good accuracy"
|
|
891
|
+
description: "Balanced model - 50 frames, good accuracy",
|
|
892
|
+
deprecated: false
|
|
878
893
|
},
|
|
879
894
|
"250": {
|
|
880
895
|
type: "250",
|
|
881
896
|
minFrames: 250,
|
|
882
897
|
recommendedFrames: 250,
|
|
883
|
-
description: "High-accuracy model - 250 frames, best accuracy"
|
|
898
|
+
description: "High-accuracy model - 250 frames, best accuracy",
|
|
899
|
+
deprecated: false
|
|
884
900
|
},
|
|
885
901
|
// Hybrid V2 models with physiological features
|
|
886
902
|
"hybrid-v2-10": {
|
|
887
903
|
type: "hybrid-v2-10",
|
|
888
904
|
minFrames: 10,
|
|
889
905
|
recommendedFrames: 10,
|
|
890
|
-
description: "Hybrid V2 10-frame model with physio features"
|
|
906
|
+
description: "Hybrid V2 10-frame model with physio features",
|
|
907
|
+
deprecated: false
|
|
891
908
|
},
|
|
892
909
|
"hybrid-v2-30": {
|
|
893
910
|
type: "hybrid-v2-30",
|
|
894
911
|
minFrames: 30,
|
|
895
912
|
recommendedFrames: 30,
|
|
896
|
-
description: "Hybrid V2 30-frame model with physio features"
|
|
913
|
+
description: "Hybrid V2 30-frame model with physio features",
|
|
914
|
+
deprecated: false
|
|
897
915
|
},
|
|
898
916
|
"hybrid-v2-50": {
|
|
899
917
|
type: "hybrid-v2-50",
|
|
900
918
|
minFrames: 50,
|
|
901
919
|
recommendedFrames: 50,
|
|
902
|
-
description: "Hybrid V2 50-frame model with physio features"
|
|
920
|
+
description: "Hybrid V2 50-frame model with physio features",
|
|
921
|
+
deprecated: false
|
|
903
922
|
},
|
|
904
923
|
"hybrid-v2-60": {
|
|
905
924
|
type: "hybrid-v2-60",
|
|
906
925
|
minFrames: 60,
|
|
907
926
|
recommendedFrames: 60,
|
|
908
|
-
description: "Hybrid V2 60-frame model with physio features"
|
|
927
|
+
description: "Hybrid V2 60-frame model with physio features",
|
|
928
|
+
deprecated: false
|
|
909
929
|
},
|
|
910
930
|
"hybrid-v2-90": {
|
|
911
931
|
type: "hybrid-v2-90",
|
|
912
932
|
minFrames: 90,
|
|
913
933
|
recommendedFrames: 90,
|
|
914
|
-
description: "Hybrid V2 90-frame model with physio features"
|
|
934
|
+
description: "Hybrid V2 90-frame model with physio features",
|
|
935
|
+
deprecated: false
|
|
915
936
|
},
|
|
916
937
|
"hybrid-v2-100": {
|
|
917
938
|
type: "hybrid-v2-100",
|
|
918
939
|
minFrames: 100,
|
|
919
940
|
recommendedFrames: 100,
|
|
920
|
-
description: "Hybrid V2 100-frame model with physio features"
|
|
941
|
+
description: "Hybrid V2 100-frame model with physio features",
|
|
942
|
+
deprecated: false
|
|
921
943
|
},
|
|
922
944
|
"hybrid-v2-125": {
|
|
923
945
|
type: "hybrid-v2-125",
|
|
924
946
|
minFrames: 125,
|
|
925
947
|
recommendedFrames: 125,
|
|
926
|
-
description: "Hybrid V2 125-frame model with physio features"
|
|
948
|
+
description: "Hybrid V2 125-frame model with physio features",
|
|
949
|
+
deprecated: false
|
|
927
950
|
},
|
|
928
951
|
"hybrid-v2-150": {
|
|
929
952
|
type: "hybrid-v2-150",
|
|
930
953
|
minFrames: 150,
|
|
931
954
|
recommendedFrames: 150,
|
|
932
|
-
description: "Hybrid V2 150-frame model with physio features"
|
|
955
|
+
description: "Hybrid V2 150-frame model with physio features",
|
|
956
|
+
deprecated: false
|
|
933
957
|
},
|
|
934
958
|
"hybrid-v2-250": {
|
|
935
959
|
type: "hybrid-v2-250",
|
|
936
960
|
minFrames: 250,
|
|
937
961
|
recommendedFrames: 250,
|
|
938
|
-
description: "Hybrid V2 250-frame model with physio features"
|
|
962
|
+
description: "Hybrid V2 250-frame model with physio features",
|
|
963
|
+
deprecated: false
|
|
939
964
|
},
|
|
940
|
-
// Mixed models
|
|
965
|
+
// Mixed V1 models — deprecated, use mixed-*-v2 equivalents instead
|
|
941
966
|
"mixed-10": {
|
|
942
967
|
type: "mixed-10",
|
|
943
968
|
minFrames: 10,
|
|
944
969
|
recommendedFrames: 10,
|
|
945
|
-
description: "Mixed 10-frame model"
|
|
970
|
+
description: "Mixed 10-frame model",
|
|
971
|
+
deprecated: true
|
|
946
972
|
},
|
|
947
973
|
"mixed-30": {
|
|
948
974
|
type: "mixed-30",
|
|
949
975
|
minFrames: 30,
|
|
950
976
|
recommendedFrames: 30,
|
|
951
|
-
description: "Mixed 30-frame model"
|
|
977
|
+
description: "Mixed 30-frame model",
|
|
978
|
+
deprecated: true
|
|
952
979
|
},
|
|
953
980
|
"mixed-60": {
|
|
954
981
|
type: "mixed-60",
|
|
955
982
|
minFrames: 60,
|
|
956
983
|
recommendedFrames: 60,
|
|
957
|
-
description: "Mixed 60-frame model"
|
|
984
|
+
description: "Mixed 60-frame model",
|
|
985
|
+
deprecated: true
|
|
958
986
|
},
|
|
959
987
|
"mixed-90": {
|
|
960
988
|
type: "mixed-90",
|
|
961
989
|
minFrames: 90,
|
|
962
990
|
recommendedFrames: 90,
|
|
963
|
-
description: "Mixed 90-frame model"
|
|
991
|
+
description: "Mixed 90-frame model",
|
|
992
|
+
deprecated: true
|
|
964
993
|
},
|
|
965
994
|
"mixed-120": {
|
|
966
995
|
type: "mixed-120",
|
|
967
996
|
minFrames: 120,
|
|
968
997
|
recommendedFrames: 120,
|
|
969
|
-
description: "Mixed 120-frame model"
|
|
998
|
+
description: "Mixed 120-frame model",
|
|
999
|
+
deprecated: true
|
|
970
1000
|
},
|
|
971
1001
|
"mixed-150": {
|
|
972
1002
|
type: "mixed-150",
|
|
973
1003
|
minFrames: 150,
|
|
974
1004
|
recommendedFrames: 150,
|
|
975
|
-
description: "Mixed 150-frame model"
|
|
1005
|
+
description: "Mixed 150-frame model",
|
|
1006
|
+
deprecated: true
|
|
976
1007
|
},
|
|
977
1008
|
"mixed-250": {
|
|
978
1009
|
type: "mixed-250",
|
|
979
1010
|
minFrames: 250,
|
|
980
1011
|
recommendedFrames: 250,
|
|
981
|
-
description: "Mixed 250-frame model"
|
|
1012
|
+
description: "Mixed 250-frame model",
|
|
1013
|
+
deprecated: true
|
|
1014
|
+
},
|
|
1015
|
+
// Mixed V2 models (exp_042 checkpoints — EER: 4.0% / AUC: 0.991 at 30f)
|
|
1016
|
+
"mixed-10-v2": {
|
|
1017
|
+
type: "mixed-10-v2",
|
|
1018
|
+
minFrames: 10,
|
|
1019
|
+
recommendedFrames: 10,
|
|
1020
|
+
description: "Mixed V2 10-frame model",
|
|
1021
|
+
deprecated: false
|
|
1022
|
+
},
|
|
1023
|
+
"mixed-30-v2": {
|
|
1024
|
+
type: "mixed-30-v2",
|
|
1025
|
+
minFrames: 30,
|
|
1026
|
+
recommendedFrames: 30,
|
|
1027
|
+
description: "Mixed V2 30-frame model (recommended \u2014 95.7% balanced accuracy)",
|
|
1028
|
+
deprecated: false
|
|
1029
|
+
},
|
|
1030
|
+
"mixed-60-v2": {
|
|
1031
|
+
type: "mixed-60-v2",
|
|
1032
|
+
minFrames: 60,
|
|
1033
|
+
recommendedFrames: 60,
|
|
1034
|
+
description: "Mixed V2 60-frame model",
|
|
1035
|
+
deprecated: false
|
|
1036
|
+
},
|
|
1037
|
+
"mixed-90-v2": {
|
|
1038
|
+
type: "mixed-90-v2",
|
|
1039
|
+
minFrames: 90,
|
|
1040
|
+
recommendedFrames: 90,
|
|
1041
|
+
description: "Mixed V2 90-frame model",
|
|
1042
|
+
deprecated: false
|
|
1043
|
+
},
|
|
1044
|
+
"mixed-120-v2": {
|
|
1045
|
+
type: "mixed-120-v2",
|
|
1046
|
+
minFrames: 120,
|
|
1047
|
+
recommendedFrames: 120,
|
|
1048
|
+
description: "Mixed V2 120-frame model",
|
|
1049
|
+
deprecated: false
|
|
982
1050
|
}
|
|
983
1051
|
};
|
|
984
1052
|
var HYBRID_MODEL_CONFIGS = {
|
|
@@ -998,10 +1066,16 @@ var HYBRID_MODEL_CONFIGS = {
|
|
|
998
1066
|
}
|
|
999
1067
|
};
|
|
1000
1068
|
function getMinFramesForModel(model) {
|
|
1001
|
-
return MODEL_CONFIGS[model]
|
|
1069
|
+
return MODEL_CONFIGS[model]?.minFrames ?? 10;
|
|
1002
1070
|
}
|
|
1003
1071
|
function hasEnoughFrames(model, frameCount) {
|
|
1004
|
-
return frameCount >=
|
|
1072
|
+
return frameCount >= getMinFramesForModel(model);
|
|
1073
|
+
}
|
|
1074
|
+
function isDeprecatedModel(model) {
|
|
1075
|
+
return MODEL_CONFIGS[model]?.deprecated ?? false;
|
|
1076
|
+
}
|
|
1077
|
+
function getActiveModels() {
|
|
1078
|
+
return Object.values(MODEL_CONFIGS).filter((c) => !c.deprecated);
|
|
1005
1079
|
}
|
|
1006
1080
|
|
|
1007
1081
|
// src/types/detectors.ts
|
|
@@ -1104,8 +1178,8 @@ function isRetryableError(code) {
|
|
|
1104
1178
|
|
|
1105
1179
|
// src/constants/feedback.ts
|
|
1106
1180
|
var ALIGNMENT_THRESHOLD_CAPTURE = 0.6;
|
|
1107
|
-
var ALIGNMENT_THRESHOLD_POOR = 0.
|
|
1108
|
-
var ALIGNMENT_THRESHOLD_GOOD = 0.
|
|
1181
|
+
var ALIGNMENT_THRESHOLD_POOR = 0.6;
|
|
1182
|
+
var ALIGNMENT_THRESHOLD_GOOD = 0.6;
|
|
1109
1183
|
var ALIGNMENT_THRESHOLD_PERFECT = 0.85;
|
|
1110
1184
|
var OVAL_GUIDE_COLORS = {
|
|
1111
1185
|
no_face: "#ef4444",
|
|
@@ -1314,7 +1388,7 @@ function validateTimestamp(timestamp) {
|
|
|
1314
1388
|
}
|
|
1315
1389
|
function validateFrameCount(model, frameCount) {
|
|
1316
1390
|
const config = MODEL_CONFIGS[model];
|
|
1317
|
-
const required = config
|
|
1391
|
+
const required = config?.minFrames ?? 10;
|
|
1318
1392
|
return {
|
|
1319
1393
|
valid: frameCount >= required,
|
|
1320
1394
|
required,
|
|
@@ -1356,7 +1430,7 @@ function decodeBase64(base64) {
|
|
|
1356
1430
|
|
|
1357
1431
|
// src/utils/frameAnalysis.ts
|
|
1358
1432
|
var DEFAULT_BLUR_THRESHOLD = 100;
|
|
1359
|
-
var BLUR_THRESHOLD_MOBILE =
|
|
1433
|
+
var BLUR_THRESHOLD_MOBILE = 60;
|
|
1360
1434
|
var BACKLIT_RATIO_THRESHOLD = 0.6;
|
|
1361
1435
|
var LOW_LIGHT_THRESHOLD = 50;
|
|
1362
1436
|
var MIN_FACE_TOP_MARGIN = 0.1;
|
|
@@ -1459,14 +1533,21 @@ function isFaceFullyVisible(boundingBox, frameWidth, frameHeight) {
|
|
|
1459
1533
|
}
|
|
1460
1534
|
return { visible: true };
|
|
1461
1535
|
}
|
|
1462
|
-
var
|
|
1536
|
+
var OVAL_REGION_DESKTOP = {
|
|
1463
1537
|
centerX: 0.5,
|
|
1464
1538
|
centerY: 0.5,
|
|
1465
1539
|
width: 0.36,
|
|
1466
|
-
// 36% of frame width (+20%)
|
|
1467
1540
|
height: 0.48
|
|
1468
|
-
// 36
|
|
1541
|
+
// 0.36 * (4/3)
|
|
1542
|
+
};
|
|
1543
|
+
var OVAL_REGION_MOBILE = {
|
|
1544
|
+
centerX: 0.5,
|
|
1545
|
+
centerY: 0.5,
|
|
1546
|
+
width: 0.55,
|
|
1547
|
+
height: 0.73
|
|
1548
|
+
// 0.55 * (4/3)
|
|
1469
1549
|
};
|
|
1550
|
+
var DEFAULT_OVAL_REGION = OVAL_REGION_DESKTOP;
|
|
1470
1551
|
function isFaceInOval(faceBox, frameWidth, frameHeight, oval = DEFAULT_OVAL_REGION, tolerance = 0.3) {
|
|
1471
1552
|
const faceCenterX = (faceBox.originX + faceBox.width / 2) / frameWidth;
|
|
1472
1553
|
const faceCenterY = (faceBox.originY + faceBox.height / 2) / frameHeight;
|
|
@@ -1890,6 +1971,8 @@ function checkEyeRegionQuality(pixels, thresholds = EYE_QUALITY_THRESHOLDS) {
|
|
|
1890
1971
|
MODEL_CONFIGS,
|
|
1891
1972
|
OVAL_GUIDE_COLORS,
|
|
1892
1973
|
OVAL_GUIDE_STYLES,
|
|
1974
|
+
OVAL_REGION_DESKTOP,
|
|
1975
|
+
OVAL_REGION_MOBILE,
|
|
1893
1976
|
RETRY_CONFIG,
|
|
1894
1977
|
TARGET_FACE_PERCENTAGE_IN_CROP,
|
|
1895
1978
|
analyzeBlur,
|
|
@@ -1907,6 +1990,7 @@ function checkEyeRegionQuality(pixels, thresholds = EYE_QUALITY_THRESHOLDS) {
|
|
|
1907
1990
|
detectSpecularHighlights,
|
|
1908
1991
|
encodeBase64,
|
|
1909
1992
|
generateSessionId,
|
|
1993
|
+
getActiveModels,
|
|
1910
1994
|
getApiErrorMessage,
|
|
1911
1995
|
getCaptureQualityFeedback,
|
|
1912
1996
|
getEyeRegionBounds,
|
|
@@ -1915,6 +1999,7 @@ function checkEyeRegionQuality(pixels, thresholds = EYE_QUALITY_THRESHOLDS) {
|
|
|
1915
1999
|
getOvalGuideState,
|
|
1916
2000
|
getStatusMessage,
|
|
1917
2001
|
hasEnoughFrames,
|
|
2002
|
+
isDeprecatedModel,
|
|
1918
2003
|
isFaceCropFullyInFrame,
|
|
1919
2004
|
isFaceFullyVisible,
|
|
1920
2005
|
isFaceInOval,
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ var API_ENDPOINTS = {
|
|
|
7
7
|
var DEFAULT_ENDPOINT = API_ENDPOINTS.production;
|
|
8
8
|
var API_PATHS = {
|
|
9
9
|
health: "/health",
|
|
10
|
+
models: "/api/v1/models",
|
|
10
11
|
fastCheck: "/api/v1/fast-check",
|
|
11
12
|
fastCheckCrops: "/api/v1/fast-check-crops",
|
|
12
13
|
fastCheckStream: "/api/v1/fast-check-stream",
|
|
@@ -294,6 +295,14 @@ var LivenessClient = class _LivenessClient {
|
|
|
294
295
|
async health() {
|
|
295
296
|
return this.request(API_PATHS.health);
|
|
296
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Fetch the full model registry from the API.
|
|
300
|
+
* Includes all models with their deprecated status.
|
|
301
|
+
* Use this instead of the local MODEL_CONFIGS for a live list.
|
|
302
|
+
*/
|
|
303
|
+
async getModels() {
|
|
304
|
+
return this.request(API_PATHS.models);
|
|
305
|
+
}
|
|
297
306
|
/**
|
|
298
307
|
* Get queue statistics
|
|
299
308
|
*/
|
|
@@ -743,117 +752,172 @@ var MODEL_CONFIGS = {
|
|
|
743
752
|
type: "10",
|
|
744
753
|
minFrames: 10,
|
|
745
754
|
recommendedFrames: 10,
|
|
746
|
-
description: "Fast model - 10 frames, quick verification"
|
|
755
|
+
description: "Fast model - 10 frames, quick verification",
|
|
756
|
+
deprecated: false
|
|
747
757
|
},
|
|
748
758
|
"50": {
|
|
749
759
|
type: "50",
|
|
750
760
|
minFrames: 50,
|
|
751
761
|
recommendedFrames: 50,
|
|
752
|
-
description: "Balanced model - 50 frames, good accuracy"
|
|
762
|
+
description: "Balanced model - 50 frames, good accuracy",
|
|
763
|
+
deprecated: false
|
|
753
764
|
},
|
|
754
765
|
"250": {
|
|
755
766
|
type: "250",
|
|
756
767
|
minFrames: 250,
|
|
757
768
|
recommendedFrames: 250,
|
|
758
|
-
description: "High-accuracy model - 250 frames, best accuracy"
|
|
769
|
+
description: "High-accuracy model - 250 frames, best accuracy",
|
|
770
|
+
deprecated: false
|
|
759
771
|
},
|
|
760
772
|
// Hybrid V2 models with physiological features
|
|
761
773
|
"hybrid-v2-10": {
|
|
762
774
|
type: "hybrid-v2-10",
|
|
763
775
|
minFrames: 10,
|
|
764
776
|
recommendedFrames: 10,
|
|
765
|
-
description: "Hybrid V2 10-frame model with physio features"
|
|
777
|
+
description: "Hybrid V2 10-frame model with physio features",
|
|
778
|
+
deprecated: false
|
|
766
779
|
},
|
|
767
780
|
"hybrid-v2-30": {
|
|
768
781
|
type: "hybrid-v2-30",
|
|
769
782
|
minFrames: 30,
|
|
770
783
|
recommendedFrames: 30,
|
|
771
|
-
description: "Hybrid V2 30-frame model with physio features"
|
|
784
|
+
description: "Hybrid V2 30-frame model with physio features",
|
|
785
|
+
deprecated: false
|
|
772
786
|
},
|
|
773
787
|
"hybrid-v2-50": {
|
|
774
788
|
type: "hybrid-v2-50",
|
|
775
789
|
minFrames: 50,
|
|
776
790
|
recommendedFrames: 50,
|
|
777
|
-
description: "Hybrid V2 50-frame model with physio features"
|
|
791
|
+
description: "Hybrid V2 50-frame model with physio features",
|
|
792
|
+
deprecated: false
|
|
778
793
|
},
|
|
779
794
|
"hybrid-v2-60": {
|
|
780
795
|
type: "hybrid-v2-60",
|
|
781
796
|
minFrames: 60,
|
|
782
797
|
recommendedFrames: 60,
|
|
783
|
-
description: "Hybrid V2 60-frame model with physio features"
|
|
798
|
+
description: "Hybrid V2 60-frame model with physio features",
|
|
799
|
+
deprecated: false
|
|
784
800
|
},
|
|
785
801
|
"hybrid-v2-90": {
|
|
786
802
|
type: "hybrid-v2-90",
|
|
787
803
|
minFrames: 90,
|
|
788
804
|
recommendedFrames: 90,
|
|
789
|
-
description: "Hybrid V2 90-frame model with physio features"
|
|
805
|
+
description: "Hybrid V2 90-frame model with physio features",
|
|
806
|
+
deprecated: false
|
|
790
807
|
},
|
|
791
808
|
"hybrid-v2-100": {
|
|
792
809
|
type: "hybrid-v2-100",
|
|
793
810
|
minFrames: 100,
|
|
794
811
|
recommendedFrames: 100,
|
|
795
|
-
description: "Hybrid V2 100-frame model with physio features"
|
|
812
|
+
description: "Hybrid V2 100-frame model with physio features",
|
|
813
|
+
deprecated: false
|
|
796
814
|
},
|
|
797
815
|
"hybrid-v2-125": {
|
|
798
816
|
type: "hybrid-v2-125",
|
|
799
817
|
minFrames: 125,
|
|
800
818
|
recommendedFrames: 125,
|
|
801
|
-
description: "Hybrid V2 125-frame model with physio features"
|
|
819
|
+
description: "Hybrid V2 125-frame model with physio features",
|
|
820
|
+
deprecated: false
|
|
802
821
|
},
|
|
803
822
|
"hybrid-v2-150": {
|
|
804
823
|
type: "hybrid-v2-150",
|
|
805
824
|
minFrames: 150,
|
|
806
825
|
recommendedFrames: 150,
|
|
807
|
-
description: "Hybrid V2 150-frame model with physio features"
|
|
826
|
+
description: "Hybrid V2 150-frame model with physio features",
|
|
827
|
+
deprecated: false
|
|
808
828
|
},
|
|
809
829
|
"hybrid-v2-250": {
|
|
810
830
|
type: "hybrid-v2-250",
|
|
811
831
|
minFrames: 250,
|
|
812
832
|
recommendedFrames: 250,
|
|
813
|
-
description: "Hybrid V2 250-frame model with physio features"
|
|
833
|
+
description: "Hybrid V2 250-frame model with physio features",
|
|
834
|
+
deprecated: false
|
|
814
835
|
},
|
|
815
|
-
// Mixed models
|
|
836
|
+
// Mixed V1 models — deprecated, use mixed-*-v2 equivalents instead
|
|
816
837
|
"mixed-10": {
|
|
817
838
|
type: "mixed-10",
|
|
818
839
|
minFrames: 10,
|
|
819
840
|
recommendedFrames: 10,
|
|
820
|
-
description: "Mixed 10-frame model"
|
|
841
|
+
description: "Mixed 10-frame model",
|
|
842
|
+
deprecated: true
|
|
821
843
|
},
|
|
822
844
|
"mixed-30": {
|
|
823
845
|
type: "mixed-30",
|
|
824
846
|
minFrames: 30,
|
|
825
847
|
recommendedFrames: 30,
|
|
826
|
-
description: "Mixed 30-frame model"
|
|
848
|
+
description: "Mixed 30-frame model",
|
|
849
|
+
deprecated: true
|
|
827
850
|
},
|
|
828
851
|
"mixed-60": {
|
|
829
852
|
type: "mixed-60",
|
|
830
853
|
minFrames: 60,
|
|
831
854
|
recommendedFrames: 60,
|
|
832
|
-
description: "Mixed 60-frame model"
|
|
855
|
+
description: "Mixed 60-frame model",
|
|
856
|
+
deprecated: true
|
|
833
857
|
},
|
|
834
858
|
"mixed-90": {
|
|
835
859
|
type: "mixed-90",
|
|
836
860
|
minFrames: 90,
|
|
837
861
|
recommendedFrames: 90,
|
|
838
|
-
description: "Mixed 90-frame model"
|
|
862
|
+
description: "Mixed 90-frame model",
|
|
863
|
+
deprecated: true
|
|
839
864
|
},
|
|
840
865
|
"mixed-120": {
|
|
841
866
|
type: "mixed-120",
|
|
842
867
|
minFrames: 120,
|
|
843
868
|
recommendedFrames: 120,
|
|
844
|
-
description: "Mixed 120-frame model"
|
|
869
|
+
description: "Mixed 120-frame model",
|
|
870
|
+
deprecated: true
|
|
845
871
|
},
|
|
846
872
|
"mixed-150": {
|
|
847
873
|
type: "mixed-150",
|
|
848
874
|
minFrames: 150,
|
|
849
875
|
recommendedFrames: 150,
|
|
850
|
-
description: "Mixed 150-frame model"
|
|
876
|
+
description: "Mixed 150-frame model",
|
|
877
|
+
deprecated: true
|
|
851
878
|
},
|
|
852
879
|
"mixed-250": {
|
|
853
880
|
type: "mixed-250",
|
|
854
881
|
minFrames: 250,
|
|
855
882
|
recommendedFrames: 250,
|
|
856
|
-
description: "Mixed 250-frame model"
|
|
883
|
+
description: "Mixed 250-frame model",
|
|
884
|
+
deprecated: true
|
|
885
|
+
},
|
|
886
|
+
// Mixed V2 models (exp_042 checkpoints — EER: 4.0% / AUC: 0.991 at 30f)
|
|
887
|
+
"mixed-10-v2": {
|
|
888
|
+
type: "mixed-10-v2",
|
|
889
|
+
minFrames: 10,
|
|
890
|
+
recommendedFrames: 10,
|
|
891
|
+
description: "Mixed V2 10-frame model",
|
|
892
|
+
deprecated: false
|
|
893
|
+
},
|
|
894
|
+
"mixed-30-v2": {
|
|
895
|
+
type: "mixed-30-v2",
|
|
896
|
+
minFrames: 30,
|
|
897
|
+
recommendedFrames: 30,
|
|
898
|
+
description: "Mixed V2 30-frame model (recommended \u2014 95.7% balanced accuracy)",
|
|
899
|
+
deprecated: false
|
|
900
|
+
},
|
|
901
|
+
"mixed-60-v2": {
|
|
902
|
+
type: "mixed-60-v2",
|
|
903
|
+
minFrames: 60,
|
|
904
|
+
recommendedFrames: 60,
|
|
905
|
+
description: "Mixed V2 60-frame model",
|
|
906
|
+
deprecated: false
|
|
907
|
+
},
|
|
908
|
+
"mixed-90-v2": {
|
|
909
|
+
type: "mixed-90-v2",
|
|
910
|
+
minFrames: 90,
|
|
911
|
+
recommendedFrames: 90,
|
|
912
|
+
description: "Mixed V2 90-frame model",
|
|
913
|
+
deprecated: false
|
|
914
|
+
},
|
|
915
|
+
"mixed-120-v2": {
|
|
916
|
+
type: "mixed-120-v2",
|
|
917
|
+
minFrames: 120,
|
|
918
|
+
recommendedFrames: 120,
|
|
919
|
+
description: "Mixed V2 120-frame model",
|
|
920
|
+
deprecated: false
|
|
857
921
|
}
|
|
858
922
|
};
|
|
859
923
|
var HYBRID_MODEL_CONFIGS = {
|
|
@@ -873,10 +937,16 @@ var HYBRID_MODEL_CONFIGS = {
|
|
|
873
937
|
}
|
|
874
938
|
};
|
|
875
939
|
function getMinFramesForModel(model) {
|
|
876
|
-
return MODEL_CONFIGS[model]
|
|
940
|
+
return MODEL_CONFIGS[model]?.minFrames ?? 10;
|
|
877
941
|
}
|
|
878
942
|
function hasEnoughFrames(model, frameCount) {
|
|
879
|
-
return frameCount >=
|
|
943
|
+
return frameCount >= getMinFramesForModel(model);
|
|
944
|
+
}
|
|
945
|
+
function isDeprecatedModel(model) {
|
|
946
|
+
return MODEL_CONFIGS[model]?.deprecated ?? false;
|
|
947
|
+
}
|
|
948
|
+
function getActiveModels() {
|
|
949
|
+
return Object.values(MODEL_CONFIGS).filter((c) => !c.deprecated);
|
|
880
950
|
}
|
|
881
951
|
|
|
882
952
|
// src/types/detectors.ts
|
|
@@ -979,8 +1049,8 @@ function isRetryableError(code) {
|
|
|
979
1049
|
|
|
980
1050
|
// src/constants/feedback.ts
|
|
981
1051
|
var ALIGNMENT_THRESHOLD_CAPTURE = 0.6;
|
|
982
|
-
var ALIGNMENT_THRESHOLD_POOR = 0.
|
|
983
|
-
var ALIGNMENT_THRESHOLD_GOOD = 0.
|
|
1052
|
+
var ALIGNMENT_THRESHOLD_POOR = 0.6;
|
|
1053
|
+
var ALIGNMENT_THRESHOLD_GOOD = 0.6;
|
|
984
1054
|
var ALIGNMENT_THRESHOLD_PERFECT = 0.85;
|
|
985
1055
|
var OVAL_GUIDE_COLORS = {
|
|
986
1056
|
no_face: "#ef4444",
|
|
@@ -1189,7 +1259,7 @@ function validateTimestamp(timestamp) {
|
|
|
1189
1259
|
}
|
|
1190
1260
|
function validateFrameCount(model, frameCount) {
|
|
1191
1261
|
const config = MODEL_CONFIGS[model];
|
|
1192
|
-
const required = config
|
|
1262
|
+
const required = config?.minFrames ?? 10;
|
|
1193
1263
|
return {
|
|
1194
1264
|
valid: frameCount >= required,
|
|
1195
1265
|
required,
|
|
@@ -1231,7 +1301,7 @@ function decodeBase64(base64) {
|
|
|
1231
1301
|
|
|
1232
1302
|
// src/utils/frameAnalysis.ts
|
|
1233
1303
|
var DEFAULT_BLUR_THRESHOLD = 100;
|
|
1234
|
-
var BLUR_THRESHOLD_MOBILE =
|
|
1304
|
+
var BLUR_THRESHOLD_MOBILE = 60;
|
|
1235
1305
|
var BACKLIT_RATIO_THRESHOLD = 0.6;
|
|
1236
1306
|
var LOW_LIGHT_THRESHOLD = 50;
|
|
1237
1307
|
var MIN_FACE_TOP_MARGIN = 0.1;
|
|
@@ -1334,14 +1404,21 @@ function isFaceFullyVisible(boundingBox, frameWidth, frameHeight) {
|
|
|
1334
1404
|
}
|
|
1335
1405
|
return { visible: true };
|
|
1336
1406
|
}
|
|
1337
|
-
var
|
|
1407
|
+
var OVAL_REGION_DESKTOP = {
|
|
1338
1408
|
centerX: 0.5,
|
|
1339
1409
|
centerY: 0.5,
|
|
1340
1410
|
width: 0.36,
|
|
1341
|
-
// 36% of frame width (+20%)
|
|
1342
1411
|
height: 0.48
|
|
1343
|
-
// 36
|
|
1412
|
+
// 0.36 * (4/3)
|
|
1413
|
+
};
|
|
1414
|
+
var OVAL_REGION_MOBILE = {
|
|
1415
|
+
centerX: 0.5,
|
|
1416
|
+
centerY: 0.5,
|
|
1417
|
+
width: 0.55,
|
|
1418
|
+
height: 0.73
|
|
1419
|
+
// 0.55 * (4/3)
|
|
1344
1420
|
};
|
|
1421
|
+
var DEFAULT_OVAL_REGION = OVAL_REGION_DESKTOP;
|
|
1345
1422
|
function isFaceInOval(faceBox, frameWidth, frameHeight, oval = DEFAULT_OVAL_REGION, tolerance = 0.3) {
|
|
1346
1423
|
const faceCenterX = (faceBox.originX + faceBox.width / 2) / frameWidth;
|
|
1347
1424
|
const faceCenterY = (faceBox.originY + faceBox.height / 2) / frameHeight;
|
|
@@ -1764,6 +1841,8 @@ export {
|
|
|
1764
1841
|
MODEL_CONFIGS,
|
|
1765
1842
|
OVAL_GUIDE_COLORS,
|
|
1766
1843
|
OVAL_GUIDE_STYLES,
|
|
1844
|
+
OVAL_REGION_DESKTOP,
|
|
1845
|
+
OVAL_REGION_MOBILE,
|
|
1767
1846
|
RETRY_CONFIG,
|
|
1768
1847
|
TARGET_FACE_PERCENTAGE_IN_CROP,
|
|
1769
1848
|
analyzeBlur,
|
|
@@ -1781,6 +1860,7 @@ export {
|
|
|
1781
1860
|
detectSpecularHighlights,
|
|
1782
1861
|
encodeBase64,
|
|
1783
1862
|
generateSessionId,
|
|
1863
|
+
getActiveModels,
|
|
1784
1864
|
getApiErrorMessage,
|
|
1785
1865
|
getCaptureQualityFeedback,
|
|
1786
1866
|
getEyeRegionBounds,
|
|
@@ -1789,6 +1869,7 @@ export {
|
|
|
1789
1869
|
getOvalGuideState,
|
|
1790
1870
|
getStatusMessage,
|
|
1791
1871
|
hasEnoughFrames,
|
|
1872
|
+
isDeprecatedModel,
|
|
1792
1873
|
isFaceCropFullyInFrame,
|
|
1793
1874
|
isFaceFullyVisible,
|
|
1794
1875
|
isFaceInOval,
|