@steedos/standard-object-database 2.6.2-beta.2 → 2.6.2-beta.21
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/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml +2 -0
- package/main/default/objectTranslations/object_fields.zh-CN/object_fields.zh-CN.objectTranslation.yml +2 -0
- package/main/default/objects/object_actions.object.yml +2 -2
- package/main/default/objects/object_fields.object.yml +4 -2
- package/main/default/objects/object_listviews.object.yml +9 -1
- package/main/default/pages/design_field_layout.page.amis.json +107 -109
- package/main/default/triggers/object_fields.trigger.js +2 -2
- package/package.json +4 -3
- package/package.service.js +14 -0
|
@@ -66,6 +66,8 @@ fields:
|
|
|
66
66
|
value: markdown
|
|
67
67
|
- label: Select
|
|
68
68
|
value: select
|
|
69
|
+
- label: Color
|
|
70
|
+
value: color
|
|
69
71
|
- label: Boolean
|
|
70
72
|
value: boolean
|
|
71
73
|
- label: Toggle
|
|
@@ -431,7 +433,7 @@ fields:
|
|
|
431
433
|
# group: Advanced
|
|
432
434
|
sort_no: 270
|
|
433
435
|
options:
|
|
434
|
-
type:
|
|
436
|
+
type: table
|
|
435
437
|
label: Options
|
|
436
438
|
is_wide: true
|
|
437
439
|
inlineHelpText: The label and value of each option cannot be empty. Set the background color to FFFFFF in hexadecimal format.
|
|
@@ -454,7 +456,7 @@ fields:
|
|
|
454
456
|
required: true
|
|
455
457
|
options.$.color:
|
|
456
458
|
label: Color
|
|
457
|
-
type:
|
|
459
|
+
type: color
|
|
458
460
|
required: false
|
|
459
461
|
options.$.description:
|
|
460
462
|
label: Description
|
|
@@ -220,7 +220,7 @@ fields:
|
|
|
220
220
|
visible_on: "{{global.mode ==='read' ? true : false}}"
|
|
221
221
|
mobile_columns:
|
|
222
222
|
label: Mobile Columns
|
|
223
|
-
type:
|
|
223
|
+
type: table
|
|
224
224
|
is_wide: true
|
|
225
225
|
depend_on:
|
|
226
226
|
- object_name
|
|
@@ -234,8 +234,16 @@ fields:
|
|
|
234
234
|
type: lookup
|
|
235
235
|
multiple: false
|
|
236
236
|
is_wide: false
|
|
237
|
+
required: true
|
|
238
|
+
depend_on:
|
|
239
|
+
- object_name
|
|
237
240
|
reference_to: object_fields
|
|
238
241
|
reference_to_field: name
|
|
242
|
+
enable_enhanced_lookup: false
|
|
243
|
+
filtersFunction: !<tag:yaml.org,2002:js/function> |-
|
|
244
|
+
function(filters, values){
|
|
245
|
+
return ['object', '=', values.object_name]
|
|
246
|
+
}
|
|
239
247
|
searchable_fields:
|
|
240
248
|
label: Searchable Fields
|
|
241
249
|
type: grid
|
|
@@ -34,29 +34,36 @@
|
|
|
34
34
|
"size": "lg",
|
|
35
35
|
"body": [
|
|
36
36
|
{
|
|
37
|
-
"type": "
|
|
38
|
-
"
|
|
37
|
+
"type": "form",
|
|
38
|
+
"mode": "normal",
|
|
39
|
+
"body": [
|
|
39
40
|
{
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
"type": "steedos-input-table",
|
|
42
|
+
"fields": [
|
|
43
|
+
{
|
|
44
|
+
"name": "group_name",
|
|
45
|
+
"label": "名称",
|
|
46
|
+
"type": "text",
|
|
47
|
+
"id": "u:31952daa443c"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "visible_on",
|
|
51
|
+
"label": "显示条件",
|
|
52
|
+
"type": "text",
|
|
53
|
+
"id": "u:8d7551abcd28",
|
|
54
|
+
"value": null
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"name": "groups",
|
|
58
|
+
"addable": true,
|
|
59
|
+
"editable": true,
|
|
60
|
+
"removable": true,
|
|
61
|
+
"draggable": false,
|
|
62
|
+
"showIndex": false,
|
|
63
|
+
"id": "u:776ec89804c0",
|
|
64
|
+
"label": ""
|
|
51
65
|
}
|
|
52
|
-
]
|
|
53
|
-
"name": "groups",
|
|
54
|
-
"addable": true,
|
|
55
|
-
"editable": true,
|
|
56
|
-
"removable": true,
|
|
57
|
-
"draggable": false,
|
|
58
|
-
"showIndex": false,
|
|
59
|
-
"id": "u:776ec89804c0"
|
|
66
|
+
]
|
|
60
67
|
}
|
|
61
68
|
],
|
|
62
69
|
"onEvent": {
|
|
@@ -182,86 +189,86 @@
|
|
|
182
189
|
{
|
|
183
190
|
"type": "tpl",
|
|
184
191
|
"tpl": "<p><strong>${label}</strong> ${designObjectLabel}<span style=\"color: rgb(149, 165, 166);\">${_name}</span></p>",
|
|
185
|
-
"className": "w-4/5
|
|
186
|
-
"inline": true
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
192
|
+
"className": "w-4/5",
|
|
193
|
+
"inline": true
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"type": "action",
|
|
197
|
+
"className": "w-4/5 mr-7",
|
|
198
|
+
"label": "",
|
|
199
|
+
"id": "steedos-field-edit-button",
|
|
200
|
+
"icon": "fa fa-pencil",
|
|
201
|
+
"level": "link",
|
|
202
|
+
"actionType": "dialog",
|
|
203
|
+
"dialog": {
|
|
204
|
+
"title": "编辑字段",
|
|
205
|
+
"body": [
|
|
206
|
+
{
|
|
207
|
+
"type": "steedos-object-form",
|
|
208
|
+
"label": "对象表单",
|
|
209
|
+
"objectApiName": "object_fields",
|
|
210
|
+
"recordId": "${_id}",
|
|
211
|
+
"mode": "edit",
|
|
212
|
+
"defaultData": {
|
|
213
|
+
"name": "",
|
|
214
|
+
"shared": false,
|
|
215
|
+
"object": "${designObjectName}"
|
|
216
|
+
},
|
|
217
|
+
"fields": [
|
|
218
|
+
"label",
|
|
219
|
+
"readonly",
|
|
220
|
+
"is_wide"
|
|
221
|
+
],
|
|
222
|
+
"fieldsExtend": {
|
|
223
|
+
"label": {
|
|
224
|
+
"is_wide": true,
|
|
225
|
+
"group": ""
|
|
226
|
+
},
|
|
227
|
+
"readonly": {
|
|
228
|
+
"group": ""
|
|
229
|
+
},
|
|
230
|
+
"is_wide": {
|
|
231
|
+
"group": ""
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"id": "u:b71796d3cb8c",
|
|
235
|
+
"className": "mb-4",
|
|
236
|
+
"apiRequestAdaptor": "api.data.query = api.data.query.replace('object_fields__update', 'object_fields__upsert')",
|
|
237
|
+
"onEvent": {
|
|
238
|
+
"submitSucc": {
|
|
239
|
+
"weight": 0,
|
|
240
|
+
"actions": [
|
|
204
241
|
{
|
|
205
|
-
"
|
|
206
|
-
"
|
|
207
|
-
"objectApiName": "object_fields",
|
|
208
|
-
"recordId": "${_id}",
|
|
209
|
-
"mode": "edit",
|
|
210
|
-
"defaultData": {
|
|
211
|
-
"name": "",
|
|
212
|
-
"shared": false,
|
|
213
|
-
"object": "${designObjectName}"
|
|
214
|
-
},
|
|
215
|
-
"fields": [
|
|
216
|
-
"label",
|
|
217
|
-
"readonly",
|
|
218
|
-
"is_wide"
|
|
219
|
-
],
|
|
220
|
-
"fieldsExtend": {
|
|
221
|
-
"label": {
|
|
222
|
-
"is_wide": true,
|
|
223
|
-
"group": ""
|
|
224
|
-
},
|
|
225
|
-
"readonly": {
|
|
226
|
-
"group": ""
|
|
227
|
-
},
|
|
228
|
-
"is_wide": {
|
|
229
|
-
"group": ""
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
"id": "u:b71796d3cb8c",
|
|
233
|
-
"className": "mb-4",
|
|
234
|
-
"apiRequestAdaptor": "api.data.query = api.data.query.replace('object_fields__update', 'object_fields__upsert')",
|
|
235
|
-
"onEvent": {
|
|
236
|
-
"submitSucc": {
|
|
237
|
-
"weight": 0,
|
|
238
|
-
"actions": [
|
|
239
|
-
{
|
|
240
|
-
"actionType": "custom",
|
|
241
|
-
"script": "setTimeout(() => {\n doAction({\n \"actionType\": \"broadcast\",\n \"args\": {\n \"eventName\": \"@data.changed.object_fields\"\n }\n });\n}, 500);\n\n\n"
|
|
242
|
-
}
|
|
243
|
-
]
|
|
244
|
-
}
|
|
245
|
-
}
|
|
242
|
+
"actionType": "custom",
|
|
243
|
+
"script": "setTimeout(() => {\n doAction({\n \"actionType\": \"broadcast\",\n \"args\": {\n \"eventName\": \"@data.changed.object_fields\"\n }\n });\n}, 500);\n\n\n"
|
|
246
244
|
}
|
|
247
|
-
]
|
|
248
|
-
"showCloseButton": true,
|
|
249
|
-
"showErrorMsg": true,
|
|
250
|
-
"showLoading": true,
|
|
251
|
-
"closeOnEsc": false,
|
|
252
|
-
"dataMapSwitch": false,
|
|
253
|
-
"size": "md",
|
|
254
|
-
"id": "u:066b3884bdd8"
|
|
245
|
+
]
|
|
255
246
|
}
|
|
256
247
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"type": "dialog",
|
|
251
|
+
"data": {
|
|
252
|
+
"appId": "${appId}",
|
|
253
|
+
"global": "${global}",
|
|
254
|
+
"context": "${context}",
|
|
255
|
+
"designObjectName": "${designObjectName}",
|
|
256
|
+
"_master": "${_master}",
|
|
257
|
+
"_id": "${_id}"
|
|
258
|
+
},
|
|
259
|
+
"showCloseButton": true,
|
|
260
|
+
"showErrorMsg": true,
|
|
261
|
+
"showLoading": true,
|
|
262
|
+
"closeOnEsc": false,
|
|
263
|
+
"dataMapSwitch": false,
|
|
264
|
+
"size": "md",
|
|
265
|
+
"id": "u:066b3884bdd8"
|
|
266
|
+
},
|
|
267
|
+
"size": "xs"
|
|
260
268
|
}
|
|
261
269
|
],
|
|
262
270
|
"bodyClassName": "h-7 flex justify-between items-center p-0 pl-10 my-2",
|
|
263
|
-
"toolbar": [
|
|
264
|
-
],
|
|
271
|
+
"toolbar": [],
|
|
265
272
|
"className": "mb-0 border-0 bg-none card",
|
|
266
273
|
"id": "u:296298da1bef"
|
|
267
274
|
},
|
|
@@ -290,8 +297,7 @@
|
|
|
290
297
|
},
|
|
291
298
|
"requestAdaptor": "var graphqlOrder = \"\";\n//先修改字段,使系统对象自行自定义\n//根据design_field,修改对象字段的sort_no与groups\nvar index = 1;\n_.forEach(api.data.design_field, function (items, key) {\n let group = key;\n if (key == \"未分组\" || key == \"隐藏\") {\n group = null;\n }\n _.forEach(items, function (item) {\n const field = _.find(api.data.fields, { 'id': item });\n //如果是在隐藏分组里的字段,就给visible_on属性赋予{{false}};如果不在隐藏分组里,就判断来自数据库内的visible_on属性是不是{{false}},是就清除,不是就保持不变\n const visible_on = key == \"隐藏\" ? \"{{false}}\" : (field.attr_visible_on == \"{{false}}\" ? \"{{true}}\" : field.attr_visible_on);\n let docJson = {\n sort_no: index * 10,\n group, visible_on\n }\n if (field.id == field._id && field.is_system) {\n docJson = {\n object: api.data.$self.designObjectName,\n type: field.type,\n _name: field._name,\n label: field.label,\n sort_no: index * 10,\n group,\n visible_on,\n is_system: field.is_system\n }\n }\n if (key != \"隐藏\") {\n docJson.hidden = false;\n }\n let itemOrder = 'upsert' + index + ':object_fields__upsert(id:\"' + item + '\" , doc:' + JSON.stringify(JSON.stringify(docJson)) + '){_id}\\n';\n graphqlOrder += itemOrder;\n index++;\n })\n})\n\n//根据groups,修改对象的字段分组field_groups\nvar field_groups = _.cloneDeep(api.data.groups);\n_.remove(field_groups, { is_default: true });\n_.remove(field_groups, { is_hidden: true });\nfield_groups = field_groups.map(function (group) {\n return _.omit(group, 'id');\n})\nconst keys = _.keys(api.data.design_field);\nfield_groups = _.sortBy(field_groups, function (group) { return _.findIndex(keys, function (key) { return key == group.group_name }) });\nconst groupOrder = 'upsert0:objects__upsert(id:\"' + api.data.$self.designObjectId + '\" , doc:' + JSON.stringify(JSON.stringify({ field_groups, name: api.data.$self.designObjectName })) + ') {_id}';\ngraphqlOrder += groupOrder;\n\n\ngraphqlOrder = 'mutation {' + graphqlOrder + '}';\nreturn {\n ...api,\n data: {\n query: graphqlOrder\n }\n}",
|
|
292
299
|
"adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[\n 0\n ].message) : payload.errors[\n 0\n ].message;\n}\nreturn payload;",
|
|
293
|
-
"messages": {
|
|
294
|
-
},
|
|
300
|
+
"messages": {},
|
|
295
301
|
"data": {
|
|
296
302
|
"design_field": "${design_field}",
|
|
297
303
|
"groups": "${groups}",
|
|
@@ -333,14 +339,12 @@
|
|
|
333
339
|
"headers": {
|
|
334
340
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
335
341
|
},
|
|
336
|
-
"messages": {
|
|
337
|
-
},
|
|
342
|
+
"messages": {},
|
|
338
343
|
"requestAdaptor": "",
|
|
339
344
|
"adaptor": "//筛选出可编辑的字段\r\nvar oldFields = _.filter(payload.data.fields, function (obj) { return obj.recordPermissions.allowEdit; });\r\n//将group为空的字段分为未分组的组中,将系统字段的_id改为对象名.字段名\r\noldFields = _.map(oldFields, function (obj) {\r\n obj.originId = obj._id;\r\n if (obj.hidden || obj.visible_on == \"{{false}}\") {\r\n obj.group = \"隐藏\";\r\n }else if (obj.group === null) {\r\n obj.group = \"未分组\";\r\n }\r\n if (obj.is_system) {\r\n obj._id = api.data.designObjectName + \".\" + obj._name;\r\n }\r\n return obj;\r\n});\r\n\r\n//整合出字段的属性集合\r\nconst fields = oldFields.map((field) => {\r\n return {\r\n \"id\": field._id,//用与steedos-board组件的关系分辨\r\n \"_name\": field._name,\r\n \"label\": field.label,\r\n \"_id\": field.originId,//用于打开steedos-objectform\r\n \"columnSpan\": field.is_wide ? 2 : 1,\r\n \"is_system\": field.is_system,\r\n \"type\": field.type,\r\n \"attr_visible_on\": field.visible_on\r\n }\r\n})\r\n\r\n//从字段的group属性中,整合出字段分组的属性集合\r\nlet field_groups = _.map(_.uniqBy(oldFields, \"group\"), function (obj) {\r\n return {\r\n \"id\": obj.group,\r\n \"group_name\": obj.group,\r\n \"visible_on\": \"\"\r\n };\r\n});\r\n\r\n//合并对象上的field_groups与字段上的group\r\nlet groups = _.unionBy(api.data.field_groups, field_groups, 'id');\r\n\r\n//判断是否第一次调用接口,不是的话(说明是触发了datachange事件),返回fields与fieldUpdateData\r\nif (api.data.dataInitialed) {\r\n const eventData = api.data.eventData;\r\n let fieldUpdateData = \"\";\r\n const fieldForGroup = api.data.fieldForGroup;\r\n let fieldForGroupLength = 0;\r\n _.forIn(fieldForGroup, function (value, key) {\r\n fieldForGroupLength += value.length;\r\n });\r\n if (fieldForGroupLength < fields.length) {\r\n fieldUpdateData = {\r\n type: \"insert\",\r\n id: eventData.result.data.recordId\r\n }\r\n } else if (fieldForGroupLength > fields.length) {\r\n fieldUpdateData = {\r\n type: \"delete\",\r\n id: eventData._id\r\n }\r\n }\r\n return payload = {\r\n data: {\r\n fields,\r\n fieldUpdateData\r\n }\r\n }\r\n}\r\n\r\n//整合字段与分组的关系\r\nconst oldFieldsInGroups = _.groupBy(oldFields, \"group\");\r\nlet fieldForGroup = _.mapValues(_.groupBy(groups, \"id\"), function (group,key) {\r\n if (oldFieldsInGroups[key]) {\r\n return _.map(oldFieldsInGroups[key], function (obj) {\r\n return obj._id;\r\n });\r\n } else {\r\n return [];\r\n }\r\n});\r\n\r\n//未分组 放在所有分组开头,隐藏 放在所有分组最后\r\nconst defaultGroup = fieldForGroup[\"未分组\"];\r\nconst hiddenGroup = fieldForGroup[\"隐藏\"];\r\ndelete fieldForGroup[\"未分组\"];\r\ndelete fieldForGroup[\"隐藏\"];\r\nfieldForGroup = _.merge({ \"未分组\": defaultGroup }, fieldForGroup, { \"隐藏\": hiddenGroup });\r\n\r\n//根据fieldForGroup调整groups顺序,设置分组与保存时需要groups按照顺序\r\nconst keys = _.keys(fieldForGroup);\r\ngroups = _.sortBy(groups, function (group) { return _.findIndex(keys, function (key) { return key == group.group_name }) });\r\n\r\nreturn payload = {\r\n data: {\r\n fields,\r\n groups,\r\n fieldForGroup,\r\n dataInitialed: true\r\n }\r\n};",
|
|
340
345
|
"sendOn": "!!this.designObjectId"
|
|
341
346
|
},
|
|
342
|
-
"messages": {
|
|
343
|
-
},
|
|
347
|
+
"messages": {},
|
|
344
348
|
"onEvent": {
|
|
345
349
|
"fetchInited": {
|
|
346
350
|
"actions": [
|
|
@@ -368,13 +372,11 @@
|
|
|
368
372
|
"headers": {
|
|
369
373
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
370
374
|
},
|
|
371
|
-
"messages": {
|
|
372
|
-
},
|
|
375
|
+
"messages": {},
|
|
373
376
|
"requestAdaptor": "",
|
|
374
377
|
"adaptor": "const field_groups = payload.data.objects[0] && _.map(payload.data.objects[0].field_groups, function (obj) {\r\n return {\r\n \"id\": obj.group_name,\r\n \"group_name\": obj.group_name,\r\n \"visible_on\": obj.visible_on\r\n }\r\n});\r\nfield_groups.unshift({\r\n id: \"隐藏\",\r\n group_name: \"隐藏\",\r\n visible_on: \"\",\r\n is_hidden: true\r\n});\r\nfield_groups.unshift({\r\n id: \"未分组\",\r\n group_name: \"未分组\",\r\n visible_on: \"\",\r\n is_default: true\r\n});\r\n\r\n\r\n\r\nconst designObjectId = payload.data.objects[0] && payload.data.objects[0]._id;\r\nreturn payload = {\r\n data: {\r\n field_groups,\r\n designObjectId,\r\n designObjectLabel: payload.data.objects[0] && payload.data.objects[0].label,\r\n _master: {\r\n recordId: designObjectId\r\n }\r\n }\r\n}"
|
|
375
378
|
},
|
|
376
|
-
"messages": {
|
|
377
|
-
},
|
|
379
|
+
"messages": {},
|
|
378
380
|
"onEvent": {
|
|
379
381
|
"@data.changed.object_fields": {
|
|
380
382
|
"actions": [
|
|
@@ -394,8 +396,7 @@
|
|
|
394
396
|
"body"
|
|
395
397
|
],
|
|
396
398
|
"data": {
|
|
397
|
-
"initialValues": {
|
|
398
|
-
},
|
|
399
|
+
"initialValues": {},
|
|
399
400
|
"appId": "builder",
|
|
400
401
|
"title": "",
|
|
401
402
|
"context": "${context}",
|
|
@@ -405,9 +406,6 @@
|
|
|
405
406
|
"css": {
|
|
406
407
|
".antd-TplField p": {
|
|
407
408
|
"margin": "0.625rem 0.625rem"
|
|
408
|
-
},
|
|
409
|
-
".steedos-design-field li.p-1 .field-amplify:hover": {
|
|
410
|
-
"font-size": "17px"
|
|
411
409
|
}
|
|
412
410
|
},
|
|
413
411
|
"className": "steedos-design-field",
|
|
@@ -35,7 +35,7 @@ const validateOptionsValue = (value)=>{
|
|
|
35
35
|
|
|
36
36
|
const validateOptionColorValue = (value)=>{
|
|
37
37
|
if(value){
|
|
38
|
-
const reg = /^[\da-f]{6}$/i;
|
|
38
|
+
const reg = /^(#)?[\da-f]{6}$/i;
|
|
39
39
|
if(!reg.test(value)){
|
|
40
40
|
throw new Error("object_fields_error_option_color_not_valid");
|
|
41
41
|
}
|
|
@@ -369,7 +369,7 @@ module.exports = {
|
|
|
369
369
|
if( doc.data_type === 'number' && !(_.isNumber(numberValue) && !_.isNaN(numberValue)) ){
|
|
370
370
|
throw new Meteor.Error(500, "选择项中的选项值类型应该与数据类型值一致, 请输入合法的数值。");
|
|
371
371
|
}
|
|
372
|
-
console.log('doc==>',doc.data_type , value)
|
|
372
|
+
// console.log('doc==>',doc.data_type , value)
|
|
373
373
|
if( doc.data_type === 'boolean' && ['true','false'].indexOf(value) < 0){
|
|
374
374
|
throw new Meteor.Error(500, "选择项中的选项值类型应该与数据类型值一致, 请输入 true 或 false。");
|
|
375
375
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.6.2-beta.
|
|
3
|
+
"version": "2.6.2-beta.21",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
],
|
|
12
12
|
"description": "steedos package",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@steedos-widgets/amis-lib": "^1.0.22"
|
|
14
|
+
"@steedos-widgets/amis-lib": "^1.0.22",
|
|
15
|
+
"@steedos/standard-objects": "2.6.2-beta.21"
|
|
15
16
|
},
|
|
16
17
|
"repository": {},
|
|
17
18
|
"license": "MIT",
|
|
18
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "600e2d63df2d9ce268fab74c21b5a50ef102a042"
|
|
19
20
|
}
|
package/package.service.js
CHANGED
|
@@ -12,6 +12,7 @@ const packageLoader = require('@steedos/service-meteor-package-loader');
|
|
|
12
12
|
const serviceObjectMixin = require('@steedos/service-object-mixin');
|
|
13
13
|
const validator = require('validator');
|
|
14
14
|
const triggers = require('./src/triggers');
|
|
15
|
+
const { checkAPIName } = require('@steedos/standard-objects').util
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* @typedef {import('moleculer').Context} Context Moleculer's Context
|
|
@@ -120,6 +121,19 @@ module.exports = {
|
|
|
120
121
|
return object.update(id, data, userSession)
|
|
121
122
|
},
|
|
122
123
|
},
|
|
124
|
+
checkAPIName: {
|
|
125
|
+
params: {
|
|
126
|
+
objectName: { type: 'string' },
|
|
127
|
+
fieldName: { type: 'string' },
|
|
128
|
+
fieldValue: { type: 'string' },
|
|
129
|
+
recordId: { type: 'string', optional: true },
|
|
130
|
+
filters: { type: 'array', optional: true, },
|
|
131
|
+
},
|
|
132
|
+
async handler (ctx) {
|
|
133
|
+
const { objectName, fieldName, fieldValue, recordId, filters } = ctx.params;
|
|
134
|
+
await checkAPIName(objectName, fieldName, fieldValue, recordId, filters)
|
|
135
|
+
}
|
|
136
|
+
},
|
|
123
137
|
},
|
|
124
138
|
|
|
125
139
|
/**
|