lack 1.3.8 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -213,7 +213,23 @@ declare namespace Whistle {
213
213
  type GetSession = (cb: (session: Session | '') => void) => void;
214
214
  type GetFrame = (cb: (Frames: Frame[] | '') => void) => void;
215
215
  type SetRules = (rules: string) => boolean;
216
- type PassThrough = (uri?: any, trailers?: any) => void;
216
+ interface PluginDecoder {
217
+ getBuffer: (cb: (err: any, buf?: Buffer | null) => void) => void;
218
+ getText: (cb: (err: any, text?: string) => void, encoding?: string) => void;
219
+ getJson: (cb: (err: any, json?: any) => void, encoding?: string) => void;
220
+ }
221
+
222
+ type PluginReqCtx = PluginDecoder & PluginRequest;
223
+ type PluginResCtx = PluginDecoder & WhistleBase.Request;
224
+ type PluginNextResult = {
225
+ rules?: string | null | undefined;
226
+ body?: any;
227
+ };
228
+ type PluginReqHandler = (buffer: Buffer | null, next: (result?: PluginNextResult) => void, ctx?: PluginReqCtx) => void;
229
+ type PluginResHandler = (buffer: Buffer | null, next: (result?: PluginNextResult) => void, ctx?: PluginResCtx) => void;
230
+ type PassThroughReq = PluginReqHandler | { [key: string]: any } | null | undefined;
231
+ type PassThroughRes = PluginResHandler | { [key: string]: any } | null | undefined;
232
+ type PassThrough = (uri?: PassThroughReq, trailers?: PassThroughRes) => void;
217
233
 
218
234
  interface WriteHead {
219
235
  (code: string | number, msg?: string, headers?: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lack",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "whistle extension tools",
5
5
  "author": "avenwu <avwu@qq.com>",
6
6
  "license": "MIT",