@authme/engine 2.2.1-rc.5 → 2.2.1

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.
Binary file
Binary file
@@ -1 +1 @@
1
- 5.1.0
1
+ 5.2.1
package/index.cjs CHANGED
@@ -129,6 +129,8 @@ exports.EAuthMePassportServiceStatus = void 0;
129
129
  EAuthMePassportServiceStatus["NotFound"] = "EAuthMePassportServiceStatus_NotFound";
130
130
  EAuthMePassportServiceStatus["RecogFailed"] = "EAuthMePassportServiceStatus_RecogFailed";
131
131
  EAuthMePassportServiceStatus["Error"] = "EAuthMePassportServiceStatus_Error";
132
+ EAuthMePassportServiceStatus["NotAligned"] = "EAuthMePassportServiceStatus_NotAligned";
133
+ EAuthMePassportServiceStatus["Reflective"] = "EAuthMePassportServiceStatus_Reflective";
132
134
  })(exports.EAuthMePassportServiceStatus || (exports.EAuthMePassportServiceStatus = {}));
133
135
  exports.EAuthMeIDCardAntiFraudStage = void 0;
134
136
  (function (EAuthMeIDCardAntiFraudStage) {
@@ -224,7 +226,7 @@ const defaultMlEngineConfig = {
224
226
  };
225
227
 
226
228
  var name = "@authme/engine";
227
- var version$1 = "2.2.1-rc.5";
229
+ var version$1 = "2.2.1";
228
230
  var peerDependencies = {
229
231
  "core-js": "^3.6.0",
230
232
  rxjs: "^7.4.0"
@@ -376,7 +378,13 @@ class MlEngine {
376
378
  // * https://stackoverflow.com/questions/25458104/can-should-html5-web-workers-use-cors-for-cross-origin
377
379
  // * https://web.dev/workers-basics/
378
380
  const worker = yield createWorkerWithObjectUrlAsync(`${(_a = this.config.scriptPath) !== null && _a !== void 0 ? _a : ''}engine-worker.js?t=${Date.now()}`);
379
- const workerMessage$ = rxjs.fromEvent(worker, 'message').pipe(rxjs.map(x => x.data), rxjs.shareReplay(1));
381
+ const workerMessage$ = rxjs.fromEvent(worker, 'message').pipe(rxjs.map(x => {
382
+ var _a, _b;
383
+ if ((_b = (_a = x.data) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.error) {
384
+ throw new core.AuthmeError(core.ErrorCode.SDK_INTERNAL_ERROR, 'unexpected worker error');
385
+ }
386
+ return x.data;
387
+ }), rxjs.shareReplay(1));
380
388
  yield this._run(worker, workerMessage$, exports.EngineModule.Core, 'setConfig', this.config);
381
389
  return [worker, workerMessage$];
382
390
  });
package/index.js CHANGED
@@ -125,6 +125,8 @@ var EAuthMePassportServiceStatus;
125
125
  EAuthMePassportServiceStatus["NotFound"] = "EAuthMePassportServiceStatus_NotFound";
126
126
  EAuthMePassportServiceStatus["RecogFailed"] = "EAuthMePassportServiceStatus_RecogFailed";
127
127
  EAuthMePassportServiceStatus["Error"] = "EAuthMePassportServiceStatus_Error";
128
+ EAuthMePassportServiceStatus["NotAligned"] = "EAuthMePassportServiceStatus_NotAligned";
129
+ EAuthMePassportServiceStatus["Reflective"] = "EAuthMePassportServiceStatus_Reflective";
128
130
  })(EAuthMePassportServiceStatus || (EAuthMePassportServiceStatus = {}));
129
131
  var EAuthMeIDCardAntiFraudStage;
130
132
  (function (EAuthMeIDCardAntiFraudStage) {
@@ -220,7 +222,7 @@ const defaultMlEngineConfig = {
220
222
  };
221
223
 
222
224
  var name = "@authme/engine";
223
- var version$1 = "2.2.1-rc.5";
225
+ var version$1 = "2.2.1";
224
226
  var peerDependencies = {
225
227
  "core-js": "^3.6.0",
226
228
  rxjs: "^7.4.0"
@@ -372,7 +374,13 @@ class MlEngine {
372
374
  // * https://stackoverflow.com/questions/25458104/can-should-html5-web-workers-use-cors-for-cross-origin
373
375
  // * https://web.dev/workers-basics/
374
376
  const worker = yield createWorkerWithObjectUrlAsync(`${(_a = this.config.scriptPath) !== null && _a !== void 0 ? _a : ''}engine-worker.js?t=${Date.now()}`);
375
- const workerMessage$ = fromEvent(worker, 'message').pipe(map(x => x.data), shareReplay(1));
377
+ const workerMessage$ = fromEvent(worker, 'message').pipe(map(x => {
378
+ var _a, _b;
379
+ if ((_b = (_a = x.data) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.error) {
380
+ throw new AuthmeError(ErrorCode.SDK_INTERNAL_ERROR, 'unexpected worker error');
381
+ }
382
+ return x.data;
383
+ }), shareReplay(1));
376
384
  yield this._run(worker, workerMessage$, EngineModule.Core, 'setConfig', this.config);
377
385
  return [worker, workerMessage$];
378
386
  });
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@authme/engine",
3
- "version": "2.2.1-rc.5",
3
+ "version": "2.2.1",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
6
  "rxjs": "^7.4.0",
7
- "@authme/core": "2.2.1-rc.5",
8
- "@authme/util": "2.2.1-rc.5"
7
+ "@authme/core": "2.2.1",
8
+ "@authme/util": "2.2.1"
9
9
  },
10
10
  "module": "./index.js",
11
11
  "main": "./index.cjs",
@@ -1,5 +1,5 @@
1
1
  import { EngineModule } from './enum';
2
- import { EngineDebugInfo, MlEngineConfig } from './interface';
2
+ import { EngineDebugInfo, EngineParams, MlEngineConfig } from './interface';
3
3
  export declare abstract class AuthmeFunctionModule {
4
4
  init(config: MlEngineConfig): Promise<void>;
5
5
  static getVersion(): string;
@@ -41,10 +41,7 @@ export declare abstract class AuthmeEngineModuleBase<T = any> {
41
41
  recognition(data: Uint8Array | Uint8ClampedArray): Promise<T & EngineDebugInfo>;
42
42
  getDebugImageData(data: Uint8Array | Uint8ClampedArray): Promise<Uint8Array>;
43
43
  setFrameSize(width: number, height: number): Promise<boolean>;
44
- getParams(): Promise<{
45
- timeoutSec: number;
46
- fFASTh: number;
47
- }>;
44
+ getParams(): Promise<EngineParams>;
48
45
  setParams(params: any): Promise<unknown>;
49
46
  setMaskPosition(positions: number[][]): Promise<unknown>;
50
47
  destroy(): Promise<boolean>;
@@ -51,7 +51,9 @@ export declare enum EAuthMePassportServiceStatus {
51
51
  Success = "EAuthMePassportServiceStatus_Success",
52
52
  NotFound = "EAuthMePassportServiceStatus_NotFound",
53
53
  RecogFailed = "EAuthMePassportServiceStatus_RecogFailed",
54
- Error = "EAuthMePassportServiceStatus_Error"
54
+ Error = "EAuthMePassportServiceStatus_Error",
55
+ NotAligned = "EAuthMePassportServiceStatus_NotAligned",
56
+ Reflective = "EAuthMePassportServiceStatus_Reflective"
55
57
  }
56
58
  export declare enum EAuthMeIDCardAntiFraudStage {
57
59
  Frontal = "EAuthMeIDCardAntiFraudStage_Frontal",
@@ -10,3 +10,13 @@ export interface EngineDebugInfo {
10
10
  debugImage?: Uint8Array;
11
11
  };
12
12
  }
13
+ export interface EngineParams {
14
+ timeoutSec: number;
15
+ fFASTh: number;
16
+ faceROI: {
17
+ fLeft: number;
18
+ fRight: number;
19
+ fTop: number;
20
+ fBottom: number;
21
+ };
22
+ }