@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,14 @@
1
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import * as Request from "../../request/interface";
5
+
6
+ export class GlobalConfig {
7
+ /**
8
+ * 根据 key 获取对应的全局变量
9
+ * @param key 全局变量的 key
10
+ */
11
+ async getVar<valueT>(key: string): Promise<valueT> {
12
+ return await Request.GetInstance().getGlobalConfigByKey(key) as valueT
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ declare const componentTypes: Record<string, string>;
2
+ declare class Component {
3
+ private type;
4
+ constructor(type: string);
5
+ }
6
+ export { Component, componentTypes, };
@@ -0,0 +1,17 @@
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.componentTypes = exports.Component = void 0;
6
+ const componentTypes = {
7
+ desktopList: "desktopList",
8
+ desktopRecordDetail: "desktopRecordDetail",
9
+ mobileList: "mobileList",
10
+ };
11
+ exports.componentTypes = componentTypes;
12
+ class Component {
13
+ constructor(type) {
14
+ this.type = type;
15
+ }
16
+ }
17
+ exports.Component = Component;
@@ -0,0 +1,22 @@
1
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ const componentTypes: Record<string, string> = {
5
+ desktopList: "desktopList",
6
+ desktopRecordDetail: "desktopRecordDetail",
7
+
8
+ mobileList: "mobileList",
9
+ };
10
+
11
+ class Component {
12
+ private type: string;
13
+
14
+ constructor(type: string) {
15
+ this.type = type;
16
+ }
17
+ }
18
+
19
+ export {
20
+ Component,
21
+ componentTypes,
22
+ }
@@ -0,0 +1,12 @@
1
+ import { Component } from "./common";
2
+ import { RecordDetail as DesktopRecordDetail } from "./desktop/recordDetail";
3
+ import { List as DesktopList } from "./desktop/list";
4
+ import { List as MobileList } from "./mobile/list";
5
+ declare const desktop: {
6
+ RecordDetail: typeof DesktopRecordDetail;
7
+ List: typeof DesktopList;
8
+ };
9
+ declare const mobile: {
10
+ List: typeof MobileList;
11
+ };
12
+ export { Component, desktop, mobile, };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
3
+ // SPDX-License-Identifier: MIT
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.mobile = exports.desktop = exports.Component = void 0;
6
+ const common_1 = require("./common");
7
+ Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return common_1.Component; } });
8
+ const recordDetail_1 = require("./desktop/recordDetail");
9
+ const list_1 = require("./desktop/list");
10
+ const list_2 = require("./mobile/list");
11
+ const desktop = {
12
+ RecordDetail: recordDetail_1.RecordDetail,
13
+ List: list_1.List,
14
+ };
15
+ exports.desktop = desktop;
16
+ const mobile = {
17
+ List: list_2.List,
18
+ };
19
+ exports.mobile = mobile;
@@ -0,0 +1,22 @@
1
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import {Component} from "./common";
5
+ import {RecordDetail as DesktopRecordDetail} from "./desktop/recordDetail";
6
+ import {List as DesktopList} from "./desktop/list";
7
+ import {List as MobileList} from "./mobile/list";
8
+
9
+ const desktop = {
10
+ RecordDetail: DesktopRecordDetail,
11
+ List: DesktopList,
12
+ }
13
+
14
+ const mobile = {
15
+ List: MobileList,
16
+ }
17
+
18
+ export {
19
+ Component,
20
+ desktop,
21
+ mobile,
22
+ }
@@ -0,0 +1,16 @@
1
+ import { Component } from "../common";
2
+ import { UIMetaFilterType, UIMetaDesktopType, DeskListDetailField, DeskListSubtitleField, DeskListTitleField } from "../../types/components";
3
+ import { I18ns } from "../../types/common";
4
+ declare class List extends Component {
5
+ titleAreaText: I18ns;
6
+ objectApiName: string;
7
+ isCompositeType: boolean;
8
+ titleFields: DeskListTitleField[];
9
+ subtitleFields: DeskListSubtitleField[];
10
+ detailFields: DeskListDetailField[];
11
+ filter: UIMetaFilterType;
12
+ sortConditions: object[];
13
+ constructor(params: UIMetaDesktopType);
14
+ static parse(input: Record<string, any>): List;
15
+ }
16
+ export { List, };
@@ -0,0 +1,402 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.List = void 0;
4
+ const common = require("@byted-apaas/server-common-node");
5
+ const commonUtils = common.utils;
6
+ const common_1 = require("../common");
7
+ const common_2 = require("../../types/common");
8
+ /*
9
+ titleAreaText: i18n;
10
+ objectApiName: string;
11
+ isCompositeType: boolean;
12
+ titleFields: [{
13
+ fieldApiName: string;
14
+ },...]
15
+ subtitleFields: [{
16
+ type: "field"|"concatText"
17
+ fieldApiName: string;
18
+ alias: i18n;
19
+ concatText: {
20
+ zh_CN: [{
21
+ dataType: "fieldApiName"|"text"
22
+ fieldApiName: string;
23
+ text: string;
24
+ },...]
25
+ en_US: [{
26
+ dataType: "fieldApiName"|"text"
27
+ fieldApiName: string;
28
+ text: string;
29
+ },...]
30
+ }
31
+ },...]
32
+ detailFields: [{
33
+ fieldApiName: string;
34
+ alias: i18n;
35
+ },...]
36
+ filter: {
37
+ conditions: object[];
38
+ logic: string;
39
+ };
40
+ sortConditions: object[];
41
+ */
42
+ class List extends common_1.Component {
43
+ constructor(params) {
44
+ super(common_1.componentTypes.desktopList);
45
+ // TODO check
46
+ this.titleAreaText = params.titleAreaText;
47
+ this.objectApiName = params.objectApiName;
48
+ this.isCompositeType = params.isCompositeType;
49
+ this.titleFields = params.titleFields;
50
+ this.subtitleFields = params.subtitleFields;
51
+ this.detailFields = params.detailFields;
52
+ this.filter = params.filter;
53
+ this.sortConditions = params.sortConditions;
54
+ }
55
+ static parse(input) {
56
+ if (input.dataType === 'object') {
57
+ return convertUIMetaListObject(input);
58
+ }
59
+ else if (input.dataType === 'compositeType') {
60
+ return convertUIMetaListCompositeType(input);
61
+ }
62
+ return input;
63
+ }
64
+ }
65
+ exports.List = List;
66
+ function convertUIMetaListObject(input) {
67
+ return {
68
+ isCompositeType: false,
69
+ titleAreaText: input.titleLabel,
70
+ objectApiName: input.objectApiName,
71
+ titleFields: getListObjectTitleFields(input),
72
+ subtitleFields: getListObjectSubtitleFields(input),
73
+ detailFields: getListObjectDetailFields(input),
74
+ filter: getListFilter(input),
75
+ sortConditions: getListSort(input),
76
+ };
77
+ }
78
+ function convertUIMetaListCompositeType(input) {
79
+ return {
80
+ isCompositeType: true,
81
+ titleAreaText: input.titleLabel,
82
+ objectApiName: getListCompositeTypeObjectApiName(input),
83
+ titleFields: getListCompositeTypeTitleFields(input),
84
+ subtitleFields: getListCompositeTypeSubtitleFields(input),
85
+ detailFields: getListCompositeTypeDetailFields(input),
86
+ filter: getListCompositeTypeFilter(input),
87
+ sortConditions: getListSort(input),
88
+ };
89
+ }
90
+ function getListObjectTitleFields(input) {
91
+ if (!input || (0, common_2.isNullOrUndefined)(input.title)) {
92
+ return [];
93
+ }
94
+ let titles = [];
95
+ try {
96
+ let inputTitles = JSON.parse(input.title);
97
+ if (!inputTitles || !(inputTitles instanceof Array)) {
98
+ return [];
99
+ }
100
+ for (let inputTitle of inputTitles) {
101
+ titles.push({
102
+ fieldApiName: inputTitle.columnApiName,
103
+ });
104
+ }
105
+ }
106
+ catch (err) {
107
+ return [];
108
+ }
109
+ return titles;
110
+ }
111
+ function getListObjectSubtitleFields(input) {
112
+ if (!input || (0, common_2.isNullOrUndefined)(input["subTitle"])) {
113
+ return [];
114
+ }
115
+ let subtitles = [];
116
+ try {
117
+ let inputSubtitles = JSON.parse(input.subTitle);
118
+ if (!inputSubtitles || !Array.isArray(inputSubtitles)) {
119
+ return [];
120
+ }
121
+ for (let inputSubtitle of inputSubtitles) {
122
+ subtitles.push({
123
+ fieldApiName: inputSubtitle.columnApiName,
124
+ alias: inputSubtitle.alias,
125
+ });
126
+ }
127
+ }
128
+ catch (err) {
129
+ return [];
130
+ }
131
+ return subtitles;
132
+ }
133
+ function getListObjectDetailFields(input) {
134
+ if (!input || (0, common_2.isNullOrUndefined)(input.detail)) {
135
+ return [];
136
+ }
137
+ let details = [];
138
+ try {
139
+ let inputDetails = JSON.parse(input.detail);
140
+ if (!inputDetails || !Array.isArray(inputDetails)) {
141
+ return [];
142
+ }
143
+ for (let inputDetail of inputDetails) {
144
+ details.push({
145
+ fieldApiName: inputDetail.columnApiName,
146
+ alias: inputDetail.alias,
147
+ });
148
+ }
149
+ }
150
+ catch (err) {
151
+ return [];
152
+ }
153
+ return details;
154
+ }
155
+ function getListFilter(input) {
156
+ if (!input || !input.describeFilter || (0, common_2.isNullOrUndefined)(input.describeFilter.filter)) {
157
+ return {};
158
+ }
159
+ try {
160
+ let inputFilter = JSON.parse(input.describeFilter.filter);
161
+ if (!inputFilter) {
162
+ return {};
163
+ }
164
+ return {
165
+ conditions: inputFilter.conditions,
166
+ logic: inputFilter.logic,
167
+ };
168
+ }
169
+ catch (err) {
170
+ return {};
171
+ }
172
+ }
173
+ function getListSort(input) {
174
+ if (!input || !input.sort || !Array.isArray(input.sort)) {
175
+ return [];
176
+ }
177
+ let sortFields = [];
178
+ for (let field of input.sort) {
179
+ sortFields.push({
180
+ fieldApiName: field.field,
181
+ sort: field.direction,
182
+ });
183
+ }
184
+ return sortFields;
185
+ }
186
+ function getListCompositeTypeObjectApiName(input) {
187
+ if ((0, common_2.isNullOrUndefined)(input)) {
188
+ return "";
189
+ }
190
+ let objectApiName = getObjectApiNameFromTitle(input);
191
+ if (objectApiName) {
192
+ return objectApiName;
193
+ }
194
+ objectApiName = getObjectApiNameFromSubTitle(input);
195
+ if (objectApiName) {
196
+ return objectApiName;
197
+ }
198
+ objectApiName = getObjectApiNameFromDetail(input);
199
+ if (objectApiName) {
200
+ return objectApiName;
201
+ }
202
+ return "";
203
+ }
204
+ function getObjectApiNameFromTitle(input) {
205
+ if (!input || (0, common_2.isNullOrUndefined)(input.title)) {
206
+ return "";
207
+ }
208
+ try {
209
+ return JSON.parse(input.title)[0].picker.fieldPath[0].objectApiName;
210
+ }
211
+ catch (err) {
212
+ return "";
213
+ }
214
+ }
215
+ function getObjectApiNameFromDetail(input) {
216
+ if (!input || (0, common_2.isNullOrUndefined)(input.detail)) {
217
+ return "";
218
+ }
219
+ try {
220
+ return JSON.parse(input.detail)[0].picker.fieldPath[0].objectApiName;
221
+ }
222
+ catch (err) {
223
+ return "";
224
+ }
225
+ }
226
+ function getObjectApiNameFromSubTitle(input) {
227
+ if (!input || (0, common_2.isNullOrUndefined)(input.subTitle)) {
228
+ return "";
229
+ }
230
+ try {
231
+ return JSON.parse(input.subTitle)[0].picker.fieldPath[0].objectApiName;
232
+ }
233
+ catch (err) {
234
+ return "";
235
+ }
236
+ }
237
+ function getListCompositeTypeTitleFields(input) {
238
+ if (!input || (0, common_2.isNullOrUndefined)(input.title)) {
239
+ return [];
240
+ }
241
+ let inputFields = [];
242
+ try {
243
+ let inputTitles = JSON.parse(input.title);
244
+ if (!inputTitles || !(inputTitles instanceof Array)) {
245
+ return [];
246
+ }
247
+ for (let title of inputTitles) {
248
+ try {
249
+ inputFields.push({
250
+ fieldApiName: title.picker.fieldPath[0].fieldApiName,
251
+ });
252
+ }
253
+ catch (e) {
254
+ continue;
255
+ }
256
+ }
257
+ }
258
+ catch (err) {
259
+ return [];
260
+ }
261
+ return inputFields;
262
+ }
263
+ function parsePrimitive(element) {
264
+ try {
265
+ return {
266
+ type: "field",
267
+ fieldApiName: element.picker.fieldPath[0].fieldApiName,
268
+ alias: [],
269
+ concatText: {
270
+ zh_CN: [],
271
+ en_US: [],
272
+ }
273
+ };
274
+ }
275
+ catch (e) {
276
+ return null;
277
+ }
278
+ }
279
+ function getListCompositeTypeSubtitleFields(input) {
280
+ if (!input || (0, common_2.isNullOrUndefined)(input.subTitle)) {
281
+ return [];
282
+ }
283
+ let fields = [], subTitle;
284
+ try {
285
+ subTitle = JSON.parse(input.subTitle);
286
+ }
287
+ catch (err) {
288
+ return [];
289
+ }
290
+ if (!subTitle || !Array.isArray(subTitle)) {
291
+ return [];
292
+ }
293
+ for (let element of subTitle) {
294
+ let field = null;
295
+ if (element.type === 'primitive') {
296
+ field = parsePrimitive(element);
297
+ }
298
+ else if (element.type === 'concatenate') {
299
+ field = parseConcatenate(element);
300
+ }
301
+ if (field) {
302
+ fields.push(field);
303
+ }
304
+ }
305
+ return fields;
306
+ }
307
+ function getListCompositeTypeDetailFields(input) {
308
+ if (!input || (0, common_2.isNullOrUndefined)(input.detail)) {
309
+ return [];
310
+ }
311
+ let fields = [];
312
+ try {
313
+ let detail = JSON.parse(input.detail);
314
+ if (!detail || !(detail instanceof Array)) {
315
+ return [];
316
+ }
317
+ for (let element of detail) {
318
+ try {
319
+ fields.push({
320
+ fieldApiName: element.picker.fieldPath[0].fieldApiName,
321
+ alias: [], // TODO
322
+ });
323
+ }
324
+ catch (e) {
325
+ continue;
326
+ }
327
+ }
328
+ }
329
+ catch (err) {
330
+ return [];
331
+ }
332
+ return fields;
333
+ }
334
+ function getListCompositeTypeFilter(input) {
335
+ if (!input || !input.describeFilter || (0, common_2.isNullOrUndefined)(input.describeFilter.filter)) {
336
+ return {};
337
+ }
338
+ try {
339
+ let inputFilter = JSON.parse(input.describeFilter.filter);
340
+ if (!inputFilter) {
341
+ return {};
342
+ }
343
+ return {
344
+ conditions: inputFilter.conditions,
345
+ logic: inputFilter.logic,
346
+ };
347
+ }
348
+ catch (err) {
349
+ return {};
350
+ }
351
+ }
352
+ function parseLangValues(values) {
353
+ let lang = [];
354
+ for (let value of values) {
355
+ if (value.type === "text") {
356
+ lang.push({
357
+ dataType: "text",
358
+ fieldApiName: "",
359
+ text: value.value,
360
+ });
361
+ }
362
+ else if (value.type === "field") {
363
+ if (value && value.picker && commonUtils.getArrayLength(value.picker.fieldPath) > 0
364
+ && value.picker.fieldPath[0].fieldApiName) {
365
+ lang.push({
366
+ dataType: "fieldApiName",
367
+ fieldApiName: value.picker.fieldPath[0].fieldApiName,
368
+ text: ""
369
+ });
370
+ }
371
+ }
372
+ }
373
+ return lang;
374
+ }
375
+ function parseConcatenate(element) {
376
+ if (!element || (0, common_2.isNullOrUndefined)(element.content)) {
377
+ return null;
378
+ }
379
+ let concatEle = {
380
+ type: "concatText",
381
+ fieldApiName: "",
382
+ alias: [],
383
+ concatText: {
384
+ zh_CN: [],
385
+ en_US: [],
386
+ }
387
+ };
388
+ for (let code of Object.keys(element.content)) {
389
+ let values = element.content[code];
390
+ if (code === "2052") {
391
+ concatEle.concatText.zh_CN = parseLangValues(values);
392
+ }
393
+ else if (code === "1033") {
394
+ concatEle.concatText.en_US = parseLangValues(values);
395
+ }
396
+ }
397
+ if (commonUtils.getArrayLength(concatEle.concatText.zh_CN) > 0 ||
398
+ commonUtils.getArrayLength(concatEle.concatText.en_US) > 0) {
399
+ return concatEle;
400
+ }
401
+ return null;
402
+ }