-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31efa5b
commit f154c29
Showing
26 changed files
with
449 additions
and
108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
* @Author: [email protected] | ||
* @Date: 2024-03-22 14:37:50 | ||
* @LastEditors: [email protected] | ||
* @LastEditTime: 2024-04-12 15:17:00 | ||
* @LastEditTime: 2024-04-24 15:07:09 | ||
* @Description: 由于 collection observe 在 steedos-server.started 事件中被触发报错需要 Fiber ,添加Fiber 后, 不报错,但是无法订阅到数据. 所以单写服务处理此问题. | ||
* | ||
*/ | ||
|
||
"use strict"; | ||
const _ = require('lodash') | ||
const register = require('@steedos/metadata-registrar'); | ||
const { ActionFieldUpdateCacher, WorkflowOutboundMessageCacher, WorkflowNotificationCacher, WorkflowRuleCacher, ObjectValidationRulesCacher, SettingsCacher } = require('./lib/index') | ||
const { ActionFieldUpdateCacher, WorkflowOutboundMessageCacher, WorkflowNotificationCacher, WorkflowRuleCacher, ObjectValidationRulesCacher, SettingsCacher, ObjectWebhookCacher } = require('./lib/index') | ||
/** | ||
* @typedef {import('moleculer').Context} Context Moleculer's Context | ||
* 软件包服务启动后也需要抛出事件。 | ||
|
@@ -84,6 +84,8 @@ module.exports = { | |
|
||
this.settingsCacher = new SettingsCacher(); | ||
|
||
this.objectWebhooksCacher = new ObjectWebhookCacher(); | ||
|
||
await this.loadMetadataWorkflows() | ||
}, | ||
|
||
|
@@ -94,5 +96,6 @@ module.exports = { | |
this.workflowRuleCacher?.destroy(); | ||
this.objectValidationRulesCacher?.destroy(); | ||
this.settingsCacher?.destroy(); | ||
this.objectWebhooksCacher?.destroy() | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @Author: [email protected] | ||
* @Date: 2024-03-22 09:49:22 | ||
* @LastEditors: [email protected] | ||
* @LastEditTime: 2024-04-15 16:39:05 | ||
* @LastEditTime: 2024-04-24 15:55:16 | ||
* @Description: | ||
*/ | ||
const cachers = require('@steedos/cachers'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,13 @@ | |
* @Author: [email protected] | ||
* @Date: 2024-03-22 11:23:14 | ||
* @LastEditors: [email protected] | ||
* @LastEditTime: 2024-04-12 15:15:45 | ||
* @LastEditTime: 2024-04-24 09:30:07 | ||
* @Description: | ||
*/ | ||
export { ActionFieldUpdateCacher } from './action_field_updates' | ||
export { WorkflowNotificationCacher } from './workflow_notifications'; | ||
export { WorkflowOutboundMessageCacher } from './workflow_outbound_messages' | ||
export { WorkflowRuleCacher } from './workflow_rule'; | ||
export { ObjectValidationRulesCacher } from './object_validation_rules' | ||
export { SettingsCacher } from './settings' | ||
export { SettingsCacher } from './settings' | ||
export { ObjectWebhookCacher } from './object_webhook' |
14 changes: 14 additions & 0 deletions
14
services/service-cachers-manager/src/metadata-cachers/object_webhook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* @Author: [email protected] | ||
* @Date: 2024-04-24 09:29:28 | ||
* @LastEditors: [email protected] | ||
* @LastEditTime: 2024-04-24 14:53:42 | ||
* @Description: | ||
*/ | ||
import { MetadataCacherBase } from './base' | ||
|
||
export class ObjectWebhookCacher extends MetadataCacherBase{ | ||
constructor(){ | ||
super('object_webhooks', true, {active: true}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...in/default/objectTranslations/object_webhooks.en/object_webhooks.en.objectTranslation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: object_webhooks | ||
label: Object Webhook | ||
description: | ||
fields: | ||
name: | ||
label: Name | ||
help: | ||
description: | ||
object_name: | ||
label: Object | ||
help: | ||
description: | ||
events: | ||
label: Events | ||
help: | ||
options: | ||
- label: create | ||
value: create | ||
- label: update | ||
value: update | ||
- label: delete | ||
value: delete | ||
description: | ||
fields: | ||
label: Fields | ||
help: | ||
description: | ||
payload_url: | ||
label: Payload URL | ||
help: | ||
description: | ||
content_type: | ||
label: Format of Request | ||
help: | ||
description: | ||
active: | ||
label: Active | ||
help: | ||
description: | ||
space: | ||
label: Company | ||
help: | ||
description: | ||
listviews: | ||
all: | ||
label: All Object Webhooks |
48 changes: 48 additions & 0 deletions
48
...ault/objectTranslations/object_webhooks.zh-CN/object_webhooks.zh-CN.objectTranslation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: object_webhooks | ||
label: WebHooks | ||
description: | ||
fields: | ||
name: | ||
label: 名称 | ||
help: | ||
description: | ||
object_name: | ||
label: 对象 | ||
help: | ||
description: | ||
events: | ||
label: 何时触发 | ||
help: | ||
options: | ||
- label: 记录已创建 | ||
value: create | ||
- label: 记录已更新 | ||
value: update | ||
- label: 记录已创建或已更新 | ||
value: createAndUpdate | ||
- label: 记录已删除 | ||
value: delete | ||
description: | ||
fields: | ||
label: 推送字段 | ||
help: | ||
description: | ||
payload_url: | ||
label: URL | ||
help: | ||
description: | ||
content_type: | ||
label: 请求数据格式 | ||
help: | ||
description: | ||
active: | ||
label: 激活 | ||
help: | ||
description: | ||
space: | ||
label: 所属工作区 | ||
help: | ||
description: | ||
listviews: | ||
all: | ||
label: 所有 |
5 changes: 5 additions & 0 deletions
5
...ces/standard-object-database/main/default/objects/object_webhooks/fields/active.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: active | ||
label: Active | ||
type: boolean | ||
defaultValue: true | ||
sort_no: 80 |
6 changes: 6 additions & 0 deletions
6
.../standard-object-database/main/default/objects/object_webhooks/fields/condition.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: condition | ||
type: text | ||
sort_no: 40 | ||
is_wide: true | ||
label: 准入条件 | ||
inlineHelpText: 指定准入条件,减少触发执行次数。最大限度地减少非必要执行次数,这将有助于节省资源。如果您创建将在记录更新时触发,我们建议先定义准入条件。然后,对于何时为更新的记录运行,选择仅在更新记录满足条件要求时选项。 |
5 changes: 5 additions & 0 deletions
5
...andard-object-database/main/default/objects/object_webhooks/fields/content_type.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: content_type | ||
label: Format of Request | ||
type: text | ||
defaultValue: '"application/json"' | ||
hidden: true |
15 changes: 15 additions & 0 deletions
15
...ices/standard-object-database/main/default/objects/object_webhooks/fields/event.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: event | ||
type: select | ||
label: 何时触发 | ||
required: true | ||
multiple: false | ||
sort_no: 30 | ||
options: | ||
- label: 记录已创建 | ||
value: create | ||
- label: 记录已更新 | ||
value: update | ||
- label: 记录已创建或已更新 | ||
value: createAndUpdate | ||
- label: 记录已删除 | ||
value: delete |
12 changes: 12 additions & 0 deletions
12
...andard-object-database/main/default/objects/object_webhooks/fields/execute_when.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: execute_when | ||
label: 何时运行更新记录的webhook | ||
type: select | ||
inlineHelpText: 您可能希望仅在将触发记录从不满足条件要求更改为满足条件要求时运行。在出现此情况时,选择第二个选项。 | ||
visible_on: ${!!condition && (event === 'update' || event === 'createAndUpdate')} | ||
sort_no: 50 | ||
is_wide: true | ||
options: | ||
- label: 每次更新记录并满足条件要求 | ||
value: trueEveryTime | ||
- label: 仅在更新记录以满足条件要求时 | ||
value: trueOnChangeOnly |
27 changes: 27 additions & 0 deletions
27
...ces/standard-object-database/main/default/objects/object_webhooks/fields/fields.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: fields | ||
type: lookup | ||
label: Fields | ||
multiple: true | ||
is_wide: true | ||
sort_no: 60 | ||
depend_on: | ||
- object_name | ||
optionsFunction: !!js/function | | ||
function(values) { | ||
var _object, _options, fields, icon, object_name; | ||
object_name = values.object_name; | ||
if (!object_name) { | ||
return []; | ||
} | ||
_options = []; | ||
_object = Creator.getObject(object_name); | ||
fields = _object.fields; | ||
icon = _object.icon; | ||
_.forEach(fields, function(f, k) { | ||
return _options.push({ | ||
label: f.label || k, | ||
value: k | ||
}); | ||
}); | ||
return _options; | ||
} |
5 changes: 5 additions & 0 deletions
5
services/standard-object-database/main/default/objects/object_webhooks/fields/name.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: name | ||
type: text | ||
label: Name | ||
required: true | ||
sort_no: 10 |
8 changes: 8 additions & 0 deletions
8
...tandard-object-database/main/default/objects/object_webhooks/fields/object_name.field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: object_name | ||
type: lookup | ||
reference_to: objects | ||
reference_to_field: name | ||
label: Object | ||
required: true | ||
index: true | ||
sort_no: 20 |
Oops, something went wrong.