@byted-apaas/server-sdk-node 0.0.2-beta.2 → 0.0.2-beta.3

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.
Files changed (163) hide show
  1. package/LICENSE +7 -0
  2. package/NOTICE +3 -0
  3. package/application/application.js +0 -1
  4. package/application/function/function.js +0 -1
  5. package/application/impl/common.js +0 -1
  6. package/application/impl/impl.js +2 -2
  7. package/constants/constants.js +2 -1
  8. package/context/context.js +2 -1
  9. package/context/db/db.js +2 -1
  10. package/context/db/impl/IObject.js +2 -1
  11. package/context/db/impl/db.js +0 -1
  12. package/context/db/impl/object.js +2 -1
  13. package/context/db/impl/oql/ioql.js +2 -1
  14. package/context/db/impl/oql/oql.js +2 -1
  15. package/context/db/impl/order.js +2 -1
  16. package/context/db/impl/propertiesStore.js +2 -1
  17. package/context/db/impl/queryBuilder.js +2 -1
  18. package/context/db/impl/transaction/index.js +2 -1
  19. package/context/db/impl/transaction/operation.js +0 -1
  20. package/context/db/impl/transaction.js +2 -1
  21. package/context/globalConfig/globalConfig.js +2 -1
  22. package/context/metadata/components/common.js +2 -1
  23. package/context/metadata/components/components.js +2 -1
  24. package/context/metadata/components/desktop/list.js +0 -1
  25. package/context/metadata/components/desktop/recordDetail.js +2 -1
  26. package/context/metadata/components/mobile/list.js +2 -1
  27. package/context/metadata/metadata.js +2 -1
  28. package/context/metadata/objects/fields.js +2 -1
  29. package/context/metadata/objects/fields.util.js +0 -1
  30. package/context/metadata/objects/objects.js +2 -1
  31. package/context/metadata/types/common.js +2 -1
  32. package/context/metadata/types/components.js +2 -1
  33. package/context/metadata/types/objects.js +2 -1
  34. package/context/msg/msg.js +2 -1
  35. package/context/resources/IResources.js +0 -1
  36. package/context/resources/impl/resources.js +2 -1
  37. package/context/tasks/tasks.js +0 -1
  38. package/data/index.js +0 -1
  39. package/hooks/api.js +0 -1
  40. package/hooks/hooks.js +0 -1
  41. package/kunlun/kunlun.js +2 -1
  42. package/kunlun/operator/IOperator.js +2 -1
  43. package/kunlun/operator/impl/expression.js +2 -1
  44. package/kunlun/operator/impl/logic.js +2 -1
  45. package/kunlun/operator/impl/logicV2.js +0 -1
  46. package/kunlun/operator/impl/operator.js +2 -1
  47. package/kunlun/operator/impl/operatorV2.js +0 -1
  48. package/lib/core.js +2 -1
  49. package/package.json +3 -14
  50. package/request/common.js +0 -1
  51. package/request/constants.js +0 -1
  52. package/request/faasinfra.js +0 -1
  53. package/request/innerapi.js +2 -1
  54. package/request/interface.js +2 -1
  55. package/request/openapi.js +2 -1
  56. package/types/types.js +2 -1
  57. package/LICENSE.md +0 -0
  58. package/application/application.js.map +0 -1
  59. package/application/application.ts +0 -40
  60. package/application/function/function.js.map +0 -1
  61. package/application/function/function.ts +0 -37
  62. package/application/impl/common.js.map +0 -1
  63. package/application/impl/common.ts +0 -50
  64. package/application/impl/impl.js.map +0 -1
  65. package/application/impl/impl.ts +0 -48
  66. package/constants/constants.js.map +0 -1
  67. package/constants/constants.ts +0 -12
  68. package/context/context.js.map +0 -1
  69. package/context/context.ts +0 -127
  70. package/context/db/db.js.map +0 -1
  71. package/context/db/db.ts +0 -77
  72. package/context/db/impl/IObject.js.map +0 -1
  73. package/context/db/impl/IObject.ts +0 -244
  74. package/context/db/impl/db.js.map +0 -1
  75. package/context/db/impl/db.ts +0 -95
  76. package/context/db/impl/object.js.map +0 -1
  77. package/context/db/impl/object.ts +0 -628
  78. package/context/db/impl/oql/ioql.js.map +0 -1
  79. package/context/db/impl/oql/ioql.ts +0 -6
  80. package/context/db/impl/oql/oql.js.map +0 -1
  81. package/context/db/impl/oql/oql.ts +0 -22
  82. package/context/db/impl/order.js.map +0 -1
  83. package/context/db/impl/order.ts +0 -16
  84. package/context/db/impl/propertiesStore.js.map +0 -1
  85. package/context/db/impl/propertiesStore.ts +0 -28
  86. package/context/db/impl/queryBuilder.js.map +0 -1
  87. package/context/db/impl/queryBuilder.ts +0 -103
  88. package/context/db/impl/transaction/index.js.map +0 -1
  89. package/context/db/impl/transaction/index.ts +0 -337
  90. package/context/db/impl/transaction/operation.js.map +0 -1
  91. package/context/db/impl/transaction/operation.ts +0 -72
  92. package/context/db/impl/transaction.js.map +0 -1
  93. package/context/db/impl/transaction.ts +0 -76
  94. package/context/globalConfig/globalConfig.js.map +0 -1
  95. package/context/globalConfig/globalConfig.ts +0 -11
  96. package/context/metadata/components/common.js.map +0 -1
  97. package/context/metadata/components/common.ts +0 -19
  98. package/context/metadata/components/components.js.map +0 -1
  99. package/context/metadata/components/components.ts +0 -19
  100. package/context/metadata/components/desktop/list.js.map +0 -1
  101. package/context/metadata/components/desktop/list.ts +0 -457
  102. package/context/metadata/components/desktop/recordDetail.js.map +0 -1
  103. package/context/metadata/components/desktop/recordDetail.ts +0 -64
  104. package/context/metadata/components/mobile/list.js.map +0 -1
  105. package/context/metadata/components/mobile/list.ts +0 -176
  106. package/context/metadata/metadata.js.map +0 -1
  107. package/context/metadata/metadata.ts +0 -175
  108. package/context/metadata/objects/fields.js.map +0 -1
  109. package/context/metadata/objects/fields.ts +0 -454
  110. package/context/metadata/objects/fields.util.js.map +0 -1
  111. package/context/metadata/objects/fields.util.ts +0 -360
  112. package/context/metadata/objects/objects.js.map +0 -1
  113. package/context/metadata/objects/objects.ts +0 -27
  114. package/context/metadata/types/common.js.map +0 -1
  115. package/context/metadata/types/common.ts +0 -10
  116. package/context/metadata/types/components.js.map +0 -1
  117. package/context/metadata/types/components.ts +0 -105
  118. package/context/metadata/types/objects.js.map +0 -1
  119. package/context/metadata/types/objects.ts +0 -251
  120. package/context/msg/msg.js.map +0 -1
  121. package/context/msg/msg.ts +0 -49
  122. package/context/resources/IResources.js.map +0 -1
  123. package/context/resources/IResources.ts +0 -73
  124. package/context/resources/impl/resources.js.map +0 -1
  125. package/context/resources/impl/resources.ts +0 -170
  126. package/context/tasks/tasks.js.map +0 -1
  127. package/context/tasks/tasks.ts +0 -159
  128. package/data/index.js.map +0 -1
  129. package/data/index.ts +0 -30
  130. package/hooks/api.js.map +0 -1
  131. package/hooks/api.ts +0 -341
  132. package/hooks/hooks.js.map +0 -1
  133. package/hooks/hooks.ts +0 -100
  134. package/kunlun/kunlun.js.map +0 -1
  135. package/kunlun/kunlun.ts +0 -69
  136. package/kunlun/operator/IOperator.js.map +0 -1
  137. package/kunlun/operator/IOperator.ts +0 -163
  138. package/kunlun/operator/impl/expression.js.map +0 -1
  139. package/kunlun/operator/impl/expression.ts +0 -71
  140. package/kunlun/operator/impl/logic.js.map +0 -1
  141. package/kunlun/operator/impl/logic.ts +0 -595
  142. package/kunlun/operator/impl/logicV2.js.map +0 -1
  143. package/kunlun/operator/impl/logicV2.ts +0 -254
  144. package/kunlun/operator/impl/operator.js.map +0 -1
  145. package/kunlun/operator/impl/operator.ts +0 -255
  146. package/kunlun/operator/impl/operatorV2.js.map +0 -1
  147. package/kunlun/operator/impl/operatorV2.ts +0 -249
  148. package/lib/core.js.map +0 -1
  149. package/lib/core.ts +0 -4
  150. package/request/common.js.map +0 -1
  151. package/request/common.ts +0 -91
  152. package/request/constants.js.map +0 -1
  153. package/request/constants.ts +0 -25
  154. package/request/faasinfra.js.map +0 -1
  155. package/request/faasinfra.ts +0 -393
  156. package/request/innerapi.js.map +0 -1
  157. package/request/innerapi.ts +0 -1645
  158. package/request/interface.js.map +0 -1
  159. package/request/interface.ts +0 -166
  160. package/request/openapi.js.map +0 -1
  161. package/request/openapi.ts +0 -1220
  162. package/types/types.js.map +0 -1
  163. package/types/types.ts +0 -105
