@steedos/objectql 2.1.82 → 2.1.84
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/actions/field_updates.js +15 -15
- package/lib/actions/field_updates.js.map +1 -1
- package/lib/actions/index.js +3 -3
- package/lib/actions/index.js.map +1 -1
- package/lib/actions/workflow_notifications.js +10 -10
- package/lib/actions/workflow_notifications.js.map +1 -1
- package/lib/actions/workflow_rule.js +19 -19
- package/lib/actions/workflow_rule.js.map +1 -1
- package/lib/driver/index.js +1 -0
- package/lib/driver/index.js.map +1 -1
- package/lib/driver/metadata.js +3 -3
- package/lib/driver/metadata.js.map +1 -1
- package/lib/driver/meteorMongo.js +36 -36
- package/lib/driver/meteorMongo.js.map +1 -1
- package/lib/driver/mongo.js +43 -43
- package/lib/driver/mongo.js.map +1 -1
- package/lib/driver/mysql.js +2 -2
- package/lib/driver/mysql.js.map +1 -1
- package/lib/driver/oracle.js +5 -5
- package/lib/driver/oracle.js.map +1 -1
- package/lib/driver/postgres.js +2 -2
- package/lib/driver/postgres.js.map +1 -1
- package/lib/driver/sqlite3.js +2 -2
- package/lib/driver/sqlite3.js.map +1 -1
- package/lib/driver/sqlserver.js +4 -4
- package/lib/driver/sqlserver.js.map +1 -1
- package/lib/dynamic-load/actions.js +22 -18
- package/lib/dynamic-load/actions.js.map +1 -1
- package/lib/dynamic-load/approval_process.js +15 -10
- package/lib/dynamic-load/approval_process.js.map +1 -1
- package/lib/dynamic-load/button.js +25 -18
- package/lib/dynamic-load/button.js.map +1 -1
- package/lib/dynamic-load/chart.js +20 -23
- package/lib/dynamic-load/chart.js.map +1 -1
- package/lib/dynamic-load/field.js +21 -16
- package/lib/dynamic-load/field.js.map +1 -1
- package/lib/dynamic-load/flow_role.js +12 -8
- package/lib/dynamic-load/flow_role.js.map +1 -1
- package/lib/dynamic-load/index.d.ts +1 -0
- package/lib/dynamic-load/index.js +20 -19
- package/lib/dynamic-load/index.js.map +1 -1
- package/lib/dynamic-load/layout.js +19 -14
- package/lib/dynamic-load/layout.js.map +1 -1
- package/lib/dynamic-load/listview.js +14 -11
- package/lib/dynamic-load/listview.js.map +1 -1
- package/lib/dynamic-load/method.js +9 -6
- package/lib/dynamic-load/method.js.map +1 -1
- package/lib/dynamic-load/object_translations.js +29 -51
- package/lib/dynamic-load/object_translations.js.map +1 -1
- package/lib/dynamic-load/originalObject.js +1 -1
- package/lib/dynamic-load/originalObject.js.map +1 -1
- package/lib/dynamic-load/package.d.ts +9 -0
- package/lib/dynamic-load/package.js +507 -0
- package/lib/dynamic-load/package.js.map +1 -0
- package/lib/dynamic-load/page.js +20 -23
- package/lib/dynamic-load/page.js.map +1 -1
- package/lib/dynamic-load/permission.js +61 -65
- package/lib/dynamic-load/permission.js.map +1 -1
- package/lib/dynamic-load/permissionset.js +30 -25
- package/lib/dynamic-load/permissionset.js.map +1 -1
- package/lib/dynamic-load/preload_data.js +55 -74
- package/lib/dynamic-load/preload_data.js.map +1 -1
- package/lib/dynamic-load/profile.js +33 -28
- package/lib/dynamic-load/profile.js.map +1 -1
- package/lib/dynamic-load/query.js +20 -23
- package/lib/dynamic-load/query.js.map +1 -1
- package/lib/dynamic-load/restrictionRules.js +18 -23
- package/lib/dynamic-load/restrictionRules.js.map +1 -1
- package/lib/dynamic-load/role.js +12 -8
- package/lib/dynamic-load/role.js.map +1 -1
- package/lib/dynamic-load/shareRules.js +18 -23
- package/lib/dynamic-load/shareRules.js.map +1 -1
- package/lib/dynamic-load/tab.js +4 -3
- package/lib/dynamic-load/tab.js.map +1 -1
- package/lib/dynamic-load/tabs.js +9 -7
- package/lib/dynamic-load/tabs.js.map +1 -1
- package/lib/dynamic-load/translations.js +23 -17
- package/lib/dynamic-load/translations.js.map +1 -1
- package/lib/dynamic-load/trigger.js +14 -10
- package/lib/dynamic-load/trigger.js.map +1 -1
- package/lib/dynamic-load/validation_rule.js +13 -8
- package/lib/dynamic-load/validation_rule.js.map +1 -1
- package/lib/dynamic-load/workflow.js +38 -25
- package/lib/dynamic-load/workflow.js.map +1 -1
- package/lib/errors/index.js +2 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/formula/core.js +105 -91
- package/lib/formula/core.js.map +1 -1
- package/lib/formula/field_formula.js +26 -20
- package/lib/formula/field_formula.js.map +1 -1
- package/lib/formula/index.js +26 -26
- package/lib/formula/index.js.map +1 -1
- package/lib/formula/params.js +1 -1
- package/lib/formula/params.js.map +1 -1
- package/lib/formula/recompute.js +27 -25
- package/lib/formula/recompute.js.map +1 -1
- package/lib/formula/simple_params.js +2 -2
- package/lib/formula/simple_params.js.map +1 -1
- package/lib/formula/util.js +33 -23
- package/lib/formula/util.js.map +1 -1
- package/lib/index.js +15 -15
- package/lib/index.js.map +1 -1
- package/lib/metadata-register/_base.d.ts +1 -0
- package/lib/metadata-register/_base.js +45 -15
- package/lib/metadata-register/_base.js.map +1 -1
- package/lib/metadata-register/app.js +8 -8
- package/lib/metadata-register/chart.js +1 -1
- package/lib/metadata-register/chart.js.map +1 -1
- package/lib/metadata-register/index.js +72 -72
- package/lib/metadata-register/index.js.map +1 -1
- package/lib/metadata-register/layout.js +18 -16
- package/lib/metadata-register/layout.js.map +1 -1
- package/lib/metadata-register/object.d.ts +0 -1
- package/lib/metadata-register/object.js +17 -35
- package/lib/metadata-register/object.js.map +1 -1
- package/lib/metadata-register/page.js +1 -1
- package/lib/metadata-register/page.js.map +1 -1
- package/lib/metadata-register/permissionFields.js +2 -2
- package/lib/metadata-register/permissionFields.js.map +1 -1
- package/lib/metadata-register/permissionset.js +6 -6
- package/lib/metadata-register/profile.js +6 -6
- package/lib/metadata-register/query.js +1 -1
- package/lib/metadata-register/query.js.map +1 -1
- package/lib/metadata-register/restrictionRules.js +2 -2
- package/lib/metadata-register/restrictionRules.js.map +1 -1
- package/lib/metadata-register/shareRules.js +2 -2
- package/lib/metadata-register/shareRules.js.map +1 -1
- package/lib/metadata-register/tab.js +1 -1
- package/lib/metadata-register/tab.js.map +1 -1
- package/lib/metadata-register/tabs.js +18 -16
- package/lib/metadata-register/tabs.js.map +1 -1
- package/lib/services/datasourceServiceFactory.d.ts +1 -0
- package/lib/services/datasourceServiceFactory.js +51 -0
- package/lib/services/datasourceServiceFactory.js.map +1 -0
- package/lib/services/helpers/graphql.js +86 -87
- package/lib/services/helpers/graphql.js.map +1 -1
- package/lib/services/helpers/index.js +2 -2
- package/lib/services/helpers/index.js.map +1 -1
- package/lib/services/helpers/rest.js +1 -1
- package/lib/services/helpers/rest.js.map +1 -1
- package/lib/services/index.d.ts +3 -0
- package/lib/services/index.js +10 -4
- package/lib/services/index.js.map +1 -1
- package/lib/services/objectService.js +143 -143
- package/lib/services/objectService.js.map +1 -1
- package/lib/services/objectServiceDispatcher.js +92 -92
- package/lib/services/objectServiceDispatcher.js.map +1 -1
- package/lib/{metadata-register/objectServiceManager.d.ts → services/objectServiceFactory.d.ts} +0 -0
- package/lib/{metadata-register/objectServiceManager.js → services/objectServiceFactory.js} +5 -5
- package/lib/services/objectServiceFactory.js.map +1 -0
- package/lib/summary/core.js +51 -44
- package/lib/summary/core.js.map +1 -1
- package/lib/summary/field_summary.js +21 -16
- package/lib/summary/field_summary.js.map +1 -1
- package/lib/summary/index.js +25 -22
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/recompute.js +13 -11
- package/lib/summary/recompute.js.map +1 -1
- package/lib/ts-types/index.js +3 -3
- package/lib/ts-types/index.js.map +1 -1
- package/lib/typeorm/driver.js +58 -58
- package/lib/typeorm/driver.js.map +1 -1
- package/lib/typeorm/index.js +2 -1
- package/lib/typeorm/index.js.map +1 -1
- package/lib/typeorm/util.js +2 -2
- package/lib/typeorm/util.js.map +1 -1
- package/lib/types/app.js +41 -35
- package/lib/types/app.js.map +1 -1
- package/lib/types/config.js +52 -45
- package/lib/types/config.js.map +1 -1
- package/lib/types/connection.js +20 -18
- package/lib/types/connection.js.map +1 -1
- package/lib/types/dashboard.js +10 -7
- package/lib/types/dashboard.js.map +1 -1
- package/lib/types/datasource.d.ts +14 -1
- package/lib/types/datasource.js +205 -192
- package/lib/types/datasource.js.map +1 -1
- package/lib/types/field.d.ts +2 -2
- package/lib/types/field.js +6 -6
- package/lib/types/field.js.map +1 -1
- package/lib/types/field_permission.js +8 -8
- package/lib/types/field_permission.js.map +1 -1
- package/lib/types/index.js +11 -10
- package/lib/types/index.js.map +1 -1
- package/lib/types/list_view.d.ts +1 -1
- package/lib/types/list_view.js +1 -1
- package/lib/types/list_view.js.map +1 -1
- package/lib/types/object.d.ts +11 -11
- package/lib/types/object.js +208 -201
- package/lib/types/object.js.map +1 -1
- package/lib/types/object_dynamic_load.js +105 -155
- package/lib/types/object_dynamic_load.js.map +1 -1
- package/lib/types/object_events.js +5 -5
- package/lib/types/object_events.js.map +1 -1
- package/lib/types/object_layouts.js +7 -7
- package/lib/types/object_layouts.js.map +1 -1
- package/lib/types/object_permission.d.ts +1 -1
- package/lib/types/object_permission.js +1 -1
- package/lib/types/object_permission.js.map +1 -1
- package/lib/types/report.js +10 -7
- package/lib/types/report.js.map +1 -1
- package/lib/types/restrictionRule.js +11 -11
- package/lib/types/restrictionRule.js.map +1 -1
- package/lib/types/schema.d.ts +1 -1
- package/lib/types/schema.js +41 -19
- package/lib/types/schema.js.map +1 -1
- package/lib/types/shareRule.js +11 -11
- package/lib/types/shareRule.js.map +1 -1
- package/lib/types/trigger.js +2 -2
- package/lib/types/trigger.js.map +1 -1
- package/lib/types/validation_rules.js +5 -5
- package/lib/types/validation_rules.js.map +1 -1
- package/lib/util/convert.d.ts +2 -0
- package/lib/util/convert.js +130 -0
- package/lib/util/convert.js.map +1 -0
- package/lib/util/field.js +5 -3
- package/lib/util/field.js.map +1 -1
- package/lib/util/function_expression.js +5 -3
- package/lib/util/function_expression.js.map +1 -1
- package/lib/util/index.d.ts +2 -7
- package/lib/util/index.js +86 -166
- package/lib/util/index.js.map +1 -1
- package/lib/util/locale.js +5 -3
- package/lib/util/locale.js.map +1 -1
- package/lib/util/permission_shares.js +2 -2
- package/lib/util/permission_shares.js.map +1 -1
- package/lib/util/suffix.js +22 -16
- package/lib/util/suffix.js.map +1 -1
- package/lib/util/transform.js +11 -11
- package/lib/util/transform.js.map +1 -1
- package/lib/validators/index.js +3 -2
- package/lib/validators/index.js.map +1 -1
- package/package.json +13 -13
- package/src/dynamic-load/chart.ts +6 -1
- package/src/dynamic-load/index.ts +1 -0
- package/src/dynamic-load/object_translations.ts +19 -10
- package/src/dynamic-load/package.ts +303 -0
- package/src/dynamic-load/page.ts +7 -1
- package/src/dynamic-load/permission.ts +1 -5
- package/src/dynamic-load/preload_data.ts +2 -3
- package/src/dynamic-load/query.ts +6 -1
- package/src/dynamic-load/restrictionRules.ts +6 -2
- package/src/dynamic-load/shareRules.ts +5 -1
- package/src/dynamic-load/translations.ts +3 -1
- package/src/metadata-register/_base.ts +23 -0
- package/src/metadata-register/object.ts +1 -20
- package/src/services/datasourceServiceFactory.ts +37 -0
- package/src/services/helpers/graphql.ts +5 -3
- package/src/services/index.ts +7 -0
- package/src/services/objectService.ts +5 -4
- package/src/{metadata-register/objectServiceManager.ts → services/objectServiceFactory.ts} +4 -4
- package/src/types/datasource.ts +81 -72
- package/src/types/field.ts +2 -2
- package/src/types/list_view.ts +1 -1
- package/src/types/object.ts +11 -11
- package/src/types/object_dynamic_load.ts +5 -47
- package/src/types/object_permission.ts +1 -1
- package/src/types/schema.ts +11 -1
- package/src/util/convert.ts +130 -0
- package/src/util/index.ts +6 -120
- package/lib/metadata-register/objectServiceManager.js.map +0 -1
package/src/types/datasource.ts
CHANGED
|
@@ -28,8 +28,7 @@ import {
|
|
|
28
28
|
addAllConfigFiles
|
|
29
29
|
} from '.';
|
|
30
30
|
import { SteedosDriverConfig } from '../driver';
|
|
31
|
-
import { createObjectService } from '../
|
|
32
|
-
import { getObjectDispatcher } from '../services/index';
|
|
31
|
+
import { getObjectDispatcher, createObjectService, createDataSourceService } from '../services/index';
|
|
33
32
|
import path = require('path');
|
|
34
33
|
let Fiber = require('fibers');
|
|
35
34
|
declare var Creator: any;
|
|
@@ -87,6 +86,21 @@ export class SteedosDataSourceType implements Dictionary {
|
|
|
87
86
|
private _locale?: string;
|
|
88
87
|
private _schema: SteedosSchema;
|
|
89
88
|
private _objects: Dictionary<SteedosObjectType> = {};
|
|
89
|
+
private _cacheObjects?: Array<SteedosObjectType> = [];
|
|
90
|
+
public get cacheObjects(): any {
|
|
91
|
+
return this._cacheObjects;
|
|
92
|
+
}
|
|
93
|
+
public set cacheObjects(value: any) {
|
|
94
|
+
this._cacheObjects = value;
|
|
95
|
+
}
|
|
96
|
+
private _service?: any;
|
|
97
|
+
public get service(): any {
|
|
98
|
+
return this._service;
|
|
99
|
+
}
|
|
100
|
+
public set service(value: any) {
|
|
101
|
+
this._service = value;
|
|
102
|
+
}
|
|
103
|
+
|
|
90
104
|
private _objectsConfig: Dictionary<SteedosObjectTypeConfig> = {};
|
|
91
105
|
private _objectsRolesPermission: Dictionary<Dictionary<SteedosObjectPermissionType>> = {};
|
|
92
106
|
private _objectsSpaceRolesPermission: Dictionary<Dictionary<Dictionary<SteedosObjectPermissionType>>> = {};
|
|
@@ -110,10 +124,19 @@ export class SteedosDataSourceType implements Dictionary {
|
|
|
110
124
|
}
|
|
111
125
|
|
|
112
126
|
async getObjects() {
|
|
113
|
-
if(!this.schema.metadataRegister){
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
return await this.schema.metadataRegister.getObjectsConfig(this.name);
|
|
127
|
+
// if(!this.schema.metadataRegister){
|
|
128
|
+
// return this._objects
|
|
129
|
+
// }
|
|
130
|
+
// return await this.schema.metadataRegister.getObjectsConfig(this.name);
|
|
131
|
+
return this.getCacheObjects();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
getCacheObjects() {
|
|
135
|
+
return this.cacheObjects;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async flushCacheObjects() {
|
|
139
|
+
this.cacheObjects = await this.schema.metadataRegister.getObjectsConfig(this.name);
|
|
117
140
|
}
|
|
118
141
|
|
|
119
142
|
getLocalObjects() {
|
|
@@ -147,7 +170,17 @@ export class SteedosDataSourceType implements Dictionary {
|
|
|
147
170
|
async setObject(objectApiName: string, objectConfig: SteedosObjectTypeConfig) {
|
|
148
171
|
const serviceName = getObjectServiceName(objectApiName)
|
|
149
172
|
let object = new SteedosObjectType(objectApiName, this, objectConfig)
|
|
173
|
+
|
|
150
174
|
this._objectsConfig[objectApiName] = objectConfig;
|
|
175
|
+
|
|
176
|
+
const findIndex = _.findIndex(this.cacheObjects, (item: any) => { return item?.metadata?.name === objectApiName });
|
|
177
|
+
|
|
178
|
+
if (findIndex != -1) {
|
|
179
|
+
this.cacheObjects[findIndex] = Object.assign({ service: { name: serviceName } }, { metadata: objectConfig });
|
|
180
|
+
} else {
|
|
181
|
+
this.cacheObjects.push(Object.assign({ service: { name: serviceName } }, { metadata: objectConfig }));
|
|
182
|
+
}
|
|
183
|
+
|
|
151
184
|
this._objects[objectApiName] = object;
|
|
152
185
|
await createObjectService(this._schema.metadataBroker, serviceName, objectConfig)
|
|
153
186
|
return object;
|
|
@@ -206,71 +239,32 @@ export class SteedosDataSourceType implements Dictionary {
|
|
|
206
239
|
}
|
|
207
240
|
}
|
|
208
241
|
|
|
209
|
-
async
|
|
242
|
+
async initObject(objectConfig) {
|
|
243
|
+
//从本地对象配置中读取触发器配置
|
|
244
|
+
const localObjectConfig = getObjectConfig(objectConfig.name);
|
|
245
|
+
if (localObjectConfig) {
|
|
246
|
+
objectConfig.listeners = localObjectConfig.listeners;
|
|
247
|
+
objectConfig.methods = localObjectConfig.methods;
|
|
248
|
+
}
|
|
249
|
+
if (this.name === "meteor") {
|
|
250
|
+
try {
|
|
251
|
+
const _db = Creator.createCollection(objectConfig)
|
|
252
|
+
Creator.Collections[_db._name] = _db
|
|
253
|
+
} catch (error) {
|
|
254
|
+
// console.log(`error`, error) //此处无需打印日志,@steedos/core 在init Creator 时,会兼容此部分的异常逻辑。
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
await this.setObject(objectConfig.name, objectConfig);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async initObjects() {
|
|
210
261
|
// 从缓存中加载所有本数据源对象到datasource中
|
|
211
|
-
let objects: Array<any> =
|
|
262
|
+
let objects: Array<any> = this.cacheObjects;
|
|
212
263
|
let self = this;
|
|
213
264
|
for await (const object of _.values(objects)) {
|
|
214
265
|
const objectConfig = object.metadata;
|
|
215
|
-
|
|
216
|
-
const localObjectConfig = getObjectConfig(objectConfig.name);
|
|
217
|
-
if(localObjectConfig){
|
|
218
|
-
objectConfig.listeners = localObjectConfig.listeners;
|
|
219
|
-
objectConfig.methods = localObjectConfig.methods;
|
|
220
|
-
}
|
|
221
|
-
// if(self._schema.metadataBroker){
|
|
222
|
-
// const res = await self._schema.metadataRegister.object(object)
|
|
223
|
-
// if(res){
|
|
224
|
-
// self.setObject(object.name, object);
|
|
225
|
-
// }
|
|
226
|
-
// }else{
|
|
227
|
-
// self.setObject(object.name, object);
|
|
228
|
-
// }
|
|
229
|
-
await self.setObject(objectConfig.name, objectConfig);
|
|
230
|
-
|
|
231
|
-
if(this.name === "default"){
|
|
232
|
-
try {
|
|
233
|
-
const _db = Creator.createCollection(objectConfig)
|
|
234
|
-
Creator.Collections[_db._name] = _db
|
|
235
|
-
} catch (error) {
|
|
236
|
-
// console.log(`error`, error) //此处无需打印日志,@steedos/core 在init Creator 时,会兼容此部分的异常逻辑。
|
|
237
|
-
}
|
|
238
|
-
}
|
|
266
|
+
await self.initObject(objectConfig)
|
|
239
267
|
}
|
|
240
|
-
|
|
241
|
-
// _.each(objects, (object) => {
|
|
242
|
-
// const obj = this.getObject(object.name);
|
|
243
|
-
// if(obj){
|
|
244
|
-
// // 加try catch是因为有错误时不应该影响下一个对象加载
|
|
245
|
-
// try{
|
|
246
|
-
// obj.initMasterDetails();
|
|
247
|
-
// }
|
|
248
|
-
// catch(ex){
|
|
249
|
-
// console.error(ex);
|
|
250
|
-
// }
|
|
251
|
-
// }
|
|
252
|
-
// });
|
|
253
|
-
|
|
254
|
-
// _.each(objects, (object) => {
|
|
255
|
-
// const obj = this.getObject(object.name);
|
|
256
|
-
// if(obj){
|
|
257
|
-
// // 加try catch是因为有错误时不应该影响下一个对象加载
|
|
258
|
-
// try{
|
|
259
|
-
// obj.checkMasterDetails();
|
|
260
|
-
// }
|
|
261
|
-
// catch(ex){
|
|
262
|
-
// console.error(ex);
|
|
263
|
-
// }
|
|
264
|
-
// }
|
|
265
|
-
// });
|
|
266
|
-
|
|
267
|
-
_.each(this.config.objectsRolesPermission, (objectRolesPermission, object_name) => {
|
|
268
|
-
_.each(objectRolesPermission, (objectRolePermission, role_name) => {
|
|
269
|
-
objectRolePermission.name = role_name
|
|
270
|
-
this.setObjectPermission(object_name, objectRolePermission)
|
|
271
|
-
})
|
|
272
|
-
})
|
|
273
|
-
|
|
274
268
|
return true;
|
|
275
269
|
}
|
|
276
270
|
|
|
@@ -461,15 +455,30 @@ export class SteedosDataSourceType implements Dictionary {
|
|
|
461
455
|
}
|
|
462
456
|
|
|
463
457
|
async init() {
|
|
464
|
-
await this.
|
|
465
|
-
await this.
|
|
466
|
-
|
|
467
|
-
|
|
458
|
+
// await this.flushCacheObjects();
|
|
459
|
+
// await this.initObjects();
|
|
460
|
+
this.initObjectPermissions();
|
|
461
|
+
if (!this.service) {
|
|
462
|
+
const broker = this._schema.metadataBroker
|
|
463
|
+
this.service = await createDataSourceService(broker, this)
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* 初始化数据源上配置的对象权限。
|
|
469
|
+
*/
|
|
470
|
+
initObjectPermissions() {
|
|
471
|
+
_.each(this.config.objectsRolesPermission, (objectRolesPermission, object_name) => {
|
|
472
|
+
_.each(objectRolesPermission, (objectRolePermission, role_name) => {
|
|
473
|
+
objectRolePermission.name = role_name
|
|
474
|
+
this.setObjectPermission(object_name, objectRolePermission)
|
|
475
|
+
})
|
|
476
|
+
})
|
|
468
477
|
}
|
|
469
478
|
|
|
470
|
-
|
|
479
|
+
initTypeORM() {
|
|
471
480
|
const _objects = {};
|
|
472
|
-
_.map(
|
|
481
|
+
_.map(this.cacheObjects, (item) => {
|
|
473
482
|
if(item && item.metadata){
|
|
474
483
|
_objects[item.metadata.name] = item.metadata
|
|
475
484
|
}
|
package/src/types/field.ts
CHANGED
|
@@ -52,7 +52,7 @@ abstract class SteedosFieldProperties{
|
|
|
52
52
|
object_name?: string
|
|
53
53
|
name?: string
|
|
54
54
|
column_name?: string
|
|
55
|
-
type?: string
|
|
55
|
+
abstract type?: string
|
|
56
56
|
primary?: boolean
|
|
57
57
|
generated?: true
|
|
58
58
|
label?: string
|
|
@@ -88,7 +88,7 @@ abstract class SteedosFieldProperties{
|
|
|
88
88
|
reference_limit?: number
|
|
89
89
|
is_company_limited?: boolean
|
|
90
90
|
system?: string;
|
|
91
|
-
fieldDBType
|
|
91
|
+
abstract fieldDBType: SteedosFieldDBType | string
|
|
92
92
|
formula?: string
|
|
93
93
|
data_type?: string
|
|
94
94
|
formula_blank_value?: string
|
package/src/types/list_view.ts
CHANGED
package/src/types/object.ts
CHANGED
|
@@ -58,9 +58,9 @@ export const getRepeatObjectNameFromPaths = (paths: string[]) => {
|
|
|
58
58
|
|
|
59
59
|
abstract class SteedosObjectProperties {
|
|
60
60
|
_id?: string
|
|
61
|
-
name?: string
|
|
61
|
+
abstract name?: string
|
|
62
62
|
extend?: string
|
|
63
|
-
table_name?: string
|
|
63
|
+
abstract table_name?: string
|
|
64
64
|
label?: string
|
|
65
65
|
icon?: string
|
|
66
66
|
enable_search?: boolean
|
|
@@ -70,11 +70,11 @@ abstract class SteedosObjectProperties {
|
|
|
70
70
|
enable_notes?: boolean
|
|
71
71
|
enable_events?: boolean
|
|
72
72
|
enable_api?: boolean //TODO 未开放功能
|
|
73
|
-
enable_share?: boolean
|
|
74
|
-
enable_instances?: boolean
|
|
73
|
+
abstract enable_share?: boolean
|
|
74
|
+
abstract enable_instances?: boolean
|
|
75
75
|
enable_chatter?: boolean
|
|
76
|
-
enable_audit?: boolean
|
|
77
|
-
enable_trash?: boolean
|
|
76
|
+
abstract enable_audit?: boolean
|
|
77
|
+
abstract enable_trash?: boolean
|
|
78
78
|
enable_space_global?: boolean
|
|
79
79
|
enable_tree?: boolean
|
|
80
80
|
parent_field?: string
|
|
@@ -91,10 +91,10 @@ abstract class SteedosObjectProperties {
|
|
|
91
91
|
// triggers?: object
|
|
92
92
|
sidebar?: object //TODO
|
|
93
93
|
calendar?: object //TODO
|
|
94
|
-
actions?: Dictionary<SteedosActionTypeConfig>
|
|
95
|
-
fields?: Dictionary<SteedosFieldTypeConfig>
|
|
96
|
-
listeners?: Dictionary<SteedosListenerConfig>
|
|
97
|
-
list_views?: Dictionary<SteedosObjectListViewTypeConfig>
|
|
94
|
+
abstract actions?: Dictionary<SteedosActionTypeConfig>
|
|
95
|
+
abstract fields?: Dictionary<SteedosFieldTypeConfig>
|
|
96
|
+
abstract listeners?: Dictionary<SteedosListenerConfig>
|
|
97
|
+
abstract list_views?: Dictionary<SteedosObjectListViewTypeConfig>
|
|
98
98
|
permissions?: Dictionary<SteedosObjectPermissionTypeConfig>
|
|
99
99
|
methods?: Dictionary<Function>
|
|
100
100
|
fields_serial_number?: number
|
|
@@ -107,7 +107,7 @@ export interface SteedosObjectTypeConfig extends SteedosObjectProperties {
|
|
|
107
107
|
name?: string
|
|
108
108
|
isMain?: boolean
|
|
109
109
|
datasource?: string
|
|
110
|
-
fields
|
|
110
|
+
fields?: Dictionary<SteedosFieldTypeConfig>
|
|
111
111
|
actions?: Dictionary<SteedosActionTypeConfig>
|
|
112
112
|
listeners?: Dictionary<SteedosListenerConfig>
|
|
113
113
|
permission_set?: Dictionary<SteedosObjectPermissionTypeConfig> //TODO remove ; 目前为了兼容现有object的定义保留
|
|
@@ -3,7 +3,7 @@ import path = require('path')
|
|
|
3
3
|
import { SteedosObjectTypeConfig, SteedosObjectPermissionTypeConfig, SteedosActionTypeConfig, getDataSource } from '.'
|
|
4
4
|
// import { isMeteor } from '../util'
|
|
5
5
|
import { Dictionary } from '@salesforce/ts-types';
|
|
6
|
-
import {
|
|
6
|
+
import { addObjectListenerConfig, loadObjectLayouts, loadSourceProfiles, loadSourcePermissionset, loadObjectValidationRules, loadSourceRoles, loadSourceFlowRoles, loadSourceApprovalProcesses, loadSourceWorkflows, loadStandardProfiles, loadStandardPermissionsets, preloadDBObjectFields, preloadDBObjectButtons, preloadDBApps, preloadDBObjectLayouts, preloadDBTabs, preloadDBShareRules, preloadDBRestrictionRules, preloadDBPermissionFields, loadPackageMetadatas } from '../dynamic-load'
|
|
7
7
|
import { transformListenersToTriggers } from '..';
|
|
8
8
|
import { getSteedosSchema } from './schema';
|
|
9
9
|
|
|
@@ -94,54 +94,12 @@ export const addObjectConfigFiles = async (filePath: string, datasource: string,
|
|
|
94
94
|
if (!datasource)
|
|
95
95
|
datasource = 'meteor'
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
for await (const element of objectJsons) {
|
|
99
|
-
let startNo = 10;
|
|
100
|
-
_.each(element.fields, function(field){
|
|
101
|
-
if(!_.has(field, 'sort_no')){
|
|
102
|
-
field.sort_no = startNo;
|
|
103
|
-
startNo = startNo + 10;
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
if(!element.fields){
|
|
107
|
-
element.fields = {}
|
|
108
|
-
}
|
|
109
|
-
_.each(getLazyLoadFields(element.name), function(field){
|
|
110
|
-
util.extend(element.fields, {[field.name]: field})
|
|
111
|
-
})
|
|
112
|
-
if(!element.actions){
|
|
113
|
-
element.actions = {}
|
|
114
|
-
}
|
|
115
|
-
_.each(getLazyLoadButtons(element.name), function(action){
|
|
116
|
-
util.extend(element.actions, {[action.name]: action})
|
|
117
|
-
})
|
|
118
|
-
let _mf = _.maxBy(_.values(element.fields), function (field) { return field.sort_no; });
|
|
119
|
-
if(_mf && element.name){
|
|
120
|
-
element.fields_serial_number = _mf.sort_no + 10;
|
|
121
|
-
}
|
|
122
|
-
await addObjectConfig(element, datasource, serviceName);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
await loadObjectFields(filePath, serviceName);
|
|
126
|
-
|
|
127
|
-
await loadObjectListViews(filePath, serviceName);
|
|
128
|
-
|
|
129
|
-
await loadObjectButtons(filePath, serviceName);
|
|
130
|
-
|
|
131
|
-
loadObjectTriggers(filePath);
|
|
132
|
-
|
|
133
|
-
await loadObjectActions(filePath, serviceName);
|
|
134
|
-
|
|
135
|
-
loadObjectMethods(filePath); //此功能不支持微服务模式
|
|
97
|
+
await loadPackageMetadatas(filePath, datasource, serviceName)
|
|
136
98
|
|
|
137
99
|
await loadObjectLayouts(filePath, serviceName);
|
|
138
|
-
|
|
139
|
-
await loadObjectPermissions(filePath, serviceName);
|
|
140
|
-
|
|
100
|
+
// await loadObjectPermissions(filePath, serviceName);
|
|
141
101
|
await loadSourceProfiles(filePath, serviceName);
|
|
142
|
-
|
|
143
102
|
await loadSourcePermissionset(filePath, serviceName);
|
|
144
|
-
|
|
145
103
|
loadObjectValidationRules(filePath);
|
|
146
104
|
|
|
147
105
|
loadSourceRoles(filePath);
|
|
@@ -325,11 +283,11 @@ export const removeObjectListenerConfig = (_id, listenTo, when)=>{
|
|
|
325
283
|
}
|
|
326
284
|
|
|
327
285
|
export const loadStandardMetadata = async (serviceName: string, datasourceApiName: string) => {
|
|
328
|
-
await loadStandardProfiles(serviceName);
|
|
329
|
-
await loadStandardPermissionsets(serviceName);
|
|
330
286
|
await loadStandardBaseObjects(serviceName);
|
|
331
287
|
if (dbMetadataLoaing != true) {
|
|
332
288
|
dbMetadataLoaing = true;
|
|
289
|
+
await loadStandardProfiles(serviceName);
|
|
290
|
+
await loadStandardPermissionsets(serviceName);
|
|
333
291
|
await loadDbMetadatas(datasourceApiName);
|
|
334
292
|
}
|
|
335
293
|
}
|
package/src/types/schema.ts
CHANGED
|
@@ -229,7 +229,17 @@ export class SteedosSchema {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
async getAllObject() {
|
|
232
|
-
|
|
232
|
+
let schemaObjects = [];
|
|
233
|
+
const datasources = this.getDataSources();
|
|
234
|
+
for (const name in datasources) {
|
|
235
|
+
const datasource = datasources[name]
|
|
236
|
+
const datasourceObjects = await datasource.getObjects();
|
|
237
|
+
if (datasourceObjects && datasourceObjects.length > 0) {
|
|
238
|
+
schemaObjects = schemaObjects.concat(datasourceObjects);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return schemaObjects;
|
|
242
|
+
// return await this.metadataBroker.call("objects.getAll");
|
|
233
243
|
}
|
|
234
244
|
}
|
|
235
245
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as _ from 'lodash';
|
|
2
|
+
|
|
3
|
+
function funEval(funStr) {
|
|
4
|
+
try {
|
|
5
|
+
return eval(funStr)
|
|
6
|
+
} catch (e) {
|
|
7
|
+
console.error(e, funStr);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function jsonToObject(objectMetadata) {
|
|
12
|
+
_.forEach(objectMetadata.fields, (field, key) => {
|
|
13
|
+
const _reference_to = field._reference_to;
|
|
14
|
+
if (_reference_to && _.isString(_reference_to)) {
|
|
15
|
+
field.reference_to = funEval(`(${_reference_to})`);
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function objectToJson(objectConfig) {
|
|
21
|
+
_.forEach(objectConfig.actions, (action, key) => {
|
|
22
|
+
const _todo = action?.todo
|
|
23
|
+
if (_todo && _.isFunction(_todo)) {
|
|
24
|
+
action.todo = _todo.toString()
|
|
25
|
+
}
|
|
26
|
+
const _visible = action?.visible
|
|
27
|
+
if (_visible && _.isFunction(_visible)) {
|
|
28
|
+
action._visible = _visible.toString()
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
_.forEach(objectConfig.fields, (field, key) => {
|
|
33
|
+
|
|
34
|
+
const options = field.options
|
|
35
|
+
if (options && _.isFunction(options)) {
|
|
36
|
+
field._options = field.options.toString()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (field.regEx) {
|
|
40
|
+
field._regEx = field.regEx.toString();
|
|
41
|
+
}
|
|
42
|
+
if (_.isFunction(field.min)) {
|
|
43
|
+
field._min = field.min.toString();
|
|
44
|
+
}
|
|
45
|
+
if (_.isFunction(field.max)) {
|
|
46
|
+
field._max = field.max.toString();
|
|
47
|
+
}
|
|
48
|
+
if (field.autoform) {
|
|
49
|
+
const _type = field.autoform.type;
|
|
50
|
+
if (_type && _.isFunction(_type) && _type != Object && _type != String && _type != Number && _type != Boolean && !_.isArray(_type)) {
|
|
51
|
+
field.autoform._type = _type.toString();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const optionsFunction = field.optionsFunction;
|
|
55
|
+
const reference_to = field.reference_to;
|
|
56
|
+
const createFunction = field.createFunction;
|
|
57
|
+
const beforeOpenFunction = field.beforeOpenFunction;
|
|
58
|
+
const filtersFunction = field.filtersFunction;
|
|
59
|
+
if (optionsFunction && _.isFunction(optionsFunction)) {
|
|
60
|
+
field._optionsFunction = optionsFunction.toString()
|
|
61
|
+
}
|
|
62
|
+
if (reference_to && _.isFunction(reference_to)) {
|
|
63
|
+
field._reference_to = reference_to.toString()
|
|
64
|
+
}
|
|
65
|
+
if (createFunction && _.isFunction(createFunction)) {
|
|
66
|
+
field._createFunction = createFunction.toString()
|
|
67
|
+
}
|
|
68
|
+
if (beforeOpenFunction && _.isFunction(beforeOpenFunction)) {
|
|
69
|
+
field._beforeOpenFunction = beforeOpenFunction.toString()
|
|
70
|
+
}
|
|
71
|
+
if (filtersFunction && _.isFunction(filtersFunction)) {
|
|
72
|
+
field._filtersFunction = filtersFunction.toString()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
const defaultValue = field.defaultValue
|
|
77
|
+
if (defaultValue && _.isFunction(defaultValue)) {
|
|
78
|
+
field._defaultValue = field.defaultValue.toString()
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const is_company_limited = field.is_company_limited;
|
|
82
|
+
if (is_company_limited && _.isFunction(is_company_limited)) {
|
|
83
|
+
field._is_company_limited = field.is_company_limited.toString()
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
_.forEach(objectConfig.list_views, (list_view, key) => {
|
|
88
|
+
if (_.isFunction(list_view.filters)) {
|
|
89
|
+
list_view._filters = list_view.filters.toString()
|
|
90
|
+
} else if (_.isArray(list_view.filters)) {
|
|
91
|
+
_.forEach(list_view.filters, (filter: any, _index) => {
|
|
92
|
+
if (_.isArray(filter)) {
|
|
93
|
+
if (filter.length == 3 && _.isFunction(filter[2])) {
|
|
94
|
+
filter[2] = filter[2].toString()
|
|
95
|
+
filter[3] = "FUNCTION"
|
|
96
|
+
} else if (filter.length == 3 && _.isDate(filter[2])) {
|
|
97
|
+
filter[3] = "DATE"
|
|
98
|
+
}
|
|
99
|
+
} else if (_.isObject(filter)) {
|
|
100
|
+
if (_.isFunction((filter as any)?.value)) {
|
|
101
|
+
(filter as any)._value = (filter as any).value.toString()
|
|
102
|
+
} else if (_.isDate((filter as any)?.value)) {
|
|
103
|
+
(filter as any)._is_date = true
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
if (objectConfig.form && !_.isString(objectConfig.form)) {
|
|
111
|
+
objectConfig.form = JSON.stringify(objectConfig.form, (key, val) => {
|
|
112
|
+
if (_.isFunction(val))
|
|
113
|
+
return val + '';
|
|
114
|
+
else
|
|
115
|
+
return val;
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_.forEach(objectConfig.relatedList, (relatedObjInfo) => {
|
|
120
|
+
if (_.isObject(relatedObjInfo)) {
|
|
121
|
+
_.forEach(relatedObjInfo, (val: any, key) => {
|
|
122
|
+
if (key == 'filters' && _.isFunction(val)) {
|
|
123
|
+
relatedObjInfo[key] = val.toString();
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
return objectConfig;
|
|
130
|
+
}
|
package/src/util/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from './suffix'
|
|
|
28
28
|
export * from './locale'
|
|
29
29
|
export * from './field'
|
|
30
30
|
export * from './function_expression'
|
|
31
|
+
export * from './convert'
|
|
31
32
|
|
|
32
33
|
exports.loadJSONFile = (filePath: string)=>{
|
|
33
34
|
return JSON.parse(fs.readFileSync(filePath, 'utf8').normalize('NFC'));
|
|
@@ -571,7 +572,7 @@ export function extend(destination: JsonMap, ...sources: JsonMap[]){
|
|
|
571
572
|
}else if(isJsonMap(v)){
|
|
572
573
|
let _d = getJsonMap(destination, k);
|
|
573
574
|
if(isJsonMap(_d)){
|
|
574
|
-
destination[k] =
|
|
575
|
+
destination[k] = extend(clone(_d), v)
|
|
575
576
|
}else{
|
|
576
577
|
destination[k] = v
|
|
577
578
|
}
|
|
@@ -682,7 +683,7 @@ export function getSteedosConfig(){
|
|
|
682
683
|
let config: any;
|
|
683
684
|
let configPath = path.join(getBaseDirectory(), configName)
|
|
684
685
|
if (fs.existsSync(configPath) && !fs.statSync(configPath).isDirectory()) {
|
|
685
|
-
config =
|
|
686
|
+
config = loadFile(configPath)
|
|
686
687
|
if (config.env){
|
|
687
688
|
_.each(config.env, function(item, key){
|
|
688
689
|
process.env[key] = calcString(item)
|
|
@@ -951,128 +952,13 @@ export function absoluteUrl (path, options?) {
|
|
|
951
952
|
return url;
|
|
952
953
|
}
|
|
953
954
|
|
|
954
|
-
/**
|
|
955
|
-
* 对objectConfig中的function属性做toString()处理
|
|
956
|
-
* This method mutates objectConfig.
|
|
957
|
-
* @param objectConfig
|
|
958
|
-
* @returns objectConfig
|
|
959
|
-
*/
|
|
960
|
-
export function objectToJson(objectConfig){
|
|
961
|
-
_.forEach(objectConfig.actions, (action, key)=>{
|
|
962
|
-
const _todo = action?.todo
|
|
963
|
-
if(_todo && _.isFunction(_todo)){
|
|
964
|
-
action.todo = _todo.toString()
|
|
965
|
-
}
|
|
966
|
-
const _visible = action?.visible
|
|
967
|
-
if(_visible && _.isFunction(_visible)){
|
|
968
|
-
action._visible = _visible.toString()
|
|
969
|
-
}
|
|
970
|
-
})
|
|
971
|
-
|
|
972
|
-
_.forEach(objectConfig.fields, (field, key)=>{
|
|
973
|
-
|
|
974
|
-
const options = field.options
|
|
975
|
-
if(options && _.isFunction(options)){
|
|
976
|
-
field._options = field.options.toString()
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
if(field.regEx){
|
|
980
|
-
field._regEx = field.regEx.toString();
|
|
981
|
-
}
|
|
982
|
-
if(_.isFunction(field.min)){
|
|
983
|
-
field._min = field.min.toString();
|
|
984
|
-
}
|
|
985
|
-
if(_.isFunction(field.max)){
|
|
986
|
-
field._max = field.max.toString();
|
|
987
|
-
}
|
|
988
|
-
if(field.autoform){
|
|
989
|
-
const _type = field.autoform.type;
|
|
990
|
-
if(_type && _.isFunction(_type) && _type != Object && _type != String && _type != Number && _type != Boolean && !_.isArray(_type)){
|
|
991
|
-
field.autoform._type = _type.toString();
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
const optionsFunction = field.optionsFunction;
|
|
995
|
-
const reference_to = field.reference_to;
|
|
996
|
-
const createFunction = field.createFunction;
|
|
997
|
-
const beforeOpenFunction = field.beforeOpenFunction;
|
|
998
|
-
const filtersFunction = field.filtersFunction;
|
|
999
|
-
if(optionsFunction && _.isFunction(optionsFunction)){
|
|
1000
|
-
field._optionsFunction = optionsFunction.toString()
|
|
1001
|
-
}
|
|
1002
|
-
if(reference_to && _.isFunction(reference_to)){
|
|
1003
|
-
field._reference_to = reference_to.toString()
|
|
1004
|
-
}
|
|
1005
|
-
if(createFunction && _.isFunction(createFunction)){
|
|
1006
|
-
field._createFunction = createFunction.toString()
|
|
1007
|
-
}
|
|
1008
|
-
if(beforeOpenFunction && _.isFunction(beforeOpenFunction)){
|
|
1009
|
-
field._beforeOpenFunction = beforeOpenFunction.toString()
|
|
1010
|
-
}
|
|
1011
|
-
if(filtersFunction && _.isFunction(filtersFunction)){
|
|
1012
|
-
field._filtersFunction = filtersFunction.toString()
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
const defaultValue = field.defaultValue
|
|
1017
|
-
if(defaultValue && _.isFunction(defaultValue)){
|
|
1018
|
-
field._defaultValue = field.defaultValue.toString()
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
const is_company_limited = field.is_company_limited;
|
|
1022
|
-
if(is_company_limited && _.isFunction(is_company_limited)){
|
|
1023
|
-
field._is_company_limited = field.is_company_limited.toString()
|
|
1024
|
-
}
|
|
1025
|
-
})
|
|
1026
|
-
|
|
1027
|
-
_.forEach(objectConfig.list_views, (list_view, key)=>{
|
|
1028
|
-
if(_.isFunction(list_view.filters)){
|
|
1029
|
-
list_view._filters = list_view.filters.toString()
|
|
1030
|
-
}else if(_.isArray(list_view.filters)){
|
|
1031
|
-
_.forEach(list_view.filters, (filter, _index)=>{
|
|
1032
|
-
if(_.isArray(filter)){
|
|
1033
|
-
if(filter.length == 3 && _.isFunction(filter[2])){
|
|
1034
|
-
filter[2] = filter[2].toString()
|
|
1035
|
-
filter[3] = "FUNCTION"
|
|
1036
|
-
}else if(filter.length == 3 && _.isDate(filter[2])){
|
|
1037
|
-
filter[3] = "DATE"
|
|
1038
|
-
}
|
|
1039
|
-
}else if(_.isObject(filter)){
|
|
1040
|
-
if(_.isFunction(filter?.value)){
|
|
1041
|
-
filter._value = filter.value.toString()
|
|
1042
|
-
}else if(_.isDate(filter?.value)){
|
|
1043
|
-
filter._is_date = true
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
})
|
|
1047
|
-
}
|
|
1048
|
-
})
|
|
1049
|
-
|
|
1050
|
-
if(objectConfig.form && !_.isString(objectConfig.form)){
|
|
1051
|
-
objectConfig.form = JSON.stringify(objectConfig.form, (key, val)=>{
|
|
1052
|
-
if(_.isFunction(val))
|
|
1053
|
-
return val + '';
|
|
1054
|
-
else
|
|
1055
|
-
return val;
|
|
1056
|
-
})
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
_.forEach(objectConfig.relatedList, (relatedObjInfo)=>{
|
|
1060
|
-
if(_.isObject(relatedObjInfo)){
|
|
1061
|
-
_.forEach(relatedObjInfo, (val, key)=>{
|
|
1062
|
-
if(key == 'filters' && _.isFunction(val)){
|
|
1063
|
-
relatedObjInfo[key] = val.toString();
|
|
1064
|
-
}
|
|
1065
|
-
})
|
|
1066
|
-
}
|
|
1067
|
-
})
|
|
1068
|
-
|
|
1069
|
-
return objectConfig;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
955
|
export function validateFilters(filters: [], objectFields: any) {
|
|
1073
956
|
processFilters(clone(filters), objectFields);
|
|
1074
957
|
}
|
|
1075
958
|
|
|
959
|
+
export async function sleep(ms) {
|
|
960
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
961
|
+
}
|
|
1076
962
|
|
|
1077
963
|
export function parserFilters(filters){
|
|
1078
964
|
if(_.isString(filters)){
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"objectServiceManager.js","sourceRoot":"","sources":["../../src/metadata-register/objectServiceManager.ts"],"names":[],"mappings":";;;;AACA,2CAAyD;AACzD,IAAM,aAAa,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAE3D,IAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,SAAS,sBAAsB,CAAC,aAAa;IACzC,IAAM,WAAW,GAAG,4BAAoB,CAAC,aAAa,CAAC,CAAC;IACxD,OAAO,mBAAmB,CAAC,WAAW,CAAC,CAAA;AAC3C,CAAC;AAED,SAAsB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY;;;;;;oBACvE,IAAG,mBAAmB,CAAC,WAAW,CAAC,EAAC;wBAChC,sBAAQ;qBACX;oBACG,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC;wBAC/B,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,CAAC,aAAa,CAAC;wBACvB,QAAQ,EAAE;4BACN,YAAY,EAAE,YAAY;4BAC1B,sBAAsB,wBAAA;yBACzB;qBACJ,CAAC,CAAA;yBACE,CAAC,MAAM,CAAC,OAAO,EAAf,wBAAe;oBACf,qBAAM,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAA;;;oBAEzC,mBAAmB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;oBACxC,sBAAM;;;;CACT;AAjBD,kDAiBC"}
|