egg 3.16.1 → 3.17.1

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.
@@ -14,7 +14,7 @@ class Messenger extends EventEmitter {
14
14
  constructor() {
15
15
  super();
16
16
  this.pid = String(process.pid);
17
- // pids of agent or app maneged by master
17
+ // pids of agent or app managed by master
18
18
  // - retrieve app worker pids when it's an agent worker
19
19
  // - retrieve agent worker pids when it's an app worker
20
20
  this.opids = [];
@@ -79,6 +79,11 @@ class Singleton {
79
79
  return this.clients.get(id);
80
80
  }
81
81
 
82
+ // alias to `get(id)`
83
+ getSingletonInstance(id) {
84
+ return this.clients.get(id);
85
+ }
86
+
82
87
  createInstance(config, clientName) {
83
88
  // async creator only support createInstanceAsync
84
89
  assert(!is.asyncFunction(this.create),
package/lib/egg.js CHANGED
@@ -27,7 +27,7 @@ const EGG_PATH = Symbol.for('egg#eggPath');
27
27
  const CLUSTER_CLIENTS = Symbol.for('egg#clusterClients');
28
28
 
29
29
  /**
30
- * Base on koa's Application
30
+ * Based on koa's Application
31
31
  * @see https://github.com/eggjs/egg-core
32
32
  * @see http://koajs.com/#application
33
33
  * @augments EggCore
@@ -62,8 +62,8 @@ class EggApplication extends EggCore {
62
62
  */
63
63
  this.messenger = Messenger.create(this);
64
64
 
65
- // trigger serverDidReady hook when all app workers
66
- // and agent worker is ready
65
+ // trigger `serverDidReady` hook when all the app workers
66
+ // and agent worker are ready
67
67
  this.messenger.once('egg-ready', () => {
68
68
  this.lifecycle.triggerServerDidReady();
69
69
  });
@@ -40,7 +40,7 @@ class AppWorkerLoader extends EggLoader {
40
40
  // app
41
41
  this.loadController();
42
42
  // app
43
- this.loadRouter(); // Dependent on controllers
43
+ this.loadRouter(); // Depend on controllers
44
44
  }
45
45
 
46
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egg",
3
- "version": "3.16.1",
3
+ "version": "3.17.1",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
@@ -46,7 +46,7 @@
46
46
  "graceful": "^1.1.0",
47
47
  "humanize-ms": "^1.2.1",
48
48
  "is-type-of": "^1.2.1",
49
- "koa-bodyparser": "^4.3.0",
49
+ "koa-bodyparser": "^4.4.1",
50
50
  "koa-is-json": "^1.0.0",
51
51
  "koa-override": "^3.0.0",
52
52
  "ms": "^2.1.3",
@@ -1,42 +0,0 @@
1
- /**
2
- * 继承 koa 的 Context
3
- * @class Context
4
- * @see http://koajs.com/#context
5
- */
6
-
7
- /**
8
- * 实现页面跳转
9
- * @see Response#redirect
10
- * @method Context#redirect
11
- * @param {String} url 需要跳转的地址
12
- */
13
-
14
- /**
15
- * 开启 {@link Rest} 功能后,将会有 `this.params` 对象
16
- * @member {Object} Context#params
17
- * @example
18
- * ##### ctx.params.id {String}
19
- *
20
- * 资源 id,如 `GET /api/users/1` => `'1'`
21
- *
22
- * ##### ctx.params.ids {Array<String>}
23
- *
24
- * 一组资源 id,如 `GET /api/users/1,2,3` => `['1', '2', '3']`
25
- *
26
- * ##### ctx.params.fields {Array<String>}
27
- *
28
- * 期待返回的资源字段,如 `GET /api/users/1?fields=name,title` => `['name', 'title']`.
29
- * 即使应用 Controller 实现返回了全部字段,[REST] 处理器会根据 `fields` 筛选只需要的字段。
30
- *
31
- * ##### ctx.params.data {Object}
32
- *
33
- * 请求数据对象
34
- *
35
- * ##### ctx.params.page {Number}
36
- *
37
- * 分页码,如 `GET /api/users?page=10` => `10`
38
- *
39
- * ##### ctx.params.per_page {Number}
40
- *
41
- * 每页资源数目,如 `GET /api/users?per_page=20` => `20`
42
- */
@@ -1,48 +0,0 @@
1
- /**
2
- * 继承 koa 的 Request
3
- * @class Request
4
- * @see http://koajs.com/#request
5
- */
6
-
7
-
8
- // 文档注释
9
- /**
10
- * Request header
11
- * @member {Object} Request#header
12
- */
13
-
14
- /**
15
- * Request headers
16
- * @member {Object} Request#headers
17
- */
18
-
19
- /**
20
- * Request HTTP Method, 比如: GET, POST, PATCH, PUT, DELETE
21
- * @member {String} Request#method
22
- */
23
-
24
- /**
25
- * 完整的请求 URL 地址
26
- * @member {String} Request#url
27
- */
28
-
29
- /**
30
- * 完整的请求 URL 地址
31
- * @member {String} Request#originalUrl
32
- */
33
-
34
- /**
35
- * 完整的请求 URL 地址,的路径部分(不包含域名)
36
- * @member {String} Request#path
37
- */
38
-
39
- /**
40
- * 请求的 GET 参数
41
- * @member {String} Request#querystring
42
- * @example
43
- * GET http://127.0.0.1:7001?name=Foo&age=20
44
- * ```js
45
- * this.request.querystring
46
- * => 'name=Foo&age=20'
47
- * ```
48
- */
@@ -1,5 +0,0 @@
1
- /**
2
- * 继承 koa 的 Response
3
- * @class Response
4
- * @see http://koajs.com/#response
5
- */