@moveris/shared 3.3.1 → 3.6.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 CHANGED
@@ -161,8 +161,11 @@ interface HealthResponse {
161
161
  dependencies?: Record<string, unknown>;
162
162
  }
163
163
  interface ErrorResponse {
164
- error: string;
164
+ errors?: Array<Record<string, string[]>>;
165
165
  message: string;
166
+ success?: false;
167
+ data?: null;
168
+ error?: string;
166
169
  required?: number;
167
170
  received?: number;
168
171
  }
@@ -479,6 +482,56 @@ interface StabilizerConfig {
479
482
  }
480
483
  declare const DEFAULT_STABILIZER_CONFIG: StabilizerConfig;
481
484
 
485
+ interface CameraCapabilities {
486
+ deviceId: string;
487
+ label: string;
488
+ facingMode: string[];
489
+ resolution: {
490
+ width: {
491
+ min: number;
492
+ max: number;
493
+ };
494
+ height: {
495
+ min: number;
496
+ max: number;
497
+ };
498
+ };
499
+ frameRate: {
500
+ min: number;
501
+ max: number;
502
+ };
503
+ currentSettings: {
504
+ width: number;
505
+ height: number;
506
+ frameRate: number;
507
+ facingMode?: string;
508
+ };
509
+ zoom?: {
510
+ min: number;
511
+ max: number;
512
+ step: number;
513
+ };
514
+ torch?: boolean;
515
+ focusModes?: string[];
516
+ exposureModes?: string[];
517
+ whiteBalanceModes?: string[];
518
+ }
519
+ interface CameraRequirements {
520
+ minWidth: number;
521
+ minHeight: number;
522
+ minFrameRate: number;
523
+ idealWidth: number;
524
+ idealHeight: number;
525
+ idealFrameRate: number;
526
+ }
527
+ interface CameraValidationResult {
528
+ meetsMinimum: boolean;
529
+ meetsIdeal: boolean;
530
+ warnings: string[];
531
+ capabilities: CameraCapabilities;
532
+ }
533
+ declare const DEFAULT_CAMERA_REQUIREMENTS: CameraRequirements;
534
+
482
535
  interface LivenessClientConfig {
483
536
  baseUrl?: string;
484
537
  apiKey: string;
@@ -849,4 +902,4 @@ declare function analyzeEyeRegionContrast(pixels: Uint8Array | Uint8ClampedArray
849
902
  declare function detectSpecularHighlights(pixels: Uint8Array | Uint8ClampedArray, relativeFactor?: number, meanBrightness?: number): number;
850
903
  declare function checkEyeRegionQuality(pixels: Uint8Array | Uint8ClampedArray, thresholds?: EyeQualityThresholds): EyeRegionQuality;
851
904
 
852
- 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 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DynamicRangeAnalysis, 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 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, 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, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, 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, 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, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, 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 };
905
+ 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 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 DynamicRangeAnalysis, 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 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, 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, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, 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, 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, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, 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 };
package/dist/index.d.ts CHANGED
@@ -161,8 +161,11 @@ interface HealthResponse {
161
161
  dependencies?: Record<string, unknown>;
162
162
  }
163
163
  interface ErrorResponse {
164
- error: string;
164
+ errors?: Array<Record<string, string[]>>;
165
165
  message: string;
166
+ success?: false;
167
+ data?: null;
168
+ error?: string;
166
169
  required?: number;
167
170
  received?: number;
168
171
  }
@@ -479,6 +482,56 @@ interface StabilizerConfig {
479
482
  }
480
483
  declare const DEFAULT_STABILIZER_CONFIG: StabilizerConfig;
481
484
 
485
+ interface CameraCapabilities {
486
+ deviceId: string;
487
+ label: string;
488
+ facingMode: string[];
489
+ resolution: {
490
+ width: {
491
+ min: number;
492
+ max: number;
493
+ };
494
+ height: {
495
+ min: number;
496
+ max: number;
497
+ };
498
+ };
499
+ frameRate: {
500
+ min: number;
501
+ max: number;
502
+ };
503
+ currentSettings: {
504
+ width: number;
505
+ height: number;
506
+ frameRate: number;
507
+ facingMode?: string;
508
+ };
509
+ zoom?: {
510
+ min: number;
511
+ max: number;
512
+ step: number;
513
+ };
514
+ torch?: boolean;
515
+ focusModes?: string[];
516
+ exposureModes?: string[];
517
+ whiteBalanceModes?: string[];
518
+ }
519
+ interface CameraRequirements {
520
+ minWidth: number;
521
+ minHeight: number;
522
+ minFrameRate: number;
523
+ idealWidth: number;
524
+ idealHeight: number;
525
+ idealFrameRate: number;
526
+ }
527
+ interface CameraValidationResult {
528
+ meetsMinimum: boolean;
529
+ meetsIdeal: boolean;
530
+ warnings: string[];
531
+ capabilities: CameraCapabilities;
532
+ }
533
+ declare const DEFAULT_CAMERA_REQUIREMENTS: CameraRequirements;
534
+
482
535
  interface LivenessClientConfig {
483
536
  baseUrl?: string;
484
537
  apiKey: string;
@@ -849,4 +902,4 @@ declare function analyzeEyeRegionContrast(pixels: Uint8Array | Uint8ClampedArray
849
902
  declare function detectSpecularHighlights(pixels: Uint8Array | Uint8ClampedArray, relativeFactor?: number, meanBrightness?: number): number;
850
903
  declare function checkEyeRegionQuality(pixels: Uint8Array | Uint8ClampedArray, thresholds?: EyeQualityThresholds): EyeRegionQuality;
851
904
 
852
- 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 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DynamicRangeAnalysis, 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 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, 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, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, 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, 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, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, 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 };
905
+ 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 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 DynamicRangeAnalysis, 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 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, 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, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, 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, 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, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, 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 };
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  CAMERA_ANGLE_HIGH_RATIO: () => CAMERA_ANGLE_HIGH_RATIO,
35
35
  CAMERA_ANGLE_LOW_RATIO: () => CAMERA_ANGLE_LOW_RATIO,
