libchai 0.1.11 → 0.1.12

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.
Files changed (4) hide show
  1. package/chai.d.ts +30 -14
  2. package/chai.js +112 -58
  3. package/chai_bg.wasm +0 -0
  4. package/package.json +1 -1
package/chai.d.ts CHANGED
@@ -6,24 +6,37 @@
6
6
  */
7
7
  export function validate(js_config: any): any;
8
8
  /**
9
- * @param {any} js_input
10
- * @returns {any}
11
9
  */
12
- export function encode(js_input: any): any;
10
+ export class WebInterface {
11
+ free(): void;
13
12
  /**
14
- * @param {any} js_input
15
- * @returns {any}
13
+ * @param {Function} post_message
14
+ * @param {any} js_config
15
+ * @param {any} js_info
16
+ * @param {any} js_assets
17
+ * @returns {WebInterface}
16
18
  */
17
- export function evaluate(js_input: any): any;
19
+ static new(post_message: Function, js_config: any, js_info: any, js_assets: any): WebInterface;
18
20
  /**
19
- * @param {any} js_input
20
- * @param {Function} post_message
21
+ * @param {any} js_config
21
22
  */
22
- export function optimize(js_input: any, post_message: Function): void;
23
+ update_config(js_config: any): void;
23
24
  /**
25
+ * @param {any} js_info
24
26
  */
25
- export class WebInterface {
26
- free(): void;
27
+ update_info(js_info: any): void;
28
+ /**
29
+ * @param {any} js_assets
30
+ */
31
+ update_assets(js_assets: any): void;
32
+ /**
33
+ * @param {any} js_objective
34
+ * @returns {any}
35
+ */
36
+ encode_evaluate(js_objective: any): any;
37
+ /**
38
+ */
39
+ optimize(): void;
27
40
  }
28
41
 
29
42
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -32,9 +45,12 @@ export interface InitOutput {
32
45
  readonly memory: WebAssembly.Memory;
33
46
  readonly __wbg_webinterface_free: (a: number) => void;
34
47
  readonly validate: (a: number, b: number) => void;
35
- readonly encode: (a: number, b: number) => void;
36
- readonly evaluate: (a: number, b: number) => void;
37
- readonly optimize: (a: number, b: number, c: number) => void;
48
+ readonly webinterface_new: (a: number, b: number, c: number, d: number, e: number) => void;
49
+ readonly webinterface_update_config: (a: number, b: number, c: number) => void;
50
+ readonly webinterface_update_info: (a: number, b: number, c: number) => void;
51
+ readonly webinterface_update_assets: (a: number, b: number, c: number) => void;
52
+ readonly webinterface_encode_evaluate: (a: number, b: number, c: number) => void;
53
+ readonly webinterface_optimize: (a: number, b: number) => void;
38
54
  readonly __wbindgen_export_0: (a: number, b: number) => number;
39
55
  readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
40
56
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
package/chai.js CHANGED
@@ -218,64 +218,6 @@ export function validate(js_config) {
218
218
  }
219
219
  }
220
220
 
221
- /**
222
- * @param {any} js_input
223
- * @returns {any}
224
- */
225
- export function encode(js_input) {
226
- try {
227
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
228
- wasm.encode(retptr, addHeapObject(js_input));
229
- var r0 = getInt32Memory0()[retptr / 4 + 0];
230
- var r1 = getInt32Memory0()[retptr / 4 + 1];
231
- var r2 = getInt32Memory0()[retptr / 4 + 2];
232
- if (r2) {
233
- throw takeObject(r1);
234
- }
235
- return takeObject(r0);
236
- } finally {
237
- wasm.__wbindgen_add_to_stack_pointer(16);
238
- }
239
- }
240
-
241
- /**
242
- * @param {any} js_input
243
- * @returns {any}
244
- */
245
- export function evaluate(js_input) {
246
- try {
247
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
248
- wasm.evaluate(retptr, addHeapObject(js_input));
249
- var r0 = getInt32Memory0()[retptr / 4 + 0];
250
- var r1 = getInt32Memory0()[retptr / 4 + 1];
251
- var r2 = getInt32Memory0()[retptr / 4 + 2];
252
- if (r2) {
253
- throw takeObject(r1);
254
- }
255
- return takeObject(r0);
256
- } finally {
257
- wasm.__wbindgen_add_to_stack_pointer(16);
258
- }
259
- }
260
-
261
- /**
262
- * @param {any} js_input
263
- * @param {Function} post_message
264
- */
265
- export function optimize(js_input, post_message) {
266
- try {
267
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
268
- wasm.optimize(retptr, addHeapObject(js_input), addHeapObject(post_message));
269
- var r0 = getInt32Memory0()[retptr / 4 + 0];
270
- var r1 = getInt32Memory0()[retptr / 4 + 1];
271
- if (r1) {
272
- throw takeObject(r0);
273
- }
274
- } finally {
275
- wasm.__wbindgen_add_to_stack_pointer(16);
276
- }
277
- }
278
-
279
221
  function handleError(f, args) {
280
222
  try {
281
223
  return f.apply(this, args);
@@ -291,6 +233,14 @@ const WebInterfaceFinalization = (typeof FinalizationRegistry === 'undefined')
291
233
  */
292
234
  export class WebInterface {
293
235
 
236
+ static __wrap(ptr) {
237
+ ptr = ptr >>> 0;
238
+ const obj = Object.create(WebInterface.prototype);
239
+ obj.__wbg_ptr = ptr;
240
+ WebInterfaceFinalization.register(obj, obj.__wbg_ptr, obj);
241
+ return obj;
242
+ }
243
+
294
244
  __destroy_into_raw() {
295
245
  const ptr = this.__wbg_ptr;
296
246
  this.__wbg_ptr = 0;
@@ -302,6 +252,110 @@ export class WebInterface {
302
252
  const ptr = this.__destroy_into_raw();
303
253
  wasm.__wbg_webinterface_free(ptr);
304
254
  }
255
+ /**
256
+ * @param {Function} post_message
257
+ * @param {any} js_config
258
+ * @param {any} js_info
259
+ * @param {any} js_assets
260
+ * @returns {WebInterface}
261
+ */
262
+ static new(post_message, js_config, js_info, js_assets) {
263
+ try {
264
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
+ wasm.webinterface_new(retptr, addHeapObject(post_message), addHeapObject(js_config), addHeapObject(js_info), addHeapObject(js_assets));
266
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
267
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
268
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
269
+ if (r2) {
270
+ throw takeObject(r1);
271
+ }
272
+ return WebInterface.__wrap(r0);
273
+ } finally {
274
+ wasm.__wbindgen_add_to_stack_pointer(16);
275
+ }
276
+ }
277
+ /**
278
+ * @param {any} js_config
279
+ */
280
+ update_config(js_config) {
281
+ try {
282
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
283
+ wasm.webinterface_update_config(retptr, this.__wbg_ptr, addHeapObject(js_config));
284
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
285
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
286
+ if (r1) {
287
+ throw takeObject(r0);
288
+ }
289
+ } finally {
290
+ wasm.__wbindgen_add_to_stack_pointer(16);
291
+ }
292
+ }
293
+ /**
294
+ * @param {any} js_info
295
+ */
296
+ update_info(js_info) {
297
+ try {
298
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
299
+ wasm.webinterface_update_info(retptr, this.__wbg_ptr, addHeapObject(js_info));
300
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
301
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
302
+ if (r1) {
303
+ throw takeObject(r0);
304
+ }
305
+ } finally {
306
+ wasm.__wbindgen_add_to_stack_pointer(16);
307
+ }
308
+ }
309
+ /**
310
+ * @param {any} js_assets
311
+ */
312
+ update_assets(js_assets) {
313
+ try {
314
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
315
+ wasm.webinterface_update_assets(retptr, this.__wbg_ptr, addHeapObject(js_assets));
316
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
317
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
318
+ if (r1) {
319
+ throw takeObject(r0);
320
+ }
321
+ } finally {
322
+ wasm.__wbindgen_add_to_stack_pointer(16);
323
+ }
324
+ }
325
+ /**
326
+ * @param {any} js_objective
327
+ * @returns {any}
328
+ */
329
+ encode_evaluate(js_objective) {
330
+ try {
331
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
332
+ wasm.webinterface_encode_evaluate(retptr, this.__wbg_ptr, addHeapObject(js_objective));
333
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
334
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
335
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
336
+ if (r2) {
337
+ throw takeObject(r1);
338
+ }
339
+ return takeObject(r0);
340
+ } finally {
341
+ wasm.__wbindgen_add_to_stack_pointer(16);
342
+ }
343
+ }
344
+ /**
345
+ */
346
+ optimize() {
347
+ try {
348
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
349
+ wasm.webinterface_optimize(retptr, this.__wbg_ptr);
350
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
351
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
352
+ if (r1) {
353
+ throw takeObject(r0);
354
+ }
355
+ } finally {
356
+ wasm.__wbindgen_add_to_stack_pointer(16);
357
+ }
358
+ }
305
359
  }
306
360
 
307
361
  async function __wbg_load(module, imports) {
package/chai_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "Songchen Tan <i@tansongchen.com>"
5
5
  ],
6
- "version": "0.1.11",
6
+ "version": "0.1.12",
7
7
  "files": [
8
8
  "chai_bg.wasm",
9
9
  "chai.js",