@midwayjs/core 4.0.0-beta.7 → 4.0.0-beta.8

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 (105) hide show
  1. package/dist/baseFramework.d.ts +6 -6
  2. package/dist/baseFramework.js +19 -6
  3. package/dist/common/applicationManager.js +1 -3
  4. package/dist/common/asyncContextManager.js +23 -0
  5. package/dist/common/dataListener.js +2 -3
  6. package/dist/common/dataSourceManager.js +10 -8
  7. package/dist/common/fileDetector.js +2 -4
  8. package/dist/common/filterManager.js +6 -8
  9. package/dist/common/loggerFactory.js +1 -3
  10. package/dist/common/middlewareManager.js +2 -2
  11. package/dist/common/performanceManager.d.ts +0 -1
  12. package/dist/common/performanceManager.js +21 -20
  13. package/dist/common/priorityManager.js +2 -4
  14. package/dist/common/serviceDiscovery/healthCheck.js +10 -2
  15. package/dist/common/serviceDiscovery/loadBalancer.js +1 -3
  16. package/dist/common/serviceDiscovery/serviceDiscovery.js +6 -3
  17. package/dist/common/serviceFactory.js +6 -6
  18. package/dist/common/typedResourceManager.js +3 -2
  19. package/dist/common/webGenerator.js +2 -0
  20. package/dist/config/config.default.js +4 -4
  21. package/dist/context/componentLoader.js +3 -2
  22. package/dist/context/container.d.ts +0 -1
  23. package/dist/context/container.js +9 -8
  24. package/dist/context/definitionRegistry.js +3 -6
  25. package/dist/context/dynamicContainer.js +3 -2
  26. package/dist/context/managedResolverFactory.js +2 -1
  27. package/dist/context/providerWrapper.js +1 -2
  28. package/dist/context/requestContainer.js +5 -2
  29. package/dist/decorator/common/aspect.js +1 -2
  30. package/dist/decorator/common/autoload.js +1 -2
  31. package/dist/decorator/common/configuration.js +1 -2
  32. package/dist/decorator/common/filter.js +2 -3
  33. package/dist/decorator/common/framework.js +8 -9
  34. package/dist/decorator/common/guard.js +2 -3
  35. package/dist/decorator/common/inject.js +4 -5
  36. package/dist/decorator/common/middleware.js +1 -2
  37. package/dist/decorator/common/mock.js +1 -2
  38. package/dist/decorator/common/objectDef.js +2 -3
  39. package/dist/decorator/common/pipe.js +1 -2
  40. package/dist/decorator/common/provide.js +1 -2
  41. package/dist/decorator/common/scope.js +2 -3
  42. package/dist/decorator/decoratorManager.js +1 -1
  43. package/dist/decorator/faas/serverlessTrigger.js +2 -3
  44. package/dist/decorator/metadataManager.js +11 -11
  45. package/dist/decorator/microservice/consumer.js +1 -2
  46. package/dist/decorator/microservice/kafkaListener.js +1 -2
  47. package/dist/decorator/microservice/provider.js +4 -4
  48. package/dist/decorator/microservice/rabbitmqListener.js +1 -2
  49. package/dist/decorator/task/queue.js +1 -2
  50. package/dist/decorator/task/schedule.js +1 -2
  51. package/dist/decorator/task/task.js +1 -2
  52. package/dist/decorator/task/taskLocal.js +1 -2
  53. package/dist/decorator/web/controller.js +1 -2
  54. package/dist/decorator/web/response.js +5 -6
  55. package/dist/decorator/ws/webSocketController.js +1 -2
  56. package/dist/decorator/ws/webSocketEvent.js +6 -6
  57. package/dist/definitions/functionDefinition.js +21 -12
  58. package/dist/definitions/objectCreator.js +2 -1
  59. package/dist/definitions/objectDefinition.js +19 -17
  60. package/dist/error/base.js +5 -2
  61. package/dist/functional/configuration.js +1 -0
  62. package/dist/functional/hooks.js +10 -11
  63. package/dist/interface.d.ts +0 -2
  64. package/dist/legacy/decorator.js +31 -32
  65. package/dist/response/base.d.ts +3 -5
  66. package/dist/response/base.js +22 -21
  67. package/dist/response/http.d.ts +4 -7
  68. package/dist/response/http.js +12 -12
  69. package/dist/response/sse.d.ts +0 -1
  70. package/dist/response/sse.js +4 -1
  71. package/dist/response/stream.d.ts +0 -1
  72. package/dist/response/stream.js +3 -1
  73. package/dist/service/aspectService.js +1 -0
  74. package/dist/service/configService.js +13 -12
  75. package/dist/service/decoratorService.js +6 -4
  76. package/dist/service/environmentService.js +2 -3
  77. package/dist/service/frameworkService.js +9 -1
  78. package/dist/service/healthService.js +5 -4
  79. package/dist/service/informationService.js +3 -0
  80. package/dist/service/lifeCycleService.js +6 -1
  81. package/dist/service/loggerService.js +6 -2
  82. package/dist/service/middlewareService.js +1 -0
  83. package/dist/service/mockService.js +17 -15
  84. package/dist/service/slsFunctionService.js +1 -0
  85. package/dist/service/webRouterService.d.ts +1 -1
  86. package/dist/service/webRouterService.js +4 -3
  87. package/dist/setup.js +4 -5
  88. package/dist/util/camelCase.js +2 -3
  89. package/dist/util/contextUtil.d.ts +3 -3
  90. package/dist/util/extend.js +1 -2
  91. package/dist/util/flatted.js +2 -3
  92. package/dist/util/fs.js +2 -2
  93. package/dist/util/httpclient.d.ts +0 -4
  94. package/dist/util/httpclient.js +3 -2
  95. package/dist/util/index.d.ts +1 -2
  96. package/dist/util/index.js +26 -36
  97. package/dist/util/pathFileUtil.d.ts +0 -1
  98. package/dist/util/pathFileUtil.js +6 -6
  99. package/dist/util/retry.js +2 -3
  100. package/dist/util/timeout.d.ts +0 -1
  101. package/dist/util/timeout.js +1 -2
  102. package/dist/util/types.d.ts +7 -7
  103. package/dist/util/types.js +17 -17
  104. package/dist/util/uuid.js +1 -2
  105. package/package.json +2 -2
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PathFileUtils = exports.getModuleRequirePathList = exports.normalizePath = exports.getFileContentSync = exports.isPathEqual = exports.isPath = void 0;
3
+ exports.PathFileUtils = void 0;
4
+ exports.isPath = isPath;
5
+ exports.isPathEqual = isPathEqual;
6
+ exports.getFileContentSync = getFileContentSync;
7
+ exports.normalizePath = normalizePath;
8
+ exports.getModuleRequirePathList = getModuleRequirePathList;
4
9
  const path_1 = require("path");