36
36
  DEFAULT_BLUR_THRESHOLD: () => DEFAULT_BLUR_THRESHOLD,
37
+ DEFAULT_CAMERA_REQUIREMENTS: () => DEFAULT_CAMERA_REQUIREMENTS,
37
38
  DEFAULT_ENDPOINT: () => DEFAULT_ENDPOINT,
38
39
  DEFAULT_FACE_DETECTION_TIERS: () => DEFAULT_FACE_DETECTION_TIERS,
39
40
  DEFAULT_GAZE_THRESHOLDS: () => DEFAULT_GAZE_THRESHOLDS,
@@ -341,7 +342,8 @@ var LivenessClient = class _LivenessClient {
341
342
  if (!response.ok) {
342
343
  throw await this.parseErrorResponse(response);
343
344
  }
344
- const data = await response.json();
345
+ const json = await response.json();
346
+ const data = "data" in json && "success" in json ? json.data : json;
345
347
  return { data, headers: response.headers };
346
348
  } catch (error) {
347
349
  clearTimeout(timeoutId);
@@ -361,11 +363,14 @@ var LivenessClient = class _LivenessClient {
361
363
  /**
362
364
  * Parse an error response body, handling both JSON and non-JSON bodies.
363
365
  *
364
- * The backend sometimes wraps the real error in a generic envelope:
366
+ * Handles the new v2 envelope error format:
367
+ * ```json
368
+ * { "data": null, "success": false, "message": "...", "errors": [{ "error_code": ["detail"] }] }
369
+ * ```
370
+ * Falls back to the legacy format:
365
371
  * ```json
366
372
  * { "error": "http_error", "message": "{'error': 'session_expired', ...}" }
367
373
  * ```
368
- * This method unwraps such envelopes to extract the real error code.
369
374
  */
370
375
  async parseErrorResponse(response) {
371
376
  const status = response.status;
@@ -376,16 +381,29 @@ var LivenessClient = class _LivenessClient {
376
381
  return new LivenessApiError(`Request failed with status ${status}`, "server_error", status);
377
382
  }
378
383
  try {
379
- const data = JSON.parse(body);
380
- if (data.error) {
381
- const realCode = _LivenessClient.unwrapErrorCode(data.error, data.message);
382
- const realMessage = _LivenessClient.unwrapErrorMessage(data.message);
384
+ const json = JSON.parse(body);
385
+ if (Array.isArray(json.errors) && json.errors.length > 0) {
386
+ const errorEntry = json.errors[0];
387
+ if (errorEntry) {
388
+ const errorCode = Object.keys(errorEntry)[0] ?? "server_error";
389
+ const msgs = errorEntry[errorCode];
390
+ const errorMessage = Array.isArray(msgs) && msgs.length > 0 ? msgs[0] : void 0;
391
+ return new LivenessApiError(
392
+ errorMessage ?? json.message ?? `Request failed (${errorCode})`,
393
+ errorCode,
394
+ status
395
+ );
396
+ }
397
+ }
398
+ if (json.error) {
399
+ const realCode = _LivenessClient.unwrapErrorCode(json.error, json.message);
400
+ const realMessage = _LivenessClient.unwrapErrorMessage(json.message);
383
401
  return new LivenessApiError(
384
402
  realMessage ?? `Request failed (${realCode})`,
385
403
  realCode,
386
404
  status,
387
- data.required,
388
- data.received
405
+ json.required,
406
+ json.received
389
407
  );
390
408
  }
391
409
  } catch {
@@ -1240,6 +1258,16 @@ var DEFAULT_STABILIZER_CONFIG = {
1240
1258
  sampleSize: 64
1241
1259
  };
1242
1260
 
1261
+ // src/types/camera.ts
1262
+ var DEFAULT_CAMERA_REQUIREMENTS = {
1263
+ minWidth: 640,
1264
+ minHeight: 480,
1265
+ minFrameRate: 15,
1266
+ idealWidth: 1920,
1267
+ idealHeight: 1080,
1268
+ idealFrameRate: 30
1269
+ };
1270
+
1243
1271
  // src/constants/errors.ts
1244
1272
  var API_ERROR_CODES = {
1245
1273
  SESSION_EXPIRED: "session_expired",
@@ -2212,6 +2240,7 @@ function checkEyeRegionQuality(pixels, thresholds = EYE_QUALITY_THRESHOLDS) {
2212
2240
  CAMERA_ANGLE_HIGH_RATIO,
2213
2241
  CAMERA_ANGLE_LOW_RATIO,
2214
2242
  DEFAULT_BLUR_THRESHOLD,
2243
+ DEFAULT_CAMERA_REQUIREMENTS,
2215
2244
  DEFAULT_ENDPOINT,
2216
2245
  DEFAULT_FACE_DETECTION_TIERS,
2217
2246
  DEFAULT_GAZE_THRESHOLDS,
package/dist/index.mjs CHANGED
@@ -198,7 +198,8 @@ var LivenessClient = class _LivenessClient {
198
198
  if (!response.ok) {
199
199
  throw await this.parseErrorResponse(response);
200
200
  }
201
- const data = await response.json();
201
+ const json = await response.json();
202
+ const data = "data" in json && "success" in json ? json.data : json;
202
203
  return { data, headers: response.headers };
203
204
  } catch (error) {
204
205
  clearTimeout(timeoutId);
@@ -218,11 +219,14 @@ var LivenessClient = class _LivenessClient {
218
219
  /**
219
220
  * Parse an error response body, handling both JSON and non-JSON bodies.
220
221
  *
221
- * The backend sometimes wraps the real error in a generic envelope:
222
+ * Handles the new v2 envelope error format:
223
+ * ```json
224
+ * { "data": null, "success": false, "message": "...", "errors": [{ "error_code": ["detail"] }] }
225
+ * ```
226
+ * Falls back to the legacy format:
222
227
  * ```json
223
228
  * { "error": "http_error", "message": "{'error': 'session_expired', ...}" }
224
229
  * ```
225
- * This method unwraps such envelopes to extract the real error code.
226
230
  */
227
231
  async parseErrorResponse(response) {
228
232
  const status = response.status;
@@ -233,16 +237,29 @@ var LivenessClient = class _LivenessClient {
233
237
  return new LivenessApiError(`Request failed with status ${status}`, "server_error", status);
234
238
  }
235
239
  try {
236
- const data = JSON.parse(body);
237
- if (data.error) {
238
- const realCode = _LivenessClient.unwrapErrorCode(data.error, data.message);
239
- const realMessage = _LivenessClient.unwrapErrorMessage(data.message);
240
+ const json = JSON.parse(body);
241
+ if (Array.isArray(json.errors) && json.errors.length > 0) {
242
+ const errorEntry = json.errors[0];
243
+ if (errorEntry) {
244
+ const errorCode = Object.keys(errorEntry)[0] ?? "server_error";
245
+ const msgs = errorEntry[errorCode];
246
+ const errorMessage = Array.isArray(msgs) && msgs.length > 0 ? msgs[0] : void 0;
247
+ return new LivenessApiError(
248
+ errorMessage ?? json.message ?? `Request failed (${errorCode})`,
249
+ errorCode,
250
+ status
251
+ );
252
+ }
253
+ }
254
+ if (json.error) {
255
+ const realCode = _LivenessClient.unwrapErrorCode(json.error, json.message);
256
+ const realMessage = _LivenessClient.unwrapErrorMessage(json.message);
240
257
  return new LivenessApiError(
241
258
  realMessage ?? `Request failed (${realCode})`,
242
259
  realCode,
243
260
  status,
244
- data.required,
245
- data.received
261
+ json.required,
262
+ json.received
246
263
  );
247
264
  }
248
265
  } catch {
@@ -1097,6 +1114,16 @@ var DEFAULT_STABILIZER_CONFIG = {
1097
1114
  sampleSize: 64
1098
1115
  };
1099
1116
 
1117
+ // src/types/camera.ts
1118
+ var DEFAULT_CAMERA_REQUIREMENTS = {
1119
+ minWidth: 640,
1120
+ minHeight: 480,
1121
+ minFrameRate: 15,
1122
+ idealWidth: 1920,
1123
+ idealHeight: 1080,
1124
+ idealFrameRate: 30
1125
+ };
1126
+
1100
1127
  // src/constants/errors.ts
1101
1128
  var API_ERROR_CODES = {
1102
1129
  SESSION_EXPIRED: "session_expired",
@@ -2068,6 +2095,7 @@ export {
2068
2095
  CAMERA_ANGLE_HIGH_RATIO,
2069
2096
  CAMERA_ANGLE_LOW_RATIO,
2070
2097
  DEFAULT_BLUR_THRESHOLD,
2098
+ DEFAULT_CAMERA_REQUIREMENTS,
2071
2099
  DEFAULT_ENDPOINT,
2072
2100
  DEFAULT_FACE_DETECTION_TIERS,
2073
2101
  DEFAULT_GAZE_THRESHOLDS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moveris/shared",
3
- "version": "3.3.1",
3
+ "version": "3.6.0",
4
4
  "description": "Core business logic for Moveris Live SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",