Remove enum prefixes
This commit is contained in:
@@ -123,7 +123,7 @@ describe("auth", () => {
|
||||
socket.auth.status = AuthStatus.PendingResponse
|
||||
|
||||
await expect(socket.auth.doAuth(sign)).rejects.toThrow(
|
||||
"Attempted to authenticate when auth is already auth:status:pending_response",
|
||||
"Attempted to authenticate when auth is already pending_response",
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import {Unsubscriber} from "./util.js"
|
||||
import {netContext, NetContext} from "./context.js"
|
||||
|
||||
export enum AdapterEvent {
|
||||
Receive = "adapter:event:receive",
|
||||
Receive = "receive",
|
||||
}
|
||||
|
||||
export type AdapterEvents = {
|
||||
|
||||
@@ -7,13 +7,13 @@ import {Socket, SocketStatus, SocketEvent} from "./socket.js"
|
||||
import {Unsubscriber} from "./util.js"
|
||||
|
||||
export enum AuthStatus {
|
||||
None = "auth:status:none",
|
||||
Requested = "auth:status:requested",
|
||||
PendingSignature = "auth:status:pending_signature",
|
||||
DeniedSignature = "auth:status:denied_signature",
|
||||
PendingResponse = "auth:status:pending_response",
|
||||
Forbidden = "auth:status:forbidden",
|
||||
Ok = "auth:status:ok",
|
||||
None = "none",
|
||||
Requested = "requested",
|
||||
PendingSignature = "pending_signature",
|
||||
DeniedSignature = "denied_signature",
|
||||
PendingResponse = "pending_response",
|
||||
Forbidden = "forbidden",
|
||||
Ok = "ok",
|
||||
}
|
||||
|
||||
export type AuthResult = {
|
||||
|
||||
@@ -14,9 +14,9 @@ import {requestOne} from "./request.js"
|
||||
import {publish} from "./publish.js"
|
||||
|
||||
export enum DifferenceEvent {
|
||||
Message = "difference:event:message",
|
||||
Error = "difference:event:error",
|
||||
Close = "difference:event:close",
|
||||
Message = "message",
|
||||
Error = "error",
|
||||
Close = "close",
|
||||
}
|
||||
|
||||
export type DifferenceEvents = {
|
||||
|
||||
@@ -4,12 +4,12 @@ import {RelayMessage, ClientMessageType, isRelayOk} from "./message.js"
|
||||
import {AdapterEvent, AdapterContext, getAdapter} from "./adapter.js"
|
||||
|
||||
export enum PublishStatus {
|
||||
Sending = "publish:status:sending",
|
||||
Pending = "publish:status:pending",
|
||||
Success = "publish:status:success",
|
||||
Failure = "publish:status:failure",
|
||||
Timeout = "publish:status:timeout",
|
||||
Aborted = "publish:status:aborted",
|
||||
Sending = "sending",
|
||||
Pending = "pending",
|
||||
Success = "success",
|
||||
Failure = "failure",
|
||||
Timeout = "timeout",
|
||||
Aborted = "aborted",
|
||||
}
|
||||
|
||||
export type PublishResult = {
|
||||
|
||||
+11
-11
@@ -5,20 +5,20 @@ import {RelayMessage, ClientMessage} from "./message.js"
|
||||
import {AuthState} from "./auth.js"
|
||||
|
||||
export enum SocketStatus {
|
||||
Open = "socket:status:open",
|
||||
Opening = "socket:status:opening",
|
||||
Closing = "socket:status:closing",
|
||||
Closed = "socket:status:closed",
|
||||
Error = "socket:status:error",
|
||||
Open = "open",
|
||||
Opening = "opening",
|
||||
Closing = "closing",
|
||||
Closed = "closed",
|
||||
Error = "error",
|
||||
}
|
||||
|
||||
export enum SocketEvent {
|
||||
Error = "socket:event:error",
|
||||
Status = "socket:event:status",
|
||||
Send = "socket:event:send",
|
||||
Sending = "socket:event:sending",
|
||||
Receive = "socket:event:receive",
|
||||
Receiving = "socket:event:receiving",
|
||||
Error = "error",
|
||||
Status = "status",
|
||||
Send = "send",
|
||||
Sending = "sending",
|
||||
Receive = "receive",
|
||||
Receiving = "receiving",
|
||||
}
|
||||
|
||||
export type SocketEvents = {
|
||||
|
||||
@@ -18,6 +18,7 @@ export type WrapManagerOptions = {
|
||||
export class WrapManager extends Emitter {
|
||||
_wrapIndex = new Map<string, WrapItem>()
|
||||
_rumorIndex = new Map<string, WrapReference>()
|
||||
_recipientIndex = new Map<string, WrapReference>()
|
||||
|
||||
constructor(readonly options: WrapManagerOptions) {
|
||||
super()
|
||||
@@ -28,7 +29,7 @@ export class WrapManager extends Emitter {
|
||||
dump = () => Array.from(this._wrapIndex.values())
|
||||
|
||||
getWraps = (rumorId: string) =>
|
||||
this._rumorIndex.get(rumorId).map(wrapId => this._wrapIndex.get(wrapId)!)
|
||||
(this._rumorIndex.get(rumorId) || []).map(wrapId => this._wrapIndex.get(wrapId)!)
|
||||
|
||||
getRumor = (wrapId: string) => {
|
||||
const wrapItem = this._wrapIndex.get(wrapId)
|
||||
|
||||
Reference in New Issue
Block a user