@nocobase/plugin-workflow-delay 1.2.12-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 +2 -2
- package/dist/client/DelayInstruction.d.ts +0 -52
- package/dist/client/index.d.ts +0 -14
- package/dist/client/index.js +0 -13
- package/dist/externalVersion.js +0 -17
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -48
- package/dist/locale/en-US.json +0 -9
- package/dist/locale/es-ES.json +0 -8
- package/dist/locale/fr-FR.json +0 -8
- package/dist/locale/index.d.ts +0 -11
- package/dist/locale/index.js +0 -48
- package/dist/locale/ko_KR.json +0 -10
- package/dist/locale/pt-BR.json +0 -8
- package/dist/locale/zh-CN.json +0 -9
- package/dist/server/DelayInstruction.d.ts +0 -21
- package/dist/server/DelayInstruction.js +0 -115
- package/dist/server/Plugin.d.ts +0 -12
- package/dist/server/Plugin.js +0 -50
- package/dist/server/index.d.ts +0 -9
- package/dist/server/index.js +0 -42
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:延时节点",
|
|
5
5
|
"description": "Could be used in workflow parallel branch for waiting other branches.",
|
|
6
6
|
"description.zh-CN": "可用于工作流并行分支中等待其他分支执行完成。",
|
|
7
|
-
"version": "1.
|
|
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-delay",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@nocobase/server": "1.x",
|
|
22
22
|
"@nocobase/test": "1.x"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4",
|
|
25
25
|
"keywords": [
|
|
26
26
|
"Workflow"
|
|
27
27
|
]
|
|
@@ -1,52 +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 { Instruction } from '@nocobase/plugin-workflow/client';
|
|
11
|
-
declare function Duration({ value, onChange }: {
|
|
12
|
-
value?: number;
|
|
13
|
-
onChange: any;
|
|
14
|
-
}): React.JSX.Element;
|
|
15
|
-
export default class extends Instruction {
|
|
16
|
-
title: string;
|
|
17
|
-
type: string;
|
|
18
|
-
group: string;
|
|
19
|
-
description: string;
|
|
20
|
-
fieldset: {
|
|
21
|
-
duration: {
|
|
22
|
-
type: string;
|
|
23
|
-
title: string;
|
|
24
|
-
'x-decorator': string;
|
|
25
|
-
'x-component': string;
|
|
26
|
-
default: number;
|
|
27
|
-
required: boolean;
|
|
28
|
-
};
|
|
29
|
-
endStatus: {
|
|
30
|
-
type: string;
|
|
31
|
-
title: string;
|
|
32
|
-
'x-decorator': string;
|
|
33
|
-
'x-component': string;
|
|
34
|
-
enum: {
|
|
35
|
-
label: string;
|
|
36
|
-
value: number;
|
|
37
|
-
}[];
|
|
38
|
-
required: boolean;
|
|
39
|
-
default: number;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
components: {
|
|
43
|
-
Duration: typeof Duration;
|
|
44
|
-
};
|
|
45
|
-
isAvailable({ engine, workflow, upstream, branchIndex }: {
|
|
46
|
-
engine: any;
|
|
47
|
-
workflow: any;
|
|
48
|
-
upstream: any;
|
|
49
|
-
branchIndex: any;
|
|
50
|
-
}): boolean;
|
|
51
|
-
}
|
|
52
|
-
export {};
|
package/dist/client/index.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/client/index.js
DELETED
|
@@ -1,13 +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("react/jsx-runtime"),require("antd"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","antd","@nocobase/plugin-workflow/client","react-i18next"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-workflow-delay"]={},e["@nocobase/client"],e.jsxRuntime,e.antd,e["@nocobase/plugin-workflow"]))})(this,function(e,t,n,f,s){"use strict";var v=Object.defineProperty;var h=(e,t,n)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var r=(e,t,n)=>(h(e,typeof t!="symbol"?t+"":t,n),n);var m=(e,t,n)=>new Promise((f,s)=>{var a=o=>{try{c(n.next(o))}catch(d){s(d)}},w=o=>{try{c(n.throw(o))}catch(d){s(d)}},c=o=>o.done?f(o.value):Promise.resolve(o.value).then(a,w);c((n=n.apply(e,t)).next())});const a="workflow-delay",w=[{value:1e3,label:`{{t('Seconds', { ns: "workflow" })}}`},{value:6e4,label:`{{t('Minutes', { ns: "workflow" })}}`},{value:36e5,label:`{{t('Hours', { ns: "workflow" })}}`},{value:864e5,label:`{{t('Days', { ns: "workflow" })}}`},{value:6048e5,label:`{{t('Weeks', { ns: "workflow" })}}`}];function c(u){return w.slice().reverse().find(i=>!(u%i.value))}function o({value:u=6e4,onChange:i}){const b=t.useCompile(),p=c(u),y=Math.round(u/p.value);return n.jsxs("fieldset",{className:t.css`
|
|
11
|
-
display: flex;
|
|
12
|
-
gap: 0.5em;
|
|
13
|
-
`,children:[n.jsx(f.InputNumber,{min:1,value:y,onChange:l=>i(Math.round(l*p.value)),className:"auto-width"}),n.jsx(f.Select,{role:"button","data-testid":"select-time-unit",popupMatchSelectWidth:!1,value:p.value,onChange:l=>i(Math.round(y*l)),className:"auto-width",options:w.map(l=>({value:l.value,label:b(l.label)}))})]})}class d extends s.Instruction{constructor(){super(...arguments);r(this,"title",`{{t("Delay", { ns: "${a}" })}}`);r(this,"type","delay");r(this,"group","control");r(this,"description",`{{t("Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.", { ns: "${a}" })}}`);r(this,"fieldset",{duration:{type:"number",title:`{{t("Duration", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"Duration",default:6e4,required:!0},endStatus:{type:"number",title:`{{t("End status", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeed and continue", { ns: "${a}" })}}`,value:s.JOB_STATUS.RESOLVED},{label:`{{t("Fail and exit", { ns: "${a}" })}}`,value:s.JOB_STATUS.FAILED}],required:!0,default:s.JOB_STATUS.RESOLVED}});r(this,"components",{Duration:o})}isAvailable({engine:b,workflow:p,upstream:y,branchIndex:l}){return!b.isWorkflowSync(p)}}class x extends t.Plugin{afterAdd(){return m(this,null,function*(){})}beforeLoad(){return m(this,null,function*(){})}load(){return m(this,null,function*(){this.app.pm.get("workflow").registerInstruction("delay",d)})}}e.default=x,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
DELETED
|
@@ -1,17 +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
|
-
"@nocobase/client": "1.2.12-alpha",
|
|
14
|
-
"@nocobase/plugin-workflow": "1.2.12-alpha",
|
|
15
|
-
"react-i18next": "11.18.6",
|
|
16
|
-
"@nocobase/server": "1.2.12-alpha"
|
|
17
|
-
};
|
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
|
-
});
|
package/dist/locale/en-US.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Delay": "Delay",
|
|
3
|
-
"Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.": "Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.",
|
|
4
|
-
"Duration": "Duration",
|
|
5
|
-
"End status": "End status",
|
|
6
|
-
"Select status": "Select status",
|
|
7
|
-
"Succeed and continue": "Succeed and continue",
|
|
8
|
-
"Fail and exit": "Fail and exit"
|
|
9
|
-
}
|
package/dist/locale/es-ES.json
DELETED
package/dist/locale/fr-FR.json
DELETED
package/dist/locale/index.d.ts
DELETED
|
@@ -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-delay";
|
|
10
|
-
export declare function useLang(key: string, options?: {}): string;
|
|
11
|
-
export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"workflow-delay", undefined>;
|
package/dist/locale/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 __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-delay";
|
|
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
|
-
});
|
package/dist/locale/ko_KR.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Delay": "지연",
|
|
3
|
-
"Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.":
|
|
4
|
-
"일정 시간 동안 지연한 다음 프로세스를 계속하거나 종료합니다. 병렬 분기에서 대기 또는 타임아웃 시간을 설정하는 데 사용할 수 있습니다.",
|
|
5
|
-
"Duration": "기간",
|
|
6
|
-
"End Status": "종료 상태",
|
|
7
|
-
"Select status": "상태 선택",
|
|
8
|
-
"Succeed and continue": "성공하고 계속",
|
|
9
|
-
"Fail and exit": "실패하고 종료"
|
|
10
|
-
}
|
package/dist/locale/pt-BR.json
DELETED
package/dist/locale/zh-CN.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Delay": "延时",
|
|
3
|
-
"Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.": "延时一段时间,然后继续或退出流程。可以用于并行分支中等待其他分支或设置超时时间。",
|
|
4
|
-
"Duration": "时长",
|
|
5
|
-
"End status": "到时状态",
|
|
6
|
-
"Select status": "选择状态",
|
|
7
|
-
"Succeed and continue": "通过并继续",
|
|
8
|
-
"Fail and exit": "失败并退出"
|
|
9
|
-
}
|
|
@@ -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
|
-
/// <reference types="node" />
|
|
10
|
-
import WorkflowPlugin, { Processor, Instruction } from '@nocobase/plugin-workflow';
|
|
11
|
-
export default class extends Instruction {
|
|
12
|
-
workflow: WorkflowPlugin;
|
|
13
|
-
timers: Map<number, NodeJS.Timeout>;
|
|
14
|
-
constructor(workflow: WorkflowPlugin);
|
|
15
|
-
load: () => Promise<void>;
|
|
16
|
-
unload: () => void;
|
|
17
|
-
schedule(job: any): void;
|
|
18
|
-
trigger(job: any): Promise<void>;
|
|
19
|
-
run(node: any, prevJob: any, processor: Processor): Promise<any>;
|
|
20
|
-
resume(node: any, prevJob: any, processor: Processor): Promise<any>;
|
|
21
|
-
}
|
|
@@ -1,115 +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 DelayInstruction_exports = {};
|
|
28
|
-
__export(DelayInstruction_exports, {
|
|
29
|
-
default: () => DelayInstruction_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(DelayInstruction_exports);
|
|
32
|
-
var import_plugin_workflow = require("@nocobase/plugin-workflow");
|
|
33
|
-
class DelayInstruction_default extends import_plugin_workflow.Instruction {
|
|
34
|
-
constructor(workflow) {
|
|
35
|
-
super(workflow);
|
|
36
|
-
this.workflow = workflow;
|
|
37
|
-
workflow.app.on("afterStart", this.load);
|
|
38
|
-
workflow.app.on("beforeStop", this.unload);
|
|
39
|
-
}
|
|
40
|
-
timers = /* @__PURE__ */ new Map();
|
|
41
|
-
load = async () => {
|
|
42
|
-
const { model } = this.workflow.app.db.getCollection("jobs");
|
|
43
|
-
const jobs = await model.findAll({
|
|
44
|
-
where: {
|
|
45
|
-
status: import_plugin_workflow.JOB_STATUS.PENDING
|
|
46
|
-
},
|
|
47
|
-
include: [
|
|
48
|
-
{
|
|
49
|
-
association: "execution",
|
|
50
|
-
attributes: [],
|
|
51
|
-
where: {
|
|
52
|
-
status: import_plugin_workflow.EXECUTION_STATUS.STARTED
|
|
53
|
-
},
|
|
54
|
-
required: true
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
association: "node",
|
|
58
|
-
attributes: ["config"],
|
|
59
|
-
where: {
|
|
60
|
-
type: "delay"
|
|
61
|
-
},
|
|
62
|
-
required: true
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
jobs.forEach((job) => {
|
|
67
|
-
this.schedule(job);
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
unload = () => {
|
|
71
|
-
for (const timer of this.timers.values()) {
|
|
72
|
-
clearTimeout(timer);
|
|
73
|
-
}
|
|
74
|
-
this.timers = /* @__PURE__ */ new Map();
|
|
75
|
-
};
|
|
76
|
-
schedule(job) {
|
|
77
|
-
const now = /* @__PURE__ */ new Date();
|
|
78
|
-
const createdAt = Date.parse(job.createdAt);
|
|
79
|
-
const delay = createdAt + job.node.config.duration - now.getTime();
|
|
80
|
-
if (delay > 0) {
|
|
81
|
-
const trigger = this.trigger.bind(this, job);
|
|
82
|
-
this.timers.set(job.id, setTimeout(trigger, delay));
|
|
83
|
-
} else {
|
|
84
|
-
this.trigger(job);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async trigger(job) {
|
|
88
|
-
if (!job.execution) {
|
|
89
|
-
job.execution = await job.getExecution();
|
|
90
|
-
}
|
|
91
|
-
if (job.execution.status === import_plugin_workflow.EXECUTION_STATUS.STARTED) {
|
|
92
|
-
this.workflow.resume(job);
|
|
93
|
-
}
|
|
94
|
-
if (this.timers.get(job.id)) {
|
|
95
|
-
this.timers.delete(job.id);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
async run(node, prevJob, processor) {
|
|
99
|
-
const job = await processor.saveJob({
|
|
100
|
-
status: import_plugin_workflow.JOB_STATUS.PENDING,
|
|
101
|
-
result: null,
|
|
102
|
-
nodeId: node.id,
|
|
103
|
-
nodeKey: node.key,
|
|
104
|
-
upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
|
|
105
|
-
});
|
|
106
|
-
job.node = node;
|
|
107
|
-
this.schedule(job);
|
|
108
|
-
return processor.exit();
|
|
109
|
-
}
|
|
110
|
-
async resume(node, prevJob, processor) {
|
|
111
|
-
const { endStatus } = node.config;
|
|
112
|
-
prevJob.set("status", endStatus);
|
|
113
|
-
return prevJob;
|
|
114
|
-
}
|
|
115
|
-
}
|
package/dist/server/Plugin.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/server/Plugin.js
DELETED
|
@@ -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_DelayInstruction = __toESM(require("./DelayInstruction"));
|
|
45
|
-
class Plugin_default extends import_server.Plugin {
|
|
46
|
-
async load() {
|
|
47
|
-
const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
|
|
48
|
-
workflowPlugin.registerInstruction("delay", import_DelayInstruction.default);
|
|
49
|
-
}
|
|
50
|
-
}
|
package/dist/server/index.d.ts
DELETED
|
@@ -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';
|
package/dist/server/index.js
DELETED
|
@@ -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"));
|