forked from ExpressGateway/express-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
42 lines (36 loc) · 1.09 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import express = require("express");
import { EventEmitter } from "events";
import { JSONSchema6 } from "json-schema";
declare global {
namespace Express {
export interface Request {
egContext: any
}
}
namespace ExpressGateway {
interface Policy {
name: string,
policy(actionParams): express.RequestHandler,
schema?: JSONSchema6
}
interface Condition {
name: string,
handler(req: express.Request, conditionConfig): boolean,
schema?: JSONSchema6
}
interface PluginContext {
registerPolicy(policy: Policy): void,
registerCondition(condition: Condition): void,
registerGatewayRoute(gatewayRoutesDeclaration: (gatewayExpressApp: express.Application) => void): void,
registerAdminRoute(adminRoutesDeclaration: (adminExpressApp: express.Application) => void): void,
registerCLIExtension(cliExtension): void,
eventBus: EventEmitter
}
export interface Plugin {
version?: string,
policies?: Array<string>,
init(context: PluginContext): void,
schema?: JSONSchema6
}
}
}