@@ -1,254 +0,0 @@
1
- import { OrderV2 } from "../../../request/interface";
2
- import { UserDataType } from "./expression";
3
- import { operates } from "./operator";
4
-
5
- export type FieldPath = {
6
- objectApiName: string;
7
- fieldApiName: string;
8
- extendLogicTags: string[];
9
- }
10
-
11
- export type SettingType = {
12
- data?: any;
13
- fieldPath?: FieldPath[];
14
- }
15
-
16
- export type Expression = {
17
- type: string;
18
- settings: SettingType;
19
- }
20
-
21
- export function NewMetadataExpressionField(objectApiName: string, fieldApiName: string): Expression {
22
- return {
23
- type: "metadataVariable",
24
- settings: {
25
- fieldPath: [{
26
- objectApiName: objectApiName,
27
- fieldApiName: fieldApiName,
28
- extendLogicTags: []
29
- }]
30
- }
31
- }
32
- }
33
-
34
- export function NewConstantExpressionField(data: UserDataType): Expression {
35
- return {
36
- type: "constant",
37
- settings: {
38
- data: data
39
- }
40
- }
41
- }
42
-
43
- export type ExpressionV2 = {
44
- leftValue: string;
45
- operator: string;
46
- rightValue: any;
47
- }
48
-
49
- export class ArithmeticExpression {
50
- left: Expression;
51
- operator: string;
52
- right: Expression;
53
- expr: ExpressionV2;
54
-
55
- constructor(leftValue: string, op: string, rightValue: any) {
56
- let fieldPaths: FieldPath[] = [];
57
- leftValue.split('.').forEach((fieldApiName) => {
58
- fieldPaths.push({
59
- fieldApiName: fieldApiName,
60
- objectApiName: "",
61
- extendLogicTags: []
62
- });
63
- })
64
- const left: Expression = {
65
- type: "metadataVariable",
66
- settings: {
67
- fieldPath: fieldPaths,
68
- data: null
69
- }
70
- };
71
- let right: Expression = {
72
- type: "constant",
73
- settings: {
74
- fieldPath: [],
75
- data: rightValue
76
- }
77
- };
78
- if (op == "isEmpty" || op == "isNotEmpty") {
79
- right = null;
80
- }
81
- this.operator = op;
82
- this.left = left;
83
- this.right = right;
84
- this.expr = {
85
- leftValue: leftValue,
86
- operator: op,
87
- rightValue: rightValue
88
- }
89
- }
90
- };
91
-
92
-
93
- export class LogicalExpression {
94
- type: string;
95
- arithmeticExpressions: ArithmeticExpression[];
96
- logicalExpressions: LogicalExpression[];
97
-
98
- constructor(logicType: string, expressions: ArithmeticExpression[], logics: LogicalExpression[]) {
99
- this.type = logicType;
100
- this.arithmeticExpressions = expressions;
101
- this.logicalExpressions = logics;
102
- }
103
- }
104
-
105
- export class QueryV2 {
106
- objectApiName: string;
107
- _limit: number;
108
- _offset: number;
109
- fields: string[];
110
- _order: OrderV2[];
111
- filter: LogicalExpression;
112
-
113
- buildCriterion(filter: LogicalExpression): any[] {
114
- if (!filter || filter.arithmeticExpressions.length == 0 && filter.logicalExpressions.length == 0) {
115
- return null;
116
- }
117
- var conditions: any[] = [];
118
-
119
- filter.logicalExpressions.forEach((logicalExpression) => {
120
- conditions.push({
121
- [logicalExpression.type]: this.buildCriterion(logicalExpression),
122
- });
123
- })
124
-
125
- filter.arithmeticExpressions.forEach((arithmeticExpression) => {
126
- conditions.push(arithmeticExpression.expr);
127
- });
128
- return conditions;
129
- }
130
-
131
- where(condition: LogicalExpression | Record<string, ArithmeticExpression>): QueryV2 {
132
- if (!condition) {
133
- return this;
134
- }
135
-
136
- const { logicalExps, arithmeticExps } = logical([condition]);
137
- logicalExps.forEach((logicalExpression) => {
138
- if (this.filter) {
139
- this.filter.logicalExpressions.push(logicalExpression);
140
- }
141
- });
142
- const logicalExpBuiltByArithmeticExps = new LogicalExpression(operates.AND, arithmeticExps, []);
143
- this.filter.logicalExpressions.push(logicalExpBuiltByArithmeticExps);
144
-
145
- return this;
146
- }
147
-
148
- offset(offset: number): QueryV2 {
149
- if (offset < 0) {
150
- throw new Error("offset must be greater than or equal to 0");
151
- }
152
- this._offset = offset;
153
- return this;
154
- }
155
-
156
- limit(limit: number): QueryV2 {
157
- if (limit <= 0 || limit > 200) {
158
- throw new Error("limit must be greater than 0 and less than or equal to 200");
159
- }
160
- this._limit = limit;
161
- return this;
162
- }
163
-
164
- orderBy(fieldApiNames: string[]): QueryV2 {
165
- fieldApiNames.forEach((fieldApiName) => {
166
- this._order.push({
167
- field: fieldApiName,
168
- direction: "asc",
169
- type: "",
170
- });
171
- });
172
- return this;
173
- }
174
-
175
- orderByDesc(fieldApiNames: string[]): QueryV2 {
176
- fieldApiNames.forEach((fieldApiName) => {
177
- this._order.push({
178
- field: fieldApiName,
179
- direction: "desc",
180
- type: "",
181
- });
182
- });
183
- return this;
184
- }
185
-
186
- select(fieldApiNames: string[]): QueryV2 {
187
- fieldApiNames.forEach((fieldApiName) => {
188
- this.fields.push(fieldApiName);
189
- });
190
- return this;
191
- }
192
-
193
- constructor(objectApiName: string) {
194
- this.objectApiName = objectApiName;
195
- this._limit = 200;
196
- this._offset = 0;
197
- this.fields = [];
198
- this._order = [];
199
- this.filter = {
200
- type: "and",
201
- arithmeticExpressions: null,
202
- logicalExpressions: null,
203
- };
204
- }
205
- }
206
-
207
- export type logicalRet = {
208
- logicalExps: LogicalExpression[];
209
- arithmeticExps: ArithmeticExpression[];
210
- }
211
-
212
- export function logical(exps: (LogicalExpression | Record<string, ArithmeticExpression>)[]): logicalRet {
213
- if (!exps || exps.length == 0) {
214
- return null;
215
- }
216
- var logicalExps: LogicalExpression[] = [];
217
- var arithmeticExps: ArithmeticExpression[] = [];
218
- exps.forEach((exp) => {
219
- if (!exp) {
220
- return;
221
- }
222
- if (exp instanceof LogicalExpression) {
223
- logicalExps.push(exp);
224
- } else {
225
- for (var key in exp) {
226
- if (exp[key]) {
227
- arithmeticExps.push(new ArithmeticExpression(key, exp[key].operator, exp[key].right));
228
- }
229
- }
230
- }
231
- });
232
- return {
233
- logicalExps: logicalExps,
234
- arithmeticExps: arithmeticExps,
235
- }
236
- }
237
-
238
- export type CriterionV2 = (Record<string, CriterionV2> | ExpressionV2)[];
239
-
240
- export function buildCriterionV2(filter: LogicalExpression): CriterionV2 {
241
- if (!filter || filter.logicalExpressions.length == 0 && filter.arithmeticExpressions.length == 0) {
242
- return null;
243
- }
244
- var conditions: any[] = [];
245
- filter.logicalExpressions.forEach((logicalExp) => {
246
- conditions.push({
247
- [logicalExp.type]: buildCriterionV2(logicalExp),
248
- })
249
- });
250
- filter.arithmeticExpressions.forEach((arithmeticExp) => {
251
- conditions.push(arithmeticExp.expr);
252
- });
253
- return conditions;
254
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"operator.js","sourceRoot":"","sources":["operator.ts"],"names":[],"mappings":";;;AAEA,wEAAmE;AACnE,mCAA+C;AAGlC,QAAA,QAAQ,GAAG;IACpB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IAER,K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CAAC;IAAA,CAAC;IAYF,SAAS,CAAI,KAA8C,EAAE,GAAG,UAA+B;QAC3F,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5B,MAAM,OAAO,GAAG,0BAAK,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,MAAM,IAAI,+BAAU,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,CAAC;SAC5E;QACD,OAAO,IAAI,iBAAS,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAQ,CAAC,WAAW,CAAC,CAAA;IAC7D,CAAC;IAAA,CAAC;CACL;AA7ND,4BA6NC"}
@@ -1,255 +0,0 @@
1
- import { _Cond, _BooleanCond, _LogicalCond } from '../../../types/types'
2
- import { IOperator } from "../IOperator";
3
- import { exceptions, utils } from '@byted-apaas/server-common-node'
4
- import { buildLogic, Condition } from './logic'
5
- import { UserDataType } from './expression';
6
-
7
- export const operates = {
8
- AND: "and", // 逻辑与
9
- OR: "or", // 逻辑或
10
-
11
- EMTPY: "isEmpty", // 为空
12
- NOT_EMTPY: "isNotEmpty", // 不为空
13
-
14
- EQ: "equals", // 等于
15
- NEQ: "notEquals", // 不等于
16
- LT: "lessThan", // 小于
17
- LTE: "lessThanOrEquals", // 小于或等于
18
- GT: "greaterThan", // 大于
19
- GTE: "greaterThanOrEquals", // 大于或等于
20
-
21
- CONTAIN: "contains", // 包含
22
- NOT_CONTAIN: "notContains", // 不包含
23
-
24
- IN: "isAnyOf", // 在......列表内
25
- NIN: "isNoneOf", // 不在......列表内
26
-
27
- HAS_ANY_OF: "hasAnyOf", // 右值和左值有交集
28
- HAS_NONE_OF: "hasNoneOf", // 右值和左值无交集
29
-
30
- isOnOrBefore: "isOnOrBefore",
31
- isOnOrAfter: "isOnOrAfter",
32
- }
33
-
34
- export class Operator<T> implements IOperator {
35
- /**
36
- * 逻辑且
37
- * @param conditions 多个条件,用逗号分隔
38
- * @example
39
- * ```
40
- * context.db.object("_user").where(kunlun.operator.and({
41
- * age: "22"
42
- * },{
43
- * gender: "male"
44
- * }))
45
- * ```
46
- */
47
- and<T>(...conditions: (_Cond<T> | _BooleanCond<T>)[]): _LogicalCond<T> {
48
- if (conditions.length < 1) {
49
- return null;
50
- }
51
-
52
- return buildLogic(conditions, operates.AND);
53
- };
54
- /**
55
- * 逻辑或
56
- * @param conditions 多个条件,用逗号分隔
57
- * @example
58
- * ```
59
- * context.db.object("_user").where(kunlun.operator.or({
60
- * age: "22"
61
- * },{
62
- * age: "25"
63
- * }))
64
- * ```
65
- */
66
- or<T>(...conditions: (_Cond<T> | _BooleanCond<T>)[]): _LogicalCond<T> {
67
- if (conditions.length < 1) {
68
- return null;
69
- }
70
-
71
- return buildLogic(conditions, operates.OR);
72
- };
73
- /**
74
- * 包含
75
- * @param value 判定是否包含的文本值
76
- * @example
77
- * ```
78
- * context.db.object("_user").where({_name: kunlun.operator.contain("a")})
79
- * ```
80
- */
81
- contain<T>(value: UserDataType): _BooleanCond<T> {
82
- return new Condition(null, value, operates.CONTAIN)
83
- };
84
- /**
85
- * 不包含
86
- * @param value 判定是否不包含的文本值
87
- * @example
88
- * ```
89
- * context.db.object("_user").where({_name: kunlun.operator.notContain("a")})
90
- * ```
91
- */
92
- notContain<T>(value: UserDataType): _BooleanCond<T> {
93
- return new Condition(null, value, operates.NOT_CONTAIN)
94
- };
95
- /**
96
- * 无需入参,判断是否为空
97
- * @example
98
- * ```
99
- * context.db.object("_user").where({employeeType: kunlun.operator.empty()})
100
- * ```
101
- */
102
- empty(): _BooleanCond<undefined> {
103
- return new Condition(null, null, operates.EMTPY);
104
- };
105
- /**
106
- * 无需入参,判断是否为空
107
- * @example
108
- * ```
109
- * context.db.object("_user").where({employeeType: kunlun.operator.notEmpty()})
110
- * ```
111
- */
112
- notEmpty(): _BooleanCond<undefined> {
113
- return new Condition(null, null, operates.NOT_EMTPY);
114
- };
115
- /**
116
- * 等于
117
- * @param value 判定是否相等的值
118
- * @example
119
- * ```
120
- * context.db.object("_user").where({age: kunlun.operator.eq(20)})
121
- * ```
122
- */
123
- eq<T>(value: UserDataType): _BooleanCond<T> {
124
- return new Condition(null, value, operates.EQ);
125
- };
126
- /**
127
- * 不等于
128
- * @param value 判定是否不相等的值
129
- * @example
130
- * ```
131
- * context.db.object("_user").where({age: kunlun.operator.neq(20)})
132
- * ```
133
- */
134
- neq<T>(value: UserDataType): _BooleanCond<T> {
135
- return new Condition(null, value, operates.NEQ)
136
- };
137
- /**
138
- * 大于或晚于
139
- * @param value 判定是否大于或晚于的值
140
- * @example
141
- * ```
142
- * kunlun.operator.gt(new Date("2020-11-26").getTime())
143
- * ```
144
- */
145
- gt<T>(value: number | Date): _BooleanCond<T> {
146
- return new Condition(null, value, operates.GT)
147
- };
148
- /**
149
- * 大于等于或晚于等于
150
- * @param value 判定是否大于等于或晚于等于的值
151
- * @example
152
- * ```
153
- * kunlun.operator.gte(new Date("2020-11-26").getTime())
154
- * ```
155
- */
156
- gte<T>(value: number | Date): _BooleanCond<T> {
157
- return new Condition(null, value, operates.GTE)
158
- };
159
- /**
160
- * 小于或早于
161
- * @param value 判定是否小于或早于的值
162
- * @example
163
- * ```
164
- * kunlun.operator.lt(new Date("2020-11-26").getTime())
165
- * ```
166
- */
167
- lt<T>(value: number | Date): _BooleanCond<T> {
168
- return new Condition(null, value, operates.LT)
169
- };
170
- /**
171
- * 小于等于或早于等于
172
- * @param value 判定是否小于等于或早于等于的值
173
- * @example
174
- * ```
175
- * kunlun.operator.lte(new Date("2020-11-26").getTime())
176
- * ```
177
- */
178
- lte<T>(value: number | Date): _BooleanCond<T> {
179
- return new Condition(null, value, operates.LTE)
180
- };
181
- /**
182
- * 存在于给定的数组内
183
- * @param values 判定是否存在于的一组值,用数组传递
184
- */
185
- in<T>(values: T[]): _BooleanCond<T>;
186
- /**
187
- * 存在于给定的数组内
188
- * @param values 判定是否存在于的一组值,用逗号分隔
189
- */
190
- in<T>(...values: T[]): _BooleanCond<T>;
191
- in<T>(value: T | T[], ...restValues: T[]): _BooleanCond<T> {
192
- value = !value ? [] : value;
193
- const argList = utils.argsToList(value, restValues);
194
- if (argList.length === 0) {
195
- throw new exceptions.InvalidParamError("can not IN empty list");
196
- }
197
- return new Condition(null, argList, operates.IN)
198
- };
199
- /**
200
- * 不存在于给定的数组内
201
- * @param values 判定是否不存在于的一组值,用数组传递
202
- */
203
- notIn<T>(values: T[]): _BooleanCond<T>;
204
- /**
205
- * 不存在于给定的数组内
206
- * @param values 判定是否不存在于的一组值,用逗号分隔
207
- */
208
- notIn<T>(...values: T[]): _BooleanCond<T>;
209
- notIn<T>(value: T | T[], ...restValues: T[]): _BooleanCond<T> {
210
- value = !value ? [] : value;
211
- const argList = utils.argsToList(value, restValues);
212
- if (argList.length === 0) {
213
- throw new exceptions.InvalidParamError("can not NOT_IN empty list");
214
- }
215
- return new Condition(null, argList, operates.NIN)
216
- };
217
-
218
- /**
219
- * 存在给定的多个值中的任何一个值
220
- * @param values 判定是否不存在于的一组值,用逗号分隔
221
- */
222
- hasAnyOf<T>(values: number[] | string[]): _BooleanCond<T>;
223
- /**
224
- * 存在给定的多个值中的任何一个值
225
- * @param values 判定是否不存在于的一组值,用逗号分隔
226
- */
227
- hasAnyOf<T>(...values: (number | string)[]): _BooleanCond<T>;
228
- hasAnyOf<T>(value: (number | string) | (number | string)[], ...restValues: (number | string)[]): _BooleanCond<T> {
229
- value = !value ? [] : value;
230
- const argList = utils.argsToList(value, restValues);
231
- if (argList.length === 0) {
232
- throw new exceptions.InvalidParamError("can not HAS_ANY_OF empty list");
233
- }
234
- return new Condition(null, argList, operates.HAS_ANY_OF)
235
- };
236
- /**
237
- * 不存在给定的多个值中的任何值
238
- * @param values 判定是否不存在于的一组值,用逗号分隔
239
- */
240
- hasNoneOf<T>(values: number[] | string[]): _BooleanCond<T>;
241
-
242
- /**
243
- * 不存在给定的多个值中的任何值
244
- * @param values 判定是否不存在于的一组值,用逗号分隔
245
- */
246
- hasNoneOf<T>(...values: (number | string)[]): _BooleanCond<T>;
247
- hasNoneOf<T>(value: (number | string) | (number | string)[], ...restValues: (number | string)[]): _BooleanCond<T> {
248
- value = !value ? [] : value;
249
- const argList = utils.argsToList(value, restValues);
250
- if (argList.length === 0) {
251
- throw new exceptions.InvalidParamError("can not HAS_NONE_OF empty list");
252
- }
253
- return new Condition(null, argList, operates.HAS_NONE_OF)
254
- };
255
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"operatorV2.js","sourceRoot":"","sources":["operatorV2.ts"],"names":[],"mappings":";;;AAEA,wEAAmE;AACnE,uCAA6E;AAGhE,QAAA,QAAQ,GAAG;IACpB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IAER,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,YAAY;IAEvB,EAAE,EAAE,QAAQ;IACZ,GAAG,EAAE,WAAW;IAChB,EAAE,EAAE,UAAU;IACd,GAAG,EAAE,kBAAkB;IACvB,EAAE,EAAE,aAAa;IACjB,GAAG,EAAE,qBAAqB;IAE1B,OAAO,EAAE,UAAU;IACnB,WAAW,EAAE,aAAa;IAE1B,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,UAAU;IAEf,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,WAAW;IAExB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;CACpB,CAAA;AAED,MAAa,UAAU;IACnB;;;;;;;;;;;OAWG;IACH,GAAG,CAAI,GAAG,IAAwD;QAC9D,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAA,iBAAO,EAAC,IAAW,CAAC,CAAC;QAC7D,OAAO,IAAI,2BAAiB,CAAC,gBAAQ,CAAC,GAAG,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;IAC5E,CAAC;IAAA,CAAC;IACF;;;;;;;;;;;OAWG;IACH,EAAE,CAAI,GAAG,IAAwD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