@nocobase/plugin-workflow 2.2.0-alpha.6 → 2.2.0-alpha.7

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.
Files changed (44) hide show
  1. package/dist/client/{509.0504f44820a39d45.js → 509.e8d543f308a5823c.js} +1 -1
  2. package/dist/client/54.d81b710f7b4c1cd5.js +10 -0
  3. package/dist/client/635.ff6085589e23d39b.js +10 -0
  4. package/dist/client/728.711fd4f1ed7d4e6a.js +10 -0
  5. package/dist/client/782.e058403fcb6b1750.js +10 -0
  6. package/dist/client/index.js +1 -1
  7. package/dist/client-v2/387.fd0a379e808b069f.js +10 -0
  8. package/dist/client-v2/54.d3daf06e53092726.js +10 -0
  9. package/dist/client-v2/635.20680bb5710698d0.js +10 -0
  10. package/dist/client-v2/677.a8c841cd3c3a6f7d.js +10 -0
  11. package/dist/client-v2/728.4e8322ff8fce87b9.js +10 -0
  12. package/dist/client-v2/canvas/Instruction.d.ts +5 -5
  13. package/dist/client-v2/canvas/Node.d.ts +6 -4
  14. package/dist/client-v2/components/TestRunButton.d.ts +1 -1
  15. package/dist/client-v2/components/collection/AssignedFieldsEditor.d.ts +2 -1
  16. package/dist/client-v2/constants.d.ts +5 -0
  17. package/dist/client-v2/index.d.ts +3 -0
  18. package/dist/client-v2/index.js +1 -1
  19. package/dist/client-v2/models/WorkflowTasksTopbarActionModel.d.ts +18 -0
  20. package/dist/client-v2/models/index.d.ts +1 -0
  21. package/dist/client-v2/pages/WorkflowTasksPage.d.ts +10 -0
  22. package/dist/client-v2/plugin.d.ts +52 -0
  23. package/dist/client-v2/taskCenter.d.ts +105 -0
  24. package/dist/client-v2/triggers/index.d.ts +3 -1
  25. package/dist/common/collections/workflows.d.ts +18 -0
  26. package/dist/common/collections/workflows.js +5 -0
  27. package/dist/externalVersion.js +13 -13
  28. package/dist/node_modules/cron-parser/package.json +1 -1
  29. package/dist/node_modules/joi/package.json +1 -1
  30. package/dist/node_modules/lru-cache/package.json +1 -1
  31. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  32. package/dist/server/Dispatcher.js +2 -1
  33. package/dist/server/ExecutionTimeoutManager.js +2 -1
  34. package/dist/server/actions/workflows.d.ts +1 -0
  35. package/dist/server/actions/workflows.js +5 -0
  36. package/dist/server/types/Workflow.d.ts +1 -0
  37. package/package.json +2 -2
  38. package/dist/client/54.d3d5d9f2f2115201.js +0 -10
  39. package/dist/client/635.42814cddec653cdd.js +0 -10
  40. package/dist/client/782.e0f0d84dd5cfac2a.js +0 -10
  41. package/dist/client-v2/387.eae325172ba209e5.js +0 -10
  42. package/dist/client-v2/54.287764bc467d65da.js +0 -10
  43. package/dist/client-v2/635.d14f99a9520d336b.js +0 -10
  44. package/dist/client-v2/677.d3294a45cd038c72.js +0 -10
@@ -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
+ import { TopbarActionModel } from '@nocobase/client-v2';
10
+ import React from 'react';
11
+ export declare class WorkflowTasksTopbarActionModel extends TopbarActionModel {
12
+ sort: number;
13
+ actionId: string;
14
+ testId: string;
15
+ tooltip: string;
16
+ render(): React.JSX.Element;
17
+ }
18
+ export default WorkflowTasksTopbarActionModel;
@@ -10,3 +10,4 @@ export { NodeDetailsModel } from './NodeDetailsModel';
10
10
  export { NodeDetailsGridModel } from './NodeDetailsGridModel';
11
11
  export { NodeValueModel } from './NodeValueModel';
12
12
  export { TaskCardCommonItemModel } from './TaskCardCommonItemModel';
13
+ export { WorkflowTasksTopbarActionModel } from './WorkflowTasksTopbarActionModel';
@@ -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 WorkflowTasksPage(): React.JSX.Element;
@@ -7,6 +7,8 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Plugin } from '@nocobase/client-v2';
10
+ import type { ReactNode } from 'react';
11
+ import type { TaskTypeOptions } from './taskCenter';
10
12
  import type { Instruction } from './canvas/Instruction';
11
13
  import type { Trigger } from './triggers';
12
14
  import './models/triggerWorkflows';
@@ -14,6 +16,43 @@ export type InstructionGroup = {
14
16
  key: string;
15
17
  label: string;
16
18
  };
19
+ /**
20
+ * UI location where workflow notices are requested.
21
+ *
22
+ * This is a rendering context hint for non-blocking UI notices; it is not a validation surface and providers should
23
+ * not use it to block workflow execution or saving.
24
+ */
25
+ export type WorkflowNoticeSurface = 'workflow-list-row' | 'trigger-node-card';
26
+ export type WorkflowNotice = {
27
+ /** Extra explanatory content. List rows render this as tooltip content; compact card surfaces may ignore it. */
28
+ description?: ReactNode;
29
+ /** Stable identity for React rendering and provider-level deduplication. */
30
+ key: string;
31
+ /** Short user-facing notice title. */
32
+ message: ReactNode;
33
+ /** Visual severity. Providers should keep notices informational and side-effect free. */
34
+ type?: 'error' | 'info' | 'success' | 'warning';
35
+ };
36
+ export type WorkflowNoticeProviderContext = {
37
+ nodes?: Array<Record<string, unknown>>;
38
+ /** The UI surface requesting notices so providers can return copy and density suitable for that location. */
39
+ surface: WorkflowNoticeSurface;
40
+ workflow?: Record<string, unknown> | null;
41
+ };
42
+ export type WorkflowNoticeResult = WorkflowNotice | WorkflowNotice[] | null | undefined;
43
+ export type WorkflowListNoticeProviderContext = {
44
+ api?: unknown;
45
+ surface: 'workflow-list-row';
46
+ workflows: Array<Record<string, unknown>>;
47
+ };
48
+ export type WorkflowListNoticeMap = Record<string, WorkflowNotice | WorkflowNotice[] | null | undefined>;
49
+ export type WorkflowNoticeProviderFunction = (context: WorkflowNoticeProviderContext) => WorkflowNoticeResult;
50
+ export type WorkflowNoticeProviderObject = {
51
+ getNotices?: (context: WorkflowNoticeProviderContext) => WorkflowNoticeResult;
52
+ loadWorkflowListNotices?: (context: WorkflowListNoticeProviderContext) => Promise<WorkflowListNoticeMap>;
53
+ shouldLoadWorkflowListNotices?: (context: WorkflowListNoticeProviderContext) => boolean;
54
+ };
55
+ export type WorkflowNoticeProvider = WorkflowNoticeProviderFunction | WorkflowNoticeProviderObject;
17
56
  /**
18
57
  * A workflow **system variable** (the `$system` scope). Registered by the
19
58
  * workflow plugin itself — fixed, framework-independent values (current time,
@@ -33,12 +72,15 @@ export declare class PluginWorkflowClientV2 extends Plugin {
33
72
  instructions: any;
34
73
  instructionGroups: any;
35
74
  systemVariables: any;
75
+ workflowNoticeProviders: any;
76
+ taskTypes: any;
36
77
  /**
37
78
  * Register a `$system` scope variable. Mirrors v1's `registerSystemVariable`
38
79
  * but writes to *this* (v2) runtime's registry. The workflow plugin registers
39
80
  * the builtin ones (time / instance id / snowflake id) on load.
40
81
  */
