@byted-apaas/server-sdk-node 1.1.23-beta.9 → 1.1.23
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/package.json +2 -2
- package/application/application.d.ts +0 -33
- package/application/application.js +0 -2
- package/application/function/function.d.ts +0 -14
- package/application/function/function.js +0 -20
- package/application/impl/common.d.ts +0 -2
- package/application/impl/common.js +0 -52
- package/application/impl/impl.d.ts +0 -19
- package/application/impl/impl.js +0 -45
- package/common/structs.d.ts +0 -15
- package/common/structs.js +0 -21
- package/constants/constants.d.ts +0 -13
- package/constants/constants.js +0 -18
- package/context/context.d.ts +0 -44
- package/context/context.js +0 -25
- package/context/db/db.d.ts +0 -110
- package/context/db/db.js +0 -2
- package/context/db/impl/IObject.d.ts +0 -303
- package/context/db/impl/IObject.js +0 -5
- package/context/db/impl/IObjectV3.d.ts +0 -239
- package/context/db/impl/IObjectV3.js +0 -5
- package/context/db/impl/db.d.ts +0 -62
- package/context/db/impl/db.js +0 -84
- package/context/db/impl/dbV3.d.ts +0 -35
- package/context/db/impl/dbV3.js +0 -50
- package/context/db/impl/object.d.ts +0 -123
- package/context/db/impl/object.js +0 -1008
- package/context/db/impl/oql/ioql.d.ts +0 -14
- package/context/db/impl/oql/ioql.js +0 -4
- package/context/db/impl/oql/oql.d.ts +0 -14
- package/context/db/impl/oql/oql.js +0 -39
- package/context/db/impl/order.d.ts +0 -9
- package/context/db/impl/order.js +0 -15
- package/context/db/impl/propertiesStore.d.ts +0 -8
- package/context/db/impl/propertiesStore.js +0 -29
- package/context/db/impl/queryBuilder.d.ts +0 -33
- package/context/db/impl/queryBuilder.js +0 -72
- package/context/db/impl/transaction/index.d.ts +0 -25
- package/context/db/impl/transaction/index.js +0 -300
- package/context/db/impl/transaction/operation.d.ts +0 -27
- package/context/db/impl/transaction/operation.js +0 -69
- package/context/db/impl/transaction.d.ts +0 -70
- package/context/db/impl/transaction.js +0 -4
- package/context/globalConfig/globalConfig.d.ts +0 -7
- package/context/globalConfig/globalConfig.js +0 -16
- package/context/integration/IIntegration.d.ts +0 -30
- package/context/integration/IIntegration.js +0 -4
- package/context/integration/impl/integration.d.ts +0 -16
- package/context/integration/impl/integration.js +0 -62
- package/context/metadata/components/common.d.ts +0 -6
- package/context/metadata/components/common.js +0 -17
- package/context/metadata/components/components.d.ts +0 -12
- package/context/metadata/components/components.js +0 -19
- package/context/metadata/components/desktop/list.d.ts +0 -16
- package/context/metadata/components/desktop/list.js +0 -402
- package/context/metadata/components/desktop/recordDetail.d.ts +0 -11
- package/context/metadata/components/desktop/recordDetail.js +0 -53
- package/context/metadata/components/mobile/list.d.ts +0 -24
- package/context/metadata/components/mobile/list.js +0 -145
- package/context/metadata/metadata.d.ts +0 -63
- package/context/metadata/metadata.js +0 -125
- package/context/metadata/objects/fields.d.ts +0 -158
- package/context/metadata/objects/fields.js +0 -369
- package/context/metadata/objects/fields.util.d.ts +0 -52
- package/context/metadata/objects/fields.util.js +0 -420
- package/context/metadata/objects/fieldsV3.d.ts +0 -159
- package/context/metadata/objects/fieldsV3.js +0 -369
- package/context/metadata/objects/objects.d.ts +0 -11
- package/context/metadata/objects/objects.js +0 -20
- package/context/metadata/types/common.d.ts +0 -11
- package/context/metadata/types/common.js +0 -33
- package/context/metadata/types/components.d.ts +0 -90
- package/context/metadata/types/components.js +0 -4
- package/context/metadata/types/objects.d.ts +0 -246
- package/context/metadata/types/objects.js +0 -4
- package/context/metadata/types/objectsV3.d.ts +0 -128
- package/context/metadata/types/objectsV3.js +0 -4
- package/context/msg/msg.d.ts +0 -38
- package/context/msg/msg.js +0 -35
- package/context/resources/IResources.d.ts +0 -68
- package/context/resources/IResources.js +0 -2
- package/context/resources/impl/resources.d.ts +0 -42
- package/context/resources/impl/resources.js +0 -161
- package/context/tasks/tasks.d.ts +0 -33
- package/context/tasks/tasks.js +0 -139
- package/data/index.d.ts +0 -27
- package/data/index.js +0 -4
- package/global/application/flow/flow.d.ts +0 -99
- package/global/application/flow/flow.js +0 -8
- package/global/application/flow/impl/flow.d.ts +0 -20
- package/global/application/flow/impl/flow.js +0 -56
- package/global/application/globalVar/globalVar.d.ts +0 -7
- package/global/application/globalVar/globalVar.js +0 -2
- package/global/global.d.ts +0 -70
- package/global/global.js +0 -3
- package/hooks/api.d.ts +0 -65
- package/hooks/api.js +0 -347
- package/hooks/hooks.d.ts +0 -1
- package/hooks/hooks.js +0 -107
- package/kunlun/kunlun.d.ts +0 -55
- package/kunlun/kunlun.js +0 -58
- package/kunlun/operator/IOperator.d.ts +0 -158
- package/kunlun/operator/IOperator.js +0 -4
- package/kunlun/operator/impl/expression.d.ts +0 -75
- package/kunlun/operator/impl/expression.js +0 -96
- package/kunlun/operator/impl/logic.d.ts +0 -68
- package/kunlun/operator/impl/logic.js +0 -573
- package/kunlun/operator/impl/logicV2.d.ts +0 -59
- package/kunlun/operator/impl/logicV2.js +0 -197
- package/kunlun/operator/impl/operator.d.ts +0 -179
- package/kunlun/operator/impl/operator.js +0 -222
- package/kunlun/operator/impl/operatorV2.d.ts +0 -180
- package/kunlun/operator/impl/operatorV2.js +0 -216
- package/lib/core.d.ts +0 -4
- package/lib/core.js +0 -19
- package/request/common.d.ts +0 -13
- package/request/common.js +0 -88
- package/request/constants.d.ts +0 -12
- package/request/constants.js +0 -29
- package/request/faasinfra.d.ts +0 -8
- package/request/faasinfra.js +0 -146
- package/request/interface.d.ts +0 -121
- package/request/interface.js +0 -30
- package/request/openapi.d.ts +0 -84
- package/request/openapi.js +0 -1529
- package/request/structs.d.ts +0 -99
- package/request/structs.js +0 -15
- package/types/types.d.ts +0 -79
- package/types/types.js +0 -4
- package/version/version.d.ts +0 -2
- package/version/version.js +0 -8
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildCriterionV2 = exports.logical = exports.QueryV2 = exports.LogicalExpression = exports.ArithmeticExpression = exports.NewConstantExpressionField = exports.NewMetadataExpressionField = void 0;
|
|
4
|
-
const operator_1 = require("./operator");
|
|
5
|
-
function NewMetadataExpressionField(objectApiName, fieldApiName) {
|
|
6
|
-
return {
|
|
7
|
-
type: 'metadataVariable',
|
|
8
|
-
settings: {
|
|
9
|
-
fieldPath: [{
|
|
10
|
-
objectApiName: objectApiName,
|
|
11
|
-
fieldApiName: fieldApiName,
|
|
12
|
-
extendLogicTags: []
|
|
13
|
-
}]
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.NewMetadataExpressionField = NewMetadataExpressionField;
|
|
18
|
-
function NewConstantExpressionField(data) {
|
|
19
|
-
return {
|
|
20
|
-
type: 'constant',
|
|
21
|
-
settings: {
|
|
22
|
-
data: data
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.NewConstantExpressionField = NewConstantExpressionField;
|
|
27
|
-
class ArithmeticExpression {
|
|
28
|
-
constructor(leftValue, op, rightValue) {
|
|
29
|
-
let fieldPaths = [];
|
|
30
|
-
leftValue.split('.').forEach((fieldApiName) => {
|
|
31
|
-
fieldPaths.push({
|
|
32
|
-
fieldApiName: fieldApiName,
|
|
33
|
-
objectApiName: '',
|
|
34
|
-
extendLogicTags: []
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
const left = {
|
|
38
|
-
type: 'metadataVariable',
|
|
39
|
-
settings: {
|
|
40
|
-
fieldPath: fieldPaths,
|
|
41
|
-
data: null
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
let right = {
|
|
45
|
-
type: 'constant',
|
|
46
|
-
settings: {
|
|
47
|
-
fieldPath: [],
|
|
48
|
-
data: rightValue
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
if (op === 'isEmpty' || op === 'isNotEmpty') {
|
|
52
|
-
right = null;
|
|
53
|
-
}
|
|
54
|
-
this.operator = op;
|
|
55
|
-
this.left = left;
|
|
56
|
-
this.right = right;
|
|
57
|
-
this.expr = {
|
|
58
|
-
leftValue: leftValue,
|
|
59
|
-
operator: op,
|
|
60
|
-
rightValue: rightValue
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ArithmeticExpression = ArithmeticExpression;
|
|
65
|
-
class LogicalExpression {
|
|
66
|
-
constructor(logicType, expressions, logics) {
|
|
67
|
-
this.type = logicType;
|
|
68
|
-
this.arithmeticExpressions = expressions;
|
|
69
|
-
this.logicalExpressions = logics;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.LogicalExpression = LogicalExpression;
|
|
73
|
-
class QueryV2 {
|
|
74
|
-
buildCriterion(filter) {
|
|
75
|
-
if (!filter || filter.arithmeticExpressions.length == 0 && filter.logicalExpressions.length == 0) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
var conditions = [];
|
|
79
|
-
filter.logicalExpressions.forEach((logicalExpression) => {
|
|
80
|
-
conditions.push({
|
|
81
|
-
[logicalExpression.type]: this.buildCriterion(logicalExpression),
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
filter.arithmeticExpressions.forEach((arithmeticExpression) => {
|
|
85
|
-
conditions.push(arithmeticExpression.expr);
|
|
86
|
-
});
|
|
87
|
-
return conditions;
|
|
88
|
-
}
|
|
89
|
-
where(condition) {
|
|
90
|
-
if (!condition) {
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
const { logicalExps, arithmeticExps } = logical([condition]);
|
|
94
|
-
logicalExps.forEach((logicalExpression) => {
|
|
95
|
-
if (this.filter) {
|
|
96
|
-
this.filter.logicalExpressions.push(logicalExpression);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
const logicalExpBuiltByArithmeticExps = new LogicalExpression(operator_1.operates.AND, arithmeticExps, []);
|
|
100
|
-
this.filter.logicalExpressions.push(logicalExpBuiltByArithmeticExps);
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
offset(offset) {
|
|
104
|
-
if (offset < 0) {
|
|
105
|
-
throw new Error('offset must be greater than or equal to 0');
|
|
106
|
-
}
|
|
107
|
-
this._offset = offset;
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
limit(limit) {
|
|
111
|
-
this._limit = limit;
|
|
112
|
-
this.isSetLimit = true;
|
|
113
|
-
return this;
|
|
114
|
-
}
|
|
115
|
-
orderBy(fieldApiNames) {
|
|
116
|
-
fieldApiNames.forEach((fieldApiName) => {
|
|
117
|
-
this._order.push({
|
|
118
|
-
field: fieldApiName,
|
|
119
|
-
direction: 'asc',
|
|
120
|
-
type: '',
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
orderByDesc(fieldApiNames) {
|
|
126
|
-
fieldApiNames.forEach((fieldApiName) => {
|
|
127
|
-
this._order.push({
|
|
128
|
-
field: fieldApiName,
|
|
129
|
-
direction: 'desc',
|
|
130
|
-
type: '',
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
select(fieldApiNames) {
|
|
136
|
-
fieldApiNames.forEach((fieldApiName) => {
|
|
137
|
-
this.fields.push(fieldApiName);
|
|
138
|
-
});
|
|
139
|
-
return this;
|
|
140
|
-
}
|
|
141
|
-
constructor(objectApiName) {
|
|
142
|
-
this.objectApiName = objectApiName;
|
|
143
|
-
this._limit = 200;
|
|
144
|
-
this._offset = 0;
|
|
145
|
-
this.fields = [];
|
|
146
|
-
this._order = [];
|
|
147
|
-
this.filter = {
|
|
148
|
-
type: 'and',
|
|
149
|
-
arithmeticExpressions: [],
|
|
150
|
-
logicalExpressions: [],
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.QueryV2 = QueryV2;
|
|
155
|
-
function logical(exps) {
|
|
156
|
-
if (!exps || exps.length == 0) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
var logicalExps = [];
|
|
160
|
-
var arithmeticExps = [];
|
|
161
|
-
exps.forEach((exp) => {
|
|
162
|
-
if (!exp) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (exp instanceof LogicalExpression) {
|
|
166
|
-
logicalExps.push(exp);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
for (var key in exp) {
|
|
170
|
-
if (exp[key]) {
|
|
171
|
-
arithmeticExps.push(new ArithmeticExpression(key, exp[key].operator, exp[key].right));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
return {
|
|
177
|
-
logicalExps: logicalExps,
|
|
178
|
-
arithmeticExps: arithmeticExps,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
exports.logical = logical;
|
|
182
|
-
function buildCriterionV2(filter) {
|
|
183
|
-
if (!filter || filter.logicalExpressions.length == 0 && filter.arithmeticExpressions.length == 0) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
var conditions = [];
|
|
187
|
-
filter.logicalExpressions.forEach((logicalExp) => {
|
|
188
|
-
conditions.push({
|
|
189
|
-
[logicalExp.type]: buildCriterionV2(logicalExp),
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
filter.arithmeticExpressions.forEach((arithmeticExp) => {
|
|
193
|
-
conditions.push(arithmeticExp.expr);
|
|
194
|
-
});
|
|
195
|
-
return conditions;
|
|
196
|
-
}
|
|
197
|
-
exports.buildCriterionV2 = buildCriterionV2;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { _Cond, _BooleanCond, _LogicalCond } from '../../../types/types';
|
|
2
|
-
import { IOperator } from '../IOperator';
|
|
3
|
-
import { UserDataType } from './expression';
|
|
4
|
-
export declare const operates: {
|
|
5
|
-
AND: string;
|
|
6
|
-
OR: string;
|
|
7
|
-
EMTPY: string;
|
|
8
|
-
NOT_EMTPY: string;
|
|
9
|
-
EQ: string;
|
|
10
|
-
NEQ: string;
|
|
11
|
-
LT: string;
|
|
12
|
-
LTE: string;
|
|
13
|
-
GT: string;
|
|
14
|
-
GTE: string;
|
|
15
|
-
CONTAIN: string;
|
|
16
|
-
NOT_CONTAIN: string;
|
|
17
|
-
IN: string;
|
|
18
|
-
NIN: string;
|
|
19
|
-
HAS_ANY_OF: string;
|
|
20
|
-
HAS_NONE_OF: string;
|
|
21
|
-
isOnOrBefore: string;
|
|
22
|
-
isOnOrAfter: string;
|
|
23
|
-
};
|
|
24
|
-
export declare class Operator<T> implements IOperator {
|
|
25
|
-
/**
|
|
26
|
-
* 逻辑且
|
|
27
|
-
* @param conditions 多个条件,用逗号分隔
|
|
28
|
-
* @example
|
|
29
|
-
* ```
|
|
30
|
-
* context.db.object('_user').where(kunlun.operator.and({
|
|
31
|
-
* age: '22'
|
|
32
|
-
* },{
|
|
33
|
-
* gender: 'male'
|
|
34
|
-
* }))
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
and<T>(...conditions: (_Cond<T> | _BooleanCond<T>)[]): _LogicalCond<T>;
|
|
38
|
-
/**
|
|
39
|
-
* 逻辑或
|
|
40
|
-
* @param conditions 多个条件,用逗号分隔
|
|
41
|
-
* @example
|
|
42
|
-
* ```
|
|
43
|
-
* context.db.object('_user').where(kunlun.operator.or({
|
|
44
|
-
* age: '22'
|
|
45
|
-
* },{
|
|
46
|
-
* age: '25'
|
|
47
|
-
* }))
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
or<T>(...conditions: (_Cond<T> | _BooleanCond<T>)[]): _LogicalCond<T>;
|
|
51
|
-
/**
|
|
52
|
-
* 包含
|
|
53
|
-
* @param value 判定是否包含的文本值
|
|
54
|
-
* @example
|
|
55
|
-
* ```
|
|
56
|
-
* context.db.object('_user').where({_name: kunlun.operator.contain('a')})
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
contain<T>(value: UserDataType): _BooleanCond<T>;
|
|
60
|
-
/**
|
|
61
|
-
* 不包含
|
|
62
|
-
* @param value 判定是否不包含的文本值
|
|
63
|
-
* @example
|
|
64
|
-
* ```
|
|
65
|
-
* context.db.object('_user').where({_name: kunlun.operator.notContain('a')})
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
notContain<T>(value: UserDataType): _BooleanCond<T>;
|
|
69
|
-
/**
|
|
70
|
-
* 无需入参,判断是否为空
|
|
71
|
-
* @example
|
|
72
|
-
* ```
|
|
73
|
-
* context.db.object('_user').where({employeeType: kunlun.operator.empty()})
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
empty(): _BooleanCond<undefined>;
|
|
77
|
-
/**
|
|
78
|
-
* 无需入参,判断是否为空
|
|
79
|
-
* @example
|
|
80
|
-
* ```
|
|
81
|
-
* context.db.object('_user').where({employeeType: kunlun.operator.notEmpty()})
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
notEmpty(): _BooleanCond<undefined>;
|
|
85
|
-
/**
|
|
86
|
-
* 等于
|
|
87
|
-
* @param value 判定是否相等的值
|
|
88
|
-
* @example
|
|
89
|
-
* ```
|
|
90
|
-
* context.db.object('_user').where({age: kunlun.operator.eq(20)})
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
eq<T>(value: UserDataType): _BooleanCond<T>;
|
|
94
|
-
/**
|
|
95
|
-
* 不等于
|
|
96
|
-
* @param value 判定是否不相等的值
|
|
97
|
-
* @example
|
|
98
|
-
* ```
|
|
99
|
-
* context.db.object('_user').where({age: kunlun.operator.neq(20)})
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
neq<T>(value: UserDataType): _BooleanCond<T>;
|
|
103
|
-
/**
|
|
104
|
-
* 大于或晚于
|
|
105
|
-
* @param value 判定是否大于或晚于的值
|
|
106
|
-
* @example
|
|
107
|
-
* ```
|
|
108
|
-
* kunlun.operator.gt(new Date('2020-11-26').getTime())
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
gt<T>(value: number | Date): _BooleanCond<T>;
|
|
112
|
-
/**
|
|
113
|
-
* 大于等于或晚于等于
|
|
114
|
-
* @param value 判定是否大于等于或晚于等于的值
|
|
115
|
-
* @example
|
|
116
|
-
* ```
|
|
117
|
-
* kunlun.operator.gte(new Date('2020-11-26').getTime())
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
gte<T>(value: number | Date): _BooleanCond<T>;
|
|
121
|
-
/**
|
|
122
|
-
* 小于或早于
|
|
123
|
-
* @param value 判定是否小于或早于的值
|
|
124
|
-
* @example
|
|
125
|
-
* ```
|
|
126
|
-
* kunlun.operator.lt(new Date('2020-11-26').getTime())
|
|
127
|
-
* ```
|
|
128
|
-
*/
|
|
129
|
-
lt<T>(value: number | Date): _BooleanCond<T>;
|
|
130
|
-
/**
|
|
131
|
-
* 小于等于或早于等于
|
|
132
|
-
* @param value 判定是否小于等于或早于等于的值
|
|
133
|
-
* @example
|
|
134
|
-
* ```
|
|
135
|
-
* kunlun.operator.lte(new Date('2020-11-26').getTime())
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
lte<T>(value: number | Date): _BooleanCond<T>;
|
|
139
|
-
/**
|
|
140
|
-
* 存在于给定的数组内
|
|
141
|
-
* @param values 判定是否存在于的一组值,用数组传递
|
|
142
|
-
*/
|
|
143
|
-
in<T>(values: T[]): _BooleanCond<T>;
|
|
144
|
-
/**
|
|
145
|
-
* 存在于给定的数组内
|
|
146
|
-
* @param values 判定是否存在于的一组值,用逗号分隔
|
|
147
|
-
*/
|
|
148
|
-
in<T>(...values: T[]): _BooleanCond<T>;
|
|
149
|
-
/**
|
|
150
|
-
* 不存在于给定的数组内
|
|
151
|
-
* @param values 判定是否不存在于的一组值,用数组传递
|
|
152
|
-
*/
|
|
153
|
-
notIn<T>(values: T[]): _BooleanCond<T>;
|
|
154
|
-
/**
|
|
155
|
-
* 不存在于给定的数组内
|
|
156
|
-
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
157
|
-
*/
|
|
158
|
-
notIn<T>(...values: T[]): _BooleanCond<T>;
|
|
159
|
-
/**
|
|
160
|
-
* 存在给定的多个值中的任何一个值
|
|
161
|
-
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
162
|
-
*/
|
|
163
|
-
hasAnyOf<T>(values: number[] | string[]): _BooleanCond<T>;
|
|
164
|
-
/**
|
|
165
|
-
* 存在给定的多个值中的任何一个值
|
|
166
|
-
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
167
|
-
*/
|
|
168
|
-
hasAnyOf<T>(...values: (number | string)[]): _BooleanCond<T>;
|
|
169
|
-
/**
|
|
170
|
-
* 不存在给定的多个值中的任何值
|
|
171
|
-
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
172
|
-
*/
|
|
173
|
-
hasNoneOf<T>(values: number[] | string[]): _BooleanCond<T>;
|
|
174
|
-
/**
|
|
175
|
-
* 不存在给定的多个值中的任何值
|
|
176
|
-
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
177
|
-
*/
|
|
178
|
-
hasNoneOf<T>(...values: (number | string)[]): _BooleanCond<T>;
|
|
179
|
-
}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2022 ByteDance Ltd. and/or its affiliates
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.Operator = exports.operates = void 0;
|
|
6
|
-
const server_common_node_1 = require("@byted-apaas/server-common-node");
|
|
7
|
-
const logic_1 = require("./logic");
|
|
8
|
-
exports.operates = {
|
|
9
|
-
AND: 'and',
|
|
10
|
-
OR: 'or',
|
|
11
|
-
EMTPY: 'isEmpty',
|
|
12
|
-
NOT_EMTPY: 'isNotEmpty',
|
|
13
|
-
EQ: 'equals',
|
|
14
|
-
NEQ: 'notEquals',
|
|
15
|
-
LT: 'lessThan',
|
|
16
|
-
LTE: 'lessThanOrEquals',
|
|
17
|
-
GT: 'greaterThan',
|
|
18
|
-
GTE: 'greaterThanOrEquals',
|
|
19
|
-
CONTAIN: 'contains',
|
|
20
|
-
NOT_CONTAIN: 'notContains',
|
|
21
|
-
IN: 'isAnyOf',
|
|
22
|
-
NIN: 'isNoneOf',
|
|
23
|
-
HAS_ANY_OF: 'hasAnyOf',
|
|
24
|
-
HAS_NONE_OF: 'hasNoneOf',
|
|
25
|
-
isOnOrBefore: 'isOnOrBefore',
|
|
26
|
-
isOnOrAfter: 'isOnOrAfter',
|
|
27
|
-
};
|
|
28
|
-
class Operator {
|
|
29
|
-
/**
|
|
30
|
-
* 逻辑且
|
|
31
|
-
* @param conditions 多个条件,用逗号分隔
|
|
32
|
-
* @example
|
|
33
|
-
* ```
|
|
34
|
-
* context.db.object('_user').where(kunlun.operator.and({
|
|
35
|
-
* age: '22'
|
|
36
|
-
* },{
|
|
37
|
-
* gender: 'male'
|
|
38
|
-
* }))
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
and(...conditions) {
|
|
42
|
-
if (conditions.length < 1) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return (0, logic_1.buildLogic)(conditions, exports.operates.AND);
|
|
46
|
-
}
|
|
47
|
-
;
|
|
48
|
-
/**
|
|
49
|
-
* 逻辑或
|
|
50
|
-
* @param conditions 多个条件,用逗号分隔
|
|
51
|
-
* @example
|
|
52
|
-
* ```
|
|
53
|
-
* context.db.object('_user').where(kunlun.operator.or({
|
|
54
|
-
* age: '22'
|
|
55
|
-
* },{
|
|
56
|
-
* age: '25'
|
|
57
|
-
* }))
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
or(...conditions) {
|
|
61
|
-
if (conditions.length < 1) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
return (0, logic_1.buildLogic)(conditions, exports.operates.OR);
|
|
65
|
-
}
|
|
66
|
-
;
|
|
67
|
-
/**
|
|
68
|
-
* 包含
|
|
69
|
-
* @param value 判定是否包含的文本值
|
|
70
|
-
* @example
|
|
71
|
-
* ```
|
|
72
|
-
* context.db.object('_user').where({_name: kunlun.operator.contain('a')})
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
contain(value) {
|
|
76
|
-
return new logic_1.Condition(null, value, exports.operates.CONTAIN);
|
|
77
|
-
}
|
|
78
|
-
;
|
|
79
|
-
/**
|
|
80
|
-
* 不包含
|
|
81
|
-
* @param value 判定是否不包含的文本值
|
|
82
|
-
* @example
|
|
83
|
-
* ```
|
|
84
|
-
* context.db.object('_user').where({_name: kunlun.operator.notContain('a')})
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
notContain(value) {
|
|
88
|
-
return new logic_1.Condition(null, value, exports.operates.NOT_CONTAIN);
|
|
89
|
-
}
|
|
90
|
-
;
|
|
91
|
-
/**
|
|
92
|
-
* 无需入参,判断是否为空
|
|
93
|
-
* @example
|
|
94
|
-
* ```
|
|
95
|
-
* context.db.object('_user').where({employeeType: kunlun.operator.empty()})
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
empty() {
|
|
99
|
-
return new logic_1.Condition(null, null, exports.operates.EMTPY);
|
|
100
|
-
}
|
|
101
|
-
;
|
|
102
|
-
/**
|
|
103
|
-
* 无需入参,判断是否为空
|
|
104
|
-
* @example
|
|
105
|
-
* ```
|
|
106
|
-
* context.db.object('_user').where({employeeType: kunlun.operator.notEmpty()})
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
notEmpty() {
|
|
110
|
-
return new logic_1.Condition(null, null, exports.operates.NOT_EMTPY);
|
|
111
|
-
}
|
|
112
|
-
;
|
|
113
|
-
/**
|
|
114
|
-
* 等于
|
|
115
|
-
* @param value 判定是否相等的值
|
|
116
|
-
* @example
|
|
117
|
-
* ```
|
|
118
|
-
* context.db.object('_user').where({age: kunlun.operator.eq(20)})
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
eq(value) {
|
|
122
|
-
return new logic_1.Condition(null, value, exports.operates.EQ);
|
|
123
|
-
}
|
|
124
|
-
;
|
|
125
|
-
/**
|
|
126
|
-
* 不等于
|
|
127
|
-
* @param value 判定是否不相等的值
|
|
128
|
-
* @example
|
|
129
|
-
* ```
|
|
130
|
-
* context.db.object('_user').where({age: kunlun.operator.neq(20)})
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
neq(value) {
|
|
134
|
-
return new logic_1.Condition(null, value, exports.operates.NEQ);
|
|
135
|
-
}
|
|
136
|
-
;
|
|
137
|
-
/**
|
|
138
|
-
* 大于或晚于
|
|
139
|
-
* @param value 判定是否大于或晚于的值
|
|
140
|
-
* @example
|
|
141
|
-
* ```
|
|
142
|
-
* kunlun.operator.gt(new Date('2020-11-26').getTime())
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
gt(value) {
|
|
146
|
-
return new logic_1.Condition(null, value, exports.operates.GT);
|
|
147
|
-
}
|
|
148
|
-
;
|
|
149
|
-
/**
|
|
150
|
-
* 大于等于或晚于等于
|
|
151
|
-
* @param value 判定是否大于等于或晚于等于的值
|
|
152
|
-
* @example
|
|
153
|
-
* ```
|
|
154
|
-
* kunlun.operator.gte(new Date('2020-11-26').getTime())
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
gte(value) {
|
|
158
|
-
return new logic_1.Condition(null, value, exports.operates.GTE);
|
|
159
|
-
}
|
|
160
|
-
;
|
|
161
|
-
/**
|
|
162
|
-
* 小于或早于
|
|
163
|
-
* @param value 判定是否小于或早于的值
|
|
164
|
-
* @example
|
|
165
|
-
* ```
|
|
166
|
-
* kunlun.operator.lt(new Date('2020-11-26').getTime())
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
lt(value) {
|
|
170
|
-
return new logic_1.Condition(null, value, exports.operates.LT);
|
|
171
|
-
}
|
|
172
|
-
;
|
|
173
|
-
/**
|
|
174
|
-
* 小于等于或早于等于
|
|
175
|
-
* @param value 判定是否小于等于或早于等于的值
|
|
176
|
-
* @example
|
|
177
|
-
* ```
|
|
178
|
-
* kunlun.operator.lte(new Date('2020-11-26').getTime())
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
|
-
lte(value) {
|
|
182
|
-
return new logic_1.Condition(null, value, exports.operates.LTE);
|
|
183
|
-
}
|
|
184
|
-
;
|
|
185
|
-
in(value, ...restValues) {
|
|
186
|
-
value = !value ? [] : value;
|
|
187
|
-
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
188
|
-
if (argList.length === 0) {
|
|
189
|
-
throw new server_common_node_1.exceptions.InvalidParamError('can not IN empty list');
|
|
190
|
-
}
|
|
191
|
-
return new logic_1.Condition(null, argList, exports.operates.IN);
|
|
192
|
-
}
|
|
193
|
-
;
|
|
194
|
-
notIn(value, ...restValues) {
|
|
195
|
-
value = !value ? [] : value;
|
|
196
|
-
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
197
|
-
if (argList.length === 0) {
|
|
198
|
-
throw new server_common_node_1.exceptions.InvalidParamError('can not NOT_IN empty list');
|
|
199
|
-
}
|
|
200
|
-
return new logic_1.Condition(null, argList, exports.operates.NIN);
|
|
201
|
-
}
|
|
202
|
-
;
|
|
203
|
-
hasAnyOf(value, ...restValues) {
|
|
204
|
-
value = !value ? [] : value;
|
|
205
|
-
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
206
|
-
if (argList.length === 0) {
|
|
207
|
-
throw new server_common_node_1.exceptions.InvalidParamError('can not HAS_ANY_OF empty list');
|
|
208
|
-
}
|
|
209
|
-
return new logic_1.Condition(null, argList, exports.operates.HAS_ANY_OF);
|
|
210
|
-
}
|
|
211
|
-
;
|
|
212
|
-
hasNoneOf(value, ...restValues) {
|
|
213
|
-
value = !value ? [] : value;
|
|
214
|
-
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
215
|
-
if (argList.length === 0) {
|
|
216
|
-
throw new server_common_node_1.exceptions.InvalidParamError('can not HAS_NONE_OF empty list');
|
|
217
|
-
}
|
|
218
|
-
return new logic_1.Condition(null, argList, exports.operates.HAS_NONE_OF);
|
|
219
|
-
}
|
|
220
|
-
;
|
|
221
|
-
}
|
|
222
|
-
exports.Operator = Operator;
|