@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/dist/index.esm.js CHANGED
@@ -372,6 +372,10 @@ function useCurrentMode() {
372
372
  }, []);
373
373
  return currentMode;
374
374
  }
375
+ function getCssPropertyValue(name) {
376
+ var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.documentElement;
377
+ return window.getComputedStyle(el).getPropertyValue(name);
378
+ }
375
379
 
376
380
  function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
377
381
  try {
@@ -495,6 +499,24 @@ var InstanceApi_postSearch = /*#__PURE__*/function () {
495
499
  return _ref.apply(this, arguments);
496
500
  };
497
501
  }();
502
+ /**
503
+ * @description 搜索实例V3 (支持多属性排序)
504
+ * @endpoint POST /v3/object/:objectId/instance/_search
505
+ */
506
+
507
+
508
+ var InstanceApi_postSearchV3 = /*#__PURE__*/function () {
509
+ var _ref = _asyncToGenerator$3(function* (objectId, data, options) {
510
+ return (
511
+ /**! @contract easyops.api.cmdb.instance.PostSearchV3 */
512
+ (yield http.post("api/gateway/cmdb.instance.PostSearchV3/v3/object/".concat(objectId, "/instance/_search"), data, options)).data
513
+ );
514
+ });
515
+
516
+ return function InstanceApi_postSearchV3(_x, _x2, _x3) {
517
+ return _ref.apply(this, arguments);
518
+ };
519
+ }();
498
520
 