41
82
  registerSystemVariable(option: SystemVariableOption): void;
83
+ registerTaskType(key: string, option: Omit<TaskTypeOptions, 'key'> | TaskTypeOptions): void;
42
84
  isWorkflowSync(workflow: any): any;
43
85
  /**
44
86
  * Register a node type's v2 instruction. Mirrors v1's `registerInstruction`
@@ -55,6 +97,14 @@ export declare class PluginWorkflowClientV2 extends Plugin {
55
97
  new (): Trigger;
56
98
  }): void;
57
99
  getTriggerOptions(type?: string): any;
100
+ /**
101
+ * Register a workflow notice provider. Providers should be pure readers of the supplied context; they are queried by
102
+ * UI surfaces such as workflow list rows and trigger node cards.
103
+ */
104
+ registerWorkflowNoticeProvider(key: string, provider: WorkflowNoticeProvider): void;
105
+ /** Collect notices from registered providers for the current UI surface. */
106
+ getWorkflowNotices(context: WorkflowNoticeProviderContext): any[];
107
+ loadWorkflowListNotices(context: WorkflowListNoticeProviderContext): Promise<Record<string, WorkflowNotice[]>>;
58
108
  load(): Promise<void>;
59
109
  private registerBuiltinSystemVariables;
60
110
  private registerBuiltinInstructions;
@@ -63,5 +113,7 @@ export declare class PluginWorkflowClientV2 extends Plugin {
63
113
  private registerSettingsPage;
64
114
  private registerCanvasRoute;
65
115
  private registerExecutionRoute;
116
+ private registerTaskCenterRoutes;
66
117
  }
67
118
  export default PluginWorkflowClientV2;
119
+ export type { TaskTypeOptions } from './taskCenter';
@@ -0,0 +1,105 @@
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 type { ComponentType, ReactNode } from 'react';
10
+ export declare const TASK_STATUS: {
11
+ readonly ALL: "all";
12
+ readonly PENDING: "pending";
13
+ readonly COMPLETED: "completed";
14
+ };
15
+ export declare const TASK_STATUS_VALUES: readonly ["pending", "completed", "all"];
16
+ export type WorkflowTaskStatus = (typeof TASK_STATUS_VALUES)[number];
17
+ export declare const WORKFLOW_TASKS_PAGE_SIZE = 20;
18
+ export type WorkflowTaskRecord = Record<string, unknown>;
19
+ export type WorkflowTaskRequestParams = Record<string, unknown>;
20
+ export type WorkflowTaskStats = Record<string, number | undefined> & {
21
+ pending?: number;
22
+ completed?: number;
23
+ all?: number;
24
+ };
25
+ export type WorkflowTaskCounts = Record<string, WorkflowTaskStats>;
26
+ export interface WorkflowTaskActionsProps {
27
+ onlyIcon?: boolean;
28
+ reload?: () => Promise<void>;
29
+ }
30
+ export interface WorkflowTaskDetailModalProps {
31
+ children?: ReactNode;
32
+ mobile: boolean;
33
+ onClose: () => void;
34
+ record: WorkflowTaskRecord | null;
35
+ title: ReactNode;
36
+ type: TaskTypeOptions;
37
+ }
38
+ export interface WorkflowTaskRecordContextValue {
39
+ record: WorkflowTaskRecord;
40
+ openRecord?: (record: WorkflowTaskRecord) => void;
41
+ refresh?: () => Promise<void>;
42
+ }
43
+ export declare const WorkflowTaskRecordContext: import("react").Context<WorkflowTaskRecordContextValue>;
44
+ export declare function useWorkflowTaskRecord(): WorkflowTaskRecordContextValue;
45
+ export interface WorkflowTaskResource {
46
+ [action: string]: ((params?: WorkflowTaskRequestParams) => Promise<unknown>) | undefined;
47
+ }
48
+ export interface WorkflowTaskApiClient {
49
+ resource: (name: string) => WorkflowTaskResource;
50
+ }
51
+ export interface WorkflowTaskRegistry {
52
+ get: (key: string) => TaskTypeOptions | undefined;
53
+ getKeys: () => Iterable<string>;
54
+ getEntities?: () => Iterable<[string, TaskTypeOptions]>;
55
+ }
56
+ export interface WorkflowTaskPlugin {
57
+ taskTypes: WorkflowTaskRegistry;
58
+ }
59
+ export interface WorkflowTaskFlowContext {
60
+ api: WorkflowTaskApiClient;
61
+ app?: {
62
+ eventBus?: EventTarget;
63
+ pm?: {
64
+ get: (name: string) => WorkflowTaskPlugin | undefined;
65
+ };
66
+ };
67
+ router?: {
68
+ navigate: (path: string, options?: {
69
+ replace?: boolean;
70
+ }) => void;
71
+ };
72
+ t?: (key: string, options?: Record<string, unknown>) => string;
73
+ }
74
+ export interface TaskTypeOptions {
75
+ key: string;
76
+ title: string;
77
+ collection: string;
78
+ action?: string;
79
+ useActionParams?: (status: WorkflowTaskStatus) => WorkflowTaskRequestParams | undefined;
80
+ Actions?: ComponentType<WorkflowTaskActionsProps>;
81
+ DetailModal?: ComponentType<WorkflowTaskDetailModalProps>;
82
+ Item: ComponentType;
83
+ Detail: ComponentType;
84
+ getPopupRecord?: (apiClient: WorkflowTaskApiClient, context: {
85
+ params: WorkflowTaskRequestParams;
86
+ }) => Promise<unknown>;
87
+ alwaysShow?: boolean;
88
+ }
89
+ export interface WorkflowTaskListPayload {
90
+ data: WorkflowTaskRecord[];
91
+ meta: Record<string, unknown>;
92
+ }
93
+ export declare function normalizeWorkflowTaskStatus(status?: string): WorkflowTaskStatus;
94
+ export declare function normalizeWorkflowTaskRecordsResponse(response: unknown): WorkflowTaskListPayload;
95
+ export declare function normalizeWorkflowTaskRecordResponse(response: unknown): WorkflowTaskRecord | null;
96
+ export declare function normalizeWorkflowTaskCountsResponse(response: unknown): WorkflowTaskCounts;
97
+ export declare function getWorkflowTaskRegistry(ctx?: WorkflowTaskFlowContext): WorkflowTaskRegistry | undefined;
98
+ export declare function getWorkflowTaskTypeKeys(taskTypes?: WorkflowTaskRegistry): string[];
99
+ export declare function getWorkflowTaskRecordKey(record: WorkflowTaskRecord): unknown;
100
+ export declare function getAvailableWorkflowTaskTypeKeys(taskTypes: WorkflowTaskRegistry | undefined, counts: WorkflowTaskCounts): string[];
101
+ export declare function useWorkflowTaskCounts(ctx: WorkflowTaskFlowContext | undefined, taskTypes: WorkflowTaskRegistry | undefined): {
102
+ counts: WorkflowTaskCounts;
103
+ total: number;
104
+ reload: () => Promise<void>;
105
+ };
@@ -13,12 +13,13 @@
13
13
  * time, making v1 fall through to the inherited loaders.
