@nocobase/plugin-workflow-request-interceptor 2.2.0-beta.9 → 2.2.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/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./dist/client-v2/index.js');
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_workflow_request_interceptor=self.webpackChunk_nocobase_plugin_workflow_request_interceptor||[]).push([["214"],{685:function(e,l,t){t.r(l),t.d(l,{RequestInterceptionTriggerPresetConfig:function(){return u},default:function(){return m}});var r=t(197),n=t(59),o=t(155),a=t.n(o),c=t(977),i=t(488);function u(){var e=(0,i.kj)();return a().createElement(n.Form.Item,{name:["config","collection"],label:e("Collection"),rules:[{required:!0}]},a().createElement(r.CollectionCascader,null))}function m(){var e=(0,i.kj)(),l=n.Form.useWatch(["config","collection"]),t=n.Form.useWatch(["config","global"]),u=(0,o.useMemo)(function(){return[{label:e("Create record"),value:c.r.CREATE},{label:e("Update record"),value:c.r.UPDATE},{label:e("Delete record"),value:c.r.DESTROY}]},[e]);return a().createElement("fieldset",null,a().createElement(n.Form.Item,{name:["config","collection"],label:e("Collection"),rules:[{required:!0}]},a().createElement(r.CollectionCascader,{disabled:!0})),l?a().createElement(n.Form.Item,{name:["config","global"],label:e("Trigger mode"),initialValue:!1},a().createElement(n.Radio.Group,null,a().createElement(n.Space,{direction:"vertical"},a().createElement(n.Radio,{value:!1},e("Local mode, triggered before executing the actions bound to this workflow")),a().createElement(n.Radio,{value:!0},e("Global mode, triggered before executing the following actions"))))):null,l&&t?a().createElement(n.Form.Item,{name:["config","actions"],label:e("Select actions"),rules:[{required:!0}]},a().createElement(n.Checkbox.Group,null,a().createElement(n.Space,{direction:"vertical"},u.map(function(e){return a().createElement(n.Checkbox,{key:e.value,value:e.value},e.label)})))):null)}}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_workflow_request_interceptor=self.webpackChunk_nocobase_plugin_workflow_request_interceptor||[]).push([["600"],{51:function(e,t,r){r.r(t),r.d(t,{default:function(){return h}});var n=r(485),o=r(694),a=r(197),l=r(59),u=r(155),i=r.n(u),c=r(977),s=r(488);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t,r,n,o,a,l){try{var u=e[a](l),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){p(a,n,o,l,u,"next",e)}function u(e){p(a,n,o,l,u,"throw",e)}l(void 0)})}}function v(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var c=[u,i];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function b(e){var t,r=null!=(t=null==e?void 0:e.paths)?t:[];return r.length?"{{".concat(r.join("."),"}}"):""}function d(e){if("string"==typeof e){var t=e.trim().match(/^\{\{\s*(.+?)\s*\}\}$/);return t?t[1].split("."):void 0}}function y(e){var t,r=e.value,c=e.onChange,s=e.request,p=e.mapOptions,m=e.cacheKey,v=e.variableOptions,y=(0,a.useWorkflowVariableOptions)(v),h=function(e){if(Array.isArray(e))return e}(t=(0,u.useState)())||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw r}}return o}}(t)||function(e){if(e){if("string"==typeof e)return f(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return f(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=h[0],w=h[1],E="string"==typeof r&&/^\{\{\s*[^{}]+?\s*\}\}$/.test(r),k=E?void 0:r,S=(0,u.useMemo)(function(){return y},[y]);return i().createElement(l.Space.Compact,{block:!0},E?i().createElement(o.VariableTag,{value:r,metaTree:S,metaTreeNode:g,onClear:function(){return null==c?void 0:c(null)}}):i().createElement(n.RemoteSelect,{value:k,onChange:function(e){return null==c?void 0:c(e)},request:s,mapOptions:p,cacheKey:m}),i().createElement(o.FlowContextSelector,{metaTree:S,value:E?r:void 0,parseValueToPath:d,formatPathToValue:b,onChange:function(e,t){w(t),null==c||c(e)}}))}function h(){var e=(0,s.kj)(),t=(0,o.useFlowEngine)(),r=(0,u.useMemo)(function(){return[{label:e("Create record"),value:c.r.CREATE},{label:e("Update record"),value:c.r.UPDATE},{label:e("Delete record"),value:c.r.DESTROY}]},[e]),n=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]}},[]),f=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]}},[]);return i().createElement(i().Fragment,null,i().createElement(l.Form.Item,{name:"action",label:e("Action type"),initialValue:c.r.CREATE,rules:[{required:!0}]},i().createElement(l.Select,{allowClear:!1,options:r})),i().createElement(l.Form.Item,{name:"target",label:e("Record to submit"),extra:e("Choose a record or primary key of a record in the collection to trigger.",{ns:"workflow"}),initialValue:null,rules:[{required:!0}]},i().createElement(a.TriggerCollectionRecordSelect,null)),i().createElement(l.Form.Item,{name:"userId",label:e("User acted"),initialValue:null,rules:[{required:!0}]},i().createElement(y,{request:function(){return m(function(){var e,r,n;return v(this,function(o){switch(o.label){case 0:return[4,t.context.api.resource("users").list({pageSize:50})];case 1:return[2,null!=(e=null==(n=o.sent())||null==(r=n.data)?void 0:r.data)?e:[]]}})})()},mapOptions:function(e){var t;return{label:null!=(t=e.nickname)?t:e.id,value:e.id}},cacheKey:"workflow-request-interceptor:users",variableOptions:n})),i().createElement(l.Form.Item,{name:"roleName",label:e("Role of user acted"),initialValue:null},i().createElement(y,{request:function(){return m(function(){var e,r,n;return v(this,function(o){switch(o.label){case 0:return[4,t.context.api.resource("roles").list({pageSize:50})];case 1:return[2,null!=(e=null==(n=o.sent())||null==(r=n.data)?void 0:r.data)?e:[]]}})})()},mapOptions:function(t){return{label:t.title?e(t.title):t.name,value:t.name}},cacheKey:"workflow-request-interceptor:roles",variableOptions:f})))}}}]);
@@ -6,35 +6,19 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- /**
10
- * This file is part of the NocoBase (R) project.
11
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
12
- * Authors: NocoBase Team.
13
- *
14
- * This program is offered under a commercial license.
15
- * For more information, see <https://www.nocobase.com/agreement>
16
- */
17
- import { SchemaInitializerItemType, useCollectionDataSource } from '@nocobase/client';
18
- import { Trigger, RadioWithTooltip, CheckboxGroupWithTooltip, TriggerCollectionRecordSelect, WorkflowVariableWrapper } from '@nocobase/plugin-workflow/client';
9
+ import { useCollectionDataSource } from '@nocobase/client';
10
+ import type { SchemaInitializerItemType } from '@nocobase/client';
11
+ import { CheckboxGroupWithTooltip, RadioWithTooltip, TriggerCollectionRecordSelect, WorkflowVariableWrapper } from '@nocobase/plugin-workflow/client';
19
12
  import React from 'react';