499
521
  function supply(attemptToVisitGlobals, providedGlobalVariables) {
500
522
  var globalVariables = _objectSpread({}, providedGlobalVariables); // Allow limited browser builtin values.
@@ -3175,7 +3197,7 @@ var unauthenticatedConfirmModal;
3175
3197
 
3176
3198
  function handleHttpError(error) {
3177
3199
  // Redirect to login page if not logged in.
3178
- if (isUnauthenticatedError(error)) {
3200
+ if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {
3179
3201
  // Do not show multiple confirm modals.
3180
3202
  if (unauthenticatedConfirmModal) {
3181
3203
  return;
@@ -5001,6 +5023,39 @@ var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5001
5023
  };
5002
5024
  }();
5003
5025
 
5026
+ var mocks = {
5027
+ mockId: null,
5028
+ mockList: []
5029
+ };
5030
+ function registerMock(useMocks) {
5031
+ var _useMocks$mockList;
5032
+
5033
+ if (useMocks) mocks = _objectSpread(_objectSpread({}, useMocks), {}, {
5034
+ mockList: (_useMocks$mockList = useMocks.mockList) === null || _useMocks$mockList === void 0 ? void 0 : _useMocks$mockList.map(item => _objectSpread(_objectSpread({}, item), {}, {
5035
+ uri: item.uri.replace(/(easyops\.api\.)(.+?)\/(.+)/, (_match, p1, p2, p3) => {
5036
+ return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?/").concat(p3, "$");
5037
+ }).replace(/:\w+/g, "([^/]+)")
5038
+ }))
5039
+ });
5040
+ }
5041
+ function getMockList() {
5042
+ return mocks.mockList;
5043
+ }
5044
+ var getMockInfo = requestUrl => {
5045
+ var item = mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl));
5046
+
5047
+ if (item) {
5048
+ return {
5049
+ url: requestUrl.replace(/(api\/gateway\/.+?)(@\d+\.\d+\.\d+)?\/(.+)/, (_match, p1, _p2, p3) => {
5050
+ return "".concat(p1, "/").concat(p3);
5051
+ }).replace(/(api\/gateway)/, "api/gateway/mock_server.proxy.".concat(mocks.mockId)),
5052
+ mockId: mocks.mockId
5053
+ };
5054
+ }
5055
+
5056
+ return;
5057
+ };
5058
+
5004
5059
  var flowApiDefinitionPromiseMap = new Map(); // Legacy Custom API: `${namespace}@${name}`
5005
5060
  // Flow API: `${namespace}@${name}:${version}`
5006
5061
 
@@ -5120,25 +5175,59 @@ function _fetchFlowApiDefinition2() {
5120
5175
  _fetchFlowApiDefinition2 = _asyncToGenerator$4(function* (provider) {
5121
5176
  var [namespaceName, nameWithVersion] = provider.split("@");
5122
5177
  var [name, version] = nameWithVersion.split(":");
5123
- var {
5124
- contractData
5125
- } = yield ContractApi_searchSingleContract({
5126
- contractName: "".concat(namespaceName, ".").concat(name),
5127
- version
5128
- }); // return undefined if don't found contract
5178
+ var isUseMock = getMockList().find(item => item.provider === "".concat(namespaceName, "@").concat(name));
5129
5179
 
5130
- if (contractData) {
5131
- var _contractData$namespa, _contractData$namespa2;
5180
+ if (isUseMock) {
5181
+ var _list$;
5132
5182
 
5133
- return {
5134
- name: contractData.name,
5135
- 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,
5136
- version: contractData.version,
5137
- contract: {
5138
- endpoint: contractData.endpoint,
5139
- response: contractData.response
5183
+ var {
5184
+ list
5185
+ } = yield InstanceApi_postSearchV3("FLOW_BUILDER_API_CONTRACT@EASYOPS", {
5186
+ fields: ["name", "namespaceId", "endpoint", "response", "version"],
5187
+ query: {
5188
+ namespaceId: {
5189
+ $eq: namespaceName
5190
+ },
5191
+ name: {
5192
+ $eq: name
5193
+ }
5140
5194
  }
5141
- };
5195
+ });
5196
+
5197
+ if ((_list$ = list[0]) !== null && _list$ !== void 0 && _list$.instanceId) {
5198
+ var _list$2;
5199
+
5200
+ return {
5201
+ name: list[0].name,
5202
+ namespace: (_list$2 = list[0]) === null || _list$2 === void 0 ? void 0 : _list$2.namespaceId,
5203
+ version: list[0].version,
5204
+ contract: {
5205
+ endpoint: list[0].endpoint,
5206
+ response: list[0].response
5207
+ }
5208
+ };
5209
+ }
5210
+ } else {
5211
+ var {
5212
+ contractData
5213
+ } = yield ContractApi_searchSingleContract({
5214
+ contractName: "".concat(namespaceName, ".").concat(name),
5215
+ version
5216
+ }); // return undefined if don't found contract
5217
+
5218
+ if (contractData) {
5219
+ var _contractData$namespa, _contractData$namespa2;
5220
+
5221
+ return {
5222
+ name: contractData.name,
5223
+ 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,
5224
+ version: contractData.version,
5225
+ contract: {
5226
+ endpoint: contractData.endpoint,
5227
+ response: contractData.response
5228
+ }
5229
+ };
5230
+ }
5142
5231
  }
5143
5232
  });
5144
5233
  return _fetchFlowApiDefinition2.apply(this, arguments);
@@ -10067,36 +10156,6 @@ function shouldBeDefaultCollapsed(defaultCollapsed, defaultCollapsedBreakpoint)
10067
10156
  return defaultCollapsed || defaultCollapsedBreakpoint && document.documentElement.clientWidth < defaultCollapsedBreakpoint;
10068
10157
  }
10069
10158
 
10070
- var mocks = {
10071
- mockId: null,
10072
- mockList: []
10073
- };
10074
- function registerMock(useMocks) {
10075
- var _useMocks$mockList;
10076
-
10077
- if (useMocks) mocks = _objectSpread(_objectSpread({}, useMocks), {}, {
10078
- mockList: (_useMocks$mockList = useMocks.mockList) === null || _useMocks$mockList === void 0 ? void 0 : _useMocks$mockList.map(item => _objectSpread(_objectSpread({}, item), {}, {
10079
- uri: item.uri.replace(/(easyops\.api\.)(.+?)\/(.+)/, (_match, p1, p2, p3) => {
10080
- return "(".concat(p1, ")?").concat(p2, "(@\\d+\\.\\d+\\.\\d+)?/").concat(p3, "$");
10081
- }).replace(/:\w+/g, "([^/]+)")
10082
- }))
10083
- });
10084
- }
10085
- var getMockInfo = requestUrl => {
10086
- var item = mocks.mockList.find(item => new RegExp(item.uri).test(requestUrl));
10087
-
10088
- if (item) {
10089
- return {
10090
- url: requestUrl.replace(/(api\/gateway\/.+?)(@\d+\.\d+\.\d+)?\/(.+)/, (_match, p1, _p2, p3) => {
10091
- return "".concat(p1, "/").concat(p3);
10092
- }).replace(/(api\/gateway)/, "api/gateway/mock_server.proxy.".concat(mocks.mockId)),
10093
- mockId: mocks.mockId
10094
- };
10095
- }
10096
-
10097
- return;
10098
- };
10099
-
10100
10159
  class Router {
10101
10160
  constructor(kernel) {
10102
10161
  _defineProperty$1(this, "defaultCollapsed", false);
@@ -10262,7 +10321,7 @@ class Router {
10262
10321
  var _this3 = this;
10263
10322
 
10264
10323
  return _asyncToGenerator$4(function* () {
10265
- var _apiAnalyzer$getInsta, _currentApp$theme;
10324
+ var _apiAnalyzer$getInsta;
10266
10325
 
10267
10326
  _this3.state = "initial";
10268
10327
  _this3.renderId = uniqueId("render-id-");
@@ -10313,7 +10372,7 @@ class Router {
10313
10372
  var legacy = currentApp ? currentApp.legacy : undefined;
10314
10373
  _this3.kernel.nextApp = currentApp;
10315
10374
  var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
10316
- setTheme((_currentApp$theme = currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) !== null && _currentApp$theme !== void 0 ? _currentApp$theme : "light");
10375
+ setTheme((currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
10317
10376
  setMode("default");
10318
10377
  devtoolsHookEmit("rendering");
10319
10378
  unmountTree(mountPoints.bg);
@@ -10358,7 +10417,7 @@ class Router {
10358
10417
  // eslint-disable-next-line no-console
10359
10418
  console.error(error); // Redirect to login page if not logged in.
10360
10419
 
10361
- if (isUnauthenticatedError(error)) {
10420
+ if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {
10362
10421
  mountRoutesResult.flags.unauthenticated = true;
10363
10422
  } else {
10364
10423
  yield _this3.kernel.layoutBootstrap(layoutType);
@@ -12575,5 +12634,5 @@ var ModalElement = _decorate(null, function (_initialize, _UpdatingElement) {
12575
12634
  };
12576
12635
  }, UpdatingElement);
12577
12636
 
12578
- export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getHistory, getMockInfo, getRuntime, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useRecentApps };
12637
+ export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getCssPropertyValue, getHistory, getMockInfo, getRuntime, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useRecentApps };
12579
12638
  //# sourceMappingURL=index.esm.js.map