egg 3.8.0 → 3.9.0-beta.0

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.
Files changed (2) hide show
  1. package/index.d.ts +13 -5
  2. package/package.json +4 -2
package/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  import accepts = require('accepts');
3
- import KoaApplication = require('koa');
4
- import KoaRouter = require('koa-router');
5
3
  import { AsyncLocalStorage } from 'async_hooks';
6
4
  import { EventEmitter } from 'events'
7
5
  import { Readable } from 'stream';
8
6
  import { Socket } from 'net';
9
7
  import { IncomingMessage, ServerResponse } from 'http';
8
+ import KoaApplication = require('koa');
9
+ import KoaRouter = require('koa-router');
10
10
  import {
11
11
  EggLogger as Logger,
12
12
  EggLoggers,
@@ -15,7 +15,9 @@ import {
15
15
  EggLoggerOptions,
16
16
  EggContextLogger
17
17
  } from 'egg-logger';
18
- import { HttpClient, RequestOptions2 as RequestOptions } from 'urllib';
18
+ import { RequestOptions2 as RequestOptions, HttpClientResponse } from 'urllib';
19
+ import { RequestURL, RequestOptions as RequestOptionsNext } from 'urllib-next/src/Request';
20
+ import { HttpClientResponse as HttpClientResponseNext } from 'urllib-next/src/Response';
19
21
  import {
20
22
  EggCoreBase,
21
23
  FileLoaderOption,
@@ -46,12 +48,18 @@ declare module 'egg' {
46
48
  // Remove specific property from the specific class
47
49
  type RemoveSpecProp<T, P> = Pick<T, Exclude<keyof T, P>>;
48
50
 
49
- export interface EggHttpClient extends HttpClient<RequestOptions> { }
51
+ // Compatible with both urllib@2 and urllib@3 RequestOptions to request
52
+ export interface EggHttpClient extends EventEmitter {
53
+ reques<T = any>(url: RequestURL): Promise<HttpClientResponse<T> | HttpClientResponseNext>;
54
+ request<T = any>(url: RequestURL, options: RequestOptions | RequestOptionsNext): Promise<HttpClientResponse<T> | HttpClientResponseNext>;
55
+ curl<T = any>(url: RequestURL): Promise<HttpClientResponse<T> | HttpClientResponseNext>;
56
+ curl<T = any>(url: RequestURL, options: RequestOptions | RequestOptionsNext): Promise<HttpClientResponse<T> | HttpClientResponseNext>;
57
+ }
50
58
  interface EggHttpConstructor {
51
59
  new(app: Application): EggHttpClient;
52
60
  }
53
61
 
54
- export interface EggContextHttpClient extends HttpClient<RequestOptions> { }
62
+ export interface EggContextHttpClient extends EggHttpClient { }
55
63
  interface EggContextHttpClientConstructor {
56
64
  new(ctx: Context): EggContextHttpClient;
57
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egg",
3
- "version": "3.8.0",
3
+ "version": "3.9.0-beta.0",
4
4
  "publishConfig": {
5
5
  "tag": "next"
6
6
  },
@@ -54,7 +54,7 @@
54
54
  "on-finished": "^2.4.1",
55
55
  "sendmessage": "^1.1.0",
56
56
  "urllib": "^2.33.0",
57
- "urllib-next": "^3.1.3",
57
+ "urllib-next": "^3.8.0",
58
58
  "utility": "^1.17.0",
59
59
  "ylru": "^1.3.2"
60
60
  },
@@ -81,6 +81,8 @@
81
81
  "koa-static": "^5.0.0",
82
82
  "pedding": "^1.1.0",
83
83
  "prettier": "^2.7.1",
84
+ "react": "^16.14.0",
85
+ "react-dom": "^16.14.0",
84
86
  "runscript": "^1.5.3",
85
87
  "spy": "^1.0.0",
86
88
  "supertest": "^6.2.4",