20
- import { SubModelItem } from '@nocobase/flow-engine';
21
- declare function useVariables(config: any, options: any): (import("@nocobase/plugin-workflow/client").VariableOption | {
22
- label: string;
23
- value: string;
24
- children: ({
25
- label: string;
26
- value: string;
27
- children?: undefined;
28
- } | {
29
- label: string;
30
- value: string;
31
- children: import("@nocobase/plugin-workflow/client").VariableOption[];
32
- })[];
33
- })[];
34
- export default class extends Trigger {
35
- sync: boolean;
36
- title: string;
37
- description: string;
13
+ import V2RequestInterceptionTrigger from '../client-v2/RequestInterceptionTrigger';
14
+ type WorkflowField = {
15
+ isForeignKey?: boolean;
16
+ type?: string;
17
+ target?: string;
18
+ collectionName?: string;
19
+ name?: string;
20
+ };
21
+ export default class RequestInterceptionTrigger extends V2RequestInterceptionTrigger {
38
22
  presetFieldset: {
39
23
  collection: {
40
24
  type: string;
@@ -133,9 +117,9 @@ export default class extends Trigger {
133
117
  nullable: boolean;
134
118
  changeOnSelect: boolean;
135
119
  variableOptions: {
136
- types: ((field: any) => boolean)[];
120
+ types: ((field: WorkflowField) => boolean)[];
137
121
  };
138
- render(props: any): React.JSX.Element;
122
+ render(props: Record<string, unknown>): React.JSX.Element;
139
123
  };
140
124
  default: any;
141
125
  required: boolean;
@@ -149,14 +133,13 @@ export default class extends Trigger {
149
133
  nullable: boolean;
150
134
  changeOnSelect: boolean;
151
135
  variableOptions: {
152
- types: ((field: any) => boolean)[];
136
+ types: ((field: WorkflowField) => boolean)[];
153
137
  };
154
- render(props: any): React.JSX.Element;
138
+ render(props: Record<string, unknown>): React.JSX.Element;
155
139
  };
156
140
  default: any;
157
141
  };
158
142
  };
159
- validate(values: any): any;
160
143
  scope: {
161
144
  useCollectionDataSource: typeof useCollectionDataSource;
162
145
  useValueObject(): boolean;
@@ -168,15 +151,6 @@ export default class extends Trigger {
168
151
  WorkflowVariableWrapper: typeof WorkflowVariableWrapper;
169
152
  TriggerCollectionRecordSelect: typeof TriggerCollectionRecordSelect;
170
153
  };
171
- isActionTriggerable_deprecated: (config: any, context: any) => boolean;
172
- actionTriggerableScope: (config: any, scope: any) => boolean;
173
- useVariables: typeof useVariables;
174
154
  useInitializers(config: any): SchemaInitializerItemType | null;
175
- /**
176
- * 2.0
177
- */
178
- getCreateModelMenuItem({ config }: {
179
- config: any;
180
- }): SubModelItem;
181
155
  }
182
156
  export {};
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-request-interceptor",["react","@nocobase/client","@formily/react","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-request-interceptor"]=t(require("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-request-interceptor"]=t(e.react,e["@nocobase/client"],e["@formily/react"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,r,o){return function(){"use strict";var n={230:function(e){e.exports=r},342:function(e){e.exports=t},990:function(e){e.exports=o},155:function(t){t.exports=e}},i={};function c(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,c),r.exports}c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,{a:t}),t},c.d=function(e,t){for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(l=c.g.location+"");var l,a=c.g.document;if(!l&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(l=a.currentScript.src),!l)){var u=a.getElementsByTagName("script");if(u.length)for(var s=u.length-1;s>-1&&(!l||!/^http(s?):/.test(l));)l=u[s--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");c.p=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var p={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var r=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client/")>=0&&(e=r.replace(/\/[^\/]+$/,"/"))}if(!e){var o=window.__webpack_public_path__||"";o&&("/"!==o.charAt(o.length-1)&&(o+="/"),e=o+"static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",i="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var l=window.location.pathname||"/",a=l.indexOf(i);e=a>=0?l.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client/"}c.p=e}(),!function(){c.r(p),c.d(p,{PluginWorkflowRequestInterceptorClient:function(){return C},default:function(){return T}});var e=c(342),t=c(990),r="@nocobase/plugin-workflow-request-interceptor";function o(t){var o,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.i18n.t(t,(o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},i),n=n={ns:r},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(n)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(n,e))}),o))}var n=c(230),i="destroy",l=c(155),a=c.n(l);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){s(e,t,r[t])})}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}var v=[{label:"{{t('Create record', { ns: '".concat(r,"' })}}"),value:"create"},{label:"{{t('Update record', { ns: '".concat(r,"' })}}"),value:"update"},{label:"{{t('Delete record', { ns: '".concat(r,"' })}}"),value:i}];function w(r,n){var c,l,a,u,s=(0,e.useCompile)(),p=(0,t.useGetDataSourceCollectionManager)(),f=(0,t.getCollectionFieldOptions)(d(b({appends:["user"]},n),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:o("User acted")}},{name:"roleName",uiSchema:{title:o("Role of user acted")}}],compile:s,collectionManager:p})),y=[{label:o("Parameters"),value:"params",children:(l=(function(e){if(Array.isArray(e))return e}(c=(0,e.parseCollectionName)(r.collection))||function(e){var t,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n=[],i=!0,c=!1;try{for(o=o.call(e);!(i=(t=o.next()).done)&&(n.push(t.value),1!==n.length);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(c)throw r}}return n}}(c)||m(c,1)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],a=(0,e.useCompile)(),u=(0,t.useGetDataSourceCollectionManager)(l),[{label:o("ID"),value:"filterByTk"}].concat(g(r.action!==i?[{label:o("Values submitted"),value:"values",children:(0,t.getCollectionFieldOptions)(d(b({},n),{appends:null,depth:3,collection:r.collection,compile:a,collectionManager:u}))}]:[])))}];return g(f).concat(g(y))}var O=function(o){var c;if("function"!=typeof o&&null!==o)throw TypeError("Super expression must either be null or a function");function l(){var o,c,u;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return c=l,u=arguments,c=f(c),s(o=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(c,u||[],f(this).constructor):c.apply(this,u)),"sync",!0),s(o,"title",'{{t("Pre-action event", { ns: "'.concat(r,'" })}}')),s(o,"description",'{{t(\'Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the "End process" node.\', { ns: "'.concat(r,'" })}}')),s(o,"presetFieldset",{collection:{type:"string",title:'{{t("Collection")}}',required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"}}),s(o,"fieldset",{collection:s({type:"string",title:'{{t("Collection")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},"x-reactions",[{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]),global:{type:"boolean",title:'{{t("Trigger mode", { ns: "'.concat(r,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Local mode, triggered before executing the actions bound to this workflow", { ns: "'.concat(r,'" })}}'),value:!1},{label:'{{t("Global mode, triggered before executing the following actions", { ns: "'.concat(r,'" })}}'),value:!0}]},default:!1},actions:{type:"number",title:'{{t("Select actions", { ns: "'.concat(r,'" })}}'),"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:v},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]}}),s(o,"triggerFieldset",{action:{type:"string",title:'{{t("Action type")}}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!1},enum:v,default:"create",required:!0},target:{type:"string",title:'{{t("Record to submit", { ns: "'.concat(r,'" })}}'),description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(r,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]},render:function(t){return a().createElement(e.RemoteSelect,b({fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1},t))}},default:null,required:!0},roleName:{type:"string",title:'{{t("Role of user acted", { ns: "'.concat(r,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]},render:function(t){return a().createElement(e.RemoteSelect,b({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),s(o,"scope",{useCollectionDataSource:e.useCollectionDataSource,useValueObject:function(){return(0,n.useForm)().values.action!==i}}),s(o,"components",{FieldsSelect:t.FieldsSelect,RadioWithTooltip:t.RadioWithTooltip,CheckboxGroupWithTooltip:t.CheckboxGroupWithTooltip,WorkflowVariableWrapper:t.WorkflowVariableWrapper,TriggerCollectionRecordSelect:t.TriggerCollectionRecordSelect}),s(o,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update","destroy"].includes(t.buttonAction)}),s(o,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),s(o,"useVariables",w),o}return l.prototype=Object.create(o&&o.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),o&&y(l,o),c=[{key:"validate",value:function(e){return e.collection}},{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "workflow" })}}',Component:t.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.params.values"}:null}},{key:"getCreateModelMenuItem",value:function(e){return{key:"triggerData",label:'{{t("Trigger data", { ns: "workflow" })}}',useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:e.config.collection,dataPath:"$context.params.values"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "workflow" })}}'}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(l.prototype,c),l}(t.Trigger);function j(e,t,r,o,n,i,c){try{var l=e[i](c),a=l.value}catch(e){r(e);return}l.done?t(a):Promise.resolve(a).then(o,n)}function S(e,t,r){return(S=_()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&P(n,r.prototype),n}).apply(null,arguments)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return S(e,arguments,x(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),P(r,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}var C=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=x(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(e,t||[],x(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&P(r,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,o,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(c,"next",{value:a(0)}),l(c,"throw",{value:a(1)}),l(c,"return",{value:a(2)}),"function"==typeof Symbol&&l(c,Symbol.iterator,{value:function(){return this}}),c;function a(l){return function(a){var u=[l,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(r=1,o&&(n=2&u[0]?o.return:u[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,u[1])).done)return n;switch(o=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){i.label=u[1];break}if(6===u[0]&&i.label<n[1]){i.label=n[1],n=u;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(u);break}n[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("request-interception",O),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){j(i,o,n,c,l,"next",e)}function l(e){j(i,o,n,c,l,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(r.prototype,t),r}(k(e.Plugin)),T=C}(),p}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-request-interceptor",["@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/client","@formily/react","@nocobase/plugin-workflow/client","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-request-interceptor"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-request-interceptor"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/client"],e["@formily/react"],e["@nocobase/plugin-workflow/client"],e["@nocobase/flow-engine"])}(self,function(e,t,r,o,n,i,c,l){return function(){"use strict";var a,u,s,f={488:function(e,t,r){r.d(t,{CU:function(){return n},kj:function(){return i}});var o=r(694),n="workflow-request-interceptor";function i(){var e=(0,o.useFlowEngine)();return function(t,r){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({ns:[n,"@nocobase/plugin-workflow-request-interceptor","client"],nsMode:"fallback"},r))}}},977:function(e,t,r){r.d(t,{r:function(){return o}});var o={CREATE:"create",UPDATE:"update",UPSERT:"updateOrCreate",DESTROY:"destroy"}},230:function(e){e.exports=i},342:function(e){e.exports=n},485:function(t){t.exports=e},694:function(e){e.exports=l},990:function(e){e.exports=c},197:function(e){e.exports=o},59:function(e){e.exports=r},155:function(e){e.exports=t}},p={};function b(e){var t=p[e];if(void 0!==t)return t.exports;var r=p[e]={exports:{}};return f[e](r,r.exports,b),r.exports}b.m=f,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var r in t)b.o(t,r)&&!b.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,r){return b.f[r](e,t),t},[]))},b.u=function(e){return""+e+"."+({214:"0c74ad84986640fb",600:"aa8df1195194813a"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},b.l=function(e,t,r,o){if(d[e])return void d[e].push(t);if(void 0!==r)for(var n,i,c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var a=c[l];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-workflow-request-interceptor:"+r){n=a;break}}n||(i=!0,(n=document.createElement("script")).timeout=120,b.nc&&n.setAttribute("nonce",b.nc),n.setAttribute("data-rspack","@nocobase/plugin-workflow-request-interceptor:"+r),n.src=e),d[e]=[t];var u=function(t,r){n.onerror=n.onload=null,clearTimeout(s);var o=d[e];if(delete d[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(function(e){return e(r)}),t)return t(r)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),i&&document.head.appendChild(n)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(y=b.g.location+"");var d,y,g=b.g.document;if(!y&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(y=g.currentScript.src),!y)){var m=g.getElementsByTagName("script");if(m.length)for(var v=m.length-1;v>-1&&(!y||!/^http(s?):/.test(y));)y=m[v--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");b.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a={889:0},b.f.j=function(e,t){var r=b.o(a,e)?a[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var o=new Promise(function(t,o){r=a[e]=[t,o]});t.push(r[2]=o);var n=b.p+b.u(e),i=Error();b.l(n,function(t){if(b.o(a,e)&&(0!==(r=a[e])&&(a[e]=void 0),r)){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+o+": "+n+")",i.name="ChunkLoadError",i.type=o,i.request=n,r[1](i)}},"chunk-"+e,e)}},u=function(e,t){var r,o,n=t[0],i=t[1],c=t[2],l=0;if(n.some(function(e){return 0!==a[e]})){for(r in i)b.o(i,r)&&(b.m[r]=i[r]);c&&c(b)}for(e&&e(t);l<n.length;l++)o=n[l],b.o(a,o)&&a[o]&&a[o][0](),a[o]=0},(s=self.webpackChunk_nocobase_plugin_workflow_request_interceptor=self.webpackChunk_nocobase_plugin_workflow_request_interceptor||[]).forEach(u.bind(null,0)),s.push=u.bind(null,s.push.bind(s));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var r=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client/")>=0&&(e=r.replace(/\/[^\/]+$/,"/"))}if(!e){var o=window.__webpack_public_path__||"";o&&("/"!==o.charAt(o.length-1)&&(o+="/"),e=o+"static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",i="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",l=c.indexOf(i);e=l>=0?c.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client/"}b.p=e}(),!function(){b.r(h),b.d(h,{PluginWorkflowRequestInterceptorClient:function(){return D},default:function(){return I}});var e=b(342),t=b(230),r=b(990),o=b(155),n=b.n(o),i=b(977),c=b(694),l=b(197),a=b(488);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){s(e,t,r[t])})}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function v(e,t){var r,o,n,s,f,b,y,m=(0,c.useFlowEngine)(),v=(0,a.kj)(),h=(0,l.getCollectionManagerAdapter)(m.context.dataSourceManager);return((function(e){if(Array.isArray(e))return u(e)})(r=(0,l.getCollectionFieldOptions)(d(p({appends:["user"]},t),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:v("User acted")}},{name:"roleName",uiSchema:{title:v("Role of user acted")}}],compile:v,collectionManager:h})))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||g(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{label:v("Parameters"),value:"params",children:(o=(0,c.useFlowEngine)(),n=(0,a.kj)(),f=(function(e){if(Array.isArray(e))return e}(s=(0,l.parseCollectionName)(e.collection))||function(e){var t,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n=[],i=!0,c=!1;try{for(o=o.call(e);!(i=(t=o.next()).done)&&(n.push(t.value),1!==n.length);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(c)throw r}}return n}}(s)||g(s,1)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],b=(0,l.getCollectionManagerAdapter)(o.context.dataSourceManager,f),y=[{label:n("ID"),value:"filterByTk"}],e.collection&&e.action!==i.r.DESTROY&&y.push({label:n("Values submitted"),value:"values",children:(0,l.getCollectionFieldOptions)(d(p({},t),{appends:null,depth:3,collection:e.collection,compile:n,collectionManager:b}))}),y)}])}var w=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,o;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,o=arguments,t=f(t),s(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,m()?Reflect.construct(t,o||[],f(this).constructor):t.apply(this,o)),"sync",!0),s(e,"title",'{{t("Pre-action event", { ns: "'.concat(a.CU,'" })}}')),s(e,"description",'{{t(\'Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the "End process" node.\', { ns: "'.concat(a.CU,'" })}}')),s(e,"PresetFieldsetLoader",function(){return b.e("214").then(b.bind(b,685)).then(function(e){return{default:e.RequestInterceptionTriggerPresetConfig}})}),s(e,"FieldsetLoader",function(){return b.e("214").then(b.bind(b,685))}),s(e,"TriggerFieldsetLoader",function(){return b.e("600").then(b.bind(b,51))}),s(e,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update","destroy"].includes(t.buttonAction||"")}),s(e,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),s(e,"useVariables",v),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&y(r,e),t=[{key:"validate",value:function(e){return!!e.collection}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return(null==t?void 0:t.collection)?{key:"triggerData",label:'{{t("Trigger data", { ns: "workflow" })}}',useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.params.values"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "workflow" })}}'}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}},{key:"useTempAssociationSource",value:function(e,t){return(null==e?void 0:e.collection)&&(null==t?void 0:t.id)?{collection:e.collection,nodeId:t.id,nodeKey:"workflow",nodeType:"workflow"}:null}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(r.prototype,t),r}(l.Trigger),O="@nocobase/plugin-workflow-request-interceptor";function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){k(e,t,r[t])})}return e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}var P=[{label:"{{t('Create record', { ns: '".concat(O,"' })}}"),value:i.r.CREATE},{label:"{{t('Update record', { ns: '".concat(O,"' })}}"),value:i.r.UPDATE},{label:"{{t('Delete record', { ns: '".concat(O,"' })}}"),value:i.r.DESTROY}],T=function(o){var c;if("function"!=typeof o&&null!==o)throw TypeError("Super expression must either be null or a function");function l(){var o,c,a;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return c=l,a=arguments,c=j(c),k(o=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(c,a||[],j(this).constructor):c.apply(this,a)),"presetFieldset",{collection:{type:"string",title:'{{t("Collection")}}',required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"}}),k(o,"fieldset",{collection:k({type:"string",title:'{{t("Collection")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},"x-reactions",[{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]),global:{type:"boolean",title:'{{t("Trigger mode", { ns: "'.concat(O,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Local mode, triggered before executing the actions bound to this workflow", { ns: "'.concat(O,'" })}}'),value:!1},{label:'{{t("Global mode, triggered before executing the following actions", { ns: "'.concat(O,'" })}}'),value:!0}]},default:!1},actions:{type:"number",title:'{{t("Select actions", { ns: "'.concat(O,'" })}}'),"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:P},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]}}),k(o,"triggerFieldset",{action:{type:"string",title:'{{t("Action type")}}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!1},enum:P,default:"create",required:!0},target:{type:"string",title:'{{t("Record to submit", { ns: "'.concat(O,'" })}}'),description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(O,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]},render:function(t){return n().createElement(e.RemoteSelect,S({fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1},t))}},default:null,required:!0},roleName:{type:"string",title:'{{t("Role of user acted", { ns: "'.concat(O,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]},render:function(t){return n().createElement(e.RemoteSelect,S({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),k(o,"scope",{useCollectionDataSource:e.useCollectionDataSource,useValueObject:function(){return(0,t.useForm)().values.action!==i.r.DESTROY}}),k(o,"components",{FieldsSelect:r.FieldsSelect,RadioWithTooltip:r.RadioWithTooltip,CheckboxGroupWithTooltip:r.CheckboxGroupWithTooltip,WorkflowVariableWrapper:r.WorkflowVariableWrapper,TriggerCollectionRecordSelect:r.TriggerCollectionRecordSelect}),o}return l.prototype=Object.create(o&&o.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),o&&x(l,o),c=[{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "workflow" })}}',Component:r.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.params.values"}:null}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(l.prototype,c),l}(w);function C(e,t,r,o,n,i,c){try{var l=e[i](c),a=l.value}catch(e){r(e);return}l.done?t(a):Promise.resolve(a).then(o,n)}function E(e,t,r){return(E=F()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&R(n,r.prototype),n}).apply(null,arguments)}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t="function"==typeof Map?new Map:void 0;return(A=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return E(e,arguments,q(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),R(r,e)})(e)}function F(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(F=function(){return!!e})()}var D=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=q(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,F()?Reflect.construct(e,t||[],q(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&R(r,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,o,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(c,"next",{value:a(0)}),l(c,"throw",{value:a(1)}),l(c,"return",{value:a(2)}),"function"==typeof Symbol&&l(c,Symbol.iterator,{value:function(){return this}}),c;function a(l){return function(a){var u=[l,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(r=1,o&&(n=2&u[0]?o.return:u[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,u[1])).done)return n;switch(o=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){i.label=u[1];break}if(6===u[0]&&i.label<n[1]){i.label=n[1],n=u;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(u);break}n[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("request-interception",T),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){C(i,o,n,c,l,"next",e)}function l(e){C(i,o,n,c,l,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(r.prototype,t),r}(A(e.Plugin)),I=D}(),h}()});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_workflow_request_interceptor_client_v2=self.webpackChunk_nocobase_plugin_workflow_request_interceptor_client_v2||[]).push([["214"],{685:function(e,l,t){t.r(l),t.d(l,{RequestInterceptionTriggerPresetConfig:function(){return u},default:function(){return m}});var r=t(197),n=t(59),o=t(155),c=t.n(o),a=t(358),i=t(488);function u(){var e=(0,i.kj)();return c().createElement(n.Form.Item,{name:["config","collection"],label:e("Collection"),rules:[{required:!0}]},c().createElement(r.CollectionCascader,null))}function m(){var e=(0,i.kj)(),l=n.Form.useWatch(["config","collection"]),t=n.Form.useWatch(["config","global"]),u=(0,o.useMemo)(function(){return[{label:e("Create record"),value:a.r.CREATE},{label:e("Update record"),value:a.r.UPDATE},{label:e("Delete record"),value:a.r.DESTROY}]},[e]);return c().createElement("fieldset",null,c().createElement(n.Form.Item,{name:["config","collection"],label:e("Collection"),rules:[{required:!0}]},c().createElement(r.CollectionCascader,{disabled:!0})),l?c().createElement(n.Form.Item,{name:["config","global"],label:e("Trigger mode"),initialValue:!1},c().createElement(n.Radio.Group,null,c().createElement(n.Space,{direction:"vertical"},c().createElement(n.Radio,{value:!1},e("Local mode, triggered before executing the actions bound to this workflow")),c().createElement(n.Radio,{value:!0},e("Global mode, triggered before executing the following actions"))))):null,l&&t?c().createElement(n.Form.Item,{name:["config","actions"],label:e("Select actions"),rules:[{required:!0}]},c().createElement(n.Checkbox.Group,null,c().createElement(n.Space,{direction:"vertical"},u.map(function(e){return c().createElement(n.Checkbox,{key:e.value,value:e.value},e.label)})))):null)}}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_workflow_request_interceptor_client_v2=self.webpackChunk_nocobase_plugin_workflow_request_interceptor_client_v2||[]).push([["600"],{51:function(e,t,r){r.r(t),r.d(t,{default:function(){return h}});var n=r(485),o=r(694),l=r(197),a=r(59),u=r(155),i=r.n(u),c=r(358),s=r(488);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t,r,n,o,l,a){try{var u=e[l](a),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){p(l,n,o,a,u,"next",e)}function u(e){p(l,n,o,a,u,"throw",e)}a(void 0)})}}function v(e,t){var r,n,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:i(0)}),u(a,"throw",{value:i(1)}),u(a,"return",{value:i(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function i(u){return function(i){var c=[u,i];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function b(e){var t,r=null!=(t=null==e?void 0:e.paths)?t:[];return r.length?"{{".concat(r.join("."),"}}"):""}function d(e){if("string"==typeof e){var t=e.trim().match(/^\{\{\s*(.+?)\s*\}\}$/);return t?t[1].split("."):void 0}}function y(e){var t,r=e.value,c=e.onChange,s=e.request,p=e.mapOptions,m=e.cacheKey,v=e.variableOptions,y=(0,l.useWorkflowVariableOptions)(v),h=function(e){if(Array.isArray(e))return e}(t=(0,u.useState)())||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],l=!0,a=!1;try{for(n=n.call(e);!(l=(t=n.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==n.return||n.return()}finally{if(a)throw r}}return o}}(t)||function(e){if(e){if("string"==typeof e)return f(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return f(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=h[0],w=h[1],E="string"==typeof r&&/^\{\{\s*[^{}]+?\s*\}\}$/.test(r),k=E?void 0:r,S=(0,u.useMemo)(function(){return y},[y]);return i().createElement(a.Space.Compact,{block:!0},E?i().createElement(o.VariableTag,{value:r,metaTree:S,metaTreeNode:g,onClear:function(){return null==c?void 0:c(null)}}):i().createElement(n.RemoteSelect,{value:k,onChange:function(e){return null==c?void 0:c(e)},request:s,mapOptions:p,cacheKey:m}),i().createElement(o.FlowContextSelector,{metaTree:S,value:E?r:void 0,parseValueToPath:d,formatPathToValue:b,onChange:function(e,t){w(t),null==c||c(e)}}))}function h(){var e=(0,s.kj)(),t=(0,o.useFlowEngine)(),r=(0,u.useMemo)(function(){return[{label:e("Create record"),value:c.r.CREATE},{label:e("Update record"),value:c.r.UPDATE},{label:e("Delete record"),value:c.r.DESTROY}]},[e]),n=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]}},[]),f=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]}},[]);return i().createElement(i().Fragment,null,i().createElement(a.Form.Item,{name:"action",label:e("Action type"),initialValue:c.r.CREATE,rules:[{required:!0}]},i().createElement(a.Select,{allowClear:!1,options:r})),i().createElement(a.Form.Item,{name:"target",label:e("Record to submit"),extra:e("Choose a record or primary key of a record in the collection to trigger.",{ns:"workflow"}),initialValue:null,rules:[{required:!0}]},i().createElement(l.TriggerCollectionRecordSelect,null)),i().createElement(a.Form.Item,{name:"userId",label:e("User acted"),initialValue:null,rules:[{required:!0}]},i().createElement(y,{request:function(){return m(function(){var e,r,n;return v(this,function(o){switch(o.label){case 0:return[4,t.context.api.resource("users").list({pageSize:50})];case 1:return[2,null!=(e=null==(n=o.sent())||null==(r=n.data)?void 0:r.data)?e:[]]}})})()},mapOptions:function(e){var t;return{label:null!=(t=e.nickname)?t:e.id,value:e.id}},cacheKey:"workflow-request-interceptor:users",variableOptions:n})),i().createElement(a.Form.Item,{name:"roleName",label:e("Role of user acted"),initialValue:null},i().createElement(y,{request:function(){return m(function(){var e,r,n;return v(this,function(o){switch(o.label){case 0:return[4,t.context.api.resource("roles").list({pageSize:50})];case 1:return[2,null!=(e=null==(n=o.sent())||null==(r=n.data)?void 0:r.data)?e:[]]}})})()},mapOptions:function(t){return{label:t.title?e(t.title):t.name,value:t.name}},cacheKey:"workflow-request-interceptor:roles",variableOptions:f})))}}}]);
@@ -0,0 +1,45 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ /**
10
+ * This file is part of the NocoBase (R) project.
11
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
12
+ * Authors: NocoBase Team.
13
+ *
14
+ * This program is offered under a commercial license.
15
+ * For more information, see <https://www.nocobase.com/agreement>
16
+ */
17
+ import { type SubModelItem } from '@nocobase/flow-engine';
18
+ import { Trigger, type TriggerLoaderOf, type UseVariableOptions, type VariableOption } from '@nocobase/plugin-workflow/client-v2';
19
+ declare function useVariables(config: Record<string, unknown>, options?: UseVariableOptions): VariableOption[];
20
+ export default class RequestInterceptionTrigger extends Trigger {
21
+ sync: boolean;
22
+ title: string;
23
+ description: string;
24
+ PresetFieldsetLoader: TriggerLoaderOf;
25
+ FieldsetLoader: TriggerLoaderOf;
26
+ TriggerFieldsetLoader: TriggerLoaderOf;
27
+ validate(config: Record<string, unknown>): boolean;
28
+ isActionTriggerable_deprecated: (config: Record<string, unknown>, context: {
29
+ buttonAction?: string;
30
+ }) => boolean;
31
+ actionTriggerableScope: (config: Record<string, unknown>, scope: string) => boolean;
32
+ useVariables: typeof useVariables;
33
+ getCreateModelMenuItem({ config }: {
34
+ config: Record<string, unknown>;
35
+ }): SubModelItem | null;
36
+ useTempAssociationSource(config: Record<string, unknown>, workflow?: {
37
+ id?: string | number;
38
+ }): {
39
+ collection: string;
40
+ nodeId: string | number;
41
+ nodeKey: string;
42
+ nodeType: "workflow";
43
+ };
44
+ }
45
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export declare function RequestInterceptionTriggerPresetConfig(): React.JSX.Element;
11
+ export default function RequestInterceptionTriggerConfig(): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export default function TriggerRequestInterceptionConfig(): React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ /**
10
+ * This file is part of the NocoBase (R) project.
11
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
12
+ * Authors: NocoBase Team.
13
+ *
14
+ * This program is offered under a commercial license.
15
+ * For more information, see <https://www.nocobase.com/agreement>
16
+ */
17
+ export { default } from './plugin';
18
+ export { default as RequestInterceptionTrigger } from './RequestInterceptionTrigger';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-request-interceptor/client-v2",["@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-request-interceptor/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-request-interceptor/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/flow-engine"])}(self,function(e,t,r,n,o){return function(){"use strict";var i,c,u,a={488:function(e,t,r){r.d(t,{CU:function(){return o},kj:function(){return i}});var n=r(694),o="workflow-request-interceptor";function i(){var e=(0,n.useFlowEngine)();return function(t,r){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({ns:[o,"@nocobase/plugin-workflow-request-interceptor","client"],nsMode:"fallback"},r))}}},358:function(e,t,r){r.d(t,{r:function(){return n}});var n={CREATE:"create",UPDATE:"update",UPSERT:"updateOrCreate",DESTROY:"destroy"}},485:function(t){t.exports=e},694:function(e){e.exports=o},197:function(e){e.exports=n},59:function(e){e.exports=r},155:function(e){e.exports=t}},l={};function f(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return a[e](r,r.exports,f),r.exports}f.m=a,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,r){return f.f[r](e,t),t},[]))},f.u=function(e){return""+e+"."+({214:"5e60c2320d4a3737",600:"be71ccb0e0f1e3db"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},f.l=function(e,t,r,n){if(s[e])return void s[e].push(t);if(void 0!==r)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-workflow-request-interceptor/client-v2:"+r){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-workflow-request-interceptor/client-v2:"+r),o.src=e),s[e]=[t];var l=function(t,r){o.onerror=o.onload=null,clearTimeout(p);var n=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(p=f.g.location+"");var s,p,b=f.g.document;if(!p&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(p=b.currentScript.src),!p)){var d=b.getElementsByTagName("script");if(d.length)for(var y=d.length-1;y>-1&&(!p||!/^http(s?):/.test(p));)p=d[y--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");f.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},f.f.j=function(e,t){var r=f.o(i,e)?i[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=i[e]=[t,n]});t.push(r[2]=n);var o=f.p+f.u(e),c=Error();f.l(o,function(t){if(f.o(i,e)&&(0!==(r=i[e])&&(i[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",c.name="ChunkLoadError",c.type=n,c.request=o,r[1](c)}},"chunk-"+e,e)}},c=function(e,t){var r,n,o=t[0],c=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==i[e]})){for(r in c)f.o(c,r)&&(f.m[r]=c[r]);u&&u(f)}for(e&&e(t);a<o.length;a++)n=o[a],f.o(i,n)&&i[n]&&i[n][0](),i[n]=0},(u=self.webpackChunk_nocobase_plugin_workflow_request_interceptor_client_v2=self.webpackChunk_nocobase_plugin_workflow_request_interceptor_client_v2||[]).forEach(c.bind(null,0)),u.push=c.bind(null,u.push.bind(u));var g={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var r=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client-v2/")>=0&&(e=r.replace(/\/[^\/]+$/,"/"))}if(!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",u=c.indexOf(i);e=u>=0?c.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-request-interceptor/dist/client-v2/"}f.p=e}(),!function(){f.r(g),f.d(g,{RequestInterceptionTrigger:function(){return y},default:function(){return _}});var e=f(485),t=f(694),r=f(197),n=f(358),o=f(488);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){c(e,t,r[t])})}return e}function l(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}}function b(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!e})()}function d(e,c){var u,f,s,b,d,y,g,v=(0,t.useFlowEngine)(),h=(0,o.kj)(),w=(0,r.getCollectionManagerAdapter)(v.context.dataSourceManager);return((function(e){if(Array.isArray(e))return i(e)})(u=(0,r.getCollectionFieldOptions)(l(a({appends:["user"]},c),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:h("User acted")}},{name:"roleName",uiSchema:{title:h("Role of user acted")}}],compile:h,collectionManager:w})))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(u)||p(u)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{label:h("Parameters"),value:"params",children:(f=(0,t.useFlowEngine)(),s=(0,o.kj)(),d=(function(e){if(Array.isArray(e))return e}(b=(0,r.parseCollectionName)(e.collection))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),1!==o.length);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw r}}return o}}(b)||p(b,1)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],y=(0,r.getCollectionManagerAdapter)(f.context.dataSourceManager,d),g=[{label:s("ID"),value:"filterByTk"}],e.collection&&e.action!==n.r.DESTROY&&g.push({label:s("Values submitted"),value:"values",children:(0,r.getCollectionFieldOptions)(l(a({},c),{appends:null,depth:3,collection:e.collection,compile:s,collectionManager:y}))}),g)}])}var y=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=u(t),c(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,b()?Reflect.construct(t,n||[],u(this).constructor):t.apply(this,n)),"sync",!0),c(e,"title",'{{t("Pre-action event", { ns: "'.concat(o.CU,'" })}}')),c(e,"description",'{{t(\'Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the "End process" node.\', { ns: "'.concat(o.CU,'" })}}')),c(e,"PresetFieldsetLoader",function(){return f.e("214").then(f.bind(f,685)).then(function(e){return{default:e.RequestInterceptionTriggerPresetConfig}})}),c(e,"FieldsetLoader",function(){return f.e("214").then(f.bind(f,685))}),c(e,"TriggerFieldsetLoader",function(){return f.e("600").then(f.bind(f,51))}),c(e,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update","destroy"].includes(t.buttonAction||"")}),c(e,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),c(e,"useVariables",d),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&s(r,e),t=[{key:"validate",value:function(e){return!!e.collection}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return(null==t?void 0:t.collection)?{key:"triggerData",label:'{{t("Trigger data", { ns: "workflow" })}}',useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.params.values"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "workflow" })}}'}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}},{key:"useTempAssociationSource",value:function(e,t){return(null==e?void 0:e.collection)&&(null==t?void 0:t.id)?{collection:e.collection,nodeId:t.id,nodeKey:"workflow",nodeType:"workflow"}:null}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(r.Trigger);function v(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}function h(e,t,r){return(h=j()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&m(o,r.prototype),o}).apply(null,arguments)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t="function"==typeof Map?new Map:void 0;return(O=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return h(e,arguments,w(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)})(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}var _=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=w(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(e,t||[],w(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&m(r,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("request-interception",y),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function c(e){v(i,n,o,c,u,"next",e)}function u(e){v(i,n,o,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(O(e.Plugin))}(),g}()});
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const NAMESPACE = "workflow-request-interceptor";
10
+ export declare function useT(): (key: string, options?: Record<string, unknown>) => string;
11
+ export declare function tExpr(key: string, options?: Record<string, unknown>): string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ /**
10
+ * This file is part of the NocoBase (R) project.
11
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
12
+ * Authors: NocoBase Team.
13
+ *
14
+ * This program is offered under a commercial license.
15
+ * For more information, see <https://www.nocobase.com/agreement>
16
+ */
17
+ import { Application, Plugin } from '@nocobase/client-v2';
18
+ export declare class PluginWorkflowRequestInterceptorClientV2 extends Plugin<unknown, Application> {
19
+ load(): Promise<void>;
20
+ }
21
+ export default PluginWorkflowRequestInterceptorClientV2;
@@ -8,13 +8,15 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-beta.9",
12
- "@nocobase/plugin-workflow": "2.2.0-beta.9",
13
11
  "@formily/react": "2.3.7",