14
14
  */
15
15
  import type { ComponentType } from 'react';
16
- import type { ISchema, JSXComponent } from '@formily/react';
17
16
  import type { SubModelItem } from '@nocobase/flow-engine';
18
17
  import type { UseVariableOptions, VariableOption } from '../canvas/collectionFieldOptions';
19
18
  export type LoaderOf<P = {}> = () => Promise<{
20
19
  default: ComponentType<P>;
21
20
  }>;
21
+ type ISchema = import('@formily/react').ISchema;
22
+ type JSXComponent = import('@formily/react').JSXComponent;
22
23
  export type TriggerTempAssociationSource = {
23
24
  collection: string;
24
25
  nodeId: string | number;
@@ -59,3 +60,4 @@ export type LegacyTriggerFieldsetRenderMode = 'legacy-fieldset' | 'modern-loader
59
60
  export declare function resolveLegacyTriggerPresetRenderMode(trigger?: Pick<Trigger, 'presetFieldset' | 'PresetFieldsetLoader'> | null): LegacyTriggerFieldsetRenderMode;
60
61
  export declare function resolveLegacyTriggerConfigRenderMode(trigger?: Pick<Trigger, 'fieldset' | 'FieldsetLoader'> | null): LegacyTriggerFieldsetRenderMode;
61
62
  export declare function resolveLegacyTriggerExecuteRenderMode(trigger?: Pick<Trigger, 'triggerFieldset' | 'TriggerFieldsetLoader'> | null): LegacyTriggerFieldsetRenderMode;
63
+ export {};
@@ -188,6 +188,24 @@ declare const _default: {
188
188
  constraints?: undefined;
189
189
  through?: undefined;
190
190
  otherKey?: undefined;
191
+ } | {
192
+ type: string;
193
+ name: string;
194
+ defaultValue: {
195
+ timeout?: undefined;
196
+ };
197
+ primaryKey?: undefined;
198
+ allowNull?: undefined;
199
+ interface?: undefined;
200
+ uiSchema?: undefined;
201
+ required?: undefined;
202
+ target?: undefined;
203
+ onDelete?: undefined;
204
+ foreignKey?: undefined;
205
+ sourceKey?: undefined;
206
+ constraints?: undefined;
207
+ through?: undefined;
208
+ otherKey?: undefined;
191
209
  } | {
192
210
  type: string;
193
211
  name: string;
@@ -120,6 +120,11 @@ var workflows_default = {
120
120
  required: true,
121
121
  defaultValue: {}
122
122
  },
123
+ {
124
+ type: "jsonb",
125
+ name: "validation",
126
+ defaultValue: {}
127
+ },
123
128
  {
124
129
  type: "hasMany",
125
130
  name: "nodes",
@@ -11,33 +11,33 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/core": "2.3.7",
13
13
  "@formily/react": "2.3.7",
14
- "@nocobase/client": "2.2.0-alpha.6",
15
- "@nocobase/utils": "2.2.0-alpha.6",
14
+ "@nocobase/client": "2.2.0-alpha.7",
15
+ "@nocobase/utils": "2.2.0-alpha.7",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
- "@nocobase/flow-engine": "2.2.0-alpha.6",
18
+ "@nocobase/flow-engine": "2.2.0-alpha.7",
19
19
  "ahooks": "3.7.8",
20
20
  "react-router-dom": "6.30.1",
21
21
  "react-i18next": "11.18.6",
22
22
  "lodash": "4.18.1",
23
23
  "@dnd-kit/core": "6.1.0",
24
24
  "@formily/shared": "2.3.7",
25
- "@nocobase/plugin-mobile": "2.2.0-alpha.6",
26
- "@nocobase/client-v2": "2.2.0-alpha.6",
25
+ "@nocobase/plugin-mobile": "2.2.0-alpha.7",
26
+ "@nocobase/client-v2": "2.2.0-alpha.7",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/server": "2.2.0-alpha.6",
29
- "@nocobase/database": "2.2.0-alpha.6",
30
- "@nocobase/data-source-manager": "2.2.0-alpha.6",
31
- "@nocobase/logger": "2.2.0-alpha.6",
32
- "@nocobase/evaluators": "2.2.0-alpha.6",
28
+ "@nocobase/server": "2.2.0-alpha.7",
29
+ "@nocobase/database": "2.2.0-alpha.7",
30
+ "@nocobase/data-source-manager": "2.2.0-alpha.7",
31
+ "@nocobase/logger": "2.2.0-alpha.7",
32
+ "@nocobase/evaluators": "2.2.0-alpha.7",
33
33
  "@formily/antd-v5": "1.2.3",
34
34
  "@formily/reactive": "2.3.7",
35
35
  "@emotion/css": "11.13.0",
36
36
  "@formily/json-schema": "2.3.7",
37
37
  "antd-style": "3.7.1",
38
38
  "dayjs": "1.11.13",
39
- "@nocobase/actions": "2.2.0-alpha.6",
40
- "@nocobase/plugin-workflow-test": "2.2.0-alpha.6",
41
- "@nocobase/test": "2.2.0-alpha.6",
39
+ "@nocobase/actions": "2.2.0-alpha.7",
40
+ "@nocobase/plugin-workflow-test": "2.2.0-alpha.7",
41
+ "@nocobase/test": "2.2.0-alpha.7",
42
42
  "@dnd-kit/sortable": "7.0.2"
43
43
  };
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2026-07-05T05:52:54.770Z"}
1
+ {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2026-07-09T09:54:10.400Z"}
@@ -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-05T05:52:54.485Z"}
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-09T09:54:10.076Z"}
@@ -1 +1 @@
1
- {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-07-05T05:52:53.690Z"}
1
+ {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-07-09T09:54:09.237Z"}
@@ -1 +1 @@
1
- {"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2026-07-05T05:52:53.517Z"}
1
+ {"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2026-07-09T09:54:09.048Z"}
@@ -527,7 +527,8 @@ class Dispatcher {
527
527
  }
528
528
  return processor;
529
529
  };
530
- const lock = await this.plugin.app.lockManager.tryAcquire((0, import_utils.getExecutionLockKey)(execution.id), 6e4);
530
+ const lockManager = this.plugin.app.lockManager;
531
+ const lock = await lockManager.tryAcquire((0, import_utils.getExecutionLockKey)(execution.id), 6e4);
531
532
  try {
532
533
  return await lock.runExclusive(run, 6e4);
533
534
  } catch (error) {
@@ -108,7 +108,8 @@ class ExecutionTimeoutManager {
108
108
  }
109
109
  async abortExecutionIfExpiredWithLock(executionOrId) {
110
110
  const executionId = typeof executionOrId === "object" ? executionOrId.id : executionOrId;
111
- const lock = await this.plugin.app.lockManager.tryAcquire((0, import_utils.getExecutionLockKey)(executionId), EXECUTION_LOCK_TIMEOUT);
111
+ const lockManager = this.plugin.app.lockManager;
112
+ const lock = await lockManager.tryAcquire((0, import_utils.getExecutionLockKey)(executionId), EXECUTION_LOCK_TIMEOUT);
112
113
  return lock.runExclusive(async () => {
113
114
  const execution = await this.plugin.db.getRepository("executions").findOne({
114
115
  filterByTk: executionId
@@ -12,6 +12,7 @@ export declare class WorkflowValidationError extends Error {
12
12
  errors: Record<string, string>;
13
13
  constructor(errors: Record<string, string>);
14
14
  }
15
+ export declare function list(context: Context, next: any): Promise<void>;
15
16
  export declare function create(context: Context, next: any): Promise<void>;
16
17
  export declare function update(context: Context, next: any): Promise<void>;
17
18
  export declare function destroy(context: Context, next: any): Promise<void>;
@@ -40,6 +40,7 @@ __export(workflows_exports, {
40
40
  create: () => create,
41
41
  destroy: () => destroy,
42
42
  execute: () => execute,
43
+ list: () => list,
43
44
  revision: () => revision,
44
45
  sync: () => sync,
45
46
  update: () => update
@@ -72,6 +73,9 @@ function validateWorkflow(context, plugin, { type, config }) {
72
73
  }
73
74
  }
74
75
  }
76
+ async function list(context, next) {
77
+ return import_actions.default.list(context, next);
78
+ }
75
79
  async function create(context, next) {
76
80
  const plugin = context.app.pm.get(import_Plugin.default);
77
81
  const { values } = context.action.params;
@@ -220,6 +224,7 @@ async function execute(context, next) {
220
224
  create,
221
225
  destroy,
222
226
  execute,
227
+ list,
223
228
  revision,
224
229
  sync,
225
230
  update
@@ -19,6 +19,7 @@ export default class WorkflowModel extends Model {
19
19
  description?: string;
20
20
  type: string;
21
21
  config: any;
22
+ validation?: Record<string, any>;
22
23
  options: {
23
24
  timeout?: number;
24
25
  stackLimit?: number;
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
7
7
  "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
8
8
  "description.ru-RU": "Мощный инструмент BPM, обеспечивающий базовую поддержку автоматизации бизнес-процессов с возможностью неограниченного расширения триггеров и узлов.",
9
- "version": "2.2.0-alpha.6",
9
+ "version": "2.2.0-alpha.7",
10
10
  "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/workflow",
@@ -51,7 +51,7 @@
51
51
  "@nocobase/test": "2.x",
52
52
  "@nocobase/utils": "2.x"
53
53
  },
54
- "gitHead": "f55b252811f6af01d08cd3814171867b70c8ef7a",
54
+ "gitHead": "34ba02960fca9ab0b6881d3db7040a8a64067bba",
55
55
  "keywords": [
56
56
  "Workflow"
57
57
  ]
@@ -1,10 +0,0 @@
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=self.webpackChunk_nocobase_plugin_workflow||[]).push([["54"],{5329:function(e,n,l){l.d(n,{F:function(){return r}});var t=l(9155),a=l.n(t),o=l(2059),i=l(8198),s=l(9488);function c(e){var n=e.value,l=e.onChange,o=e.disabled,s=e.onCollectionChanged,c=(0,t.useRef)();return a().createElement(i.XJ,{value:n,disabled:o,onChange:function(e){var t,a=null!=(t=c.current)?t:n;null==l||l(e),a&&a!==e&&(null==s||s(a,e)),c.current=e}})}function r(e){var n=e.disabled,l=e.onCollectionChanged,t=(0,s.kj)();return a().createElement(o.Form.Item,{name:["config","collection"],label:t("Collection"),rules:[{required:!0}]},a().createElement(c,{disabled:n,onCollectionChanged:l}))}},6381:function(e,n,l){l.d(n,{CreateFieldset:function(){return m},CreatePresetFieldset:function(){return d}});var t=l(9155),a=l.n(t),o=l(2059),i=l(2235),s=l(8198),c=l(9488),r=l(5329);function u(){var e=(0,c.kj)(),n=o.Form.useFormInstance(),l=o.Form.useWatch(["config","collection"]);return(0,t.useEffect)(function(){l&&(n.setFieldValue(["config","usingAssignFormSchema"],void 0),n.setFieldValue(["config","assignFormSchema"],void 0))},[l,n]),a().createElement(a().Fragment,null,a().createElement(o.Form.Item,{name:["config","params","values"],label:e("Fields values"),extra:e("Unassigned fields will be set to default values, and those without default values will be set to null.")},a().createElement(s.XH,{collection:l})),l?a().createElement(o.Form.Item,{name:["config","params","appends"],label:e("Preload associations"),extra:e("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.")},a().createElement(s.Kr,{collection:l})):null)}function m(){var e,n=(0,i.TA)(),l=o.Form.useFormInstance();return a().createElement(a().Fragment,null,a().createElement(r.F,{disabled:!!(null==n||null==(e=n.config)?void 0:e.collection),onCollectionChanged:function(){l.setFieldValue(["config","params"],{}),l.setFieldValue(["config","usingAssignFormSchema"],void 0),l.setFieldValue(["config","assignFormSchema"],void 0)}}),a().createElement(u,null))}function d(){return a().createElement(r.F,null)}}}]);
@@ -1,10 +0,0 @@
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=self.webpackChunk_nocobase_plugin_workflow||[]).push([["635"],{8950:function(e,l,n){n.d(l,{UpdateFieldset:function(){return g},UpdatePresetFieldset:function(){return p}});var t=n(9155),o=n.n(t),a=n(2059),i=n(2235),r=n(8198),s=n(9785),c=n(9488),u=n(5329),d=n(6855),m=function(e){return!(0,r.Cg)(e)||"belongsTo"===e.type};function f(){var e,l=(0,c.kj)(),n=a.Form.useFormInstance(),i=a.Form.useWatch(["config","collection"]),u=a.Form.useWatch(["config","params","individualHooks"],n),f=[{label:(e=(0,c.kj)())("Update in a batch"),value:!1,tooltip:e("Update all eligible data at one time, which has better performance when the amount of data is large. But association fields are not supported (unless foreign key in current collection), and the updated data will not trigger other workflows.")},{label:e("Update one by one"),value:!0,tooltip:e("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.")}],g=!0!==u;return((0,t.useEffect)(function(){i&&(n.setFieldValue(["config","usingAssignFormSchema"],void 0),n.setFieldValue(["config","assignFormSchema"],void 0),void 0===n.getFieldValue(["config","params","individualHooks"])&&n.setFieldValue(["config","params","individualHooks"],!1))},[i,n]),i)?o().createElement(o().Fragment,null,o().createElement(a.Form.Item,{name:["config","params","individualHooks"],label:l("Update mode")},o().createElement(s.$,{options:f})),o().createElement(d.F,{collection:i,label:l("Only update records matching conditions")}),o().createElement(a.Form.Item,{name:["config","params","values"],label:l("Fields values")},o().createElement(r.XH,{collection:i,fieldFilter:g?m:void 0,pruneFilteredValues:g}))):null}function g(){var e,l=(0,i.TA)(),n=a.Form.useFormInstance();return o().createElement(o().Fragment,null,o().createElement(u.F,{disabled:!!(null==l||null==(e=l.config)?void 0:e.collection),onCollectionChanged:function(){n.setFieldValue(["config","params","filter"],{}),n.setFieldValue(["config","params","values"],{}),n.setFieldValue(["config","usingAssignFormSchema"],void 0),n.setFieldValue(["config","assignFormSchema"],void 0)}}),o().createElement(f,null))}function p(){return o().createElement(u.F,null)}}}]);
@@ -1,10 +0,0 @@
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=self.webpackChunk_nocobase_plugin_workflow||[]).push([["782"],{3210:function(e,t,n){n.d(t,{s:function(){return u}});var r=n(5477),a=n(8275),o=n(9155),l=n.n(o);function i(){var e,t,n=(e=["\n &:after {\n content: ':';\n }\n & + a {\n margin-left: 0.25em;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return i=function(){return n},n}var u=function(e,t){var n=a.evaluators.get(e);return n&&n.link?l().createElement(l().Fragment,null,l().createElement("span",{className:(0,r.css)(i())},t("Syntax references")),l().createElement("a",{href:t(n.link),target:"_blank",rel:"noreferrer"},n.label)):null}},8101:function(e,t,n){n.d(t,{FW:function(){return J}});var r=n(9155),a=n.n(r),o=n(8275),l=n(2059),i=n(5606),u=n(7375),c=n(5477),s=n(3485),p=n(7768),f=n(5953),m=n(9488),b=n(4563);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}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 n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,i=!1;try{for(a=a.call(e);!(l=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==a.return||a.return()}finally{if(i)throw r}}return o}}(e,t)||w(e,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.")}()}function h(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function O(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||w(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 w(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}}function E(){var e=h(["\n &.ant-select {\n width: auto;\n min-width: 6em;\n flex-shrink: 0;\n }\n"]);return E=function(){return e},e}function j(){var e=h(["\n display: flex;\n gap: 0.5em;\n align-items: center;\n flex-wrap: nowrap;\n margin: 0;\n padding: 0;\n border: none;\n min-width: 0;\n "]);return j=function(){return e},e}function C(){var e=h(["\n display: flex;\n position: relative;\n margin: 0.5em 0;\n "]);return C=function(){return e},e}function k(){var e=h(["\n position: relative;\n width: 100%;\n .node-type-condition-group {\n padding: 0.5em 1em;\n border: 1px dashed #ddd;\n }\n + button {\n position: absolute;\n right: 0;\n }\n "]);return k=function(){return e},e}function S(){var e=h(["\n display: flex;\n align-items: center;\n gap: 0.5em;\n .ant-select {\n width: auto;\n min-width: 6em;\n }\n "]);return S=function(){return e},e}function x(){var e=h(["\n button {\n padding: 0;\n &:not(:last-child) {\n margin-right: 1em;\n }\n }\n "]);return x=function(){return e},e}var A=n(1236).g,P=(0,c.css)(E()),I=new p.Registry;I.register("equal",{name:"=",type:"boolean",group:"boolean"}),I.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),I.register("gt",{name:">",type:"boolean",group:"boolean"}),I.register("gte",{name:"≥",type:"boolean",group:"boolean"}),I.register("lt",{name:"<",type:"boolean",group:"boolean"}),I.register("lte",{name:"≤",type:"boolean",group:"boolean"}),I.register("add",{name:"+",type:"number",group:"number"}),I.register("minus",{name:"-",type:"number",group:"number"}),I.register("multiple",{name:"*",type:"number",group:"number"}),I.register("divide",{name:"/",type:"number",group:"number"}),I.register("mod",{name:"%",type:"number",group:"number"}),I.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),I.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),I.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),I.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),I.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),I.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),I.register("concat",{name:'{{t("Concatenate", { ns: "'.concat(m.CU,'" })}}'),type:"string",group:"string"});var T=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:'{{t("Arithmetic calculation", { ns: "'.concat(m.CU,'" })}}')},{value:"string",title:'{{t("String operation", { ns: "'.concat(m.CU,'" })}}')},{value:"date",title:'{{t("Date", { ns: "'.concat(m.CU,'" })}}')}];function W(e){return Array.from(I.getEntities()).filter(function(t){return v(t,2)[1].group===e})}var N=(0,r.createContext)(b.P);function _(){return(0,r.useContext)(N)()}function F(e){var t=e.calculator,n=e.operands,o=void 0===n?[]:n,i=e.onChange,u=(0,m.kj)(),p=_(),f=_(),b=(0,r.useCallback)(function(e){return i({calculator:t,operands:[e,o[1]]})},[t,i,o]),y=(0,r.useCallback)(function(e){return i({calculator:t,operands:[o[0],e]})},[t,i,o]),g=(0,r.useCallback)(function(e){return i({operands:o,calculator:e})},[i,o]);return a().createElement("fieldset",{className:(0,c.css)(j())},a().createElement(s.TypedVariableInput,{types:A,metaTree:p,value:o[0],onChange:b,style:{flex:1,minWidth:0}}),a().createElement(l.Select,{role:"button","aria-label":"select-operator-calc",value:t,onChange:g,placeholder:u("Operator"),popupMatchSelectWidth:!1,className:P},T.filter(function(e){return!!W(e.value).length}).map(function(e){return a().createElement(l.Select.OptGroup,{key:e.value,label:u(e.title)},W(e.value).map(function(e){var t=v(e,2),n=t[0],r=t[1].name;return a().createElement(l.Select.Option,{key:n,value:n},u(r))}))})),a().createElement(s.TypedVariableInput,{types:A,metaTree:f,value:o[1],onChange:y,style:{flex:1,minWidth:0}}))}function q(e){var t=e.value,n=e.onChange,r=e.onRemove;if(!t)return null;var o=t.calculator,i=t.operands;return a().createElement("div",{className:(0,c.css)(C())},t.group?a().createElement(D,{value:t.group,onChange:function(e){return n(d(g({},t),{group:e}))}}):a().createElement(F,{operands:void 0===i?[]:i,calculator:o,onChange:n}),a().createElement(l.Button,{"aria-label":"icon-close",onClick:r,type:"link",icon:a().createElement(u.CloseCircleOutlined,null)}))}function D(e){var t=e.value,n=e.onChange,o=(0,m.kj)(),i=(0,m.ec)().t,u=t.type,s=t.calculations,p=void 0===s?[]:s,b=(0,r.useCallback)(function(){n(d(g({},t),{calculations:O(p).concat([{not:!1,calculator:"equal"}])}))},[t,p,n]),y=(0,r.useCallback)(function(){n(d(g({},t),{calculations:O(p).concat([{not:!1,group:{type:"and",calculations:[]}}])}))},[t,p,n]),v=(0,r.useCallback)(function(e){p.splice(e,1),n(d(g({},t),{calculations:O(p)}))},[t,p,n]),h=(0,r.useCallback)(function(e,r){p.splice(e,1,r),n(d(g({},t),{calculations:O(p)}))},[t,p,n]);return a().createElement("div",{className:(0,c.cx)("node-type-condition-group",(0,c.css)(k()))},a().createElement("div",{className:(0,c.css)(S())},a().createElement(f.Trans,{t:i},"Meet ",a().createElement(l.Select,{role:"button","data-testid":"filter-select-all-or-any",value:void 0===u?"and":u,onChange:function(e){return n(d(g({},t),{type:e}))}},a().createElement(l.Select.Option,{value:"and"},"All"),a().createElement(l.Select.Option,{value:"or"},"Any"))," conditions in the group")),a().createElement("div",{className:"calculation-items"},p.map(function(e,t){return a().createElement(q,{key:"".concat(e.calculator,"_").concat(t),value:e,onChange:h.bind(null,t),onRemove:function(){return v(t)}})})),a().createElement("div",{className:(0,c.css)(x())},a().createElement(l.Button,{type:"link",onClick:b},o("Add condition")),a().createElement(l.Button,{type:"link",onClick:y},o("Add condition group"))))}function U(e){var t=e.value,n=e.onChange,r=e.useVariableHook,o=void 0===r?b.P:r,l=t&&Object.keys(t).length?t:{group:{type:"and",calculations:[]}};return a().createElement(N.Provider,{value:o},a().createElement(D,{value:l.group,onChange:function(e){return null==n?void 0:n(d(g({},l),{group:e}))}}))}var B=n(9785),M=n(3210);function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function V(e,t,n,r,a,o,l){try{var i=e[o](l),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,a)}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,i=!1;try{for(a=a.call(e);!(l=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==a.return||a.return()}finally{if(i)throw r}}return o}}(e,t)||G(e,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.")}()}function $(e){return function(e){if(Array.isArray(e))return z(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||G(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 G(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return z(e,t)}}var L="basic";function H(e,t){return $(e).concat([t])}function J(e){var t,n,r,u=e.prefix,c=e.calculationLabel,s=e.expressionLabel,p=e.expressionItemProps,f=(0,m.kj)(),b=(t=(0,m.kj)(),n=Array.from(o.evaluators.getEntities()).filter(function(e){return["math.js","formula.js"].includes(R(e,1)[0])}).map(function(e){var t=R(e,2),n=t[0],r=t[1];return{value:n,label:r.label,tooltip:r.tooltip}}),[{value:L,label:t("Basic")}].concat($(n))),y=null!=(r=l.Form.useWatch(H(u,"engine")))?r:L;return a().createElement(a().Fragment,null,a().createElement(l.Form.Item,{name:H(u,"engine"),label:f("Calculation engine"),rules:[{required:!0}],initialValue:L},a().createElement(B.$,{options:b})),a().createElement(l.Form.Item,{name:H(u,"calculation"),label:null!=c?c:f("Condition"),hidden:y!==L,dependencies:[H(u,"engine")],rules:[{required:y===L}]},a().createElement(U,null)),a().createElement(l.Form.Item,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({name:H(u,"expression"),label:null!=s?s:f("Condition expression"),hidden:y===L,dependencies:[H(u,"engine")],validateTrigger:["onChange","onBlur"],rules:[{required:y!==L},{validator:function(e,t){var n;return(n=function(){var e,n;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(r){if(y===L||!t||!(e=o.evaluators.get(y)))return[2];n=String(t).trim().replace(/{{([^{}]+)}}/g,' "1" ');try{e.evaluate(n)}catch(e){throw Error(f("Expression syntax error"))}return[2]})},function(){var e=this,t=arguments;return new Promise(function(r,a){var o=n.apply(e,t);function l(e){V(o,r,a,l,i,"next",e)}function i(e){V(o,r,a,l,i,"throw",e)}l(void 0)})})()}}],extra:y===L?void 0:(0,M.s)(y,f)},p),a().createElement(i.M,null)))}}}]);
@@ -1,10 +0,0 @@
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_client_v2=self.webpackChunk_nocobase_plugin_workflow_client_v2||[]).push([["387"],{2034:function(e,t,n){n.d(t,{i:function(){return F}});var r=n(9155),l=n.n(r),o=n(2059),a=n(7375),i=n(5477),c=n(7694),u=n(5980),s=n(9651),d=n(2235),f=n(3052),m=n(9488),p=n(4759),v=n(2625),g=n(3485),y=n(2404);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function E(e){var t,n,r,i=e.triggerTitle,c=(0,m.kj)(),s=null!=(n=(0,d.$K)())?n:{},f=s.execution,p=s.workflow,v=function(e){if(Array.isArray(e))return e}(t=l().useState(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var l=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(l.push(t.value),2!==l.length);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw n}}return l}}(t)||function(e){if(e){if("string"==typeof e)return b(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 b(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=v[0],E=v[1],w=(0,u.A)().styles;return f?l().createElement(l().Fragment,null,l().createElement(o.Tooltip,{title:c("View result")},l().createElement(o.Button,{type:"primary",shape:"circle",size:"small",icon:l().createElement(a.InfoOutlined,null),className:w.nodeJobButtonClass,onClick:function(e){e.stopPropagation(),E(!0)},onMouseDown:function(e){return e.stopPropagation()}})),l().createElement(o.Modal,{open:g,onCancel:function(){return E(!1)},width:980,footer:null,title:l().createElement("div",{className:w.nodeTitleClass},l().createElement(o.Tag,null,i),l().createElement("strong",null,null==p?void 0:p.title)),destroyOnClose:!0,modalRender:function(e){return l().createElement("div",{onClick:function(e){return e.stopPropagation()},onMouseDown:function(e){return e.stopPropagation()}},e)}},l().createElement("div",{style:{marginBottom:16}},l().createElement("div",{style:{fontWeight:500,marginBottom:8}},c("Triggered at"),":"),l().createElement("div",null,(0,y.fU)(null==f?void 0:f.createdAt))),l().createElement("div",{style:{fontWeight:500,marginBottom:8}},c("Trigger variables"),":"),l().createElement(o.Input.TextArea,{value:JSON.stringify(null!=(r=null==f?void 0:f.context)?r:null,null,2),disabled:!0,autoSize:{minRows:4,maxRows:20},className:w.nodeJobResultClass,style:{whiteSpace:"pre",fontFamily:"monospace",fontSize:"80%"}}))):null}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t,n,r,l,o,a){try{var i=e[o](a),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,l)}function C(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var o=e.apply(t,n);function a(e){h(o,r,l,a,i,"next",e)}function i(e){h(o,r,l,a,i,"throw",e)}a(void 0)})}}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var o=[],a=!0,i=!1;try{for(l=l.call(e);!(a=(n=l.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==l.return||l.return()}finally{if(i)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(e,t)}}(e,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.")}()}function T(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function S(e,t){var n,r,l,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function A(){var e=T(["\n margin-bottom: ","px;\n padding: ","px;\n background-color: ",";\n\n > *:last-child {\n margin-bottom: 0;\n }\n\n dl {\n display: flex;\n align-items: baseline;\n margin: 0;\n }\n\n dt {\n color: ",";\n }\n\n dt::after {\n content: ':';\n margin-right: ","px;\n }\n\n dd {\n margin: 0;\n }\n\n p {\n margin-top: ","px;\n color: ",";\n }\n "]);return A=function(){return e},e}function x(){var e=T(["\n .ant-form-item {\n margin-bottom: ","px;\n }\n\n .ant-form-item-extra {\n margin-top: ","px;\n }\n "]);return x=function(){return e},e}function N(e){var t=e.trigger,n=e.t,r=o.theme.useToken().token;if(!t.description)return null;var a=(0,i.css)(A(),r.marginLG,r.padding,r.colorFillAlter,r.colorText,r.marginXS,r.marginSM,r.colorTextDescription);return l().createElement("div",{className:a},l().createElement("dl",null,l().createElement("dt",null,n("Trigger type")),l().createElement("dd",null,l().createElement(o.Tag,null,n(t.title)))),l().createElement("p",null,n(t.description)))}function R(e){var t,n=e.trigger,a=e.workflow,u=e.onSubmitted,s=(0,c.useFlowContext)(),f=(0,m.kj)(),p=o.theme.useToken().token,y=o.App.useApp().message,b=!!(null==a||null==(t=a.versionStats)?void 0:t.executed),E=k(o.Form.useForm(),1)[0],w=k((0,r.useState)(!1),2),h=w[0],T=w[1],A=(0,r.useMemo)(function(){return(null==n?void 0:n.FieldsetLoader)?(0,r.lazy)(n.FieldsetLoader):null},[n]),R=(0,r.useMemo)(function(){var e;return{config:null!=(e=a.config)?e:{}}},[a.config]);(0,r.useEffect)(function(){E.setFieldsValue(R)},[E,R]);var O=(0,v.useMemoizedFn)(function(){return C(function(){var e,t,n;return S(this,function(r){switch(r.label){case 0:return[4,E.validateFields()];case 1:e=r.sent(),T(!0),r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,s.api.resource("workflows").update({filterByTk:a.id,values:{config:null!=(t=e.config)?t:{}}})];case 3:return r.sent(),null==u||u(),[3,6];case 4:throw n=r.sent(),y.error(f("Failed to save trigger")),console.error(n),n;case 5:return T(!1),[7];case 6:return[2]}})})()}),I=(0,i.css)(x(),p.margin,p.marginXXS);return l().createElement(d.AA.Provider,{value:a},l().createElement(g.DrawerFormLayout,{title:f("Trigger"),onSubmit:O,submitting:h,submitText:f("Submit"),cancelText:f("Cancel"),footer:b?l().createElement("span",null):void 0},l().createElement("div",{style:{paddingBottom:48}},l().createElement(o.Form,{className:I,form:E,layout:"vertical",disabled:b,requiredMark:function(e,t){return t.required?l().createElement(l().Fragment,null,l().createElement("span",{style:{color:p.colorError}},"*"),e):e}},n?l().createElement(N,{trigger:n,t:f}):null,A?l().createElement(r.Suspense,{fallback:l().createElement(o.Skeleton,{active:!0,paragraph:{rows:4}})},l().createElement(A,null)):l().createElement(o.Typography.Paragraph,{type:"secondary"},n?f("This trigger's configuration has not been migrated to the new canvas yet."):f("This trigger type is not available in the new canvas yet."))))))}function O(){var e,t,n=(0,c.useFlowContext)(),i=(0,m.kj)(),s=(0,u.A)(),f=s.styles,g=s.cx,y=null!=(e=(0,d.$K)())?e:{},b=y.workflow,w=y.refresh,h=!!(0,d.S8)(),T=n.app.pm.get(p.q),A=(null==b?void 0:b.type)?T.getTriggerOptions(b.type):void 0,x=A?i(A.title):null!=(t=null==b?void 0:b.type)?t:i("Unknown trigger"),N=k((0,r.useState)(""),2),O=N[0],I=N[1];(0,r.useEffect)(function(){var e,t;I(null!=(e=null!=(t=null==b?void 0:b.triggerTitle)?t:null==b?void 0:b.title)?e:x)},[x,null==b?void 0:b.title,null==b?void 0:b.triggerTitle]);var j=(0,v.useMemoizedFn)(function(e){return C(function(){var t;return S(this,function(r){switch(r.label){case 0:if(!(null==b?void 0:b.id)||(I(t=e||x),t===b.triggerTitle))return[2];return[4,n.api.resource("workflows").update({filterByTk:b.id,values:{triggerTitle:t}})];case 1:return r.sent(),null==w||w(),[2]}})})()}),F=(0,v.useMemoizedFn)(function(){if(null==b?void 0:b.id){var e;(e={ctx:n,trigger:A,workflow:b,refresh:w}).ctx.viewer.drawer({width:"50%",closable:!0,content:function(){return l().createElement(R,{trigger:e.trigger,workflow:e.workflow,onSubmitted:e.refresh})}})}});if(!b)return null;var D=i("Trigger");return l().createElement("div",{className:f.nodeClass,role:"button","aria-label":"".concat(D,"-").concat(O),onClick:function(e){if(e.currentTarget.contains(e.target)){var t,n,r;n=t=e.target,(null!=(r=HTMLElement)&&"u">typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](n):n instanceof r)&&t.closest("textarea, input, button, a, .ant-dropdown, .workflow-node-actions, .ant-modal")||F()}}},l().createElement("div",{className:g(f.nodeCardClass,{invalid:!A})},l().createElement("div",{className:f.nodeHeaderClass},l().createElement("div",{className:g(f.nodeMetaClass,"workflow-node-meta")},l().createElement(o.Tooltip,{title:(null==A?void 0:A.description)?i(A.description):void 0},l().createElement(o.Tag,{color:A?"gold":"error",icon:l().createElement(a.ThunderboltOutlined,null)},l().createElement("span",{className:"type"},x)))),l().createElement("div",{className:"workflow-node-actions"},l().createElement(E,{triggerTitle:x}))),l().createElement("div",{className:"workflow-node-title"},l().createElement(o.Input.TextArea,{value:O,onChange:function(e){return I(e.target.value)},onBlur:function(e){return C(function(){return S(this,function(t){switch(t.label){case 0:return[4,j(e.target.value)];case 1:return t.sent(),[2]}})})()},autoSize:!0,disabled:h,"aria-label":i("Trigger title")}))))}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(){var e,t=(0,u.A)().styles,n=(0,m.kj)(),r=(0,c.useFlowEngine)(),i=(0,f.x)(),s=null==i?void 0:i.clipboard;if(!s)return null;var d=r.context.app.pm.get(p.q),v=null==d?void 0:d.getInstruction(s.type),g=v?n(v.title):s.type;return l().createElement("div",{className:t.clipboardPreviewClass},l().createElement("div",{className:"workflow-clipboard-header"},l().createElement("span",null,n("Copied node")),l().createElement(o.Button,{type:"text",size:"small",icon:l().createElement(a.CloseOutlined,null),onClick:function(){return null==i?void 0:i.clearClipboard()}})),l().createElement("div",{className:"workflow-clipboard-card"},l().createElement("div",{className:"workflow-clipboard-type"},g),l().createElement("div",{className:"workflow-clipboard-title"},null!=(e=s.title)?e:s.type)))}function F(e){var t,n,a=e.entry,c=(0,u.A)(),f=c.styles,p=c.cx,v=(0,m.kj)(),g=(0,d.S8)();(null!=(n=(0,d.$K)())?n:{}).workflow;var y=function(e){if(Array.isArray(e))return e}(t=(0,r.useState)(100))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var l=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(l.push(t.value),2!==l.length);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw n}}return l}}(t)||function(e){if(e){if("string"==typeof e)return I(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 I(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.")}(),b=y[0],E=y[1];return l().createElement("div",{className:p(f.workflowPageClass,(0,i.css)({height:"100%"}))},l().createElement("div",{className:"workflow-canvas-wrapper"},l().createElement("div",{className:"workflow-canvas",style:{zoom:b/100}},l().createElement("div",{className:p(f.branchBlockClass,(0,i.css)({marginTop:"0 !important"}))},l().createElement("div",{className:f.branchClass},g?l().createElement(o.Alert,{type:"warning",showIcon:!0,message:v("Executed workflow cannot be modified. Could be copied to a new version to modify."),style:{marginBottom:"1em"}}):null,l().createElement(O,null),l().createElement("div",{className:p(f.branchBlockClass,(0,i.css)({marginTop:"0 !important"}))},l().createElement(s.l,{entry:a})),l().createElement("div",{className:f.terminalClass},v("End"))))),l().createElement(j,null),l().createElement("div",{className:"workflow-canvas-zoomer"},l().createElement(o.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:b,onChange:E}))))}},8761:function(e,t,n){n.d(t,{K:function(){return r}});function r(e){var t=new Map;e.forEach(function(e){return t.set(e.id,e)});var n=!0,r=!1,l=void 0;try{for(var o,a=t.values()[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var i=o.value;i.upstreamId&&(i.upstream=t.get(i.upstreamId)),i.downstreamId&&(i.downstream=t.get(i.downstreamId))}}catch(e){r=!0,l=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw l}}}},7001:function(e,t,n){n.d(t,{TD:function(){return i}});var r=n(2625),l=n(3485),o=n(8401);function a(){return"modern"===(0,l.getRouteRuntimeVersion)()}function i(){var e=(0,r.useMemoizedFn)(function(e){return a()?(0,o.JG)(e):"/admin/settings/workflow/workflows/".concat(e)}),t=(0,r.useMemoizedFn)(function(e){return a()?(0,o.Pq)(e):"/admin/settings/workflow/executions/".concat(e)});return{isV2Runtime:a(),getWorkflowCanvasPath:e,getWorkflowExecutionPath:t}}},9239:function(e,t,n){n.d(t,{GO:function(){return o},QQ:function(){return c},hi:function(){return a},m2:function(){return i}});var r=n(358);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},a=[{value:o.QUEUEING,label:'{{t("Queueing", { ns: "'.concat(r.C,'" })}}'),color:"blue",description:'{{t("Triggered but still waiting in queue to execute.", { ns: "'.concat(r.C,'" })}}')},{value:o.STARTED,label:'{{t("On going", { ns: "'.concat(r.C,'" })}}'),color:"gold",description:'{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "'.concat(r.C,'" })}}')},{value:o.RESOLVED,label:'{{t("Resolved", { ns: "'.concat(r.C,'" })}}'),color:"green",description:'{{t("Successfully finished.", { ns: "'.concat(r.C,'" })}}')},{value:o.FAILED,label:'{{t("Failed", { ns: "'.concat(r.C,'" })}}'),color:"red",description:'{{t("Failed to satisfy node configurations.", { ns: "'.concat(r.C,'" })}}')},{value:o.ERROR,label:'{{t("Error", { ns: "'.concat(r.C,'" })}}'),color:"red",description:'{{t("Some node meets error.", { ns: "'.concat(r.C,'" })}}')},{value:o.ABORTED,label:'{{t("Aborted", { ns: "'.concat(r.C,'" })}}'),color:"red",description:'{{t("Running of some node was aborted by program flow.", { ns: "'.concat(r.C,'" })}}')},{value:o.CANCELED,label:'{{t("Canceled", { ns: "'.concat(r.C,'" })}}'),color:"volcano",description:'{{t("Manually canceled whole execution when waiting.", { ns: "'.concat(r.C,'" })}}')},{value:o.REJECTED,label:'{{t("Rejected", { ns: "'.concat(r.C,'" })}}'),color:"volcano",description:'{{t("Rejected from a manual node.", { ns: "'.concat(r.C,'" })}}')},{value:o.RETRY_NEEDED,label:'{{t("Retry needed", { ns: "'.concat(r.C,'" })}}'),color:"volcano",description:'{{t("General failed but should do another try.", { ns: "'.concat(r.C,'" })}}')}],i=a.reduce(function(e,t){return Object.assign(e,l({},t.value,t))},{}),c=[{value:r.K.TIMEOUT,label:'{{t("Timed out", { ns: "'.concat(r.C,'" })}}')},{value:r.K.MANUAL_CANCEL,label:'{{t("Canceled manually", { ns: "'.concat(r.C,'" })}}')},{value:r.K.PARENT_ABORTED,label:'{{t("Aborted with parent execution", { ns: "'.concat(r.C,'" })}}')}].reduce(function(e,t){return Object.assign(e,l({},t.value,t))},{})}}]);