@ferscloud/fers-calculation 0.2.21 → 0.2.25

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.
@@ -1,6 +1,17 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * Free-tier solver (100-member limit). Used when no valid solve token is present.
6
+ */
4
7
  export function calculate_from_json(json_data: string): string;
5
8
 
9
+ /**
10
+ * Tier-aware solver. Verifies the Ed25519-signed solve token issued by the
11
+ * FERS Cloud server; grants Premium limits (10 000 members) when the token
12
+ * is valid and contains `"tier":"premium"`. Falls back to Free on any
13
+ * failure — expired, malformed, or wrong signature.
14
+ */
15
+ export function calculate_from_json_with_token(json_data: string, solve_token: string): string;
16
+
6
17
  export function load_fers_from_file(path: string): string;
@@ -1,6 +1,7 @@
1
1
  /* @ts-self-types="./fers_calculations.d.ts" */
2
2
 
3
3
  /**
4
+ * Free-tier solver (100-member limit). Used when no valid solve token is present.
4
5
  * @param {string} json_data
5
6
  * @returns {string}
6
7
  */
@@ -20,6 +21,33 @@ function calculate_from_json(json_data) {
20
21
  }
21
22
  exports.calculate_from_json = calculate_from_json;
22
23
 
24
+ /**
25
+ * Tier-aware solver. Verifies the Ed25519-signed solve token issued by the
26
+ * FERS Cloud server; grants Premium limits (10 000 members) when the token
27
+ * is valid and contains `"tier":"premium"`. Falls back to Free on any
28
+ * failure — expired, malformed, or wrong signature.
29
+ * @param {string} json_data
30
+ * @param {string} solve_token
31
+ * @returns {string}
32
+ */
33
+ function calculate_from_json_with_token(json_data, solve_token) {
34
+ let deferred3_0;
35
+ let deferred3_1;
36
+ try {
37
+ const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
38
+ const len0 = WASM_VECTOR_LEN;
39
+ const ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40
+ const len1 = WASM_VECTOR_LEN;
41
+ const ret = wasm.calculate_from_json_with_token(ptr0, len0, ptr1, len1);
42
+ deferred3_0 = ret[0];
43
+ deferred3_1 = ret[1];
44
+ return getStringFromWasm0(ret[0], ret[1]);
45
+ } finally {
46
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
47
+ }
48
+ }
49
+ exports.calculate_from_json_with_token = calculate_from_json_with_token;
50
+
23
51
  /**
24
52
  * @param {string} path
25
53
  * @returns {string}
@@ -42,6 +70,13 @@ exports.load_fers_from_file = load_fers_from_file;
42
70
  function __wbg_get_imports() {
43
71
  const import0 = {
44
72
  __proto__: null,
73
+ __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
74
+ throw new Error(getStringFromWasm0(arg0, arg1));
75
+ },
76
+ __wbg_now_81363d44c96dd239: function() {
77
+ const ret = Date.now();
78
+ return ret;
79
+ },
45
80
  __wbindgen_init_externref_table: function() {
46
81
  const table = wasm.__wbindgen_externrefs;
47
82
  const offset = table.grow(4);
@@ -59,8 +94,7 @@ function __wbg_get_imports() {
59
94
  }
60
95
 
61
96
  function getStringFromWasm0(ptr, len) {
62
- ptr = ptr >>> 0;
63
- return decodeText(ptr, len);
97
+ return decodeText(ptr >>> 0, len);
64
98
  }
65
99
 
66
100
  let cachedUint8ArrayMemory0 = null;
@@ -132,5 +166,6 @@ let WASM_VECTOR_LEN = 0;
132
166
  const wasmPath = `${__dirname}/fers_calculations_bg.wasm`;
133
167
  const wasmBytes = require('fs').readFileSync(wasmPath);
134
168
  const wasmModule = new WebAssembly.Module(wasmBytes);
135
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
169
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
170
+ let wasm = wasmInstance.exports;
136
171
  wasm.__wbindgen_start();
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferscloud/fers-calculation",
3
- "version": "0.2.21",
3
+ "version": "0.2.25",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Jeroen124/FERS_calculations.git"