12
+ "@nocobase/client": "2.2.0",
13
+ "@nocobase/plugin-workflow": "2.2.0",
14
14
  "react": "18.2.0",
15
- "@nocobase/flow-engine": "2.2.0-beta.9",
16
- "@nocobase/server": "2.2.0-beta.9",
15
+ "@nocobase/flow-engine": "2.2.0",
16
+ "antd": "5.24.2",
17
+ "@nocobase/client-v2": "2.2.0",
18
+ "@nocobase/server": "2.2.0",
17
19
  "lodash": "4.18.1",
18
- "@nocobase/plugin-error-handler": "2.2.0-beta.9",
19
- "@nocobase/data-source-manager": "2.2.0-beta.9"
20
+ "@nocobase/plugin-error-handler": "2.2.0",
21
+ "@nocobase/data-source-manager": "2.2.0"
20
22
  };
@@ -1 +1 @@
1
- {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-07-06T02:57:01.699Z"}
1
+ {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-08-22T01:45:07.677Z"}
@@ -201,7 +201,10 @@ class RequestInterceptionTrigger extends import_plugin_workflow.Trigger {
201
201
  };
202
202
  constructor(workflow) {
203
203
  super(workflow);
204
- workflow.app.dataSourceManager.use(this.middleware);
204
+ workflow.app.dataSourceManager.use(this.middleware, {
205
+ after: "parseVariables",
206
+ before: "default"
207
+ });
205
208
  workflow.app.pm.get(import_plugin_error_handler.default).errorHandler.register(
206
209
  (err) => err instanceof RequestInterceptionError || err.name === "RequestInterceptionError",
207
210
  async (err, ctx, next) => {
package/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-workflow-request-interceptor",
3
- "version": "2.2.0-beta.9",
3
+ "version": "2.2.0",
4
4
  "displayName": "Workflow: Pre-action event",
5
5
  "displayName.zh-CN": "工作流:操作前事件",
6
6
  "description": "Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the \"End process\" node.",
7
7
  "description.zh-CN": "通过操作按钮或 API 发起请求并在执行前触发,比如新增、更新、删除数据之前。适用于在操作前进行数据验证、逻辑判断,并可通过“结束节点”来拦截请求。",
8
8
  "main": "./dist/server/index.js",
9
9
  "devDependencies": {
10
- "joi": "^17.13.3"
10
+ "antd": "5.x",
11
+ "joi": "^17.13.3",
12
+ "react": "18.x"
11
13
  },
12
14
  "homepage": "https://docs.nocobase.com/handbook/workflow-request-interceptor",
13
15
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow-request-interceptor",
14
16
  "peerDependencies": {
15
17
  "@nocobase/client": "2.x",
18
+ "@nocobase/client-v2": "2.x",
16
19
  "@nocobase/plugin-error-handler": "2.x",
17
20
  "@nocobase/plugin-users": "2.x",
18
21
  "@nocobase/plugin-workflow": ">= 0.19.0-alpha.3",
@@ -30,6 +33,6 @@
30
33
  "keywords": [
31
34
  "Workflow"
32
35
  ],
33
- "gitHead": "60e3d7abbaa0c7cead76f71a4f3d5eedb6b8acdb",
36
+ "gitHead": "d5052cae37177054c236f1bf7bba3aed6ef029d0",
34
37
  "license": "Apache-2.0"
35
38
  }