@hinkal/common 0.0.126 → 0.0.128

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.
@@ -7,6 +7,8 @@ export interface ChainEventListener {
7
7
  }
8
8
  export interface IProviderAdapter<ConnectorType = unknown> {
9
9
  chainId: number | undefined;
10
+ constructor: Function;
11
+ new?: (connector: ConnectorType) => IProviderAdapter<ConnectorType>;
10
12
  init(chainId?: number): Promise<void>;
11
13
  connectToConnector(connector: ConnectorType): Promise<number>;
12
14
  disconnectFromConnector(): Promise<void>;
package/index.mjs CHANGED
@@ -236951,7 +236951,7 @@ function fromRprBE$2(C, I, l) {
236951
236951
  d[W] = Z.getUint32(W * 4, !1).toString(16).padStart(8, "0");
236952
236952
  return fromString$3(d.join(""), 16);
236953
236953
  }
236954
- function toString$a(C, I) {
236954
+ function toString$b(C, I) {
236955
236955
  return C.toString(I);
236956
236956
  }
236957
236957
  function toLEBuff$2(C) {
@@ -237004,7 +237004,7 @@ var _Scalar$2 = /* @__PURE__ */ Object.freeze({
237004
237004
  toNumber: toNumber$1$2,
237005
237005
  toRprBE: toRprBE$2,
237006
237006
  toRprLE: toRprLE$2,
237007
- toString: toString$a,
237007
+ toString: toString$b,
237008
237008
  zero: zero$2
237009
237009
  });
237010
237010
  function exp$2(C, I, l) {
@@ -244824,7 +244824,7 @@ let WasmField1$1 = class {
244824
244824
  }
244825
244825
  toString(I, l) {
244826
244826
  const Z = this.fromMontgomery(I), d = fromRprLE$2(Z, 0);
244827
- return toString$a(d, l);
244827
+ return toString$b(d, l);
244828
244828
  }
244829
244829
  fromRng(I) {
244830
244830
  let l;
@@ -247029,7 +247029,7 @@ var blake2bWasm = { exports: {} }, browser$4 = { exports: {} };
247029
247029
  function byteLength$6(C) {
247030
247030
  return C.length;
247031
247031
  }
247032
- function toString$9(C) {
247032
+ function toString$a(C) {
247033
247033
  const I = C.byteLength;
247034
247034
  let l = "";
247035
247035
  for (let Z = 0; Z < I; Z++)
@@ -247044,7 +247044,7 @@ function write$4(C, I, l = 0, Z = byteLength$6(I)) {
247044
247044
  }
247045
247045
  var ascii$1 = {
247046
247046
  byteLength: byteLength$6,
247047
- toString: toString$9,
247047
+ toString: toString$a,
247048
247048
  write: write$4
247049
247049
  };
247050
247050
  const alphabet$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", codes$1 = new Uint8Array(256);
@@ -247062,7 +247062,7 @@ function byteLength$5(C) {
247062
247062
  let I = C.length;
247063
247063
  return C.charCodeAt(I - 1) === 61 && I--, I > 1 && C.charCodeAt(I - 1) === 61 && I--, I * 3 >>> 2;
247064
247064
  }
247065
- function toString$8(C) {
247065
+ function toString$9(C) {
247066
247066
  const I = C.byteLength;
247067
247067
  let l = "";
247068
247068
  for (let Z = 0; Z < I; Z += 3)
@@ -247079,13 +247079,13 @@ function write$3(C, I, l = 0, Z = byteLength$5(I)) {
247079
247079
  }
247080
247080
  var base64$4 = {
247081
247081
  byteLength: byteLength$5,
247082
- toString: toString$8,
247082
+ toString: toString$9,
247083
247083
  write: write$3
247084
247084
  };
247085
247085
  function byteLength$4(C) {
247086
247086
  return C.length >>> 1;
247087
247087
  }
247088
- function toString$7(C) {
247088
+ function toString$8(C) {
247089
247089
  const I = C.byteLength;
247090
247090
  C = new DataView(C.buffer, C.byteOffset, I);
247091
247091
  let l = "", Z = 0;
@@ -247107,7 +247107,7 @@ function write$2(C, I, l = 0, Z = byteLength$4(I)) {
247107
247107
  }
247108
247108
  var hex$1 = {
247109
247109
  byteLength: byteLength$4,
247110
- toString: toString$7,
247110
+ toString: toString$8,
247111
247111
  write: write$2
247112
247112
  };
247113
247113
  function hexValue(C) {
@@ -247133,14 +247133,14 @@ function byteLength$3(C) {
247133
247133
  }
247134
247134
  return I;
247135
247135
  }
247136
- let toString$6;
247136
+ let toString$7;
247137
247137
  if (typeof TextDecoder < "u") {
247138
247138
  const C = new TextDecoder();
247139
- toString$6 = function(l) {
247139
+ toString$7 = function(l) {
247140
247140
  return C.decode(l);
247141
247141
  };
247142
247142
  } else
247143
- toString$6 = function(I) {
247143
+ toString$7 = function(I) {
247144
247144
  const l = I.byteLength;
247145
247145
  let Z = "", d = 0;
247146
247146
  for (; d < l; ) {
@@ -247187,13 +247187,13 @@ if (typeof TextEncoder < "u") {
247187
247187
  };
247188
247188
  var utf8$6 = {
247189
247189
  byteLength: byteLength$3,
247190
- toString: toString$6,
247190
+ toString: toString$7,
247191
247191
  write: write$1
247192
247192
  };
247193
247193
  function byteLength$2(C) {
247194
247194
  return C.length * 2;
247195
247195
  }
247196
- function toString$5(C) {
247196
+ function toString$6(C) {
247197
247197
  const I = C.byteLength;
247198
247198
  let l = "";
247199
247199
  for (let Z = 0; Z < I - 1; Z += 2)
@@ -247211,7 +247211,7 @@ function write(C, I, l = 0, Z = byteLength$2(I)) {
247211
247211
  }
247212
247212
  var utf16le = {
247213
247213
  byteLength: byteLength$2,
247214
- toString: toString$5,
247214
+ toString: toString$6,
247215
247215
  write
247216
247216
  };
247217
247217
  (function(C, I) {
@@ -284661,8 +284661,8 @@ function bind$3(C, I) {
284661
284661
  return C.apply(I, arguments);
284662
284662
  };
284663
284663
  }
284664
- const { toString: toString$4 } = Object.prototype, { getPrototypeOf } = Object, kindOf$1 = /* @__PURE__ */ ((C) => (I) => {
284665
- const l = toString$4.call(I);
284664
+ const { toString: toString$5 } = Object.prototype, { getPrototypeOf } = Object, kindOf$1 = /* @__PURE__ */ ((C) => (I) => {
284665
+ const l = toString$5.call(I);
284666
284666
  return C[l] || (C[l] = l.slice(8, -1).toLowerCase());
284667
284667
  })(/* @__PURE__ */ Object.create(null)), kindOfTest = (C) => (C = C.toLowerCase(), (I) => kindOf$1(I) === C), typeOfTest = (C) => (I) => typeof I === C, { isArray: isArray$2 } = Array, isUndefined$1 = typeOfTest("undefined");
284668
284668
  function isBuffer$2(C) {
@@ -317843,7 +317843,7 @@ supportedChainsList.CHAINS = {
317843
317843
  XPLA: "xpla"
317844
317844
  }
317845
317845
  };
317846
- var toString$3 = Object.prototype.toString, kindOf = function(I) {
317846
+ var toString$4 = Object.prototype.toString, kindOf = function(I) {
317847
317847
  if (I === void 0)
317848
317848
  return "undefined";
317849
317849
  if (I === null)
@@ -317905,7 +317905,7 @@ var toString$3 = Object.prototype.toString, kindOf = function(I) {
317905
317905
  }
317906
317906
  if (isGeneratorObj(I))
317907
317907
  return "generator";
317908
- switch (l = toString$3.call(I), l) {
317908
+ switch (l = toString$4.call(I), l) {
317909
317909
  case "[object Object]":
317910
317910
  return "object";
317911
317911
  case "[object Map Iterator]":
@@ -318991,7 +318991,7 @@ const ERROR_PACKET = { type: "error", data: "parser error" };
318991
318991
  commons.ERROR_PACKET = ERROR_PACKET;
318992
318992
  Object.defineProperty(encodePacket_browser, "__esModule", { value: !0 });
318993
318993
  encodePacket_browser.encodePacket = encodePacket_browser.encodePacketToBinary = void 0;
318994
- const commons_js_1$1 = commons, withNativeBlob = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", withNativeArrayBuffer$1 = typeof ArrayBuffer == "function", isView = (C) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(C) : C && C.buffer instanceof ArrayBuffer, encodePacket = ({ type: C, data: I }, l, Z) => withNativeBlob && I instanceof Blob ? l ? Z(I) : encodeBlobAsBase64(I, Z) : withNativeArrayBuffer$1 && (I instanceof ArrayBuffer || isView(I)) ? l ? Z(I) : encodeBlobAsBase64(new Blob([I]), Z) : Z(commons_js_1$1.PACKET_TYPES[C] + (I || ""));
318994
+ const commons_js_1$1 = commons, withNativeBlob$1 = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", withNativeArrayBuffer$2 = typeof ArrayBuffer == "function", isView$1 = (C) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(C) : C && C.buffer instanceof ArrayBuffer, encodePacket = ({ type: C, data: I }, l, Z) => withNativeBlob$1 && I instanceof Blob ? l ? Z(I) : encodeBlobAsBase64(I, Z) : withNativeArrayBuffer$2 && (I instanceof ArrayBuffer || isView$1(I)) ? l ? Z(I) : encodeBlobAsBase64(new Blob([I]), Z) : Z(commons_js_1$1.PACKET_TYPES[C] + (I || ""));
318995
318995
  encodePacket_browser.encodePacket = encodePacket;
318996
318996
  const encodeBlobAsBase64 = (C, I) => {
318997
318997
  const l = new FileReader();
@@ -319005,9 +319005,9 @@ function toArray$2(C) {
319005
319005
  }
319006
319006
  let TEXT_ENCODER;
319007
319007
  function encodePacketToBinary(C, I) {
319008
- if (withNativeBlob && C.data instanceof Blob)
319008
+ if (withNativeBlob$1 && C.data instanceof Blob)
319009
319009
  return C.data.arrayBuffer().then(toArray$2).then(I);
319010
- if (withNativeArrayBuffer$1 && (C.data instanceof ArrayBuffer || isView(C.data)))
319010
+ if (withNativeArrayBuffer$2 && (C.data instanceof ArrayBuffer || isView$1(C.data)))
319011
319011
  return I(toArray$2(C.data));
319012
319012
  encodePacket(C, !1, (l) => {
319013
319013
  TEXT_ENCODER || (TEXT_ENCODER = new TextEncoder()), I(TEXT_ENCODER.encode(l));
@@ -319038,7 +319038,7 @@ const decode$3 = (C) => {
319038
319038
  base64Arraybuffer.decode = decode$3;
319039
319039
  Object.defineProperty(decodePacket_browser, "__esModule", { value: !0 });
319040
319040
  decodePacket_browser.decodePacket = void 0;
319041
- const commons_js_1 = commons, base64_arraybuffer_js_1 = base64Arraybuffer, withNativeArrayBuffer = typeof ArrayBuffer == "function", decodePacket = (C, I) => {
319041
+ const commons_js_1 = commons, base64_arraybuffer_js_1 = base64Arraybuffer, withNativeArrayBuffer$1 = typeof ArrayBuffer == "function", decodePacket = (C, I) => {
319042
319042
  if (typeof C != "string")
319043
319043
  return {
319044
319044
  type: "message",
@@ -319057,7 +319057,7 @@ const commons_js_1 = commons, base64_arraybuffer_js_1 = base64Arraybuffer, withN
319057
319057
  };
319058
319058
  decodePacket_browser.decodePacket = decodePacket;
319059
319059
  const decodeBase64Packet = (C, I) => {
319060
- if (withNativeArrayBuffer) {
319060
+ if (withNativeArrayBuffer$1) {
319061
319061
  const l = (0, base64_arraybuffer_js_1.decode)(C);
319062
319062
  return mapBinary(l, I);
319063
319063
  } else
@@ -320566,290 +320566,279 @@ function url(C, I = "", l) {
320566
320566
  return Z.id = Z.protocol + "://" + W + ":" + Z.port + I, Z.href = Z.protocol + "://" + W + (l && l.port === Z.port ? "" : ":" + Z.port), Z;
320567
320567
  }
320568
320568
  url$1.url = url;
320569
- var manager = {}, socket = {}, cjs = {}, binary = {}, isBinary = {}, hasRequiredIsBinary;
320570
- function requireIsBinary() {
320571
- if (hasRequiredIsBinary)
320572
- return isBinary;
320573
- hasRequiredIsBinary = 1, Object.defineProperty(isBinary, "__esModule", { value: !0 }), isBinary.hasBinary = isBinary.isBinary = void 0;
320574
- const C = typeof ArrayBuffer == "function", I = (B) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(B) : B.buffer instanceof ArrayBuffer, l = Object.prototype.toString, Z = typeof Blob == "function" || typeof Blob < "u" && l.call(Blob) === "[object BlobConstructor]", d = typeof File == "function" || typeof File < "u" && l.call(File) === "[object FileConstructor]";
320575
- function W(B) {
320576
- return C && (B instanceof ArrayBuffer || I(B)) || Z && B instanceof Blob || d && B instanceof File;
320577
- }
320578
- isBinary.isBinary = W;
320579
- function T(B, o) {
320580
- if (!B || typeof B != "object")
320581
- return !1;
320582
- if (Array.isArray(B)) {
320583
- for (let D = 0, p = B.length; D < p; D++)
320584
- if (T(B[D]))
320585
- return !0;
320586
- return !1;
320587
- }
320588
- if (W(B))
320589
- return !0;
320590
- if (B.toJSON && typeof B.toJSON == "function" && arguments.length === 1)
320591
- return T(B.toJSON(), !0);
320592
- for (const D in B)
320593
- if (Object.prototype.hasOwnProperty.call(B, D) && T(B[D]))
320569
+ var manager = {}, socket = {}, cjs = {}, binary = {}, isBinary$1 = {};
320570
+ Object.defineProperty(isBinary$1, "__esModule", { value: !0 });
320571
+ isBinary$1.hasBinary = isBinary$1.isBinary = void 0;
320572
+ const withNativeArrayBuffer = typeof ArrayBuffer == "function", isView = (C) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(C) : C.buffer instanceof ArrayBuffer, toString$3 = Object.prototype.toString, withNativeBlob = typeof Blob == "function" || typeof Blob < "u" && toString$3.call(Blob) === "[object BlobConstructor]", withNativeFile = typeof File == "function" || typeof File < "u" && toString$3.call(File) === "[object FileConstructor]";
320573
+ function isBinary(C) {
320574
+ return withNativeArrayBuffer && (C instanceof ArrayBuffer || isView(C)) || withNativeBlob && C instanceof Blob || withNativeFile && C instanceof File;
320575
+ }
320576
+ isBinary$1.isBinary = isBinary;
320577
+ function hasBinary(C, I) {
320578
+ if (!C || typeof C != "object")
320579
+ return !1;
320580
+ if (Array.isArray(C)) {
320581
+ for (let l = 0, Z = C.length; l < Z; l++)
320582
+ if (hasBinary(C[l]))
320594
320583
  return !0;
320595
320584
  return !1;
320596
320585
  }
320597
- return isBinary.hasBinary = T, isBinary;
320586
+ if (isBinary(C))
320587
+ return !0;
320588
+ if (C.toJSON && typeof C.toJSON == "function" && arguments.length === 1)
320589
+ return hasBinary(C.toJSON(), !0);
320590
+ for (const l in C)
320591
+ if (Object.prototype.hasOwnProperty.call(C, l) && hasBinary(C[l]))
320592
+ return !0;
320593
+ return !1;
320598
320594
  }
320599
- var hasRequiredBinary;
320600
- function requireBinary() {
320601
- if (hasRequiredBinary)
320602
- return binary;
320603
- hasRequiredBinary = 1, Object.defineProperty(binary, "__esModule", { value: !0 }), binary.reconstructPacket = binary.deconstructPacket = void 0;
320604
- const C = requireIsBinary();
320605
- function I(W) {
320606
- const T = [], B = W.data, o = W;
320607
- return o.data = l(B, T), o.attachments = T.length, { packet: o, buffers: T };
320595
+ isBinary$1.hasBinary = hasBinary;
320596
+ Object.defineProperty(binary, "__esModule", { value: !0 });
320597
+ binary.reconstructPacket = binary.deconstructPacket = void 0;
320598
+ const is_binary_js_1 = isBinary$1;
320599
+ function deconstructPacket(C) {
320600
+ const I = [], l = C.data, Z = C;
320601
+ return Z.data = _deconstructPacket(l, I), Z.attachments = I.length, { packet: Z, buffers: I };
320602
+ }
320603
+ binary.deconstructPacket = deconstructPacket;
320604
+ function _deconstructPacket(C, I) {
320605
+ if (!C)
320606
+ return C;
320607
+ if ((0, is_binary_js_1.isBinary)(C)) {
320608
+ const l = { _placeholder: !0, num: I.length };
320609
+ return I.push(C), l;
320610
+ } else if (Array.isArray(C)) {
320611
+ const l = new Array(C.length);
320612
+ for (let Z = 0; Z < C.length; Z++)
320613
+ l[Z] = _deconstructPacket(C[Z], I);
320614
+ return l;
320615
+ } else if (typeof C == "object" && !(C instanceof Date)) {
320616
+ const l = {};
320617
+ for (const Z in C)
320618
+ Object.prototype.hasOwnProperty.call(C, Z) && (l[Z] = _deconstructPacket(C[Z], I));
320619
+ return l;
320608
320620
  }
320609
- binary.deconstructPacket = I;
320610
- function l(W, T) {
320611
- if (!W)
320612
- return W;
320613
- if ((0, C.isBinary)(W)) {
320614
- const B = { _placeholder: !0, num: T.length };
320615
- return T.push(W), B;
320616
- } else if (Array.isArray(W)) {
320617
- const B = new Array(W.length);
320618
- for (let o = 0; o < W.length; o++)
320619
- B[o] = l(W[o], T);
320620
- return B;
320621
- } else if (typeof W == "object" && !(W instanceof Date)) {
320622
- const B = {};
320623
- for (const o in W)
320624
- Object.prototype.hasOwnProperty.call(W, o) && (B[o] = l(W[o], T));
320625
- return B;
320621
+ return C;
320622
+ }
320623
+ function reconstructPacket(C, I) {
320624
+ return C.data = _reconstructPacket(C.data, I), delete C.attachments, C;
320625
+ }
320626
+ binary.reconstructPacket = reconstructPacket;
320627
+ function _reconstructPacket(C, I) {
320628
+ if (!C)
320629
+ return C;
320630
+ if (C && C._placeholder === !0) {
320631
+ if (typeof C.num == "number" && C.num >= 0 && C.num < I.length)
320632
+ return I[C.num];
320633
+ throw new Error("illegal attachments");
320634
+ } else if (Array.isArray(C))
320635
+ for (let l = 0; l < C.length; l++)
320636
+ C[l] = _reconstructPacket(C[l], I);
320637
+ else if (typeof C == "object")
320638
+ for (const l in C)
320639
+ Object.prototype.hasOwnProperty.call(C, l) && (C[l] = _reconstructPacket(C[l], I));
320640
+ return C;
320641
+ }
320642
+ (function(C) {
320643
+ Object.defineProperty(C, "__esModule", { value: !0 }), C.Decoder = C.Encoder = C.PacketType = C.protocol = void 0;
320644
+ const I = require$$5, l = binary, Z = isBinary$1, W = (0, browserExports.default)("socket.io-parser"), T = [
320645
+ "connect",
320646
+ "connect_error",
320647
+ "disconnect",
320648
+ "disconnecting",
320649
+ "newListener",
320650
+ "removeListener"
320651
+ // used by the Node.js EventEmitter
320652
+ ];
320653
+ C.protocol = 5;
320654
+ var B;
320655
+ (function(S) {
320656
+ S[S.CONNECT = 0] = "CONNECT", S[S.DISCONNECT = 1] = "DISCONNECT", S[S.EVENT = 2] = "EVENT", S[S.ACK = 3] = "ACK", S[S.CONNECT_ERROR = 4] = "CONNECT_ERROR", S[S.BINARY_EVENT = 5] = "BINARY_EVENT", S[S.BINARY_ACK = 6] = "BINARY_ACK";
320657
+ })(B = C.PacketType || (C.PacketType = {}));
320658
+ class o {
320659
+ /**
320660
+ * Encoder constructor
320661
+ *
320662
+ * @param {function} replacer - custom replacer to pass down to JSON.parse
320663
+ */
320664
+ constructor(CI) {
320665
+ this.replacer = CI;
320666
+ }
320667
+ /**
320668
+ * Encode a packet as a single string if non-binary, or as a
320669
+ * buffer sequence, depending on packet type.
320670
+ *
320671
+ * @param {Object} obj - packet object
320672
+ */
320673
+ encode(CI) {
320674
+ return W("encoding packet %j", CI), (CI.type === B.EVENT || CI.type === B.ACK) && (0, Z.hasBinary)(CI) ? this.encodeAsBinary({
320675
+ type: CI.type === B.EVENT ? B.BINARY_EVENT : B.BINARY_ACK,
320676
+ nsp: CI.nsp,
320677
+ data: CI.data,
320678
+ id: CI.id
320679
+ }) : [this.encodeAsString(CI)];
320680
+ }
320681
+ /**
320682
+ * Encode packet as string.
320683
+ */
320684
+ encodeAsString(CI) {
320685
+ let lI = "" + CI.type;
320686
+ return (CI.type === B.BINARY_EVENT || CI.type === B.BINARY_ACK) && (lI += CI.attachments + "-"), CI.nsp && CI.nsp !== "/" && (lI += CI.nsp + ","), CI.id != null && (lI += CI.id), CI.data != null && (lI += JSON.stringify(CI.data, this.replacer)), W("encoded %j as %s", CI, lI), lI;
320687
+ }
320688
+ /**
320689
+ * Encode packet as 'buffer sequence' by removing blobs, and
320690
+ * deconstructing packet into object with placeholders and
320691
+ * a list of buffers.
320692
+ */
320693
+ encodeAsBinary(CI) {
320694
+ const lI = (0, l.deconstructPacket)(CI), J = this.encodeAsString(lI.packet), h = lI.buffers;
320695
+ return h.unshift(J), h;
320626
320696
  }
320627
- return W;
320628
- }
320629
- function Z(W, T) {
320630
- return W.data = d(W.data, T), delete W.attachments, W;
320631
320697
  }
320632
- binary.reconstructPacket = Z;
320633
- function d(W, T) {
320634
- if (!W)
320635
- return W;
320636
- if (W && W._placeholder === !0) {
320637
- if (typeof W.num == "number" && W.num >= 0 && W.num < T.length)
320638
- return T[W.num];
320639
- throw new Error("illegal attachments");
320640
- } else if (Array.isArray(W))
320641
- for (let B = 0; B < W.length; B++)
320642
- W[B] = d(W[B], T);
320643
- else if (typeof W == "object")
320644
- for (const B in W)
320645
- Object.prototype.hasOwnProperty.call(W, B) && (W[B] = d(W[B], T));
320646
- return W;
320698
+ C.Encoder = o;
320699
+ function D(S) {
320700
+ return Object.prototype.toString.call(S) === "[object Object]";
320647
320701
  }
320648
- return binary;
320649
- }
320650
- var hasRequiredCjs;
320651
- function requireCjs() {
320652
- return hasRequiredCjs || (hasRequiredCjs = 1, function(C) {
320653
- Object.defineProperty(C, "__esModule", { value: !0 }), C.Decoder = C.Encoder = C.PacketType = C.protocol = void 0;
320654
- const I = require$$5, l = requireBinary(), Z = requireIsBinary(), W = (0, browserExports.default)("socket.io-parser"), T = [
320655
- "connect",
320656
- "connect_error",
320657
- "disconnect",
320658
- "disconnecting",
320659
- "newListener",
320660
- "removeListener"
320661
- // used by the Node.js EventEmitter
320662
- ];
320663
- C.protocol = 5;
320664
- var B;
320665
- (function(S) {
320666
- S[S.CONNECT = 0] = "CONNECT", S[S.DISCONNECT = 1] = "DISCONNECT", S[S.EVENT = 2] = "EVENT", S[S.ACK = 3] = "ACK", S[S.CONNECT_ERROR = 4] = "CONNECT_ERROR", S[S.BINARY_EVENT = 5] = "BINARY_EVENT", S[S.BINARY_ACK = 6] = "BINARY_ACK";
320667
- })(B = C.PacketType || (C.PacketType = {}));
320668
- class o {
320669
- /**
320670
- * Encoder constructor
320671
- *
320672
- * @param {function} replacer - custom replacer to pass down to JSON.parse
320673
- */
320674
- constructor(CI) {
320675
- this.replacer = CI;
320676
- }
320677
- /**
320678
- * Encode a packet as a single string if non-binary, or as a
320679
- * buffer sequence, depending on packet type.
320680
- *
320681
- * @param {Object} obj - packet object
320682
- */
320683
- encode(CI) {
320684
- return W("encoding packet %j", CI), (CI.type === B.EVENT || CI.type === B.ACK) && (0, Z.hasBinary)(CI) ? this.encodeAsBinary({
320685
- type: CI.type === B.EVENT ? B.BINARY_EVENT : B.BINARY_ACK,
320686
- nsp: CI.nsp,
320687
- data: CI.data,
320688
- id: CI.id
320689
- }) : [this.encodeAsString(CI)];
320690
- }
320691
- /**
320692
- * Encode packet as string.
320693
- */
320694
- encodeAsString(CI) {
320695
- let lI = "" + CI.type;
320696
- return (CI.type === B.BINARY_EVENT || CI.type === B.BINARY_ACK) && (lI += CI.attachments + "-"), CI.nsp && CI.nsp !== "/" && (lI += CI.nsp + ","), CI.id != null && (lI += CI.id), CI.data != null && (lI += JSON.stringify(CI.data, this.replacer)), W("encoded %j as %s", CI, lI), lI;
320697
- }
320698
- /**
320699
- * Encode packet as 'buffer sequence' by removing blobs, and
320700
- * deconstructing packet into object with placeholders and
320701
- * a list of buffers.
320702
- */
320703
- encodeAsBinary(CI) {
320704
- const lI = (0, l.deconstructPacket)(CI), J = this.encodeAsString(lI.packet), h = lI.buffers;
320705
- return h.unshift(J), h;
320706
- }
320707
- }
320708
- C.Encoder = o;
320709
- function D(S) {
320710
- return Object.prototype.toString.call(S) === "[object Object]";
320711
- }
320712
- class p extends I.Emitter {
320713
- /**
320714
- * Decoder constructor
320715
- *
320716
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
320717
- */
320718
- constructor(CI) {
320719
- super(), this.reviver = CI;
320720
- }
320721
- /**
320722
- * Decodes an encoded packet string into packet JSON.
320723
- *
320724
- * @param {String} obj - encoded packet
320725
- */
320726
- add(CI) {
320727
- let lI;
320728
- if (typeof CI == "string") {
320729
- if (this.reconstructor)
320730
- throw new Error("got plaintext data when reconstructing a packet");
320731
- lI = this.decodeString(CI);
320732
- const J = lI.type === B.BINARY_EVENT;
320733
- J || lI.type === B.BINARY_ACK ? (lI.type = J ? B.EVENT : B.ACK, this.reconstructor = new $(lI), lI.attachments === 0 && super.emitReserved("decoded", lI)) : super.emitReserved("decoded", lI);
320734
- } else if ((0, Z.isBinary)(CI) || CI.base64)
320735
- if (this.reconstructor)
320736
- lI = this.reconstructor.takeBinaryData(CI), lI && (this.reconstructor = null, super.emitReserved("decoded", lI));
320737
- else
320738
- throw new Error("got binary data when not reconstructing a packet");
320702
+ class p extends I.Emitter {
320703
+ /**
320704
+ * Decoder constructor
320705
+ *
320706
+ * @param {function} reviver - custom reviver to pass down to JSON.stringify
320707
+ */
320708
+ constructor(CI) {
320709
+ super(), this.reviver = CI;
320710
+ }
320711
+ /**
320712
+ * Decodes an encoded packet string into packet JSON.
320713
+ *
320714
+ * @param {String} obj - encoded packet
320715
+ */
320716
+ add(CI) {
320717
+ let lI;
320718
+ if (typeof CI == "string") {
320719
+ if (this.reconstructor)
320720
+ throw new Error("got plaintext data when reconstructing a packet");
320721
+ lI = this.decodeString(CI);
320722
+ const J = lI.type === B.BINARY_EVENT;
320723
+ J || lI.type === B.BINARY_ACK ? (lI.type = J ? B.EVENT : B.ACK, this.reconstructor = new $(lI), lI.attachments === 0 && super.emitReserved("decoded", lI)) : super.emitReserved("decoded", lI);
320724
+ } else if ((0, Z.isBinary)(CI) || CI.base64)
320725
+ if (this.reconstructor)
320726
+ lI = this.reconstructor.takeBinaryData(CI), lI && (this.reconstructor = null, super.emitReserved("decoded", lI));
320739
320727
  else
320740
- throw new Error("Unknown type: " + CI);
320741
- }
320742
- /**
320743
- * Decode a packet String (JSON data)
320744
- *
320745
- * @param {String} str
320746
- * @return {Object} packet
320747
- */
320748
- decodeString(CI) {
320749
- let lI = 0;
320750
- const J = {
320751
- type: Number(CI.charAt(0))
320752
- };
320753
- if (B[J.type] === void 0)
320754
- throw new Error("unknown packet type " + J.type);
320755
- if (J.type === B.BINARY_EVENT || J.type === B.BINARY_ACK) {
320756
- const w = lI + 1;
320757
- for (; CI.charAt(++lI) !== "-" && lI != CI.length; )
320758
- ;
320759
- const E = CI.substring(w, lI);
320760
- if (E != Number(E) || CI.charAt(lI) !== "-")
320761
- throw new Error("Illegal attachments");
320762
- J.attachments = Number(E);
320763
- }
320764
- if (CI.charAt(lI + 1) === "/") {
320765
- const w = lI + 1;
320766
- for (; ++lI && !(CI.charAt(lI) === "," || lI === CI.length); )
320767
- ;
320768
- J.nsp = CI.substring(w, lI);
320769
- } else
320770
- J.nsp = "/";
320771
- const h = CI.charAt(lI + 1);
320772
- if (h !== "" && Number(h) == h) {
320773
- const w = lI + 1;
320774
- for (; ++lI; ) {
320775
- const E = CI.charAt(lI);
320776
- if (E == null || Number(E) != E) {
320777
- --lI;
320778
- break;
320779
- }
320780
- if (lI === CI.length)
320781
- break;
320728
+ throw new Error("got binary data when not reconstructing a packet");
320729
+ else
320730
+ throw new Error("Unknown type: " + CI);
320731
+ }
320732
+ /**
320733
+ * Decode a packet String (JSON data)
320734
+ *
320735
+ * @param {String} str
320736
+ * @return {Object} packet
320737
+ */
320738
+ decodeString(CI) {
320739
+ let lI = 0;
320740
+ const J = {
320741
+ type: Number(CI.charAt(0))
320742
+ };
320743
+ if (B[J.type] === void 0)
320744
+ throw new Error("unknown packet type " + J.type);
320745
+ if (J.type === B.BINARY_EVENT || J.type === B.BINARY_ACK) {
320746
+ const w = lI + 1;
320747
+ for (; CI.charAt(++lI) !== "-" && lI != CI.length; )
320748
+ ;
320749
+ const E = CI.substring(w, lI);
320750
+ if (E != Number(E) || CI.charAt(lI) !== "-")
320751
+ throw new Error("Illegal attachments");
320752
+ J.attachments = Number(E);
320753
+ }
320754
+ if (CI.charAt(lI + 1) === "/") {
320755
+ const w = lI + 1;
320756
+ for (; ++lI && !(CI.charAt(lI) === "," || lI === CI.length); )
320757
+ ;
320758
+ J.nsp = CI.substring(w, lI);
320759
+ } else
320760
+ J.nsp = "/";
320761
+ const h = CI.charAt(lI + 1);
320762
+ if (h !== "" && Number(h) == h) {
320763
+ const w = lI + 1;
320764
+ for (; ++lI; ) {
320765
+ const E = CI.charAt(lI);
320766
+ if (E == null || Number(E) != E) {
320767
+ --lI;
320768
+ break;
320782
320769
  }
320783
- J.id = Number(CI.substring(w, lI + 1));
320784
- }
320785
- if (CI.charAt(++lI)) {
320786
- const w = this.tryParse(CI.substr(lI));
320787
- if (p.isPayloadValid(J.type, w))
320788
- J.data = w;
320789
- else
320790
- throw new Error("invalid payload");
320770
+ if (lI === CI.length)
320771
+ break;
320791
320772
  }
320792
- return W("decoded %s as %j", CI, J), J;
320773
+ J.id = Number(CI.substring(w, lI + 1));
320793
320774
  }
320794
- tryParse(CI) {
320795
- try {
320796
- return JSON.parse(CI, this.reviver);
320797
- } catch {
320798
- return !1;
320799
- }
320775
+ if (CI.charAt(++lI)) {
320776
+ const w = this.tryParse(CI.substr(lI));
320777
+ if (p.isPayloadValid(J.type, w))
320778
+ J.data = w;
320779
+ else
320780
+ throw new Error("invalid payload");
320800
320781
  }
320801
- static isPayloadValid(CI, lI) {
320802
- switch (CI) {
320803
- case B.CONNECT:
320804
- return D(lI);
320805
- case B.DISCONNECT:
320806
- return lI === void 0;
320807
- case B.CONNECT_ERROR:
320808
- return typeof lI == "string" || D(lI);
320809
- case B.EVENT:
320810
- case B.BINARY_EVENT:
320811
- return Array.isArray(lI) && (typeof lI[0] == "number" || typeof lI[0] == "string" && T.indexOf(lI[0]) === -1);
320812
- case B.ACK:
320813
- case B.BINARY_ACK:
320814
- return Array.isArray(lI);
320815
- }
320816
- }
320817
- /**
320818
- * Deallocates a parser's resources
320819
- */
320820
- destroy() {
320821
- this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
320822
- }
320823
- }
320824
- C.Decoder = p;
320825
- class $ {
320826
- constructor(CI) {
320827
- this.packet = CI, this.buffers = [], this.reconPack = CI;
320828
- }
320829
- /**
320830
- * Method to be called when binary data received from connection
320831
- * after a BINARY_EVENT packet.
320832
- *
320833
- * @param {Buffer | ArrayBuffer} binData - the raw binary data received
320834
- * @return {null | Object} returns null if more binary data is expected or
320835
- * a reconstructed packet object if all buffers have been received.
320836
- */
320837
- takeBinaryData(CI) {
320838
- if (this.buffers.push(CI), this.buffers.length === this.reconPack.attachments) {
320839
- const lI = (0, l.reconstructPacket)(this.reconPack, this.buffers);
320840
- return this.finishedReconstruction(), lI;
320841
- }
320842
- return null;
320782
+ return W("decoded %s as %j", CI, J), J;
320783
+ }
320784
+ tryParse(CI) {
320785
+ try {
320786
+ return JSON.parse(CI, this.reviver);
320787
+ } catch {
320788
+ return !1;
320843
320789
  }
320844
- /**
320845
- * Cleans up binary packet reconstruction variables.
320846
- */
320847
- finishedReconstruction() {
320848
- this.reconPack = null, this.buffers = [];
320790
+ }
320791
+ static isPayloadValid(CI, lI) {
320792
+ switch (CI) {
320793
+ case B.CONNECT:
320794
+ return D(lI);
320795
+ case B.DISCONNECT:
320796
+ return lI === void 0;
320797
+ case B.CONNECT_ERROR:
320798
+ return typeof lI == "string" || D(lI);
320799
+ case B.EVENT:
320800
+ case B.BINARY_EVENT:
320801
+ return Array.isArray(lI) && (typeof lI[0] == "number" || typeof lI[0] == "string" && T.indexOf(lI[0]) === -1);
320802
+ case B.ACK:
320803
+ case B.BINARY_ACK:
320804
+ return Array.isArray(lI);
320849
320805
  }
320850
320806
  }
320851
- }(cjs)), cjs;
320852
- }
320807
+ /**
320808
+ * Deallocates a parser's resources
320809
+ */
320810
+ destroy() {
320811
+ this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
320812
+ }
320813
+ }
320814
+ C.Decoder = p;
320815
+ class $ {
320816
+ constructor(CI) {
320817
+ this.packet = CI, this.buffers = [], this.reconPack = CI;
320818
+ }
320819
+ /**
320820
+ * Method to be called when binary data received from connection
320821
+ * after a BINARY_EVENT packet.
320822
+ *
320823
+ * @param {Buffer | ArrayBuffer} binData - the raw binary data received
320824
+ * @return {null | Object} returns null if more binary data is expected or
320825
+ * a reconstructed packet object if all buffers have been received.
320826
+ */
320827
+ takeBinaryData(CI) {
320828
+ if (this.buffers.push(CI), this.buffers.length === this.reconPack.attachments) {
320829
+ const lI = (0, l.reconstructPacket)(this.reconPack, this.buffers);
320830
+ return this.finishedReconstruction(), lI;
320831
+ }
320832
+ return null;
320833
+ }
320834
+ /**
320835
+ * Cleans up binary packet reconstruction variables.
320836
+ */
320837
+ finishedReconstruction() {
320838
+ this.reconPack = null, this.buffers = [];
320839
+ }
320840
+ }
320841
+ })(cjs);
320853
320842
  var on$1 = {};
320854
320843
  Object.defineProperty(on$1, "__esModule", { value: !0 });
320855
320844
  on$1.on = void 0;
@@ -320864,7 +320853,7 @@ var __importDefault$q = commonjsGlobal && commonjsGlobal.__importDefault || func
320864
320853
  };
320865
320854
  Object.defineProperty(socket, "__esModule", { value: !0 });
320866
320855
  socket.Socket = void 0;
320867
- const socket_io_parser_1 = requireCjs(), on_js_1$1 = on$1, component_emitter_1$1 = require$$5, debug_1$1 = __importDefault$q(browserExports), debug$1 = debug_1$1.default("socket.io-client:socket"), RESERVED_EVENTS = Object.freeze({
320856
+ const socket_io_parser_1 = cjs, on_js_1$1 = on$1, component_emitter_1$1 = require$$5, debug_1$1 = __importDefault$q(browserExports), debug$1 = debug_1$1.default("socket.io-client:socket"), RESERVED_EVENTS = Object.freeze({
320868
320857
  connect: 1,
320869
320858
  connect_error: 1,
320870
320859
  disconnect: 1,
@@ -321525,7 +321514,7 @@ var __createBinding$p = commonjsGlobal && commonjsGlobal.__createBinding || (Obj
321525
321514
  };
321526
321515
  Object.defineProperty(manager, "__esModule", { value: !0 });
321527
321516
  manager.Manager = void 0;
321528
- const engine_io_client_1 = cjs$2, socket_js_1 = socket, parser = __importStar$p(requireCjs()), on_js_1 = on$1, backo2_js_1 = backo2, component_emitter_1 = require$$5, debug_1 = __importDefault$p(browserExports), debug = debug_1.default("socket.io-client:manager");
321517
+ const engine_io_client_1 = cjs$2, socket_js_1 = socket, parser = __importStar$p(cjs), on_js_1 = on$1, backo2_js_1 = backo2, component_emitter_1 = require$$5, debug_1 = __importDefault$p(browserExports), debug = debug_1.default("socket.io-client:manager");
321529
321518
  class Manager extends component_emitter_1.Emitter {
321530
321519
  constructor(I, l) {
321531
321520
  var Z;
@@ -321784,7 +321773,7 @@ manager.Manager = Manager;
321784
321773
  io: D,
321785
321774
  connect: D
321786
321775
  });
321787
- var p = requireCjs();
321776
+ var p = cjs;
321788
321777
  Object.defineProperty(I, "protocol", { enumerable: !0, get: function() {
321789
321778
  return p.protocol;
321790
321779
  } }), C.exports = D;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hinkal/common",
3
- "version": "0.0.126",
3
+ "version": "0.0.128",
4
4
  "homepage": "hinkal.pro",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"