@nocobase/plugin-workflow
Version:
A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.
1,428 lines (1,427 loc) • 52 kB
TypeScript
/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
/**
* NocoBase Workflow Plugin — Swagger / OpenAPI 3.0 document
*
* Resources covered:
* workflows — Workflow CRUD, versioning, sync and manual execution
* workflows.nodes — Create nodes inside a workflow (association resource)
* flow_nodes — Update / delete / move / duplicate / test nodes
* executions — Execution record queries, cancellation and deletion
* jobs — Node job queries and resuming paused executions
* userWorkflowTasks — Current-user's pending workflow tasks
*
* API conventions:
* Base URL : /api
* Route fmt : /api/<resource>:<action>
* Assoc fmt : /api/<resource>/<sourceId>/<association>:<action>
*
* Client-side usage (example):
* import { useAPIClient } from '@nocobase/client';
* const api = useAPIClient();
* await api.resource('workflows').list({ filter: { current: true } });
*
* Direct HTTP usage (example):
* GET /api/workflows:list?filter={"current":true}&sort=-createdAt&except[]=config
* Headers: Authorization: Bearer <token>
*/
declare const _default: {
openapi: string;
info: {
title: string;
};
tags: {
name: string;
description: string;
}[];
paths: {
'/workflows:list': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
$ref: string;
name?: undefined;
in?: undefined;
description?: undefined;
schema?: undefined;
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items?: undefined;
default?: undefined;
};
$ref?: undefined;
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
default?: undefined;
};
$ref?: undefined;
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
default: number;
items?: undefined;
};
$ref?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
type: string;
items: {
$ref: string;
};
};
};
};
};
};
};
};
'/workflows:get': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
$ref: string;
name?: undefined;
in?: undefined;
description?: undefined;
schema?: undefined;
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
};
$ref?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
allOf: ({
$ref: string;
type?: undefined;
properties?: undefined;
} | {
type: string;
properties: {
nodes: {
type: string;
items: {
$ref: string;
};
};
};
$ref?: undefined;
})[];
};
};
};
};
};
};
};
'/workflows:create': {
post: {
tags: string[];
summary: string;
description: string;
parameters: any[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
required: string[];
properties: {
title: {
$ref: string;
};
type: {
$ref: string;
};
description: {
$ref: string;
};
enabled: {
$ref: string;
};
sync: {
$ref: string;
};
triggerTitle: {
$ref: string;
};
config: {
$ref: string;
};
options: {
$ref: string;
};
categories: {
$ref: string;
};
};
};
};
};
};
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
};
};
};
'/workflows:update': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
$ref: string;
}[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
properties: {
title: {
$ref: string;
};
enabled: {
$ref: string;
};
description: {
$ref: string;
};
triggerTitle: {
$ref: string;
};
config: {
$ref: string;
};
options: {
$ref: string;
};
categories: {
$ref: string;
};
};
};
};
};
};
responses: {
200: {
description: string;
};
400: {
description: string;
};
};
};
};
'/workflows:destroy': {
post: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
description: string;
schema: {
type: string;
properties?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
properties: {
key: {
type: string;
description: string;
};
};
};
})[];
responses: {
200: {
description: string;
};
};
};
};
'/workflows:revision': {
post: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
description: string;
schema: {
type: string;
properties?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
properties: {
key: {
type: string;
description: string;
};
};
};
})[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
description: string;
properties: {
title: {
type: string;
description: string;
};
enabled: {
type: string;
description: string;
};
current: {
type: string;
description: string;
};
};
};
};
};
};
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
};
};
};
'/workflows:sync': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
description: string;
schema: {
type: string;
};
}[];
responses: {
204: {
description: string;
};
};
};
};
'/workflows:execute': {
post: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
enum?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
enum: number[];
};
required?: undefined;
})[];
requestBody: {
required: boolean;
content: {
'application/json': {
schema: {
type: string;
description: string;
additionalProperties: boolean;
};
};
};
};
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
type: string;
properties: {
execution: {
type: string;
properties: {
id: {
type: string;
description: string;
};
status: {
type: string;
description: string;
};
};
};
newVersionId: {
type: string;
nullable: boolean;
description: string;
};
};
};
};
};
};
400: {
description: string;
};
404: {
description: string;
};
};
};
};
'/workflows/{workflowId}/nodes:create': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
};
}[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
required: string[];
properties: {
type: {
$ref: string;
};
title: {
$ref: string;
};
config: {
$ref: string;
};
upstreamId: {
$ref: string;
};
branchIndex: {
$ref: string;
};
};
};
};
};
};
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
allOf: {
$ref: string;
}[];
};
};
};
};
400: {
description: string;
};
};
};
};
'/flow_nodes:get': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
items?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
};
required?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
};
};
};
'/flow_nodes:update': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
};
}[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
properties: {
title: {
$ref: string;
};
config: {
$ref: string;
};
branchIndex: {
$ref: string;
};
updateAssociationValues: {
type: string;
description: string;
items: {
type: string;
};
};
};
};
};
};
};
responses: {
200: {
description: string;
};
400: {
description: string;
};
};
};
};
'/flow_nodes:destroy': {
post: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
};
required?: undefined;
})[];
responses: {
200: {
description: string;
};
400: {
description: string;
};
};
};
};
'/flow_nodes:destroyBranch': {
post: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
enum?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
enum: number[];
};
required?: undefined;
})[];
responses: {
200: {
description: string;
};
400: {
description: string;
};
};
};
};
'/flow_nodes:duplicate': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
};
}[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
description: string;
properties: {
upstreamId: {
$ref: string;
};
branchIndex: {
$ref: string;
};
config: {
$ref: string;
};
};
};
};
};
};
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
400: {
description: string;
};
404: {
description: string;
};
};
};
};
'/flow_nodes:move': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
};
}[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
description: string;
properties: {
upstreamId: {
type: string;
nullable: boolean;
description: string;
};
branchIndex: {
type: string;
nullable: boolean;
description: string;
};
};
};
};
};
};
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
400: {
description: string;
};
404: {
description: string;
};
};
};
};
'/flow_nodes:test': {
post: {
tags: string[];
summary: string;
description: string;
parameters: any[];
requestBody: {
required: boolean;
content: {
'application/json': {
schema: {
type: string;
required: string[];
properties: {
type: {
$ref: string;
};
config: {
$ref: string;
};
};
};
};
};
};
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
type: string;
};
};
};
};
400: {
description: string;
};
500: {
description: string;
};
};
};
};
'/executions:list': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
description: string;
schema: {
type: string;
items?: undefined;
default?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
default?: undefined;
};
} | {
name: string;
in: string;
schema: {
type: string;
default: number;
items?: undefined;
};
description?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
type: string;
description: string;
items: {
$ref: string;
type: string;
not: {
$ref: string;
};
};
};
};
};
};
};
};
};
'/executions:get': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
items?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
};
required?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
};
};
};
'/executions:cancel': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
};
}[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
400: {
description: string;
};
404: {
description: string;
};
};
};
};
'/executions:destroy': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
description: string;
schema: {
type: string;
};
}[];
responses: {
200: {
description: string;
};
};
};
};
'/jobs:list': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
description: string;
schema: {
type: string;
items?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
};
} | {
name: string;
in: string;
schema: {
type: string;
items?: undefined;
};
description?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
type: string;
items: {
$ref: string;
};
};
};
};
};
};
};
};
'/jobs:get': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
items?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
};
required?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
};
};
};
'/jobs:resume': {
post: {
tags: string[];
summary: string;
description: string;
parameters: {
name: string;
in: string;
required: boolean;
description: string;
schema: {
type: string;
};
}[];
requestBody: {
content: {
'application/json': {
schema: {
type: string;
description: string;
properties: {
status: {
type: string;
description: string;
};
result: {
type: string;
description: string;
};
meta: {
type: string;
description: string;
};
};
};
};
};
};
responses: {
202: {
description: string;
content: {
'application/json': {
schema: {
$ref: string;
};
};
};
};
404: {
description: string;
};
};
};
};
'/userWorkflowTasks:listMine': {
get: {
tags: string[];
summary: string;
description: string;
parameters: ({
name: string;
in: string;
description: string;
schema: {
type: string;
items?: undefined;
};
} | {
name: string;
in: string;
description: string;
schema: {
type: string;
items: {
type: string;
};
};
} | {
name: string;
in: string;
schema: {
type: string;
items?: undefined;
};
description?: undefined;
})[];
responses: {
200: {
description: string;
content: {
'application/json': {
schema: {
type: string;
items: {
$ref: string;
};
};
};
};
};
};
};
};
};
components: {
schemas: {
workflow: {
model: {
type: string;
description: string;
properties: {
id: {
type: string;
description: string;
};
key: {
type: string;
description: string;
};
title: {
type: string;
description: string;
};
description: {
type: string;
description: string;
};
triggerTitle: {
type: string;
description: string;
};
current: {
type: string;
description: string;
};
enabled: {
type: string;
description: string;
};
type: {
type: string;
description: string;
};
sync: {
type: string;
description: string;
};
config: {
type: string;
description: string;
};
options: {
type: string;
description: string;
properties: {
deleteExecutionOnStatus: {
type: string;
description: string;
items: {
type: string;
};
};
stackLimit: {
type: string;
description: string;
default: number;
};
timeout: {
type: string;
description: string;
default: number;
};
};
};
categories: {
type: string;
description: string;
items: {
type: string;
};
};
nodes: {
type: string;
description: string;
};
executions: {
type: string;
description: string;
};
revisions: {
type: string;
description: string;
};
};
};
filterByTk: {
name: string;
in: string;
description: string;
schema: {
type: string;
description: string;
};
};
filter: {
name: string;
in: string;
description: string;
schema: {
type: string;
properties: {
id: {
$ref: string;
};
title: {
$ref: string;
};
type: {
$ref: string;
};
enabled: {
$ref: string;
};
current: {
$ref: string;
};
key: {
$ref: string;
};
};
};
};
};
node: {
type: string;
description: string;
properties: {
id: {
type: string;
description: string;
};
title: {
type: string;
description: string;
};
workflowId: {
type: string;
description: string;
};
upstreamId: {
type: string;
nullable: boolean;
description: string;
};
upstream: {
type: string;
description: string;
$ref: string;
};
downstreamId: {
type: string;
nullable: boolean;
description: string;
};
downstream: {
type: string;
description: string;
$ref: string;
};
type: {
type: string;
description: string;
};
config: {
type: string;
description: string;
};
branchIndex: {
type: string;
nullable: boolean;
description: string;
};
branches: {
type: string;
description: string;
items: {
$ref: string;
};
};
};
};
execution: {
type: string;
description: string;
properties: {
id: {
type: string;
description: string;
};
key: {
type: string;
description: string;
};
workflowId: {
type: string;
description: string;
};
context: {
type: string;
description: string;
};
status: {
type: string;
description: string;
};
output: {
type: string;
description: string;
};
parentExecutionId: {
type: string;
nullable: boolean;
description: string;
};
startedAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
expiresAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
jobs: {
type: string;
description: string;
items: {
$ref: string;
};
};
};
};
job: {
type: string;
description: string;
properties: {
id: {
type: string;
description: string;
};