u8-mqtt 0.3.1 → 0.3.2-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.
Files changed (46) hide show
  1. package/README.md +2 -2
  2. package/cjs/index.cjs +33 -9
  3. package/cjs/index.cjs.map +1 -1
  4. package/cjs/v4.cjs +33 -9
  5. package/cjs/v4.cjs.map +1 -1
  6. package/cjs/v5.cjs +33 -9
  7. package/cjs/v5.cjs.map +1 -1
  8. package/code/core.jsy +41 -15
  9. package/code/{index.mjs → index.js} +1 -1
  10. package/code/{v4.mjs → v4.js} +1 -1
  11. package/code/{v5.mjs → v5.js} +1 -1
  12. package/code/version.js +1 -0
  13. package/esm/deno/index.js +38 -15
  14. package/esm/deno/index.js.map +1 -1
  15. package/esm/deno/v4.js +38 -15
  16. package/esm/deno/v4.js.map +1 -1
  17. package/esm/deno/v5.js +38 -15
  18. package/esm/deno/v5.js.map +1 -1
  19. package/esm/node/index.js +32 -8
  20. package/esm/node/index.js.map +1 -1
  21. package/esm/node/index.mjs +32 -8
  22. package/esm/node/index.mjs.map +1 -1
  23. package/esm/node/v4.js +32 -8
  24. package/esm/node/v4.js.map +1 -1
  25. package/esm/node/v4.mjs +32 -8
  26. package/esm/node/v4.mjs.map +1 -1
  27. package/esm/node/v5.js +32 -8
  28. package/esm/node/v5.js.map +1 -1
  29. package/esm/node/v5.mjs +32 -8
  30. package/esm/node/v5.mjs.map +1 -1
  31. package/esm/web/index.js +27 -4
  32. package/esm/web/index.js.map +1 -1
  33. package/esm/web/index.min.js +1 -1
  34. package/esm/web/index.min.js.br +0 -0
  35. package/esm/web/index.min.js.gz +0 -0
  36. package/esm/web/v4.js +27 -4
  37. package/esm/web/v4.js.map +1 -1
  38. package/esm/web/v4.min.js +1 -1
  39. package/esm/web/v4.min.js.br +0 -0
  40. package/esm/web/v4.min.js.gz +0 -0
  41. package/esm/web/v5.js +27 -4
  42. package/esm/web/v5.js.map +1 -1
  43. package/esm/web/v5.min.js +1 -1
  44. package/esm/web/v5.min.js.br +0 -0
  45. package/esm/web/v5.min.js.gz +0 -0
  46. package/package.json +5 -5
package/esm/deno/v5.js CHANGED
@@ -867,8 +867,6 @@ function mqtt_pkt_ctx(mqtt_level, opts, pkt_ctx) {
867
867
  }
868
868
  }
869
869
 
870
- Object.freeze({ao_done: true});
871
-
872
870
  function ao_defer_ctx(as_res = (...args) => args) {
873
871
  let y,n,_pset = (a,b) => { y=a, n=b; };
874
872
  return p =>(
@@ -1448,7 +1446,7 @@ class MQTTCore extends MQTTBase {
1448
1446
  return this}
1449
1447
 
1450
1448
  //log_conn(evt, arg, err_arg) ::
1451
- //console.info @ '[[u8-mqtt log: %s]]', evt, arg, err_arg
1449
+ // console.info @ '[[u8-mqtt log: %s]]', evt, arg, err_arg
1452
1450
 
1453
1451
  on_live(client, is_reconnect) {
1454
1452
  if (is_reconnect) {
@@ -1490,23 +1488,48 @@ class MQTTCore extends MQTTBase {
1490
1488
  return this}
1491
1489
 
1492
1490
 
1491
+
1492
+
1493
+ with_tcp(...opt) {
1494
+ opt = this._conn_opt(opt);
1495
+ opt.transport = 'tcp';
1496
+ return this._use_conn (() =>
1497
+ this.with_deno_iter(
1498
+ Deno.connect(opt)) ) }
1499
+
1500
+ with_tls(...opt) {
1501
+ opt = this._conn_opt(opt);
1502
+ return this._use_conn (() =>
1503
+ this.with_deno_iter(
1504
+ Deno.connectTls(opt)) ) }
1505
+
1506
+ with_deno_iter(conn) {
1507
+ return this.with_async_iter(
1508
+ conn.then(Deno.iter),
1509
+ async u8_pkt =>
1510
+ (await conn).write(u8_pkt)) }
1511
+
1512
+ _conn_opt([a0, a1, a2]) {
1513
+ // (port, hostname, options) or (url, options)
1514
+ if (Number.isFinite(a0)) {
1515
+ return {...a2, port: a0, hostname: a1}}
1516
+
1517
+ a0 = new URL(a0);
1518
+ return {...a1, port: a0.port, hostname: a0.hostname}}
1519
+
1493
1520
 
1494
- with_tcp(port, hostname) {
1495
- if (!Number.isFinite(port)) {
1496
- ({port, hostname} = new URL(port));}
1497
1521
 
1498
- return this._use_conn (() => {
1499
- let conn = Deno.connect({
1500
- port, hostname, transport: 'tcp'});
1501
1522
 
1502
- this.with_async_iter(
1503
- conn.then(Deno.iter,)
1504
- , async u8_pkt => (await conn).write(u8_pkt));
1505
1523
 
1506
- return this}) }
1507
1524
 
1508
1525
 
1509
-
1526
+
1527
+
1528
+
1529
+
1530
+
1531
+
1532
+
1510
1533
 
1511
1534
 
1512
1535
 
@@ -1559,7 +1582,7 @@ class MQTTCore extends MQTTBase {
1559
1582
 
1560
1583
  return this} }
1561
1584
 
1562
- var version = "0.3.1";
1585
+ const version = '0.3.2-0';
1563
1586
 
1564
1587
  const MQTTClient_v4 = /* #__PURE__ */
1565
1588
  MQTTCore.mqtt_ctx(4, mqtt_opts_v5);