@ibiz-template/model-helper 0.7.16 → 0.7.17-alpha.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/dist/index.esm.js +47 -9
- package/dist/index.system.min.js +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -0
- package/out/locale/en/index.d.ts +15 -0
- package/out/locale/en/index.d.ts.map +1 -0
- package/out/locale/en/index.js +14 -0
- package/out/locale/index.d.ts +3 -0
- package/out/locale/index.d.ts.map +1 -0
- package/out/locale/index.js +2 -0
- package/out/locale/zh-CN/index.d.ts +15 -0
- package/out/locale/zh-CN/index.d.ts.map +1 -0
- package/out/locale/zh-CN/index.js +14 -0
- package/out/model-helper.js +1 -1
- package/out/model-util.d.ts.map +1 -1
- package/out/model-util.js +3 -3
- package/out/utils/service-path-util/service-path-util.js +3 -3
- package/package.json +2 -2
package/out/index.d.ts
CHANGED
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,wBAAwB,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,OAAO;QAEf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,wBAAwB,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,OAAO;QAEf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
|
package/out/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const en: {
|
|
2
|
+
modelHelper: {
|
|
3
|
+
utils: {
|
|
4
|
+
noFoundEntity: string;
|
|
5
|
+
maximumTier: string;
|
|
6
|
+
circularRecursive: string;
|
|
7
|
+
calculatedEntities: string;
|
|
8
|
+
};
|
|
9
|
+
noInitialized: string;
|
|
10
|
+
noFoundEntity: string;
|
|
11
|
+
noFoundView: string;
|
|
12
|
+
noSupported: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locale/en/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;CAed,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
modelHelper: {
|
|
3
|
+
utils: {
|
|
4
|
+
noFoundEntity: 'Entity not found {id}',
|
|
5
|
+
maximumTier: 'Service path calculation exceeds maximum tier 10',
|
|
6
|
+
circularRecursive: 'A circular recursive reference appears in the computational resource relationship path, triggering the entity:',
|
|
7
|
+
calculatedEntities: 'Current list of calculated entities. ',
|
|
8
|
+
},
|
|
9
|
+
noInitialized: '[{appId}] is not initialized, please call initModelUtil method to initialize it first',
|
|
10
|
+
noFoundEntity: 'Application [{appId}] data entity not found [{tag}]',
|
|
11
|
+
noFoundView: 'Application [{appId}] view not found [{tag}]',
|
|
12
|
+
noSupported: '[{language}] language not supported',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const zhCn: {
|
|
2
|
+
modelHelper: {
|
|
3
|
+
utils: {
|
|
4
|
+
noFoundEntity: string;
|
|
5
|
+
maximumTier: string;
|
|
6
|
+
circularRecursive: string;
|
|
7
|
+
calculatedEntities: string;
|
|
8
|
+
};
|
|
9
|
+
noInitialized: string;
|
|
10
|
+
noFoundEntity: string;
|
|
11
|
+
noFoundView: string;
|
|
12
|
+
noSupported: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locale/zh-CN/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;;;;;;;;CAahB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const zhCn = {
|
|
2
|
+
modelHelper: {
|
|
3
|
+
utils: {
|
|
4
|
+
noFoundEntity: '未找到实体 {id}',
|
|
5
|
+
maximumTier: '服务路径计算超过最大层级 10',
|
|
6
|
+
circularRecursive: '计算资源关系路径出现循环递归引用,触发实体:',
|
|
7
|
+
calculatedEntities: '当前已计算过实体清单: ',
|
|
8
|
+
},
|
|
9
|
+
noInitialized: '[{appId}]未初始化,请先调用 initModelUtil 方法初始化',
|
|
10
|
+
noFoundEntity: '应用[{appId}]未找到数据实体[{tag}]',
|
|
11
|
+
noFoundView: '应用[{appId}]未找到视图[{tag}]',
|
|
12
|
+
noSupported: '[{language}]语言未支持',
|
|
13
|
+
},
|
|
14
|
+
};
|
package/out/model-helper.js
CHANGED
|
@@ -317,7 +317,7 @@ export class ModelHelper {
|
|
|
317
317
|
if (this.cache.has(appId)) {
|
|
318
318
|
return this.cache.get(appId);
|
|
319
319
|
}
|
|
320
|
-
throw new Error(
|
|
320
|
+
throw new Error(ibiz.i18n.t('modelHelper.noInitialized', { appId }));
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* 计算应用标识
|
package/out/model-util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-util.d.ts","sourceRoot":"","sources":["../src/model-util.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,eAAe,EAAE,MAAM,SAAS,CAAC;AAGlE;;;;;;;GAOG;AACH,qBAAa,SAAS;IAyClB,SAAS,CAAC,KAAK,EAAE,MAAM;IACvB,SAAS,CAAC,QAAQ,EAAE,MAAM;IAC1B,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC;IACjE,SAAS,CAAC,GAAG,EAAE,OAAO;IACtB,SAAS,CAAC,UAAU,EAAE,OAAO;IA5C/B;;;;;;;OAOG;IACH,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAEtD;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,EAAG,MAAM,CAAC;IAE5B;;;;;;OAMG;IACH,eAAe,EAAG,eAAe,CAAC;IAElC;;;;;;;;;OASG;gBAES,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,EACvD,GAAG,EAAE,OAAO,EACZ,UAAU,GAAE,OAAc;IAGtC;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqD3B;;;;;;;OAOG;cACa,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAWhD;;;;;;OAMG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAepC;;;;;;OAMG;IACG,WAAW,IAAI,OA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W,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAqB3C;;;;;;;;;OASG;IACG,qBAAqB,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,OAAc,EACpB,UAAU,GAAE,OAAe,GAC1B,OAAO,CAAC,MAAM,CAAC;IA8BlB;;;;;;;;;OASG;IACG,eAAe,CACnB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,CAAC;IAiBlB;;;;;;;OAOG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAarD;;;;;;;OAOG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUjD;;;;;;;;;OASG;IACG,QAAQ,CACZ,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,CAAC;IAmBlB;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAmB5C;;;;;;;;;OASG;IACH,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,OAAe,GAAG,MAAM;IAS5E;;;;;;;;;OASG;IACH,SAAS,CAAC,cAAc,CACtB,SAAS,EAAE,MAAM,EACjB,SAAS,GAAE,OAAe,GACzB,MAAM;CAQV"}
|
package/out/model-util.js
CHANGED
|
@@ -190,7 +190,7 @@ export class ModelUtil {
|
|
|
190
190
|
return this.getModel(dataEntity.path);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
throw new Error(
|
|
193
|
+
throw new Error(ibiz.i18n.t('modelHelper.noFoundEntity', { appId: this.appId, tag }));
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
196
|
* 根据应用视图 id 获取应用视图模型,如果给了 params 则每次都会重新加载模型
|
|
@@ -212,7 +212,7 @@ export class ModelUtil {
|
|
|
212
212
|
return this.getModel(view.path, params, isDynamic);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
throw new Error(
|
|
215
|
+
throw new Error(ibiz.i18n.t('modelHelper.noFoundView', { appId: this.appId, tag }));
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* 加载应用多语言模型
|
|
@@ -230,7 +230,7 @@ export class ModelUtil {
|
|
|
230
230
|
if (lang) {
|
|
231
231
|
return this.getModel(lang.path);
|
|
232
232
|
}
|
|
233
|
-
ibiz.log.error(
|
|
233
|
+
ibiz.log.error(ibiz.i18n.t('modelHelper.noSupported', { language }));
|
|
234
234
|
}
|
|
235
235
|
return {};
|
|
236
236
|
}
|
|
@@ -90,7 +90,7 @@ export class ServicePathUtil {
|
|
|
90
90
|
async calcPaths(id) {
|
|
91
91
|
const entityRef = this.appDataEntities.find(item => item.id === id);
|
|
92
92
|
if (!entityRef) {
|
|
93
|
-
throw new Error(
|
|
93
|
+
throw new Error(ibiz.i18n.t('modelHelper.utils.noFoundEntity', { id }));
|
|
94
94
|
}
|
|
95
95
|
const { codeName } = entityRef;
|
|
96
96
|
if (!this.entityRsLoadMap.has(codeName)) {
|
|
@@ -131,13 +131,13 @@ export class ServicePathUtil {
|
|
|
131
131
|
*/
|
|
132
132
|
calcDeepPath(ids, deRss, num = 0) {
|
|
133
133
|
if (num > 10) {
|
|
134
|
-
throw new Error('
|
|
134
|
+
throw new Error(ibiz.i18n.t('modelHelper.utils.maximumTier'));
|
|
135
135
|
}
|
|
136
136
|
num += 1;
|
|
137
137
|
const arr = [];
|
|
138
138
|
deRss.forEach(rs => {
|
|
139
139
|
if (ids.includes(rs.majorAppDataEntityId)) {
|
|
140
|
-
ibiz.log.warn('
|
|
140
|
+
ibiz.log.warn(ibiz.i18n.t('modelHelper.utils.circularRecursive'), rs.majorAppDataEntityId, ibiz.i18n.t('modelHelper.utils.calculatedEntities'), ids);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
const items = this.filterDERSs(rs.majorAppDataEntityId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/model-helper",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17-alpha.0",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"ramda": "^0.29.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@ibiz-template/runtime": "^0.7.
|
|
41
|
+
"@ibiz-template/runtime": "^0.7.17-alpha.0",
|
|
42
42
|
"@types/pluralize": "^0.0.33",
|
|
43
43
|
"@types/ramda": "^0.29.10"
|
|
44
44
|
},
|