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