@ferscloud/fers-calculation-web 0.2.77 → 0.2.79

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/README.md CHANGED
@@ -153,13 +153,15 @@ If the token is missing, expired, or invalid, the solver falls back to the free
153
153
 
154
154
  ## Tier comparison
155
155
 
156
- | Feature | Free | Pro |
157
- |---|---|---|
158
- | Use | Non-commercial | Commercial and non-commercial |
159
- | Max members | 100 | 10 000 |
160
- | WASM function | `calculate_from_json` | `calculate_from_json_with_token` |
161
- | Requires token | No | Yes |
162
- | Token TTL | — | 30 minutes |
156
+ | Feature | Free | Pro | Enterprise |
157
+ |---|---|---|---|
158
+ | Use | Non-commercial | Commercial and non-commercial | Commercial and non-commercial, by agreement |
159
+ | Max members | 100 | 10 000 | 1 000 000 |
160
+ | WASM function | `calculate_from_json` | `calculate_from_json_with_token` | `calculate_from_json_with_token` |
161
+ | Requires token | No | Yes | Yes |
162
+ | Token TTL | — | 30 minutes | 30 minutes |
163
+
164
+ An Enterprise token is a Pro token that also carries `"plan":"enterprise"`; engines before 0.2.78 read it as Pro. In the browser, memory runs out long before 1 000 000 members: the WASM build has 4 GB and one thread.
163
165
 
164
166
  ## Several cores: solving in parts
165
167
 
@@ -10,8 +10,10 @@ export function calculate_from_json(json_data: string): string;
10
10
  /**
11
11
  * Tier-aware solver. Verifies the Ed25519-signed solve token issued by the
12
12
  * FERS Cloud server; grants Premium limits (10 000 members) when the token
13
- * is valid and contains `"tier":"premium"`. Falls back to Free on any
14
- * failure — expired, malformed, or wrong signature. Returns the JSON envelope.
13
+ * is valid and contains `"tier":"premium"`, and Enterprise limits
14
+ * (1 000 000 members) when it also carries `"plan":"enterprise"`. Falls back
15
+ * to Free on any failure — expired, malformed, or wrong signature. Returns the
16
+ * JSON envelope.
15
17
  */
16
18
  export function calculate_from_json_with_token(json_data: string, solve_token: string): string;
17
19
 
