Skip to content

Commit

Permalink
fix: Fix invalid placing of namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ReiiYuki committed Aug 16, 2023
1 parent 25c14a0 commit 7176365
Showing 1 changed file with 57 additions and 57 deletions.
114 changes: 57 additions & 57 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
export {}

declare namespace proxyman.addons {
type Method = 'ANY' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'PATCH'

type Scheme = 'http' | 'https'

type Flow = {
serverPort: string
serverIpAddress: string
clientIpAddress: string
remoteDeviceName: string | null
remoteDeviceIP: string | null
id: string
clientPath: string | null
clientPort: string
clientName: string | null
}

type Context = {
scriptName: string
matchingRule: string
matchingMethod: Method
isEnableOnRequest: boolean
isEnableOnResponse: boolean
filePath: string
flow?: Flow
}

type Request = {
method: Method
scheme: Scheme
host: string
path: string
port: number
queries: Record<string, any>
headers: Record<string, any>
body?: string | Record<string, any>
bodyFilePath?: string
rawBody?: string
preserveHostHeader: boolean
isURLEncoding: boolean
}

type Response = {
statusCode: number
httpVersion: string
statusPhrase: string
headers: Record<string, any>
body?: string | Record<string, any>
rawBody?: string
bodyFilePath?: string
}

type onRequest = (context: Context, url: string, request: Request) => Request

type onResponse = (context: Context, url: string, request: Request, response: Response) => Response
}

declare global {
const sharedState: Record<string, any>

namespace proxyman.addons {
type Method = 'ANY' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'PATCH'

type Scheme = 'http' | 'https'

type Flow = {
serverPort: string
serverIpAddress: string
clientIpAddress: string
remoteDeviceName: string | null
remoteDeviceIP: string | null
id: string
clientPath: string | null
clientPort: string
clientName: string | null
}

type Context = {
scriptName: string
matchingRule: string
matchingMethod: Method
isEnableOnRequest: boolean
isEnableOnResponse: boolean
filePath: string
flow?: Flow
}

type Request = {
method: Method
scheme: Scheme
host: string
path: string
port: number
queries: Record<string, any>
headers: Record<string, any>
body?: string | Record<string, any>
bodyFilePath?: string
rawBody?: string
preserveHostHeader: boolean
isURLEncoding: boolean
}

type Response = {
statusCode: number
httpVersion: string
statusPhrase: string
headers: Record<string, any>
body?: string | Record<string, any>
rawBody?: string
bodyFilePath?: string
}

type onRequest = (context: Context, url: string, request: Request) => Request

type onResponse = (context: Context, url: string, request: Request, response: Response) => Response
}
}

0 comments on commit 7176365

Please sign in to comment.