@authme/engine 2.2.0-rc.6 → 2.2.0-rc.9

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/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [2.2.0-rc.9](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.8...v2.2.0-rc.9) (2022-12-09)
6
+
7
+ ### Features
8
+
9
+ - update engine-lib to 4.8.0 ([6276dd7](https://github.com/AuthMe01/web-client-sdk/commit/6276dd74431a6f9321c2b9b04d02e4bcc0e4230f))
10
+
11
+ ## [2.2.0-rc.8](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.7...v2.2.0-rc.8) (2022-12-07)
12
+
13
+ ### Features
14
+
15
+ - update engine-lib to 4.7.0 ([968d200](https://github.com/AuthMe01/web-client-sdk/commit/968d2006d3834a187177384710e314e65bf333a0))
16
+
17
+ ## [2.2.0-rc.7](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.6...v2.2.0-rc.7) (2022-12-07)
18
+
19
+ ### Bug Fixes
20
+
21
+ - cors problem on worker creating ([143cb33](https://github.com/AuthMe01/web-client-sdk/commit/143cb336982777a853b75ea88c038d8fa68e1dce))
22
+
5
23
  ## [2.2.0-rc.6](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.5...v2.2.0-rc.6) (2022-12-05)
6
24
 
7
25
  ## [2.2.0-rc.5](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.4...v2.2.0-rc.5) (2022-12-03)
@@ -5,19 +5,12 @@
5
5
 
6
6
  let modelSession = {};
7
7
 
8
- function isSimdSupported() {
9
- try {
10
- // Test for WebAssembly SIMD capability (for both browsers and Node.js)
11
- // This typed array is a WebAssembly program containing SIMD instructions.
12
- return WebAssembly.validate(
13
- new Uint8Array([
14
- 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 9, 1,
15
- 7, 0, 65, 0, 253, 15, 26, 11,
16
- ])
17
- );
18
- } catch (e) {
19
- return false;
20
- }
8
+ function importScriptsViaJsContent(jsContent) {
9
+ const objectUrl = URL.createObjectURL(
10
+ new Blob([jsContent], { type: 'text/javascript' })
11
+ );
12
+ importScripts(objectUrl);
13
+ URL.revokeObjectURL(objectUrl);
21
14
  }
22
15
 
23
16
  function base64toBlob(data) {
@@ -52,7 +45,7 @@
52
45
  }
53
46
  }
54
47
 
55
- async function loadWasm() {
48
+ async function loadWasm({ engineJsContent, engineWasmContent }) {
56
49
  return new Promise((res, rej) => {
57
50
  // console.log('load wasm');
58
51
  if (wasm_loaded || wasm_loading) {
@@ -71,14 +64,11 @@
71
64
  });
72
65
  },
73
66
  };
74
- self.importScripts(
75
- isSimdSupported()
76
- ? `${self.config.scriptPath}ml_engine_web.simd.js`
77
- : `${self.config.scriptPath}ml_engine_web.js`
78
- );
67
+ importScriptsViaJsContent(engineJsContent);
79
68
  let tryInitEngineLib = async () => {
80
69
  try {
81
70
  const module = await AuthmeMLEngineLib({
71
+ wasmBinary: engineWasmContent,
82
72
  print: (msg) => {
83
73
  console.log(msg);
84
74
  postMessage({
@@ -352,6 +342,12 @@
352
342
  self.Fas.instance.setStage(stageList);
353
343
  }
354
344
  },
345
+ getStageParams({ stageIndex }) {
346
+ return self.Fas.instance.getStageParams(stageIndex);
347
+ },
348
+ setStageParams({ stageIndex, value }) {
349
+ self.Fas.instance.setStageParams(value, stageIndex);
350
+ },
355
351
  recognition: function (params) {
356
352
  const result = self.Base.recognition(self.Fas, params);
357
353
  if (result) {
@@ -524,8 +520,8 @@
524
520
  };
525
521
  return true;
526
522
  },
527
- loadEngine: async function () {
528
- return await loadWasm();
523
+ loadEngine: async function ({ engineJsContent, engineWasmContent }) {
524
+ return await loadWasm({ engineJsContent, engineWasmContent });
529
525
  },
530
526
  verify: async function (params) {
531
527
  for (let index = 0; index < 20; index++) {