@byted-apaas/server-sdk-node 0.0.1-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/README.md +1 -0
  4. package/application/application.d.ts +27 -0
  5. package/application/application.js +2 -0
  6. package/application/application.ts +40 -0
  7. package/application/function/function.d.ts +14 -0
  8. package/application/function/function.js +21 -0
  9. package/application/function/function.ts +37 -0
  10. package/application/impl/common.d.ts +2 -0
  11. package/application/impl/common.js +50 -0
  12. package/application/impl/common.ts +50 -0
  13. package/application/impl/impl.d.ts +16 -0
  14. package/application/impl/impl.js +38 -0
  15. package/application/impl/impl.ts +48 -0
  16. package/constants/constants.d.ts +10 -0
  17. package/constants/constants.js +15 -0
  18. package/constants/constants.ts +15 -0
  19. package/context/context.d.ts +74 -0
  20. package/context/context.js +25 -0
  21. package/context/context.ts +130 -0
  22. package/context/db/db.d.ts +73 -0
  23. package/context/db/db.js +4 -0
  24. package/context/db/db.ts +80 -0
  25. package/context/db/impl/IObject.d.ts +251 -0
  26. package/context/db/impl/IObject.js +5 -0
  27. package/context/db/impl/IObject.ts +247 -0
  28. package/context/db/impl/db.d.ts +61 -0
  29. package/context/db/impl/db.js +86 -0
  30. package/context/db/impl/db.ts +95 -0
  31. package/context/db/impl/object.d.ts +92 -0
  32. package/context/db/impl/object.js +524 -0
  33. package/context/db/impl/object.ts +631 -0
  34. package/context/db/impl/oql/ioql.d.ts +6 -0
  35. package/context/db/impl/oql/ioql.js +4 -0
  36. package/context/db/impl/oql/ioql.ts +9 -0
  37. package/context/db/impl/oql/oql.d.ts +8 -0
  38. package/context/db/impl/oql/oql.js +21 -0
  39. package/context/db/impl/oql/oql.ts +25 -0
  40. package/context/db/impl/order.d.ts +9 -0
  41. package/context/db/impl/order.js +15 -0
  42. package/context/db/impl/order.ts +19 -0
  43. package/context/db/impl/propertiesStore.d.ts +8 -0
  44. package/context/db/impl/propertiesStore.js +29 -0
  45. package/context/db/impl/propertiesStore.ts +31 -0
  46. package/context/db/impl/queryBuilder.d.ts +29 -0
  47. package/context/db/impl/queryBuilder.js +78 -0
  48. package/context/db/impl/queryBuilder.ts +106 -0
  49. package/context/db/impl/transaction/index.d.ts +20 -0
  50. package/context/db/impl/transaction/index.js +277 -0
  51. package/context/db/impl/transaction/index.ts +340 -0
  52. package/context/db/impl/transaction/operation.d.ts +27 -0
  53. package/context/db/impl/transaction/operation.js +69 -0
  54. package/context/db/impl/transaction/operation.ts +72 -0
  55. package/context/db/impl/transaction.d.ts +67 -0
  56. package/context/db/impl/transaction.js +4 -0
  57. package/context/db/impl/transaction.ts +79 -0
  58. package/context/globalConfig/globalConfig.d.ts +7 -0
  59. package/context/globalConfig/globalConfig.js +16 -0
  60. package/context/globalConfig/globalConfig.ts +14 -0
  61. package/context/metadata/components/common.d.ts +6 -0
  62. package/context/metadata/components/common.js +17 -0
  63. package/context/metadata/components/common.ts +22 -0
  64. package/context/metadata/components/components.d.ts +12 -0
  65. package/context/metadata/components/components.js +19 -0
  66. package/context/metadata/components/components.ts +22 -0
  67. package/context/metadata/components/desktop/list.d.ts +16 -0
  68. package/context/metadata/components/desktop/list.js +402 -0
  69. package/context/metadata/components/desktop/list.ts +457 -0
  70. package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
  71. package/context/metadata/components/desktop/recordDetail.js +53 -0
  72. package/context/metadata/components/desktop/recordDetail.ts +67 -0
  73. package/context/metadata/components/mobile/list.d.ts +24 -0
  74. package/context/metadata/components/mobile/list.js +145 -0
  75. package/context/metadata/components/mobile/list.ts +179 -0
  76. package/context/metadata/metadata.d.ts +61 -0
  77. package/context/metadata/metadata.js +103 -0
  78. package/context/metadata/metadata.ts +178 -0
  79. package/context/metadata/objects/fields.d.ts +130 -0
  80. package/context/metadata/objects/fields.js +334 -0
  81. package/context/metadata/objects/fields.ts +457 -0
  82. package/context/metadata/objects/fields.util.d.ts +40 -0
  83. package/context/metadata/objects/fields.util.js +319 -0
  84. package/context/metadata/objects/fields.util.ts +360 -0
  85. package/context/metadata/objects/objects.d.ts +11 -0
  86. package/context/metadata/objects/objects.js +20 -0
  87. package/context/metadata/objects/objects.ts +30 -0
  88. package/context/metadata/types/common.d.ts +6 -0
  89. package/context/metadata/types/common.js +9 -0
  90. package/context/metadata/types/common.ts +13 -0
  91. package/context/metadata/types/components.d.ts +90 -0
  92. package/context/metadata/types/components.js +4 -0
  93. package/context/metadata/types/components.ts +108 -0
  94. package/context/metadata/types/objects.d.ts +226 -0
  95. package/context/metadata/types/objects.js +4 -0
  96. package/context/metadata/types/objects.ts +254 -0
  97. package/context/msg/msg.d.ts +38 -0
  98. package/context/msg/msg.js +35 -0
  99. package/context/msg/msg.ts +52 -0
  100. package/context/resources/IResources.d.ts +66 -0
  101. package/context/resources/IResources.js +2 -0
  102. package/context/resources/IResources.ts +73 -0
  103. package/context/resources/impl/resources.d.ts +42 -0
  104. package/context/resources/impl/resources.js +150 -0
  105. package/context/resources/impl/resources.ts +173 -0
  106. package/context/tasks/tasks.d.ts +33 -0
  107. package/context/tasks/tasks.js +139 -0
  108. package/context/tasks/tasks.ts +159 -0
  109. package/data/index.d.ts +27 -0
  110. package/data/index.js +4 -0
  111. package/data/index.ts +30 -0
  112. package/hooks/api.d.ts +61 -0
  113. package/hooks/api.js +327 -0
  114. package/hooks/api.ts +341 -0
  115. package/hooks/hooks.d.ts +1 -0
  116. package/hooks/hooks.js +88 -0
  117. package/hooks/hooks.ts +100 -0
  118. package/kunlun/kunlun.d.ts +55 -0
  119. package/kunlun/kunlun.js +58 -0
  120. package/kunlun/kunlun.ts +72 -0
  121. package/kunlun/operator/IOperator.d.ts +158 -0
  122. package/kunlun/operator/IOperator.js +4 -0
  123. package/kunlun/operator/IOperator.ts +166 -0
  124. package/kunlun/operator/impl/expression.d.ts +47 -0
  125. package/kunlun/operator/impl/expression.js +56 -0
  126. package/kunlun/operator/impl/expression.ts +74 -0
  127. package/kunlun/operator/impl/logic.d.ts +50 -0
  128. package/kunlun/operator/impl/logic.js +509 -0
  129. package/kunlun/operator/impl/logic.ts +598 -0
  130. package/kunlun/operator/impl/logicV2.d.ts +58 -0
  131. package/kunlun/operator/impl/logicV2.js +200 -0
  132. package/kunlun/operator/impl/logicV2.ts +254 -0
  133. package/kunlun/operator/impl/operator.d.ts +179 -0
  134. package/kunlun/operator/impl/operator.js +222 -0
  135. package/kunlun/operator/impl/operator.ts +258 -0
  136. package/kunlun/operator/impl/operatorV2.d.ts +180 -0
  137. package/kunlun/operator/impl/operatorV2.js +216 -0
  138. package/kunlun/operator/impl/operatorV2.ts +249 -0
  139. package/lib/core.d.ts +4 -0
  140. package/lib/core.js +19 -0
  141. package/lib/core.ts +7 -0
  142. package/package.json +50 -0
  143. package/request/common.d.ts +13 -0
  144. package/request/common.js +87 -0
  145. package/request/common.ts +91 -0
  146. package/request/constants.d.ts +10 -0
  147. package/request/constants.js +25 -0
  148. package/request/constants.ts +25 -0
  149. package/request/faasinfra.d.ts +8 -0
  150. package/request/faasinfra.js +358 -0
  151. package/request/faasinfra.ts +393 -0
  152. package/request/innerapi.d.ts +67 -0
  153. package/request/innerapi.js +1412 -0
  154. package/request/innerapi.ts +1648 -0
  155. package/request/interface.d.ts +95 -0
  156. package/request/interface.js +41 -0
  157. package/request/interface.ts +169 -0
  158. package/request/openapi.d.ts +69 -0
  159. package/request/openapi.js +1014 -0
  160. package/request/openapi.ts +1223 -0
  161. package/types/types.d.ts +79 -0
  162. package/types/types.js +4 -0
  163. package/types/types.ts +108 -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,53 @@
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.RecordDetail = void 0;
6
+ const common_1 = require("../common");
7
+ /*
8
+ titleAreaText: i18n;
9
+ objectApiName: string;
10
+ selectedFields: [{
11
+ fieldPath: [{
12
+ objectApiName: string;
13
+ fieldApiName: string;
14
+ }, ...];
15
+ },...]
16
+ */
17
+ class RecordDetail extends common_1.Component {
18
+ constructor(params) {
19
+ super(common_1.componentTypes.desktopRecordDetail);
20
+ // TODO check
21
+ this.titleAreaText = params.titleAreaText;
22
+ this.objectApiName = params.objectApiName;
23
+ this.selectedFields = params.selectedFields;
24
+ }
25
+ static parse(input) {
26
+ return new RecordDetail({
27
+ titleAreaText: input.titleLabel,
28
+ objectApiName: input.objectApiName,
29
+ selectedFields: getSelectedFields(input),
30
+ });
31
+ }
32
+ }
33
+ exports.RecordDetail = RecordDetail;
34
+ function getSelectedFields(input) {
35
+ if (!input || !input.selectedFields || !Array.isArray(input.selectedFields)) {
36
+ return [];
37
+ }
38
+ let selectedFields = [];
39
+ for (let selectedField of input.selectedFields) {
40
+ if (!selectedField || !selectedField.picker || !selectedField.picker.fieldPath) {
41
+ continue;
42
+ }
43
+ let fieldPath = [];
44
+ for (let field of selectedField.picker.fieldPath) {
45
+ fieldPath.push({
46
+ objectApiName: field.objectApiName,
47
+ fieldApiName: field.fieldApiName,
48
+ });
49
+ }
50
+ selectedFields.push({ fieldPath: fieldPath });
51
+ }
52
+ return selectedFields;
53
+ }
@@ -0,0 +1,67 @@
1
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import {Component, componentTypes} from "../common";
5
+ import {SelectFieldType} from '../../types/components'
6
+ import {I18ns} from "../../types/common";
7
+
8
+ /*
9
+ titleAreaText: i18n;
10
+ objectApiName: string;
11
+ selectedFields: [{
12
+ fieldPath: [{
13
+ objectApiName: string;
14
+ fieldApiName: string;
15
+ }, ...];
16
+ },...]
17
+ */
18
+
19
+ class RecordDetail extends Component {
20
+ titleAreaText: I18ns;
21
+ objectApiName: string;
22
+ selectedFields: SelectFieldType[];
23
+
24
+ constructor(params: Record<string, any>) {
25
+ super(componentTypes.desktopRecordDetail);
26
+
27
+ // TODO check
28
+ this.titleAreaText = params.titleAreaText;
29
+ this.objectApiName = params.objectApiName;
30
+ this.selectedFields = params.selectedFields;
31
+ }
32
+
33
+ static parse(input: Record<string, any>): RecordDetail {
34
+ return new RecordDetail({
35
+ titleAreaText: input.titleLabel,
36
+ objectApiName: input.objectApiName,
37
+ selectedFields: getSelectedFields(input),
38
+ });
39
+ }
40
+ }
41
+
42
+ function getSelectedFields(input: Record<string, any>): SelectFieldType[] {
43
+ if (!input || !input.selectedFields || !Array.isArray(input.selectedFields)) {
44
+ return [];
45
+ }
46
+
47
+ let selectedFields = [];
48
+ for (let selectedField of input.selectedFields) {
49
+ if (!selectedField || !selectedField.picker || !selectedField.picker.fieldPath) {
50
+ continue;
51
+ }
52
+
53
+ let fieldPath = [];
54
+ for (let field of selectedField.picker.fieldPath) {
55
+ fieldPath.push({
56
+ objectApiName: field.objectApiName,
57
+ fieldApiName: field.fieldApiName,
58
+ });
59
+ }
60
+ selectedFields.push({fieldPath: fieldPath});
61
+ }
62
+ return selectedFields;
63
+ }
64
+
65
+ export {
66
+ RecordDetail,
67
+ }
@@ -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, };