mqtt5-wasm 0.3.0 → 0.6.1

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
@@ -23,7 +23,7 @@ npm install mqtt5-wasm
23
23
 
24
24
  ```toml
25
25
  [dependencies]
26
- mqtt5-wasm = "0.3"
26
+ mqtt5-wasm = "0.5"
27
27
  ```
28
28
 
29
29
  Build with wasm-pack:
package/mqtt5_wasm.d.ts CHANGED
@@ -24,17 +24,31 @@ export class WasmBroker {
24
24
  free(): void;
25
25
  [Symbol.dispose](): void;
26
26
  add_bridge(config: WasmBridgeConfig, remote_port: MessagePort): Promise<void>;
27
+ list_roles(): Promise<string[]>;
28
+ role_count(): Promise<number>;
27
29
  user_count(): Promise<number>;
30
+ assign_role(username: string, role_name: string): Promise<void>;
31
+ clear_roles(): Promise<void>;
32
+ remove_role(name: string): Promise<boolean>;
28
33
  remove_user(username: string): Promise<boolean>;
29
34
  static with_config(wasm_config: WasmBrokerConfig): WasmBroker;
35
+ add_acl_rule(username: string, topic_pattern: string, permission: string): Promise<void>;
30
36
  list_bridges(): string[];
37
+ add_role_rule(role_name: string, topic_pattern: string, permission: string): Promise<void>;
31
38
  static hash_password(password: string): string;
32
39
  remove_bridge(name: string): Promise<void>;
40
+ unassign_role(username: string, role_name: string): Promise<boolean>;
41
+ acl_rule_count(): Promise<number>;
42
+ get_user_roles(username: string): Promise<string[]>;
43
+ clear_acl_rules(): Promise<void>;
44
+ stop_sys_topics(): void;
45
+ start_sys_topics(): void;
33
46
  stop_all_bridges(): Promise<void>;
34
47
  add_user_with_hash(username: string, password_hash: string): Promise<void>;
35
48
  create_client_port(): MessagePort;
36
- set_allow_anonymous(allow: boolean): void;
49
+ start_sys_topics_with_interval_secs(interval_secs: number): void;
37
50
  constructor();
51
+ add_role(name: string): Promise<void>;
38
52
  add_user(username: string, password: string): Promise<void>;
39
53
  has_user(username: string): Promise<boolean>;
40
54
  }
