@next-core/brick-kit 2.101.2 → 2.103.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 CHANGED
@@ -3,6 +3,56 @@
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.103.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.103.0...@next-core/brick-kit@2.103.1) (2022-01-13)
7
+
8
+ **Note:** Version bump only for package @next-core/brick-kit
9
+
10
+
11
+
12
+
13
+
14
+ # [2.103.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.102.1...@next-core/brick-kit@2.103.0) (2022-01-12)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * refine theme ([7d6480b](https://github.com/easyops-cn/next-core/commit/7d6480bffd738676a0c04865991c6cad796b7379))
20
+
21
+
22
+ ### Features
23
+
24
+ * add button style ([ebf1377](https://github.com/easyops-cn/next-core/commit/ebf1377805306600dbf96a6c05164f295d04f9af))
25
+ * chart style ([8d3f04b](https://github.com/easyops-cn/next-core/commit/8d3f04b342f79f62c65696ef82337b06d881aafd))
26
+
27
+
28
+
29
+
30
+
31
+ ## [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)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * do not redirect to login page while NO_AUTH_GUARD is enabled ([02b69b1](https://github.com/easyops-cn/next-core/commit/02b69b19b98b1ba4aa4e0d2405d28444f3c05def))
37
+
38
+
39
+
40
+
41
+
42
+ # [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)
43
+
44
+
45
+ ### Features
46
+
47
+ * **FlowApi:** update size-limit.js ([7b61a08](https://github.com/easyops-cn/next-core/commit/7b61a088ed6e0f2bd7ecd3bcb80fd2fa8b918bc7))
48
+ * **FlowApi:** update unit test ([059f6b6](https://github.com/easyops-cn/next-core/commit/059f6b612d5e90cb5facaa6285c8340f046ce4b0))
49
+ * **FlowApi:** update unit test ([a4bcc9d](https://github.com/easyops-cn/next-core/commit/a4bcc9d654039616a3889c142e5bd37c8ee987bc))
50
+ * **FlowApi:** useMock in flow api ([05a5751](https://github.com/easyops-cn/next-core/commit/05a5751e33aedfaae73c80a040081c2b4d2f2a73))
51
+
52
+
53
+
54
+
55
+
6
56
  ## [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)
7
57
 
8
58
 
@@ -389,6 +389,10 @@
389
389
  }, []);
390
390
  return currentMode;
391
391
  }
392
+ function getCssPropertyValue(name) {
393
+ var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.documentElement;
394
+ return window.getComputedStyle(el).getPropertyValue(name);
395
+ }
392
396
 
393
397
  function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
394
398
  try {
@@ -512,6 +516,24 @@
512
516
  return _ref.apply(this, arguments);
513
517
  };
514
518
  }();
519
+ /**
520
+ * @description 搜索实例V3 (支持多属性排序)
521
+ * @endpoint POST /v3/object/:objectId/instance/_search
522
+ */
523
+
524
+
525
+ var InstanceApi_postSearchV3 = /*#__PURE__*/function () {
526
+ var _ref = _asyncToGenerator$3(function* (objectId, data, options) {
527
+ return (
528
+ /**! @contract easyops.api.cmdb.instance.PostSearchV3 */
529
+ (yield brickHttp.http.post("api/gateway/cmdb.instance.PostSearchV3/v3/object/".concat(objectId, "/instance/_search"), data, options)).data
530
+ );
531
+ });
532
+
533
+ return function InstanceApi_postSearchV3(_x, _x2, _x3) {
534
+ return _ref.apply(this, arguments);
535
+ };
536
+ }();
515
537
 
516
538
  function supply(attemptToVisitGlobals, providedGlobalVariables) {
517
539
  var globalVariables = _objectSpread__default["default"]({}, providedGlobalVariables); // Allow limited browser builtin values.
@@ -3192,7 +3214,7 @@
3192
3214
 
3193
3215
  function handleHttpError(error) {
3194
3216
  // Redirect to login page if not logged in.
3195
- if (isUnauthenticatedError(error)) {
3217
+ if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {
3196
3218
  // Do not show multiple confirm modals.
3197
3219
  if (unauthenticatedConfirmModal) {
3198
3220
  return;
@@ -5018,6 +5040,39 @@
5018
5040
  };
5019
5041
  }();
5020
5042
 
5043
+ var mocks = {
5044
+ mockId: null,
5045
+ mockList: []
5046
+ };
5047
+ function registerMock(useMocks) {
5048
+ var _useMocks$mockList;
5049
+
5050
+ if (useMocks) mocks = _objectSpread__default["default"](_objectSpread__default["default"]({}, useMocks), {}, {
5051
+ mockList: (_useMocks$mockList = useMocks.mockList) === null || _useMocks$mockList === void 0 ? void 0 : _useMocks$mockList.map(item => _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
5052
+ uri: item.uri.replace(/(easyops\.api\.)(.+?)\/(.+)/, (_match, p1, p2, p3) => {
5053
+ return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?/").concat(p3, "$");
5054
+ }).replace(/:\w+/g, "([^/]+)")
5055
+ }))
5056
+ });
5057
+ }
5058
+ function getMockList() {
5059
+ return mocks.mockList;
5060
+ }
5061
+ var getMockInfo = requestUrl => {
5062
+ var item = mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl));
5063
+
5064
+ if (item) {
5065
+ return {
5066
+ url: requestUrl.replace(/(api\/gateway\/.+?)(@\d+\.\d+\.\d+)?\/(.+)/, (_match, p1, _p2, p3) => {
5067
+ return "".concat(p1, "/").concat(p3);
5068
+ }).replace(/(api\/gateway)/, "api/gateway/mock_server.proxy.".concat(mocks.mockId)),
5069
+ mockId: mocks.mockId
5070
+ };
5071
+ }
5072
+
5073
+ return;
5074
+ };
5075
+
5021
5076
  var flowApiDefinitionPromiseMap = new Map(); // Legacy Custom API: `${namespace}@${name}`
5022
5077
  // Flow API: `${namespace}@${name}:${version}`
5023
5078
 
@@ -5137,25 +5192,59 @@
5137
5192
  _fetchFlowApiDefinition2 = _asyncToGenerator__default["default"](function* (provider) {
5138
5193
  var [namespaceName, nameWithVersion] = provider.split("@");
5139
5194
  var [name, version] = nameWithVersion.split(":");
5140
- var {
5141
- contractData
5142
- } = yield ContractApi_searchSingleContract({
5143
- contractName: "".concat(namespaceName, ".").concat(name),
5144
- version
5145
- }); // return undefined if don't found contract
5195
+ var isUseMock = getMockList().find(item => item.provider === "".concat(namespaceName, "@").concat(name));
5146
5196
 
5147
- if (contractData) {
5148
- var _contractData$namespa, _contractData$namespa2;
5197
+ if (isUseMock) {
5198
+ var _list$;
5149
5199
 
5150
- return {
5151
- name: contractData.name,
5152
- 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,
5153
- version: contractData.version,
5154
- contract: {
5155
- endpoint: contractData.endpoint,
5156
- response: contractData.response
5200
+ var {
5201
+ list
5202
+ } = yield InstanceApi_postSearchV3("FLOW_BUILDER_API_CONTRACT@EASYOPS", {
5203
+ fields: ["name", "namespaceId", "endpoint", "response", "version"],
5204
+ query: {
5205
+ namespaceId: {
5206
+ $eq: namespaceName
5207
+ },
5208
+ name: {
5209
+ $eq: name
5210
+ }
5157
5211
  }
5158
- };
5212
+ });
5213
+
5214
+ if ((_list$ = list[0]) !== null && _list$ !== void 0 && _list$.instanceId) {
5215
+ var _list$2;
5216
+
5217
+ return {
5218
+ name: list[0].name,
5219
+ namespace: (_list$2 = list[0]) === null || _list$2 === void 0 ? void 0 : _list$2.namespaceId,
5220
+ version: list[0].version,
5221
+ contract: {
5222
+ endpoint: list[0].endpoint,
5223
+ response: list[0].response
5224
+ }
5225
+ };
5226
+ }
5227
+ } else {
5228
+ var {
5229
+ contractData
5230
+ } = yield ContractApi_searchSingleContract({
5231
+ contractName: "".concat(namespaceName, ".").concat(name),
5232
+ version
5233
+ }); // return undefined if don't found contract
5234
+
5235
+ if (contractData) {
5236
+ var _contractData$namespa, _contractData$namespa2;
5237
+
5238
+ return {
5239
+ name: contractData.name,
5240
+ 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,
5241
+ version: contractData.version,
5242
+ contract: {
5243
+ endpoint: contractData.endpoint,
5244
+ response: contractData.response
5245
+ }
5246
+ };
5247
+ }
5159
5248
  }
5160
5249
  });
5161
5250
  return _fetchFlowApiDefinition2.apply(this, arguments);
@@ -10084,36 +10173,6 @@
10084
10173
  return defaultCollapsed || defaultCollapsedBreakpoint && document.documentElement.clientWidth < defaultCollapsedBreakpoint;
10085
10174
  }
10086
10175
 
10087
- var mocks = {
10088
- mockId: null,
10089
- mockList: []
10090
- };
10091
- function registerMock(useMocks) {
10092
- var _useMocks$mockList;
10093
-
10094
- if (useMocks) mocks = _objectSpread__default["default"](_objectSpread__default["default"]({}, useMocks), {}, {
10095
- mockList: (_useMocks$mockList = useMocks.mockList) === null || _useMocks$mockList === void 0 ? void 0 : _useMocks$mockList.map(item => _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
10096
- uri: item.uri.replace(/(easyops\.api\.)(.+?)\/(.+)/, (_match, p1, p2, p3) => {
10097
- return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?/").concat(p3, "$");
10098
- }).replace(/:\w+/g, "([^/]+)")
10099
- }))
10100
- });
10101
- }
10102
- var getMockInfo = requestUrl => {
10103
- var item = mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl));
10104
-
10105
- if (item) {
10106
- return {
10107
- url: requestUrl.replace(/(api\/gateway\/.+?)(@\d+\.\d+\.\d+)?\/(.+)/, (_match, p1, _p2, p3) => {
10108
- return "".concat(p1, "/").concat(p3);
10109
- }).replace(/(api\/gateway)/, "api/gateway/mock_server.proxy.".concat(mocks.mockId)),
10110
- mockId: mocks.mockId
10111
- };
10112
- }
10113
-
10114
- return;
10115
- };
10116
-
10117
10176
  class Router {
10118
10177
  constructor(kernel) {
10119
10178
  _defineProperty__default["default"](this, "defaultCollapsed", false);
@@ -10279,7 +10338,7 @@
10279
10338
  var _this3 = this;
10280
10339
 
10281
10340
  return _asyncToGenerator__default["default"](function* () {
10282
- var _apiAnalyzer$getInsta, _currentApp$theme;
10341
+ var _apiAnalyzer$getInsta;
10283
10342
 
10284
10343
  _this3.state = "initial";
10285
10344
  _this3.renderId = lodash.uniqueId("render-id-");
@@ -10330,7 +10389,7 @@
10330
10389
  var legacy = currentApp ? currentApp.legacy : undefined;
10331
10390
  _this3.kernel.nextApp = currentApp;
10332
10391
  var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
10333
- setTheme((_currentApp$theme = currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) !== null && _currentApp$theme !== void 0 ? _currentApp$theme : "light");
10392
+ setTheme((currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
10334
10393
  setMode("default");
10335
10394
  devtoolsHookEmit("rendering");
10336
10395
  unmountTree(mountPoints.bg);
@@ -10375,7 +10434,7 @@
10375
10434
  // eslint-disable-next-line no-console
10376
10435
  console.error(error); // Redirect to login page if not logged in.
10377
10436
 
10378
- if (isUnauthenticatedError(error)) {
10437
+ if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {
10379
10438
  mountRoutesResult.flags.unauthenticated = true;
10380
10439
  } else {
10381
10440
  yield _this3.kernel.layoutBootstrap(layoutType);
@@ -12612,6 +12671,7 @@
12612
12671
  exports.doTransform = doTransform;
12613
12672
  exports.event = event;
12614
12673
  exports.getAuth = getAuth;
12674
+ exports.getCssPropertyValue = getCssPropertyValue;
12615
12675
  exports.getHistory = getHistory;
12616
12676
  exports.getMockInfo = getMockInfo;
12617
12677
  exports.getRuntime = getRuntime;