@ibiz-template/model-helper 0.7.16 → 0.7.17

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
@@ -15930,7 +15930,7 @@ var ServicePathUtil = class {
15930
15930
  async calcPaths(id) {
15931
15931
  const entityRef = this.appDataEntities.find((item) => item.id === id);
15932
15932
  if (!entityRef) {
15933
- throw new Error("\u672A\u627E\u5230\u5B9E\u4F53 ".concat(id));
15933
+ throw new Error(ibiz.i18n.t("modelHelper.utils.noFoundEntity", { id }));
15934
15934
  }
15935
15935
  const { codeName } = entityRef;
15936
15936
  if (!this.entityRsLoadMap.has(codeName)) {
@@ -15968,16 +15968,16 @@ var ServicePathUtil = class {
15968
15968
  */
15969
15969
  calcDeepPath(ids, deRss, num = 0) {
15970
15970
  if (num > 10) {
15971
- throw new Error("\u670D\u52A1\u8DEF\u5F84\u8BA1\u7B97\u8D85\u8FC7\u6700\u5927\u5C42\u7EA7 10");
15971
+ throw new Error(ibiz.i18n.t("modelHelper.utils.maximumTier"));
15972
15972
  }
15973
15973
  num += 1;
15974
15974
  const arr = [];
15975
15975
  deRss.forEach((rs) => {
15976
15976
  if (ids.includes(rs.majorAppDataEntityId)) {
15977
15977
  ibiz.log.warn(
15978
- "\u8BA1\u7B97\u8D44\u6E90\u5173\u7CFB\u8DEF\u5F84\u51FA\u73B0\u5FAA\u73AF\u9012\u5F52\u5F15\u7528\uFF0C\u89E6\u53D1\u5B9E\u4F53\uFF1A",
15978
+ ibiz.i18n.t("modelHelper.utils.circularRecursive"),
15979
15979
  rs.majorAppDataEntityId,
15980
- "\u5F53\u524D\u5DF2\u8BA1\u7B97\u8FC7\u5B9E\u4F53\u6E05\u5355: ",
15980
+ ibiz.i18n.t("modelHelper.utils.calculatedEntities"),
15981
15981
  ids
15982
15982
  );
15983
15983
  return;
@@ -16370,7 +16370,9 @@ var ModelUtil = class {
16370
16370
  return this.getModel(dataEntity.path);
16371
16371
  }
16372
16372
  }
16373
- throw new Error("\u5E94\u7528[".concat(this.appId, "]\u672A\u627E\u5230\u6570\u636E\u5B9E\u4F53[").concat(tag, "]"));
16373
+ throw new Error(
16374
+ ibiz.i18n.t("modelHelper.noFoundEntity", { appId: this.appId, tag })
16375
+ );
16374
16376
  }
16375
16377
  /**
16376
16378
  * 根据应用视图 id 获取应用视图模型,如果给了 params 则每次都会重新加载模型
@@ -16394,7 +16396,9 @@ var ModelUtil = class {
16394
16396
  return this.getModel(view.path, params, isDynamic);
16395
16397
  }
16396
16398
  }
16397
- throw new Error("\u5E94\u7528[".concat(this.appId, "]\u672A\u627E\u5230\u89C6\u56FE[").concat(tag, "]"));
16399
+ throw new Error(
16400
+ ibiz.i18n.t("modelHelper.noFoundView", { appId: this.appId, tag })
16401
+ );
16398
16402
  }
16399
16403
  /**
16400
16404
  * 加载应用多语言模型
@@ -16412,7 +16416,7 @@ var ModelUtil = class {
16412
16416
  if (lang) {
16413
16417
  return this.getModel(lang.path);
16414
16418
  }
16415
- ibiz.log.error("[".concat(language, "]\u8BED\u8A00\u672A\u652F\u6301"));
16419
+ ibiz.log.error(ibiz.i18n.t("modelHelper.noSupported", { language }));
16416
16420
  }
16417
16421
  return {};
16418
16422
  }
@@ -16866,7 +16870,7 @@ var ModelHelper = class {
16866
16870
  if (this.cache.has(appId)) {
16867
16871
  return this.cache.get(appId);
16868
16872
  }
16869
- throw new Error("[".concat(appId, "]\u672A\u521D\u59CB\u5316\uFF0C\u8BF7\u5148\u8C03\u7528 initModelUtil \u65B9\u6CD5\u521D\u59CB\u5316"));
16873
+ throw new Error(ibiz.i18n.t("modelHelper.noInitialized", { appId }));
16870
16874
  }
16871
16875
  /**
16872
16876
  * 计算应用标识
@@ -16887,6 +16891,40 @@ var ModelHelper = class {
16887
16891
  return appId;
16888
16892
  }
16889
16893
  };
16894
+
16895
+ // src/locale/en/index.ts
16896
+ var en = {
16897
+ modelHelper: {
16898
+ utils: {
16899
+ noFoundEntity: "Entity not found {id}",
16900
+ maximumTier: "Service path calculation exceeds maximum tier 10",
16901
+ circularRecursive: "A circular recursive reference appears in the computational resource relationship path, triggering the entity:",
16902
+ calculatedEntities: "Current list of calculated entities. "
16903
+ },
16904
+ noInitialized: "[{appId}] is not initialized, please call initModelUtil method to initialize it first",
16905
+ noFoundEntity: "Application [{appId}] data entity not found [{tag}]",
16906
+ noFoundView: "Application [{appId}] view not found [{tag}]",
16907
+ noSupported: "[{language}] language not supported"
16908
+ }
16909
+ };
16910
+
16911
+ // src/locale/zh-CN/index.ts
16912
+ var zhCn = {
16913
+ modelHelper: {
16914
+ utils: {
16915
+ noFoundEntity: "\u672A\u627E\u5230\u5B9E\u4F53 {id}",
16916
+ maximumTier: "\u670D\u52A1\u8DEF\u5F84\u8BA1\u7B97\u8D85\u8FC7\u6700\u5927\u5C42\u7EA7 10",
16917
+ circularRecursive: "\u8BA1\u7B97\u8D44\u6E90\u5173\u7CFB\u8DEF\u5F84\u51FA\u73B0\u5FAA\u73AF\u9012\u5F52\u5F15\u7528\uFF0C\u89E6\u53D1\u5B9E\u4F53\uFF1A",
16918
+ calculatedEntities: "\u5F53\u524D\u5DF2\u8BA1\u7B97\u8FC7\u5B9E\u4F53\u6E05\u5355: "
16919
+ },
16920
+ noInitialized: "[{appId}]\u672A\u521D\u59CB\u5316\uFF0C\u8BF7\u5148\u8C03\u7528 initModelUtil \u65B9\u6CD5\u521D\u59CB\u5316",
16921
+ noFoundEntity: "\u5E94\u7528[{appId}]\u672A\u627E\u5230\u6570\u636E\u5B9E\u4F53[{tag}]",
16922
+ noFoundView: "\u5E94\u7528[{appId}]\u672A\u627E\u5230\u89C6\u56FE[{tag}]",
16923
+ noSupported: "[{language}]\u8BED\u8A00\u672A\u652F\u6301"
16924
+ }
16925
+ };
16890
16926
  export {
16891
- ModelHelper
16927
+ ModelHelper,
16928
+ en,
16929
+ zhCn
16892
16930
  };