oak-domain 3.0.1 → 3.0.2
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/lib/actions/action.d.ts +16 -16
- package/lib/actions/action.js +17 -17
- package/lib/actions/relation.d.ts +5 -5
- package/lib/actions/relation.js +38 -38
- package/lib/base-app-domain/ActionAuth/Schema.d.ts +160 -160
- package/lib/base-app-domain/ActionAuth/Schema.js +2 -2
- package/lib/base-app-domain/ActionAuth/Storage.d.ts +3 -3
- package/lib/base-app-domain/ActionAuth/Storage.js +42 -42
- package/lib/base-app-domain/ActionDefDict.d.ts +9 -9
- package/lib/base-app-domain/ActionDefDict.js +11 -11
- package/lib/base-app-domain/EntityDict.d.ts +24 -24
- package/lib/base-app-domain/EntityDict.js +2 -2
- package/lib/base-app-domain/I18n/Schema.d.ts +129 -129
- package/lib/base-app-domain/I18n/Schema.js +2 -2
- package/lib/base-app-domain/I18n/Storage.d.ts +3 -3
- package/lib/base-app-domain/I18n/Storage.js +59 -59
- package/lib/base-app-domain/Modi/Action.d.ts +10 -10
- package/lib/base-app-domain/Modi/Action.js +14 -14
- package/lib/base-app-domain/Modi/Schema.d.ts +136 -136
- package/lib/base-app-domain/Modi/Schema.js +2 -2
- package/lib/base-app-domain/Modi/Storage.d.ts +3 -3
- package/lib/base-app-domain/Modi/Storage.js +63 -63
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +311 -311
- package/lib/base-app-domain/ModiEntity/Schema.js +2 -2
- package/lib/base-app-domain/ModiEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/ModiEntity/Storage.js +30 -30
- package/lib/base-app-domain/Oper/Schema.d.ts +152 -152
- package/lib/base-app-domain/Oper/Schema.js +2 -2
- package/lib/base-app-domain/Oper/Storage.d.ts +3 -3
- package/lib/base-app-domain/Oper/Storage.js +38 -38
- package/lib/base-app-domain/OperEntity/Schema.d.ts +300 -300
- package/lib/base-app-domain/OperEntity/Schema.js +2 -2
- package/lib/base-app-domain/OperEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/OperEntity/Storage.js +30 -30
- package/lib/base-app-domain/Relation/Schema.d.ts +188 -188
- package/lib/base-app-domain/Relation/Schema.js +2 -2
- package/lib/base-app-domain/Relation/Storage.d.ts +3 -3
- package/lib/base-app-domain/Relation/Storage.js +54 -54
- package/lib/base-app-domain/Relation.d.ts +10 -10
- package/lib/base-app-domain/Relation.js +10 -10
- package/lib/base-app-domain/RelationAuth/Schema.d.ts +180 -180
- package/lib/base-app-domain/RelationAuth/Schema.js +2 -2
- package/lib/base-app-domain/RelationAuth/Storage.d.ts +3 -3
- package/lib/base-app-domain/RelationAuth/Storage.js +46 -46
- package/lib/base-app-domain/Storage.d.ts +3 -3
- package/lib/base-app-domain/Storage.js +27 -27
- package/lib/base-app-domain/User/Action.d.ts +10 -10
- package/lib/base-app-domain/User/Action.js +12 -12
- package/lib/base-app-domain/User/Schema.d.ts +197 -197
- package/lib/base-app-domain/User/Schema.js +2 -2
- package/lib/base-app-domain/User/Storage.d.ts +3 -3
- package/lib/base-app-domain/User/Storage.js +33 -33
- package/lib/base-app-domain/UserEntityGrant/Action.d.ts +5 -5
- package/lib/base-app-domain/UserEntityGrant/Action.js +5 -5
- package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +157 -157
- package/lib/base-app-domain/UserEntityGrant/Schema.js +2 -2
- package/lib/base-app-domain/UserEntityGrant/Storage.d.ts +3 -3
- package/lib/base-app-domain/UserEntityGrant/Storage.js +29 -29
- package/lib/base-app-domain/UserRelation/Schema.d.ts +194 -194
- package/lib/base-app-domain/UserRelation/Schema.js +2 -2
- package/lib/base-app-domain/UserRelation/Storage.d.ts +3 -3
- package/lib/base-app-domain/UserRelation/Storage.js +56 -56
- package/lib/base-app-domain/_SubQuery.d.ts +112 -112
- package/lib/base-app-domain/_SubQuery.js +2 -2
- package/lib/base-app-domain/index.d.ts +4 -4
- package/lib/base-app-domain/index.js +7 -7
- package/lib/checkers/index.d.ts +5 -5
- package/lib/checkers/index.js +14 -14
- package/lib/compiler/env.d.ts +14 -14
- package/lib/compiler/env.js +50 -50
- package/lib/compiler/localeBuilder.d.ts +22 -22
- package/lib/compiler/localeBuilder.js +169 -169
- package/lib/compiler/schemalBuilder.d.ts +11 -11
- package/lib/compiler/schemalBuilder.js +3787 -3787
- package/lib/compiler/uiBuilder.d.ts +1 -1
- package/lib/compiler/uiBuilder.js +3 -3
- package/lib/entities/ActionAuth.d.ts +12 -12
- package/lib/entities/ActionAuth.js +29 -29
- package/lib/entities/I18n.d.ts +9 -9
- package/lib/entities/I18n.js +37 -37
- package/lib/entities/Modi.d.ts +11 -11
- package/lib/entities/Modi.js +49 -49
- package/lib/entities/ModiEntity.d.ts +8 -8
- package/lib/entities/ModiEntity.js +18 -18
- package/lib/entities/Oper.d.ts +11 -11
- package/lib/entities/Oper.js +21 -21
- package/lib/entities/OperEntity.d.ts +8 -8
- package/lib/entities/OperEntity.js +18 -18
- package/lib/entities/Relation.d.ts +8 -8
- package/lib/entities/Relation.js +35 -35
- package/lib/entities/RelationAuth.d.ts +8 -8
- package/lib/entities/RelationAuth.js +34 -34
- package/lib/entities/User.d.ts +8 -8
- package/lib/entities/User.js +31 -31
- package/lib/entities/UserEntityGrant.d.ts +8 -8
- package/lib/entities/UserEntityGrant.js +18 -18
- package/lib/entities/UserRelation.d.ts +10 -10
- package/lib/entities/UserRelation.js +38 -38
- package/lib/store/AsyncRowStore.d.ts +58 -58
- package/lib/store/AsyncRowStore.js +190 -190
- package/lib/store/CascadeStore.d.ts +103 -103
- package/lib/store/CascadeStore.js +2035 -2035
- package/lib/store/RelationAuth.d.ts +103 -103
- package/lib/store/RelationAuth.js +1492 -1492
- package/lib/store/SyncRowStore.d.ts +29 -29
- package/lib/store/SyncRowStore.js +49 -48
- package/lib/store/TriggerExecutor.d.ts +31 -31
- package/lib/store/TriggerExecutor.js +532 -532
- package/lib/store/actionAuth.d.ts +4 -4
- package/lib/store/actionAuth.js +40 -40
- package/lib/store/actionDef.d.ts +10 -10
- package/lib/store/actionDef.js +351 -351
- package/lib/store/checker.d.ts +26 -26
- package/lib/store/checker.js +623 -623
- package/lib/store/filter.d.ts +123 -123
- package/lib/store/filter.js +1761 -1761
- package/lib/store/modi.d.ts +13 -13
- package/lib/store/modi.js +315 -315
- package/lib/store/relation.d.ts +12 -12
- package/lib/store/relation.js +67 -67
- package/lib/timers/oper.d.ts +18 -18
- package/lib/timers/oper.js +60 -60
- package/lib/timers/vaccum.d.ts +20 -20
- package/lib/timers/vaccum.js +176 -176
- package/lib/triggers/index.d.ts +5 -5
- package/lib/triggers/index.js +8 -8
- package/lib/types/Action.d.ts +20 -20
- package/lib/types/Action.js +2 -2
- package/lib/types/AppLoader.d.ts +11 -11
- package/lib/types/AppLoader.js +10 -10
- package/lib/types/Aspect.d.ts +13 -13
- package/lib/types/Aspect.js +4 -4
- package/lib/types/Auth.d.ts +74 -74
- package/lib/types/Auth.js +2 -2
- package/lib/types/Connector.d.ts +33 -33
- package/lib/types/Connector.js +9 -9
- package/lib/types/Context.d.ts +7 -7
- package/lib/types/Context.js +3 -3
- package/lib/types/DataType.d.ts +24 -24
- package/lib/types/DataType.js +6 -6
- package/lib/types/Demand.d.ts +88 -88
- package/lib/types/Demand.js +10 -10
- package/lib/types/Endpoint.d.ts +11 -11
- package/lib/types/Endpoint.js +3 -3
- package/lib/types/Entity.d.ts +193 -193
- package/lib/types/Entity.js +14 -14
- package/lib/types/EntityDesc.d.ts +8 -8
- package/lib/types/EntityDesc.js +2 -2
- package/lib/types/Environment.d.ts +57 -57
- package/lib/types/Environment.js +2 -2
- package/lib/types/Exception.d.ts +115 -115
- package/lib/types/Exception.js +389 -389
- package/lib/types/Expression.d.ts +163 -163
- package/lib/types/Expression.js +427 -427
- package/lib/types/Geo.d.ts +18 -18
- package/lib/types/Geo.js +2 -2
- package/lib/types/Locale.d.ts +25 -25
- package/lib/types/Locale.js +2 -2
- package/lib/types/Logger.d.ts +6 -6
- package/lib/types/Logger.js +3 -3
- package/lib/types/Polyfill.d.ts +24 -24
- package/lib/types/Polyfill.js +2 -2
- package/lib/types/Port.d.ts +18 -18
- package/lib/types/Port.js +2 -2
- package/lib/types/RowStore.d.ts +18 -18
- package/lib/types/RowStore.js +34 -34
- package/lib/types/Storage.d.ts +57 -57
- package/lib/types/Storage.js +2 -2
- package/lib/types/Style.d.ts +11 -11
- package/lib/types/Style.js +2 -2
- package/lib/types/Timer.d.ts +14 -14
- package/lib/types/Timer.js +2 -2
- package/lib/types/Trigger.d.ts +108 -108
- package/lib/types/Trigger.js +54 -54
- package/lib/types/Txn.d.ts +2 -2
- package/lib/types/Txn.js +3 -3
- package/lib/types/Watcher.d.ts +19 -19
- package/lib/types/Watcher.js +4 -4
- package/lib/types/index.d.ts +24 -24
- package/lib/types/index.js +27 -27
- package/lib/types/schema/DataTypes.d.ts +34 -34
- package/lib/types/schema/DataTypes.js +3 -3
- package/lib/utils/SimpleConnector.d.ts +48 -48
- package/lib/utils/SimpleConnector.js +180 -180
- package/lib/utils/assert.d.ts +5 -5
- package/lib/utils/assert.js +9 -9
- package/lib/utils/concurrent.d.ts +15 -15
- package/lib/utils/concurrent.js +89 -89
- package/lib/utils/date.d.ts +1 -1
- package/lib/utils/date.js +18 -18
- package/lib/utils/geo.d.ts +4 -4
- package/lib/utils/geo.js +24 -24
- package/lib/utils/lodash.d.ts +20 -20
- package/lib/utils/lodash.js +55 -55
- package/lib/utils/mask.d.ts +5 -5
- package/lib/utils/mask.js +35 -35
- package/lib/utils/money.d.ts +6 -6
- package/lib/utils/money.js +40 -40
- package/lib/utils/random/random.d.ts +1 -1
- package/lib/utils/random/random.js +24 -24
- package/lib/utils/random/random.mp.d.ts +1 -1
- package/lib/utils/random/random.mp.js +25 -25
- package/lib/utils/random/random.web.d.ts +1 -1
- package/lib/utils/random/random.web.js +17 -17
- package/lib/utils/string.d.ts +28 -28
- package/lib/utils/string.js +82 -82
- package/lib/utils/url.d.ts +1 -1
- package/lib/utils/url.js +12 -12
- package/lib/utils/uuid.d.ts +17 -17
- package/lib/utils/uuid.js +257 -257
- package/lib/utils/validator.d.ts +25 -25
- package/lib/utils/validator.js +128 -128
- package/lib/utils/version.d.ts +7 -7
- package/lib/utils/version.js +21 -21
- package/package.json +49 -49
- package/src/entities/ActionAuth.ts +41 -41
- package/src/entities/I18n.ts +46 -46
- package/src/entities/Modi.ts +69 -69
- package/src/entities/ModiEntity.ts +26 -26
- package/src/entities/Oper.ts +32 -32
- package/src/entities/OperEntity.ts +27 -27
- package/src/entities/Relation.ts +43 -43
- package/src/entities/RelationAuth.ts +43 -43
- package/src/entities/User.ts +48 -48
- package/src/entities/UserEntityGrant.ts +27 -27
- package/src/entities/UserRelation.ts +50 -50
package/lib/utils/validator.js
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Xc on 2018/12/23.
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkAttributesScope = exports.checkAttributesNotNull = exports.isVehicleNumber = exports.isMoney = exports.isNumber = exports.isTel = exports.isPhone = exports.isDigital = exports.isSizedCaptcha = exports.isNickname = exports.isUrl = exports.isSoldierNumber = exports.isBirthNumber = exports.isTwCardNumber = exports.isAmCardNumber = exports.isHkCardNumber = exports.isPassportNumber = exports.isIdCardNumber = exports.isCaptcha = exports.isPassword = exports.isMobile = void 0;
|
|
7
|
-
var types_1 = require("../types");
|
|
8
|
-
var isMobile = function (text) {
|
|
9
|
-
return ((text) && (typeof text === "string") && ((/^1[3|4|5|6|7|8|9]\d{9}$/.test(text))));
|
|
10
|
-
};
|
|
11
|
-
exports.isMobile = isMobile;
|
|
12
|
-
var isPassword = function (text) {
|
|
13
|
-
return ((text) && (typeof text === "string") && (/^[a-zA-Z0-9!.@]{8,16}$/.test(text)));
|
|
14
|
-
};
|
|
15
|
-
exports.isPassword = isPassword;
|
|
16
|
-
var isCaptcha = function (text) {
|
|
17
|
-
return ((text) && (typeof text === "string") && (/^\d{4}$/.test(text)));
|
|
18
|
-
};
|
|
19
|
-
exports.isCaptcha = isCaptcha;
|
|
20
|
-
var isIdCardNumber = function (text) {
|
|
21
|
-
return ((typeof text === "string") && text.length === 18 && (/^\d{6}(18|19|20)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(text)));
|
|
22
|
-
};
|
|
23
|
-
exports.isIdCardNumber = isIdCardNumber;
|
|
24
|
-
var isPassportNumber = function (text) {
|
|
25
|
-
// 护照
|
|
26
|
-
// 规则: 14/15开头 + 7位数字, G + 8位数字, P + 7位数字, S/D + 7或8位数字,等
|
|
27
|
-
// 样本: 141234567, G12345678, P1234567
|
|
28
|
-
return typeof text === 'string' && /^([a-zA-z]|[0-9]){5,17}$/.test(text);
|
|
29
|
-
};
|
|
30
|
-
exports.isPassportNumber = isPassportNumber;
|
|
31
|
-
var isHkCardNumber = function (text) {
|
|
32
|
-
// 港澳居民来往内地通行证
|
|
33
|
-
// 规则: H/M + 10位或6位数字
|
|
34
|
-
// 样本: H1234567890
|
|
35
|
-
return typeof text === 'string' && /^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(text);
|
|
36
|
-
};
|
|
37
|
-
exports.isHkCardNumber = isHkCardNumber;
|
|
38
|
-
var isAmCardNumber = function (text) {
|
|
39
|
-
return typeof text === 'string' && /^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(text);
|
|
40
|
-
};
|
|
41
|
-
exports.isAmCardNumber = isAmCardNumber;
|
|
42
|
-
var isTwCardNumber = function (text) {
|
|
43
|
-
// 台湾居民来往大陆通行证
|
|
44
|
-
// 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母
|
|
45
|
-
// 样本: 12345678 或 1234567890B
|
|
46
|
-
return typeof text === 'string' && /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/.test(text);
|
|
47
|
-
};
|
|
48
|
-
exports.isTwCardNumber = isTwCardNumber;
|
|
49
|
-
var isBirthNumber = function (text) {
|
|
50
|
-
return typeof text === 'string' && /^[a-zA-Z0-9]{5,21}$/.test(text);
|
|
51
|
-
};
|
|
52
|
-
exports.isBirthNumber = isBirthNumber;
|
|
53
|
-
var isSoldierNumber = function (text) {
|
|
54
|
-
// 军官证
|
|
55
|
-
// 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号"
|
|
56
|
-
// 样本: 军字第2001988号, 士字第P011816X号
|
|
57
|
-
return typeof text === 'string' && /^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$/.test(text);
|
|
58
|
-
};
|
|
59
|
-
exports.isSoldierNumber = isSoldierNumber;
|
|
60
|
-
var isUrl = function (str) {
|
|
61
|
-
var regex = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
|
62
|
-
return typeof str === "string" && regex.test(str);
|
|
63
|
-
};
|
|
64
|
-
exports.isUrl = isUrl;
|
|
65
|
-
var isNickname = function (str) {
|
|
66
|
-
return str && typeof str === "string" && str.trim().length > 0 && str.length < 16;
|
|
67
|
-
};
|
|
68
|
-
exports.isNickname = isNickname;
|
|
69
|
-
var isSizedCaptcha = function (text, size) {
|
|
70
|
-
return typeof text === 'string' && text.length === size && !isNaN(parseInt(text, 10));
|
|
71
|
-
};
|
|
72
|
-
exports.isSizedCaptcha = isSizedCaptcha;
|
|
73
|
-
var isDigital = function (digital) {
|
|
74
|
-
return /^\d{6,12}$/.test(digital);
|
|
75
|
-
};
|
|
76
|
-
exports.isDigital = isDigital;
|
|
77
|
-
var isPhone = function (phone) {
|
|
78
|
-
// return /^((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(phone);
|
|
79
|
-
return /^(\(\d{3,4}\)|\d{3,4}-)?\d{7,8}$/.test(phone);
|
|
80
|
-
};
|
|
81
|
-
exports.isPhone = isPhone;
|
|
82
|
-
var isTel = function (text) {
|
|
83
|
-
// 1、133xxxx4545 2、0571-630xx239 3、400-123-1400
|
|
84
|
-
var reg = /^(((\d{3,4}-)?[0-9]{7,8})|(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}|((400)-(\d{3})-(\d{4})(.)(\d{1,4})|(400)-(\d{3})-(\d{4}$)|(400)(\d{3})(\d{4}$)|(400)-(\d{4})-(\d{3}$)))$/.test(text);
|
|
85
|
-
return reg;
|
|
86
|
-
};
|
|
87
|
-
exports.isTel = isTel;
|
|
88
|
-
var isNumber = function (str) {
|
|
89
|
-
return /^[0-9]*$/.test(str);
|
|
90
|
-
};
|
|
91
|
-
exports.isNumber = isNumber;
|
|
92
|
-
var isMoney = function (str, zero) {
|
|
93
|
-
// 金额,最多可以有两位小数 zero为true包含零
|
|
94
|
-
if (zero) {
|
|
95
|
-
return /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(str);
|
|
96
|
-
}
|
|
97
|
-
return /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/.test(str);
|
|
98
|
-
};
|
|
99
|
-
exports.isMoney = isMoney;
|
|
100
|
-
var isVehicleNumber = function (str) {
|
|
101
|
-
// const xreg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
|
|
102
|
-
// const creg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
|
|
103
|
-
var reg = /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/;
|
|
104
|
-
return reg.test(str);
|
|
105
|
-
};
|
|
106
|
-
exports.isVehicleNumber = isVehicleNumber;
|
|
107
|
-
function checkAttributesNotNull(entity, data, attributes, allowEmpty) {
|
|
108
|
-
var attrs = attributes.filter(function (attr) {
|
|
109
|
-
if (data[attr] === null || data[attr] === '' || data[attr] === undefined) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
if (!allowEmpty && !data.hasOwnProperty(attr)) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
if (attrs.length > 0) {
|
|
117
|
-
throw new types_1.OakAttrNotNullException(entity, attrs, '属性不能为空');
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.checkAttributesNotNull = checkAttributesNotNull;
|
|
121
|
-
;
|
|
122
|
-
function checkAttributesScope(entity, data, attributes) {
|
|
123
|
-
var attrs = attributes.filter(function (attr) { return !data.hasOwnProperty(attr); });
|
|
124
|
-
if (attrs.length > 0) {
|
|
125
|
-
throw new types_1.OakInputIllegalException(entity, attrs, '多余的属性');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.checkAttributesScope = checkAttributesScope;
|
|
1
|
+
/**
|
|
2
|
+
* Created by Xc on 2018/12/23.
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.checkAttributesScope = exports.checkAttributesNotNull = exports.isVehicleNumber = exports.isMoney = exports.isNumber = exports.isTel = exports.isPhone = exports.isDigital = exports.isSizedCaptcha = exports.isNickname = exports.isUrl = exports.isSoldierNumber = exports.isBirthNumber = exports.isTwCardNumber = exports.isAmCardNumber = exports.isHkCardNumber = exports.isPassportNumber = exports.isIdCardNumber = exports.isCaptcha = exports.isPassword = exports.isMobile = void 0;
|
|
7
|
+
var types_1 = require("../types");
|
|
8
|
+
var isMobile = function (text) {
|
|
9
|
+
return ((text) && (typeof text === "string") && ((/^1[3|4|5|6|7|8|9]\d{9}$/.test(text))));
|
|
10
|
+
};
|
|
11
|
+
exports.isMobile = isMobile;
|
|
12
|
+
var isPassword = function (text) {
|
|
13
|
+
return ((text) && (typeof text === "string") && (/^[a-zA-Z0-9!.@]{8,16}$/.test(text)));
|
|
14
|
+
};
|
|
15
|
+
exports.isPassword = isPassword;
|
|
16
|
+
var isCaptcha = function (text) {
|
|
17
|
+
return ((text) && (typeof text === "string") && (/^\d{4}$/.test(text)));
|
|
18
|
+
};
|
|
19
|
+
exports.isCaptcha = isCaptcha;
|
|
20
|
+
var isIdCardNumber = function (text) {
|
|
21
|
+
return ((typeof text === "string") && text.length === 18 && (/^\d{6}(18|19|20)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(text)));
|
|
22
|
+
};
|
|
23
|
+
exports.isIdCardNumber = isIdCardNumber;
|
|
24
|
+
var isPassportNumber = function (text) {
|
|
25
|
+
// 护照
|
|
26
|
+
// 规则: 14/15开头 + 7位数字, G + 8位数字, P + 7位数字, S/D + 7或8位数字,等
|
|
27
|
+
// 样本: 141234567, G12345678, P1234567
|
|
28
|
+
return typeof text === 'string' && /^([a-zA-z]|[0-9]){5,17}$/.test(text);
|
|
29
|
+
};
|
|
30
|
+
exports.isPassportNumber = isPassportNumber;
|
|
31
|
+
var isHkCardNumber = function (text) {
|
|
32
|
+
// 港澳居民来往内地通行证
|
|
33
|
+
// 规则: H/M + 10位或6位数字
|
|
34
|
+
// 样本: H1234567890
|
|
35
|
+
return typeof text === 'string' && /^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(text);
|
|
36
|
+
};
|
|
37
|
+
exports.isHkCardNumber = isHkCardNumber;
|
|
38
|
+
var isAmCardNumber = function (text) {
|
|
39
|
+
return typeof text === 'string' && /^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(text);
|
|
40
|
+
};
|
|
41
|
+
exports.isAmCardNumber = isAmCardNumber;
|
|
42
|
+
var isTwCardNumber = function (text) {
|
|
43
|
+
// 台湾居民来往大陆通行证
|
|
44
|
+
// 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母
|
|
45
|
+
// 样本: 12345678 或 1234567890B
|
|
46
|
+
return typeof text === 'string' && /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/.test(text);
|
|
47
|
+
};
|
|
48
|
+
exports.isTwCardNumber = isTwCardNumber;
|
|
49
|
+
var isBirthNumber = function (text) {
|
|
50
|
+
return typeof text === 'string' && /^[a-zA-Z0-9]{5,21}$/.test(text);
|
|
51
|
+
};
|
|
52
|
+
exports.isBirthNumber = isBirthNumber;
|
|
53
|
+
var isSoldierNumber = function (text) {
|
|
54
|
+
// 军官证
|
|
55
|
+
// 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号"
|
|
56
|
+
// 样本: 军字第2001988号, 士字第P011816X号
|
|
57
|
+
return typeof text === 'string' && /^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$/.test(text);
|
|
58
|
+
};
|
|
59
|
+
exports.isSoldierNumber = isSoldierNumber;
|
|
60
|
+
var isUrl = function (str) {
|
|
61
|
+
var regex = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
|
62
|
+
return typeof str === "string" && regex.test(str);
|
|
63
|
+
};
|
|
64
|
+
exports.isUrl = isUrl;
|
|
65
|
+
var isNickname = function (str) {
|
|
66
|
+
return str && typeof str === "string" && str.trim().length > 0 && str.length < 16;
|
|
67
|
+
};
|
|
68
|
+
exports.isNickname = isNickname;
|
|
69
|
+
var isSizedCaptcha = function (text, size) {
|
|
70
|
+
return typeof text === 'string' && text.length === size && !isNaN(parseInt(text, 10));
|
|
71
|
+
};
|
|
72
|
+
exports.isSizedCaptcha = isSizedCaptcha;
|
|
73
|
+
var isDigital = function (digital) {
|
|
74
|
+
return /^\d{6,12}$/.test(digital);
|
|
75
|
+
};
|
|
76
|
+
exports.isDigital = isDigital;
|
|
77
|
+
var isPhone = function (phone) {
|
|
78
|
+
// return /^((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(phone);
|
|
79
|
+
return /^(\(\d{3,4}\)|\d{3,4}-)?\d{7,8}$/.test(phone);
|
|
80
|
+
};
|
|
81
|
+
exports.isPhone = isPhone;
|
|
82
|
+
var isTel = function (text) {
|
|
83
|
+
// 1、133xxxx4545 2、0571-630xx239 3、400-123-1400
|
|
84
|
+
var reg = /^(((\d{3,4}-)?[0-9]{7,8})|(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}|((400)-(\d{3})-(\d{4})(.)(\d{1,4})|(400)-(\d{3})-(\d{4}$)|(400)(\d{3})(\d{4}$)|(400)-(\d{4})-(\d{3}$)))$/.test(text);
|
|
85
|
+
return reg;
|
|
86
|
+
};
|
|
87
|
+
exports.isTel = isTel;
|
|
88
|
+
var isNumber = function (str) {
|
|
89
|
+
return /^[0-9]*$/.test(str);
|
|
90
|
+
};
|
|
91
|
+
exports.isNumber = isNumber;
|
|
92
|
+
var isMoney = function (str, zero) {
|
|
93
|
+
// 金额,最多可以有两位小数 zero为true包含零
|
|
94
|
+
if (zero) {
|
|
95
|
+
return /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(str);
|
|
96
|
+
}
|
|
97
|
+
return /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/.test(str);
|
|
98
|
+
};
|
|
99
|
+
exports.isMoney = isMoney;
|
|
100
|
+
var isVehicleNumber = function (str) {
|
|
101
|
+
// const xreg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
|
|
102
|
+
// const creg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
|
|
103
|
+
var reg = /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/;
|
|
104
|
+
return reg.test(str);
|
|
105
|
+
};
|
|
106
|
+
exports.isVehicleNumber = isVehicleNumber;
|
|
107
|
+
function checkAttributesNotNull(entity, data, attributes, allowEmpty) {
|
|
108
|
+
var attrs = attributes.filter(function (attr) {
|
|
109
|
+
if (data[attr] === null || data[attr] === '' || data[attr] === undefined) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if (!allowEmpty && !data.hasOwnProperty(attr)) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
if (attrs.length > 0) {
|
|
117
|
+
throw new types_1.OakAttrNotNullException(entity, attrs, '属性不能为空');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.checkAttributesNotNull = checkAttributesNotNull;
|
|
121
|
+
;
|
|
122
|
+
function checkAttributesScope(entity, data, attributes) {
|
|
123
|
+
var attrs = attributes.filter(function (attr) { return !data.hasOwnProperty(attr); });
|
|
124
|
+
if (attrs.length > 0) {
|
|
125
|
+
throw new types_1.OakInputIllegalException(entity, attrs, '多余的属性');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.checkAttributesScope = checkAttributesScope;
|
package/lib/utils/version.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 版本比较
|
|
3
|
-
* @param curVersion 当前版本
|
|
4
|
-
* @param reqVersion 比较版本
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export declare const compareVersion: (curVersion: string, reqVersion: string) => number;
|
|
1
|
+
/**
|
|
2
|
+
* 版本比较
|
|
3
|
+
* @param curVersion 当前版本
|
|
4
|
+
* @param reqVersion 比较版本
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare const compareVersion: (curVersion: string, reqVersion: string) => number;
|
package/lib/utils/version.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compareVersion = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* 版本比较
|
|
6
|
-
* @param curVersion 当前版本
|
|
7
|
-
* @param reqVersion 比较版本
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
var compareVersion = function (curVersion, reqVersion) {
|
|
11
|
-
var v1 = curVersion.split('.');
|
|
12
|
-
var v2 = reqVersion.split('.');
|
|
13
|
-
for (var i = 0; i < Math.max(v1.length, v2.length); i++) {
|
|
14
|
-
var num1 = i < v1.length ? parseInt(v1[i], 10) : 0;
|
|
15
|
-
var num2 = i < v2.length ? parseInt(v2[i], 10) : 0;
|
|
16
|
-
if (num1 !== num2)
|
|
17
|
-
return num1 - num2;
|
|
18
|
-
}
|
|
19
|
-
return 0;
|
|
20
|
-
};
|
|
21
|
-
exports.compareVersion = compareVersion;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compareVersion = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 版本比较
|
|
6
|
+
* @param curVersion 当前版本
|
|
7
|
+
* @param reqVersion 比较版本
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
var compareVersion = function (curVersion, reqVersion) {
|
|
11
|
+
var v1 = curVersion.split('.');
|
|
12
|
+
var v2 = reqVersion.split('.');
|
|
13
|
+
for (var i = 0; i < Math.max(v1.length, v2.length); i++) {
|
|
14
|
+
var num1 = i < v1.length ? parseInt(v1[i], 10) : 0;
|
|
15
|
+
var num2 = i < v2.length ? parseInt(v2[i], 10) : 0;
|
|
16
|
+
if (num1 !== num2)
|
|
17
|
+
return num1 - num2;
|
|
18
|
+
}
|
|
19
|
+
return 0;
|
|
20
|
+
};
|
|
21
|
+
exports.compareVersion = compareVersion;
|
package/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "oak-domain",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"author": {
|
|
5
|
-
"name": "XuChang"
|
|
6
|
-
},
|
|
7
|
-
"scripts": {
|
|
8
|
-
"make:domain": "ts-node scripts/make.ts",
|
|
9
|
-
"build": "tsc",
|
|
10
|
-
"prebuild": "npm run make:domain",
|
|
11
|
-
"test": "ts-node test/test.ts"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"lib/**/*",
|
|
15
|
-
"src/entities/*"
|
|
16
|
-
],
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@babel/cli": "^7.12.13",
|
|
19
|
-
"@babel/core": "^7.12.13",
|
|
20
|
-
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
|
21
|
-
"@babel/preset-env": "^7.12.13",
|
|
22
|
-
"@babel/preset-typescript": "^7.12.13",
|
|
23
|
-
"@types/assert": "^1.5.6",
|
|
24
|
-
"@types/cross-spawn": "^6.0.2",
|
|
25
|
-
"@types/fs-extra": "^9.0.13",
|
|
26
|
-
"@types/lodash": "^4.14.182",
|
|
27
|
-
"@types/luxon": "^2.0.9",
|
|
28
|
-
"@types/mocha": "^8.2.0",
|
|
29
|
-
"@types/node": "^14.18.48",
|
|
30
|
-
"@types/node-schedule": "^2.1.0",
|
|
31
|
-
"@types/react": "^17.0.2",
|
|
32
|
-
"@types/uuid": "^8.3.0",
|
|
33
|
-
"@types/wechat-miniprogram": "^3.4.1",
|
|
34
|
-
"assert": "^2.0.0",
|
|
35
|
-
"cross-env": "^7.0.2",
|
|
36
|
-
"cross-spawn": "^7.0.3",
|
|
37
|
-
"fs-extra": "^10.0.0",
|
|
38
|
-
"mocha": "^8.2.1",
|
|
39
|
-
"ts-node": "~10.9.1",
|
|
40
|
-
"tslib": "^2.4.0",
|
|
41
|
-
"typescript": "^4.7.4"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"dayjs": "^1.11.5",
|
|
45
|
-
"lodash": "^4.17.21",
|
|
46
|
-
"node-schedule": "^2.1.1",
|
|
47
|
-
"uuid": "^9.0.0"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "oak-domain",
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "XuChang"
|
|
6
|
+
},
|
|
7
|
+
"scripts": {
|
|
8
|
+
"make:domain": "ts-node scripts/make.ts",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prebuild": "npm run make:domain",
|
|
11
|
+
"test": "ts-node test/test.ts"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"lib/**/*",
|
|
15
|
+
"src/entities/*"
|
|
16
|
+
],
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@babel/cli": "^7.12.13",
|
|
19
|
+
"@babel/core": "^7.12.13",
|
|
20
|
+
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
|
21
|
+
"@babel/preset-env": "^7.12.13",
|
|
22
|
+
"@babel/preset-typescript": "^7.12.13",
|
|
23
|
+
"@types/assert": "^1.5.6",
|
|
24
|
+
"@types/cross-spawn": "^6.0.2",
|
|
25
|
+
"@types/fs-extra": "^9.0.13",
|
|
26
|
+
"@types/lodash": "^4.14.182",
|
|
27
|
+
"@types/luxon": "^2.0.9",
|
|
28
|
+
"@types/mocha": "^8.2.0",
|
|
29
|
+
"@types/node": "^14.18.48",
|
|
30
|
+
"@types/node-schedule": "^2.1.0",
|
|
31
|
+
"@types/react": "^17.0.2",
|
|
32
|
+
"@types/uuid": "^8.3.0",
|
|
33
|
+
"@types/wechat-miniprogram": "^3.4.1",
|
|
34
|
+
"assert": "^2.0.0",
|
|
35
|
+
"cross-env": "^7.0.2",
|
|
36
|
+
"cross-spawn": "^7.0.3",
|
|
37
|
+
"fs-extra": "^10.0.0",
|
|
38
|
+
"mocha": "^8.2.1",
|
|
39
|
+
"ts-node": "~10.9.1",
|
|
40
|
+
"tslib": "^2.4.0",
|
|
41
|
+
"typescript": "^4.7.4"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"dayjs": "^1.11.5",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"node-schedule": "^2.1.1",
|
|
47
|
+
"uuid": "^9.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { Schema as Relation } from './Relation';
|
|
4
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
-
|
|
6
|
-
type Actions = string[];
|
|
7
|
-
type Paths = string[];
|
|
8
|
-
|
|
9
|
-
export interface Schema extends EntityShape {
|
|
10
|
-
relation?: Relation;
|
|
11
|
-
paths: Paths;
|
|
12
|
-
destEntity: String<32>;
|
|
13
|
-
deActions: Actions;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
17
|
-
locales: {
|
|
18
|
-
zh_CN: {
|
|
19
|
-
name: '用户授权',
|
|
20
|
-
attr: {
|
|
21
|
-
relation: '关系',
|
|
22
|
-
paths: '路径',
|
|
23
|
-
destEntity: '目标对象',
|
|
24
|
-
deActions: '目标对象动作',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
indexes: [
|
|
29
|
-
{
|
|
30
|
-
name: 'index_entity_relation',
|
|
31
|
-
attributes: [
|
|
32
|
-
{
|
|
33
|
-
name: 'destEntity',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'relation',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
};
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { Schema as Relation } from './Relation';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
+
|
|
6
|
+
type Actions = string[];
|
|
7
|
+
type Paths = string[];
|
|
8
|
+
|
|
9
|
+
export interface Schema extends EntityShape {
|
|
10
|
+
relation?: Relation;
|
|
11
|
+
paths: Paths;
|
|
12
|
+
destEntity: String<32>;
|
|
13
|
+
deActions: Actions;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
17
|
+
locales: {
|
|
18
|
+
zh_CN: {
|
|
19
|
+
name: '用户授权',
|
|
20
|
+
attr: {
|
|
21
|
+
relation: '关系',
|
|
22
|
+
paths: '路径',
|
|
23
|
+
destEntity: '目标对象',
|
|
24
|
+
deActions: '目标对象动作',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
indexes: [
|
|
29
|
+
{
|
|
30
|
+
name: 'index_entity_relation',
|
|
31
|
+
attributes: [
|
|
32
|
+
{
|
|
33
|
+
name: 'destEntity',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'relation',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
package/src/entities/I18n.ts
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
-
|
|
5
|
-
export interface Schema extends EntityShape {
|
|
6
|
-
module: String<64>;
|
|
7
|
-
position: String<188>;
|
|
8
|
-
namespace: String<256>;
|
|
9
|
-
language: String<32>;
|
|
10
|
-
data: Object;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
14
|
-
locales: {
|
|
15
|
-
zh_CN: {
|
|
16
|
-
name: '用户授权',
|
|
17
|
-
attr: {
|
|
18
|
-
module: '模块',
|
|
19
|
-
position: '文件位置',
|
|
20
|
-
namespace: '命名空间',
|
|
21
|
-
language: '语言',
|
|
22
|
-
data: '数据'
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
indexes: [
|
|
27
|
-
{
|
|
28
|
-
name: 'namespace_language',
|
|
29
|
-
attributes: [
|
|
30
|
-
{
|
|
31
|
-
name: 'namespace',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'language',
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
config: {
|
|
38
|
-
unique: true,
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
configuration: {
|
|
43
|
-
actionType: 'readOnly',
|
|
44
|
-
static: true,
|
|
45
|
-
}
|
|
46
|
-
};
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
+
|
|
5
|
+
export interface Schema extends EntityShape {
|
|
6
|
+
module: String<64>;
|
|
7
|
+
position: String<188>;
|
|
8
|
+
namespace: String<256>;
|
|
9
|
+
language: String<32>;
|
|
10
|
+
data: Object;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
14
|
+
locales: {
|
|
15
|
+
zh_CN: {
|
|
16
|
+
name: '用户授权',
|
|
17
|
+
attr: {
|
|
18
|
+
module: '模块',
|
|
19
|
+
position: '文件位置',
|
|
20
|
+
namespace: '命名空间',
|
|
21
|
+
language: '语言',
|
|
22
|
+
data: '数据'
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
indexes: [
|
|
27
|
+
{
|
|
28
|
+
name: 'namespace_language',
|
|
29
|
+
attributes: [
|
|
30
|
+
{
|
|
31
|
+
name: 'namespace',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'language',
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
config: {
|
|
38
|
+
unique: true,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
configuration: {
|
|
43
|
+
actionType: 'readOnly',
|
|
44
|
+
static: true,
|
|
45
|
+
}
|
|
46
|
+
};
|