@byted-apaas/server-sdk-node 0.0.2-beta.1

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 (215) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +1 -0
  3. package/application/application.d.ts +27 -0
  4. package/application/application.js +3 -0
  5. package/application/application.js.map +1 -0
  6. package/application/application.ts +40 -0
  7. package/application/function/function.d.ts +14 -0
  8. package/application/function/function.js +22 -0
  9. package/application/function/function.js.map +1 -0
  10. package/application/function/function.ts +37 -0
  11. package/application/impl/common.d.ts +2 -0
  12. package/application/impl/common.js +51 -0
  13. package/application/impl/common.js.map +1 -0
  14. package/application/impl/common.ts +50 -0
  15. package/application/impl/impl.d.ts +16 -0
  16. package/application/impl/impl.js +39 -0
  17. package/application/impl/impl.js.map +1 -0
  18. package/application/impl/impl.ts +48 -0
  19. package/constants/constants.d.ts +10 -0
  20. package/constants/constants.js +14 -0
  21. package/constants/constants.js.map +1 -0
  22. package/constants/constants.ts +12 -0
  23. package/context/context.d.ts +74 -0
  24. package/context/context.js +24 -0
  25. package/context/context.js.map +1 -0
  26. package/context/context.ts +127 -0
  27. package/context/db/db.d.ts +73 -0
  28. package/context/db/db.js +3 -0
  29. package/context/db/db.js.map +1 -0
  30. package/context/db/db.ts +77 -0
  31. package/context/db/impl/IObject.d.ts +251 -0
  32. package/context/db/impl/IObject.js +4 -0
  33. package/context/db/impl/IObject.js.map +1 -0
  34. package/context/db/impl/IObject.ts +244 -0
  35. package/context/db/impl/db.d.ts +61 -0
  36. package/context/db/impl/db.js +87 -0
  37. package/context/db/impl/db.js.map +1 -0
  38. package/context/db/impl/db.ts +95 -0
  39. package/context/db/impl/object.d.ts +92 -0
  40. package/context/db/impl/object.js +523 -0
  41. package/context/db/impl/object.js.map +1 -0
  42. package/context/db/impl/object.ts +628 -0
  43. package/context/db/impl/oql/ioql.d.ts +6 -0
  44. package/context/db/impl/oql/ioql.js +3 -0
  45. package/context/db/impl/oql/ioql.js.map +1 -0
  46. package/context/db/impl/oql/ioql.ts +6 -0
  47. package/context/db/impl/oql/oql.d.ts +8 -0
  48. package/context/db/impl/oql/oql.js +20 -0
  49. package/context/db/impl/oql/oql.js.map +1 -0
  50. package/context/db/impl/oql/oql.ts +22 -0
  51. package/context/db/impl/order.d.ts +9 -0
  52. package/context/db/impl/order.js +14 -0
  53. package/context/db/impl/order.js.map +1 -0
  54. package/context/db/impl/order.ts +16 -0
  55. package/context/db/impl/propertiesStore.d.ts +8 -0
  56. package/context/db/impl/propertiesStore.js +28 -0
  57. package/context/db/impl/propertiesStore.js.map +1 -0
  58. package/context/db/impl/propertiesStore.ts +28 -0
  59. package/context/db/impl/queryBuilder.d.ts +29 -0
  60. package/context/db/impl/queryBuilder.js +77 -0
  61. package/context/db/impl/queryBuilder.js.map +1 -0
  62. package/context/db/impl/queryBuilder.ts +103 -0
  63. package/context/db/impl/transaction/index.d.ts +20 -0
  64. package/context/db/impl/transaction/index.js +276 -0
  65. package/context/db/impl/transaction/index.js.map +1 -0
  66. package/context/db/impl/transaction/index.ts +337 -0
  67. package/context/db/impl/transaction/operation.d.ts +27 -0
  68. package/context/db/impl/transaction/operation.js +70 -0
  69. package/context/db/impl/transaction/operation.js.map +1 -0
  70. package/context/db/impl/transaction/operation.ts +72 -0
  71. package/context/db/impl/transaction.d.ts +67 -0
  72. package/context/db/impl/transaction.js +3 -0
  73. package/context/db/impl/transaction.js.map +1 -0
  74. package/context/db/impl/transaction.ts +76 -0
  75. package/context/globalConfig/globalConfig.d.ts +7 -0
  76. package/context/globalConfig/globalConfig.js +15 -0
  77. package/context/globalConfig/globalConfig.js.map +1 -0
  78. package/context/globalConfig/globalConfig.ts +11 -0
  79. package/context/metadata/components/common.d.ts +6 -0
  80. package/context/metadata/components/common.js +16 -0
  81. package/context/metadata/components/common.js.map +1 -0
  82. package/context/metadata/components/common.ts +19 -0
  83. package/context/metadata/components/components.d.ts +12 -0
  84. package/context/metadata/components/components.js +18 -0
  85. package/context/metadata/components/components.js.map +1 -0
  86. package/context/metadata/components/components.ts +19 -0
  87. package/context/metadata/components/desktop/list.d.ts +16 -0
  88. package/context/metadata/components/desktop/list.js +403 -0
  89. package/context/metadata/components/desktop/list.js.map +1 -0
  90. package/context/metadata/components/desktop/list.ts +457 -0
  91. package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
  92. package/context/metadata/components/desktop/recordDetail.js +52 -0
  93. package/context/metadata/components/desktop/recordDetail.js.map +1 -0
  94. package/context/metadata/components/desktop/recordDetail.ts +64 -0
  95. package/context/metadata/components/mobile/list.d.ts +24 -0
  96. package/context/metadata/components/mobile/list.js +144 -0
  97. package/context/metadata/components/mobile/list.js.map +1 -0
  98. package/context/metadata/components/mobile/list.ts +176 -0
  99. package/context/metadata/metadata.d.ts +61 -0
  100. package/context/metadata/metadata.js +102 -0
  101. package/context/metadata/metadata.js.map +1 -0
  102. package/context/metadata/metadata.ts +175 -0
  103. package/context/metadata/objects/fields.d.ts +130 -0
  104. package/context/metadata/objects/fields.js +333 -0
  105. package/context/metadata/objects/fields.js.map +1 -0
  106. package/context/metadata/objects/fields.ts +454 -0
  107. package/context/metadata/objects/fields.util.d.ts +40 -0
  108. package/context/metadata/objects/fields.util.js +320 -0
  109. package/context/metadata/objects/fields.util.js.map +1 -0
  110. package/context/metadata/objects/fields.util.ts +360 -0
  111. package/context/metadata/objects/objects.d.ts +11 -0
  112. package/context/metadata/objects/objects.js +19 -0
  113. package/context/metadata/objects/objects.js.map +1 -0
  114. package/context/metadata/objects/objects.ts +27 -0
  115. package/context/metadata/types/common.d.ts +6 -0
  116. package/context/metadata/types/common.js +8 -0
  117. package/context/metadata/types/common.js.map +1 -0
  118. package/context/metadata/types/common.ts +10 -0
  119. package/context/metadata/types/components.d.ts +90 -0
  120. package/context/metadata/types/components.js +3 -0
  121. package/context/metadata/types/components.js.map +1 -0
  122. package/context/metadata/types/components.ts +105 -0
  123. package/context/metadata/types/objects.d.ts +226 -0
  124. package/context/metadata/types/objects.js +3 -0
  125. package/context/metadata/types/objects.js.map +1 -0
  126. package/context/metadata/types/objects.ts +251 -0
  127. package/context/msg/msg.d.ts +38 -0
  128. package/context/msg/msg.js +34 -0
  129. package/context/msg/msg.js.map +1 -0
  130. package/context/msg/msg.ts +49 -0
  131. package/context/resources/IResources.d.ts +66 -0
  132. package/context/resources/IResources.js +3 -0
  133. package/context/resources/IResources.js.map +1 -0
  134. package/context/resources/IResources.ts +73 -0
  135. package/context/resources/impl/resources.d.ts +42 -0
  136. package/context/resources/impl/resources.js +149 -0
  137. package/context/resources/impl/resources.js.map +1 -0
  138. package/context/resources/impl/resources.ts +170 -0
  139. package/context/tasks/tasks.d.ts +33 -0
  140. package/context/tasks/tasks.js +140 -0
  141. package/context/tasks/tasks.js.map +1 -0
  142. package/context/tasks/tasks.ts +159 -0
  143. package/data/index.d.ts +27 -0
  144. package/data/index.js +5 -0
  145. package/data/index.js.map +1 -0
  146. package/data/index.ts +30 -0
  147. package/hooks/api.d.ts +61 -0
  148. package/hooks/api.js +328 -0
  149. package/hooks/api.js.map +1 -0
  150. package/hooks/api.ts +341 -0
  151. package/hooks/hooks.d.ts +1 -0
  152. package/hooks/hooks.js +89 -0
  153. package/hooks/hooks.js.map +1 -0
  154. package/hooks/hooks.ts +100 -0
  155. package/kunlun/kunlun.d.ts +55 -0
  156. package/kunlun/kunlun.js +57 -0
  157. package/kunlun/kunlun.js.map +1 -0
  158. package/kunlun/kunlun.ts +69 -0
  159. package/kunlun/operator/IOperator.d.ts +158 -0
  160. package/kunlun/operator/IOperator.js +3 -0
  161. package/kunlun/operator/IOperator.js.map +1 -0
  162. package/kunlun/operator/IOperator.ts +163 -0
  163. package/kunlun/operator/impl/expression.d.ts +47 -0
  164. package/kunlun/operator/impl/expression.js +55 -0
  165. package/kunlun/operator/impl/expression.js.map +1 -0
  166. package/kunlun/operator/impl/expression.ts +71 -0
  167. package/kunlun/operator/impl/logic.d.ts +50 -0
  168. package/kunlun/operator/impl/logic.js +508 -0
  169. package/kunlun/operator/impl/logic.js.map +1 -0
  170. package/kunlun/operator/impl/logic.ts +595 -0
  171. package/kunlun/operator/impl/logicV2.d.ts +58 -0
  172. package/kunlun/operator/impl/logicV2.js +201 -0
  173. package/kunlun/operator/impl/logicV2.js.map +1 -0
  174. package/kunlun/operator/impl/logicV2.ts +254 -0
  175. package/kunlun/operator/impl/operator.d.ts +179 -0
  176. package/kunlun/operator/impl/operator.js +221 -0
  177. package/kunlun/operator/impl/operator.js.map +1 -0
  178. package/kunlun/operator/impl/operator.ts +255 -0
  179. package/kunlun/operator/impl/operatorV2.d.ts +180 -0
  180. package/kunlun/operator/impl/operatorV2.js +217 -0
  181. package/kunlun/operator/impl/operatorV2.js.map +1 -0
  182. package/kunlun/operator/impl/operatorV2.ts +249 -0
  183. package/lib/core.d.ts +4 -0
  184. package/lib/core.js +18 -0
  185. package/lib/core.js.map +1 -0
  186. package/lib/core.ts +4 -0
  187. package/package.json +50 -0
  188. package/request/common.d.ts +13 -0
  189. package/request/common.js +88 -0
  190. package/request/common.js.map +1 -0
  191. package/request/common.ts +91 -0
  192. package/request/constants.d.ts +10 -0
  193. package/request/constants.js +26 -0
  194. package/request/constants.js.map +1 -0
  195. package/request/constants.ts +25 -0
  196. package/request/faasinfra.d.ts +8 -0
  197. package/request/faasinfra.js +359 -0
  198. package/request/faasinfra.js.map +1 -0
  199. package/request/faasinfra.ts +393 -0
  200. package/request/innerapi.d.ts +67 -0
  201. package/request/innerapi.js +1411 -0
  202. package/request/innerapi.js.map +1 -0
  203. package/request/innerapi.ts +1645 -0
  204. package/request/interface.d.ts +95 -0
  205. package/request/interface.js +40 -0
  206. package/request/interface.js.map +1 -0
  207. package/request/interface.ts +166 -0
  208. package/request/openapi.d.ts +69 -0
  209. package/request/openapi.js +1013 -0
  210. package/request/openapi.js.map +1 -0
  211. package/request/openapi.ts +1220 -0
  212. package/types/types.d.ts +79 -0
  213. package/types/types.js +3 -0
  214. package/types/types.js.map +1 -0
  215. package/types/types.ts +105 -0
