unetjs 3.1.2 → 3.1.4

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/dist/cjs/unet.cjs CHANGED
@@ -1,8 +1,8 @@
1
- /* unet.js v3.1.2 2024-02-21T08:15:43.663Z */
1
+ /* unet.js v3.1.4 2024-04-02T09:46:40.762Z */
2
2
 
3
3
  'use strict';
4
4
 
5
- /* fjage.js v1.12.1 */
5
+ /* fjage.js v1.12.2 */
6
6
 
7
7
  const isBrowser =
8
8
  typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -864,6 +864,16 @@ class Gateway {
864
864
  return conn;
865
865
  }
866
866
 
867
+ /** @private */
868
+ _isConstructor(value) {
869
+ try {
870
+ new new Proxy(value, {construct() { return {}; }});
871
+ return true;
872
+ } catch (err) {
873
+ return false;
874
+ }
875
+ }
876
+
867
877
  /** @private */
868
878
  _matchMessage(filter, msg){
869
879
  if (typeof filter == 'string' || filter instanceof String) {
@@ -872,7 +882,7 @@ class Gateway {
872
882
  return 'inReplyTo' in msg && msg.inReplyTo == filter.msgID;
873
883
  } else if (filter.__proto__.name == 'Message' || filter.__proto__.__proto__.name == 'Message') {
874
884
  return filter.__clazz__ == msg.__clazz__;
875
- } else if (typeof filter == 'function') {
885
+ } else if (typeof filter == 'function' && !this._isConstructor(filter)) {
876
886
  try {
877
887
  return filter(msg);
878
888
  }catch(e){
package/dist/esm/unet.js CHANGED
@@ -1,6 +1,6 @@
1
- /* unet.js v3.1.2 2024-02-21T08:15:43.662Z */
1
+ /* unet.js v3.1.4 2024-04-02T09:46:40.761Z */
2
2
 
3
- /* fjage.js v1.12.1 */
3
+ /* fjage.js v1.12.2 */
4
4
 
5
5
  const isBrowser =
6
6
  typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -862,6 +862,16 @@ class Gateway {
862
862
  return conn;
863
863
  }
864
864
 
865
+ /** @private */
866
+ _isConstructor(value) {
867
+ try {
868
+ new new Proxy(value, {construct() { return {}; }});
869
+ return true;
870
+ } catch (err) {
871
+ return false;
872
+ }
873
+ }
874
+
865
875
  /** @private */
866
876
  _matchMessage(filter, msg){
867
877
  if (typeof filter == 'string' || filter instanceof String) {
@@ -870,7 +880,7 @@ class Gateway {
870
880
  return 'inReplyTo' in msg && msg.inReplyTo == filter.msgID;
871
881
  } else if (filter.__proto__.name == 'Message' || filter.__proto__.__proto__.name == 'Message') {
872
882
  return filter.__clazz__ == msg.__clazz__;
873
- } else if (typeof filter == 'function') {
883
+ } else if (typeof filter == 'function' && !this._isConstructor(filter)) {
874
884
  try {
875
885
  return filter(msg);
876
886
  }catch(e){
package/dist/unetjs.js CHANGED
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.unet = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- /* fjage.js v1.12.1 */
7
+ /* fjage.js v1.12.2 */
8
8
 
9
9
  const isBrowser =
10
10
  typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -866,6 +866,16 @@
866
866
  return conn;
867
867
  }
868
868
 
869
+ /** @private */
870
+ _isConstructor(value) {
871
+ try {
872
+ new new Proxy(value, {construct() { return {}; }});
873
+ return true;
874
+ } catch (err) {
875
+ return false;
876
+ }
877
+ }
878
+
869
879
  /** @private */
870
880
  _matchMessage(filter, msg){
871
881
  if (typeof filter == 'string' || filter instanceof String) {
@@ -874,7 +884,7 @@
874
884
  return 'inReplyTo' in msg && msg.inReplyTo == filter.msgID;
875
885
  } else if (filter.__proto__.name == 'Message' || filter.__proto__.__proto__.name == 'Message') {
876
886
  return filter.__clazz__ == msg.__clazz__;
877
- } else if (typeof filter == 'function') {
887
+ } else if (typeof filter == 'function' && !this._isConstructor(filter)) {
878
888
  try {
879
889
  return filter(msg);
880
890
  }catch(e){