@steedos/service-metadata-objects 2.1.49 → 2.1.53
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.
- package/lib/actionsHandler.d.ts +1 -0
- package/lib/actionsHandler.js +12 -3
- package/lib/actionsHandler.js.map +1 -1
- package/lib/formula/formulaActionHandler.d.ts +1 -0
- package/lib/formula/formulaActionHandler.js +16 -0
- package/lib/formula/formulaActionHandler.js.map +1 -1
- package/lib/lookup/LookupActionHandler.d.ts +2 -2
- package/lib/lookup/LookupActionHandler.js +32 -29
- package/lib/lookup/LookupActionHandler.js.map +1 -1
- package/lib/master-detail/masterDetailActionHandler.d.ts +7 -6
- package/lib/master-detail/masterDetailActionHandler.js +85 -69
- package/lib/master-detail/masterDetailActionHandler.js.map +1 -1
- package/lib/objects/fields/index.d.ts +1 -0
- package/lib/objects/fields/index.js +143 -3
- package/lib/objects/fields/index.js.map +1 -1
- package/lib/objects/index.js +40 -20
- package/lib/objects/index.js.map +1 -1
- package/lib/objects.service.js +11 -0
- package/lib/objects.service.js.map +1 -1
- package/lib/summary/summaryActionHandler.d.ts +1 -0
- package/lib/summary/summaryActionHandler.js +16 -0
- package/lib/summary/summaryActionHandler.js.map +1 -1
- package/package.json +2 -2
- package/src/actionsHandler.ts +10 -3
- package/src/formula/formulaActionHandler.ts +14 -0
- package/src/lookup/LookupActionHandler.ts +21 -29
- package/src/master-detail/masterDetailActionHandler.ts +56 -66
- package/src/objects/fields/index.ts +145 -3
- package/src/objects/index.ts +113 -76
- package/src/objects.service.ts +9 -0
- package/src/summary/summaryActionHandler.ts +14 -0
|
@@ -18,6 +18,9 @@ export class LookupActionHandler {
|
|
|
18
18
|
|
|
19
19
|
async deleteAll(objectConfig){
|
|
20
20
|
try {
|
|
21
|
+
if (!objectConfig) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
21
24
|
await this.deleteAllLookups(objectConfig);
|
|
22
25
|
return true
|
|
23
26
|
} catch (error) {
|
|
@@ -63,14 +66,14 @@ export class LookupActionHandler {
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
getDetailKey(objectApiName) {
|
|
67
|
-
return `$steedos.$lookup.#${objectApiName}
|
|
69
|
+
getDetailKey(objectApiName, detailApiName) {
|
|
70
|
+
return `$steedos.$lookup.#${objectApiName}.$detail.${detailApiName}`
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
async getDetails(objectApiName: string) {
|
|
71
|
-
let { metadata } = (await this.broker.call('metadata.get', { key: this.getDetailKey(objectApiName) }, { meta: {} })) || {};
|
|
72
74
|
let detailName = [];
|
|
73
|
-
|
|
75
|
+
const detailsInfo = await this.getDetailsInfo(objectApiName);
|
|
76
|
+
_.each(detailsInfo, function(item){
|
|
74
77
|
if(item && _.isString(item)){
|
|
75
78
|
const foo = item.split('.');
|
|
76
79
|
if(foo.length > 0){
|
|
@@ -81,39 +84,28 @@ export class LookupActionHandler {
|
|
|
81
84
|
return _.uniq(detailName);
|
|
82
85
|
}
|
|
83
86
|
async getDetailsInfo(objectApiName: string){
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
const detailsInfo = [];
|
|
88
|
+
let records = (await this.broker.call('metadata.filter', { key: this.getDetailKey(objectApiName, "*") }, { meta: {} })) || {};
|
|
89
|
+
for await (const item of records) {
|
|
90
|
+
const metadata = item?.metadata;
|
|
91
|
+
if(metadata){
|
|
92
|
+
detailsInfo.push(metadata);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return detailsInfo;
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
async removeDetail(objectApiName: any, detailObjectApiName: string, detailField: any) {
|
|
89
|
-
let detail = await this.getDetailsInfo(objectApiName);
|
|
90
|
-
let maps = [];
|
|
91
|
-
if (detail) {
|
|
92
|
-
maps = detail;
|
|
93
|
-
}
|
|
94
99
|
const detailFullName = `${detailObjectApiName}.${detailField.name}`
|
|
95
|
-
|
|
96
|
-
await this.broker.call('metadata.add', { key: this.getDetailKey(objectApiName), data: maps }, { meta: {} })
|
|
97
|
-
// this.broker.emit(`@${objectApiName}.detailsChanged`, { objectApiName, detailObjectApiName, detailFieldName: detailField.name, detailFieldReferenceToFieldName: detailField.reference_to_field });
|
|
100
|
+
await this.broker.call('metadata.delete', { key: this.getDetailKey(objectApiName, detailFullName) }, { meta: {} });
|
|
98
101
|
return true;
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
async addDetail(objectApiName: any, detailObjectApiName: string, detailField: any) {
|
|
102
|
-
let detail = await this.getDetailsInfo(objectApiName);
|
|
103
|
-
let maps = [];
|
|
104
|
-
if (detail) {
|
|
105
|
-
maps = detail;
|
|
106
|
-
}
|
|
107
105
|
const detailFullName = `${detailObjectApiName}.${detailField.name}`
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
maps = _.uniq(maps);
|
|
112
|
-
await this.broker.call('metadata.add', { key: this.getDetailKey(objectApiName), data: maps }, { meta: {} })
|
|
113
|
-
this.broker.emit(`@${objectApiName}.detailsChanged`, { objectApiName, detailObjectApiName, detailFieldName: detailField.name, detailFieldReferenceToFieldName: detailField.reference_to_field });
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
return false;
|
|
106
|
+
await this.broker.call('metadata.add', { key: this.getDetailKey(objectApiName, detailFullName), data: detailFullName }, { meta: {} })
|
|
107
|
+
this.broker.broadcast(`@${objectApiName}.detailsChanged`, { objectApiName, detailObjectApiName, detailFieldName: detailField.name, detailFieldReferenceToFieldName: detailField.reference_to_field });
|
|
108
|
+
return true;
|
|
117
109
|
}
|
|
118
110
|
|
|
119
111
|
// async removeDetail(objectApiName: any, detailObjectApiName: string) {
|
|
@@ -126,7 +118,7 @@ export class LookupActionHandler {
|
|
|
126
118
|
// }
|
|
127
119
|
|
|
128
120
|
async deleteObjectLookups(objectApiName: string) {
|
|
129
|
-
await this.broker.call('metadata.
|
|
121
|
+
await this.broker.call('metadata.fuzzyDelete', { key: this.getDetailKey(objectApiName, '*') }, { meta: {} });
|
|
130
122
|
return true;
|
|
131
123
|
}
|
|
132
124
|
}
|
|
@@ -79,7 +79,21 @@ export class MasterDetailActionHandler{
|
|
|
79
79
|
}
|
|
80
80
|
return false
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
|
+
async deleteAll(objectConfig) {
|
|
84
|
+
try {
|
|
85
|
+
if (!objectConfig) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
await this.deleteObjectMasterDetails(objectConfig.name);
|
|
89
|
+
await this.broker.call('metadata.fuzzyDelete', {key: this.getDetailKey('*', objectConfig.name, '*')}, {meta: {}});
|
|
90
|
+
return true;
|
|
91
|
+
} catch (error) {
|
|
92
|
+
this.broker.logger.error(error);
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
83
97
|
async remove(objectConfig){
|
|
84
98
|
try {
|
|
85
99
|
await this.removeObjectMasterDetails(objectConfig);
|
|
@@ -104,10 +118,10 @@ export class MasterDetailActionHandler{
|
|
|
104
118
|
const fieldNameReferenceTo = item.split('.')[0];
|
|
105
119
|
const fieldName = item.split('.')[1];
|
|
106
120
|
const field = objectConfig.fields[fieldName];
|
|
107
|
-
|
|
121
|
+
// 考虑以下情况: (字段删除 | 字段名改变) 、 字段类型改变、 字段引用对象改变
|
|
108
122
|
if( !field || field.type !== 'master_detail' || field.reference_to !== fieldNameReferenceTo){
|
|
109
|
-
await this.removeMaster(objectApiName, fieldNameReferenceTo,
|
|
110
|
-
await this.removeDetail(fieldNameReferenceTo, objectApiName,
|
|
123
|
+
await this.removeMaster(objectApiName, fieldNameReferenceTo, fieldName);
|
|
124
|
+
await this.removeDetail(fieldNameReferenceTo, objectApiName, fieldName);
|
|
111
125
|
}
|
|
112
126
|
}
|
|
113
127
|
}
|
|
@@ -183,15 +197,14 @@ export class MasterDetailActionHandler{
|
|
|
183
197
|
await this.checkMasterDetails(objectApiName);
|
|
184
198
|
}
|
|
185
199
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return `$steedos.$masterDetail.#${objectApiName}.master`
|
|
200
|
+
getMasterKey(objectApiName, masterApiName){
|
|
201
|
+
return `$steedos.$masterDetail.#${objectApiName}.$master.${masterApiName}`
|
|
189
202
|
}
|
|
190
203
|
|
|
191
204
|
async getMasters(objectApiName: string){
|
|
192
|
-
let
|
|
205
|
+
let mastersInfo = await this.getMastersInfo(objectApiName);
|
|
193
206
|
let mastersName = [];
|
|
194
|
-
_.each(
|
|
207
|
+
_.each(mastersInfo, function(item){
|
|
195
208
|
if(item && _.isString(item)){
|
|
196
209
|
const foo = item.split('.');
|
|
197
210
|
if(foo.length > 0){
|
|
@@ -203,48 +216,37 @@ export class MasterDetailActionHandler{
|
|
|
203
216
|
}
|
|
204
217
|
|
|
205
218
|
async getMastersInfo(objectApiName: string){
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
const mastersInfo = [];
|
|
220
|
+
let records = (await this.broker.call('metadata.filter', { key: this.getMasterKey(objectApiName, "*") }, { meta: {} })) || {};
|
|
221
|
+
for await (const item of records) {
|
|
222
|
+
const metadata = item?.metadata;
|
|
223
|
+
if(metadata){
|
|
224
|
+
mastersInfo.push(metadata);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return mastersInfo;
|
|
208
228
|
}
|
|
209
229
|
|
|
210
230
|
async addMaster(objectApiName: any, masterObjectApiName: string, field: any){
|
|
211
|
-
let master = await this.getMastersInfo(objectApiName);
|
|
212
|
-
let maps = [];
|
|
213
|
-
if(master){
|
|
214
|
-
maps = master;
|
|
215
|
-
}
|
|
216
231
|
const masterFullName = `${masterObjectApiName}.${field.name}`
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
maps.push(masterFullName);
|
|
220
|
-
maps = _.uniq(maps);
|
|
221
|
-
await this.broker.call('metadata.add', {key: this.getMasterKey(objectApiName), data: maps}, {meta: {}})
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
console.log(`maps`, maps, masterFullName)
|
|
225
|
-
return false;
|
|
232
|
+
await this.broker.call('metadata.add', {key: this.getMasterKey(objectApiName, masterFullName), data: masterFullName}, {meta: {}})
|
|
233
|
+
return true;
|
|
226
234
|
}
|
|
227
235
|
|
|
228
|
-
async removeMaster(objectApiName: any, masterObjectApiName: string,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (master) {
|
|
232
|
-
maps = master;
|
|
233
|
-
}
|
|
234
|
-
const masterFullName = `${masterObjectApiName}.${masterField.name}`
|
|
235
|
-
maps = _.difference(maps, [masterFullName]);
|
|
236
|
-
await this.broker.call('metadata.add', { key: this.getMasterKey(objectApiName), data: maps }, { meta: {} })
|
|
236
|
+
async removeMaster(objectApiName: any, masterObjectApiName: string, masterFieldName: any){
|
|
237
|
+
const masterFullName = `${masterObjectApiName}.${masterFieldName}`
|
|
238
|
+
await this.broker.call('metadata.delete', { key: this.getMasterKey(objectApiName, masterFullName) }, { meta: {} })
|
|
237
239
|
return true;
|
|
238
240
|
}
|
|
239
241
|
|
|
240
|
-
getDetailKey(objectApiName){
|
|
241
|
-
return `$steedos.$masterDetail.#${objectApiName}
|
|
242
|
+
getDetailKey(objectApiName, detailObjectApiName, detailFieldName){
|
|
243
|
+
return `$steedos.$masterDetail.#${objectApiName}.$detail.${detailObjectApiName}.${detailFieldName}`
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
async getDetails(objectApiName: string){
|
|
245
|
-
let
|
|
247
|
+
let detailsInfo = await this.getDetailsInfo(objectApiName);
|
|
246
248
|
let detailsName = [];
|
|
247
|
-
_.each(
|
|
249
|
+
_.each(detailsInfo, function(item){
|
|
248
250
|
if(item && _.isString(item)){
|
|
249
251
|
const foo = item.split('.');
|
|
250
252
|
if(foo.length > 0){
|
|
@@ -256,38 +258,26 @@ export class MasterDetailActionHandler{
|
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
async getDetailsInfo(objectApiName: string){
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
const detailsInfo = [];
|
|
262
|
+
let records = (await this.broker.call('metadata.filter', { key: this.getDetailKey(objectApiName, "*", "*") }, { meta: {} })) || {};
|
|
263
|
+
for await (const item of records) {
|
|
264
|
+
const metadata = item?.metadata;
|
|
265
|
+
if(metadata){
|
|
266
|
+
detailsInfo.push(metadata);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return detailsInfo;
|
|
261
270
|
}
|
|
262
271
|
|
|
263
272
|
async addDetail(objectApiName: any, detailObjectApiName: string, detailField: any){
|
|
264
|
-
let detail = await this.getDetailsInfo(objectApiName);
|
|
265
|
-
let maps = [];
|
|
266
|
-
if(detail){
|
|
267
|
-
maps = detail;
|
|
268
|
-
}
|
|
269
273
|
const detailFullName = `${detailObjectApiName}.${detailField.name}`
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
maps = _.uniq(maps);
|
|
274
|
-
await this.broker.call('metadata.add', {key: this.getDetailKey(objectApiName), data: maps}, {meta: {}})
|
|
275
|
-
this.broker.emit(`@${objectApiName}.detailsChanged`, { objectApiName, detailObjectApiName, detailFieldName: detailField.name, detailFieldReferenceToFieldName: detailField.reference_to_field });
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
return false;
|
|
274
|
+
await this.broker.call('metadata.add', {key: this.getDetailKey(objectApiName, detailObjectApiName, detailField.name), data: detailFullName}, {meta: {}})
|
|
275
|
+
this.broker.broadcast(`@${objectApiName}.detailsChanged`, { objectApiName, detailObjectApiName, detailFieldName: detailField.name, detailFieldReferenceToFieldName: detailField.reference_to_field });
|
|
276
|
+
return true;
|
|
279
277
|
}
|
|
280
|
-
|
|
281
278
|
|
|
282
|
-
async removeDetail(objectApiName: any, detailObjectApiName: string,
|
|
283
|
-
|
|
284
|
-
let maps = [];
|
|
285
|
-
if (detail) {
|
|
286
|
-
maps = detail;
|
|
287
|
-
}
|
|
288
|
-
const detailFullName = `${detailObjectApiName}.${detailField.name}`
|
|
289
|
-
maps = _.difference(maps, [detailFullName]);
|
|
290
|
-
await this.broker.call('metadata.add', { key: this.getDetailKey(objectApiName), data: maps }, { meta: {} })
|
|
279
|
+
async removeDetail(objectApiName: any, detailObjectApiName: string, detailFieldName: any){
|
|
280
|
+
await this.broker.call('metadata.delete', { key: this.getDetailKey(objectApiName, detailObjectApiName, detailFieldName)}, { meta: {} })
|
|
291
281
|
return true;
|
|
292
282
|
}
|
|
293
283
|
|
|
@@ -357,8 +347,8 @@ export class MasterDetailActionHandler{
|
|
|
357
347
|
}
|
|
358
348
|
|
|
359
349
|
async deleteObjectMasterDetails(objectApiName: string){
|
|
360
|
-
await this.broker.call('metadata.
|
|
361
|
-
await this.broker.call('metadata.
|
|
350
|
+
await this.broker.call('metadata.fuzzyDelete', {key: this.getMasterKey(objectApiName, '*')}, {meta: {}});
|
|
351
|
+
await this.broker.call('metadata.fuzzyDelete', {key: this.getDetailKey(objectApiName, '*', '*')}, {meta: {}});
|
|
362
352
|
return true;
|
|
363
353
|
}
|
|
364
354
|
}
|
|
@@ -1,3 +1,145 @@
|
|
|
1
|
-
export async function addObjectField(){
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export async function addObjectField() {}
|
|
2
|
+
|
|
3
|
+
enum SteedosFieldDBType {
|
|
4
|
+
varchar = "varchar",
|
|
5
|
+
text = "text",
|
|
6
|
+
number = "number",
|
|
7
|
+
boolean = "boolean",
|
|
8
|
+
date = "date",
|
|
9
|
+
dateTime = "dateTime",
|
|
10
|
+
json = "json",
|
|
11
|
+
array = "array",
|
|
12
|
+
// oneToOne,
|
|
13
|
+
// oneToMany,
|
|
14
|
+
// manyToOne,
|
|
15
|
+
// manyToMany
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getDBType(objectName, field) {
|
|
19
|
+
switch (field.type) {
|
|
20
|
+
case "text":
|
|
21
|
+
return SteedosFieldDBType.varchar;
|
|
22
|
+
case "textarea":
|
|
23
|
+
return SteedosFieldDBType.text;
|
|
24
|
+
case "html":
|
|
25
|
+
return SteedosFieldDBType.text;
|
|
26
|
+
case "select":
|
|
27
|
+
if (this.multiple) {
|
|
28
|
+
return SteedosFieldDBType.array;
|
|
29
|
+
} else {
|
|
30
|
+
return SteedosFieldDBType.varchar;
|
|
31
|
+
}
|
|
32
|
+
case "boolean":
|
|
33
|
+
return SteedosFieldDBType.boolean;
|
|
34
|
+
case "toggle":
|
|
35
|
+
return SteedosFieldDBType.boolean;
|
|
36
|
+
case "date":
|
|
37
|
+
return SteedosFieldDBType.date;
|
|
38
|
+
case "datetime":
|
|
39
|
+
return SteedosFieldDBType.dateTime;
|
|
40
|
+
case "number":
|
|
41
|
+
return SteedosFieldDBType.number;
|
|
42
|
+
case "currency":
|
|
43
|
+
if (!this.scale && this.scale != 0) {
|
|
44
|
+
this.scale = 2;
|
|
45
|
+
}
|
|
46
|
+
return SteedosFieldDBType.number;
|
|
47
|
+
case "password":
|
|
48
|
+
return SteedosFieldDBType.varchar;
|
|
49
|
+
case "lookup":
|
|
50
|
+
// let reference_to = this.reference_to
|
|
51
|
+
// if(_.isFunction(this.reference_to)){
|
|
52
|
+
// reference_to = this.reference_to()
|
|
53
|
+
// }
|
|
54
|
+
|
|
55
|
+
// if(_.isArray(reference_to)){
|
|
56
|
+
// this._columnType = SteedosColumnType.manyToMany
|
|
57
|
+
// }else{
|
|
58
|
+
// if(this.multiple){
|
|
59
|
+
// this._columnType = SteedosColumnType.oneToMany
|
|
60
|
+
// }else{
|
|
61
|
+
// this._columnType = SteedosColumnType.oneToOne
|
|
62
|
+
// }
|
|
63
|
+
// }
|
|
64
|
+
return SteedosFieldDBType.varchar;
|
|
65
|
+
case "master_detail":
|
|
66
|
+
// let reference_to2 = this.reference_to
|
|
67
|
+
// if(_.isFunction(this.reference_to)){
|
|
68
|
+
// reference_to2 = this.reference_to()
|
|
69
|
+
// }
|
|
70
|
+
|
|
71
|
+
// if(_.isArray(reference_to2)){
|
|
72
|
+
// this._columnType = SteedosColumnType.manyToMany
|
|
73
|
+
// }else{
|
|
74
|
+
// if(this.multiple){
|
|
75
|
+
// this._columnType = SteedosColumnType.manyToOne //TODO
|
|
76
|
+
// }else{
|
|
77
|
+
// this._columnType = SteedosColumnType.oneToOne
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
return SteedosFieldDBType.varchar;
|
|
81
|
+
case "grid":
|
|
82
|
+
return SteedosFieldDBType.array;
|
|
83
|
+
case "url":
|
|
84
|
+
return SteedosFieldDBType.varchar;
|
|
85
|
+
case "email":
|
|
86
|
+
return SteedosFieldDBType.varchar;
|
|
87
|
+
case "avatar":
|
|
88
|
+
return SteedosFieldDBType.varchar;
|
|
89
|
+
case "location":
|
|
90
|
+
return SteedosFieldDBType.json;
|
|
91
|
+
case "image":
|
|
92
|
+
return SteedosFieldDBType.varchar;
|
|
93
|
+
case "object":
|
|
94
|
+
return SteedosFieldDBType.json;
|
|
95
|
+
case "url":
|
|
96
|
+
return SteedosFieldDBType.varchar;
|
|
97
|
+
case "[object]":
|
|
98
|
+
return SteedosFieldDBType.array;
|
|
99
|
+
case "[Object]":
|
|
100
|
+
return SteedosFieldDBType.array;
|
|
101
|
+
case "[grid]":
|
|
102
|
+
return SteedosFieldDBType.array;
|
|
103
|
+
case "[text]":
|
|
104
|
+
return SteedosFieldDBType.array;
|
|
105
|
+
case "selectCity":
|
|
106
|
+
return SteedosFieldDBType.json;
|
|
107
|
+
case "audio":
|
|
108
|
+
return SteedosFieldDBType.varchar;
|
|
109
|
+
case "filesize":
|
|
110
|
+
return SteedosFieldDBType.number;
|
|
111
|
+
case "file":
|
|
112
|
+
return SteedosFieldDBType.varchar;
|
|
113
|
+
case "string":
|
|
114
|
+
return SteedosFieldDBType.varchar;
|
|
115
|
+
case "code":
|
|
116
|
+
return SteedosFieldDBType.varchar;
|
|
117
|
+
case "function Object() { [native code] }":
|
|
118
|
+
return SteedosFieldDBType.json;
|
|
119
|
+
case Object:
|
|
120
|
+
return SteedosFieldDBType.json;
|
|
121
|
+
case "function String() { [native code] }":
|
|
122
|
+
return SteedosFieldDBType.varchar;
|
|
123
|
+
case String:
|
|
124
|
+
return SteedosFieldDBType.varchar;
|
|
125
|
+
case "Object":
|
|
126
|
+
return SteedosFieldDBType.json;
|
|
127
|
+
case "autonumber":
|
|
128
|
+
return SteedosFieldDBType.varchar;
|
|
129
|
+
case "markdown":
|
|
130
|
+
return SteedosFieldDBType.varchar;
|
|
131
|
+
case "formula":
|
|
132
|
+
return this.getDBType(this.data_type);
|
|
133
|
+
case "summary":
|
|
134
|
+
//汇总不需要check类型
|
|
135
|
+
return SteedosFieldDBType.varchar;
|
|
136
|
+
case "percent":
|
|
137
|
+
//百分比字段按数值类型处理
|
|
138
|
+
return this.getDBType("number");
|
|
139
|
+
default:
|
|
140
|
+
console.log(`field`, field);
|
|
141
|
+
throw new Error(
|
|
142
|
+
`${objectName}.${field.name} invalid field type ${field.type}`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
}
|