()
| 2 | const InvalidActionError = scErrors.InvalidActionError; |
| 3 | |
| 4 | function AGAction() { |
| 5 | this.outcome = null; |
| 6 | this.promise = new Promise((resolve, reject) => { |
| 7 | this._resolve = resolve; |
| 8 | this._reject = reject; |
| 9 | }); |
| 10 | |
| 11 | this.allow = (packet) => { |
| 12 | if (this.outcome) { |
| 13 | throw new InvalidActionError(`AGAction ${this.type} has already been ${this.outcome}; cannot allow`); |
| 14 | } |
| 15 | this.outcome = 'allowed'; |
| 16 | this._resolve(packet); |
| 17 | }; |
| 18 | |
| 19 | this.block = (error) => { |
| 20 | if (this.outcome) { |
| 21 | throw new InvalidActionError(`AGAction ${this.type} has already been ${this.outcome}; cannot block`); |
| 22 | } |
| 23 | this.outcome = 'blocked'; |
| 24 | this._reject(error); |
| 25 | }; |
| 26 | } |
| 27 | |
| 28 | AGAction.prototype.HANDSHAKE_WS = AGAction.HANDSHAKE_WS = 'handshakeWS'; |
| 29 | AGAction.prototype.HANDSHAKE_SC = AGAction.HANDSHAKE_SC = 'handshakeSC'; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…