@ferscloud/fers-calculation 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 +9 -7
- package/fers_calculations.d.ts +4 -2
- package/fers_calculations.js +85 -50
- package/fers_calculations_bg.wasm +0 -0
- package/package.json +1 -1
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
|
|
package/fers_calculations.d.ts
CHANGED
|
@@ -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"
|
|
14
|
-
*
|
|
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
|
|
package/fers_calculations.js
CHANGED
|
@@ -25,8 +25,10 @@ exports.calculate_from_json = calculate_from_json;
|
|
|
25
25
|
/**
|
|
26
26
|
* Tier-aware solver. Verifies the Ed25519-signed solve token issued by the
|
|
27
27
|
* FERS Cloud server; grants Premium limits (10 000 members) when the token
|
|
28
|
-
* is valid and contains `"tier":"premium"
|
|
29
|
-
*
|
|
28
|
+
* is valid and contains `"tier":"premium"`, and Enterprise limits
|
|
29
|
+
* (1 000 000 members) when it also carries `"plan":"enterprise"`. Falls back
|
|
30
|
+
* to Free on any failure — expired, malformed, or wrong signature. Returns the
|
|
31
|
+
* JSON envelope.
|
|
30
32
|
* @param {string} json_data
|
|
31
33
|
* @param {string} solve_token
|
|
32
34
|
* @returns {string}
|
|
@@ -35,10 +37,17 @@ function calculate_from_json_with_token(json_data, solve_token) {
|
|
|
35
37
|
let deferred3_0;
|
|
36
38
|
let deferred3_1;
|
|
37
39
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
let ptr0, len0, ptr1, len1;
|
|
41
|
+
try {
|
|
42
|
+
ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
43
|
+
len0 = WASM_VECTOR_LEN;
|
|
44
|
+
ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
45
|
+
len1 = WASM_VECTOR_LEN;
|
|
46
|
+
} catch (e) {
|
|
47
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
48
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
49
|
+
throw e;
|
|
50
|
+
}
|
|
42
51
|
const ret = wasm.calculate_from_json_with_token(ptr0, len0, ptr1, len1);
|
|
43
52
|
deferred3_0 = ret[0];
|
|
44
53
|
deferred3_1 = ret[1];
|
|
@@ -58,17 +67,19 @@ exports.calculate_from_json_with_token = calculate_from_json_with_token;
|
|
|
58
67
|
* @returns {string}
|
|
59
68
|
*/
|
|
60
69
|
function calculate_part_from_json(json_data, part_index, part_count) {
|
|
61
|
-
let
|
|
62
|
-
let
|
|
70
|
+
let deferred4_0;
|
|
71
|
+
let deferred4_1;
|
|
63
72
|
try {
|
|
73
|
+
const val2 = +part_index;
|
|
74
|
+
const val3 = +part_count;
|
|
64
75
|
const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
65
76
|
const len0 = WASM_VECTOR_LEN;
|
|
66
|
-
const ret = wasm.calculate_part_from_json(ptr0, len0,
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
const ret = wasm.calculate_part_from_json(ptr0, len0, val2, val3);
|
|
78
|
+
deferred4_0 = ret[0];
|
|
79
|
+
deferred4_1 = ret[1];
|
|
69
80
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
70
81
|
} finally {
|
|
71
|
-
wasm.__wbindgen_free(
|
|
82
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
72
83
|
}
|
|
73
84
|
}
|
|
74
85
|
exports.calculate_part_from_json = calculate_part_from_json;
|
|
@@ -83,19 +94,28 @@ exports.calculate_part_from_json = calculate_part_from_json;
|
|
|
83
94
|
* @returns {string}
|
|
84
95
|
*/
|
|
85
96
|
function calculate_part_from_json_with_token(json_data, solve_token, part_index, part_count) {
|
|
86
|
-
let
|
|
87
|
-
let
|
|
97
|
+
let deferred5_0;
|
|
98
|
+
let deferred5_1;
|
|
88
99
|
try {
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
const val3 = +part_index;
|
|
101
|
+
const val4 = +part_count;
|
|
102
|
+
let ptr0, len0, ptr1, len1;
|
|
103
|
+
try {
|
|
104
|
+
ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
105
|
+
len0 = WASM_VECTOR_LEN;
|
|
106
|
+
ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
107
|
+
len1 = WASM_VECTOR_LEN;
|
|
108
|
+
} catch (e) {
|
|
109
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
110
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
111
|
+
throw e;
|
|
112
|
+
}
|
|
113
|
+
const ret = wasm.calculate_part_from_json_with_token(ptr0, len0, ptr1, len1, val3, val4);
|
|
114
|
+
deferred5_0 = ret[0];
|
|
115
|
+
deferred5_1 = ret[1];
|
|
96
116
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
97
117
|
} finally {
|
|
98
|
-
wasm.__wbindgen_free(
|
|
118
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
99
119
|
}
|
|
100
120
|
}
|
|
101
121
|
exports.calculate_part_from_json_with_token = calculate_part_from_json_with_token;
|
|
@@ -133,10 +153,17 @@ function merge_parts_from_json(json_data, parts) {
|
|
|
133
153
|
let deferred3_0;
|
|
134
154
|
let deferred3_1;
|
|
135
155
|
try {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
156
|
+
let ptr0, len0, ptr1, len1;
|
|
157
|
+
try {
|
|
158
|
+
ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
159
|
+
len0 = WASM_VECTOR_LEN;
|
|
160
|
+
ptr1 = passArrayJsValueToWasm0(parts, wasm.__wbindgen_malloc);
|
|
161
|
+
len1 = WASM_VECTOR_LEN;
|
|
162
|
+
} catch (e) {
|
|
163
|
+
if (ptr1) { wasm.__externref_drop_slice(ptr1, len1); wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
164
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
165
|
+
throw e;
|
|
166
|
+
}
|
|
140
167
|
const ret = wasm.merge_parts_from_json(ptr0, len0, ptr1, len1);
|
|
141
168
|
deferred3_0 = ret[0];
|
|
142
169
|
deferred3_1 = ret[1];
|
|
@@ -158,12 +185,20 @@ function merge_parts_from_json_with_token(json_data, solve_token, parts) {
|
|
|
158
185
|
let deferred4_0;
|
|
159
186
|
let deferred4_1;
|
|
160
187
|
try {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
188
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
189
|
+
try {
|
|
190
|
+
ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
191
|
+
len0 = WASM_VECTOR_LEN;
|
|
192
|
+
ptr1 = passStringToWasm0(solve_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
193
|
+
len1 = WASM_VECTOR_LEN;
|
|
194
|
+
ptr2 = passArrayJsValueToWasm0(parts, wasm.__wbindgen_malloc);
|
|
195
|
+
len2 = WASM_VECTOR_LEN;
|
|
196
|
+
} catch (e) {
|
|
197
|
+
if (ptr2) { wasm.__externref_drop_slice(ptr2, len2); wasm.__wbindgen_free(ptr2, len2 * 4, 4); }
|
|
198
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
199
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
200
|
+
throw e;
|
|
201
|
+
}
|
|
167
202
|
const ret = wasm.merge_parts_from_json_with_token(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
168
203
|
deferred4_0 = ret[0];
|
|
169
204
|
deferred4_1 = ret[1];
|
|
@@ -232,15 +267,15 @@ exports.wasm_init = wasm_init;
|
|
|
232
267
|
function __wbg_get_imports() {
|
|
233
268
|
const import0 = {
|
|
234
269
|
__proto__: null,
|
|
235
|
-
|
|
270
|
+
__wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
|
|
236
271
|
const obj = arg1;
|
|
237
272
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
238
273
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
239
274
|
var len1 = WASM_VECTOR_LEN;
|
|
240
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
241
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
275
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
276
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
242
277
|
},
|
|
243
|
-
|
|
278
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
244
279
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
245
280
|
},
|
|
246
281
|
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
@@ -254,29 +289,28 @@ function __wbg_get_imports() {
|
|
|
254
289
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
255
290
|
}
|
|
256
291
|
},
|
|
257
|
-
|
|
292
|
+
__wbg_new_bb74001155cb8ca8: function() {
|
|
258
293
|
const ret = new Error();
|
|
259
294
|
return ret;
|
|
260
295
|
},
|
|
261
|
-
|
|
296
|
+
__wbg_now_463ac581d2fc7ea3: function() {
|
|
262
297
|
const ret = Date.now();
|
|
263
298
|
return ret;
|
|
264
299
|
},
|
|
265
|
-
|
|
300
|
+
__wbg_stack_575c4e0918581b9c: function(arg0, arg1) {
|
|
266
301
|
const ret = arg1.stack;
|
|
267
302
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
268
303
|
const len1 = WASM_VECTOR_LEN;
|
|
269
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
270
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
304
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
305
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
271
306
|
},
|
|
272
307
|
__wbindgen_init_externref_table: function() {
|
|
273
308
|
const table = wasm.__wbindgen_externrefs;
|
|
274
|
-
const offset = table.grow(4);
|
|
275
309
|
table.set(0, undefined);
|
|
276
|
-
table.set(
|
|
277
|
-
table.set(
|
|
278
|
-
table.set(
|
|
279
|
-
table.set(
|
|
310
|
+
table.set(1024, undefined);
|
|
311
|
+
table.set(1025, null);
|
|
312
|
+
table.set(1026, true);
|
|
313
|
+
table.set(1027, false);
|
|
280
314
|
},
|
|
281
315
|
};
|
|
282
316
|
return {
|
|
@@ -300,7 +334,8 @@ function getDataViewMemory0() {
|
|
|
300
334
|
}
|
|
301
335
|
|
|
302
336
|
function getStringFromWasm0(ptr, len) {
|
|
303
|
-
|
|
337
|
+
ptr = ptr >>> 0;
|
|
338
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
304
339
|
}
|
|
305
340
|
|
|
306
341
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -362,10 +397,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
362
397
|
return ptr;
|
|
363
398
|
}
|
|
364
399
|
|
|
365
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
400
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
366
401
|
cachedTextDecoder.decode();
|
|
367
|
-
function decodeText(
|
|
368
|
-
return cachedTextDecoder.decode(
|
|
402
|
+
function decodeText(bytes) {
|
|
403
|
+
return cachedTextDecoder.decode(bytes);
|
|
369
404
|
}
|
|
370
405
|
|
|
371
406
|
const cachedTextEncoder = new TextEncoder();
|
|
Binary file
|