tachybase_todo/packages/plugins/@tachybase/plugin-workflow-test/src/server/instructions.ts
sealday 3e58c54aa8 feat: 仓库二期 (#719)
Co-authored-by: hello@lv <2256334253@qq.com>
Co-authored-by: wjh <wwwjh0710@163.com>
Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#719
2024-05-08 16:20:31 +08:00

68 lines
1.1 KiB
TypeScript

import { lodash } from '@tachybase/utils';
export default {
echo: {
run({ config = {} }: any, { result }, processor) {
return {
status: 1,
result: config.path == null ? result : lodash.get(result, config.path),
};
},
},
error: {
run(node, input, processor) {
throw new Error('definite error');
},
},
pending: {
run(node, input, processor) {
return {
status: 0,
};
},
},
prompt: {
run(node, input, processor) {
return {
status: 0,
};
},
resume(node, job, processor) {
return job.set({
status: 1,
});
},
},
'prompt->error': {
run(node, input, processor) {
return {
status: 0,
};
},
resume(node, input, processor) {
throw new Error('input failed');
return null;
},
},
customizedSuccess: {
run(node, input, processor) {
return {
status: 100,
};
},
},
customizedError: {
run(node, input, processor) {
return {
status: -100,
};
},
},
};