5
10
  const fs_1 = require("fs");
6
11
  function isPath(p) {
@@ -10,7 +15,6 @@ function isPath(p) {
10
15
  }
11
16
  return false;
12
17
  }
13
- exports.isPath = isPath;
14
18
  function isPathEqual(one, two) {
15
19
  if (!one || !two) {
16
20
  return false;
@@ -18,7 +22,6 @@ function isPathEqual(one, two) {
18
22
  const ext = (0, path_1.extname)(one);
19
23
  return one.replace(ext, '') === two;
20
24
  }
21
- exports.isPathEqual = isPathEqual;
22
25
  function getFileContentSync(filePath, encoding) {
23
26
  return typeof filePath === 'string'
24
27
  ? (0, fs_1.readFileSync)(filePath, {
@@ -26,7 +29,6 @@ function getFileContentSync(filePath, encoding) {
26
29
  })
27
30
  : filePath;
28
31
  }
29
- exports.getFileContentSync = getFileContentSync;
30
32
  /**
31
33
  * Normalize path, if p is absolute path, return p, otherwise join p with baseDir
32
34
  *
@@ -47,7 +49,6 @@ function normalizePath(baseDir, p) {
47
49
  return (0, path_1.resolve)(baseDir, p);
48
50
  }
49
51
  }
50
- exports.normalizePath = normalizePath;
51
52
  function getModuleRequirePathList(moduleName) {
52
53
  const moduleNameList = [moduleName, moduleName.replace(/\//g, '_')];
53
54
  let moduleNameMap = {};
@@ -74,7 +75,6 @@ function getModuleRequirePathList(moduleName) {
74
75
  moduleNameMap = undefined;
75
76
  return modulePathList;
76
77
  }
77
- exports.getModuleRequirePathList = getModuleRequirePathList;
78
78
  exports.PathFileUtils = {
79
79
  isPath,
80
80
  isPathEqual,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retryWith = exports.retryWithAsync = void 0;
3
+ exports.retryWithAsync = retryWithAsync;
4
+ exports.retryWith = retryWith;
4
5
  const _1 = require(".");
5
6
  const error_1 = require("../error");
6
7
  /**
@@ -32,7 +33,6 @@ function retryWithAsync(retryFn, retryTimes = 1, options = {}) {
32
33
  }
33
34
  });
34
35
  }
35
- exports.retryWithAsync = retryWithAsync;
36
36
  /**
37
37
  * wrap sync function with retry
38
38
  * @param retryFn
@@ -59,5 +59,4 @@ function retryWith(retryFn, retryTimes = 1, options = {}) {
59
59
  }
60
60
  });
61
61
  }
62
- exports.retryWith = retryWith;
63
62
  //# sourceMappingURL=retry.js.map
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Create a Promise that resolves after the specified time
4
3
  * @param options
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPromiseTimeoutInvokeChain = void 0;
3
+ exports.createPromiseTimeoutInvokeChain = createPromiseTimeoutInvokeChain;
4
4
  const error_1 = require("../error");
5
5
  /**
6
6
  * Create a Promise that resolves after the specified time
@@ -140,5 +140,4 @@ async function createPromiseTimeoutInvokeChain(options) {
140
140
  }
141
141
  }
142
142
  }
143
- exports.createPromiseTimeoutInvokeChain = createPromiseTimeoutInvokeChain;
144
143
  //# sourceMappingURL=timeout.js.map
@@ -1,16 +1,16 @@
1
- export declare function isString(value: any): boolean;
1
+ export declare function isString(value: any): value is string;
2
2
  export declare function isClass(fn: any): boolean;
3
3
  export declare function isAsyncFunction(value: any): boolean;
4
- export declare function isGeneratorFunction(value: any): boolean;
5
- export declare function isPromise(value: any): boolean;
4
+ export declare function isGeneratorFunction(value: any): value is GeneratorFunction;
5
+ export declare function isPromise(value: any): value is Promise<unknown>;
6
6
  export declare function isFunction(value: any): boolean;
7
7
  export declare function isObject(value: any): boolean;
8
8
  export declare function isPlainObject(obj: any): any;
9
- export declare function isNumber(value: any): boolean;
9
+ export declare function isNumber(value: any): value is number;
10
10
  export declare function isProxy(value: any): boolean;
11
- export declare function isMap(value: any): boolean;
12
- export declare function isSet(value: any): boolean;
13
- export declare function isRegExp(value: any): boolean;
11
+ export declare function isMap(value: any): value is Map<unknown, unknown>;
12
+ export declare function isSet(value: any): value is Set<unknown>;
13
+ export declare function isRegExp(value: any): value is RegExp;
14
14
  export declare function isUndefined(value: any): boolean;
15
15
  export declare function isNull(value: any): boolean;
16
16
  export declare function isNullOrUndefined(value: any): boolean;
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Types = exports.isNullOrUndefined = exports.isNull = exports.isUndefined = exports.isRegExp = exports.isSet = exports.isMap = exports.isProxy = exports.isNumber = exports.isPlainObject = exports.isObject = exports.isFunction = exports.isPromise = exports.isGeneratorFunction = exports.isAsyncFunction = exports.isClass = exports.isString = void 0;
3
+ exports.Types = void 0;
4
+ exports.isString = isString;
5
+ exports.isClass = isClass;
6
+ exports.isAsyncFunction = isAsyncFunction;
7
+ exports.isGeneratorFunction = isGeneratorFunction;
8
+ exports.isPromise = isPromise;
9
+ exports.isFunction = isFunction;
10
+ exports.isObject = isObject;
11
+ exports.isPlainObject = isPlainObject;
12
+ exports.isNumber = isNumber;
13
+ exports.isProxy = isProxy;
14
+ exports.isMap = isMap;
15
+ exports.isSet = isSet;
16
+ exports.isRegExp = isRegExp;
17
+ exports.isUndefined = isUndefined;
18
+ exports.isNull = isNull;
19
+ exports.isNullOrUndefined = isNullOrUndefined;
4
20
  const util = require("util");
5
21
  const ToString = Function.prototype.toString;
6
22
  const hasOwn = Object.prototype.hasOwnProperty;
@@ -8,7 +24,6 @@ const toStr = Object.prototype.toString;
8
24
  function isString(value) {
9
25
  return typeof value === 'string';
10
26
  }
11
- exports.isString = isString;
12
27
  function isClass(fn) {
13
28
  if (typeof fn !== 'function') {
14
29
  return false;
@@ -17,27 +32,21 @@ function isClass(fn) {
17
32
  return true;
18
33
  }
19
34
  }
20
- exports.isClass = isClass;
21
35
  function isAsyncFunction(value) {
22
36
  return util.types.isAsyncFunction(value);
23
37
  }
24
- exports.isAsyncFunction = isAsyncFunction;
25
38
  function isGeneratorFunction(value) {
26
39
  return util.types.isGeneratorFunction(value);
27
40
  }
28
- exports.isGeneratorFunction = isGeneratorFunction;
29
41
  function isPromise(value) {
30
42
  return util.types.isPromise(value);
31
43
  }
32
- exports.isPromise = isPromise;
33
44
  function isFunction(value) {
34
45
  return typeof value === 'function';
35
46
  }
36
- exports.isFunction = isFunction;
37
47
  function isObject(value) {
38
48
  return value !== null && typeof value === 'object';
39
49
  }
40
- exports.isObject = isObject;
41
50
  function isPlainObject(obj) {
42
51
  if (!obj || toStr.call(obj) !== '[object Object]') {
43
52
  return false;
@@ -58,39 +67,30 @@ function isPlainObject(obj) {
58
67
  }
59
68
  return typeof key === 'undefined' || hasOwn.call(obj, key);
60
69
  }
61
- exports.isPlainObject = isPlainObject;
62
70
  function isNumber(value) {
63
71
  return typeof value === 'number';
64
72
  }
65
- exports.isNumber = isNumber;
66
73
  function isProxy(value) {
67
74
  return util.types.isProxy(value);
68
75
  }
69
- exports.isProxy = isProxy;
70
76
  function isMap(value) {
71
77
  return util.types.isMap(value);
72
78
  }
73
- exports.isMap = isMap;
74
79
  function isSet(value) {
75
80
  return util.types.isSet(value);
76
81
  }
77
- exports.isSet = isSet;
78
82
  function isRegExp(value) {
79
83
  return util.types.isRegExp(value);
80
84
  }
81
- exports.isRegExp = isRegExp;
82
85
  function isUndefined(value) {
83
86
  return value === undefined;
84
87
  }
85
- exports.isUndefined = isUndefined;
86
88
  function isNull(value) {
87
89
  return value === null;
88
90
  }
89
- exports.isNull = isNull;
90
91
  function isNullOrUndefined(value) {
91
92
  return isUndefined(value) || isNull(value);
92
93
  }
93
- exports.isNullOrUndefined = isNullOrUndefined;
94
94
  exports.Types = {
95
95
  isClass,
96
96
  isAsyncFunction,
package/dist/util/uuid.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomUUID = void 0;
3
+ exports.randomUUID = randomUUID;
4
4
  const crypto = require("crypto");
5
5
  /**
6
6
  * code fork from https://github.com/uuidjs/uuid/blob/main/src/stringify.js
@@ -60,5 +60,4 @@ function randomUUID(force) {
60
60
  rnds[8] = (rnds[8] & 0x3f) | 0x80;
61
61
  return unsafeStringify(rnds);
62
62
  }
63
- exports.randomUUID = randomUUID;
64
63
  //# sourceMappingURL=uuid.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/core",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.8",
4
4
  "description": "midway core",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -61,5 +61,5 @@
61
61
  "types": "./dist/functional/index.d.ts"
62
62
  }
63
63
  },
64
- "gitHead": "6a221788112b4d998b3958e0a275579f42816c59"
64
+ "gitHead": "355e55949fdd132b0bdcb4830222a0a027e92ded"
65
65
  }