@nocobase/plugin-workflow-parallel 1.2.13-alpha → 1.3.0-alpha.20240710084543

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流:并行分支节点",
5
5
  "description": "Could be used for parallel execution of branch processes in the workflow.",
6
6
  "description.zh-CN": "用于在工作流中需要并行执行的分支流程。",
7
- "version": "1.2.13-alpha",
7
+ "version": "1.3.0-alpha.20240710084543",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow-parallel",
@@ -22,7 +22,7 @@
22
22
  "@nocobase/server": "1.x",
23
23
  "@nocobase/test": "1.x"
24
24
  },
25
- "gitHead": "b6a1c2ee330b47c2581ea2ce15ee46210e6220f2",
25
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4",
26
26
  "keywords": [
27
27
  "Workflow"
28
28
  ]
@@ -1,38 +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
- import React from 'react';
10
- import { RadioWithTooltip, Instruction } from '@nocobase/plugin-workflow/client';
11
- export default class extends Instruction {
12
- title: string;
13
- type: string;
14
- group: string;
15
- description: string;
16
- fieldset: {
17
- mode: {
18
- type: string;
19
- title: string;
20
- 'x-decorator': string;
21
- 'x-component': string;
22
- 'x-component-props': {
23
- options: {
24
- value: string;
25
- label: string;
26
- tooltip: string;
27
- }[];
28
- };
29
- default: string;
30
- };
31
- };
32
- components: {
33
- RadioWithTooltip: typeof RadioWithTooltip;
34
- };
35
- Component({ data }: {
36
- data: any;
37
- }): React.JSX.Element;
38
- }
@@ -1,14 +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
- import { Plugin } from '@nocobase/client';
10
- export default class extends Plugin {
11
- afterAdd(): Promise<void>;
12
- beforeLoad(): Promise<void>;
13
- load(): Promise<void>;
14
- }
@@ -1,30 +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
- (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("@nocobase/plugin-workflow/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/plugin-workflow/client","react/jsx-runtime","react","antd","@ant-design/icons","react-i18next"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-workflow-parallel"]={},e["@nocobase/client"],e["@nocobase/plugin-workflow"],e.jsxRuntime,e.react,e.antd,e["@ant-design/icons"],e["react-i18next"]))})(this,function(e,t,n,r,f,d,b,u){"use strict";var M=Object.defineProperty;var S=(e,t,n)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var l=(e,t,n)=>(S(e,typeof t!="symbol"?t+"":t,n),n);var x=(e,t,n)=>new Promise((r,f)=>{var d=a=>{try{u(n.next(a))}catch(p){f(p)}},b=a=>{try{u(n.throw(a))}catch(p){f(p)}},u=a=>a.done?r(a.value):Promise.resolve(a.value).then(d,b);u((n=n.apply(e,t)).next())});const a="workflow-parallel";function p(h,m={}){const{t:c}=v(m);return c(h)}function v(h){return u.useTranslation(a,h)}class $ extends n.Instruction{constructor(){super(...arguments);l(this,"title",`{{t("Parallel branch", { ns: "${a}" })}}`);l(this,"type","parallel");l(this,"group","control");l(this,"description",`{{t("Run multiple branch processes in parallel.", { ns: "${a}" })}}`);l(this,"fieldset",{mode:{type:"string",title:`{{t("Mode", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{value:"all",label:`{{t('All succeeded', { ns: "${a}" })}}`,tooltip:`{{t('Continue after all branches succeeded', { ns: "${a}" })}}`},{value:"any",label:`{{t('Any succeeded', { ns: "${a}" })}}`,tooltip:`{{t('Continue after any branch succeeded', { ns: "${a}" })}}`},{value:"race",label:`{{t('Any succeeded or failed', { ns: "${a}" })}}`,tooltip:`{{t('Continue after any branch succeeded, or exit after any branch failed.', { ns: "${a}" })}}`}]},default:"all"}});l(this,"components",{RadioWithTooltip:n.RadioWithTooltip})}Component({data:c}){const{styles:A}=n.useStyles(),{id:B,config:{mode:L}}=c,{workflow:y,nodes:T}=n.useFlowContext(),i=T.reduce((s,o)=>o.upstreamId===B&&o.branchIndex!=null?s.concat(o):s,[]).sort((s,o)=>s.branchIndex-o.branchIndex),[g,C]=f.useState(Math.max(2,i.length)),{getAriaLabel:q}=n.useGetAriaLabelOfAddButton(c),N=p("Add branch"),j=Array(Math.max(0,g-i.length)).fill(null),I=i[i.length-1];return r.jsx(n.NodeDefaultView,{data:c,children:r.jsxs("div",{className:A.nodeSubtreeClass,children:[r.jsxs("div",{className:A.branchBlockClass,children:[i.map(s=>r.jsx(n.Branch,{from:c,entry:s,branchIndex:s.branchIndex},s.id)),j.map((s,o)=>r.jsx(n.Branch,{from:c,branchIndex:(I?I.branchIndex:0)+o+1,controller:i.length+o>1?r.jsx("div",{className:t.css`
11
- padding-top: 2em;
12
-
13
- > button {
14
- .anticon {
15
- transform: rotate(45deg);
16
- }
17
- }
18
- `,children:r.jsx(d.Button,{shape:"circle",icon:r.jsx(b.PlusOutlined,{}),onClick:()=>C(g-1),disabled:y.executed})}):null},`temp_${i.length+o}`))]}),r.jsx(d.Tooltip,{title:N,className:t.css`
19
- visibility: ${y.executed?"hidden":"visible"};
20
- `,children:r.jsx(d.Button,{"aria-label":q("add-branch"),icon:r.jsx(b.PlusOutlined,{}),className:t.css`
21
- position: relative;
22
- top: 1em;
23
- transform-origin: center;
24
- transform: rotate(45deg);
25
-
26
- .anticon {
27
- transform-origin: center;
28
- transform: rotate(-45deg);
29
- }
30
- `,onClick:()=>C(g+1),disabled:y.executed})})]})})}}class w extends t.Plugin{afterAdd(){return x(this,null,function*(){})}beforeLoad(){return x(this,null,function*(){})}load(){return x(this,null,function*(){this.app.pm.get(n).registerInstruction("parallel",$)})}}e.default=w,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,21 +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
- module.exports = {
11
- "react": "18.2.0",
12
- "antd": "5.12.8",
13
- "@ant-design/icons": "5.2.6",
14
- "@nocobase/client": "1.2.13-alpha",
15
- "@nocobase/plugin-workflow": "1.2.13-alpha",
16
- "react-i18next": "11.18.6",
17
- "@nocobase/server": "1.2.13-alpha",
18
- "@nocobase/plugin-workflow-test": "1.2.13-alpha",
19
- "@nocobase/test": "1.2.13-alpha",
20
- "@nocobase/utils": "1.2.13-alpha"
21
- };
package/dist/index.d.ts DELETED
@@ -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
- export * from './server';
10
- export { default } from './server';
package/dist/index.js DELETED
@@ -1,48 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var src_exports = {};
39
- __export(src_exports, {
40
- default: () => import_server.default
41
- });
42
- module.exports = __toCommonJS(src_exports);
43
- __reExport(src_exports, require("./server"), module.exports);
44
- var import_server = __toESM(require("./server"));
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- ...require("./server")
48
- });
@@ -1,11 +0,0 @@
1
- {
2
- "Parallel branch": "Parallel branch",
3
- "Run multiple branch processes in parallel.": "Run multiple branch processes in parallel.",
4
- "Add branch": "Add branch",
5
- "All succeeded": "All succeeded",
6
- "Any succeeded": "Any succeeded",
7
- "Any succeeded or failed": "Any succeeded or failed",
8
- "Continue after all branches succeeded": "Continue after all branches succeeded",
9
- "Continue after any branch succeeded": "Continue after any branch succeeded",
10
- "Continue after any branch succeeded, or exit after any branch failed.": "Continue after any branch succeeded, or exit after any branch failed."
11
- }
@@ -1,10 +0,0 @@
1
- {
2
- "Parallel branch": "Rama paralela",
3
- "Add branch": "Añadir rama",
4
- "All succeeded": "Todo correcto",
5
- "Any succeeded": "Cualquiera con éxito",
6
- "Any succeeded or failed": "Cualquiera tuvo éxito o falló",
7
- "Continue after all branches succeeded": "Continuar después que todas las ramas han tenido éxito",
8
- "Continue after any branch succeeded": "Continuar después que cualquier rama tenga éxito",
9
- "Continue after any branch succeeded, or exit after any branch failed": "Continuar después de que cualquier rama tenga éxito, o salir después de que cualquier rama falle"
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "Parallel branch": "Branche parallèle",
3
- "Add branch": "Ajouter une branche",
4
- "All succeeded": "Tous réussis",
5
- "Any succeeded": "Un réussi",
6
- "Any succeeded or failed": "Un réussi ou un échoué",
7
- "Continue after all branches succeeded": "Continuer après la réussite de toutes les branches",
8
- "Continue after any branch succeeded": "Continuer après la réussite d'une branche",
9
- "Continue after any branch succeeded, or exit after any branch failed": "Continuer après la réussite d'une branche, ou quitter après l'échec d'une branche"
10
- }
@@ -1,11 +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
- export declare const NAMESPACE = "workflow-parallel";
10
- export declare function useLang(key: string, options?: {}): string;
11
- export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"workflow-parallel", undefined>;
@@ -1,48 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var locale_exports = {};
28
- __export(locale_exports, {
29
- NAMESPACE: () => NAMESPACE,
30
- useLang: () => useLang,
31
- usePluginTranslation: () => usePluginTranslation
32
- });
33
- module.exports = __toCommonJS(locale_exports);
34
- var import_react_i18next = require("react-i18next");
35
- const NAMESPACE = "workflow-parallel";
36
- function useLang(key, options = {}) {
37
- const { t } = usePluginTranslation(options);
38
- return t(key);
39
- }
40
- function usePluginTranslation(options) {
41
- return (0, import_react_i18next.useTranslation)(NAMESPACE, options);
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- NAMESPACE,
46
- useLang,
47
- usePluginTranslation
48
- });
@@ -1,7 +0,0 @@
1
- {
2
- "Parallel branch": "分岐",
3
- "All succeeded": "すべて成功",
4
- "Any succeeded": "いずれかが成功",
5
- "Continue after all branches succeeded": "すべての分岐が成功した後に続行",
6
- "Continue after any branch succeeded": "いずれかの分岐が成功した後に続行"
7
- }
@@ -1,11 +0,0 @@
1
- {
2
- "Parallel branch": "병렬 분기",
3
- "Run multiple branch processes in parallel.": "여러 분기 프로세스를 병렬로 실행합니다.",
4
- "Add branch": "분기 추가",
5
- "All succeeded": "모두 성공",
6
- "Any succeeded": "어떤 것이든 성공",
7
- "Any succeeded or failed": "어떤 것이든 성공 또는 실패",
8
- "Continue after all branches succeeded": "모든 분기가 성공한 후 계속",
9
- "Continue after any branch succeeded": "어떤 분기가든 성공한 후 계속",
10
- "Continue after any branch succeeded, or exit after any branch failed.": "어떤 분기든 성공하면 계속 진행하거나 어떤 분기든 실패하면 종료합니다."
11
- }
@@ -1,10 +0,0 @@
1
- {
2
- "Parallel branch": "Ramo paralelo",
3
- "Add branch": "Adicionar ramo",
4
- "All succeeded": "Todos com sucesso",
5
- "Any succeeded": "Qualquer um com sucesso",
6
- "Any succeeded or failed": "Qualquer um com sucesso ou falha",
7
- "Continue after all branches succeeded": "Continuar após todos os ramos com sucesso",
8
- "Continue after any branch succeeded": "Continuar após qualquer ramo com sucesso",
9
- "Continue after any branch succeeded, or exit after any branch failed": "Continuar após qualquer ramo com sucesso ou sair após qualquer ramo falhar"
10
- }
@@ -1,7 +0,0 @@
1
- {
2
- "Parallel branch": "Параллельная ветвь",
3
- "All succeeded": "Всё успешно",
4
- "Any succeeded": "Что-то успешно",
5
- "Continue after all branches succeeded": "Продолжать после успеха на всех ветвях",
6
- "Continue after any branch succeeded": "Продолжать после успеха на любой из ветвей"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "Parallel branch": "Paralel dal",
3
- "All succeeded": "Hepsi başarılı",
4
- "Any succeeded": "Herhangi biri başarılı",
5
- "Continue after all branches succeeded": "Tüm dallar başarılı olduktan sonra devam et",
6
- "Continue after any branch succeeded": "Herhangi bir dal başarılı olduktan sonra devam et"
7
- }
@@ -1,12 +0,0 @@
1
- {
2
- "Parallel branch": "分支",
3
- "Run multiple branch processes in parallel.": "并行运行多个分支流程。",
4
- "Add branch": "增加分支",
5
- "Mode": "执行模式",
6
- "All succeeded": "全部成功",
7
- "Any succeeded": "任意成功",
8
- "Any succeeded or failed": "任意成功或失败",
9
- "Continue after all branches succeeded": "全部分支都成功后才能继续",
10
- "Continue after any branch succeeded": "任意分支成功后就继续",
11
- "Continue after any branch succeeded, or exit after any branch failed.": "任意分支成功就继续流程,或者任意分支失败就退出流程。"
12
- }
@@ -1,18 +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
- import { Processor, Instruction, FlowNodeModel, JobModel } from '@nocobase/plugin-workflow';
10
- export declare const PARALLEL_MODE: {
11
- readonly ALL: "all";
12
- readonly ANY: "any";
13
- readonly RACE: "race";
14
- };
15
- export default class extends Instruction {
16
- run(node: FlowNodeModel, prevJob: JobModel, processor: Processor): Promise<any>;
17
- resume(node: FlowNodeModel, branchJob: any, processor: Processor): Promise<any>;
18
- }
@@ -1,134 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var ParallelInstruction_exports = {};
28
- __export(ParallelInstruction_exports, {
29
- PARALLEL_MODE: () => PARALLEL_MODE,
30
- default: () => ParallelInstruction_default
31
- });
32
- module.exports = __toCommonJS(ParallelInstruction_exports);
33
- var import_plugin_workflow = require("@nocobase/plugin-workflow");
34
- const PARALLEL_MODE = {
35
- ALL: "all",
36
- ANY: "any",
37
- RACE: "race"
38
- };
39
- const Modes = {
40
- [PARALLEL_MODE.ALL]: {
41
- next(previous) {
42
- return previous.status >= import_plugin_workflow.JOB_STATUS.PENDING;
43
- },
44
- getStatus(result) {
45
- const failedStatus = result.find((status) => status != null && status < import_plugin_workflow.JOB_STATUS.PENDING);
46
- if (typeof failedStatus !== "undefined") {
47
- return failedStatus;
48
- }
49
- if (result.every((status) => status != null && status === import_plugin_workflow.JOB_STATUS.RESOLVED)) {
50
- return import_plugin_workflow.JOB_STATUS.RESOLVED;
51
- }
52
- return import_plugin_workflow.JOB_STATUS.PENDING;
53
- }
54
- },
55
- [PARALLEL_MODE.ANY]: {
56
- next(previous) {
57
- return previous.status <= import_plugin_workflow.JOB_STATUS.PENDING;
58
- },
59
- getStatus(result) {
60
- if (result.some((status) => status != null && status === import_plugin_workflow.JOB_STATUS.RESOLVED)) {
61
- return import_plugin_workflow.JOB_STATUS.RESOLVED;
62
- }
63
- if (result.some((status) => status != null ? status === import_plugin_workflow.JOB_STATUS.PENDING : true)) {
64
- return import_plugin_workflow.JOB_STATUS.PENDING;
65
- }
66
- return import_plugin_workflow.JOB_STATUS.FAILED;
67
- }
68
- },
69
- [PARALLEL_MODE.RACE]: {
70
- next(previous) {
71
- return previous.status === import_plugin_workflow.JOB_STATUS.PENDING;
72
- },
73
- getStatus(result) {
74
- if (result.some((status) => status != null && status === import_plugin_workflow.JOB_STATUS.RESOLVED)) {
75
- return import_plugin_workflow.JOB_STATUS.RESOLVED;
76
- }
77
- const failedStatus = result.find((status) => status != null && status < import_plugin_workflow.JOB_STATUS.PENDING);
78
- if (typeof failedStatus !== "undefined") {
79
- return failedStatus;
80
- }
81
- return import_plugin_workflow.JOB_STATUS.PENDING;
82
- }
83
- }
84
- };
85
- class ParallelInstruction_default extends import_plugin_workflow.Instruction {
86
- async run(node, prevJob, processor) {
87
- const branches = processor.getBranches(node);
88
- const job = await processor.saveJob({
89
- status: import_plugin_workflow.JOB_STATUS.PENDING,
90
- result: Array(branches.length).fill(null),
91
- nodeId: node.id,
92
- nodeKey: node.key,
93
- upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
94
- });
95
- const { mode = PARALLEL_MODE.ALL } = node.config;
96
- await branches.reduce(
97
- (promise, branch, i) => promise.then(async (previous) => {
98
- if (i && !Modes[mode].next(previous)) {
99
- return previous;
100
- }
101
- await processor.run(branch, job);
102
- return processor.findBranchLastJob(branch, job);
103
- }),
104
- Promise.resolve()
105
- );
106
- return null;
107
- }
108
- async resume(node, branchJob, processor) {
109
- const job = processor.findBranchParentJob(branchJob, node);
110
- const { result, status } = job;
111
- if (status !== import_plugin_workflow.JOB_STATUS.PENDING) {
112
- return processor.exit();
113
- }
114
- const jobNode = processor.nodesMap.get(branchJob.nodeId);
115
- const branchStartNode = processor.findBranchStartNode(jobNode, node);
116
- const branches = processor.getBranches(node);
117
- const branchIndex = branches.indexOf(branchStartNode);
118
- const { mode = PARALLEL_MODE.ALL } = node.config || {};
119
- const newResult = [...result.slice(0, branchIndex), branchJob.status, ...result.slice(branchIndex + 1)];
120
- job.set({
121
- result: newResult,
122
- status: Modes[mode].getStatus(newResult)
123
- });
124
- if (job.status === import_plugin_workflow.JOB_STATUS.PENDING) {
125
- await job.save();
126
- return processor.exit();
127
- }
128
- return job;
129
- }
130
- }
131
- // Annotate the CommonJS export names for ESM import in node:
132
- 0 && (module.exports = {
133
- PARALLEL_MODE
134
- });
@@ -1,12 +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
- import { Plugin } from '@nocobase/server';
10
- export default class extends Plugin {
11
- load(): Promise<void>;
12
- }
@@ -1,50 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var Plugin_exports = {};
38
- __export(Plugin_exports, {
39
- default: () => Plugin_default
40
- });
41
- module.exports = __toCommonJS(Plugin_exports);
42
- var import_server = require("@nocobase/server");
43
- var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
44
- var import_ParallelInstruction = __toESM(require("./ParallelInstruction"));
45
- class Plugin_default extends import_server.Plugin {
46
- async load() {
47
- const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
48
- workflowPlugin.registerInstruction("parallel", import_ParallelInstruction.default);
49
- }
50
- }
@@ -1,9 +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
- export { default } from './Plugin';
@@ -1,42 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var server_exports = {};
38
- __export(server_exports, {
39
- default: () => import_Plugin.default
40
- });
41
- module.exports = __toCommonJS(server_exports);
42
- var import_Plugin = __toESM(require("./Plugin"));