@hexar/biometric-identity-sdk-core 1.0.19 → 1.0.20
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.
|
@@ -25,7 +25,7 @@ class BiometricIdentitySDK {
|
|
|
25
25
|
encryptionKey: config.encryptionKey || '',
|
|
26
26
|
minMatchScore: config.minMatchScore || 85,
|
|
27
27
|
minLivenessScore: config.minLivenessScore || 80,
|
|
28
|
-
validationTimeout: config.validationTimeout ||
|
|
28
|
+
validationTimeout: config.validationTimeout || 180000, // 180 seconds (3 minutes) to handle large payloads
|
|
29
29
|
modelPaths: {},
|
|
30
30
|
};
|
|
31
31
|
this.state = {
|
|
@@ -299,7 +299,7 @@ class BiometricIdentitySDK {
|
|
|
299
299
|
minimumRequired: 10
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
|
-
const MAX_FRAMES =
|
|
302
|
+
const MAX_FRAMES = 5; // Reduced to 5 to reduce payload size and processing time
|
|
303
303
|
if (videoFrames.length > MAX_FRAMES) {
|
|
304
304
|
const step = Math.floor(videoFrames.length / MAX_FRAMES);
|
|
305
305
|
videoFrames = videoFrames.filter((_, index) => index % step === 0).slice(0, MAX_FRAMES);
|
|
@@ -364,14 +364,24 @@ class BiometricIdentitySDK {
|
|
|
364
364
|
errorData: error?.errorData,
|
|
365
365
|
errorStack: error?.stack?.substring(0, 500)
|
|
366
366
|
});
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
367
|
+
// Handle timeout specifically with better error message
|
|
368
|
+
const isTimeout = error?.message?.includes('timeout') || error?.message?.includes('Request timeout') || error?.message?.includes('AbortError');
|
|
369
|
+
const errorMessage = isTimeout
|
|
370
|
+
? 'La validación está tomando demasiado tiempo. Por favor, verifica tu conexión e intenta nuevamente.'
|
|
371
|
+
: (error?.message || (error?.status ? `Backend request failed with status ${error.status}` : 'Backend validation failed'));
|
|
372
|
+
const errorToThrow = this.createError(types_1.BiometricErrorCode.NETWORK_ERROR, errorMessage, {
|
|
373
|
+
status: isTimeout ? 504 : error?.status,
|
|
374
|
+
statusText: isTimeout ? 'Gateway Timeout' : error?.statusText,
|
|
372
375
|
errorData: error?.errorData,
|
|
373
376
|
originalError: error?.message
|
|
374
377
|
});
|
|
378
|
+
// Update state before throwing so UI can show error
|
|
379
|
+
this.updateState({
|
|
380
|
+
isLoading: false,
|
|
381
|
+
currentStep: types_1.SDKStep.ERROR,
|
|
382
|
+
error: errorToThrow
|
|
383
|
+
});
|
|
384
|
+
throw errorToThrow;
|
|
375
385
|
}
|
|
376
386
|
}
|
|
377
387
|
/**
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ export class BiometricIdentitySDK {
|
|
|
40
40
|
encryptionKey: config.encryptionKey || '',
|
|
41
41
|
minMatchScore: config.minMatchScore || 85,
|
|
42
42
|
minLivenessScore: config.minLivenessScore || 80,
|
|
43
|
-
validationTimeout: config.validationTimeout ||
|
|
43
|
+
validationTimeout: config.validationTimeout || 180000, // 180 seconds (3 minutes) to handle large payloads
|
|
44
44
|
modelPaths: {},
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -381,7 +381,7 @@ export class BiometricIdentitySDK {
|
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
const MAX_FRAMES =
|
|
384
|
+
const MAX_FRAMES = 5; // Reduced to 5 to reduce payload size and processing time
|
|
385
385
|
if (videoFrames.length > MAX_FRAMES) {
|
|
386
386
|
const step = Math.floor(videoFrames.length / MAX_FRAMES);
|
|
387
387
|
videoFrames = videoFrames.filter((_, index) => index % step === 0).slice(0, MAX_FRAMES);
|
|
@@ -456,19 +456,32 @@ export class BiometricIdentitySDK {
|
|
|
456
456
|
errorStack: error?.stack?.substring(0, 500)
|
|
457
457
|
});
|
|
458
458
|
|
|
459
|
-
|
|
460
|
-
|
|
459
|
+
// Handle timeout specifically with better error message
|
|
460
|
+
const isTimeout = error?.message?.includes('timeout') || error?.message?.includes('Request timeout') || error?.message?.includes('AbortError');
|
|
461
461
|
|
|
462
|
-
|
|
462
|
+
const errorMessage = isTimeout
|
|
463
|
+
? 'La validación está tomando demasiado tiempo. Por favor, verifica tu conexión e intenta nuevamente.'
|
|
464
|
+
: (error?.message || (error?.status ? `Backend request failed with status ${error.status}` : 'Backend validation failed'));
|
|
465
|
+
|
|
466
|
+
const errorToThrow = this.createError(
|
|
463
467
|
BiometricErrorCode.NETWORK_ERROR,
|
|
464
468
|
errorMessage,
|
|
465
469
|
{
|
|
466
|
-
status: error?.status,
|
|
467
|
-
statusText: error?.statusText,
|
|
470
|
+
status: isTimeout ? 504 : error?.status,
|
|
471
|
+
statusText: isTimeout ? 'Gateway Timeout' : error?.statusText,
|
|
468
472
|
errorData: error?.errorData,
|
|
469
473
|
originalError: error?.message
|
|
470
474
|
}
|
|
471
475
|
);
|
|
476
|
+
|
|
477
|
+
// Update state before throwing so UI can show error
|
|
478
|
+
this.updateState({
|
|
479
|
+
isLoading: false,
|
|
480
|
+
currentStep: SDKStep.ERROR,
|
|
481
|
+
error: errorToThrow
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
throw errorToThrow;
|
|
472
485
|
}
|
|
473
486
|
}
|
|
474
487
|
|