oak-domain 5.1.25 → 5.1.26
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.
|
@@ -167,8 +167,11 @@ function polishSelection(schema, entity, selection, context, option) {
|
|
|
167
167
|
}
|
|
168
168
|
const toBeAssignNode2 = {}; // 用来记录在表达式中涉及到的结点
|
|
169
169
|
const projectionNodeDict = {};
|
|
170
|
-
const checkProjectionNode = (entity2, projectionNode) => {
|
|
171
|
-
const necessaryAttrs = [
|
|
170
|
+
const checkProjectionNode = (entity2, projectionNode, root) => {
|
|
171
|
+
const necessaryAttrs = [types_1.PrimaryKeyAttribute, Entity_1.CreateAtAttribute, Entity_1.UpdateAtAttribute]; // 有的页面依赖于其它页面取数据,有时两个页面的filter的差异会导致有一个加createAt,有一个不加,此时可能产生前台取数据不完整的异常。先统一加上
|
|
172
|
+
if (root && option?.includedDeleted) {
|
|
173
|
+
necessaryAttrs.push(Entity_1.DeleteAtAttribute);
|
|
174
|
+
}
|
|
172
175
|
for (const attr in projectionNode) {
|
|
173
176
|
if (attr === '#id') {
|
|
174
177
|
(0, assert_1.default)(!projectionNodeDict[projectionNode[attr]], `projection中结点的id有重复, ${projectionNode[attr]}`);
|
|
@@ -264,7 +267,7 @@ function polishSelection(schema, entity, selection, context, option) {
|
|
|
264
267
|
}
|
|
265
268
|
}
|
|
266
269
|
};
|
|
267
|
-
checkProjectionNode(entity, data);
|
|
270
|
+
checkProjectionNode(entity, data, true);
|
|
268
271
|
if (!sorter && relevantIds.length === 0) {
|
|
269
272
|
// 如果没有sorter,就给予一个按createAt逆序的sorter
|
|
270
273
|
Object.assign(selection, {
|
|
@@ -1702,7 +1705,7 @@ class CascadeStore extends RowStore_1.RowStore {
|
|
|
1702
1705
|
const entityBranch = lastOperation.d[entity];
|
|
1703
1706
|
if (entityBranch) {
|
|
1704
1707
|
rows.forEach((row) => {
|
|
1705
|
-
if (row && row.id) { // 如果没有row.id就不加入结果集了
|
|
1708
|
+
if (row && row.id && !row[Entity_1.DeleteAtAttribute]) { // 如果没有row.id就不加入结果集了
|
|
1706
1709
|
const { id } = row;
|
|
1707
1710
|
if (!entityBranch[id]) {
|
|
1708
1711
|
Object.assign(entityBranch, {
|
|
@@ -1727,7 +1730,7 @@ class CascadeStore extends RowStore_1.RowStore {
|
|
|
1727
1730
|
}
|
|
1728
1731
|
const entityBranch = {};
|
|
1729
1732
|
rows.forEach((row) => {
|
|
1730
|
-
if (row) {
|
|
1733
|
+
if (row && row.id && !row[Entity_1.DeleteAtAttribute]) {
|
|
1731
1734
|
const { id } = row;
|
|
1732
1735
|
Object.assign(entityBranch, {
|
|
1733
1736
|
[id]: (0, lodash_1.cloneDeep)(row),
|
|
@@ -54,8 +54,8 @@ export type ServerConfiguration = {
|
|
|
54
54
|
internalExceptionMask?: string;
|
|
55
55
|
koaBody?: IKoaBodyOptions;
|
|
56
56
|
socket?: (ctx: Koa.ParameterizedContext<any, KoaRouter.IRouterParamContext<any, {}>, any>) => {
|
|
57
|
-
url
|
|
58
|
-
};
|
|
57
|
+
url: string;
|
|
58
|
+
} | undefined;
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
61
|
* 前后台访问配置
|
package/lib/utils/validator.d.ts
CHANGED
|
@@ -23,4 +23,8 @@ export declare const isVehicleNumber: ValidatorFunction;
|
|
|
23
23
|
export declare const isEmail: ValidatorFunction;
|
|
24
24
|
export declare function checkAttributesNotNull<ED extends EntityDict, T extends keyof EntityDict>(entity: T, data: Partial<ED[T]['CreateOperationData']>, attributes: Array<keyof ED[T]['CreateOperationData']>, allowEmpty?: true): void;
|
|
25
25
|
export declare function checkAttributesScope<ED extends EntityDict, T extends keyof EntityDict>(entity: T, data: Partial<ED[T]['CreateOperationData']>, attributes: Array<keyof ED[T]['CreateOperationData']>): void;
|
|
26
|
+
export declare const isIPV4: ValidatorFunction;
|
|
27
|
+
export declare const isIPV6: ValidatorFunction;
|
|
28
|
+
export declare const isIP: ValidatorFunction;
|
|
29
|
+
export declare const isDomain: ValidatorFunction;
|
|
26
30
|
export {};
|
package/lib/utils/validator.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkAttributesScope = exports.checkAttributesNotNull = exports.isEmail = 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;
|
|
6
|
+
exports.isDomain = exports.isIP = exports.isIPV6 = exports.isIPV4 = exports.checkAttributesScope = exports.checkAttributesNotNull = exports.isEmail = 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
7
|
const types_1 = require("../types");
|
|
8
8
|
const isMobile = (text) => {
|
|
9
9
|
return ((text) && (typeof text === "string") && ((/^1[3|4|5|6|7|8|9]\d{9}$/.test(text))));
|
|
@@ -131,3 +131,25 @@ function checkAttributesScope(entity, data, attributes) {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
exports.checkAttributesScope = checkAttributesScope;
|
|
134
|
+
const isIPV4 = (ip) => {
|
|
135
|
+
// IPv4正则
|
|
136
|
+
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
137
|
+
return ipv4Regex.test(ip);
|
|
138
|
+
};
|
|
139
|
+
exports.isIPV4 = isIPV4;
|
|
140
|
+
const isIPV6 = (ip) => {
|
|
141
|
+
// IPv6正则(简化版,匹配常见格式)
|
|
142
|
+
const ipv6Regex = /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^::([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}$|^[0-9a-fA-F]{1,4}::([0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){1}:([0-9a-fA-F]{1,4}:){0,4}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){2}:([0-9a-fA-F]{1,4}:){0,3}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){3}:([0-9a-fA-F]{1,4}:){0,2}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){4}:([0-9a-fA-F]{1,4}:){0,1}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){5}:[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){1,6}:$/;
|
|
143
|
+
return ipv6Regex.test(ip);
|
|
144
|
+
};
|
|
145
|
+
exports.isIPV6 = isIPV6;
|
|
146
|
+
const isIP = (ip) => {
|
|
147
|
+
return (0, exports.isIPV4)(ip) || (0, exports.isIPV6)(ip);
|
|
148
|
+
};
|
|
149
|
+
exports.isIP = isIP;
|
|
150
|
+
const isDomain = (domain) => {
|
|
151
|
+
//基础域名验证正则
|
|
152
|
+
const domainRegex = /^(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/;
|
|
153
|
+
return domainRegex.test(domain);
|
|
154
|
+
};
|
|
155
|
+
exports.isDomain = isDomain;
|