@moveris/shared 3.13.0 → 3.15.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 +73 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +116 -2
- package/dist/index.mjs +115 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -98,6 +98,43 @@ interface LiveCheckRequest {
|
|
|
98
98
|
consumer?: ConsumerContext;
|
|
99
99
|
} | null;
|
|
100
100
|
}
|
|
101
|
+
interface V2UploadFrameData extends FrameData {
|
|
102
|
+
landmarks?: {
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
z: number;
|
|
106
|
+
}[] | null;
|
|
107
|
+
}
|
|
108
|
+
interface V2UploadRequest {
|
|
109
|
+
session_id: string;
|
|
110
|
+
model?: FastCheckModel;
|
|
111
|
+
source?: FrameSource;
|
|
112
|
+
fps?: number;
|
|
113
|
+
frames: V2UploadFrameData[];
|
|
114
|
+
frame_count?: number;
|
|
115
|
+
warnings?: string[];
|
|
116
|
+
}
|
|
117
|
+
interface V2UploadResponse {
|
|
118
|
+
session_id: string;
|
|
119
|
+
frames_received: number;
|
|
120
|
+
frames_required: number;
|
|
121
|
+
is_complete: boolean;
|
|
122
|
+
ttl_seconds: number;
|
|
123
|
+
stored_durable: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface V2FastCheckRequest {
|
|
126
|
+
session_id: string;
|
|
127
|
+
model?: FastCheckModel;
|
|
128
|
+
source?: FrameSource;
|
|
129
|
+
fps?: number;
|
|
130
|
+
frame_count?: number;
|
|
131
|
+
warnings?: string[];
|
|
132
|
+
device_intelligence?: DeviceIntelligence;
|
|
133
|
+
metadata?: {
|
|
134
|
+
consumer?: ConsumerContext;
|
|
135
|
+
} | null;
|
|
136
|
+
}
|
|
137
|
+
type V2LiveCheckRequest = V2FastCheckRequest;
|
|
101
138
|
interface FastCheckCropsRequest {
|
|
102
139
|
session_id: string;
|
|
103
140
|
model?: FastCheckModel;
|
|
@@ -622,6 +659,9 @@ declare class LivenessApiError extends Error {
|
|
|
622
659
|
constructor(message: string, code: string, statusCode: number, required?: number, received?: number);
|
|
623
660
|
}
|
|
624
661
|
declare function toFrameData(frames: CapturedFrame[]): FrameData[];
|
|
662
|
+
declare function toV2UploadFrameData(frames: CapturedFrame[], options?: {
|
|
663
|
+
withLandmarks?: boolean;
|
|
664
|
+
}): V2UploadFrameData[];
|
|
625
665
|
declare function toHybridFrameData(frames: CapturedFrame[]): HybridFrameData[];
|
|
626
666
|
declare function toLivenessResult(response: FastCheckResponse | VerifyResponse | HybridCheckResponse): LivenessResult;
|
|
627
667
|
declare function toLivenessResultFromStream(response: FastCheckStreamResponse): LivenessResult;
|
|
@@ -735,6 +775,35 @@ declare class LivenessClient {
|
|
|
735
775
|
}): Promise<LivenessResult>;
|
|
736
776
|
getJobResult(jobId: string): Promise<JobStatusResponse>;
|
|
737
777
|
waitForJobResult(jobId: string, timeout?: number): Promise<JobStatusResponse>;
|
|
778
|
+
v2Upload(frames: CapturedFrame[], options: {
|
|
779
|
+
sessionId: string;
|
|
780
|
+
model?: FastCheckModel;
|
|
781
|
+
modelVersion?: ModelVersion;
|
|
782
|
+
source?: FrameSource;
|
|
783
|
+
fps?: number;
|
|
784
|
+
frameCount?: number;
|
|
785
|
+
warnings?: string[];
|
|
786
|
+
withLandmarks?: boolean;
|
|
787
|
+
}): Promise<V2UploadResponse>;
|
|
788
|
+
v2FastCheck(options: {
|
|
789
|
+
sessionId: string;
|
|
790
|
+
model?: FastCheckModel;
|
|
791
|
+
modelVersion?: ModelVersion;
|
|
792
|
+
source?: FrameSource;
|
|
793
|
+
fps?: number;
|
|
794
|
+
frameCount?: number;
|
|
795
|
+
warnings?: string[];
|
|
796
|
+
}): Promise<LivenessResult>;
|
|
797
|
+
v2LiveCheck(options: {
|
|
798
|
+
sessionId: string;
|
|
799
|
+
model?: FastCheckModel;
|
|
800
|
+
modelVersion?: ModelVersion;
|
|
801
|
+
source?: FrameSource;
|
|
802
|
+
fps?: number;
|
|
803
|
+
frameCount?: number;
|
|
804
|
+
warnings?: string[];
|
|
805
|
+
}): Promise<LivenessResult>;
|
|
806
|
+
private runV2Check;
|
|
738
807
|
}
|
|
739
808
|
|
|
740
809
|
declare class FrameBuffer {
|
|
@@ -789,6 +858,9 @@ declare const API_PATHS: {
|
|
|
789
858
|
readonly jobResult: "/api/v1/result";
|
|
790
859
|
readonly queueStats: "/api/v1/queue/stats";
|
|
791
860
|
readonly sessions: "/api/v1/sessions";
|
|
861
|
+
readonly v2Upload: "/api/v2/upload";
|
|
862
|
+
readonly v2FastCheck: "/api/v2/fast-check";
|
|
863
|
+
readonly v2LiveCheck: "/api/v2/live-check";
|
|
792
864
|
};
|
|
793
865
|
declare const RETRY_CONFIG: {
|
|
794
866
|
readonly maxAttempts: 3;
|
|
@@ -1003,4 +1075,4 @@ declare function collectDeviceIntelligence(opts?: {
|
|
|
1003
1075
|
platformVersion?: string;
|
|
1004
1076
|
}): Promise<DeviceIntelligence | null>;
|
|
1005
1077
|
|
|
1006
|
-
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, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, 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, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, type LiveCheckFrameData, type LiveCheckRequest, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, 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, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
|
1078
|
+
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, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, 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, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, type LiveCheckFrameData, type LiveCheckRequest, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, 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, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type V2FastCheckRequest, type V2LiveCheckRequest, type V2UploadFrameData, type V2UploadRequest, type V2UploadResponse, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, toV2UploadFrameData, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -98,6 +98,43 @@ interface LiveCheckRequest {
|
|
|
98
98
|
consumer?: ConsumerContext;
|
|
99
99
|
} | null;
|
|
100
100
|
}
|
|
101
|
+
interface V2UploadFrameData extends FrameData {
|
|
102
|
+
landmarks?: {
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
z: number;
|
|
106
|
+
}[] | null;
|
|
107
|
+
}
|
|
108
|
+
interface V2UploadRequest {
|
|
109
|
+
session_id: string;
|
|
110
|
+
model?: FastCheckModel;
|
|
111
|
+
source?: FrameSource;
|
|
112
|
+
fps?: number;
|
|
113
|
+
frames: V2UploadFrameData[];
|
|
114
|
+
frame_count?: number;
|
|
115
|
+
warnings?: string[];
|
|
116
|
+
}
|
|
117
|
+
interface V2UploadResponse {
|
|
118
|
+
session_id: string;
|
|
119
|
+
frames_received: number;
|
|
120
|
+
frames_required: number;
|
|
121
|
+
is_complete: boolean;
|
|
122
|
+
ttl_seconds: number;
|
|
123
|
+
stored_durable: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface V2FastCheckRequest {
|
|
126
|
+
session_id: string;
|
|
127
|
+
model?: FastCheckModel;
|
|
128
|
+
source?: FrameSource;
|
|
129
|
+
fps?: number;
|
|
130
|
+
frame_count?: number;
|
|
131
|
+
warnings?: string[];
|
|
132
|
+
device_intelligence?: DeviceIntelligence;
|
|
133
|
+
metadata?: {
|
|
134
|
+
consumer?: ConsumerContext;
|
|
135
|
+
} | null;
|
|
136
|
+
}
|
|
137
|
+
type V2LiveCheckRequest = V2FastCheckRequest;
|
|
101
138
|
interface FastCheckCropsRequest {
|
|
102
139
|
session_id: string;
|
|
103
140
|
model?: FastCheckModel;
|
|
@@ -622,6 +659,9 @@ declare class LivenessApiError extends Error {
|
|
|
622
659
|
constructor(message: string, code: string, statusCode: number, required?: number, received?: number);
|
|
623
660
|
}
|
|
624
661
|
declare function toFrameData(frames: CapturedFrame[]): FrameData[];
|
|
662
|
+
declare function toV2UploadFrameData(frames: CapturedFrame[], options?: {
|
|
663
|
+
withLandmarks?: boolean;
|
|
664
|
+
}): V2UploadFrameData[];
|
|
625
665
|
declare function toHybridFrameData(frames: CapturedFrame[]): HybridFrameData[];
|
|
626
666
|
declare function toLivenessResult(response: FastCheckResponse | VerifyResponse | HybridCheckResponse): LivenessResult;
|
|
627
667
|
declare function toLivenessResultFromStream(response: FastCheckStreamResponse): LivenessResult;
|
|
@@ -735,6 +775,35 @@ declare class LivenessClient {
|
|
|
735
775
|
}): Promise<LivenessResult>;
|
|
736
776
|
getJobResult(jobId: string): Promise<JobStatusResponse>;
|
|
737
777
|
waitForJobResult(jobId: string, timeout?: number): Promise<JobStatusResponse>;
|
|
778
|
+
v2Upload(frames: CapturedFrame[], options: {
|
|
779
|
+
sessionId: string;
|
|
780
|
+
model?: FastCheckModel;
|
|
781
|
+
modelVersion?: ModelVersion;
|
|
782
|
+
source?: FrameSource;
|
|
783
|
+
fps?: number;
|
|
784
|
+
frameCount?: number;
|
|
785
|
+
warnings?: string[];
|
|
786
|
+
withLandmarks?: boolean;
|
|
787
|
+
}): Promise<V2UploadResponse>;
|
|
788
|
+
v2FastCheck(options: {
|
|
789
|
+
sessionId: string;
|
|
790
|
+
model?: FastCheckModel;
|
|
791
|
+
modelVersion?: ModelVersion;
|
|
792
|
+
source?: FrameSource;
|
|
793
|
+
fps?: number;
|
|
794
|
+
frameCount?: number;
|
|
795
|
+
warnings?: string[];
|
|
796
|
+
}): Promise<LivenessResult>;
|
|
797
|
+
v2LiveCheck(options: {
|
|
798
|
+
sessionId: string;
|
|
799
|
+
model?: FastCheckModel;
|
|
800
|
+
modelVersion?: ModelVersion;
|
|
801
|
+
source?: FrameSource;
|
|
802
|
+
fps?: number;
|
|
803
|
+
frameCount?: number;
|
|
804
|
+
warnings?: string[];
|
|
805
|
+
}): Promise<LivenessResult>;
|
|
806
|
+
private runV2Check;
|
|
738
807
|
}
|
|
739
808
|
|
|
740
809
|
declare class FrameBuffer {
|
|
@@ -789,6 +858,9 @@ declare const API_PATHS: {
|
|
|
789
858
|
readonly jobResult: "/api/v1/result";
|
|
790
859
|
readonly queueStats: "/api/v1/queue/stats";
|
|
791
860
|
readonly sessions: "/api/v1/sessions";
|
|
861
|
+
readonly v2Upload: "/api/v2/upload";
|
|
862
|
+
readonly v2FastCheck: "/api/v2/fast-check";
|
|
863
|
+
readonly v2LiveCheck: "/api/v2/live-check";
|
|
792
864
|
};
|
|
793
865
|
declare const RETRY_CONFIG: {
|
|
794
866
|
readonly maxAttempts: 3;
|
|
@@ -1003,4 +1075,4 @@ declare function collectDeviceIntelligence(opts?: {
|
|
|
1003
1075
|
platformVersion?: string;
|
|
1004
1076
|
}): Promise<DeviceIntelligence | null>;
|
|
1005
1077
|
|
|
1006
|
-
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, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, 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, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, type LiveCheckFrameData, type LiveCheckRequest, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, 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, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
|
1078
|
+
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, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, 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, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, type LiveCheckFrameData, type LiveCheckRequest, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, 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, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type V2FastCheckRequest, type V2LiveCheckRequest, type V2UploadFrameData, type V2UploadRequest, type V2UploadResponse, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, toV2UploadFrameData, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
package/dist/index.js
CHANGED
|
@@ -129,6 +129,7 @@ __export(index_exports, {
|
|
|
129
129
|
toHybridFrameData: () => toHybridFrameData,
|
|
130
130
|
toLivenessResult: () => toLivenessResult,
|
|
131
131
|
toLivenessResultFromStream: () => toLivenessResultFromStream,
|
|
132
|
+
toV2UploadFrameData: () => toV2UploadFrameData,
|
|
132
133
|
validateApiKey: () => validateApiKey,
|
|
133
134
|
validateFaceLandmarks: () => validateFaceLandmarks,
|
|
134
135
|
validateFrameCount: () => validateFrameCount,
|
|
@@ -161,7 +162,12 @@ var API_PATHS = {
|
|
|
161
162
|
hybrid150: "/api/v1/hybrid-150",
|
|
162
163
|
jobResult: "/api/v1/result",
|
|
163
164
|
queueStats: "/api/v1/queue/stats",
|
|
164
|
-
sessions: "/api/v1/sessions"
|
|
165
|
+
sessions: "/api/v1/sessions",
|
|
166
|
+
// v2 upload-first pipeline (MOV-1936). Separate from v1; frames are uploaded
|
|
167
|
+
// first and resolved server-side by session_id at check time.
|
|
168
|
+
v2Upload: "/api/v2/upload",
|
|
169
|
+
v2FastCheck: "/api/v2/fast-check",
|
|
170
|
+
v2LiveCheck: "/api/v2/live-check"
|
|
165
171
|
};
|
|
166
172
|
var RETRY_CONFIG = {
|
|
167
173
|
maxAttempts: 3,
|
|
@@ -241,7 +247,7 @@ async function sleep(ms) {
|
|
|
241
247
|
}
|
|
242
248
|
|
|
243
249
|
// package.json
|
|
244
|
-
var version = "3.
|
|
250
|
+
var version = "3.15.0";
|
|
245
251
|
|
|
246
252
|
// src/utils/deviceIntelligence.ts
|
|
247
253
|
var IPINFO_URL = "https://ipinfo.io/json";
|
|
@@ -315,6 +321,16 @@ function toFrameData(frames) {
|
|
|
315
321
|
pixels: frame.pixels
|
|
316
322
|
}));
|
|
317
323
|
}
|
|
324
|
+
function toV2UploadFrameData(frames, options = {}) {
|
|
325
|
+
return frames.map((frame) => ({
|
|
326
|
+
index: frame.index,
|
|
327
|
+
timestamp_ms: frame.timestampMs,
|
|
328
|
+
pixels: frame.pixels,
|
|
329
|
+
...options.withLandmarks ? {
|
|
330
|
+
landmarks: frame.landmarks ? frame.landmarks.map((lm) => ({ x: lm.x, y: lm.y, z: lm.z })) : null
|
|
331
|
+
} : {}
|
|
332
|
+
}));
|
|
333
|
+
}
|
|
318
334
|
function toHybridFrameData(frames) {
|
|
319
335
|
return frames.map((frame) => ({
|
|
320
336
|
timestamp_ms: frame.timestampMs,
|
|
@@ -1057,6 +1073,103 @@ var LivenessClient = class _LivenessClient {
|
|
|
1057
1073
|
`${API_PATHS.jobResult}/${jobId}/wait?timeout=${timeout}`
|
|
1058
1074
|
);
|
|
1059
1075
|
}
|
|
1076
|
+
// ===========================================================================
|
|
1077
|
+
// v2 Pipeline (MOV-1936): upload-first
|
|
1078
|
+
//
|
|
1079
|
+
// Two-phase flow, fully separate from the v1 endpoints above:
|
|
1080
|
+
// 1. v2Upload() — buffer frames server-side (call once or repeatedly).
|
|
1081
|
+
// 2. v2FastCheck() / v2LiveCheck() — run inference; NO frames in the body,
|
|
1082
|
+
// the server resolves them by session_id from the prior upload(s).
|
|
1083
|
+
// The check responses reuse the v1 FastCheckResponse shape, so the existing
|
|
1084
|
+
// `toLivenessResult` + deprecation-header handling applies unchanged.
|
|
1085
|
+
// ===========================================================================
|
|
1086
|
+
/**
|
|
1087
|
+
* Buffer a batch of frames for a session (POST /api/v2/upload).
|
|
1088
|
+
*
|
|
1089
|
+
* Inference is NOT run here — this only stores frames keyed by `session_id`.
|
|
1090
|
+
* May be called multiple times for the same session (e.g. chunked during
|
|
1091
|
+
* capture); the server accumulates and reports cumulative progress.
|
|
1092
|
+
*
|
|
1093
|
+
* Set `withLandmarks` for the live-check path so MediaPipe landmarks travel
|
|
1094
|
+
* with each frame; leave it off for the fast-check path.
|
|
1095
|
+
*
|
|
1096
|
+
* @param frames - Captured frames to buffer
|
|
1097
|
+
* @param options - Session, model, source and upload flags
|
|
1098
|
+
* @returns Upload progress (frames_received / frames_required / is_complete)
|
|
1099
|
+
*/
|
|
1100
|
+
async v2Upload(frames, options) {
|
|
1101
|
+
const effectiveVersion = options.modelVersion ?? this.modelVersion;
|
|
1102
|
+
const request = {
|
|
1103
|
+
session_id: options.sessionId,
|
|
1104
|
+
model: options.model ?? "10",
|
|
1105
|
+
source: options.source ?? "live",
|
|
1106
|
+
frames: toV2UploadFrameData(frames, { withLandmarks: options.withLandmarks }),
|
|
1107
|
+
...options.fps != null ? { fps: options.fps } : {},
|
|
1108
|
+
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
1109
|
+
...options.warnings?.length ? { warnings: options.warnings } : {}
|
|
1110
|
+
};
|
|
1111
|
+
return this.requestWithRetry(API_PATHS.v2Upload, {
|
|
1112
|
+
method: "POST",
|
|
1113
|
+
body: JSON.stringify(request),
|
|
1114
|
+
headers: this.buildModelVersionHeaders(effectiveVersion)
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Run a fast-check against frames previously uploaded via {@link v2Upload}
|
|
1119
|
+
* (POST /api/v2/fast-check). The request carries NO frames — the server
|
|
1120
|
+
* resolves them by `session_id`.
|
|
1121
|
+
*
|
|
1122
|
+
* @param options - Session and request context
|
|
1123
|
+
* @returns Liveness result
|
|
1124
|
+
*/
|
|
1125
|
+
async v2FastCheck(options) {
|
|
1126
|
+
return this.runV2Check(API_PATHS.v2FastCheck, options);
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Run a live-check against frames previously uploaded via {@link v2Upload}
|
|
1130
|
+
* with `withLandmarks: true` (POST /api/v2/live-check). The request carries
|
|
1131
|
+
* NO frames. The server requires a V3 model and surfaces the V3 `diagnostics`
|
|
1132
|
+
* block on the result.
|
|
1133
|
+
*
|
|
1134
|
+
* @param options - Session and request context
|
|
1135
|
+
* @returns Liveness result (includes `diagnostics`)
|
|
1136
|
+
*/
|
|
1137
|
+
async v2LiveCheck(options) {
|
|
1138
|
+
return this.runV2Check(API_PATHS.v2LiveCheck, options);
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Shared body for the v2 fast-check / live-check requests (internal).
|
|
1142
|
+
* Both endpoints take the identical no-frames payload and response shape;
|
|
1143
|
+
* only the path differs.
|
|
1144
|
+
*/
|
|
1145
|
+
async runV2Check(path, options) {
|
|
1146
|
+
const effectiveVersion = options.modelVersion ?? this.modelVersion;
|
|
1147
|
+
const di = await this.getDeviceIntelligence();
|
|
1148
|
+
const metadata = this.buildMetadata();
|
|
1149
|
+
const request = {
|
|
1150
|
+
session_id: options.sessionId,
|
|
1151
|
+
model: options.model ?? "10",
|
|
1152
|
+
source: options.source ?? "live",
|
|
1153
|
+
...options.fps != null ? { fps: options.fps } : {},
|
|
1154
|
+
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
1155
|
+
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
1156
|
+
...di ? { device_intelligence: di } : {},
|
|
1157
|
+
...metadata ? { metadata } : {}
|
|
1158
|
+
};
|
|
1159
|
+
const { data: response, headers } = await this.requestWithRetryRaw(path, {
|
|
1160
|
+
method: "POST",
|
|
1161
|
+
body: JSON.stringify(request),
|
|
1162
|
+
headers: this.buildModelVersionHeaders(effectiveVersion)
|
|
1163
|
+
});
|
|
1164
|
+
const result = toLivenessResult(response);
|
|
1165
|
+
result.deprecation = _LivenessClient.parseDeprecationHeaders(headers);
|
|
1166
|
+
if (result.deprecation?.deprecated) {
|
|
1167
|
+
console.warn(
|
|
1168
|
+
`[Moveris] Model "${result.deprecation.resolvedModel}" is deprecated.` + (result.deprecation.suggestedModel ? ` Migrate to "${result.deprecation.suggestedModel}".` : "") + (result.deprecation.sunsetDate ? ` Sunset date: ${result.deprecation.sunsetDate}.` : "")
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
return result;
|
|
1172
|
+
}
|
|
1060
1173
|
};
|
|
1061
1174
|
|
|
1062
1175
|
// src/buffer/FrameBuffer.ts
|
|
@@ -2572,6 +2685,7 @@ function checkEyeRegionQuality(pixels, thresholds = EYE_QUALITY_THRESHOLDS) {
|
|
|
2572
2685
|
toHybridFrameData,
|
|
2573
2686
|
toLivenessResult,
|
|
2574
2687
|
toLivenessResultFromStream,
|
|
2688
|
+
toV2UploadFrameData,
|
|
2575
2689
|
validateApiKey,
|
|
2576
2690
|
validateFaceLandmarks,
|
|
2577
2691
|
validateFrameCount,
|
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,12 @@ var API_PATHS = {
|
|
|
19
19
|
hybrid150: "/api/v1/hybrid-150",
|
|
20
20
|
jobResult: "/api/v1/result",
|
|
21
21
|
queueStats: "/api/v1/queue/stats",
|
|
22
|
-
sessions: "/api/v1/sessions"
|
|
22
|
+
sessions: "/api/v1/sessions",
|
|
23
|
+
// v2 upload-first pipeline (MOV-1936). Separate from v1; frames are uploaded
|
|
24
|
+
// first and resolved server-side by session_id at check time.
|
|
25
|
+
v2Upload: "/api/v2/upload",
|
|
26
|
+
v2FastCheck: "/api/v2/fast-check",
|
|
27
|
+
v2LiveCheck: "/api/v2/live-check"
|
|
23
28
|
};
|
|
24
29
|
var RETRY_CONFIG = {
|
|
25
30
|
maxAttempts: 3,
|
|
@@ -99,7 +104,7 @@ async function sleep(ms) {
|
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
// package.json
|
|
102
|
-
var version = "3.
|
|
107
|
+
var version = "3.15.0";
|
|
103
108
|
|
|
104
109
|
// src/utils/deviceIntelligence.ts
|
|
105
110
|
var IPINFO_URL = "https://ipinfo.io/json";
|
|
@@ -173,6 +178,16 @@ function toFrameData(frames) {
|
|
|
173
178
|
pixels: frame.pixels
|
|
174
179
|
}));
|
|
175
180
|
}
|
|
181
|
+
function toV2UploadFrameData(frames, options = {}) {
|
|
182
|
+
return frames.map((frame) => ({
|
|
183
|
+
index: frame.index,
|
|
184
|
+
timestamp_ms: frame.timestampMs,
|
|
185
|
+
pixels: frame.pixels,
|
|
186
|
+
...options.withLandmarks ? {
|
|
187
|
+
landmarks: frame.landmarks ? frame.landmarks.map((lm) => ({ x: lm.x, y: lm.y, z: lm.z })) : null
|
|
188
|
+
} : {}
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
176
191
|
function toHybridFrameData(frames) {
|
|
177
192
|
return frames.map((frame) => ({
|
|
178
193
|
timestamp_ms: frame.timestampMs,
|
|
@@ -915,6 +930,103 @@ var LivenessClient = class _LivenessClient {
|
|
|
915
930
|
`${API_PATHS.jobResult}/${jobId}/wait?timeout=${timeout}`
|
|
916
931
|
);
|
|
917
932
|
}
|
|
933
|
+
// ===========================================================================
|
|
934
|
+
// v2 Pipeline (MOV-1936): upload-first
|
|
935
|
+
//
|
|
936
|
+
// Two-phase flow, fully separate from the v1 endpoints above:
|
|
937
|
+
// 1. v2Upload() — buffer frames server-side (call once or repeatedly).
|
|
938
|
+
// 2. v2FastCheck() / v2LiveCheck() — run inference; NO frames in the body,
|
|
939
|
+
// the server resolves them by session_id from the prior upload(s).
|
|
940
|
+
// The check responses reuse the v1 FastCheckResponse shape, so the existing
|
|
941
|
+
// `toLivenessResult` + deprecation-header handling applies unchanged.
|
|
942
|
+
// ===========================================================================
|
|
943
|
+
/**
|
|
944
|
+
* Buffer a batch of frames for a session (POST /api/v2/upload).
|
|
945
|
+
*
|
|
946
|
+
* Inference is NOT run here — this only stores frames keyed by `session_id`.
|
|
947
|
+
* May be called multiple times for the same session (e.g. chunked during
|
|
948
|
+
* capture); the server accumulates and reports cumulative progress.
|
|
949
|
+
*
|
|
950
|
+
* Set `withLandmarks` for the live-check path so MediaPipe landmarks travel
|
|
951
|
+
* with each frame; leave it off for the fast-check path.
|
|
952
|
+
*
|
|
953
|
+
* @param frames - Captured frames to buffer
|
|
954
|
+
* @param options - Session, model, source and upload flags
|
|
955
|
+
* @returns Upload progress (frames_received / frames_required / is_complete)
|
|
956
|
+
*/
|
|
957
|
+
async v2Upload(frames, options) {
|
|
958
|
+
const effectiveVersion = options.modelVersion ?? this.modelVersion;
|
|
959
|
+
const request = {
|
|
960
|
+
session_id: options.sessionId,
|
|
961
|
+
model: options.model ?? "10",
|
|
962
|
+
source: options.source ?? "live",
|
|
963
|
+
frames: toV2UploadFrameData(frames, { withLandmarks: options.withLandmarks }),
|
|
964
|
+
...options.fps != null ? { fps: options.fps } : {},
|
|
965
|
+
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
966
|
+
...options.warnings?.length ? { warnings: options.warnings } : {}
|
|
967
|
+
};
|
|
968
|
+
return this.requestWithRetry(API_PATHS.v2Upload, {
|
|
969
|
+
method: "POST",
|
|
970
|
+
body: JSON.stringify(request),
|
|
971
|
+
headers: this.buildModelVersionHeaders(effectiveVersion)
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Run a fast-check against frames previously uploaded via {@link v2Upload}
|
|
976
|
+
* (POST /api/v2/fast-check). The request carries NO frames — the server
|
|
977
|
+
* resolves them by `session_id`.
|
|
978
|
+
*
|
|
979
|
+
* @param options - Session and request context
|
|
980
|
+
* @returns Liveness result
|
|
981
|
+
*/
|
|
982
|
+
async v2FastCheck(options) {
|
|
983
|
+
return this.runV2Check(API_PATHS.v2FastCheck, options);
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Run a live-check against frames previously uploaded via {@link v2Upload}
|
|
987
|
+
* with `withLandmarks: true` (POST /api/v2/live-check). The request carries
|
|
988
|
+
* NO frames. The server requires a V3 model and surfaces the V3 `diagnostics`
|
|
989
|
+
* block on the result.
|
|
990
|
+
*
|
|
991
|
+
* @param options - Session and request context
|
|
992
|
+
* @returns Liveness result (includes `diagnostics`)
|
|
993
|
+
*/
|
|
994
|
+
async v2LiveCheck(options) {
|
|
995
|
+
return this.runV2Check(API_PATHS.v2LiveCheck, options);
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Shared body for the v2 fast-check / live-check requests (internal).
|
|
999
|
+
* Both endpoints take the identical no-frames payload and response shape;
|
|
1000
|
+
* only the path differs.
|
|
1001
|
+
*/
|
|
1002
|
+
async runV2Check(path, options) {
|
|
1003
|
+
const effectiveVersion = options.modelVersion ?? this.modelVersion;
|
|
1004
|
+
const di = await this.getDeviceIntelligence();
|
|
1005
|
+
const metadata = this.buildMetadata();
|
|
1006
|
+
const request = {
|
|
1007
|
+
session_id: options.sessionId,
|
|
1008
|
+
model: options.model ?? "10",
|
|
1009
|
+
source: options.source ?? "live",
|
|
1010
|
+
...options.fps != null ? { fps: options.fps } : {},
|
|
1011
|
+
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
1012
|
+
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
1013
|
+
...di ? { device_intelligence: di } : {},
|
|
1014
|
+
...metadata ? { metadata } : {}
|
|
1015
|
+
};
|
|
1016
|
+
const { data: response, headers } = await this.requestWithRetryRaw(path, {
|
|
1017
|
+
method: "POST",
|
|
1018
|
+
body: JSON.stringify(request),
|
|
1019
|
+
headers: this.buildModelVersionHeaders(effectiveVersion)
|
|
1020
|
+
});
|
|
1021
|
+
const result = toLivenessResult(response);
|
|
1022
|
+
result.deprecation = _LivenessClient.parseDeprecationHeaders(headers);
|
|
1023
|
+
if (result.deprecation?.deprecated) {
|
|
1024
|
+
console.warn(
|
|
1025
|
+
`[Moveris] Model "${result.deprecation.resolvedModel}" is deprecated.` + (result.deprecation.suggestedModel ? ` Migrate to "${result.deprecation.suggestedModel}".` : "") + (result.deprecation.sunsetDate ? ` Sunset date: ${result.deprecation.sunsetDate}.` : "")
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
return result;
|
|
1029
|
+
}
|
|
918
1030
|
};
|
|
919
1031
|
|
|
920
1032
|
// src/buffer/FrameBuffer.ts
|
|
@@ -2429,6 +2541,7 @@ export {
|
|
|
2429
2541
|
toHybridFrameData,
|
|
2430
2542
|
toLivenessResult,
|
|
2431
2543
|
toLivenessResultFromStream,
|
|
2544
|
+
toV2UploadFrameData,
|
|
2432
2545
|
validateApiKey,
|
|
2433
2546
|
validateFaceLandmarks,
|
|
2434
2547
|
validateFrameCount,
|