mqtt5-wasm 0.3.0 → 0.4.0

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.4"
27
27
  ```
28
28
 
29
29
  Build with wasm-pack:
package/mqtt5_wasm.d.ts CHANGED
@@ -27,13 +27,15 @@ export class WasmBroker {
27
27
  user_count(): Promise<number>;
28
28
  remove_user(username: string): Promise<boolean>;
29
29
  static with_config(wasm_config: WasmBrokerConfig): WasmBroker;
30
+ add_acl_rule(username: string, topic_pattern: string, permission: string): Promise<void>;
30
31
  list_bridges(): string[];
31
32
  static hash_password(password: string): string;
32
33
  remove_bridge(name: string): Promise<void>;
34
+ acl_rule_count(): Promise<number>;
35
+ clear_acl_rules(): Promise<void>;
33
36
  stop_all_bridges(): Promise<void>;
34
37
  add_user_with_hash(username: string, password_hash: string): Promise<void>;
35
38
  create_client_port(): MessagePort;
36
- set_allow_anonymous(allow: boolean): void;
37
39
  constructor();
38
40
  add_user(username: string, password: string): Promise<void>;
39
41
  has_user(username: string): Promise<boolean>;
@@ -45,6 +47,7 @@ export class WasmBrokerConfig {
45
47
  constructor();
46
48
  set max_clients(value: number);
47
49
  set maximum_qos(value: number);
50
+ set allow_anonymous(value: boolean);
48
51
  set max_packet_size(value: number);
49
52
  set retain_available(value: boolean);
50
53
  set topic_alias_maximum(value: number);
@@ -206,9 +209,12 @@ export interface InitOutput {
206
209
  readonly wasmbridgeconfig_set_password: (a: number, b: number, c: number) => void;
207
210
  readonly wasmbridgeconfig_set_username: (a: number, b: number, c: number) => void;
208
211
  readonly wasmbridgeconfig_validate: (a: number) => [number, number];
212
+ readonly wasmbroker_acl_rule_count: (a: number) => any;
213
+ readonly wasmbroker_add_acl_rule: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
209
214
  readonly wasmbroker_add_bridge: (a: number, b: number, c: any) => any;
210
215
  readonly wasmbroker_add_user: (a: number, b: number, c: number, d: number, e: number) => any;
211
216
  readonly wasmbroker_add_user_with_hash: (a: number, b: number, c: number, d: number, e: number) => any;
217
+ readonly wasmbroker_clear_acl_rules: (a: number) => any;
212
218
  readonly wasmbroker_create_client_port: (a: number) => [number, number, number];
213
219
  readonly wasmbroker_has_user: (a: number, b: number, c: number) => any;
214
220
  readonly wasmbroker_hash_password: (a: number, b: number) => [number, number, number, number];
@@ -216,11 +222,11 @@ export interface InitOutput {
216
222
  readonly wasmbroker_new: () => [number, number, number];
217
223
  readonly wasmbroker_remove_bridge: (a: number, b: number, c: number) => any;
218
224
  readonly wasmbroker_remove_user: (a: number, b: number, c: number) => any;
219
- readonly wasmbroker_set_allow_anonymous: (a: number, b: number) => void;
220
225
  readonly wasmbroker_stop_all_bridges: (a: number) => any;
221
226
  readonly wasmbroker_user_count: (a: number) => any;
222
227
  readonly wasmbroker_with_config: (a: number) => [number, number, number];
223
228
  readonly wasmbrokerconfig_new: () => number;
229
+ readonly wasmbrokerconfig_set_allow_anonymous: (a: number, b: number) => void;
224
230
  readonly wasmbrokerconfig_set_max_clients: (a: number, b: number) => void;
225
231
  readonly wasmbrokerconfig_set_max_packet_size: (a: number, b: number) => void;
226
232
  readonly wasmbrokerconfig_set_maximum_qos: (a: number, b: number) => void;
@@ -336,13 +342,13 @@ export interface InitOutput {
336
342
  readonly wasmsubscribeoptions_set_subscriptionIdentifier: (a: number, b: number) => void;
337
343
  readonly wasmwillmessage_set_willDelayInterval: (a: number, b: number) => void;
338
344
  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;
345
+ readonly wasm_bindgen__convert__closures_____invoke__h01763d79c10fe65e: (a: number, b: number, c: any) => void;
346
+ readonly wasm_bindgen__closure__destroy__h21a697eaf8c5d6e0: (a: number, b: number) => void;
347
+ readonly wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b: (a: number, b: number) => void;
348
+ readonly wasm_bindgen__closure__destroy__he9d43d9a42a0e056: (a: number, b: number) => void;
349
+ readonly wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0: (a: number, b: number, c: any) => void;
350
+ readonly wasm_bindgen__closure__destroy__h849099dfd9acf928: (a: number, b: number) => void;
351
+ readonly wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf: (a: number, b: number, c: any, d: any) => void;
346
352
  readonly __wbindgen_malloc: (a: number, b: number) => number;
347
353
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
348
354
  readonly __wbindgen_exn_store: (a: number) => void;
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__h01763d79c10fe65e(arg0, arg1, arg2) {
255
+ wasm.wasm_bindgen__convert__closures_____invoke__h01763d79c10fe65e(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__ha9d3e198cd0951b0(arg0, arg1, arg2) {
263
+ wasm.wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0(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"];
@@ -452,6 +452,22 @@ export class WasmBroker {
452
452
  }
453
453
  return WasmBroker.__wrap(ret[0]);
454
454
  }
455
+ /**
456
+ * @param {string} username
457
+ * @param {string} topic_pattern
458
+ * @param {string} permission
459
+ * @returns {Promise<void>}
460
+ */
461
+ add_acl_rule(username, topic_pattern, permission) {
462
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
463
+ const len0 = WASM_VECTOR_LEN;
464
+ const ptr1 = passStringToWasm0(topic_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
465
+ const len1 = WASM_VECTOR_LEN;
466
+ const ptr2 = passStringToWasm0(permission, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
467
+ const len2 = WASM_VECTOR_LEN;
468
+ const ret = wasm.wasmbroker_add_acl_rule(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
469
+ return ret;
470
+ }
455
471
  /**
456
472
  * @returns {string[]}
457
473
  */
@@ -495,6 +511,20 @@ export class WasmBroker {
495
511
  const ret = wasm.wasmbroker_remove_bridge(this.__wbg_ptr, ptr0, len0);
496
512
  return ret;
497
513
  }
514
+ /**
515
+ * @returns {Promise<number>}
516
+ */
517
+ acl_rule_count() {
518
+ const ret = wasm.wasmbroker_acl_rule_count(this.__wbg_ptr);
519
+ return ret;
520
+ }
521
+ /**
522
+ * @returns {Promise<void>}
523
+ */
524
+ clear_acl_rules() {
525
+ const ret = wasm.wasmbroker_clear_acl_rules(this.__wbg_ptr);
526
+ return ret;
527
+ }
498
528
  /**
499
529
  * @returns {Promise<void>}
500
530
  */
@@ -525,12 +555,6 @@ export class WasmBroker {
525
555
  }
526
556
  return takeFromExternrefTable0(ret[0]);
527
557
  }
528
- /**
529
- * @param {boolean} allow
530
- */
531
- set_allow_anonymous(allow) {
532
- wasm.wasmbroker_set_allow_anonymous(this.__wbg_ptr, allow);
533
- }
534
558
  constructor() {
535
559
  const ret = wasm.wasmbroker_new();
536
560
  if (ret[2]) {
@@ -589,6 +613,12 @@ export class WasmBrokerConfig {
589
613
  set maximum_qos(value) {
590
614
  wasm.wasmbrokerconfig_set_maximum_qos(this.__wbg_ptr, value);
591
615
  }
616
+ /**
617
+ * @param {boolean} value
618
+ */
619
+ set allow_anonymous(value) {
620
+ wasm.wasmbrokerconfig_set_allow_anonymous(this.__wbg_ptr, value);
621
+ }
592
622
  /**
593
623
  * @param {number} value
594
624
  */
@@ -1761,7 +1791,7 @@ function __wbg_get_imports() {
1761
1791
  const a = state0.a;
1762
1792
  state0.a = 0;
1763
1793
  try {
1764
- return wasm_bindgen__convert__closures_____invoke__h2d9e646cfc355363(a, state0.b, arg0, arg1);
1794
+ return wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(a, state0.b, arg0, arg1);
1765
1795
  } finally {
1766
1796
  state0.a = a;
1767
1797
  }
@@ -1906,19 +1936,24 @@ function __wbg_get_imports() {
1906
1936
  const ret = getStringFromWasm0(arg0, arg1);
1907
1937
  return ret;
1908
1938
  };
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);
1939
+ imports.wbg.__wbindgen_cast_272c165660a21b68 = function(arg0, arg1) {
1940
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 280, function: Function { arguments: [Externref], shim_idx: 281, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1941
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h849099dfd9acf928, wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0);
1912
1942
  return ret;
1913
1943
  };
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);
1944
+ imports.wbg.__wbindgen_cast_7776c8637c2963f5 = function(arg0, arg1) {
1945
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 14, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 15, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1946
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h21a697eaf8c5d6e0, wasm_bindgen__convert__closures_____invoke__h01763d79c10fe65e);
1917
1947
  return ret;
1918
1948
  };
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);
1949
+ imports.wbg.__wbindgen_cast_943816c95a67e66d = function(arg0, arg1) {
1950
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 269, function: Function { arguments: [], shim_idx: 270, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1951
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he9d43d9a42a0e056, wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b);
1952
+ return ret;
1953
+ };
1954
+ imports.wbg.__wbindgen_cast_b05293a5b76000cf = function(arg0, arg1) {
1955
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 14, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 15, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1956
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h21a697eaf8c5d6e0, wasm_bindgen__convert__closures_____invoke__h01763d79c10fe65e);
1922
1957
  return ret;
1923
1958
  };
1924
1959
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
@@ -1926,14 +1961,9 @@ function __wbg_get_imports() {
1926
1961
  const ret = arg0;
1927
1962
  return ret;
1928
1963
  };
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);
1932
- return ret;
1933
- };
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);
1964
+ imports.wbg.__wbindgen_cast_e5e5fe8f2379daee = function(arg0, arg1) {
1965
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 14, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 15, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1966
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h21a697eaf8c5d6e0, wasm_bindgen__convert__closures_____invoke__h01763d79c10fe65e);
1937
1967
  return ret;
1938
1968
  };
1939
1969
  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.4.0",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",