justrun-ws 0.1.0 → 0.1.2

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/lib/bundle.min.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";new TextEncoder,new TextDecoder})();
1
+ var e={d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{yE:()=>w,sr:()=>n,si:()=>i,N3:()=>d,sk:()=>u,wL:()=>p,p6:()=>b,bM:()=>o,h8:()=>h,Kr:()=>f,Yu:()=>B,Kl:()=>C,kX:()=>v,jG:()=>P});class s{constructor(e,t){t?(this.k=e,this.l=void 0):(this.k=void 0,this.l=e)}get data(){return this.l||(this.l=this.decode(this.k)),this.l}set data(e){this.l=e,this.k=void 0}get buff(){return this.k||(this.k=this.encode(this.l)),this.k}k;l}class r extends s{static context;static registerPkgType(e){let t;try{t=this.pkgType}catch{return void Object.defineProperty(this,"pkgType",{value:e,writable:!1,enumerable:!1})}if(t!==e)throw new Error(`Wrapper ${this.name} is already registered with type ${t}`)}static get pkgType(){throw new Error(`Wrapper ${this.name} need to be registered`)}}class n extends r{isError(){return!0}}class o extends r{isMessage(){return!0}}class i extends r{isEvent(){return!0}}class h extends r{constructor(e,t){super(e,t)}isRequest(){return!0}get resp(){return this.r||(this.r=this.decodeResponse(this.s)),this.r}set resp(e){this.r=e,this.s=void 0}get respBuff(){return this.s||(this.s=this.encodeResponse(this.r)),this.s}set respBuff(e){this.r=void 0,this.s=e}r;s}const a=new TextEncoder,c=new TextDecoder;class d extends n{encode(e){const t=JSON.stringify(e);return a.encode(t)}decode(e){const t=c.decode(e);return JSON.parse(t)}}class u extends o{encode(e){const t=JSON.stringify(e);return a.encode(t)}decode(e){const t=c.decode(e);return JSON.parse(t)}}class p extends h{encode(e){const t=JSON.stringify(e);return a.encode(t)}decode(e){const t=c.decode(e);return JSON.parse(t)}encodeResponse(e){const t=JSON.stringify(e);return a.encode(t)}decodeResponse(e){const t=c.decode(e);return JSON.parse(t)}}class l extends d{}const g={message:"Connection is not authenticated"};class f{constructor(e,t,s=!0){this.g=e,this.m=t,this.n=s}get pkgType(){return this.g.pkgType}get pkgName(){return this.g.name}async run(e,t){const{buff:s,bodyOffset:r}=t,n=s.subarray(r),o=new this.g(n,!0);if(void 0===e.context&&this.n)this.wrapUncaughtError(e,g);else try{await this.m(e,o)}catch(t){t.isError||this.wrapUncaughtError(e,t)}void 0===e.context&&await e.close()}async runLocal(e,t){if(void 0===e.context&&this.n)this.wrapUncaughtError(e,g);else try{return await this.m(e,t)}catch(t){t.isError||this.wrapUncaughtError(e,t)}}wrapUncaughtError(e,t){return((e,t)=>((e,t)=>new l(t.message))(0,t))(0,t)}g;m;n}const y=()=>{},k=e=>{let t=0,s=0;for(;t<e.length;)s+=e[t++].length;const r=new Uint8Array(s);for(s=0;t>0;){const n=e[--t];r.set(n,s),s+=n.length}return r};class w{address(){return null}setConnWrapperMaker(e){this.makeWrapper=e}async startListen(e){return!1}async stopListen(){return!1}async connect(e){const t=new WebSocket(e);return new Promise(((e,s)=>{t.onerror=e=>{s(new Error("WebSocket error"))},t.onopen=()=>{e(this.L(t,!0))}}))}L=(e,t)=>{const s=new m(e),{conn:r,onPkgBuff:n,onClose:o}=this.makeWrapper(s,t);return e.onmessage=e=>{e.data.arrayBuffer().then((e=>{n(new Uint8Array(e))}))},e.onerror=e=>{o(new Error("WebSocket error"))},e.onclose=e=>{1e3===e.code&&o()},r};makeWrapper(e,t){throw new Error('Need to call "setConnWrapperMaker" before using')}}class m{constructor(e){this.d=e}get localAddress(){}get localPort(){}get remoteAddress(){}get remoteFamily(){}get remotePort(){}async sendPkgBuff(e){if(this.d)return this.d.send(e);throw new Error("Invalid socket")}async sendPkgBuffV(e){if(this.d){const t=k(e);return this.d.send(t)}throw new Error("Invalid socket")}async close(e){const{d:t}=this;t&&(this.d=void 0,e?t.close(3e3,e.message):t.readyState===WebSocket.OPEN&&t.close(1e3))}hadClosed(){return!this.d}d}const v=(e,t,s)=>{const r=[t,e],n=(e=>{let t,s=0,r=0;for(;s<e.length;)for(r++,t=e[s++];t>>>=7;)r++;return r})(r),o=new Uint8Array(n);((e,t,s=0)=>{let r,n,o=s;for(r=0;r<e.length;r++){n=e[r];let s=127&n;for(;n>>>=7;)t[o++]=128|s,s=127&n;t[o++]=s}if(o<=t.length)return o-s;throw new Error("Buffer overflow")})(r,o),s.push(o)},P=e=>{const{h:[t,s],k:r}=((e,t,s=0)=>{let r,n,o=s,i=0,h=0;const a=[];for(r=0;r<e;r++){do{n=t[o++],i|=(127&n)<<h,h+=7}while(128&n);if(!(void 0!==n&&h<=35))throw new Error("Parsing failed");a.push(i),i=0,h=0}return{h:a,k:o-s}})(2,e);return{buff:e,pkgType:s,requestId:t,bodyOffset:r}};class b{constructor(e){this.A=e}get id(){return this.b?.id??-1}get context(){return this.b?.context}set context(e){this.b&&(this.b.context=e)}localAddress;localPort;remoteAddress;remoteFamily;remotePort;async sendErrorResponse(e,t){return(this.b??await this.connect()).sendErrorResponse(e,t)}async sendResponse(e,t){return(this.b??await this.connect()).sendResponse(e,t)}async sendMessage(e){return(this.b??await this.connect()).sendMessage(e)}async sendRequest(e){return(this.b??await this.connect()).sendRequest(e)}async close(e){const{b:t}=this;if(t)return this.b=void 0,void await t.close(e);this.i&&await this.i.then((t=>t.close(e).then((()=>this.b=void 0))),(()=>this.b=void 0))}async connect(){let{i:e}=this;return e||(e=this.i=new Promise(((e,t)=>{this.A().then((s=>{s?(e(s),this.b=s,this.i=void 0):t(new Error("Connect failed"))}))}))),await e}A;b;i}class E{constructor(){this.e=this,this.f=this}getPrev(){return this.e}getNext(){return this.f}insertBefore(e){this.f=e,this.e=e.e,e.e=this,this.e.f=this}insertAfter(e){this.e=e,this.f=e.f,e.f=this,this.f.e=this}remove(){this.e.f=this.f,this.f.e=this.e}e;f}class x{constructor(){this.t=new E}get g(){return this.t.getNext()}get a(){return this.t.getPrev()}B(e){return e===this.t}C(e){e.insertAfter(this.t)}U(e){e.insertBefore(this.t)}t}class T extends E{}class B{constructor(e,t,s){if(this.D=e,this.y=t,this.w=s,this.j=0,this.x=0,this.o=[],0===e)return this.insert=y,this.update=y,void(this.remove=y);for(let e=0;e<s;e++)this.o.push(new x)}insert(e){this.x||(this.E=setInterval(this.M,this.D)),this.x++,this.o[this.j].C(e)}update(e){e.remove(),this.o[this.j].C(e)}remove(e){e.remove(),this.x--,this.x||clearInterval(this.E)}M=()=>{const{y:e,w:t,o:s}=this;if(this.j++,this.j===t&&(this.j=0),e){let r=this.j+e;r>=t&&(r-=t);const n=s[r];for(let e=n.g;!n.B(e);e=e.getNext())e.keepAlive()}const r=s[this.j];for(let e=r.g;!r.B(e);e=e.getNext())e.timeout()};D;y;w;j;x;E;o}class C{constructor(e,t){const{responsePkgType:s,timeoutMonitor:r,makePkgBuff:n,parsePkgBuff:o}=t;this.responsePkgType=s,this.context=void 0,this.onConnOpen=void 0,this.onConnClose=void 0,this.p=0,this.q=new Map,this.c=new Map,this.$=new Map,this.F=n,this.G=o,this.u=e,this.z=r,this.run=this.N;const i=[];this.F(s,2097152,i),this.H={makePkgBuff:n,responsePkgType:s,j:k(i)},this.c.set(s,this),this.u.setConnWrapperMaker(((e,t)=>{do{this.p++}while(this.q.has(2097151&this.p));const s=new N(this.H,e,2097151&this.p);this.q.set(s.id,s),this.z?.insert(s);const r={conn:s,onPkgBuff:e=>this.O(s,e),onClose:e=>this.P(s,e)};return this.onConnOpen?.(this,s,!!t),r}))}responsePkgType;context;onConnOpen;onConnClose;address(){return this.u.address()}getConn(e){return this.q.get(e)}connect(e){return this.u.connect(e)}async connectLocal(){do{this.p++}while(this.q.has(2097151&this.p));const e=new R(2097151&this.p,this);return this.q.set(e.id,e),e}async startServer(e){return this.u.startListen(e)}async stopServer(){return this.u.stopListen()}sendMessageLocal(e,t){const s=t.constructor.pkgType,r=this.c.get(s);if(r)return r?.runLocal(e,t);throw new Error("Invalid package")}sendRequestLocal(e,t){const s=t.constructor.pkgType,r=this.c.get(s);if(r)return r?.runLocal(e,t);throw new Error("Invalid package")}registerError(e,t){t.registerPkgType(e),this.$.set(e,t);const s=this.c.get(this.responsePkgType);this.c.set(e,s)}registerMessage(e,t){t.registerPkgType(e)}registerRequest(e,t){t.registerPkgType(e)}handleMessageWith(e){const t=e.pkgType;if(typeof t!=typeof this.responsePkgType)throw new Error(`Wrapper ${e.pkgName} has an incompatible pkgType ${typeof t}`);if(this.c.has(t))throw new Error(`Wrapper ${e.pkgName} is already handled by another handler`);return this.c.set(t,e),e}handleRequestWith(e){const t=e.pkgType;if(typeof t!=typeof this.responsePkgType)throw new Error(`Wrapper ${e.pkgName} has an incompatible pkgType ${typeof t}`);if(this.c.has(t))throw new Error(`Wrapper ${e.pkgName} is already handled by another handler`);return this.c.set(t,e),e}removeHandler(e){const t=e.pkgType;return this.c.get(t)===e&&(this.c.delete(t),!0)}O(e,t){this.z?.update(e);const s=this.G(t),r=this.c.get(s.pkgType);r?r.run(e,s):e.close(new Error("Invalid package"))}P(e,t){const s=e.id;this.q.delete(s),this.z?.remove(e),e.onClose(t),this.onConnClose?.(this,e,e.a.hadClosed(),t)}N(e,t){const{buff:s,pkgType:r,requestId:n,bodyOffset:o}=t;if(r===this.responsePkgType){const t=s.subarray(o);e.I(n,t)}else{const t=this.$.get(r);if(t){const r=new t(s.subarray(o),!0);e.Q(n,r)}}}H;p;F;G;u;q;c;$;z}class N extends T{constructor(e,t,s){super(),this.context=void 0,this.id=s,this.a=t,this.v=e,this.h=void 0,this.J=0}context;id;a;get localAddress(){return this.a.localAddress}get localPort(){return this.a.localPort}get remoteAddress(){return this.a.remoteAddress}get remoteFamily(){return this.a.remoteFamily}get remotePort(){return this.a.remotePort}sendMessage(e){const t=e.constructor.pkgType,s=[e.buff];return this.v.makePkgBuff(t,0,s),this.a.sendPkgBuffV(s)}sendRequest(e){return this.h=new Map,this.sendRequest=this.K,this.I=this.R,this.onClose=this.S,this.K(e)}sendErrorResponse(e,t){const s=e.constructor.pkgType,r=[e.buff];return this.v.makePkgBuff(s,t,r),this.a.sendPkgBuffV(r)}sendResponse(e,t){const s=[e.respBuff],{makePkgBuff:r,responsePkgType:n}=this.v;return r(n,t,s),this.a.sendPkgBuffV(s)}async close(e){await this.a.close(e)}I(e,t){2097152===e&&void 0===this.context&&this.close(new Error("Authenticating timeout"))}Q(e,t){const s=this.h.get(e);if(s)return this.h.delete(e),s.g(t)}keepAlive(){this.a.sendPkgBuff(this.v.j).catch(y)}timeout(){this.close(new Error("Connection timeout"))}onClose(e){}async K(e){const t=2097151&this.J++,s=new Promise(((e,s)=>{const r={f:e,g:s};this.h.set(t,r)})),r=e.constructor.pkgType,n=[e.buff];this.v.makePkgBuff(r,t,n),this.a.sendPkgBuffV(n),e.respBuff=await s}R(e,t){const s=this.h.get(e);if(s)return this.h.delete(e),void s.f(t);2097152===e&&void 0===this.context&&this.close(new Error("Authenticating timeout"))}S(e){const t=this.h;if(t.size>0){e||(e=new Error("Connection is closed"));for(const[s,r]of t)t.delete(s),r.g(e)}this.h=void 0}v;h;J}class R{constructor(e,t){this.context=void 0,this.id=e,this._=t}context;id;localAddress;localPort;remoteAddress;remotePort;get remoteFamily(){return"Local"}async sendMessage(e){return this._.sendMessageLocal(this,e)}async sendRequest(e){return this._.sendRequestLocal(this,e)}sendErrorResponse(e,t){throw null}sendResponse(e,t){throw null}async close(e){}_}var M=t.yE,W=t.sr,q=t.si,A=t.N3,O=t.sk,L=t.wL,S=t.p6,j=t.bM,J=t.h8,$=t.Kr,I=t.Yu,U=t.Kl,F=t.kX,z=t.jG;export{M as BrowserWsNet,W as ErrorWrapper,q as EventWrapper,A as JsonError,O as JsonMessage,L as JsonRequest,S as LazyConn,j as MessageWrapper,J as RequestWrapper,$ as SimpleMessageHandler,I as TimeoutMonitor,U as TypedPkgHub,F as makeNumTypePkgBuff,z as parseNumTypePkgBuff};
@@ -38,10 +38,10 @@ export class c {
38
38
  get a() {
39
39
  return this.t.getPrev();
40
40
  }
41
- C(node) {
41
+ B(node) {
42
42
  return node === this.t;
43
43
  }
44
- D(node) {
44
+ C(node) {
45
45
  node.insertAfter(this.t);
46
46
  }
47
47
  U(node) {
@@ -19,11 +19,11 @@ export class BrowserWsNet {
19
19
  g(new Error('WebSocket error'));
20
20
  };
21
21
  c.onopen = () => {
22
- f(this.M(c, true));
22
+ f(this.L(c, true));
23
23
  };
24
24
  });
25
25
  }
26
- M = (c, isActive) => {
26
+ L = (c, isActive) => {
27
27
  const a = new i(c);
28
28
  const { conn, onPkgBuff, onClose } = this.makeWrapper(a, isActive);
29
29
  c.onmessage = (e) => {
@@ -1,6 +1,6 @@
1
1
  export class LazyConn {
2
2
  constructor(c) {
3
- this.B = c;
3
+ this.A = c;
4
4
  }
5
5
  get id() {
6
6
  return this.b?.id ?? -1;
@@ -45,7 +45,7 @@ export class LazyConn {
45
45
  let { i } = this;
46
46
  if (!i) {
47
47
  i = this.i = new Promise((f, g) => {
48
- this.B().then((conn) => {
48
+ this.A().then((conn) => {
49
49
  if (conn) {
50
50
  f(conn);
51
51
  this.b = conn;
@@ -59,7 +59,7 @@ export class LazyConn {
59
59
  }
60
60
  return await i;
61
61
  }
62
- B;
62
+ A;
63
63
  b;
64
64
  i;
65
65
  }
@@ -2,7 +2,7 @@ import { DataWrapper } from '../common/DataWrapper';
2
2
  export { ErrorWrapper, MessageWrapper, EventWrapper, RequestWrapper, };
3
3
  class PkgWrapper extends DataWrapper {
4
4
  static context;
5
- static $(pkgType) {
5
+ static registerPkgType(pkgType) {
6
6
  let c;
7
7
  try {
8
8
  c = this.pkgType;
@@ -4,7 +4,7 @@ export class MonitorConn extends ListNode {
4
4
  }
5
5
  export class TimeoutMonitor {
6
6
  constructor(e, h, f) {
7
- this.E = e;
7
+ this.D = e;
8
8
  this.y = h;
9
9
  this.w = f;
10
10
  this.j = 0;
@@ -22,23 +22,23 @@ export class TimeoutMonitor {
22
22
  }
23
23
  insert(conn) {
24
24
  if (!this.x) {
25
- this.F = setInterval(this.N, this.E);
25
+ this.E = setInterval(this.M, this.D);
26
26
  }
27
27
  this.x++;
28
- this.o[this.j].D(conn);
28
+ this.o[this.j].C(conn);
29
29
  }
30
30
  update(conn) {
31
31
  conn.remove();
32
- this.o[this.j].D(conn);
32
+ this.o[this.j].C(conn);
33
33
  }
34
34
  remove(conn) {
35
35
  conn.remove();
36
36
  this.x--;
37
37
  if (!this.x) {
38
- clearInterval(this.F);
38
+ clearInterval(this.E);
39
39
  }
40
40
  }
41
- N = () => {
41
+ M = () => {
42
42
  const { y, w, o } = this;
43
43
  this.j++;
44
44
  if (this.j === w) {
@@ -50,21 +50,21 @@ export class TimeoutMonitor {
50
50
  d -= w;
51
51
  }
52
52
  const a = o[d];
53
- for (let node = a.g; !a.C(node); node = node.getNext()) {
53
+ for (let node = a.g; !a.B(node); node = node.getNext()) {
54
54
  node.keepAlive();
55
55
  }
56
56
  }
57
57
  const a = o[this.j];
58
- for (let node = a.g; !a.C(node); node = node.getNext()) {
58
+ for (let node = a.g; !a.B(node); node = node.getNext()) {
59
59
  node.timeout();
60
60
  }
61
61
  };
62
- E;
62
+ D;
63
63
  y;
64
64
  w;
65
65
  j;
66
66
  x;
67
- F;
67
+ E;
68
68
  o;
69
69
  }
70
70
  //# sourceMappingURL=TimeoutMonitor.js.map
@@ -10,16 +10,16 @@ export class TypedPkgHub {
10
10
  this.p = 0;
11
11
  this.q = new Map();
12
12
  this.c = new Map();
13
- this._ = new Map();
14
- this.G = makePkgBuff;
15
- this.H = parsePkgBuff;
13
+ this.$ = new Map();
14
+ this.F = makePkgBuff;
15
+ this.G = parsePkgBuff;
16
16
  this.u = s;
17
17
  this.z = timeoutMonitor;
18
18
  const o = this;
19
- o.run = this.O;
19
+ o.run = this.N;
20
20
  const j = [];
21
- this.G(responsePkgType, 0x200000, j);
22
- this.I = {
21
+ this.F(responsePkgType, 0x200000, j);
22
+ this.H = {
23
23
  makePkgBuff: makePkgBuff,
24
24
  responsePkgType: responsePkgType,
25
25
  j: l(j),
@@ -29,13 +29,13 @@ export class TypedPkgHub {
29
29
  do {
30
30
  this.p++;
31
31
  } while (this.q.has(this.p & 0x1fffff));
32
- const conn = new k(this.I, a, this.p & 0x1fffff);
32
+ const conn = new k(this.H, a, this.p & 0x1fffff);
33
33
  this.q.set(conn.id, conn);
34
34
  this.z?.insert(conn);
35
35
  const e = {
36
36
  conn,
37
- onPkgBuff: (buff) => this.P(conn, buff),
38
- onClose: (err) => this.Q(conn, err),
37
+ onPkgBuff: (buff) => this.O(conn, buff),
38
+ onClose: (err) => this.P(conn, err),
39
39
  };
40
40
  this.onConnOpen?.(this, conn, !!isActive);
41
41
  return e;
@@ -85,16 +85,16 @@ export class TypedPkgHub {
85
85
  throw new Error('Invalid package');
86
86
  }
87
87
  registerError(pkgType, wrapperCtor) {
88
- wrapperCtor.$(pkgType);
89
- this._.set(pkgType, wrapperCtor);
88
+ wrapperCtor.registerPkgType(pkgType);
89
+ this.$.set(pkgType, wrapperCtor);
90
90
  const w = this.c.get(this.responsePkgType);
91
91
  this.c.set(pkgType, w);
92
92
  }
93
93
  registerMessage(pkgType, wrapperCtor) {
94
- wrapperCtor.$(pkgType);
94
+ wrapperCtor.registerPkgType(pkgType);
95
95
  }
96
96
  registerRequest(pkgType, wrapperCtor) {
97
- wrapperCtor.$(pkgType);
97
+ wrapperCtor.registerPkgType(pkgType);
98
98
  }
99
99
  handleMessageWith(handler) {
100
100
  const pkgType = handler.pkgType;
@@ -127,9 +127,9 @@ export class TypedPkgHub {
127
127
  }
128
128
  return false;
129
129
  }
130
- P(conn, buff) {
130
+ O(conn, buff) {
131
131
  this.z?.update(conn);
132
- const parseResult = this.H(buff);
132
+ const parseResult = this.G(buff);
133
133
  const handler = this.c.get(parseResult.pkgType);
134
134
  if (handler) {
135
135
  handler.run(conn, parseResult);
@@ -137,36 +137,36 @@ export class TypedPkgHub {
137
137
  }
138
138
  conn.close(new Error('Invalid package'));
139
139
  }
140
- Q(conn, err) {
140
+ P(conn, err) {
141
141
  const connId = conn.id;
142
142
  this.q.delete(connId);
143
143
  this.z?.remove(conn);
144
144
  conn.onClose(err);
145
145
  this.onConnClose?.(this, conn, conn.a.hadClosed(), err);
146
146
  }
147
- O(conn, parseResult) {
147
+ N(conn, parseResult) {
148
148
  const { buff, pkgType, requestId, bodyOffset } = parseResult;
149
149
  if (pkgType === this.responsePkgType) {
150
150
  const b = buff.subarray(bodyOffset);
151
- conn.J(requestId, b);
151
+ conn.I(requestId, b);
152
152
  }
153
153
  else {
154
- const r = this._.get(pkgType);
154
+ const r = this.$.get(pkgType);
155
155
  if (r) {
156
156
  const b = buff.subarray(bodyOffset);
157
157
  const y = new r(b, true);
158
- conn.R(requestId, y);
158
+ conn.Q(requestId, y);
159
159
  }
160
160
  }
161
161
  }
162
- I;
162
+ H;
163
163
  p;
164
+ F;
164
165
  G;
165
- H;
166
166
  u;
167
167
  q;
168
168
  c;
169
- _;
169
+ $;
170
170
  z;
171
171
  }
172
172
  class k extends MonitorConn {
@@ -177,7 +177,7 @@ class k extends MonitorConn {
177
177
  this.a = a;
178
178
  this.v = m;
179
179
  this.h = undefined;
180
- this.K = 0;
180
+ this.J = 0;
181
181
  }
182
182
  context;
183
183
  id;
@@ -205,10 +205,10 @@ class k extends MonitorConn {
205
205
  }
206
206
  sendRequest(request) {
207
207
  this.h = new Map();
208
- this.sendRequest = this.L;
209
- this.J = this.S;
210
- this.onClose = this.T;
211
- return this.L(request);
208
+ this.sendRequest = this.K;
209
+ this.I = this.R;
210
+ this.onClose = this.S;
211
+ return this.K(request);
212
212
  }
213
213
  sendErrorResponse(error, requestId) {
214
214
  const pkgType = error.constructor.pkgType;
@@ -225,12 +225,12 @@ class k extends MonitorConn {
225
225
  async close(err) {
226
226
  await this.a.close(err);
227
227
  }
228
- J(requestId, M) {
228
+ I(requestId, L) {
229
229
  if (requestId === 0x200000 && this.context === undefined) {
230
230
  this.close(new Error('Authenticating timeout'));
231
231
  }
232
232
  }
233
- R(requestId, error) {
233
+ Q(requestId, error) {
234
234
  const d = this.h.get(requestId);
235
235
  if (d) {
236
236
  this.h.delete(requestId);
@@ -243,21 +243,21 @@ class k extends MonitorConn {
243
243
  timeout() {
244
244
  this.close(new Error('Connection timeout'));
245
245
  }
246
- onClose(B) {
246
+ onClose(A) {
247
247
  }
248
- async L(request) {
249
- const requestId = (this.K++) & 0x1fffff;
250
- const C = new Promise((f, g) => {
251
- const D = { f, g };
252
- this.h.set(requestId, D);
248
+ async K(request) {
249
+ const requestId = (this.J++) & 0x1fffff;
250
+ const B = new Promise((f, g) => {
251
+ const C = { f, g };
252
+ this.h.set(requestId, C);
253
253
  });
254
254
  const pkgType = request.constructor.pkgType;
255
255
  const encoded = [request.buff];
256
256
  this.v.makePkgBuff(pkgType, requestId, encoded);
257
257
  this.a.sendPkgBuffV(encoded);
258
- request.respBuff = await C;
258
+ request.respBuff = await B;
259
259
  }
260
- S(requestId, b) {
260
+ R(requestId, b) {
261
261
  const d = this.h.get(requestId);
262
262
  if (d) {
263
263
  this.h.delete(requestId);
@@ -268,7 +268,7 @@ class k extends MonitorConn {
268
268
  this.close(new Error('Authenticating timeout'));
269
269
  }
270
270
  }
271
- T(err) {
271
+ S(err) {
272
272
  const n = this.h;
273
273
  if (n.size > 0) {
274
274
  if (!err) {
@@ -283,13 +283,13 @@ class k extends MonitorConn {
283
283
  }
284
284
  v;
285
285
  h;
286
- K;
286
+ J;
287
287
  }
288
288
  class t {
289
- constructor(id, E) {
289
+ constructor(id, D) {
290
290
  this.context = undefined;
291
291
  this.id = id;
292
- this.A = E;
292
+ this._ = D;
293
293
  }
294
294
  context;
295
295
  id;
@@ -301,19 +301,19 @@ class t {
301
301
  return 'Local';
302
302
  }
303
303
  async sendMessage(message) {
304
- return this.A.sendMessageLocal(this, message);
304
+ return this._.sendMessageLocal(this, message);
305
305
  }
306
306
  async sendRequest(request) {
307
- return this.A.sendRequestLocal(this, request);
307
+ return this._.sendRequestLocal(this, request);
308
308
  }
309
- sendErrorResponse(N, F) {
309
+ sendErrorResponse(M, E) {
310
310
  throw null;
311
311
  }
312
- sendResponse(U, F) {
312
+ sendResponse(T, E) {
313
313
  throw null;
314
314
  }
315
- async close(B) {
315
+ async close(A) {
316
316
  }
317
- A;
317
+ _;
318
318
  }
319
319
  //# sourceMappingURL=TypedPkgHub.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "justrun-ws",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "scripts": {
5
5
  "start": "webpack serve"
6
6
  },
@@ -31,9 +31,9 @@
31
31
  "eslint": "^9.21.0",
32
32
  "eslint-plugin-import": "^2.31.0",
33
33
  "globals": "^15.14.0",
34
- "minify-ts": "^1.2.3",
34
+ "minify-ts": "^1.2.4",
35
35
  "ts-loader": "^9.5.2",
36
36
  "webpack": "^5.98.0",
37
37
  "webpack-cli": "^6.0.1"
38
38
  }
39
- }
39
+ }