@@ -45,6 +59,7 @@ export class WasmBrokerConfig {
45
59
  constructor();
46
60
  set max_clients(value: number);
47
61
  set maximum_qos(value: number);
62
+ set allow_anonymous(value: boolean);
48
63
  set max_packet_size(value: number);
49
64
  set retain_available(value: boolean);
50
65
  set topic_alias_maximum(value: number);
@@ -206,21 +221,36 @@ export interface InitOutput {
206
221
  readonly wasmbridgeconfig_set_password: (a: number, b: number, c: number) => void;
207
222
  readonly wasmbridgeconfig_set_username: (a: number, b: number, c: number) => void;
208
223
  readonly wasmbridgeconfig_validate: (a: number) => [number, number];
224
+ readonly wasmbroker_acl_rule_count: (a: number) => any;
225
+ readonly wasmbroker_add_acl_rule: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
209
226
  readonly wasmbroker_add_bridge: (a: number, b: number, c: any) => any;
227
+ readonly wasmbroker_add_role: (a: number, b: number, c: number) => any;
228
+ readonly wasmbroker_add_role_rule: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
210
229
  readonly wasmbroker_add_user: (a: number, b: number, c: number, d: number, e: number) => any;
211
230
  readonly wasmbroker_add_user_with_hash: (a: number, b: number, c: number, d: number, e: number) => any;
231
+ readonly wasmbroker_assign_role: (a: number, b: number, c: number, d: number, e: number) => any;
232
+ readonly wasmbroker_clear_acl_rules: (a: number) => any;
233
+ readonly wasmbroker_clear_roles: (a: number) => any;
212
234
  readonly wasmbroker_create_client_port: (a: number) => [number, number, number];
235
+ readonly wasmbroker_get_user_roles: (a: number, b: number, c: number) => any;
213
236
  readonly wasmbroker_has_user: (a: number, b: number, c: number) => any;
214
237
  readonly wasmbroker_hash_password: (a: number, b: number) => [number, number, number, number];
215
238
  readonly wasmbroker_list_bridges: (a: number) => [number, number];
239
+ readonly wasmbroker_list_roles: (a: number) => any;
216
240
  readonly wasmbroker_new: () => [number, number, number];
217
241
  readonly wasmbroker_remove_bridge: (a: number, b: number, c: number) => any;
242
+ readonly wasmbroker_remove_role: (a: number, b: number, c: number) => any;
218
243
  readonly wasmbroker_remove_user: (a: number, b: number, c: number) => any;
219
- readonly wasmbroker_set_allow_anonymous: (a: number, b: number) => void;
244
+ readonly wasmbroker_role_count: (a: number) => any;
245
+ readonly wasmbroker_start_sys_topics: (a: number) => void;
246
+ readonly wasmbroker_start_sys_topics_with_interval_secs: (a: number, b: number) => void;
220
247
  readonly wasmbroker_stop_all_bridges: (a: number) => any;
248
+ readonly wasmbroker_stop_sys_topics: (a: number) => void;
249
+ readonly wasmbroker_unassign_role: (a: number, b: number, c: number, d: number, e: number) => any;
221
250
  readonly wasmbroker_user_count: (a: number) => any;
222
251
  readonly wasmbroker_with_config: (a: number) => [number, number, number];
223
252
  readonly wasmbrokerconfig_new: () => number;
253
+ readonly wasmbrokerconfig_set_allow_anonymous: (a: number, b: number) => void;
224
254
  readonly wasmbrokerconfig_set_max_clients: (a: number, b: number) => void;
225
255
  readonly wasmbrokerconfig_set_max_packet_size: (a: number, b: number) => void;
226
256
  readonly wasmbrokerconfig_set_maximum_qos: (a: number, b: number) => void;
@@ -254,6 +284,7 @@ export interface InitOutput {
254
284
  readonly wasmconnectoptions_set_receiveMaximum: (a: number, b: number) => void;
255
285
  readonly wasmconnectoptions_set_requestProblemInformation: (a: number, b: number) => void;
256
286
  readonly wasmconnectoptions_set_requestResponseInformation: (a: number, b: number) => void;
287
+ readonly wasmconnectoptions_set_sessionExpiryInterval: (a: number, b: number) => void;
257
288
  readonly wasmconnectoptions_set_topicAliasMaximum: (a: number, b: number) => void;
258
289
  readonly wasmconnectoptions_set_username: (a: number, b: number, c: number) => void;
259
290
  readonly wasmconnectoptions_set_will: (a: number, b: number) => void;
@@ -262,6 +293,7 @@ export interface InitOutput {
262
293
  readonly wasmmessageproperties_contentType: (a: number) => [number, number];
263
294
  readonly wasmmessageproperties_correlationData: (a: number) => [number, number];
264
295
  readonly wasmmessageproperties_getUserProperties: (a: number) => any;
296
+ readonly wasmmessageproperties_messageExpiryInterval: (a: number) => number;
265
297
  readonly wasmmessageproperties_payloadFormatIndicator: (a: number) => number;
266
298
  readonly wasmmessageproperties_responseTopic: (a: number) => [number, number];
267
299
  readonly wasmmessageproperties_subscriptionIdentifiers: (a: number) => [number, number];
@@ -289,6 +321,7 @@ export interface InitOutput {
289
321
  readonly wasmpublishoptions_addUserProperty: (a: number, b: number, c: number, d: number, e: number) => void;
290
322
  readonly wasmpublishoptions_clearUserProperties: (a: number) => void;
291
323
  readonly wasmpublishoptions_contentType: (a: number) => [number, number];
324
+ readonly wasmpublishoptions_messageExpiryInterval: (a: number) => number;
292
325
  readonly wasmpublishoptions_new: () => number;
293
326
  readonly wasmpublishoptions_payloadFormatIndicator: (a: number) => number;
294
327
  readonly wasmpublishoptions_qos: (a: number) => number;
@@ -296,6 +329,7 @@ export interface InitOutput {
296
329
  readonly wasmpublishoptions_retain: (a: number) => number;
297
330
  readonly wasmpublishoptions_set_contentType: (a: number, b: number, c: number) => void;
298
331
  readonly wasmpublishoptions_set_correlationData: (a: number, b: number, c: number) => void;
332
+ readonly wasmpublishoptions_set_messageExpiryInterval: (a: number, b: number) => void;
299
333
  readonly wasmpublishoptions_set_payloadFormatIndicator: (a: number, b: number) => void;
300
334
  readonly wasmpublishoptions_set_qos: (a: number, b: number) => void;
301
335
  readonly wasmpublishoptions_set_responseTopic: (a: number, b: number, c: number) => void;
@@ -311,46 +345,42 @@ export interface InitOutput {
311
345
  readonly wasmsubscribeoptions_set_qos: (a: number, b: number) => void;
312
346
  readonly wasmsubscribeoptions_set_retainAsPublished: (a: number, b: number) => void;
313
347
  readonly wasmsubscribeoptions_set_retainHandling: (a: number, b: number) => void;
348
+ readonly wasmsubscribeoptions_set_subscriptionIdentifier: (a: number, b: number) => void;
349
+ readonly wasmsubscribeoptions_subscriptionIdentifier: (a: number) => number;
314
350
  readonly wasmtopicmapping_new: (a: number, b: number, c: number) => number;
315
351
  readonly wasmtopicmapping_set_local_prefix: (a: number, b: number, c: number) => void;
316
352
  readonly wasmtopicmapping_set_qos: (a: number, b: number) => void;
317
353
  readonly wasmtopicmapping_set_remote_prefix: (a: number, b: number, c: number) => void;
318
354
  readonly wasmwillmessage_contentType: (a: number) => [number, number];
355
+ readonly wasmwillmessage_messageExpiryInterval: (a: number) => number;
319
356
  readonly wasmwillmessage_new: (a: number, b: number, c: number, d: number) => number;
320
357
  readonly wasmwillmessage_qos: (a: number) => number;
321
358
  readonly wasmwillmessage_responseTopic: (a: number) => [number, number];
322
359
  readonly wasmwillmessage_retain: (a: number) => number;
323
360
  readonly wasmwillmessage_set_contentType: (a: number, b: number, c: number) => void;
361
+ readonly wasmwillmessage_set_messageExpiryInterval: (a: number, b: number) => void;
324
362
  readonly wasmwillmessage_set_qos: (a: number, b: number) => void;
325
363
  readonly wasmwillmessage_set_responseTopic: (a: number, b: number, c: number) => void;
326
364
  readonly wasmwillmessage_set_retain: (a: number, b: number) => void;
327
365
  readonly wasmwillmessage_set_topic: (a: number, b: number, c: number) => void;
366
+ readonly wasmwillmessage_set_willDelayInterval: (a: number, b: number) => void;
328
367
  readonly wasmwillmessage_topic: (a: number) => [number, number];
329
- readonly wasmmessageproperties_messageExpiryInterval: (a: number) => number;
330
- readonly wasmpublishoptions_messageExpiryInterval: (a: number) => number;
331
- readonly wasmsubscribeoptions_subscriptionIdentifier: (a: number) => number;
332
- readonly wasmwillmessage_messageExpiryInterval: (a: number) => number;
333
368
  readonly wasmwillmessage_willDelayInterval: (a: number) => number;
334
- readonly wasmconnectoptions_set_sessionExpiryInterval: (a: number, b: number) => void;
335
- readonly wasmpublishoptions_set_messageExpiryInterval: (a: number, b: number) => void;
336
- readonly wasmsubscribeoptions_set_subscriptionIdentifier: (a: number, b: number) => void;
337
- readonly wasmwillmessage_set_willDelayInterval: (a: number, b: number) => void;
338
- readonly wasmwillmessage_set_messageExpiryInterval: (a: number, b: number) => void;
339
- readonly wasm_bindgen__convert__closures_____invoke__h0669e1264d41ddde: (a: number, b: number, c: any) => void;
340
- readonly wasm_bindgen__closure__destroy__h49e187871d56b618: (a: number, b: number) => void;
341
- readonly wasm_bindgen__convert__closures_____invoke__he72b1024119f349e: (a: number, b: number) => void;
342
- readonly wasm_bindgen__closure__destroy__h010cf814693e663b: (a: number, b: number) => void;
343
- readonly wasm_bindgen__convert__closures_____invoke__h12ffa24d99e28e58: (a: number, b: number, c: any) => void;
344
- readonly wasm_bindgen__closure__destroy__hebcaa2b719f28442: (a: number, b: number) => void;
345
- readonly wasm_bindgen__convert__closures_____invoke__h2d9e646cfc355363: (a: number, b: number, c: any, d: any) => void;
369
+ readonly wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0: (a: number, b: number, c: any) => void;
370
+ readonly wasm_bindgen__closure__destroy__h849099dfd9acf928: (a: number, b: number) => void;
371
+ readonly wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b: (a: number, b: number) => void;
372
+ readonly wasm_bindgen__closure__destroy__he9d43d9a42a0e056: (a: number, b: number) => void;
373
+ readonly wasm_bindgen__convert__closures_____invoke__h834c21a82254f81d: (a: number, b: number, c: any) => void;
374
+ readonly wasm_bindgen__closure__destroy__h1cc6a113486e5735: (a: number, b: number) => void;
375
+ readonly wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf: (a: number, b: number, c: any, d: any) => void;
346
376
  readonly __wbindgen_malloc: (a: number, b: number) => number;
347
377
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
348
378
  readonly __wbindgen_exn_store: (a: number) => void;
349
379
  readonly __externref_table_alloc: () => number;
350
380
  readonly __wbindgen_externrefs: WebAssembly.Table;
351
381
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
352
- readonly __externref_table_dealloc: (a: number) => void;
353
382
  readonly __externref_drop_slice: (a: number, b: number) => void;
383
+ readonly __externref_table_dealloc: (a: number) => void;
354
384
  readonly __wbindgen_start: () => void;
355
385
  }
356
386
 
package/mqtt5_wasm.js CHANGED
@@ -251,20 +251,20 @@ if (!('encodeInto' in cachedTextEncoder)) {
251
251
 
252
252
  let WASM_VECTOR_LEN = 0;
253
253
 
254
- function wasm_bindgen__convert__closures_____invoke__h0669e1264d41ddde(arg0, arg1, arg2) {
255
- wasm.wasm_bindgen__convert__closures_____invoke__h0669e1264d41ddde(arg0, arg1, arg2);
254
+ function wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0(arg0, arg1, arg2) {
255
+ wasm.wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0(arg0, arg1, arg2);
256
256
  }
257
257
 
258
- function wasm_bindgen__convert__closures_____invoke__he72b1024119f349e(arg0, arg1) {
259
- wasm.wasm_bindgen__convert__closures_____invoke__he72b1024119f349e(arg0, arg1);
258
+ function wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b(arg0, arg1) {
259
+ wasm.wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b(arg0, arg1);
260
260
  }
261
261
 
262
- function wasm_bindgen__convert__closures_____invoke__h12ffa24d99e28e58(arg0, arg1, arg2) {
263
- wasm.wasm_bindgen__convert__closures_____invoke__h12ffa24d99e28e58(arg0, arg1, arg2);
262
+ function wasm_bindgen__convert__closures_____invoke__h834c21a82254f81d(arg0, arg1, arg2) {
263
+ wasm.wasm_bindgen__convert__closures_____invoke__h834c21a82254f81d(arg0, arg1, arg2);
264
264
  }
265
265
 
266
- function wasm_bindgen__convert__closures_____invoke__h2d9e646cfc355363(arg0, arg1, arg2, arg3) {
267
- wasm.wasm_bindgen__convert__closures_____invoke__h2d9e646cfc355363(arg0, arg1, arg2, arg3);
266
+ function wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(arg0, arg1, arg2, arg3) {
267
+ wasm.wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(arg0, arg1, arg2, arg3);
268
268
  }
269
269
 
270
270
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -422,6 +422,20 @@ export class WasmBroker {
422
422
  const ret = wasm.wasmbroker_add_bridge(this.__wbg_ptr, ptr0, remote_port);
423
423
  return ret;
424
424
  }
425
+ /**
426
+ * @returns {Promise<string[]>}
427
+ */
428
+ list_roles() {
429
+ const ret = wasm.wasmbroker_list_roles(this.__wbg_ptr);
430
+ return ret;
431
+ }
432
+ /**
433
+ * @returns {Promise<number>}
434
+ */
435
+ role_count() {
436
+ const ret = wasm.wasmbroker_role_count(this.__wbg_ptr);
437
+ return ret;
438
+ }
425
439
  /**
426
440
  * @returns {Promise<number>}
427
441
  */
@@ -429,6 +443,36 @@ export class WasmBroker {
429
443
  const ret = wasm.wasmbroker_user_count(this.__wbg_ptr);
430
444
  return ret;
431
445
  }
446
+ /**
447
+ * @param {string} username
448
+ * @param {string} role_name
449
+ * @returns {Promise<void>}
450
+ */
451
+ assign_role(username, role_name) {
452
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
453
+ const len0 = WASM_VECTOR_LEN;
454
+ const ptr1 = passStringToWasm0(role_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
455
+ const len1 = WASM_VECTOR_LEN;
456
+ const ret = wasm.wasmbroker_assign_role(this.__wbg_ptr, ptr0, len0, ptr1, len1);
457
+ return ret;
458
+ }
459
+ /**
460
+ * @returns {Promise<void>}
461
+ */
462
+ clear_roles() {
463
+ const ret = wasm.wasmbroker_clear_roles(this.__wbg_ptr);
464
+ return ret;
465
+ }
466
+ /**
467
+ * @param {string} name
468
+ * @returns {Promise<boolean>}
469
+ */
470
+ remove_role(name) {
471
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ret = wasm.wasmbroker_remove_role(this.__wbg_ptr, ptr0, len0);
474
+ return ret;
475
+ }
432
476
  /**
433
477
  * @param {string} username
434
478
  * @returns {Promise<boolean>}
@@ -452,6 +496,22 @@ export class WasmBroker {
452
496
  }
453
497
  return WasmBroker.__wrap(ret[0]);
454
498
  }
499
+ /**
500
+ * @param {string} username
501
+ * @param {string} topic_pattern
502
+ * @param {string} permission
503
+ * @returns {Promise<void>}
504
+ */
505
+ add_acl_rule(username, topic_pattern, permission) {
506
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
507
+ const len0 = WASM_VECTOR_LEN;
508
+ const ptr1 = passStringToWasm0(topic_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
509
+ const len1 = WASM_VECTOR_LEN;
510
+ const ptr2 = passStringToWasm0(permission, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
511
+ const len2 = WASM_VECTOR_LEN;
512
+ const ret = wasm.wasmbroker_add_acl_rule(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
513
+ return ret;
514
+ }
455
515
  /**
456
516
  * @returns {string[]}
457
517
  */
@@ -461,6 +521,22 @@ export class WasmBroker {
461
521
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
462
522
  return v1;
463
523
  }
524
+ /**
525
+ * @param {string} role_name
526
+ * @param {string} topic_pattern
527
+ * @param {string} permission
528
+ * @returns {Promise<void>}
529
+ */
530
+ add_role_rule(role_name, topic_pattern, permission) {
531
+ const ptr0 = passStringToWasm0(role_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
532
+ const len0 = WASM_VECTOR_LEN;
533
+ const ptr1 = passStringToWasm0(topic_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
534
+ const len1 = WASM_VECTOR_LEN;
535
+ const ptr2 = passStringToWasm0(permission, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
536
+ const len2 = WASM_VECTOR_LEN;
537
+ const ret = wasm.wasmbroker_add_role_rule(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
538
+ return ret;
539
+ }
464
540
  /**
465
541
  * @param {string} password
466
542
  * @returns {string}
@@ -495,6 +571,49 @@ export class WasmBroker {
495
571
  const ret = wasm.wasmbroker_remove_bridge(this.__wbg_ptr, ptr0, len0);
496
572
  return ret;
497
573
  }
574
+ /**
575
+ * @param {string} username
576
+ * @param {string} role_name
577
+ * @returns {Promise<boolean>}
578
+ */
579
+ unassign_role(username, role_name) {
580
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
581
+ const len0 = WASM_VECTOR_LEN;
582
+ const ptr1 = passStringToWasm0(role_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
583
+ const len1 = WASM_VECTOR_LEN;
584
+ const ret = wasm.wasmbroker_unassign_role(this.__wbg_ptr, ptr0, len0, ptr1, len1);
585
+ return ret;
586
+ }
587
+ /**
588
+ * @returns {Promise<number>}
589
+ */
590
+ acl_rule_count() {
591
+ const ret = wasm.wasmbroker_acl_rule_count(this.__wbg_ptr);
592
+ return ret;
593
+ }
594
+ /**
595
+ * @param {string} username
596
+ * @returns {Promise<string[]>}
597
+ */
598
+ get_user_roles(username) {
599
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
600
+ const len0 = WASM_VECTOR_LEN;
601
+ const ret = wasm.wasmbroker_get_user_roles(this.__wbg_ptr, ptr0, len0);
602
+ return ret;
603
+ }
604
+ /**
605
+ * @returns {Promise<void>}
606
+ */
607
+ clear_acl_rules() {
608
+ const ret = wasm.wasmbroker_clear_acl_rules(this.__wbg_ptr);
609
+ return ret;
610
+ }
611
+ stop_sys_topics() {
612
+ wasm.wasmbroker_stop_sys_topics(this.__wbg_ptr);
613
+ }
614
+ start_sys_topics() {
615
+ wasm.wasmbroker_start_sys_topics(this.__wbg_ptr);
616
+ }
498
617
  /**
499
618
  * @returns {Promise<void>}
500
619
  */
@@ -526,10 +645,10 @@ export class WasmBroker {
526
645
  return takeFromExternrefTable0(ret[0]);
527
646
  }
528
647
  /**
529
- * @param {boolean} allow
648
+ * @param {number} interval_secs
530
649
  */
531
- set_allow_anonymous(allow) {
532
- wasm.wasmbroker_set_allow_anonymous(this.__wbg_ptr, allow);
650
+ start_sys_topics_with_interval_secs(interval_secs) {
651
+ wasm.wasmbroker_start_sys_topics_with_interval_secs(this.__wbg_ptr, interval_secs);
533
652
  }
534
653
  constructor() {
535
654
  const ret = wasm.wasmbroker_new();
@@ -540,6 +659,16 @@ export class WasmBroker {
540
659
  WasmBrokerFinalization.register(this, this.__wbg_ptr, this);
541
660
  return this;
542
661
  }
662
+ /**
663
+ * @param {string} name
664
+ * @returns {Promise<void>}
665
+ */
666
+ add_role(name) {
667
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
668
+ const len0 = WASM_VECTOR_LEN;
669
+ const ret = wasm.wasmbroker_add_role(this.__wbg_ptr, ptr0, len0);
670
+ return ret;
671
+ }
543
672
  /**
544
673
  * @param {string} username
545
674
  * @param {string} password
@@ -589,6 +718,12 @@ export class WasmBrokerConfig {
589
718
  set maximum_qos(value) {
590
719
  wasm.wasmbrokerconfig_set_maximum_qos(this.__wbg_ptr, value);
591
720
  }
721
+ /**
722
+ * @param {boolean} value
723
+ */
724
+ set allow_anonymous(value) {
725
+ wasm.wasmbrokerconfig_set_allow_anonymous(this.__wbg_ptr, value);
726
+ }
592
727
  /**
593
728
  * @param {number} value
594
729
  */
@@ -807,7 +942,7 @@ export class WasmConnectOptions {
807
942
  * @param {number | null} [value]
808
943
  */
809
944
  set sessionExpiryInterval(value) {
810
- wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
945
+ wasm.wasmconnectoptions_set_sessionExpiryInterval(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
811
946
  }
812
947
  /**
813
948
  * @returns {boolean | undefined}
@@ -929,7 +1064,7 @@ export class WasmMessageProperties {
929
1064
  * @returns {number | undefined}
930
1065
  */
931
1066
  get messageExpiryInterval() {
932
- const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
1067
+ const ret = wasm.wasmmessageproperties_messageExpiryInterval(this.__wbg_ptr);
933
1068
  return ret === 0x100000001 ? undefined : ret;
934
1069
  }
935
1070
  /**
@@ -1270,7 +1405,7 @@ export class WasmPublishOptions {
1270
1405
  * @returns {number | undefined}
1271
1406
  */
1272
1407
  get messageExpiryInterval() {
1273
- const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
1408
+ const ret = wasm.wasmpublishoptions_messageExpiryInterval(this.__wbg_ptr);
1274
1409
  return ret === 0x100000001 ? undefined : ret;
1275
1410
  }
1276
1411
  /**
@@ -1284,7 +1419,7 @@ export class WasmPublishOptions {
1284
1419
  * @param {number | null} [value]
1285
1420
  */
1286
1421
  set messageExpiryInterval(value) {
1287
- wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1422
+ wasm.wasmpublishoptions_set_messageExpiryInterval(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1288
1423
  }
1289
1424
  /**
1290
1425
  * @param {boolean | null} [value]
@@ -1368,14 +1503,14 @@ export class WasmSubscribeOptions {
1368
1503
  * @returns {number | undefined}
1369
1504
  */
1370
1505
  get subscriptionIdentifier() {
1371
- const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
1506
+ const ret = wasm.wasmsubscribeoptions_subscriptionIdentifier(this.__wbg_ptr);
1372
1507
  return ret === 0x100000001 ? undefined : ret;
1373
1508
  }
1374
1509
  /**
1375
1510
  * @param {number | null} [value]
1376
1511
  */
1377
1512
  set subscriptionIdentifier(value) {
1378
- wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1513
+ wasm.wasmsubscribeoptions_set_subscriptionIdentifier(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1379
1514
  }
1380
1515
  constructor() {
1381
1516
  const ret = wasm.wasmsubscribeoptions_new();
@@ -1515,27 +1650,27 @@ export class WasmWillMessage {
1515
1650
  * @returns {number | undefined}
1516
1651
  */
1517
1652
  get willDelayInterval() {
1518
- const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
1653
+ const ret = wasm.wasmwillmessage_willDelayInterval(this.__wbg_ptr);
1519
1654
  return ret === 0x100000001 ? undefined : ret;
1520
1655
  }
1521
1656
  /**
1522
1657
  * @returns {number | undefined}
1523
1658
  */
1524
1659
  get messageExpiryInterval() {
1525
- const ret = wasm.wasmconnectoptions_maximumPacketSize(this.__wbg_ptr);
1660
+ const ret = wasm.wasmwillmessage_messageExpiryInterval(this.__wbg_ptr);
1526
1661
  return ret === 0x100000001 ? undefined : ret;
1527
1662
  }
1528
1663
  /**
1529
1664
  * @param {number | null} [value]
1530
1665
  */
1531
1666
  set willDelayInterval(value) {
1532
- wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1667
+ wasm.wasmwillmessage_set_willDelayInterval(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1533
1668
  }
1534
1669
  /**
1535
1670
  * @param {number | null} [value]
1536
1671
  */
1537
1672
  set messageExpiryInterval(value) {
1538
- wasm.wasmconnectoptions_set_maximumPacketSize(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1673
+ wasm.wasmwillmessage_set_messageExpiryInterval(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1539
1674
  }
1540
1675
  /**
1541
1676
  * @param {string} topic
@@ -1761,7 +1896,7 @@ function __wbg_get_imports() {
1761
1896
  const a = state0.a;
1762
1897
  state0.a = 0;
1763
1898
  try {
1764
- return wasm_bindgen__convert__closures_____invoke__h2d9e646cfc355363(a, state0.b, arg0, arg1);
1899
+ return wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(a, state0.b, arg0, arg1);
1765
1900
  } finally {
1766
1901
  state0.a = a;
1767
1902
  }
@@ -1906,19 +2041,26 @@ function __wbg_get_imports() {
1906
2041
  const ret = getStringFromWasm0(arg0, arg1);
1907
2042
  return ret;
1908
2043
  };
1909
- imports.wbg.__wbindgen_cast_3b08804410be858c = function(arg0, arg1) {
1910
- // Cast intrinsic for `Closure(Closure { dtor_idx: 13, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 14, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1911
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h49e187871d56b618, wasm_bindgen__convert__closures_____invoke__h0669e1264d41ddde);
2044
+ imports.wbg.__wbindgen_cast_25a0a844437d0e92 = function(arg0, arg1) {
2045
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
2046
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
2047
+ // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
2048
+ const ret = v0;
2049
+ return ret;
2050
+ };
2051
+ imports.wbg.__wbindgen_cast_7249b77047b5c954 = function(arg0, arg1) {
2052
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 355, function: Function { arguments: [], shim_idx: 356, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2053
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he9d43d9a42a0e056, wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b);
1912
2054
  return ret;
1913
2055
  };
1914
- imports.wbg.__wbindgen_cast_4de2fdf31531b840 = function(arg0, arg1) {
1915
- // Cast intrinsic for `Closure(Closure { dtor_idx: 13, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 14, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1916
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h49e187871d56b618, wasm_bindgen__convert__closures_____invoke__h0669e1264d41ddde);
2056
+ imports.wbg.__wbindgen_cast_a6d58121ace2ceaa = function(arg0, arg1) {
2057
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2058
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1cc6a113486e5735, wasm_bindgen__convert__closures_____invoke__h834c21a82254f81d);
1917
2059
  return ret;
1918
2060
  };
1919
- imports.wbg.__wbindgen_cast_6c5b6c989d728adc = function(arg0, arg1) {
1920
- // Cast intrinsic for `Closure(Closure { dtor_idx: 270, function: Function { arguments: [Externref], shim_idx: 271, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1921
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hebcaa2b719f28442, wasm_bindgen__convert__closures_____invoke__h12ffa24d99e28e58);
2061
+ imports.wbg.__wbindgen_cast_d3f7166d7f91ad34 = function(arg0, arg1) {
2062
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2063
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1cc6a113486e5735, wasm_bindgen__convert__closures_____invoke__h834c21a82254f81d);
1922
2064
  return ret;
1923
2065
  };
1924
2066
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
@@ -1926,14 +2068,14 @@ function __wbg_get_imports() {
1926
2068
  const ret = arg0;
1927
2069
  return ret;
1928
2070
  };
1929
- imports.wbg.__wbindgen_cast_e7cbf2f9a6ee5b78 = function(arg0, arg1) {
1930
- // Cast intrinsic for `Closure(Closure { dtor_idx: 259, function: Function { arguments: [], shim_idx: 260, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1931
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h010cf814693e663b, wasm_bindgen__convert__closures_____invoke__he72b1024119f349e);
2071
+ imports.wbg.__wbindgen_cast_e7f97fba0726b4ab = function(arg0, arg1) {
2072
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 366, function: Function { arguments: [Externref], shim_idx: 367, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2073
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h849099dfd9acf928, wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0);
1932
2074
  return ret;
1933
2075
  };
1934
- imports.wbg.__wbindgen_cast_ff1a1195be1e8b11 = function(arg0, arg1) {
1935
- // Cast intrinsic for `Closure(Closure { dtor_idx: 13, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 14, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1936
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h49e187871d56b618, wasm_bindgen__convert__closures_____invoke__h0669e1264d41ddde);
2076
+ imports.wbg.__wbindgen_cast_fac85390ef55bfaa = function(arg0, arg1) {
2077
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2078
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1cc6a113486e5735, wasm_bindgen__convert__closures_____invoke__h834c21a82254f81d);
1937
2079
  return ret;
1938
2080
  };
1939
2081
  imports.wbg.__wbindgen_init_externref_table = function() {
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "fabriciobracht <fabricio@bracht.dev>"
6
6
  ],
7
7
  "description": "MQTT v5.0 WebAssembly client and broker for browser environments",
8
- "version": "0.3.0",
8
+ "version": "0.6.1",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",