@byted-apaas/server-sdk-node 1.1.20 → 1.1.21-beta.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.
|
@@ -85,7 +85,8 @@ function buildCriterion(logic, objectApiName) {
|
|
|
85
85
|
let exps = logic;
|
|
86
86
|
let logs = [];
|
|
87
87
|
for (let left of Object.keys(exps)) {
|
|
88
|
-
let right = logic[left];
|
|
88
|
+
let right = parseCondition(logic[left]);
|
|
89
|
+
// let right: { [index: string]: any } = logic[left];
|
|
89
90
|
let copy = right;
|
|
90
91
|
if (server_common_node_1.utils.isObject(right) && !(right instanceof Condition) && !isKunlunTypeOrSerializedObject(right)) {
|
|
91
92
|
for (let leftInner of Object.keys(right)) {
|
|
@@ -143,6 +144,21 @@ function buildCriterion(logic, objectApiName) {
|
|
|
143
144
|
return { conditions: expressions, logic: logics.join('') };
|
|
144
145
|
}
|
|
145
146
|
exports.buildCriterion = buildCriterion;
|
|
147
|
+
// 避免引入组件库导致 app 使用的是组件库的 condition 是出现判断失败的问题。
|
|
148
|
+
function parseCondition(obj) {
|
|
149
|
+
// 判断当前对象是否是 Condition 类型的实例
|
|
150
|
+
if (obj instanceof Object &&
|
|
151
|
+
Object.keys(obj).length === 3 &&
|
|
152
|
+
obj.hasOwnProperty('op') &&
|
|
153
|
+
obj.hasOwnProperty('left') &&
|
|
154
|
+
obj.hasOwnProperty('right')) {
|
|
155
|
+
// 判断 op 是否是 Condition 支持的操作符
|
|
156
|
+
if (Object.values(operator_1.operates).includes(obj['op'])) {
|
|
157
|
+
return new Condition(obj.left, obj.right, obj.op);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return obj;
|
|
161
|
+
}
|
|
146
162
|
function buildExpression(objectApiName, left, right, index = 1) {
|
|
147
163
|
if (!(right instanceof Condition)) {
|
|
148
164
|
right = new Condition(left, right);
|