@next-core/brick-kit 2.99.2 → 2.100.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.100.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.99.2...@next-core/brick-kit@2.100.0) (2022-01-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * **MockRegistry:** remove version in mock url ([e291d52](https://github.com/easyops-cn/next-core/commit/e291d52626e5565a9ebd8cf6370cb6cf7dd33903))
12
+ * **MockRegistry:** update RegExp ([423be36](https://github.com/easyops-cn/next-core/commit/423be36023068c1ebf07215d15117af4299ec039))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [2.99.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.99.1...@next-core/brick-kit@2.99.2) (2022-01-04)
7
19
 
8
20
 
@@ -9203,15 +9203,25 @@
9203
9203
 
9204
9204
  if (useMocks) mocks = _objectSpread__default["default"](_objectSpread__default["default"]({}, useMocks), {}, {
9205
9205
  mockList: (_useMocks$mockList = useMocks.mockList) === null || _useMocks$mockList === void 0 ? void 0 : _useMocks$mockList.map(item => _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
9206
- uri: item.uri.replace(/(easyops\.api\.)(.+)(@\d+\.\d+\.\d+(?=\/))(.+)/, (_match, p1, p2, _p3, p4) => {
9207
- return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?").concat(p4, "$");
9208
- }).replace(/:\w+/g, "[\\w|-]+")
9206
+ uri: item.uri.replace(/(easyops\.api\.)(.+?)\/(.+)/, (_match, p1, p2, p3) => {
9207
+ return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?/").concat(p3, "$");
9208
+ }).replace(/:\w+/g, "([^/]+)")
9209
9209
  }))
9210
9210
  });
9211
9211
  }
9212
- var getMockId = requestUrl => {
9213
- if (mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl))) return mocks.mockId;
9214
- return undefined;
9212
+ var getMockInfo = requestUrl => {
9213
+ var item = mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl));
9214
+
9215
+ if (item) {
9216
+ return {
9217
+ url: requestUrl.replace(/(api\/gateway\/.+?)(@\d+\.\d+\.\d+)?\/(.+)/, (_match, p1, _p2, p3) => {
9218
+ return "".concat(p1, "/").concat(p3);
9219
+ }).replace(/(api\/gateway)/, "api/gateway/mock_server.proxy.".concat(mocks.mockId)),
9220
+ mockId: mocks.mockId
9221
+ };
9222
+ }
9223
+
9224
+ return;
9215
9225
  };
9216
9226
 
9217
9227
  class Router {
@@ -11713,7 +11723,7 @@
11713
11723
  exports.event = event;
11714
11724
  exports.getAuth = getAuth;
11715
11725
  exports.getHistory = getHistory;
11716
- exports.getMockId = getMockId;
11726
+ exports.getMockInfo = getMockInfo;
11717
11727
  exports.getRuntime = getRuntime;
11718
11728
  exports.handleHttpError = handleHttpError;
11719
11729
  exports.httpErrorToString = httpErrorToString;