@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.
Files changed (131) hide show
  1. package/package.json +2 -2
  2. package/application/application.d.ts +0 -33
  3. package/application/application.js +0 -2
  4. package/application/function/function.d.ts +0 -14
  5. package/application/function/function.js +0 -20
  6. package/application/impl/common.d.ts +0 -2
  7. package/application/impl/common.js +0 -52
  8. package/application/impl/impl.d.ts +0 -19
  9. package/application/impl/impl.js +0 -45
  10. package/common/structs.d.ts +0 -15
  11. package/common/structs.js +0 -21
  12. package/constants/constants.d.ts +0 -13
  13. package/constants/constants.js +0 -18
  14. package/context/context.d.ts +0 -44
  15. package/context/context.js +0 -25
  16. package/context/db/db.d.ts +0 -110
  17. package/context/db/db.js +0 -2
  18. package/context/db/impl/IObject.d.ts +0 -303
  19. package/context/db/impl/IObject.js +0 -5
  20. package/context/db/impl/IObjectV3.d.ts +0 -239
  21. package/context/db/impl/IObjectV3.js +0 -5
  22. package/context/db/impl/db.d.ts +0 -62
  23. package/context/db/impl/db.js +0 -84
  24. package/context/db/impl/dbV3.d.ts +0 -35
  25. package/context/db/impl/dbV3.js +0 -50
  26. package/context/db/impl/object.d.ts +0 -123
  27. package/context/db/impl/object.js +0 -1008
  28. package/context/db/impl/oql/ioql.d.ts +0 -14
  29. package/context/db/impl/oql/ioql.js +0 -4
  30. package/context/db/impl/oql/oql.d.ts +0 -14
  31. package/context/db/impl/oql/oql.js +0 -39
  32. package/context/db/impl/order.d.ts +0 -9
  33. package/context/db/impl/order.js +0 -15
  34. package/context/db/impl/propertiesStore.d.ts +0 -8
  35. package/context/db/impl/propertiesStore.js +0 -29
  36. package/context/db/impl/queryBuilder.d.ts +0 -33
  37. package/context/db/impl/queryBuilder.js +0 -72
  38. package/context/db/impl/transaction/index.d.ts +0 -25
  39. package/context/db/impl/transaction/index.js +0 -300
  40. package/context/db/impl/transaction/operation.d.ts +0 -27
  41. package/context/db/impl/transaction/operation.js +0 -69
  42. package/context/db/impl/transaction.d.ts +0 -70
  43. package/context/db/impl/transaction.js +0 -4
  44. package/context/globalConfig/globalConfig.d.ts +0 -7
  45. package/context/globalConfig/globalConfig.js +0 -16
  46. package/context/integration/IIntegration.d.ts +0 -30
  47. package/context/integration/IIntegration.js +0 -4
  48. package/context/integration/impl/integration.d.ts +0 -16
  49. package/context/integration/impl/integration.js +0 -62
  50. package/context/metadata/components/common.d.ts +0 -6
  51. package/context/metadata/components/common.js +0 -17
  52. package/context/metadata/components/components.d.ts +0 -12
  53. package/context/metadata/components/components.js +0 -19
  54. package/context/metadata/components/desktop/list.d.ts +0 -16
  55. package/context/metadata/components/desktop/list.js +0 -402
  56. package/context/metadata/components/desktop/recordDetail.d.ts +0 -11
  57. package/context/metadata/components/desktop/recordDetail.js +0 -53
  58. package/context/metadata/components/mobile/list.d.ts +0 -24
  59. package/context/metadata/components/mobile/list.js +0 -145
  60. package/context/metadata/metadata.d.ts +0 -63
  61. package/context/metadata/metadata.js +0 -125
  62. package/context/metadata/objects/fields.d.ts +0 -158
  63. package/context/metadata/objects/fields.js +0 -369
  64. package/context/metadata/objects/fields.util.d.ts +0 -52
  65. package/context/metadata/objects/fields.util.js +0 -420
  66. package/context/metadata/objects/fieldsV3.d.ts +0 -159
  67. package/context/metadata/objects/fieldsV3.js +0 -369
  68. package/context/metadata/objects/objects.d.ts +0 -11
  69. package/context/metadata/objects/objects.js +0 -20
  70. package/context/metadata/types/common.d.ts +0 -11
  71. package/context/metadata/types/common.js +0 -33
  72. package/context/metadata/types/components.d.ts +0 -90
  73. package/context/metadata/types/components.js +0 -4
  74. package/context/metadata/types/objects.d.ts +0 -246
  75. package/context/metadata/types/objects.js +0 -4
  76. package/context/metadata/types/objectsV3.d.ts +0 -128
  77. package/context/metadata/types/objectsV3.js +0 -4
  78. package/context/msg/msg.d.ts +0 -38
  79. package/context/msg/msg.js +0 -35
  80. package/context/resources/IResources.d.ts +0 -68
  81. package/context/resources/IResources.js +0 -2
  82. package/context/resources/impl/resources.d.ts +0 -42
  83. package/context/resources/impl/resources.js +0 -161
  84. package/context/tasks/tasks.d.ts +0 -33
  85. package/context/tasks/tasks.js +0 -139
  86. package/data/index.d.ts +0 -27
  87. package/data/index.js +0 -4
  88. package/global/application/flow/flow.d.ts +0 -99
  89. package/global/application/flow/flow.js +0 -8
  90. package/global/application/flow/impl/flow.d.ts +0 -20
  91. package/global/application/flow/impl/flow.js +0 -56
  92. package/global/application/globalVar/globalVar.d.ts +0 -7
  93. package/global/application/globalVar/globalVar.js +0 -2
  94. package/global/global.d.ts +0 -70
  95. package/global/global.js +0 -3
  96. package/hooks/api.d.ts +0 -65
  97. package/hooks/api.js +0 -347
  98. package/hooks/hooks.d.ts +0 -1
  99. package/hooks/hooks.js +0 -107
  100. package/kunlun/kunlun.d.ts +0 -55
  101. package/kunlun/kunlun.js +0 -58
  102. package/kunlun/operator/IOperator.d.ts +0 -158
  103. package/kunlun/operator/IOperator.js +0 -4
  104. package/kunlun/operator/impl/expression.d.ts +0 -75
  105. package/kunlun/operator/impl/expression.js +0 -96
  106. package/kunlun/operator/impl/logic.d.ts +0 -68
  107. package/kunlun/operator/impl/logic.js +0 -573
  108. package/kunlun/operator/impl/logicV2.d.ts +0 -59
  109. package/kunlun/operator/impl/logicV2.js +0 -197
  110. package/kunlun/operator/impl/operator.d.ts +0 -179
  111. package/kunlun/operator/impl/operator.js +0 -222
  112. package/kunlun/operator/impl/operatorV2.d.ts +0 -180
  113. package/kunlun/operator/impl/operatorV2.js +0 -216
  114. package/lib/core.d.ts +0 -4
  115. package/lib/core.js +0 -19
  116. package/request/common.d.ts +0 -13
  117. package/request/common.js +0 -88
  118. package/request/constants.d.ts +0 -12
  119. package/request/constants.js +0 -29
  120. package/request/faasinfra.d.ts +0 -8
  121. package/request/faasinfra.js +0 -146
  122. package/request/interface.d.ts +0 -121
  123. package/request/interface.js +0 -30
  124. package/request/openapi.d.ts +0 -84
  125. package/request/openapi.js +0 -1529
  126. package/request/structs.d.ts +0 -99
  127. package/request/structs.js +0 -15
  128. package/types/types.d.ts +0 -79
  129. package/types/types.js +0 -4
  130. package/version/version.d.ts +0 -2
  131. package/version/version.js +0 -8
@@ -1,180 +0,0 @@
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
- }
@@ -1,216 +0,0 @@
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 DELETED
@@ -1,4 +0,0 @@
1
- export * as hooks from '../hooks/hooks';
2
- export declare const isNewSystemProxyFunc: boolean;
3
- export { kunlun } from '../kunlun/kunlun';
4
- export { db, resources, msg, tasks, cloudfunction, microservice, workflow, metaData, Application } from '../hooks/api';
package/lib/core.js DELETED
@@ -1,19 +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.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; } });
@@ -1,13 +0,0 @@
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>;
package/request/common.js DELETED
@@ -1,88 +0,0 @@
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;
@@ -1,12 +0,0 @@
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
- };
@@ -1,29 +0,0 @@
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
- };
@@ -1,8 +0,0 @@
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
- }