@@ -22,8 +22,10 @@ export function calculate_from_json(json_data) {
22
22
  /**
23
23
  * Tier-aware solver. Verifies the Ed25519-signed solve token issued by the
24
24
  * FERS Cloud server; grants Premium limits (10 000 members) when the token
25
- * is valid and contains `"tier":"premium"`. Falls back to Free on any
26
- * failure — expired, malformed, or wrong signature. Returns the JSON envelope.
25
+ * is valid and contains `"tier":"premium"`, and Enterprise limits
26
+ * (1 000 000 members) when it also carries `"plan":"enterprise"`. Falls back
27
+ * to Free on any failure — expired, malformed, or wrong signature. Returns the
28
+ * JSON envelope.
27
29
  * @param {string} json_data
28
30
  * @param {string} solve_token
29
31
  * @returns {string}
@@ -32,10 +34,17 @@ export function calculate_from_json_with_token(json_data, solve_token) {
32
34
  let deferred3_0;
33
35
  let deferred3_1;
34
36
  try {
35
- const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
36
- const len0 = WASM_VECTOR_LEN;
37
- const ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
38
- const len1 = WASM_VECTOR_LEN;
37
+ let ptr0, len0, ptr1, len1;
38
+ try {
39
+ ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40
+ len0 = WASM_VECTOR_LEN;
41
+ ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
42
+ len1 = WASM_VECTOR_LEN;
43
+ } catch (e) {
44
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
45
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
46
+ throw e;
47
+ }
39
48
  const ret = wasm.calculate_from_json_with_token(ptr0, len0, ptr1, len1);
40
49
  deferred3_0 = ret[0];
41
50
  deferred3_1 = ret[1];
@@ -54,17 +63,19 @@ export function calculate_from_json_with_token(json_data, solve_token) {
54
63
  * @returns {string}
55
64
  */
56
65
  export function calculate_part_from_json(json_data, part_index, part_count) {
57
- let deferred2_0;
58
- let deferred2_1;
66
+ let deferred4_0;
67
+ let deferred4_1;
59
68
  try {
69
+ const val2 = +part_index;
70
+ const val3 = +part_count;
60
71
  const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
61
72
  const len0 = WASM_VECTOR_LEN;
62
- const ret = wasm.calculate_part_from_json(ptr0, len0, part_index, part_count);
63
- deferred2_0 = ret[0];
64
- deferred2_1 = ret[1];
73
+ const ret = wasm.calculate_part_from_json(ptr0, len0, val2, val3);
74
+ deferred4_0 = ret[0];
75
+ deferred4_1 = ret[1];
65
76
  return getStringFromWasm0(ret[0], ret[1]);
66
77
  } finally {
67
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
78
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
68
79
  }
69
80
  }
70
81
 
@@ -78,19 +89,28 @@ export function calculate_part_from_json(json_data, part_index, part_count) {
78
89
  * @returns {string}
79
90
  */
80
91
  export function calculate_part_from_json_with_token(json_data, solve_token, part_index, part_count) {
81
- let deferred3_0;
82
- let deferred3_1;
92
+ let deferred5_0;
93
+ let deferred5_1;
83
94
  try {
84
- const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
85
- const len0 = WASM_VECTOR_LEN;
86
- const ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
87
- const len1 = WASM_VECTOR_LEN;
88
- const ret = wasm.calculate_part_from_json_with_token(ptr0, len0, ptr1, len1, part_index, part_count);
89
- deferred3_0 = ret[0];
90
- deferred3_1 = ret[1];
95
+ const val3 = +part_index;
96
+ const val4 = +part_count;
97
+ let ptr0, len0, ptr1, len1;
98
+ try {
99
+ ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
100
+ len0 = WASM_VECTOR_LEN;
101
+ ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
102
+ len1 = WASM_VECTOR_LEN;
103
+ } catch (e) {
104
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
105
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
106
+ throw e;
107
+ }
108
+ const ret = wasm.calculate_part_from_json_with_token(ptr0, len0, ptr1, len1, val3, val4);
109
+ deferred5_0 = ret[0];
110
+ deferred5_1 = ret[1];
91
111
  return getStringFromWasm0(ret[0], ret[1]);
92
112
  } finally {
93
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
113
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
94
114
  }
95
115
  }
96
116
 
@@ -126,10 +146,17 @@ export function merge_parts_from_json(json_data, parts) {
126
146
  let deferred3_0;
127
147
  let deferred3_1;
128
148
  try {
129
- const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
130
- const len0 = WASM_VECTOR_LEN;
131
- const ptr1 = passArrayJsValueToWasm0(parts, wasm.__wbindgen_malloc);
132
- const len1 = WASM_VECTOR_LEN;
149
+ let ptr0, len0, ptr1, len1;
150
+ try {
151
+ ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
152
+ len0 = WASM_VECTOR_LEN;
153
+ ptr1 = passArrayJsValueToWasm0(parts, wasm.__wbindgen_malloc);
154
+ len1 = WASM_VECTOR_LEN;
155
+ } catch (e) {
156
+ if (ptr1) { wasm.__externref_drop_slice(ptr1, len1); wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
157
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
158
+ throw e;
159
+ }
133
160
  const ret = wasm.merge_parts_from_json(ptr0, len0, ptr1, len1);
134
161
  deferred3_0 = ret[0];
135
162
  deferred3_1 = ret[1];
@@ -150,12 +177,20 @@ export function merge_parts_from_json_with_token(json_data, solve_token, parts)
150
177
  let deferred4_0;
151
178
  let deferred4_1;
152
179
  try {
153
- const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
154
- const len0 = WASM_VECTOR_LEN;
155
- const ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
156
- const len1 = WASM_VECTOR_LEN;
157
- const ptr2 = passArrayJsValueToWasm0(parts, wasm.__wbindgen_malloc);
158
- const len2 = WASM_VECTOR_LEN;
180
+ let ptr0, len0, ptr1, len1, ptr2, len2;
181
+ try {
182
+ ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
183
+ len0 = WASM_VECTOR_LEN;
184
+ ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
185
+ len1 = WASM_VECTOR_LEN;
186
+ ptr2 = passArrayJsValueToWasm0(parts, wasm.__wbindgen_malloc);
187
+ len2 = WASM_VECTOR_LEN;
188
+ } catch (e) {
189
+ if (ptr2) { wasm.__externref_drop_slice(ptr2, len2); wasm.__wbindgen_free(ptr2, len2 * 4, 4); }
190
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
191
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
192
+ throw e;
193
+ }
159
194
  const ret = wasm.merge_parts_from_json_with_token(ptr0, len0, ptr1, len1, ptr2, len2);
160
195
  deferred4_0 = ret[0];
161
196
  deferred4_1 = ret[1];
@@ -217,15 +252,15 @@ export function version() {
217
252
  export function wasm_init() {
218
253
  wasm.wasm_init();
219
254
  }
220
- export function __wbg___wbindgen_string_get_0380ccaa2f57f0d9(arg0, arg1) {
255
+ export function __wbg___wbindgen_string_get_7ce8eee7fd327545(arg0, arg1) {
221
256
  const obj = arg1;
222
257
  const ret = typeof(obj) === 'string' ? obj : undefined;
223
258
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
224
259
  var len1 = WASM_VECTOR_LEN;
225
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
226
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
260
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
261
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
227
262
  }
228
- export function __wbg___wbindgen_throw_41e9ee4f547fc59a(arg0, arg1) {
263
+ export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
229
264
  throw new Error(getStringFromWasm0(arg0, arg1));
230
265
  }
231
266
  export function __wbg_error_757e9472f8410341(arg0, arg1) {
@@ -239,29 +274,28 @@ export function __wbg_error_757e9472f8410341(arg0, arg1) {
239
274
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
240
275
  }
241
276
  }
242
- export function __wbg_new_227d7c05414eb861() {
277
+ export function __wbg_new_bb74001155cb8ca8() {
243
278
  const ret = new Error();
244
279
  return ret;
245
280
  }
246
- export function __wbg_now_aa4ccb83129e9e55() {
281
+ export function __wbg_now_463ac581d2fc7ea3() {
247
282
  const ret = Date.now();
248
283
  return ret;
249
284
  }
250
- export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
285
+ export function __wbg_stack_575c4e0918581b9c(arg0, arg1) {
251
286
  const ret = arg1.stack;
252
287
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
253
288
  const len1 = WASM_VECTOR_LEN;
254
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
255
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
289
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
290
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
256
291
  }
257
292
  export function __wbindgen_init_externref_table() {
258
293
  const table = wasm.__wbindgen_externrefs;
259
- const offset = table.grow(4);
260
294
  table.set(0, undefined);
261
- table.set(offset + 0, undefined);
262
- table.set(offset + 1, null);
263
- table.set(offset + 2, true);
264
- table.set(offset + 3, false);
295
+ table.set(1024, undefined);
296
+ table.set(1025, null);
297
+ table.set(1026, true);
298
+ table.set(1027, false);
265
299
  }
266
300
  function addToExternrefTable0(obj) {
267
301
  const idx = wasm.__externref_table_alloc();
@@ -278,7 +312,8 @@ function getDataViewMemory0() {
278
312
  }
279
313
 
280
314
  function getStringFromWasm0(ptr, len) {
281
- return decodeText(ptr >>> 0, len);
315
+ ptr = ptr >>> 0;
316
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
282
317
  }
283
318
 
284
319
  let cachedUint8ArrayMemory0 = null;
@@ -340,18 +375,18 @@ function passStringToWasm0(arg, malloc, realloc) {
340
375
  return ptr;
341
376
  }
342
377
 
343
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
378
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
344
379
  cachedTextDecoder.decode();
345
380
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
346
381
  let numBytesDecoded = 0;
347
- function decodeText(ptr, len) {
348
- numBytesDecoded += len;
382
+ function decodeText(bytes) {
383
+ numBytesDecoded += bytes.length;
349
384
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
350
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
385
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
351
386
  cachedTextDecoder.decode();
352
- numBytesDecoded = len;
387
+ numBytesDecoded = bytes.length;
353
388
  }
354
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
389
+ return cachedTextDecoder.decode(bytes);
355
390
  }
356
391
 
357
392
  const cachedTextEncoder = new TextEncoder();
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ferscloud/fers-calculation-web",
3
3
  "type": "module",
4
- "version": "0.2.77",
4
+ "version": "0.2.79",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
7
7
  "type": "git",