@next-core/brick-kit 2.101.0 → 2.102.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.
- package/CHANGELOG.md +47 -0
- package/dist/index.bundle.js +115 -78
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +115 -78
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/FlowApi.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/internal/evaluate.d.ts.map +1 -1
- package/dist/types/internal/getGeneralGlobals.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,53 @@
|
|
|
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.102.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.102.0...@next-core/brick-kit@2.102.1) (2022-01-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* do not redirect to login page while NO_AUTH_GUARD is enabled ([02b69b1](https://github.com/easyops-cn/next-core/commit/02b69b19b98b1ba4aa4e0d2405d28444f3c05def))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.102.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.101.2...@next-core/brick-kit@2.102.0) (2022-01-07)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **FlowApi:** update size-limit.js ([7b61a08](https://github.com/easyops-cn/next-core/commit/7b61a088ed6e0f2bd7ecd3bcb80fd2fa8b918bc7))
|
|
23
|
+
* **FlowApi:** update unit test ([059f6b6](https://github.com/easyops-cn/next-core/commit/059f6b612d5e90cb5facaa6285c8340f046ce4b0))
|
|
24
|
+
* **FlowApi:** update unit test ([a4bcc9d](https://github.com/easyops-cn/next-core/commit/a4bcc9d654039616a3889c142e5bd37c8ee987bc))
|
|
25
|
+
* **FlowApi:** useMock in flow api ([05a5751](https://github.com/easyops-cn/next-core/commit/05a5751e33aedfaae73c80a040081c2b4d2f2a73))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [2.101.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.101.1...@next-core/brick-kit@2.101.2) (2022-01-06)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* dark theme refine ([db6d4e5](https://github.com/easyops-cn/next-core/commit/db6d4e58c98779329e9dad99ee0fcde22631e44b))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [2.101.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.101.0...@next-core/brick-kit@2.101.1) (2022-01-05)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* fix `_.isEmpty(QUERY)` ([3202979](https://github.com/easyops-cn/next-core/commit/3202979a524a512423b9ce1f698c265ce650755c))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
6
53
|
# [2.101.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.100.0...@next-core/brick-kit@2.101.0) (2022-01-05)
|
|
7
54
|
|
|
8
55
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -512,6 +512,24 @@
|
|
|
512
512
|
return _ref.apply(this, arguments);
|
|
513
513
|
};
|
|
514
514
|
}();
|
|
515
|
+
/**
|
|
516
|
+
* @description 搜索实例V3 (支持多属性排序)
|
|
517
|
+
* @endpoint POST /v3/object/:objectId/instance/_search
|
|
518
|
+
*/
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
var InstanceApi_postSearchV3 = /*#__PURE__*/function () {
|
|
522
|
+
var _ref = _asyncToGenerator$3(function* (objectId, data, options) {
|
|
523
|
+
return (
|
|
524
|
+
/**! @contract easyops.api.cmdb.instance.PostSearchV3 */
|
|
525
|
+
(yield brickHttp.http.post("api/gateway/cmdb.instance.PostSearchV3/v3/object/".concat(objectId, "/instance/_search"), data, options)).data
|
|
526
|
+
);
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
return function InstanceApi_postSearchV3(_x, _x2, _x3) {
|
|
530
|
+
return _ref.apply(this, arguments);
|
|
531
|
+
};
|
|
532
|
+
}();
|
|
515
533
|
|
|
516
534
|
function supply(attemptToVisitGlobals, providedGlobalVariables) {
|
|
517
535
|
var globalVariables = _objectSpread__default["default"]({}, providedGlobalVariables); // Allow limited browser builtin values.
|
|
@@ -1527,6 +1545,11 @@
|
|
|
1527
1545
|
return {
|
|
1528
1546
|
check: collectCoverage ? fakeCheckPermissions : checkPermissions
|
|
1529
1547
|
};
|
|
1548
|
+
|
|
1549
|
+
case "THEME":
|
|
1550
|
+
return {
|
|
1551
|
+
getTheme: collectCoverage ? () => "light" : getTheme
|
|
1552
|
+
};
|
|
1530
1553
|
}
|
|
1531
1554
|
}
|
|
1532
1555
|
|
|
@@ -1893,39 +1916,16 @@
|
|
|
1893
1916
|
});
|
|
1894
1917
|
|
|
1895
1918
|
case "QUERY":
|
|
1896
|
-
return
|
|
1897
|
-
get(target, key) {
|
|
1898
|
-
return query.has(key) ? query.get(key) : undefined;
|
|
1899
|
-
},
|
|
1900
|
-
|
|
1901
|
-
ownKeys() {
|
|
1902
|
-
return Array.from(query.keys());
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
});
|
|
1919
|
+
return Object.fromEntries(Array.from(query.keys()).map(key => [key, query.get(key)]));
|
|
1906
1920
|
|
|
1907
1921
|
case "QUERY_ARRAY":
|
|
1908
|
-
return
|
|
1909
|
-
get(target, key) {
|
|
1910
|
-
return query.has(key) ? query.getAll(key) : undefined;
|
|
1911
|
-
},
|
|
1912
|
-
|
|
1913
|
-
ownKeys() {
|
|
1914
|
-
return Array.from(query.keys());
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
});
|
|
1922
|
+
return Object.fromEntries(Array.from(query.keys()).map(key => [key, query.getAll(key)]));
|
|
1918
1923
|
|
|
1919
1924
|
case "SEGUE":
|
|
1920
1925
|
return {
|
|
1921
1926
|
getUrl: getUrlBySegueFactory(app, segues)
|
|
1922
1927
|
};
|
|
1923
1928
|
|
|
1924
|
-
case "THEME":
|
|
1925
|
-
return {
|
|
1926
|
-
getTheme
|
|
1927
|
-
};
|
|
1928
|
-
|
|
1929
1929
|
case "SESSION_STORAGE":
|
|
1930
1930
|
return {
|
|
1931
1931
|
getItem: getItemFactory("session")
|
|
@@ -3210,7 +3210,7 @@
|
|
|
3210
3210
|
|
|
3211
3211
|
function handleHttpError(error) {
|
|
3212
3212
|
// Redirect to login page if not logged in.
|
|
3213
|
-
if (isUnauthenticatedError(error)) {
|
|
3213
|
+
if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {
|
|
3214
3214
|
// Do not show multiple confirm modals.
|
|
3215
3215
|
if (unauthenticatedConfirmModal) {
|
|
3216
3216
|
return;
|
|
@@ -5036,6 +5036,39 @@
|
|
|
5036
5036
|
};
|
|
5037
5037
|
}();
|
|
5038
5038
|
|
|
5039
|
+
var mocks = {
|
|
5040
|
+
mockId: null,
|
|
5041
|
+
mockList: []
|
|
5042
|
+
};
|
|
5043
|
+
function registerMock(useMocks) {
|
|
5044
|
+
var _useMocks$mockList;
|
|
5045
|
+
|
|
5046
|
+
if (useMocks) mocks = _objectSpread__default["default"](_objectSpread__default["default"]({}, useMocks), {}, {
|
|
5047
|
+
mockList: (_useMocks$mockList = useMocks.mockList) === null || _useMocks$mockList === void 0 ? void 0 : _useMocks$mockList.map(item => _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
|
|
5048
|
+
uri: item.uri.replace(/(easyops\.api\.)(.+?)\/(.+)/, (_match, p1, p2, p3) => {
|
|
5049
|
+
return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?/").concat(p3, "$");
|
|
5050
|
+
}).replace(/:\w+/g, "([^/]+)")
|
|
5051
|
+
}))
|
|
5052
|
+
});
|
|
5053
|
+
}
|
|
5054
|
+
function getMockList() {
|
|
5055
|
+
return mocks.mockList;
|
|
5056
|
+
}
|
|
5057
|
+
var getMockInfo = requestUrl => {
|
|
5058
|
+
var item = mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl));
|
|
5059
|
+
|
|
5060
|
+
if (item) {
|
|
5061
|
+
return {
|
|
5062
|
+
url: requestUrl.replace(/(api\/gateway\/.+?)(@\d+\.\d+\.\d+)?\/(.+)/, (_match, p1, _p2, p3) => {
|
|
5063
|
+
return "".concat(p1, "/").concat(p3);
|
|
5064
|
+
}).replace(/(api\/gateway)/, "api/gateway/mock_server.proxy.".concat(mocks.mockId)),
|
|
5065
|
+
mockId: mocks.mockId
|
|
5066
|
+
};
|
|
5067
|
+
}
|
|
5068
|
+
|
|
5069
|
+
return;
|
|
5070
|
+
};
|
|
5071
|
+
|
|
5039
5072
|
var flowApiDefinitionPromiseMap = new Map(); // Legacy Custom API: `${namespace}@${name}`
|
|
5040
5073
|
// Flow API: `${namespace}@${name}:${version}`
|
|
5041
5074
|
|
|
@@ -5155,25 +5188,59 @@
|
|
|
5155
5188
|
_fetchFlowApiDefinition2 = _asyncToGenerator__default["default"](function* (provider) {
|
|
5156
5189
|
var [namespaceName, nameWithVersion] = provider.split("@");
|
|
5157
5190
|
var [name, version] = nameWithVersion.split(":");
|
|
5158
|
-
var
|
|
5159
|
-
contractData
|
|
5160
|
-
} = yield ContractApi_searchSingleContract({
|
|
5161
|
-
contractName: "".concat(namespaceName, ".").concat(name),
|
|
5162
|
-
version
|
|
5163
|
-
}); // return undefined if don't found contract
|
|
5191
|
+
var isUseMock = getMockList().find(item => item.provider === "".concat(namespaceName, "@").concat(name));
|
|
5164
5192
|
|
|
5165
|
-
if (
|
|
5166
|
-
var
|
|
5193
|
+
if (isUseMock) {
|
|
5194
|
+
var _list$;
|
|
5167
5195
|
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5196
|
+
var {
|
|
5197
|
+
list
|
|
5198
|
+
} = yield InstanceApi_postSearchV3("FLOW_BUILDER_API_CONTRACT@EASYOPS", {
|
|
5199
|
+
fields: ["name", "namespaceId", "endpoint", "response", "version"],
|
|
5200
|
+
query: {
|
|
5201
|
+
namespaceId: {
|
|
5202
|
+
$eq: namespaceName
|
|
5203
|
+
},
|
|
5204
|
+
name: {
|
|
5205
|
+
$eq: name
|
|
5206
|
+
}
|
|
5175
5207
|
}
|
|
5176
|
-
};
|
|
5208
|
+
});
|
|
5209
|
+
|
|
5210
|
+
if ((_list$ = list[0]) !== null && _list$ !== void 0 && _list$.instanceId) {
|
|
5211
|
+
var _list$2;
|
|
5212
|
+
|
|
5213
|
+
return {
|
|
5214
|
+
name: list[0].name,
|
|
5215
|
+
namespace: (_list$2 = list[0]) === null || _list$2 === void 0 ? void 0 : _list$2.namespaceId,
|
|
5216
|
+
version: list[0].version,
|
|
5217
|
+
contract: {
|
|
5218
|
+
endpoint: list[0].endpoint,
|
|
5219
|
+
response: list[0].response
|
|
5220
|
+
}
|
|
5221
|
+
};
|
|
5222
|
+
}
|
|
5223
|
+
} else {
|
|
5224
|
+
var {
|
|
5225
|
+
contractData
|
|
5226
|
+
} = yield ContractApi_searchSingleContract({
|
|
5227
|
+
contractName: "".concat(namespaceName, ".").concat(name),
|
|
5228
|
+
version
|
|
5229
|
+
}); // return undefined if don't found contract
|
|
5230
|
+
|
|
5231
|
+
if (contractData) {
|
|
5232
|
+
var _contractData$namespa, _contractData$namespa2;
|
|
5233
|
+
|
|
5234
|
+
return {
|
|
5235
|
+
name: contractData.name,
|
|
5236
|
+
namespace: (_contractData$namespa = contractData.namespace) === null || _contractData$namespa === void 0 ? void 0 : (_contractData$namespa2 = _contractData$namespa[0]) === null || _contractData$namespa2 === void 0 ? void 0 : _contractData$namespa2.name,
|
|
5237
|
+
version: contractData.version,
|
|
5238
|
+
contract: {
|
|
5239
|
+
endpoint: contractData.endpoint,
|
|
5240
|
+
response: contractData.response
|
|
5241
|
+
}
|
|
5242
|
+
};
|
|
5243
|
+
}
|
|
5177
5244
|
}
|
|
5178
5245
|
});
|
|
5179
5246
|
return _fetchFlowApiDefinition2.apply(this, arguments);
|
|
@@ -10102,36 +10169,6 @@
|
|
|
10102
10169
|
return defaultCollapsed || defaultCollapsedBreakpoint && document.documentElement.clientWidth < defaultCollapsedBreakpoint;
|
|
10103
10170
|
}
|
|
10104
10171
|
|
|
10105
|
-
var mocks = {
|
|
10106
|
-
mockId: null,
|
|
10107
|
-
mockList: []
|
|
10108
|
-
};
|
|
10109
|
-
function registerMock(useMocks) {
|
|
10110
|
-
var _useMocks$mockList;
|
|
10111
|
-
|
|
10112
|
-
if (useMocks) mocks = _objectSpread__default["default"](_objectSpread__default["default"]({}, useMocks), {}, {
|
|
10113
|
-
mockList: (_useMocks$mockList = useMocks.mockList) === null || _useMocks$mockList === void 0 ? void 0 : _useMocks$mockList.map(item => _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
|
|
10114
|
-
uri: item.uri.replace(/(easyops\.api\.)(.+?)\/(.+)/, (_match, p1, p2, p3) => {
|
|
10115
|
-
return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?/").concat(p3, "$");
|
|
10116
|
-
}).replace(/:\w+/g, "([^/]+)")
|
|
10117
|
-
}))
|
|
10118
|
-
});
|
|
10119
|
-
}
|
|
10120
|
-
var getMockInfo = requestUrl => {
|
|
10121
|
-
var item = mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl));
|
|
10122
|
-
|
|
10123
|
-
if (item) {
|
|
10124
|
-
return {
|
|
10125
|
-
url: requestUrl.replace(/(api\/gateway\/.+?)(@\d+\.\d+\.\d+)?\/(.+)/, (_match, p1, _p2, p3) => {
|
|
10126
|
-
return "".concat(p1, "/").concat(p3);
|
|
10127
|
-
}).replace(/(api\/gateway)/, "api/gateway/mock_server.proxy.".concat(mocks.mockId)),
|
|
10128
|
-
mockId: mocks.mockId
|
|
10129
|
-
};
|
|
10130
|
-
}
|
|
10131
|
-
|
|
10132
|
-
return;
|
|
10133
|
-
};
|
|
10134
|
-
|
|
10135
10172
|
class Router {
|
|
10136
10173
|
constructor(kernel) {
|
|
10137
10174
|
_defineProperty__default["default"](this, "defaultCollapsed", false);
|
|
@@ -10297,7 +10334,7 @@
|
|
|
10297
10334
|
var _this3 = this;
|
|
10298
10335
|
|
|
10299
10336
|
return _asyncToGenerator__default["default"](function* () {
|
|
10300
|
-
var _apiAnalyzer$getInsta;
|
|
10337
|
+
var _apiAnalyzer$getInsta, _currentApp$theme;
|
|
10301
10338
|
|
|
10302
10339
|
_this3.state = "initial";
|
|
10303
10340
|
_this3.renderId = lodash.uniqueId("render-id-");
|
|
@@ -10348,6 +10385,8 @@
|
|
|
10348
10385
|
var legacy = currentApp ? currentApp.legacy : undefined;
|
|
10349
10386
|
_this3.kernel.nextApp = currentApp;
|
|
10350
10387
|
var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
|
|
10388
|
+
setTheme((_currentApp$theme = currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) !== null && _currentApp$theme !== void 0 ? _currentApp$theme : "light");
|
|
10389
|
+
setMode("default");
|
|
10351
10390
|
devtoolsHookEmit("rendering");
|
|
10352
10391
|
unmountTree(mountPoints.bg);
|
|
10353
10392
|
|
|
@@ -10358,7 +10397,7 @@
|
|
|
10358
10397
|
};
|
|
10359
10398
|
|
|
10360
10399
|
if (storyboard) {
|
|
10361
|
-
var _currentApp$breadcrum, _currentApp$breadcrum2
|
|
10400
|
+
var _currentApp$breadcrum, _currentApp$breadcrum2;
|
|
10362
10401
|
|
|
10363
10402
|
if (appChanged && currentApp.id && isLoggedIn()) {
|
|
10364
10403
|
var usedCustomApis = brickUtils.mapCustomApisToNameAndNamespace(brickUtils.scanCustomApisInStoryboard(storyboard));
|
|
@@ -10391,7 +10430,7 @@
|
|
|
10391
10430
|
// eslint-disable-next-line no-console
|
|
10392
10431
|
console.error(error); // Redirect to login page if not logged in.
|
|
10393
10432
|
|
|
10394
|
-
if (isUnauthenticatedError(error)) {
|
|
10433
|
+
if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {
|
|
10395
10434
|
mountRoutesResult.flags.unauthenticated = true;
|
|
10396
10435
|
} else {
|
|
10397
10436
|
yield _this3.kernel.layoutBootstrap(layoutType);
|
|
@@ -10455,10 +10494,8 @@
|
|
|
10455
10494
|
_this3.kernel.unsetBars({
|
|
10456
10495
|
appChanged,
|
|
10457
10496
|
legacy: actualLegacy
|
|
10458
|
-
});
|
|
10497
|
+
}); // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.
|
|
10459
10498
|
|
|
10460
|
-
setTheme((_currentApp$theme = currentApp.theme) !== null && _currentApp$theme !== void 0 ? _currentApp$theme : "light");
|
|
10461
|
-
setMode("default"); // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.
|
|
10462
10499
|
|
|
10463
10500
|
_this3.locationContext.handleBeforePageLoad();
|
|
10464
10501
|
|