@@ -0,0 +1,457 @@
1
+ import * as common from '@byted-apaas/server-common-node'
2
+
3
+ const commonUtils = common.utils;
4
+
5
+ import {Component, componentTypes} from "../common";
6
+ import {
7
+ ConcatTextType,
8
+ FieldApiType,
9
+ UIMetaFilterType,
10
+ UIMetaLangType,
11
+ UIMetaSortConditionsType,
12
+ UIMetaDesktopType, DeskListDetailField, DeskListSubtitleField, DeskListTitleField
13
+ } from "../../types/components";
14
+ import {I18ns, isNullOrUndefined} from "../../types/common";
15
+
16
+ /*
17
+ titleAreaText: i18n;
18
+ objectApiName: string;
19
+ isCompositeType: boolean;
20
+ titleFields: [{
21
+ fieldApiName: string;
22
+ },...]
23
+ subtitleFields: [{
24
+ type: "field"|"concatText"
25
+ fieldApiName: string;
26
+ alias: i18n;
27
+ concatText: {
28
+ zh_CN: [{
29
+ dataType: "fieldApiName"|"text"
30
+ fieldApiName: string;
31
+ text: string;
32
+ },...]
33
+ en_US: [{
34
+ dataType: "fieldApiName"|"text"
35
+ fieldApiName: string;
36
+ text: string;
37
+ },...]
38
+ }
39
+ },...]
40
+ detailFields: [{
41
+ fieldApiName: string;
42
+ alias: i18n;
43
+ },...]
44
+ filter: {
45
+ conditions: object[];
46
+ logic: string;
47
+ };
48
+ sortConditions: object[];
49
+ */
50
+
51
+ class List extends Component {
52
+ titleAreaText: I18ns;
53
+ objectApiName: string;
54
+ isCompositeType: boolean;
55
+ titleFields: DeskListTitleField[];
56
+ subtitleFields: DeskListSubtitleField[];
57
+ detailFields: DeskListDetailField[];
58
+ filter: UIMetaFilterType;
59
+ sortConditions: object[];
60
+
61
+ constructor(params: UIMetaDesktopType) {
62
+ super(componentTypes.desktopList);
63
+
64
+ // TODO check
65
+ this.titleAreaText = params.titleAreaText;
66
+ this.objectApiName = params.objectApiName;
67
+ this.isCompositeType = params.isCompositeType;
68
+ this.titleFields = params.titleFields;
69
+ this.subtitleFields = params.subtitleFields as any;
70
+ this.detailFields = params.detailFields as any;
71
+ this.filter = params.filter;
72
+ this.sortConditions = params.sortConditions;
73
+ }
74
+
75
+ static parse(input: Record<string, any>): List {
76
+ if (input.dataType === 'object') {
77
+ return convertUIMetaListObject(input);
78
+ } else if (input.dataType === 'compositeType') {
79
+ return convertUIMetaListCompositeType(input);
80
+ }
81
+ return input as List;
82
+ }
83
+ }
84
+
85
+ function convertUIMetaListObject(input: Record<string, any>): List {
86
+ return {
87
+ isCompositeType: false,
88
+ titleAreaText: input.titleLabel,
89
+ objectApiName: input.objectApiName,
90
+ titleFields: getListObjectTitleFields(input),
91
+ subtitleFields: getListObjectSubtitleFields(input),
92
+ detailFields: getListObjectDetailFields(input),
93
+ filter: getListFilter(input),
94
+ sortConditions: getListSort(input),
95
+ } as List;
96
+ }
97
+
98
+ function convertUIMetaListCompositeType(input: Record<string, any>): List {
99
+ return {
100
+ isCompositeType: true,
101
+ titleAreaText: input.titleLabel,
102
+ objectApiName: getListCompositeTypeObjectApiName(input),
103
+ titleFields: getListCompositeTypeTitleFields(input),
104
+ subtitleFields: getListCompositeTypeSubtitleFields(input),
105
+ detailFields: getListCompositeTypeDetailFields(input),
106
+ filter: getListCompositeTypeFilter(input),
107
+ sortConditions: getListSort(input),
108
+ } as List;
109
+ }
110
+
111
+ function getListObjectTitleFields(input: Record<string, any>): DeskListTitleField[] {
112
+ if (!input || isNullOrUndefined(input.title)) {
113
+ return [];
114
+ }
115
+
116
+ let titles: DeskListTitleField[] = [];
117
+ try {
118
+ let inputTitles = JSON.parse(input.title)
119
+ if (!inputTitles || !(inputTitles instanceof Array)) {
120
+ return [];
121
+ }
122
+
123
+ for (let inputTitle of inputTitles) {
124
+ titles.push({
125
+ fieldApiName: inputTitle.columnApiName,
126
+ });
127
+ }
128
+ } catch (err) {
129
+ return [];
130
+ }
131
+ return titles;
132
+ }
133
+
134
+ function getListObjectSubtitleFields(input: Record<string, any>): DeskListSubtitleField[] {
135
+ if (!input || isNullOrUndefined(input["subTitle"])) {
136
+ return [];
137
+ }
138
+
139
+ let subtitles: DeskListSubtitleField[] = [];
140
+
141
+ try {
142
+ let inputSubtitles = JSON.parse(input.subTitle)
143
+ if (!inputSubtitles || !Array.isArray(inputSubtitles)) {
144
+ return [];
145
+ }
146
+ for (let inputSubtitle of inputSubtitles) {
147
+ subtitles.push({
148
+ fieldApiName: inputSubtitle.columnApiName,
149
+ alias: inputSubtitle.alias,
150
+ });
151
+ }
152
+ } catch (err) {
153
+ return [];
154
+ }
155
+ return subtitles;
156
+ }
157
+
158
+ function getListObjectDetailFields(input: Record<string, any>): DeskListDetailField[] {
159
+ if (!input || isNullOrUndefined(input.detail)) {
160
+ return [];
161
+ }
162
+
163
+ let details: DeskListDetailField[] = [];
164
+ try {
165
+ let inputDetails = JSON.parse(input.detail)
166
+ if (!inputDetails || !Array.isArray(inputDetails)) {
167
+ return [];
168
+ }
169
+
170
+ for (let inputDetail of inputDetails) {
171
+ details.push({
172
+ fieldApiName: inputDetail.columnApiName,
173
+ alias: inputDetail.alias,
174
+ });
175
+ }
176
+ } catch (err) {
177
+ return [];
178
+ }
179
+ return details;
180
+ }
181
+
182
+ function getListFilter(input: Record<string, any>): UIMetaFilterType {
183
+ if (!input || !input.describeFilter || isNullOrUndefined(input.describeFilter.filter)) {
184
+ return {} as UIMetaFilterType;
185
+ }
186
+
187
+ try {
188
+ let inputFilter = JSON.parse(input.describeFilter.filter);
189
+ if (!inputFilter) {
190
+ return {} as UIMetaFilterType;
191
+ }
192
+ return {
193
+ conditions: inputFilter.conditions,
194
+ logic: inputFilter.logic,
195
+ }
196
+ } catch (err) {
197
+ return {} as UIMetaFilterType;
198
+ }
199
+ }
200
+
201
+ function getListSort(input: Record<string, any>): UIMetaSortConditionsType[] {
202
+ if (!input || !input.sort || !Array.isArray(input.sort)) {
203
+ return [];
204
+ }
205
+
206
+ let sortFields = [];
207
+ for (let field of input.sort) {
208
+ sortFields.push({
209
+ fieldApiName: field.field,
210
+ sort: field.direction,
211
+ });
212
+ }
213
+
214
+ return sortFields;
215
+ }
216
+
217
+
218
+ function getListCompositeTypeObjectApiName(input: Record<string, any>): string {
219
+ if (isNullOrUndefined(input)) {
220
+ return "";
221
+ }
222
+
223
+ let objectApiName = getObjectApiNameFromTitle(input);
224
+ if (objectApiName) {
225
+ return objectApiName;
226
+ }
227
+
228
+ objectApiName = getObjectApiNameFromSubTitle(input);
229
+ if (objectApiName) {
230
+ return objectApiName;
231
+ }
232
+
233
+ objectApiName = getObjectApiNameFromDetail(input);
234
+ if (objectApiName) {
235
+ return objectApiName;
236
+ }
237
+
238
+ return "";
239
+ }
240
+
241
+ function getObjectApiNameFromTitle(input: Record<string, any>): string {
242
+ if (!input || isNullOrUndefined(input.title)) {
243
+ return "";
244
+ }
245
+
246
+ try {
247
+ return JSON.parse(input.title)[0].picker.fieldPath[0].objectApiName;
248
+ } catch (err) {
249
+ return "";
250
+ }
251
+ }
252
+
253
+ function getObjectApiNameFromDetail(input: Record<string, any>): string {
254
+ if (!input || isNullOrUndefined(input.detail)) {
255
+ return "";
256
+ }
257
+
258
+ try {
259
+ return JSON.parse(input.detail)[0].picker.fieldPath[0].objectApiName;
260
+ } catch (err) {
261
+ return "";
262
+ }
263
+ }
264
+
265
+ function getObjectApiNameFromSubTitle(input: Record<string, any>): string {
266
+ if (!input || isNullOrUndefined(input.subTitle)) {
267
+ return "";
268
+ }
269
+
270
+ try {
271
+ return JSON.parse(input.subTitle)[0].picker.fieldPath[0].objectApiName;
272
+ } catch (err) {
273
+ return "";
274
+ }
275
+ }
276
+
277
+ function getListCompositeTypeTitleFields(input: Record<string, any>): FieldApiType[] {
278
+ if (!input || isNullOrUndefined(input.title)) {
279
+ return [];
280
+ }
281
+
282
+ let inputFields: FieldApiType[] = [];
283
+ try {
284
+ let inputTitles = JSON.parse(input.title);
285
+ if (!inputTitles || !(inputTitles instanceof Array)) {
286
+ return [];
287
+ }
288
+
289
+ for (let title of inputTitles) {
290
+ try {
291
+ inputFields.push({
292
+ fieldApiName: title.picker.fieldPath[0].fieldApiName,
293
+ });
294
+ } catch (e) {
295
+ continue;
296
+ }
297
+ }
298
+ } catch (err) {
299
+ return [];
300
+ }
301
+ return inputFields;
302
+ }
303
+
304
+ function parsePrimitive(element: Record<string, any>): FieldApiType {
305
+ try {
306
+ return {
307
+ type: "field",
308
+ fieldApiName: element.picker.fieldPath[0].fieldApiName,
309
+ alias: [],
310
+ concatText: {
311
+ zh_CN: [],
312
+ en_US: [],
313
+ }
314
+ }
315
+ } catch (e) {
316
+ return null;
317
+ }
318
+ }
319
+
320
+
321
+ function getListCompositeTypeSubtitleFields(input: Record<string, any>): FieldApiType[] {
322
+ if (!input || isNullOrUndefined(input.subTitle)) {
323
+ return [];
324
+ }
325
+
326
+ let fields: FieldApiType[] = [], subTitle;
327
+ try {
328
+ subTitle = JSON.parse(input.subTitle);
329
+ } catch (err) {
330
+ return [];
331
+ }
332
+
333
+ if (!subTitle || !Array.isArray(subTitle)) {
334
+ return [];
335
+ }
336
+
337
+ for (let element of subTitle) {
338
+ let field = null;
339
+ if (element.type === 'primitive') {
340
+ field = parsePrimitive(element);
341
+ } else if (element.type === 'concatenate') {
342
+ field = parseConcatenate(element);
343
+ }
344
+
345
+ if (field) {
346
+ fields.push(field);
347
+ }
348
+ }
349
+ return fields;
350
+ }
351
+
352
+ function getListCompositeTypeDetailFields(input: Record<string, any>): FieldApiType[] {
353
+ if (!input || isNullOrUndefined(input.detail)) {
354
+ return [];
355
+ }
356
+
357
+ let fields: FieldApiType[] = [];
358
+ try {
359
+ let detail = JSON.parse(input.detail);
360
+ if (!detail || !(detail instanceof Array)) {
361
+ return [];
362
+ }
363
+ for (let element of detail) {
364
+ try {
365
+ fields.push({
366
+ fieldApiName: element.picker.fieldPath[0].fieldApiName,
367
+ alias: [], // TODO
368
+ });
369
+ } catch (e) {
370
+ continue;
371
+ }
372
+ }
373
+ } catch (err) {
374
+ return [];
375
+ }
376
+ return fields;
377
+ }
378
+
379
+ function getListCompositeTypeFilter(input: Record<string, any>): UIMetaFilterType {
380
+ if (!input || !input.describeFilter || isNullOrUndefined(input.describeFilter.filter)) {
381
+ return {} as UIMetaFilterType;
382
+ }
383
+
384
+ try {
385
+ let inputFilter = JSON.parse(input.describeFilter.filter);
386
+ if (!inputFilter) {
387
+ return {} as UIMetaFilterType;
388
+ }
389
+
390
+ return {
391
+ conditions: inputFilter.conditions,
392
+ logic: inputFilter.logic,
393
+ }
394
+ } catch (err) {
395
+ return {} as UIMetaFilterType;
396
+ }
397
+ }
398
+
399
+ function parseLangValues(values: Record<string, any>[]): UIMetaLangType[] {
400
+ let lang = [];
401
+ for (let value of values) {
402
+ if (value.type === "text") {
403
+ lang.push({
404
+ dataType: "text",
405
+ fieldApiName: "",
406
+ text: value.value,
407
+ });
408
+ } else if (value.type === "field") {
409
+ if (value && value.picker && commonUtils.getArrayLength(value.picker.fieldPath) > 0
410
+ && value.picker.fieldPath[0].fieldApiName) {
411
+ lang.push({
412
+ dataType: "fieldApiName",
413
+ fieldApiName: value.picker.fieldPath[0].fieldApiName,
414
+ text: ""
415
+ });
416
+
417
+ }
418
+ }
419
+ }
420
+ return lang;
421
+ }
422
+
423
+ function parseConcatenate(element: Record<string, any>): FieldApiType {
424
+ if (!element || isNullOrUndefined(element.content)) {
425
+ return null;
426
+ }
427
+
428
+ let concatEle: FieldApiType = {
429
+ type: "concatText",
430
+ fieldApiName: "",
431
+ alias: [],
432
+ concatText: {
433
+ zh_CN: [],
434
+ en_US: [],
435
+ }
436
+ };
437
+
438
+ for (let code of Object.keys(element.content)) {
439
+ let values = element.content[code];
440
+ if (code === "2052") {
441
+ concatEle.concatText.zh_CN = parseLangValues(values);
442
+ } else if (code === "1033") {
443
+ concatEle.concatText.en_US = parseLangValues(values);
444
+ }
445
+ }
446
+
447
+ if (commonUtils.getArrayLength(concatEle.concatText.zh_CN) > 0 ||
448
+ commonUtils.getArrayLength(concatEle.concatText.en_US) > 0) {
449
+ return concatEle;
450
+ }
451
+
452
+ return null;
453
+ }
454
+
455
+ export {
456
+ List,
457
+ }
@@ -0,0 +1,11 @@
1
+ import { Component } from "../common";
2
+ import { SelectFieldType } from '../../types/components';
3
+ import { I18ns } from "../../types/common";
4
+ declare class RecordDetail extends Component {
5
+ titleAreaText: I18ns;
6
+ objectApiName: string;
7
+ selectedFields: SelectFieldType[];
8
+ constructor(params: Record<string, any>);
9
+ static parse(input: Record<string, any>): RecordDetail;
10
+ }
11
+ export { RecordDetail, };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordDetail = void 0;
4
+ const common_1 = require("../common");
5
+ /*
6
+ titleAreaText: i18n;
7
+ objectApiName: string;
8
+ selectedFields: [{
9
+ fieldPath: [{
10
+ objectApiName: string;
11
+ fieldApiName: string;
12
+ }, ...];
13
+ },...]
14
+ */
15
+ class RecordDetail extends common_1.Component {
16
+ constructor(params) {
17
+ super(common_1.componentTypes.desktopRecordDetail);
18
+ // TODO check
19
+ this.titleAreaText = params.titleAreaText;
20
+ this.objectApiName = params.objectApiName;
21
+ this.selectedFields = params.selectedFields;
22
+ }
23
+ static parse(input) {
24
+ return new RecordDetail({
25
+ titleAreaText: input.titleLabel,
26
+ objectApiName: input.objectApiName,
27
+ selectedFields: getSelectedFields(input),
28
+ });
29
+ }
30
+ }
31
+ exports.RecordDetail = RecordDetail;
32
+ function getSelectedFields(input) {
33
+ if (!input || !input.selectedFields || !Array.isArray(input.selectedFields)) {
34
+ return [];
35
+ }
36
+ let selectedFields = [];
37
+ for (let selectedField of input.selectedFields) {
38
+ if (!selectedField || !selectedField.picker || !selectedField.picker.fieldPath) {
39
+ continue;
40
+ }
41
+ let fieldPath = [];
42
+ for (let field of selectedField.picker.fieldPath) {
43
+ fieldPath.push({
44
+ objectApiName: field.objectApiName,
45
+ fieldApiName: field.fieldApiName,
46
+ });
47
+ }
48
+ selectedFields.push({ fieldPath: fieldPath });
49
+ }
50
+ return selectedFields;
51
+ }
52
+ //# sourceMappingURL=recordDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordDetail.js","sourceRoot":"","sources":["recordDetail.ts"],"names":[],"mappings":";;;AAAA,sCAAoD;AAIpD;;;;;;;;;GASG;AAEH,MAAM,YAAa,SAAQ,kBAAS;IAKhC,YAAY,MAA2B;QACnC,KAAK,CAAC,uBAAc,CAAC,mBAAmB,CAAC,CAAC;QAE1C,aAAa;QACb,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,KAA0B;QACnC,OAAO,IAAI,YAAY,CAAC;YACpB,aAAa,EAAE,KAAK,CAAC,UAAU;YAC/B,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,cAAc,EAAE,iBAAiB,CAAC,KAAK,CAAC;SAC3C,CAAC,CAAC;IACP,CAAC;CACJ;AA0BG,oCAAY;AAxBhB,SAAS,iBAAiB,CAAC,KAA0B;IACjD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;QACzE,OAAO,EAAE,CAAC;KACb;IAED,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,KAAK,IAAI,aAAa,IAAI,KAAK,CAAC,cAAc,EAAE;QAC5C,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,EAAE;YAC5E,SAAS;SACZ;QAED,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,KAAK,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,CAAC,SAAS,EAAE;YAC9C,SAAS,CAAC,IAAI,CAAC;gBACX,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,YAAY,EAAE,KAAK,CAAC,YAAY;aACnC,CAAC,CAAC;SACN;QACD,cAAc,CAAC,IAAI,CAAC,EAAC,SAAS,EAAE,SAAS,EAAC,CAAC,CAAC;KAC/C;IACD,OAAO,cAAc,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,64 @@
1
+ import {Component, componentTypes} from "../common";
2
+ import {SelectFieldType} from '../../types/components'
3
+ import {I18ns} from "../../types/common";
4
+
5
+ /*
6
+ titleAreaText: i18n;
7
+ objectApiName: string;
8
+ selectedFields: [{
9
+ fieldPath: [{
10
+ objectApiName: string;
11
+ fieldApiName: string;
12
+ }, ...];
13
+ },...]
14
+ */
15
+
16
+ class RecordDetail extends Component {
17
+ titleAreaText: I18ns;
18
+ objectApiName: string;
19
+ selectedFields: SelectFieldType[];
20
+
21
+ constructor(params: Record<string, any>) {
22
+ super(componentTypes.desktopRecordDetail);
23
+
24
+ // TODO check
25
+ this.titleAreaText = params.titleAreaText;
26
+ this.objectApiName = params.objectApiName;
27
+ this.selectedFields = params.selectedFields;
28
+ }
29
+
30
+ static parse(input: Record<string, any>): RecordDetail {
31
+ return new RecordDetail({
32
+ titleAreaText: input.titleLabel,
33
+ objectApiName: input.objectApiName,
34
+ selectedFields: getSelectedFields(input),
35
+ });
36
+ }
37
+ }
38
+
39
+ function getSelectedFields(input: Record<string, any>): SelectFieldType[] {
40
+ if (!input || !input.selectedFields || !Array.isArray(input.selectedFields)) {
41
+ return [];
42
+ }
43
+
44
+ let selectedFields = [];
45
+ for (let selectedField of input.selectedFields) {
46
+ if (!selectedField || !selectedField.picker || !selectedField.picker.fieldPath) {
47
+ continue;
48
+ }
49
+
50
+ let fieldPath = [];
51
+ for (let field of selectedField.picker.fieldPath) {
52
+ fieldPath.push({
53
+ objectApiName: field.objectApiName,
54
+ fieldApiName: field.fieldApiName,
55
+ });
56
+ }
57
+ selectedFields.push({fieldPath: fieldPath});
58
+ }
59
+ return selectedFields;
60
+ }
61
+
62
+ export {
63
+ RecordDetail,
64
+ }
@@ -0,0 +1,24 @@
1
+ import { MobileListItem, UIMetaFilterType, UIMetaMobileType } from "../../types/components";
2
+ import { I18ns } from "../../types/common";
3
+ import { Component } from "../common";
4
+ declare class List extends Component {
5
+ titleAreaText: I18ns;
6
+ objectApiName: string;
7
+ listItems: MobileListItem;
8
+ filter: UIMetaFilterType;
9
+ sortConditions: object[];
10
+ pageApiName: string;
11
+ componentName: string;
12
+ pageType: ("app" | "record_page");
13
+ needPublish: boolean;
14
+ constructor(params: UIMetaMobileType);
15
+ static parse(input: Record<string, any>): List;
16
+ getReqParam(): Record<string, any>;
17
+ getTableColumn(): {
18
+ apiName: string;
19
+ }[];
20
+ getDescribeFilter(): {
21
+ filter: string;
22
+ };
23
+ }
24
+ export { List, };