u8-mqtt 0.3.0 → 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 +25 -10
  2. package/cjs/index.cjs +35 -8
  3. package/cjs/index.cjs.map +1 -1
  4. package/cjs/v4.cjs +35 -8
  5. package/cjs/v4.cjs.map +1 -1
  6. package/cjs/v5.cjs +35 -8
  7. package/cjs/v5.cjs.map +1 -1
  8. package/code/core.jsy +41 -15
  9. package/code/{index.mjs → index.js} +2 -1
  10. package/code/{v4.mjs → v4.js} +1 -0
  11. package/code/{v5.mjs → v5.js} +1 -0
  12. package/code/version.js +1 -0
  13. package/esm/deno/index.js +40 -15
  14. package/esm/deno/index.js.map +1 -1
  15. package/esm/deno/v4.js +40 -15
  16. package/esm/deno/v4.js.map +1 -1
  17. package/esm/deno/v5.js +40 -15
  18. package/esm/deno/v5.js.map +1 -1
  19. package/esm/node/index.js +34 -8
  20. package/esm/node/index.js.map +1 -1
  21. package/esm/node/index.mjs +34 -8
  22. package/esm/node/index.mjs.map +1 -1
  23. package/esm/node/v4.js +34 -8
  24. package/esm/node/v4.js.map +1 -1
  25. package/esm/node/v4.mjs +34 -8
  26. package/esm/node/v4.mjs.map +1 -1
  27. package/esm/node/v5.js +34 -8
  28. package/esm/node/v5.js.map +1 -1
  29. package/esm/node/v5.mjs +34 -8
  30. package/esm/node/v5.mjs.map +1 -1
  31. package/esm/web/index.js +29 -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 +29 -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 +29 -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 +6 -5
@@ -1,4 +1,5 @@
1
1
  import { connect } from 'node:net';
2
+ import { connect as connect$1 } from 'node:tls';
2
3
 
3
4
  function encode_varint(n, a=[]) {
4
5
  do {
@@ -869,8 +870,6 @@ function mqtt_pkt_ctx(mqtt_level, opts, pkt_ctx) {
869
870
  }
870
871
  }
871
872
 
872
- Object.freeze({ao_done: true});
873
-
874
873
  function ao_defer_ctx(as_res = (...args) => args) {
875
874
  let y,n,_pset = (a,b) => { y=a, n=b; };
876
875
  return p =>(
@@ -1450,7 +1449,7 @@ class MQTTCore extends MQTTBase {
1450
1449
  return this}
1451
1450
 
1452
1451
  //log_conn(evt, arg, err_arg) ::
1453
- //console.info @ '[[u8-mqtt log: %s]]', evt, arg, err_arg
1452
+ // console.info @ '[[u8-mqtt log: %s]]', evt, arg, err_arg
1454
1453
 
1455
1454
  on_live(client, is_reconnect) {
1456
1455
  if (is_reconnect) {
@@ -1492,6 +1491,7 @@ class MQTTCore extends MQTTBase {
1492
1491
  return this}
1493
1492
 
1494
1493
 
1494
+
1495
1495
 
1496
1496
 
1497
1497
 
@@ -1500,6 +1500,18 @@ class MQTTCore extends MQTTBase {
1500
1500
 
1501
1501
 
1502
1502
 
1503
+
1504
+
1505
+
1506
+
1507
+
1508
+
1509
+
1510
+
1511
+
1512
+
1513
+
1514
+
1503
1515
 
1504
1516
 
1505
1517
 
@@ -1509,13 +1521,25 @@ class MQTTCore extends MQTTBase {
1509
1521
 
1510
1522
 
1511
1523
 
1512
- with_tcp(port, hostname) {
1513
- if (!Number.isFinite(port)) {
1514
- ({port, hostname} = new URL(port));}
1524
+ with_tcp(...opt) {
1525
+ opt = this._conn_opt(opt);
1526
+ console.log({opt});
1527
+ return this._use_conn (() =>
1528
+ this.with_stream(
1529
+ connect(opt)) ) }
1515
1530
 
1531
+ with_tls(...opt) {
1532
+ opt = this._conn_opt(opt);
1516
1533
  return this._use_conn (() =>
1517
1534
  this.with_stream(
1518
- connect(port, hostname)) ) }
1535
+ connect$1(opt)) ) }
1536
+
1537
+ _conn_opt([a0, a1, a2]) {
1538
+ // (port, hostname, options) or (url, options)
1539
+ if (Number.isFinite(a0)) {
1540
+ return {...a2, port: a0, host: a1}}
1541
+ a0 = new URL(a0);
1542
+ return {...a1, port: a0.port, host: a0.hostname}}
1519
1543
 
1520
1544
 
1521
1545
  with_stream(read_stream, write_stream) {
@@ -1561,6 +1585,8 @@ class MQTTCore extends MQTTBase {
1561
1585
 
1562
1586
  return this} }
1563
1587
 
1588
+ const version = '0.3.2-0';
1589
+
1564
1590
  const MQTTClient_v4 = /* #__PURE__ */
1565
1591
  MQTTCore.mqtt_ctx(4, mqtt_opts_v5);
1566
1592
 
@@ -1573,5 +1599,5 @@ const mqtt_v4 = opt =>
1573
1599
  const mqtt_v5 = opt =>
1574
1600
  new MQTTClient_v5(opt);
1575
1601
 
1576
- export { MQTTBase, MQTTClient_v4, MQTTClient_v5, MQTTCore, MQTTError, _mqtt_cmdid_dispatch, _mqtt_conn, _mqtt_dispatch, _mqtt_route_match_one, _mqtt_route_remove, _mqtt_routes_iter, _mqtt_topic_router, ao_defer_v, mqtt_v4 as default, mqtt_v4, mqtt_v5 };
1602
+ export { MQTTBase, MQTTClient_v4, MQTTClient_v5, MQTTCore, MQTTError, _mqtt_cmdid_dispatch, _mqtt_conn, _mqtt_dispatch, _mqtt_route_match_one, _mqtt_route_remove, _mqtt_routes_iter, _mqtt_topic_router, ao_defer_v, mqtt_v4 as default, mqtt_v4, mqtt_v5, version };
1577
1603
  //# sourceMappingURL=index.mjs.map