@byted-apaas/server-sdk-node 1.1.23 → 1.1.24
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/application/application.d.ts +33 -0
- package/application/application.js +2 -0
- package/application/function/function.d.ts +14 -0
- package/application/function/function.js +20 -0
- package/application/impl/common.d.ts +2 -0
- package/application/impl/common.js +52 -0
- package/application/impl/impl.d.ts +19 -0
- package/application/impl/impl.js +45 -0
- package/common/structs.d.ts +15 -0
- package/common/structs.js +21 -0
- package/constants/constants.d.ts +13 -0
- package/constants/constants.js +18 -0
- package/context/context.d.ts +44 -0
- package/context/context.js +25 -0
- package/context/db/db.d.ts +110 -0
- package/context/db/db.js +2 -0
- package/context/db/impl/IObject.d.ts +303 -0
- package/context/db/impl/IObject.js +5 -0
- package/context/db/impl/IObjectV3.d.ts +239 -0
- package/context/db/impl/IObjectV3.js +5 -0
- package/context/db/impl/db.d.ts +62 -0
- package/context/db/impl/db.js +84 -0
- package/context/db/impl/dbV3.d.ts +35 -0
- package/context/db/impl/dbV3.js +50 -0
- package/context/db/impl/object.d.ts +123 -0
- package/context/db/impl/object.js +1008 -0
- package/context/db/impl/oql/ioql.d.ts +14 -0
- package/context/db/impl/oql/ioql.js +4 -0
- package/context/db/impl/oql/oql.d.ts +14 -0
- package/context/db/impl/oql/oql.js +39 -0
- package/context/db/impl/order.d.ts +9 -0
- package/context/db/impl/order.js +15 -0
- package/context/db/impl/propertiesStore.d.ts +8 -0
- package/context/db/impl/propertiesStore.js +29 -0
- package/context/db/impl/queryBuilder.d.ts +33 -0
- package/context/db/impl/queryBuilder.js +72 -0
- package/context/db/impl/transaction/index.d.ts +25 -0
- package/context/db/impl/transaction/index.js +300 -0
- package/context/db/impl/transaction/operation.d.ts +27 -0
- package/context/db/impl/transaction/operation.js +69 -0
- package/context/db/impl/transaction.d.ts +70 -0
- package/context/db/impl/transaction.js +4 -0
- package/context/globalConfig/globalConfig.d.ts +7 -0
- package/context/globalConfig/globalConfig.js +16 -0
- package/context/integration/IIntegration.d.ts +30 -0
- package/context/integration/IIntegration.js +4 -0
- package/context/integration/impl/integration.d.ts +16 -0
- package/context/integration/impl/integration.js +62 -0
- package/context/metadata/components/common.d.ts +6 -0
- package/context/metadata/components/common.js +17 -0
- package/context/metadata/components/components.d.ts +12 -0
- package/context/metadata/components/components.js +19 -0
- package/context/metadata/components/desktop/list.d.ts +16 -0
- package/context/metadata/components/desktop/list.js +402 -0
- package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
- package/context/metadata/components/desktop/recordDetail.js +53 -0
- package/context/metadata/components/mobile/list.d.ts +24 -0
- package/context/metadata/components/mobile/list.js +145 -0
- package/context/metadata/metadata.d.ts +63 -0
- package/context/metadata/metadata.js +125 -0
- package/context/metadata/objects/fields.d.ts +158 -0
- package/context/metadata/objects/fields.js +369 -0
- package/context/metadata/objects/fields.util.d.ts +52 -0
- package/context/metadata/objects/fields.util.js +420 -0
- package/context/metadata/objects/fieldsV3.d.ts +159 -0
- package/context/metadata/objects/fieldsV3.js +369 -0
- package/context/metadata/objects/objects.d.ts +11 -0
- package/context/metadata/objects/objects.js +20 -0
- package/context/metadata/types/common.d.ts +11 -0
- package/context/metadata/types/common.js +33 -0
- package/context/metadata/types/components.d.ts +90 -0
- package/context/metadata/types/components.js +4 -0
- package/context/metadata/types/objects.d.ts +246 -0
- package/context/metadata/types/objects.js +4 -0
- package/context/metadata/types/objectsV3.d.ts +128 -0
- package/context/metadata/types/objectsV3.js +4 -0
- package/context/msg/msg.d.ts +38 -0
- package/context/msg/msg.js +35 -0
- package/context/resources/IResources.d.ts +68 -0
- package/context/resources/IResources.js +2 -0
- package/context/resources/impl/resources.d.ts +42 -0
- package/context/resources/impl/resources.js +161 -0
- package/context/tasks/tasks.d.ts +33 -0
- package/context/tasks/tasks.js +139 -0
- package/data/index.d.ts +27 -0
- package/data/index.js +4 -0
- package/global/application/flow/flow.d.ts +99 -0
- package/global/application/flow/flow.js +8 -0
- package/global/application/flow/impl/flow.d.ts +20 -0
- package/global/application/flow/impl/flow.js +56 -0
- package/global/application/globalVar/globalVar.d.ts +7 -0
- package/global/application/globalVar/globalVar.js +2 -0
- package/global/global.d.ts +70 -0
- package/global/global.js +3 -0
- package/hooks/api.d.ts +65 -0
- package/hooks/api.js +347 -0
- package/hooks/hooks.d.ts +1 -0
- package/hooks/hooks.js +107 -0
- package/kunlun/kunlun.d.ts +55 -0
- package/kunlun/kunlun.js +58 -0
- package/kunlun/operator/IOperator.d.ts +158 -0
- package/kunlun/operator/IOperator.js +4 -0
- package/kunlun/operator/impl/expression.d.ts +75 -0
- package/kunlun/operator/impl/expression.js +96 -0
- package/kunlun/operator/impl/logic.d.ts +68 -0
- package/kunlun/operator/impl/logic.js +573 -0
- package/kunlun/operator/impl/logicV2.d.ts +59 -0
- package/kunlun/operator/impl/logicV2.js +197 -0
- package/kunlun/operator/impl/operator.d.ts +179 -0
- package/kunlun/operator/impl/operator.js +222 -0
- package/kunlun/operator/impl/operatorV2.d.ts +180 -0
- package/kunlun/operator/impl/operatorV2.js +216 -0
- package/lib/core.d.ts +4 -0
- package/lib/core.js +19 -0
- package/package.json +1 -1
- package/request/common.d.ts +13 -0
- package/request/common.js +88 -0
- package/request/constants.d.ts +12 -0
- package/request/constants.js +29 -0
- package/request/faasinfra.d.ts +8 -0
- package/request/faasinfra.js +146 -0
- package/request/interface.d.ts +121 -0
- package/request/interface.js +30 -0
- package/request/openapi.d.ts +84 -0
- package/request/openapi.js +1529 -0
- package/request/structs.d.ts +99 -0
- package/request/structs.js +15 -0
- package/types/types.d.ts +79 -0
- package/types/types.js +4 -0
- package/version/version.d.ts +2 -0
- package/version/version.js +8 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { _Cond, _BooleanCond } from '../../../types/types';
|
|
2
|
+
import { IOperator } from '../IOperator';
|
|
3
|
+
import { LogicalExpression } from './logicV2';
|
|
4
|
+
import { UserDataType } from './expression';
|
|
5
|
+
export declare const operates: {
|
|
6
|
+
AND: string;
|
|
7
|
+
OR: string;
|
|
8
|
+
EMPTY: string;
|
|
9
|
+
NOT_EMPTY: string;
|
|
10
|
+
EQ: string;
|
|
11
|
+
NEQ: string;
|
|
12
|
+
LT: string;
|
|
13
|
+
LTE: string;
|
|
14
|
+
GT: string;
|
|
15
|
+
GTE: string;
|
|
16
|
+
CONTAIN: string;
|
|
17
|
+
NOT_CONTAIN: string;
|
|
18
|
+
IN: string;
|
|
19
|
+
NIN: string;
|
|
20
|
+
HAS_ANY_OF: string;
|
|
21
|
+
HAS_NONE_OF: string;
|
|
22
|
+
isOnOrBefore: string;
|
|
23
|
+
isOnOrAfter: string;
|
|
24
|
+
};
|
|
25
|
+
export declare class OperatorV2<T> implements IOperator {
|
|
26
|
+
/**
|
|
27
|
+
* 逻辑且
|
|
28
|
+
* @param conditions 多个条件,用逗号分隔
|
|
29
|
+
* @example
|
|
30
|
+
* ```
|
|
31
|
+
* context.db.object('_user').where(kunlun.operator.and({
|
|
32
|
+
* age: '22'
|
|
33
|
+
* },{
|
|
34
|
+
* gender: 'male'
|
|
35
|
+
* }))
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
and<T>(...exps: (_Cond<T> | _BooleanCond<T> | LogicalExpression)[]): LogicalExpression;
|
|
39
|
+
/**
|
|
40
|
+
* 逻辑或
|
|
41
|
+
* @param conditions 多个条件,用逗号分隔
|
|
42
|
+
* @example
|
|
43
|
+
* ```
|
|
44
|
+
* context.db.object('_user').where(kunlun.operator.or({
|
|
45
|
+
* age: '22'
|
|
46
|
+
* },{
|
|
47
|
+
* age: '25'
|
|
48
|
+
* }))
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
or<T>(...exps: (_Cond<T> | _BooleanCond<T> | LogicalExpression)[]): LogicalExpression;
|
|
52
|
+
/**
|
|
53
|
+
* 包含
|
|
54
|
+
* @param value 判定是否包含的文本值
|
|
55
|
+
* @example
|
|
56
|
+
* ```
|
|
57
|
+
* context.db.object('_user').where({_name: kunlun.operator.contain('a')})
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
contain<T>(value: UserDataType): _BooleanCond<T>;
|
|
61
|
+
/**
|
|
62
|
+
* 不包含
|
|
63
|
+
* @param value 判定是否不包含的文本值
|
|
64
|
+
* @example
|
|
65
|
+
* ```
|
|
66
|
+
* context.db.object('_user').where({_name: kunlun.operator.notContain('a')})
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
notContain<T>(value: UserDataType): _BooleanCond<T>;
|
|
70
|
+
/**
|
|
71
|
+
* 无需入参,判断是否为空
|
|
72
|
+
* @example
|
|
73
|
+
* ```
|
|
74
|
+
* context.db.object('_user').where({employeeType: kunlun.operator.empty()})
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
empty(): _BooleanCond<undefined>;
|
|
78
|
+
/**
|
|
79
|
+
* 无需入参,判断是否为空
|
|
80
|
+
* @example
|
|
81
|
+
* ```
|
|
82
|
+
* context.db.object('_user').where({employeeType: kunlun.operator.notEmpty()})
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
notEmpty(): _BooleanCond<undefined>;
|
|
86
|
+
/**
|
|
87
|
+
* 等于
|
|
88
|
+
* @param value 判定是否相等的值
|
|
89
|
+
* @example
|
|
90
|
+
* ```
|
|
91
|
+
* context.db.object('_user').where({age: kunlun.operator.eq(20)})
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
eq<T>(value: UserDataType): _BooleanCond<T>;
|
|
95
|
+
/**
|
|
96
|
+
* 不等于
|
|
97
|
+
* @param value 判定是否不相等的值
|
|
98
|
+
* @example
|
|
99
|
+
* ```
|
|
100
|
+
* context.db.object('_user').where({age: kunlun.operator.neq(20)})
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
neq<T>(value: UserDataType): _BooleanCond<T>;
|
|
104
|
+
/**
|
|
105
|
+
* 大于或晚于
|
|
106
|
+
* @param value 判定是否大于或晚于的值
|
|
107
|
+
* @example
|
|
108
|
+
* ```
|
|
109
|
+
* kunlun.operator.gt(new Date('2020-11-26').getTime())
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
gt<T>(value: number | Date): _BooleanCond<T>;
|
|
113
|
+
/**
|
|
114
|
+
* 大于等于或晚于等于
|
|
115
|
+
* @param value 判定是否大于等于或晚于等于的值
|
|
116
|
+
* @example
|
|
117
|
+
* ```
|
|
118
|
+
* kunlun.operator.gte(new Date('2020-11-26').getTime())
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
gte<T>(value: number | Date): _BooleanCond<T>;
|
|
122
|
+
/**
|
|
123
|
+
* 小于或早于
|
|
124
|
+
* @param value 判定是否小于或早于的值
|
|
125
|
+
* @example
|
|
126
|
+
* ```
|
|
127
|
+
* kunlun.operator.lt(new Date('2020-11-26').getTime())
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
lt<T>(value: number | Date): _BooleanCond<T>;
|
|
131
|
+
/**
|
|
132
|
+
* 小于等于或早于等于
|
|
133
|
+
* @param value 判定是否小于等于或早于等于的值
|
|
134
|
+
* @example
|
|
135
|
+
* ```
|
|
136
|
+
* kunlun.operator.lte(new Date('2020-11-26').getTime())
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
lte<T>(value: number | Date): _BooleanCond<T>;
|
|
140
|
+
/**
|
|
141
|
+
* 存在于给定的数组内
|
|
142
|
+
* @param values 判定是否存在于的一组值,用数组传递
|
|
143
|
+
*/
|
|
144
|
+
in<T>(values: T[]): _BooleanCond<T>;
|
|
145
|
+
/**
|
|
146
|
+
* 存在于给定的数组内
|
|
147
|
+
* @param values 判定是否存在于的一组值,用逗号分隔
|
|
148
|
+
*/
|
|
149
|
+
in<T>(...values: T[]): _BooleanCond<T>;
|
|
150
|
+
/**
|
|
151
|
+
* 不存在于给定的数组内
|
|
152
|
+
* @param values 判定是否不存在于的一组值,用数组传递
|
|
153
|
+
*/
|
|
154
|
+
notIn<T>(values: T[]): _BooleanCond<T>;
|
|
155
|
+
/**
|
|
156
|
+
* 不存在于给定的数组内
|
|
157
|
+
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
158
|
+
*/
|
|
159
|
+
notIn<T>(...values: T[]): _BooleanCond<T>;
|
|
160
|
+
/**
|
|
161
|
+
* 存在给定的多个值中的任何一个值
|
|
162
|
+
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
163
|
+
*/
|
|
164
|
+
hasAnyOf<T>(values: number[] | string[]): _BooleanCond<T>;
|
|
165
|
+
/**
|
|
166
|
+
* 存在给定的多个值中的任何一个值
|
|
167
|
+
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
168
|
+
*/
|
|
169
|
+
hasAnyOf<T>(...values: (number | string)[]): _BooleanCond<T>;
|
|
170
|
+
/**
|
|
171
|
+
* 不存在给定的多个值中的任何值
|
|
172
|
+
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
173
|
+
*/
|
|
174
|
+
hasNoneOf<T>(values: number[] | string[]): _BooleanCond<T>;
|
|
175
|
+
/**
|
|
176
|
+
* 不存在给定的多个值中的任何值
|
|
177
|
+
* @param values 判定是否不存在于的一组值,用逗号分隔
|
|
178
|
+
*/
|
|
179
|
+
hasNoneOf<T>(...values: (number | string)[]): _BooleanCond<T>;
|
|
180
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OperatorV2 = exports.operates = void 0;
|
|
4
|
+
const server_common_node_1 = require("@byted-apaas/server-common-node");
|
|
5
|
+
const logicV2_1 = require("./logicV2");
|
|
6
|
+
exports.operates = {
|
|
7
|
+
AND: 'and',
|
|
8
|
+
OR: 'or',
|
|
9
|
+
EMPTY: 'isEmpty',
|
|
10
|
+
NOT_EMPTY: 'isNotEmpty',
|
|
11
|
+
EQ: 'equals',
|
|
12
|
+
NEQ: 'notEquals',
|
|
13
|
+
LT: 'lessThan',
|
|
14
|
+
LTE: 'lessThanOrEquals',
|
|
15
|
+
GT: 'greaterThan',
|
|
16
|
+
GTE: 'greaterThanOrEquals',
|
|
17
|
+
CONTAIN: 'contains',
|
|
18
|
+
NOT_CONTAIN: 'notContains',
|
|
19
|
+
IN: 'isAnyOf',
|
|
20
|
+
NIN: 'isNoneOf',
|
|
21
|
+
HAS_ANY_OF: 'hasAnyOf',
|
|
22
|
+
HAS_NONE_OF: 'hasNoneOf',
|
|
23
|
+
isOnOrBefore: 'lt',
|
|
24
|
+
isOnOrAfter: 'gt',
|
|
25
|
+
};
|
|
26
|
+
class OperatorV2 {
|
|
27
|
+
/**
|
|
28
|
+
* 逻辑且
|
|
29
|
+
* @param conditions 多个条件,用逗号分隔
|
|
30
|
+
* @example
|
|
31
|
+
* ```
|
|
32
|
+
* context.db.object('_user').where(kunlun.operator.and({
|
|
33
|
+
* age: '22'
|
|
34
|
+
* },{
|
|
35
|
+
* gender: 'male'
|
|
36
|
+
* }))
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
and(...exps) {
|
|
40
|
+
const { logicalExps, arithmeticExps } = (0, logicV2_1.logical)(exps);
|
|
41
|
+
return new logicV2_1.LogicalExpression(exports.operates.AND, arithmeticExps, logicalExps);
|
|
42
|
+
}
|
|
43
|
+
;
|
|
44
|
+
/**
|
|
45
|
+
* 逻辑或
|
|
46
|
+
* @param conditions 多个条件,用逗号分隔
|
|
47
|
+
* @example
|
|
48
|
+
* ```
|
|
49
|
+
* context.db.object('_user').where(kunlun.operator.or({
|
|
50
|
+
* age: '22'
|
|
51
|
+
* },{
|
|
52
|
+
* age: '25'
|
|
53
|
+
* }))
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
or(...exps) {
|
|
57
|
+
const { logicalExps, arithmeticExps } = (0, logicV2_1.logical)(exps);
|
|
58
|
+
return new logicV2_1.LogicalExpression(exports.operates.OR, arithmeticExps, logicalExps);
|
|
59
|
+
}
|
|
60
|
+
;
|
|
61
|
+
/**
|
|
62
|
+
* 包含
|
|
63
|
+
* @param value 判定是否包含的文本值
|
|
64
|
+
* @example
|
|
65
|
+
* ```
|
|
66
|
+
* context.db.object('_user').where({_name: kunlun.operator.contain('a')})
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
contain(value) {
|
|
70
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.CONTAIN, value);
|
|
71
|
+
}
|
|
72
|
+
;
|
|
73
|
+
/**
|
|
74
|
+
* 不包含
|
|
75
|
+
* @param value 判定是否不包含的文本值
|
|
76
|
+
* @example
|
|
77
|
+
* ```
|
|
78
|
+
* context.db.object('_user').where({_name: kunlun.operator.notContain('a')})
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
notContain(value) {
|
|
82
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.NOT_CONTAIN, value);
|
|
83
|
+
}
|
|
84
|
+
;
|
|
85
|
+
/**
|
|
86
|
+
* 无需入参,判断是否为空
|
|
87
|
+
* @example
|
|
88
|
+
* ```
|
|
89
|
+
* context.db.object('_user').where({employeeType: kunlun.operator.empty()})
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
empty() {
|
|
93
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.EMPTY, null);
|
|
94
|
+
}
|
|
95
|
+
;
|
|
96
|
+
/**
|
|
97
|
+
* 无需入参,判断是否为空
|
|
98
|
+
* @example
|
|
99
|
+
* ```
|
|
100
|
+
* context.db.object('_user').where({employeeType: kunlun.operator.notEmpty()})
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
notEmpty() {
|
|
104
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.NOT_EMPTY, null);
|
|
105
|
+
}
|
|
106
|
+
;
|
|
107
|
+
/**
|
|
108
|
+
* 等于
|
|
109
|
+
* @param value 判定是否相等的值
|
|
110
|
+
* @example
|
|
111
|
+
* ```
|
|
112
|
+
* context.db.object('_user').where({age: kunlun.operator.eq(20)})
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
eq(value) {
|
|
116
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.EQ, value);
|
|
117
|
+
}
|
|
118
|
+
;
|
|
119
|
+
/**
|
|
120
|
+
* 不等于
|
|
121
|
+
* @param value 判定是否不相等的值
|
|
122
|
+
* @example
|
|
123
|
+
* ```
|
|
124
|
+
* context.db.object('_user').where({age: kunlun.operator.neq(20)})
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
neq(value) {
|
|
128
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.NEQ, value);
|
|
129
|
+
}
|
|
130
|
+
;
|
|
131
|
+
/**
|
|
132
|
+
* 大于或晚于
|
|
133
|
+
* @param value 判定是否大于或晚于的值
|
|
134
|
+
* @example
|
|
135
|
+
* ```
|
|
136
|
+
* kunlun.operator.gt(new Date('2020-11-26').getTime())
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
gt(value) {
|
|
140
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.GT, value);
|
|
141
|
+
}
|
|
142
|
+
;
|
|
143
|
+
/**
|
|
144
|
+
* 大于等于或晚于等于
|
|
145
|
+
* @param value 判定是否大于等于或晚于等于的值
|
|
146
|
+
* @example
|
|
147
|
+
* ```
|
|
148
|
+
* kunlun.operator.gte(new Date('2020-11-26').getTime())
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
gte(value) {
|
|
152
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.GTE, value);
|
|
153
|
+
}
|
|
154
|
+
;
|
|
155
|
+
/**
|
|
156
|
+
* 小于或早于
|
|
157
|
+
* @param value 判定是否小于或早于的值
|
|
158
|
+
* @example
|
|
159
|
+
* ```
|
|
160
|
+
* kunlun.operator.lt(new Date('2020-11-26').getTime())
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
lt(value) {
|
|
164
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.LT, value);
|
|
165
|
+
}
|
|
166
|
+
;
|
|
167
|
+
/**
|
|
168
|
+
* 小于等于或早于等于
|
|
169
|
+
* @param value 判定是否小于等于或早于等于的值
|
|
170
|
+
* @example
|
|
171
|
+
* ```
|
|
172
|
+
* kunlun.operator.lte(new Date('2020-11-26').getTime())
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
lte(value) {
|
|
176
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.LTE, value);
|
|
177
|
+
}
|
|
178
|
+
;
|
|
179
|
+
in(value, ...restValues) {
|
|
180
|
+
value = !value ? [] : value;
|
|
181
|
+
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
182
|
+
if (argList.length === 0) {
|
|
183
|
+
throw new server_common_node_1.exceptions.InvalidParamError('can not IN empty list');
|
|
184
|
+
}
|
|
185
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.IN, argList);
|
|
186
|
+
}
|
|
187
|
+
;
|
|
188
|
+
notIn(value, ...restValues) {
|
|
189
|
+
value = !value ? [] : value;
|
|
190
|
+
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
191
|
+
if (argList.length === 0) {
|
|
192
|
+
throw new server_common_node_1.exceptions.InvalidParamError('can not NOT_IN empty list');
|
|
193
|
+
}
|
|
194
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.NIN, argList);
|
|
195
|
+
}
|
|
196
|
+
;
|
|
197
|
+
hasAnyOf(value, ...restValues) {
|
|
198
|
+
value = !value ? [] : value;
|
|
199
|
+
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
200
|
+
if (argList.length === 0) {
|
|
201
|
+
throw new server_common_node_1.exceptions.InvalidParamError('can not HAS_ANY_OF empty list');
|
|
202
|
+
}
|
|
203
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.HAS_ANY_OF, argList);
|
|
204
|
+
}
|
|
205
|
+
;
|
|
206
|
+
hasNoneOf(value, ...restValues) {
|
|
207
|
+
value = !value ? [] : value;
|
|
208
|
+
const argList = server_common_node_1.utils.argsToList(value, restValues);
|
|
209
|
+
if (argList.length === 0) {
|
|
210
|
+
throw new server_common_node_1.exceptions.InvalidParamError('can not HAS_NONE_OF empty list');
|
|
211
|
+
}
|
|
212
|
+
return new logicV2_1.ArithmeticExpression(null, exports.operates.HAS_NONE_OF, argList);
|
|
213
|
+
}
|
|
214
|
+
;
|
|
215
|
+
}
|
|
216
|
+
exports.OperatorV2 = OperatorV2;
|
package/lib/core.d.ts
ADDED
package/lib/core.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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.Application = exports.metaData = exports.workflow = exports.microservice = exports.cloudfunction = exports.tasks = exports.msg = exports.resources = exports.db = exports.kunlun = exports.isNewSystemProxyFunc = exports.hooks = void 0;
|
|
6
|
+
exports.hooks = require("../hooks/hooks");
|
|
7
|
+
exports.isNewSystemProxyFunc = true;
|
|
8
|
+
var kunlun_1 = require("../kunlun/kunlun");
|
|
9
|
+
Object.defineProperty(exports, "kunlun", { enumerable: true, get: function () { return kunlun_1.kunlun; } });
|
|
10
|
+
var api_1 = require("../hooks/api");
|
|
11
|
+
Object.defineProperty(exports, "db", { enumerable: true, get: function () { return api_1.db; } });
|
|
12
|
+
Object.defineProperty(exports, "resources", { enumerable: true, get: function () { return api_1.resources; } });
|
|
13
|
+
Object.defineProperty(exports, "msg", { enumerable: true, get: function () { return api_1.msg; } });
|
|
14
|
+
Object.defineProperty(exports, "tasks", { enumerable: true, get: function () { return api_1.tasks; } });
|
|
15
|
+
Object.defineProperty(exports, "cloudfunction", { enumerable: true, get: function () { return api_1.cloudfunction; } });
|
|
16
|
+
Object.defineProperty(exports, "microservice", { enumerable: true, get: function () { return api_1.microservice; } });
|
|
17
|
+
Object.defineProperty(exports, "workflow", { enumerable: true, get: function () { return api_1.workflow; } });
|
|
18
|
+
Object.defineProperty(exports, "metaData", { enumerable: true, get: function () { return api_1.metaData; } });
|
|
19
|
+
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return api_1.Application; } });
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppCtx } from '../application/application';
|
|
2
|
+
export declare function getDebugExtraInfo(): Record<string, string>;
|
|
3
|
+
export declare function getTriggerCtx(): any;
|
|
4
|
+
export declare function transMapToFlowVariable(params: Record<string, any>): {
|
|
5
|
+
api_name: string;
|
|
6
|
+
value: any;
|
|
7
|
+
}[];
|
|
8
|
+
export declare function transFlowVariableToMap(variables: {
|
|
9
|
+
api_name: string;
|
|
10
|
+
value: any;
|
|
11
|
+
}[]): Record<string, any>;
|
|
12
|
+
export declare function getTenantInfo(appCtx: AppCtx): Promise<any>;
|
|
13
|
+
export declare function getNamespaceForOpenAndFaaSSDK(): Promise<string>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNamespaceForOpenAndFaaSSDK = exports.getTenantInfo = exports.transFlowVariableToMap = exports.transMapToFlowVariable = exports.getTriggerCtx = exports.getDebugExtraInfo = void 0;
|
|
4
|
+
const constants_1 = require("@byted-apaas/server-common-node/constants/constants");
|
|
5
|
+
const common = require("@byted-apaas/server-common-node");
|
|
6
|
+
const interface_1 = require("./interface");
|
|
7
|
+
const credential_1 = require("@byted-apaas/server-common-node/credential/credential");
|
|
8
|
+
const exceptions_1 = require("@byted-apaas/server-common-node/utils/exceptions");
|
|
9
|
+
const common_1 = require("../application/impl/common");
|
|
10
|
+
const utils = common.utils;
|
|
11
|
+
const checkUtils = common.checkUtils;
|
|
12
|
+
const exceptions = common.exceptions;
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
14
|
+
const nodeCls = require('node-cls');
|
|
15
|
+
function checkLoopCtx(reqCtx) {
|
|
16
|
+
return reqCtx && reqCtx.loopMasks && Array.isArray(reqCtx.loopMasks);
|
|
17
|
+
}
|
|
18
|
+
function getDebugExtraInfo() {
|
|
19
|
+
let extra = {
|
|
20
|
+
'FunctionFrameVersion': 'FunctionFrameV2',
|
|
21
|
+
};
|
|
22
|
+
if (utils.isDebug()) {
|
|
23
|
+
extra.DebugInfo = utils.getDebugCode();
|
|
24
|
+
}
|
|
25
|
+
return extra;
|
|
26
|
+
}
|
|
27
|
+
exports.getDebugExtraInfo = getDebugExtraInfo;
|
|
28
|
+
function getTriggerCtx() {
|
|
29
|
+
let triggerCtx = {}, taskID = utils.getTriggerTaskID();
|
|
30
|
+
if (taskID) {
|
|
31
|
+
triggerCtx[constants_1.headers.triggerTaskId] = taskID;
|
|
32
|
+
}
|
|
33
|
+
let temp = utils.getDistributedHandleMask();
|
|
34
|
+
if (temp) {
|
|
35
|
+
triggerCtx[constants_1.headers.distributedHandleMask] = temp;
|
|
36
|
+
}
|
|
37
|
+
let reqCtx = nodeCls.get(constants_1.headers.loopCtxKey);
|
|
38
|
+
if (checkLoopCtx(reqCtx)) {
|
|
39
|
+
triggerCtx[constants_1.headers.loopMasks] = reqCtx.loopMasks;
|
|
40
|
+
}
|
|
41
|
+
return triggerCtx;
|
|
42
|
+
}
|
|
43
|
+
exports.getTriggerCtx = getTriggerCtx;
|
|
44
|
+
function transMapToFlowVariable(params) {
|
|
45
|
+
let variables = [];
|
|
46
|
+
if (params) {
|
|
47
|
+
if (checkUtils.isNotObject(params)) {
|
|
48
|
+
throw new exceptions.InvalidParamError(`params should be object, and not array`);
|
|
49
|
+
}
|
|
50
|
+
for (const [k, v] of Object.entries(params)) {
|
|
51
|
+
variables.push({ api_name: k, value: v });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return variables;
|
|
55
|
+
}
|
|
56
|
+
exports.transMapToFlowVariable = transMapToFlowVariable;
|
|
57
|
+
function transFlowVariableToMap(variables) {
|
|
58
|
+
let data = {};
|
|
59
|
+
if (variables && Array.isArray(variables)) {
|
|
60
|
+
for (const o of variables) {
|
|
61
|
+
data[o.api_name] = o.value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
exports.transFlowVariableToMap = transFlowVariableToMap;
|
|
67
|
+
async function getTenantInfo(appCtx) {
|
|
68
|
+
if (!appCtx) {
|
|
69
|
+
appCtx = {
|
|
70
|
+
mode: 'faasSDK',
|
|
71
|
+
credential: new credential_1.AppCredential(utils.getClientId(), utils.getClientSecret(), true)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (!appCtx.credential) {
|
|
75
|
+
throw new exceptions_1.InvalidParamError(`credential is empty`);
|
|
76
|
+
}
|
|
77
|
+
return await (0, common_1.runCtxForOpenSDK)(appCtx, async () => {
|
|
78
|
+
return await (0, interface_1.GetInstance)().getTenantInfo(appCtx);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
exports.getTenantInfo = getTenantInfo;
|
|
82
|
+
async function getNamespaceForOpenAndFaaSSDK() {
|
|
83
|
+
if (utils.isOpenSDKMode()) { // TODO check need assign?
|
|
84
|
+
return (await utils.getCredential().getTenantInfo()).namespace;
|
|
85
|
+
}
|
|
86
|
+
return utils.getNamespaceFromCtx();
|
|
87
|
+
}
|
|
88
|
+
exports.getNamespaceForOpenAndFaaSSDK = getNamespaceForOpenAndFaaSSDK;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GetHttpConfig, PostHttpConfig } from '@byted-apaas/server-common-node/http/config';
|
|
2
|
+
export declare const metricsMethodKeys: Record<string, string>;
|
|
3
|
+
export declare const openapiHttpPath: {
|
|
4
|
+
getBatchAttachmentToken: PostHttpConfig;
|
|
5
|
+
oql: PostHttpConfig;
|
|
6
|
+
getExecutionUserTaskInfo: GetHttpConfig;
|
|
7
|
+
executeFlow: PostHttpConfig;
|
|
8
|
+
revokeExecution: PostHttpConfig;
|
|
9
|
+
getExecutionInfo: GetHttpConfig;
|
|
10
|
+
getApprovalInstanceList: GetHttpConfig;
|
|
11
|
+
getApprovalInstance: GetHttpConfig;
|
|
12
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openapiHttpPath = exports.metricsMethodKeys = void 0;
|
|
4
|
+
const config_1 = require("@byted-apaas/server-common-node/http/config");
|
|
5
|
+
const constants_1 = require("@byted-apaas/server-common-node/http/constants");
|
|
6
|
+
exports.metricsMethodKeys = {
|
|
7
|
+
// openapi
|
|
8
|
+
// file upload & download
|
|
9
|
+
getBatchAttachmentToken: 'openapi_getBatchAttachmentToken',
|
|
10
|
+
oql: 'openapi_oql',
|
|
11
|
+
// flow
|
|
12
|
+
getExecutionUserTaskInfo: 'openapi_getExecutionUserTaskInfo',
|
|
13
|
+
getExecutionInfo: 'openapi_getExecutionInfo',
|
|
14
|
+
revokeExecution: 'openapi_revokeExecution',
|
|
15
|
+
executeFlow: 'openapi_executeFlow',
|
|
16
|
+
getApprovalInstanceList: 'openapi_getApprovalInstanceList',
|
|
17
|
+
getApprovalInstance: 'openapi_getApprovalInstance',
|
|
18
|
+
};
|
|
19
|
+
exports.openapiHttpPath = {
|
|
20
|
+
getBatchAttachmentToken: new config_1.PostHttpConfig(`/attachment/v1/getBatchAttachmentToken`, exports.metricsMethodKeys.getBatchAttachmentToken),
|
|
21
|
+
oql: new config_1.PostHttpConfig(`/data/v5/namespaces/${constants_1.replaceKeys.namespace}/records/query`, exports.metricsMethodKeys.oql),
|
|
22
|
+
// flow
|
|
23
|
+
getExecutionUserTaskInfo: new config_1.GetHttpConfig(`/api/flow/v1/namespaces/${constants_1.replaceKeys.namespace}/executions/${constants_1.replaceKeys.id}/userTaskInfo`, exports.metricsMethodKeys.getExecutionUserTaskInfo),
|
|
24
|
+
executeFlow: new config_1.PostHttpConfig(`/api/flow/v1/namespaces/${constants_1.replaceKeys.namespace}/flows/${constants_1.replaceKeys.apiName}/execute`, exports.metricsMethodKeys.executeFlow),
|
|
25
|
+
revokeExecution: new config_1.PostHttpConfig(`/api/flow/v1/namespaces/${constants_1.replaceKeys.namespace}/executions/${constants_1.replaceKeys.id}/revoke`, exports.metricsMethodKeys.revokeExecution),
|
|
26
|
+
getExecutionInfo: new config_1.GetHttpConfig(`/api/flow/v1/namespaces/${constants_1.replaceKeys.namespace}/executions/${constants_1.replaceKeys.id}/detail`, exports.metricsMethodKeys.getExecutionInfo),
|
|
27
|
+
getApprovalInstanceList: new config_1.GetHttpConfig(`/api/approval/v1/approval_instances/listids`, exports.metricsMethodKeys.getApprovalInstanceList),
|
|
28
|
+
getApprovalInstance: new config_1.GetHttpConfig(`/api/approval/v1/approval_instances/${constants_1.replaceKeys.id}`, exports.metricsMethodKeys.getApprovalInstance),
|
|
29
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFaaSInfraRequest } from './interface';
|
|
2
|
+
export declare class FaaSInfraRequest implements IFaaSInfraRequest {
|
|
3
|
+
constructor();
|
|
4
|
+
createDistributeTaskV1(dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any): Promise<any>;
|
|
5
|
+
createDistributeTaskV2(dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any): Promise<any>;
|
|
6
|
+
invokeMicroserviceSync(apiName: string, path: string, method: string, body: any): Promise<any>;
|
|
7
|
+
invokeMicroserviceAsync(apiName: string, path: string, method: string, body: any): Promise<any>;
|
|
8
|
+
}
|