@tachybase/module-event-source 1.5.1 → 1.6.0
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/dist/client/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
(function(i,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@tachybase/client"),require("@tego/client"),require("react/jsx-runtime"),require("@tachybase/module-workflow/client"),require("@tachybase/schema"),require("react"),require("@ant-design/icons"),require("@dnd-kit/core"),require("antd"),require("lodash"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tego/client","react/jsx-runtime","@tachybase/module-workflow/client","@tachybase/schema","react","@ant-design/icons","@dnd-kit/core","antd","lodash","dayjs"],o):(i=typeof globalThis!="undefined"?globalThis:i||self,o(i["@tachybase/module-event-source"]={},i["@tachybase/client"],i["@tego/client"],i.jsxRuntime,i["@tachybase/module-workflow"],i["@tachybase/schema"],i.react,i["@ant-design/icons"],i["@dnd-kit/core"],i.antd,i.lodash,i.dayjs))})(this,function(i,o,l,t,C,x,f,T,y,g,D,Y){"use strict";var Ve=Object.defineProperty,Be=Object.defineProperties;var Oe=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var z=(i,o,l)=>o in i?Ve(i,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[o]=l,u=(i,o)=>{for(var l in o||(o={}))G.call(o,l)&&z(i,l,o[l]);if(B)for(var l of B(o))J.call(o,l)&&z(i,l,o[l]);return i},A=(i,o)=>Be(i,Oe(o));var N=(i,o)=>{var l={};for(var t in i)G.call(i,t)&&o.indexOf(t)<0&&(l[t]=i[t]);if(i!=null&&B)for(var t of B(i))o.indexOf(t)<0&&J.call(i,t)&&(l[t]=i[t]);return l};var k=(i,o,l)=>new Promise((t,C)=>{var x=y=>{try{T(l.next(y))}catch(g){C(g)}},f=y=>{try{T(l.throw(y))}catch(g){C(g)}},T=y=>y.done?t(y.value):Promise.resolve(y.value).then(x,f);T((l=l.apply(i,o)).next())});const K={name:"customEventSources",fields:[{name:"id",type:"bigInt",interface:"input",uiSchema:{title:"ID",type:"number","x-component":"InputNumber"}},{name:"collectionName",type:"string",interface:"input",uiSchema:{title:'{{t("collection Name")}}',type:"string","x-component":"Input",required:!0}},{name:"pathDesc",type:"text",interface:"input",uiSchema:{title:'{{t("path")}}',type:"string","x-component":"Input",required:!0}},{type:"belongsTo",name:"workflow",foreignKey:"workflowId",primaryKey:!1,interface:"m2o",uiSchema:{type:"number",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"workflows"}}}},{type:"belongsTo",name:"uiSchema",foreignKey:"uiSchemaId",primaryKey:!1,interface:"m2o",uiSchema:{type:"number",title:'{{t("uiSchema", { ns: "workflow" })}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"uiSchema"}}}},{type:"belongsTo",name:"completeUiSchema",foreignKey:"completeUiSchemaId",primaryKey:!1,interface:"m2o",uiSchema:{type:"number",title:'{{t("completeUiSchema", { ns: "workflow" })}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"uiSchema"}}}}]},O="event-source";function M(e,r={}){return o.i18n.t(e,A(u({},r),{ns:[O,"core"]}))}const n=(e,r={})=>o.tval(e,u({ns:[O,"core"]},r)),H={type:"void",properties:{managerProvider:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:K,action:"list",params:{filter:{},except:["config"],appends:["workflow","uiSchema","completeUiSchema"]},rowKey:"id"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},sync:{type:"void",title:n("Sync"),"x-component":"Action","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useSyncCustomEventSource"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:10,align:"center"},properties:{id:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},workflow:{type:"void",title:'{{t("Workflow", { ns: "workflow" })}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:200},properties:{workflow:{"x-component":"ColumnWorkflow","x-read-pretty":!0}}},uiSchema:{type:"void",title:'{{t("uiSchema", { ns: "workflow" })}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:200},properties:{uiSchema:{"x-component":"ColumnUISchema","x-read-pretty":!0}}},completeUiSchema:{type:"void",title:'{{t("completeUiSchema", { ns: "workflow" })}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:200},properties:{completeUiSchema:{"x-component":"ColumnUISchema","x-read-pretty":!0}}},collectionName:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{collectionName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},pathDesc:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{pathDesc:{type:"string","x-component":"CollectionField","x-component-props":{style:{overflow:"scroll"}},"x-read-pretty":!0}}}}}}}}};function _(){const{refresh:e}=o.useDataBlockRequest(),r=o.useDataBlockResource();return{onClick(){return k(this,null,function*(){yield r.sync({name:"sync"}),e()})}}}const Q=()=>t.jsx(o.ExtendCollectionsProvider,{collections:[K],children:t.jsx(o.SchemaComponentOptions,{components:{ColumnWorkflow:X,ColumnUISchema:Z},scope:{useSyncCustomEventSource:_},children:t.jsx(C.WorkflowPane,{schema:H})})}),X=x.observer(()=>{var r,c;const e=x.useField();return`${(r=e==null?void 0:e.value)==null?void 0:r.title}-${(c=e==null?void 0:e.value)==null?void 0:c.id}`},{displayName:"ColumnWorkflow"}),Z=x.observer(()=>{var r,c;const e=x.useField();return((r=e==null?void 0:e.value)==null?void 0:r.title)||`${(c=e==null?void 0:e.value)==null?void 0:c["x-uid"]}`},{displayName:"ColumnUISchema"});class P{}class R extends P{constructor(){super(...arguments),this.title=n("App event"),this.description=n("Application-related events, such as beforeStop: before the application stops, afterStart: after the application starts"),this.options={eventName:{required:!0,type:"string",title:n("Event name"),"x-decorator":"FormItem","x-component":"Input","x-reactions":['{{(field) => { const collection = field.query("options.collection").get("value"); const event = field.query("options.collectionEvent").get("value"); field.value = `${collection || ""}.${event || ""}`; }}}']}}}}class $ extends P{constructor(){super(...arguments),this.title=n("Custom resource action"),this.description=n("for creating custom requests, try not to duplicate with other requests"),this.options={resourceName:{type:"string",title:n("Resource name"),"x-decorator":"FormItem","x-component":"Input"},actionName:{type:"string",title:n("Action name"),"x-decorator":"FormItem","x-component":"Input"},triggerOnAssociation:{type:"boolean",title:n("Trigger on association"),"x-decorator":"FormItem","x-component":"Checkbox"}}}}class ee extends P{constructor(){super(...arguments),this.title=n("Database event"),this.description=n("Add specific hook events after creating, modifying, and deleting data tables"),this.options={collection:{type:"string",title:'{{t("Collection")}}',"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader","x-decorator-props":{tooltip:n("Auxiliary selection, you can also customize the event name")}},collectionEvent:{title:n("Collection event"),"x-decorator":"FormItem","x-component":"Select",enum:[{label:n("Before Save (Create/Update)"),value:"beforeSave"},{label:n("Before Create"),value:"beforeCreate"},{label:n("Before Update"),value:"beforeUpdate"},{label:n("Before Delete"),value:"beforeDestroy"},{label:n("After Save (Create/Update)"),value:"afterSave"},{label:n("After Create"),value:"afterCreate"},{label:n("After Update"),value:"afterUpdate"},{label:n("After Delete"),value:"afterDestroy"},{label:n("After Save with Associations"),value:"afterSaveWithAssociations"},{label:n("After Create with Associations"),value:"afterCreateWithAssociations"},{label:n("After Update with Associations"),value:"afterUpdateWithAssociations"}],"x-decorator-props":{tooltip:n("Auxiliary selection, you can also customize the event name")}},eventName:{title:n("Event name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-reactions":['{{(field) => { const collection = field.query("options.collection").get("value"); const event = field.query("options.collectionEvent").get("value"); field.value = `${collection || ""}.${event || ""}`; }}}']}}}}class W extends P{constructor(r,c){super(),this.options={resourceName:{type:"string",title:n("Resource name"),"x-decorator":"FormItem","x-component":"Input"},actionName:{type:"string",title:n("Action name"),"x-decorator":"FormItem","x-component":"Input"},triggerOnAssociation:{type:"boolean",title:n("Trigger on association"),"x-decorator":"FormItem","x-component":"Checkbox"}},this.title=r,this.description=c}}const U=f.createContext({refresh:()=>{},activeKey:"",setActiveKey:()=>{}}),E=()=>f.useContext(U);function oe({data:e}){const{label:r,color:c,options:a}=e,s=o.useCompile();return t.jsxs(o.Space,{direction:"vertical",children:[t.jsx(g.Tag,{color:c,children:s(r)}),t.jsx(g.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(a.description)})]})}const I={name:"webhooks",title:"webhooks",fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:n("Name"),type:"string","x-component":"Input",required:!0}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:n("Enabled"),type:"string",required:!0,enum:[{label:n("On"),value:!0,color:"#52c41a"},{label:n("Off"),value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"belongsToMany",name:"category",target:"webhookCategories",sourceKey:"id",foreignKey:"webhookId",otherKey:"categoryId",targetKey:"id",sortBy:"sort",through:"webhookCategory",collectionName:"webhooks",interface:"m2m",uiSchema:{title:`{{t("webhook Category", { ns: "${O}" })}}`,type:"array","x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"name"}}}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"string",name:"workflowKey",interface:"select",uiSchema:{title:n("Workflow"),type:"string","x-component":"WorkflowSelect","x-component-props":{buttonAction:"customize:triggerWorkflows",noCollection:!0,label:"title",value:"key"}}},{type:"string",name:"type",uiSchema:{title:n("Type"),"x-component":"Select","x-decorator":"FormItem",enum:"{{useTriggersOptions()}}","x-component-props":{optionRender:oe,popupMatchSelectWidth:!0,listHeight:300}}},{type:"json",name:"options",interface:"object",uiSchema:{type:"object",title:n("Options"),"x-component":"TypeContainer"}},{type:"text",name:"code",interface:"textarea",uiSchema:{title:n("Code"),type:"string","x-component":"CodeMirror","x-component-props":{defaultValue:`// ctx.action.params can get user query
|
|
1
|
+
(function(c,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@tachybase/client"),require("@tego/client"),require("react/jsx-runtime"),require("@tachybase/module-workflow/client"),require("@tachybase/schema"),require("react"),require("@ant-design/icons"),require("@dnd-kit/core"),require("antd"),require("lodash")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tego/client","react/jsx-runtime","@tachybase/module-workflow/client","@tachybase/schema","react","@ant-design/icons","@dnd-kit/core","antd","lodash"],o):(c=typeof globalThis!="undefined"?globalThis:c||self,o(c["@tachybase/module-event-source"]={},c["@tachybase/client"],c["@tego/client"],c.jsxRuntime,c["@tachybase/module-workflow"],c["@tachybase/schema"],c.react,c["@ant-design/icons"],c["@dnd-kit/core"],c.antd,c.lodash))})(this,function(c,o,d,t,S,f,y,I,g,h,P){"use strict";var We=Object.defineProperty,Oe=Object.defineProperties;var Ke=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var J=(c,o,d)=>o in c?We(c,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):c[o]=d,u=(c,o)=>{for(var d in o||(o={}))H.call(o,d)&&J(c,d,o[d]);if(V)for(var d of V(o))_.call(o,d)&&J(c,d,o[d]);return c},F=(c,o)=>Oe(c,Ke(o));var q=(c,o)=>{var d={};for(var t in c)H.call(c,t)&&o.indexOf(t)<0&&(d[t]=c[t]);if(c!=null&&V)for(var t of V(c))o.indexOf(t)<0&&_.call(c,t)&&(d[t]=c[t]);return d};var k=(c,o,d)=>new Promise((t,S)=>{var f=g=>{try{I(d.next(g))}catch(h){S(h)}},y=g=>{try{I(d.throw(g))}catch(h){S(h)}},I=g=>g.done?t(g.value):Promise.resolve(g.value).then(f,y);I((d=d.apply(c,o)).next())});const M={name:"customEventSources",fields:[{name:"id",type:"bigInt",interface:"input",uiSchema:{title:"ID",type:"number","x-component":"InputNumber"}},{name:"collectionName",type:"string",interface:"input",uiSchema:{title:'{{t("collection Name")}}',type:"string","x-component":"Input",required:!0}},{name:"pathDesc",type:"text",interface:"input",uiSchema:{title:'{{t("path")}}',type:"string","x-component":"Input",required:!0}},{type:"belongsTo",name:"workflow",foreignKey:"workflowId",primaryKey:!1,interface:"m2o",uiSchema:{type:"number",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"workflows"}}}},{type:"belongsTo",name:"uiSchema",foreignKey:"uiSchemaId",primaryKey:!1,interface:"m2o",uiSchema:{type:"number",title:'{{t("uiSchema", { ns: "workflow" })}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"uiSchema"}}}},{type:"belongsTo",name:"completeUiSchema",foreignKey:"completeUiSchemaId",primaryKey:!1,interface:"m2o",uiSchema:{type:"number",title:'{{t("completeUiSchema", { ns: "workflow" })}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"uiSchema"}}}}]},W="event-source";function Q(e,r={}){return o.i18n.t(e,F(u({},r),{ns:[W,"core"]}))}const n=(e,r={})=>o.tval(e,u({ns:[W,"core"]},r)),X={type:"void",properties:{managerProvider:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:M,action:"list",params:{filter:{},except:["config"],appends:["workflow","uiSchema","completeUiSchema"]},rowKey:"id"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},sync:{type:"void",title:n("Sync"),"x-component":"Action","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useSyncCustomEventSource"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:10,align:"center"},properties:{id:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},workflow:{type:"void",title:'{{t("Workflow", { ns: "workflow" })}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:200},properties:{workflow:{"x-component":"ColumnWorkflow","x-read-pretty":!0}}},uiSchema:{type:"void",title:'{{t("uiSchema", { ns: "workflow" })}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:200},properties:{uiSchema:{"x-component":"ColumnUISchema","x-read-pretty":!0}}},completeUiSchema:{type:"void",title:'{{t("completeUiSchema", { ns: "workflow" })}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:200},properties:{completeUiSchema:{"x-component":"ColumnUISchema","x-read-pretty":!0}}},collectionName:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{collectionName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},pathDesc:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{pathDesc:{type:"string","x-component":"CollectionField","x-component-props":{style:{overflow:"scroll"}},"x-read-pretty":!0}}}}}}}}};function Y(){const{refresh:e}=o.useDataBlockRequest(),r=o.useDataBlockResource();return{onClick(){return k(this,null,function*(){yield r.sync({name:"sync"}),e()})}}}const Z=()=>t.jsx(o.ExtendCollectionsProvider,{collections:[M],children:t.jsx(o.SchemaComponentOptions,{components:{ColumnWorkflow:$,ColumnUISchema:R},scope:{useSyncCustomEventSource:Y},children:t.jsx(S.WorkflowPane,{schema:X})})}),$=f.observer(()=>{var r,i;const e=f.useField();return`${(r=e==null?void 0:e.value)==null?void 0:r.title}-${(i=e==null?void 0:e.value)==null?void 0:i.id}`},{displayName:"ColumnWorkflow"}),R=f.observer(()=>{var r,i;const e=f.useField();return((r=e==null?void 0:e.value)==null?void 0:r.title)||`${(i=e==null?void 0:e.value)==null?void 0:i["x-uid"]}`},{displayName:"ColumnUISchema"});class E{}class ee extends E{constructor(){super(...arguments),this.title=n("App event"),this.description=n("Application-related events, such as beforeStop: before the application stops, afterStart: after the application starts"),this.options={eventName:{required:!0,type:"string",title:n("Event name"),"x-decorator":"FormItem","x-component":"Input","x-reactions":['{{(field) => { const collection = field.query("options.collection").get("value"); const event = field.query("options.collectionEvent").get("value"); field.value = `${collection || ""}.${event || ""}`; }}}']}}}}class oe extends E{constructor(){super(...arguments),this.title=n("Custom resource action"),this.description=n("for creating custom requests, try not to duplicate with other requests"),this.options={resourceName:{type:"string",title:n("Resource name"),"x-decorator":"FormItem","x-component":"Input"},actionName:{type:"string",title:n("Action name"),"x-decorator":"FormItem","x-component":"Input"},triggerOnAssociation:{type:"boolean",title:n("Trigger on association"),"x-decorator":"FormItem","x-component":"Checkbox"}}}}class te extends E{constructor(){super(...arguments),this.title=n("Database event"),this.description=n("Add specific hook events after creating, modifying, and deleting data tables"),this.options={collection:{type:"string",title:'{{t("Collection")}}',"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader","x-decorator-props":{tooltip:n("Auxiliary selection, you can also customize the event name")}},collectionEvent:{title:n("Collection event"),"x-decorator":"FormItem","x-component":"Select",enum:[{label:n("Before Save (Create/Update)"),value:"beforeSave"},{label:n("Before Create"),value:"beforeCreate"},{label:n("Before Update"),value:"beforeUpdate"},{label:n("Before Delete"),value:"beforeDestroy"},{label:n("After Save (Create/Update)"),value:"afterSave"},{label:n("After Create"),value:"afterCreate"},{label:n("After Update"),value:"afterUpdate"},{label:n("After Delete"),value:"afterDestroy"},{label:n("After Save with Associations"),value:"afterSaveWithAssociations"},{label:n("After Create with Associations"),value:"afterCreateWithAssociations"},{label:n("After Update with Associations"),value:"afterUpdateWithAssociations"}],"x-decorator-props":{tooltip:n("Auxiliary selection, you can also customize the event name")}},eventName:{title:n("Event name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-reactions":['{{(field) => { const collection = field.query("options.collection").get("value"); const event = field.query("options.collectionEvent").get("value"); field.value = `${collection || ""}.${event || ""}`; }}}']}}}}class U extends E{constructor(r,i){super(),this.options={resourceName:{type:"string",title:n("Resource name"),"x-decorator":"FormItem","x-component":"Input"},actionName:{type:"string",title:n("Action name"),"x-decorator":"FormItem","x-component":"Input"},triggerOnAssociation:{type:"boolean",title:n("Trigger on association"),"x-decorator":"FormItem","x-component":"Checkbox"}},this.title=r,this.description=i}}const L=y.createContext({refresh:()=>{},activeKey:"",setActiveKey:()=>{}}),B=()=>y.useContext(L);function re({data:e}){const{label:r,color:i,options:a}=e,s=o.useCompile();return t.jsxs(o.Space,{direction:"vertical",children:[t.jsx(h.Tag,{color:i,children:s(r)}),t.jsx(h.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(a.description)})]})}const D={name:"webhooks",title:"webhooks",fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:n("Name"),type:"string","x-component":"Input",required:!0}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:n("Enabled"),type:"string",required:!0,enum:[{label:n("On"),value:!0,color:"#52c41a"},{label:n("Off"),value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"belongsToMany",name:"category",target:"webhookCategories",sourceKey:"id",foreignKey:"webhookId",otherKey:"categoryId",targetKey:"id",sortBy:"sort",through:"webhookCategory",collectionName:"webhooks",interface:"m2m",uiSchema:{title:`{{t("webhook Category", { ns: "${W}" })}}`,type:"array","x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"name"}}}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"string",name:"workflowKey",interface:"select",uiSchema:{title:n("Workflow"),type:"string","x-component":"WorkflowSelect","x-component-props":{buttonAction:"customize:triggerWorkflows",noCollection:!0,label:"title",value:"key"}}},{type:"string",name:"type",uiSchema:{title:n("Type"),"x-component":"Select","x-decorator":"FormItem",enum:"{{useTriggersOptions()}}","x-component-props":{optionRender:re,popupMatchSelectWidth:!0,listHeight:300}}},{type:"json",name:"options",interface:"object",uiSchema:{type:"object",title:n("Options"),"x-component":"TypeContainer"}},{type:"text",name:"code",interface:"textarea",uiSchema:{title:n("Code"),type:"string","x-component":"CodeMirror","x-component-props":{defaultValue:`// ctx.action.params can get user query
|
|
2
2
|
// ctx.action.params.values can get user body
|
|
3
3
|
// const { changed, data, error } = await ctx.getChanged(); can get changed fields and raw data
|
|
4
|
+
// ctx.originalBody can get action response data (available in resource after events)
|
|
4
5
|
// ctx.body to pass your data to workflow or to client who invoke this.
|
|
5
6
|
// ctx.body = ctx.action.params.values
|
|
6
|
-
// ctx.body
|
|
7
|
+
// ctx.body = ctx.originalBody // use action response data
|
|
8
|
+
// ctx.body=ctx.model`}}},{type:"boolean",name:"effect",interface:"radioGroup",uiSchema:{title:n("Real effect"),type:"string",required:!0,enum:[{label:n("On"),value:!0,color:"#52c41a"},{label:n("Off"),value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{name:"updatedAt",type:"date",interface:"updatedAt",uiSchema:{type:"datetime",title:n("Updated at"),"x-component":"DatePicker","x-component-props":{showTime:!0}}},{name:"updatedBy",type:"belongsTo",interface:"updatedBy",target:"users",targetKey:"id",foreignKey:"updatedById",collectionName:"webhooks",uiSchema:{type:"object",title:'{{t("Last updated by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}}]},ne={name:"webhookCategories",fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input"}}]},ie=f.observer(e=>{const{value:r}=e,i=o.useCompile();return t.jsx(t.Fragment,{children:r==null?void 0:r.map(a=>t.jsx(h.Tag,{color:a.color,children:i(a==null?void 0:a.name)},a.name))})},{displayName:"WebhookCategory"}),ce=()=>{const e=f.useForm(),r=o.useActionContext(),{refresh:i}=B(),a=o.useAPIClient();return{run(){return k(this,null,function*(){yield e.submit();const m=P.cloneDeep(e.values);yield a.resource("webhookCategories").create({values:u({},m)}),r.setVisible(!1),yield e.reset(),i()})}}},ae=e=>t.jsx(se,u({},e)),se=e=>{const{scope:r,getContainer:i,children:a}=e,[s,m]=y.useState(!1),{t:l}=o.useTranslation();return t.jsxs(o.ActionContextProvider,{value:{visible:s,setVisible:m},children:[t.jsx("div",{onClick:()=>m(!0),title:l("Add category"),children:a||t.jsx(I.PlusOutlined,{})}),t.jsx(o.SchemaComponent,{schema:pe,components:{CollectionCategory:ie},scope:u({getContainer:i,useCancelAction:o.useCancelAction,createOnly:!0,useCreatewebhookCategry:ce},r)})]})},pe={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:'{{ t("Add category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreatewebhookCategry }}",style:{marginLeft:"8px"}}}}}}}}},le=()=>{const e=f.useForm(),r=o.useActionContext(),{refresh:i}=B(),a=o.useAPIClient(),{id:s}=o.useRecord();return{run(){return k(this,null,function*(){yield e.submit();const l=P.cloneDeep(e.values);yield a.resource("webhookCategories").update({filter:{id:s},values:u({},l)}),r.setVisible(!1),yield e.reset(),i()})}}},de=e=>{const r=o.useRecord(),i=o.useRequest(()=>Promise.resolve({data:P.cloneDeep(r)}),F(u({},e),{manual:!0})),a=o.useActionContext();return y.useEffect(()=>{a.visible&&i.run()},[a.visible]),i},ue=e=>t.jsx(me,u({},e)),me=e=>{const{scope:r,getContainer:i,item:a,children:s}=e,[m,l]=y.useState(!1),v=o.useCompile();return t.jsx(o.RecordProvider,{record:a,children:t.jsxs(o.ActionContextProvider,{value:{visible:m,setVisible:l},children:[t.jsx(t.Fragment,{children:s||t.jsx("span",{onClick:()=>l(!0),children:v('{{ t("Edit category") }}')})}),t.jsx(o.SchemaComponent,{schema:ye,scope:u({getContainer:i,useCancelAction:o.useCancelAction,createOnly:!0,useEditCategry:le,useValuesFromRecord:de},r)})]})})},ye={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},"x-component":"Action.Modal",title:'{{ t("Edit category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useEditCategry }}",style:{marginLeft:"8px"}}}}}}}}},xe=e=>t.jsx(o.SchemaComponent,{schema:{properties:e.options}}),O=y.createContext({});O.displayName="WorkflowTitleContext";const fe=()=>y.useContext(O),ge=({children:e})=>{var C,A;const r=o.useTableBlockContext(),i=o.useAPIClient(),[a,s]=y.useState({}),m=((A=(C=r==null?void 0:r.service)==null?void 0:C.data)==null?void 0:A.data)||[],l=y.useMemo(()=>{const b=m.map(x=>x.workflowKey).filter(x=>x&&x.trim()!=="");return Array.from(new Set(b)).sort()},[m]),v=y.useMemo(()=>l.join(","),[l]);return y.useEffect(()=>{if(l.length===0){s({});return}k(null,null,function*(){try{const{data:x}=yield i.request({url:"workflows:list",method:"get",params:{filter:{key:{$in:l}},fields:["id","key","title"],paginate:!1}}),N=(x==null?void 0:x.data)||[],p={};N.forEach(T=>{T.key&&(p[T.key]=T.title||T.key)}),s(p)}catch(x){console.error("Failed to fetch workflow titles:",x)}})},[v,i]),t.jsx(O.Provider,{value:a,children:e})},j=({onClick:e})=>{const r=o.useCollectionRecordData(),i=fe(),a=r.workflowKey?i[r.workflowKey]||r.workflowKey:"-",s=!!r.workflowKey;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,textAlign:"left"},children:[s&&e&&t.jsx(h.Tooltip,{title:"查看执行历史",children:t.jsx(h.Button,{type:"text",size:"small",icon:t.jsx(I.HistoryOutlined,{style:{color:"#1890ff"}}),onClick:e,style:{padding:0,minWidth:"auto",flexShrink:0}})}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},title:a,children:a})]})},w=f.observable({value:"",item:{}}),he=a=>{var s=a,{params:e,filter:r={}}=s,i=q(s,["params","filter"]);const m=o.useCollectionRecordData(),l=F(u({},i),{params:F(u({},e),{filter:F(u({},e==null?void 0:e.filter),{key:m.workflowKey})})});return t.jsx(o.TableBlockProvider,u({},l))},be=()=>{const e=f.useForm(),r=o.useCollectionRecordData(),i=o.useDataBlockResource();return{onClick(){return k(this,null,function*(){const s=yield i.test({values:{body:JSON.parse(e.values.body||"{}"),params:JSON.parse(e.values.params||"{}"),name:r.name}});alert(JSON.stringify(s.data))})}}},ve=()=>{const{form:e}=o.useFormBlockProps();return w.value&&(e.values.category=[w.item]),{form:e}},z={name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"webhooks.name","x-component-props":{}},category:{type:"array","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"webhooks.category","x-component-props":{multiple:!0}},enabled:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"webhooks.enabled","x-component-props":{}},workflowKey:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"webhooks.workflowKey"},type:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"webhooks.type"},options:{type:"object","x-component":"CollectionField","x-decorator":"FormItem","x-reactions":{dependencies:["type"],fulfill:{schema:{"x-component-props":"{{ useTypeOptions($deps[0]) }}"}}},"x-collection-field":"webhooks.options"},code:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-decorator-props":{tooltip:`ctx.request
|
|
7
9
|
ctx.body
|
|
10
|
+
ctx.originalBody (action response data)
|
|
8
11
|
lib.JSON
|
|
9
12
|
lib.Math
|
|
10
|
-
lib.dayjs`},"x-collection-field":"webhooks.code"},effectConfig:{title:n("Effect config"),type:"string","x-component":"CodeMirror","x-component-props":{options:{readOnly:!0}},"x-decorator":"FormItem","x-decorator-props":{tooltip:n("The real effect of the server, not the preset configuration")},"x-collection-field":"webhooks.effectConfig"},description:{"x-component":"CollectionField","x-decorator":"FormItem"}},he={type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"webhooks:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:I.name},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:u({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},type:"void"}}}},L)}}},be={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"webhooks:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:I,params:{appends:["category"]}},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:u({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}}},L)}}}}}}},ve={title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-action-settings":{triggerWorkflows:[]},"x-decorator":"ACLActionProvider",type:"void"},Ce={type:"void",title:'{{ t("Test") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"webhooks:update","x-decorator":"FormBlockProvider","x-decorator-props":{action:"get",dataSource:"main",collection:I.name},"x-component":"CardItem",properties:{testForm:{type:"void","x-component":"FormV2",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useTestActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}},params:{type:"string","x-component":"CodeMirror","x-component-props":{defaultValue:"{}"},"x-decorator":"FormItem","x-decorator-props":{label:"query"}},body:{type:"string","x-component":"CodeMirror","x-component-props":{defaultValue:"{}"},"x-decorator":"FormItem","x-decorator-props":{label:"body"}}}}}}}}}};function we(e){const{isOver:r,setNodeRef:c}=y.useDroppable({id:e.id,data:e.data}),a=r?{color:"green"}:void 0;return t.jsx("div",{ref:c,style:a,children:e.children})}function ke(e){const{attributes:r,listeners:c,setNodeRef:a}=y.useDraggable({id:e.id,data:e.data});return t.jsx("div",A(u(u({ref:a},c),r),{children:t.jsx("div",{children:e.children})}))}const Se=x.observer(({item:e})=>t.jsx(we,{id:e.id.toString(),data:e,children:t.jsx("div",{children:t.jsx(ke,{id:e.id.toString(),data:e,children:t.jsx(j,{item:e})})})}),{displayName:"TabTitle"}),Ae=x.observer(e=>{const r={collection:I,dataSource:"main",action:"list",params:{pageSize:20,appends:["updatedBy","category"],sort:["-createdAt"],filter:{}},rowKey:"id",showIndex:!0,dragSort:!1};return v.value&&(r.params.filter["category.id"]=[v.value]),t.jsx(o.TableBlockProvider,u(u({},e),r))}),j=({item:e})=>{const{t:r}=o.useTranslation(),c=o.useCompile();return t.jsxs(g.Space,{children:[t.jsx(g.Badge,{color:e.color}),r(c(e.name))]})},Te=x.observer(e=>{const[r,c]=f.useState(null),{refresh:a}=E(),s=o.useAPIClient(),m=F=>k(null,null,function*(){const{active:h,over:S}=F;setTimeout(()=>{c(null)}),S&&S.id!==h.id&&(yield s.resource("webhookCategories").move({sourceId:h.id,targetId:S.id}),a())});function d(F){var h;c((h=F.active)==null?void 0:h.data.current)}const b=y.useSensor(y.MouseSensor,{activationConstraint:{distance:10}}),w=y.useSensors(b);return t.jsxs(y.DndContext,{sensors:w,onDragEnd:m,onDragStart:d,children:[e.children,t.jsx(y.DragOverlay,{children:r?t.jsx("span",{style:{whiteSpace:"nowrap"},children:t.jsx(j,{item:r})}):null})]})},{displayName:"DndProvider"}),Fe={type:"void",properties:{provider:{type:"void","x-decorator":Ae,"x-component":({children:e})=>{const r=o.useAPIClient(),[c,a]=f.useState([]),[s,m]=f.useState(!0),[d,b]=f.useState({tab:v.value,item:v.item}),w=o.useCompile(),{modal:F}=g.App.useApp(),h=f.useCallback(()=>k(null,null,function*(){m(!0);const{data:p}=yield r.request({url:"webhookCategories:list",params:{paginate:!1,sort:"sort"}});a(p.data),m(!1)}),[]);f.useEffect(()=>{h()},[h]);const S=p=>{F.confirm({title:w("{{t('Delete category')}}"),content:w("{{t('Are you sure you want to delete it?')}}"),onOk:()=>k(null,null,function*(){yield r.resource("webhookCategories").destroy({filter:{id:p}}),b({tab:"",item:{}}),v.value="",v.item={},h()})})},Pe=D.memoize(p=>({items:[{key:"edit",label:t.jsx(o.SchemaComponent,{schema:{type:"void",properties:{[x.uid()]:{"x-component":"EditWebhookCategory","x-component-props":{item:p}}}}})},{key:"delete",label:w("{{t('Delete category')}}"),onClick:()=>S(p.id)}]}));return t.jsx(U.Provider,{value:{refresh:h,activeKey:d.tab,setActiveKey:p=>b({tab:p,item:c.find(V=>V.id===p)})},children:t.jsx(Te,{children:t.jsx(g.Tabs,{addIcon:t.jsx(o.SchemaComponent,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddWebhookCategory","x-component-props":{type:"primary"}}}}}),type:"editable-card",activeKey:d.tab,onChange:p=>{const V=c.find(Ee=>Ee.id===p);b({tab:p,item:V}),v.value=p,v.item=V,p===""&&h()},defaultActiveKey:d.tab||"",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:[{id:"",name:M("All"),closable:!1}].concat(c).filter(p=>p&&p.name!=null&&p.id!=null).map(p=>({label:p.id!==""?t.jsx("div",{"data-no-dnd":"true",children:t.jsx(Se,{item:p})}):w(p.name),key:p.id,closable:p.closable,closeIcon:t.jsx(g.Dropdown,{menu:Pe(p),children:t.jsx(T.MenuOutlined,{role:"button","aria-label":w(p.name),style:{padding:8,margin:"-8px"}})}),children:t.jsx(o.CardItem,{children:e})}))})})})},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},fuzzySearch:{type:"void","x-component":"FuzzySearchInput","x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},create:{type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{form:he}}}}}},alert:{type:"void","x-component":"Alert","x-use-component-props":"useShowAlertProps","x-component-props":{message:n("configuration has changed, please click the restart in the upper right corner, or configure the service with EVENT_SOURCE_REALTIME=1 to start in real time"),type:"warning",showIcon:!0}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{nameColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:50,sorter:!0},properties:{name:{"x-collection-field":"webhooks.name","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},category:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center"},properties:{category:{type:"array","x-collection-field":"webhooks.category","x-component":"CollectionField","x-component-props":{multiple:!0,mode:"Tag"},"x-read-pretty":!0}}},enabledColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{enabled:{type:"boolean","x-collection-field":"webhooks.enabled","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},workflowKeyColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{workflowKey:{"x-collection-field":"webhooks.workflowKey","x-component":"CollectionField","x-read-pretty":!0,"x-decorator":"OpenDrawer","x-decorator-props":{component:({children:e,onClick:r})=>{const c=o.useCollectionRecordData();return t.jsxs(g.Space,{size:"small",children:[e,c.workflowKey?t.jsxs(g.Button,{type:"link",onClick:r,style:{padding:0,marginLeft:"-4px"},children:["(",M("View executions"),")"]}):null]})}},properties:{drawer:C.executionSchema}}}},typeColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,sorter:!0},properties:{type:{"x-collection-field":"webhooks.type","x-component":"CollectionField","x-component-props":{},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},executedTime:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:n("Finally executed on"),"x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{executedTime:{type:"string","x-component":"ColumnExecutedTime"}}},effectColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,sorter:!0},properties:{effect:{type:"boolean","x-collection-field":"webhooks.effect","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},description:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},updatedAt:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{updatedAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},updatedBy:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{updatedBy:{type:"string","x-collection-field":"webhooks.updatedBy","x-component":"CollectionField","x-read-pretty":!0}}},actionColumn:{type:"void",title:'{{ t("Actions") }}',"x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:150,fixed:"right"},"x-action-column":"actions",properties:{space:{type:"void","x-component":"Space",properties:{editAction:be,deleteAction:ve,testAction:Ce}}}}}}}}}},Ie=e=>{var a,s;const r=o.useDataBlockRequest(),c=(s=(a=r==null?void 0:r.data)==null?void 0:a.meta)==null?void 0:s.changed;return{style:A(u({},e.style),{visibility:c?"visible":"hidden"})}},De=()=>{const e=o.usePlugin(q),r=[];for(const s of e.triggers.getKeys())r.push({label:e.triggers.get(s).title,description:e.triggers.get(s).description,value:s});const c=s=>{var m,d;return{options:(d=(m=e.triggers)==null?void 0:m.get(s))==null?void 0:d.options}},a=()=>{const s=o.useCompile();return Array.from(e.triggers.getEntities()).map(F=>{var[d,h]=F,S=h,{title:b}=S,w=N(S,["title"]);return{value:d,label:s(b),color:"gold",options:w}}).sort((d,b)=>d.label.localeCompare(b.label))};return t.jsx(o.ExtendCollectionsProvider,{collections:[I,te],children:t.jsx(o.SchemaComponent,{name:"eventSource",schema:Fe,scope:{useTestActionProps:ge,useTriggersOptions:a,useTypeOptions:c,ExecutionRetryAction:C.ExecutionRetryAction,useShowAlertProps:Ie,useWebhookCategoryContext:E,useCreateFormBlockProps:fe},components:{Alert:o.withDynamicSchemaProps(g.Alert),ExecutionStatusColumn:C.ExecutionStatusColumn,ExecutionResourceProvider:ye,OpenDrawer:C.OpenDrawer,ExecutionLink:C.ExecutionLink,WorkflowSelect:o.WorkflowSelect,CodeMirror:l.CodeMirror,TypeContainer:xe,AddWebhookCategory:ce,EditWebhookCategory:de,ColumnExecutedTime:se}})})};class q extends o.Plugin{constructor(){super(...arguments),this.triggers=new l.Registry}load(){return k(this,null,function*(){this.triggers.register("resource",new $),this.triggers.register("applicationEvent",new R),this.triggers.register("databaseEvent",new ee),this.triggers.register("beforeResource",new W(n("Resource action before event"),n("get user input and original data changes before operation, but the workflow is triggered before the resource operation, which is commonly used for data verification, etc."))),this.triggers.register("afterResource",new W(n("Resource action after event"),n("get user input and original data changes before operation, but the workflow is triggered after the resource operation, which is commonly used for specific association changes, etc."))),this.app.systemSettingsManager.add("business-components.custom-event-source",{title:n("Custom event source"),icon:"trigger",Component:Q,aclSnippet:"pm.business-components.custom-event-source"}),this.app.systemSettingsManager.add("business-components.event-source",{title:n("Event source"),icon:"trigger",Component:De,sort:-100,aclSnippet:"pm.business-components.event-source"})})}}i.ModuleEventSourceClient=q,i.default=q,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
13
|
+
lib.dayjs`},"x-collection-field":"webhooks.code"},effectConfig:{title:n("Effect config"),type:"string","x-component":"CodeMirror","x-component-props":{options:{readOnly:!0}},"x-decorator":"FormItem","x-decorator-props":{tooltip:n("The real effect of the server, not the preset configuration")},"x-collection-field":"webhooks.effectConfig"},description:{"x-component":"CollectionField","x-decorator":"FormItem"}},Ce={type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"webhooks:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:D.name},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:u({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},type:"void"}}}},z)}}},we={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"webhooks:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:D,params:{appends:["category"]}},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:u({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}}},z)}}}}}}},ke={title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-action-settings":{triggerWorkflows:[]},"x-decorator":"ACLActionProvider",type:"void"},Se={type:"void",title:'{{ t("Test") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"webhooks:update","x-decorator":"FormBlockProvider","x-decorator-props":{action:"get",dataSource:"main",collection:D.name},"x-component":"CardItem",properties:{testForm:{type:"void","x-component":"FormV2",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useTestActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}},params:{type:"string","x-component":"CodeMirror","x-component-props":{defaultValue:"{}"},"x-decorator":"FormItem","x-decorator-props":{label:"query"}},body:{type:"string","x-component":"CodeMirror","x-component-props":{defaultValue:"{}"},"x-decorator":"FormItem","x-decorator-props":{label:"body"}}}}}}}}}};function Ae(e){const{isOver:r,setNodeRef:i}=g.useDroppable({id:e.id,data:e.data}),a=r?{color:"green"}:void 0;return t.jsx("div",{ref:i,style:a,children:e.children})}function Te(e){const{attributes:r,listeners:i,setNodeRef:a}=g.useDraggable({id:e.id,data:e.data});return t.jsx("div",F(u(u({ref:a},i),r),{children:t.jsx("div",{children:e.children})}))}const Fe=f.observer(({item:e})=>t.jsx(Ae,{id:e.id.toString(),data:e,children:t.jsx("div",{children:t.jsx(Te,{id:e.id.toString(),data:e,children:t.jsx(G,{item:e})})})}),{displayName:"TabTitle"}),Ie=f.observer(e=>{const r={collection:D,dataSource:"main",action:"list",params:{pageSize:20,appends:["updatedBy","category"],sort:["-createdAt"],filter:{}},rowKey:"id",showIndex:!0,dragSort:!1};return w.value&&(r.params.filter["category.id"]=[w.value]),t.jsx(o.TableBlockProvider,u(u({},e),r))}),G=({item:e})=>{const{t:r}=o.useTranslation(),i=o.useCompile();return t.jsxs(h.Space,{children:[t.jsx(h.Badge,{color:e.color}),r(i(e.name))]})},De=f.observer(e=>{const[r,i]=y.useState(null),{refresh:a}=B(),s=o.useAPIClient(),m=A=>k(null,null,function*(){const{active:b,over:x}=A;setTimeout(()=>{i(null)}),x&&x.id!==b.id&&(yield s.resource("webhookCategories").move({sourceId:b.id,targetId:x.id}),a())});function l(A){var b;i((b=A.active)==null?void 0:b.data.current)}const v=g.useSensor(g.MouseSensor,{activationConstraint:{distance:10}}),C=g.useSensors(v);return t.jsxs(g.DndContext,{sensors:C,onDragEnd:m,onDragStart:l,children:[e.children,t.jsx(g.DragOverlay,{children:r?t.jsx("span",{style:{whiteSpace:"nowrap"},children:t.jsx(G,{item:r})}):null})]})},{displayName:"DndProvider"}),Pe={type:"void",properties:{provider:{type:"void","x-decorator":Ie,"x-component":({children:e})=>{const r=o.useAPIClient(),[i,a]=y.useState([]),[s,m]=y.useState(!0),[l,v]=y.useState({tab:w.value,item:w.item}),C=o.useCompile(),{modal:A}=h.App.useApp(),b=y.useCallback(()=>k(null,null,function*(){m(!0);const{data:p}=yield r.request({url:"webhookCategories:list",params:{paginate:!1,sort:"sort"}});a(p.data),m(!1)}),[]);y.useEffect(()=>{b()},[b]);const x=p=>{A.confirm({title:C("{{t('Delete category')}}"),content:C("{{t('Are you sure you want to delete it?')}}"),onOk:()=>k(null,null,function*(){yield r.resource("webhookCategories").destroy({filter:{id:p}}),v({tab:"",item:{}}),w.value="",w.item={},b()})})},N=P.memoize(p=>({items:[{key:"edit",label:t.jsx(o.SchemaComponent,{schema:{type:"void",properties:{[f.uid()]:{"x-component":"EditWebhookCategory","x-component-props":{item:p}}}}})},{key:"delete",label:C("{{t('Delete category')}}"),onClick:()=>x(p.id)}]}));return t.jsx(L.Provider,{value:{refresh:b,activeKey:l.tab,setActiveKey:p=>v({tab:p,item:i.find(T=>T.id===p)})},children:t.jsx(De,{children:t.jsx(h.Tabs,{addIcon:t.jsx(o.SchemaComponent,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddWebhookCategory","x-component-props":{type:"primary"}}}}}),type:"editable-card",activeKey:l.tab,onChange:p=>{const T=i.find(Ve=>Ve.id===p);v({tab:p,item:T}),w.value=p,w.item=T,p===""&&b()},defaultActiveKey:l.tab||"",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:[{id:"",name:Q("All"),closable:!1}].concat(i).filter(p=>p&&p.name!=null&&p.id!=null).map(p=>({label:p.id!==""?t.jsx("div",{"data-no-dnd":"true",children:t.jsx(Fe,{item:p})}):C(p.name),key:p.id,closable:p.closable,closeIcon:t.jsx(h.Dropdown,{menu:N(p),children:t.jsx(I.MenuOutlined,{role:"button","aria-label":C(p.name),style:{padding:8,margin:"-8px"}})}),children:t.jsx(o.CardItem,{children:t.jsx(ge,{children:e})})}))})})})},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},fuzzySearch:{type:"void","x-component":"FuzzySearchInput","x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},create:{type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{form:Ce}}}}}},alert:{type:"void","x-component":"Alert","x-use-component-props":"useShowAlertProps","x-component-props":{message:n("configuration has changed, please click the restart in the upper right corner, or configure the service with EVENT_SOURCE_REALTIME=1 to start in real time"),type:"warning",showIcon:!0}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{nameColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:50,sorter:!0},properties:{name:{"x-collection-field":"webhooks.name","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},category:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center"},properties:{category:{type:"array","x-collection-field":"webhooks.category","x-component":"CollectionField","x-component-props":{multiple:!0,mode:"Tag"},"x-read-pretty":!0}}},enabledColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{enabled:{type:"boolean","x-collection-field":"webhooks.enabled","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},workflowKeyColumn:{title:n("Workflow"),type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{workflowKey:{type:"string","x-component":"WorkflowKeyColumn","x-decorator":"OpenDrawer","x-decorator-props":{component:({onClick:e})=>t.jsx(j,{onClick:e})},properties:{drawer:S.executionSchema}}}},typeColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,sorter:!0},properties:{type:{"x-collection-field":"webhooks.type","x-component":"CollectionField","x-component-props":{},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},effectColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,sorter:!0},properties:{effect:{type:"boolean","x-collection-field":"webhooks.effect","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},description:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},updatedAt:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{updatedAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},updatedBy:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{updatedBy:{type:"string","x-collection-field":"webhooks.updatedBy","x-component":"CollectionField","x-read-pretty":!0}}},actionColumn:{type:"void",title:'{{ t("Actions") }}',"x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:150,fixed:"right"},"x-action-column":"actions",properties:{space:{type:"void","x-component":"Space",properties:{editAction:we,deleteAction:ke,testAction:Se}}}}}}}}}},Ee=e=>{var a,s;const r=o.useDataBlockRequest(),i=(s=(a=r==null?void 0:r.data)==null?void 0:a.meta)==null?void 0:s.changed;return{style:F(u({},e.style),{visibility:i?"visible":"hidden"})}},Be=()=>{const e=o.usePlugin(K),r=[];for(const s of e.triggers.getKeys())r.push({label:e.triggers.get(s).title,description:e.triggers.get(s).description,value:s});const i=s=>{var m,l;return{options:(l=(m=e.triggers)==null?void 0:m.get(s))==null?void 0:l.options}},a=()=>{const s=o.useCompile();return Array.from(e.triggers.getEntities()).map(A=>{var[l,b]=A,x=b,{title:v}=x,C=q(x,["title"]);return{value:l,label:s(v),color:"gold",options:C}}).sort((l,v)=>l.label.localeCompare(v.label))};return t.jsx(o.ExtendCollectionsProvider,{collections:[D,ne],children:t.jsx(o.SchemaComponent,{name:"eventSource",schema:Pe,scope:{useTestActionProps:be,useTriggersOptions:a,useTypeOptions:i,ExecutionRetryAction:S.ExecutionRetryAction,useShowAlertProps:Ee,useWebhookCategoryContext:B,useCreateFormBlockProps:ve},components:{Alert:o.withDynamicSchemaProps(h.Alert),ExecutionStatusColumn:S.ExecutionStatusColumn,ExecutionResourceProvider:he,OpenDrawer:S.OpenDrawer,ExecutionLink:S.ExecutionLink,WorkflowSelect:o.WorkflowSelect,CodeMirror:d.CodeMirror,TypeContainer:xe,AddWebhookCategory:ae,EditWebhookCategory:ue,WorkflowKeyColumn:j}})})};class K extends o.Plugin{constructor(){super(...arguments),this.triggers=new d.Registry}load(){return k(this,null,function*(){this.triggers.register("resource",new oe),this.triggers.register("applicationEvent",new ee),this.triggers.register("databaseEvent",new te),this.triggers.register("beforeResource",new U(n("Resource action before event"),n("get user input and original data changes before operation, but the workflow is triggered before the resource operation, which is commonly used for data verification, etc."))),this.triggers.register("afterResource",new U(n("Resource action after event"),n("get user input and original data changes before operation, but the workflow is triggered after the resource operation, which is commonly used for specific association changes, etc."))),this.app.systemSettingsManager.add("business-components.custom-event-source",{title:n("Custom event source"),icon:"trigger",Component:Z,aclSnippet:"pm.business-components.custom-event-source"}),this.app.systemSettingsManager.add("business-components.event-source",{title:n("Event source"),icon:"trigger",Component:Be,sort:-100,aclSnippet:"pm.business-components.event-source"})})}}c.ModuleEventSourceClient=K,c.default=K,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface WorkflowTitleMap {
|
|
3
|
+
[workflowKey: string]: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const useWorkflowTitleContext: () => WorkflowTitleMap;
|
|
6
|
+
export declare const WorkflowTitleProvider: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const WorkflowKeyColumn: ({ onClick }: {
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.
|
|
2
|
+
"@tachybase/client": "1.6.0",
|
|
3
3
|
"@tego/client": "1.3.52",
|
|
4
4
|
"@tego/server": "1.3.52",
|
|
5
|
-
"@tachybase/module-workflow": "1.
|
|
5
|
+
"@tachybase/module-workflow": "1.6.0",
|
|
6
6
|
"@tachybase/schema": "1.3.52",
|
|
7
7
|
"react": "18.3.1",
|
|
8
8
|
"@ant-design/icons": "5.6.1",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-event-source",
|
|
3
3
|
"displayName": "Event Source",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"description": "Registering and managing custom event sources.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"System management"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"dayjs": "1.11.13",
|
|
21
21
|
"lodash": "4.17.21",
|
|
22
22
|
"sequelize": "6.37.5",
|
|
23
|
-
"@tachybase/
|
|
24
|
-
"@tachybase/
|
|
23
|
+
"@tachybase/client": "1.6.0",
|
|
24
|
+
"@tachybase/module-workflow": "1.6.0"
|
|
25
25
|
},
|
|
26
26
|
"description.zh-CN": "注册和管理自定义事件源",
|
|
27
27
|
"displayName.zh-CN": "事件源",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ColumnExecutedTime: () => import("react/jsx-runtime").JSX.Element;
|