@tachybase/plugin-workflow-approval 1.3.20 → 1.3.22
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/dist/client/base/Execution.schema.d.ts +1 -1
- package/dist/client/index.js +32 -32
- package/dist/client/system-settings/instruction-approval/Approval.instruction.d.ts +2 -2
- package/dist/client/system-settings/instruction-approval/initializers/forms/Approval.options.d.ts +1 -1
- package/dist/client/system-settings/instruction-carbon-copy/ApprovalCarbonCopy.instruction.d.ts +2 -2
- package/dist/client/user-interface/h5/todos/component/ViewTodosUserJobsContent.d.ts +1 -1
- package/dist/externalVersion.js +7 -11
- package/dist/server/actions/approvalCarbonCopy.js +3 -14
- package/dist/server/actions/approvalRecords.js +3 -13
- package/dist/server/actions/approvals.d.ts +0 -1
- package/dist/server/actions/approvals.js +13 -76
- package/dist/server/actions/workflows.js +2 -12
- package/dist/server/collections/approvalCarbonCopy.d.ts +1 -1
- package/dist/server/collections/approvalCarbonCopy.js +2 -2
- package/dist/server/collections/approvalExecutions.d.ts +1 -1
- package/dist/server/collections/approvalExecutions.js +2 -2
- package/dist/server/collections/approvalRecords.d.ts +1 -1
- package/dist/server/collections/approvalRecords.js +2 -2
- package/dist/server/collections/approvals.d.ts +1 -1
- package/dist/server/collections/approvals.js +2 -2
- package/dist/server/collections/workflows.d.ts +1 -1
- package/dist/server/collections/workflows.js +2 -2
- package/dist/server/instructions/Approval.js +4 -5
- package/dist/server/instructions/ApprovalCarbonCopy.js +2 -2
- package/dist/server/plugin.d.ts +1 -1
- package/dist/server/plugin.js +4 -4
- package/dist/server/triggers/Approval.js +5 -6
- package/package.json +13 -21
|
@@ -24,8 +24,8 @@ export declare class ApprovalInstruction extends Instruction {
|
|
|
24
24
|
onChange: any;
|
|
25
25
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
RadioWithTooltip: typeof RadioWithTooltip;
|
|
27
|
-
ArrayItems: import("
|
|
28
|
-
Item: import("
|
|
27
|
+
ArrayItems: import("@tachybase/schema").ReactFC<React.HTMLAttributes<HTMLDivElement>> & import("@tego/client").ArrayBaseMixins & {
|
|
28
|
+
Item: import("@tachybase/schema").ReactFC<React.HTMLAttributes<HTMLDivElement> & {
|
|
29
29
|
type?: "card" | "divide";
|
|
30
30
|
}>;
|
|
31
31
|
};
|
package/dist/client/system-settings/instruction-approval/initializers/forms/Approval.options.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SchemaInitializerItemType } from '@tachybase/client';
|
|
2
2
|
import { JOB_STATUS } from '@tachybase/module-workflow/client';
|
|
3
3
|
import { ISchema } from '@tachybase/schema';
|
|
4
|
-
import { Registry } from '@
|
|
4
|
+
import { Registry } from '@tego/client';
|
|
5
5
|
type ValueOf<T> = T[keyof T];
|
|
6
6
|
export type FormType = {
|
|
7
7
|
type: 'create' | 'update' | 'custom';
|
package/dist/client/system-settings/instruction-carbon-copy/ApprovalCarbonCopy.instruction.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare class ApprovalCarbonCopyInstruction extends Instruction {
|
|
|
7
7
|
color: string;
|
|
8
8
|
description: string;
|
|
9
9
|
components: {
|
|
10
|
-
ArrayItems: import("
|
|
11
|
-
Item: import("
|
|
10
|
+
ArrayItems: import("@tachybase/schema").ReactFC<import("react").HTMLAttributes<HTMLDivElement>> & import("@tego/client").ArrayBaseMixins & {
|
|
11
|
+
Item: import("@tachybase/schema").ReactFC<React.HTMLAttributes<HTMLDivElement> & {
|
|
12
12
|
type?: "card" | "divide";
|
|
13
13
|
}>;
|
|
14
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Registry } from '@
|
|
1
|
+
import { Registry } from '@tego/client';
|
|
2
2
|
import { ManualFormType } from '../../constants';
|
|
3
3
|
import '../../style/style.css';
|
|
4
4
|
export declare const ViewTodosUserJobsContent: import("react").MemoExoticComponent<import("@tachybase/schema").ReactFC<unknown>>;
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.3.
|
|
3
|
-
"@tachybase/module-workflow": "1.3.
|
|
4
|
-
"@
|
|
2
|
+
"@tachybase/client": "1.3.22",
|
|
3
|
+
"@tachybase/module-workflow": "1.3.22",
|
|
4
|
+
"@tego/server": "1.3.39",
|
|
5
5
|
"lodash": "4.17.21",
|
|
6
6
|
"react": "18.3.1",
|
|
7
|
-
"@tachybase/schema": "1.3.
|
|
7
|
+
"@tachybase/schema": "1.3.39",
|
|
8
8
|
"antd": "5.22.5",
|
|
9
|
-
"@tachybase/
|
|
10
|
-
"@tachybase/database": "1.3.20",
|
|
11
|
-
"@tachybase/data-source": "1.3.20",
|
|
12
|
-
"@tachybase/module-ui-schema": "1.3.20",
|
|
13
|
-
"@tachybase/utils": "1.3.20",
|
|
9
|
+
"@tachybase/module-ui-schema": "1.3.22",
|
|
14
10
|
"sequelize": "6.37.5",
|
|
15
|
-
"@
|
|
16
|
-
"@ant-design/icons": "5.
|
|
11
|
+
"@tego/client": "1.3.39",
|
|
12
|
+
"@ant-design/icons": "5.6.1",
|
|
17
13
|
"ahooks": "3.9.0",
|
|
18
14
|
"react-router-dom": "6.28.1"
|
|
19
15
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,23 +14,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
var approvalCarbonCopy_exports = {};
|
|
29
19
|
__export(approvalCarbonCopy_exports, {
|
|
30
20
|
approvalCarbonCopy: () => approvalCarbonCopy
|
|
31
21
|
});
|
|
32
22
|
module.exports = __toCommonJS(approvalCarbonCopy_exports);
|
|
33
|
-
var import_actions = __toESM(require("@tachybase/actions"));
|
|
34
|
-
var import_database = require("@tachybase/database");
|
|
35
23
|
var import_module_workflow = require("@tachybase/module-workflow");
|
|
24
|
+
var import_server = require("@tego/server");
|
|
36
25
|
var import_status = require("../constants/status");
|
|
37
26
|
var import_utils = require("../utils");
|
|
38
27
|
const approvalCarbonCopy = {
|
|
@@ -49,12 +38,12 @@ const approvalCarbonCopy = {
|
|
|
49
38
|
workflowId: centralizedApprovalFlow.map((item) => item.id),
|
|
50
39
|
approval: {
|
|
51
40
|
status: {
|
|
52
|
-
[
|
|
41
|
+
[import_server.Op.ne]: import_status.APPROVAL_STATUS.DRAFT
|
|
53
42
|
}
|
|
54
43
|
}
|
|
55
44
|
}
|
|
56
45
|
});
|
|
57
|
-
await
|
|
46
|
+
await import_server.actions.list(context, next);
|
|
58
47
|
if (context.body.rows) {
|
|
59
48
|
context.body.rows = (0, import_utils.findUniqueObjects)(
|
|
60
49
|
context.body.rows,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,22 +14,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
var approvalRecords_exports = {};
|
|
29
19
|
__export(approvalRecords_exports, {
|
|
30
20
|
approvalRecords: () => approvalRecords
|
|
31
21
|
});
|
|
32
22
|
module.exports = __toCommonJS(approvalRecords_exports);
|
|
33
|
-
var import_actions = __toESM(require("@tachybase/actions"));
|
|
34
23
|
var import_module_workflow = require("@tachybase/module-workflow");
|
|
24
|
+
var import_server = require("@tego/server");
|
|
35
25
|
var import_error_code = require("../constants/error-code");
|
|
36
26
|
var import_status = require("../constants/status");
|
|
37
27
|
const approvalRecords = {
|
|
@@ -48,11 +38,11 @@ const approvalRecords = {
|
|
|
48
38
|
workflowId: centralizedApprovalFlow.map((item) => item.id)
|
|
49
39
|
}
|
|
50
40
|
});
|
|
51
|
-
return
|
|
41
|
+
return import_server.actions.list(context, next);
|
|
52
42
|
},
|
|
53
43
|
async submit(context, next) {
|
|
54
44
|
var _a, _b;
|
|
55
|
-
const repository =
|
|
45
|
+
const repository = import_server.utils.getRepositoryFromParams(context);
|
|
56
46
|
const { filterByTk, values } = context.action.params;
|
|
57
47
|
const { data, status, needUpdateRecord } = values || {};
|
|
58
48
|
const { currentUser } = context.state;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const approvals: {
|
|
2
2
|
create(context: any, next: any): Promise<any>;
|
|
3
3
|
update(context: any, next: any): Promise<void>;
|
|
4
|
-
resubmit(context: any, next: any): Promise<any>;
|
|
5
4
|
destroy(context: any, next: any): Promise<any>;
|
|
6
5
|
withdraw(context: any, next: any): Promise<any>;
|
|
7
6
|
listCentralized(context: any, next: any): Promise<void>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,31 +14,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
var approvals_exports = {};
|
|
29
19
|
__export(approvals_exports, {
|
|
30
20
|
approvals: () => approvals
|
|
31
21
|
});
|
|
32
22
|
module.exports = __toCommonJS(approvals_exports);
|
|
33
|
-
var import_actions = __toESM(require("@tachybase/actions"));
|
|
34
|
-
var import_data_source = require("@tachybase/data-source");
|
|
35
|
-
var import_database = require("@tachybase/database");
|
|
36
23
|
var import_module_workflow = require("@tachybase/module-workflow");
|
|
24
|
+
var import_server = require("@tego/server");
|
|
37
25
|
var import_constants = require("../../common/constants");
|
|
38
26
|
var import_status = require("../constants/status");
|
|
39
27
|
var import_tools = require("../tools");
|
|
40
28
|
const approvals = {
|
|
41
29
|
async create(context, next) {
|
|
42
30
|
const { status, collectionName, data, workflowId, workflowKey } = context.action.params.values ?? {};
|
|
43
|
-
const [dataSourceName, cName] = (0,
|
|
31
|
+
const [dataSourceName, cName] = (0, import_server.parseCollectionName)(collectionName);
|
|
44
32
|
const dataSource = context.app.dataSourceManager.dataSources.get(dataSourceName);
|
|
45
33
|
if (!dataSource) {
|
|
46
34
|
return context.throw(400, `Data source "${dataSourceName}" not found`);
|
|
@@ -75,7 +63,7 @@ const approvals = {
|
|
|
75
63
|
const { repository, model } = collection;
|
|
76
64
|
const values = await repository.create({
|
|
77
65
|
values: {
|
|
78
|
-
...(0,
|
|
66
|
+
...(0, import_server.traverseJSON)(data, { collection }),
|
|
79
67
|
createdBy: context.state.currentUser.id,
|
|
80
68
|
updatedBy: context.state.currentUser.id
|
|
81
69
|
},
|
|
@@ -103,11 +91,11 @@ const approvals = {
|
|
|
103
91
|
summary
|
|
104
92
|
}
|
|
105
93
|
});
|
|
106
|
-
return
|
|
94
|
+
return import_server.actions.create(context, next);
|
|
107
95
|
},
|
|
108
96
|
async update(context, next) {
|
|
109
97
|
const { collectionName, data, status, updateAssociationValues, summaryConfig } = context.action.params.values ?? {};
|
|
110
|
-
const [dataSourceName, cName] = (0,
|
|
98
|
+
const [dataSourceName, cName] = (0, import_server.parseCollectionName)(collectionName);
|
|
111
99
|
const dataSource = context.app.dataSourceManager.dataSources.get(dataSourceName);
|
|
112
100
|
const collection = dataSource.collectionManager.getCollection(cName);
|
|
113
101
|
const [target] = await collection.repository.update({
|
|
@@ -127,58 +115,7 @@ const approvals = {
|
|
|
127
115
|
summary
|
|
128
116
|
}
|
|
129
117
|
});
|
|
130
|
-
return
|
|
131
|
-
},
|
|
132
|
-
// NOTE: 和 create 逻辑雷同, 但是 因为原本的 create 并非纯操作, 因此拷贝一份以便方便改动
|
|
133
|
-
async resubmit(context, next) {
|
|
134
|
-
const { status, collectionName, data, workflowId, collectionAppends } = context.action.params.values ?? {};
|
|
135
|
-
const [dataSourceName, cName] = (0, import_data_source.parseCollectionName)(collectionName);
|
|
136
|
-
const dataSource = context.app.dataSourceManager.dataSources.get(dataSourceName);
|
|
137
|
-
if (!dataSource) {
|
|
138
|
-
return context.throw(400, `Data source "${dataSourceName}" not found`);
|
|
139
|
-
}
|
|
140
|
-
const collection = dataSource.collectionManager.getCollection(cName);
|
|
141
|
-
if (!collection) {
|
|
142
|
-
return context.throw(400, `Collection "${cName}" not found`);
|
|
143
|
-
}
|
|
144
|
-
const workflow = await context.db.getRepository("workflows").findOne({
|
|
145
|
-
filterByTk: workflowId
|
|
146
|
-
});
|
|
147
|
-
if (!(workflow == null ? void 0 : workflow.enabled)) {
|
|
148
|
-
return context.throw(400, "Current workflow not found or disabled, please refresh and try again");
|
|
149
|
-
}
|
|
150
|
-
const { repository, model } = collection;
|
|
151
|
-
const values = await repository.create({
|
|
152
|
-
values: {
|
|
153
|
-
...data,
|
|
154
|
-
createdBy: context.state.currentUser.id,
|
|
155
|
-
updatedBy: context.state.currentUser.id
|
|
156
|
-
},
|
|
157
|
-
context
|
|
158
|
-
});
|
|
159
|
-
const instance = values.get();
|
|
160
|
-
const valuesWithAppends = await repository.findOne({
|
|
161
|
-
filterByTk: values.id,
|
|
162
|
-
appends: [...collectionAppends]
|
|
163
|
-
});
|
|
164
|
-
const summary = (0, import_tools.getSummary)({
|
|
165
|
-
summaryConfig: workflow.config.summary,
|
|
166
|
-
data: valuesWithAppends
|
|
167
|
-
});
|
|
168
|
-
Object.keys(model.associations).forEach((key) => {
|
|
169
|
-
delete instance[key];
|
|
170
|
-
});
|
|
171
|
-
context.action.mergeParams({
|
|
172
|
-
values: {
|
|
173
|
-
collectionName,
|
|
174
|
-
data: instance,
|
|
175
|
-
dataKey: values[collection.filterTargetKey],
|
|
176
|
-
workflowKey: workflow.key,
|
|
177
|
-
applicantRoleName: context.state.currentRole,
|
|
178
|
-
summary
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
return import_actions.default.create(context, next);
|
|
118
|
+
return import_server.actions.update(context, next);
|
|
182
119
|
},
|
|
183
120
|
async destroy(context, next) {
|
|
184
121
|
const {
|
|
@@ -188,7 +125,7 @@ const approvals = {
|
|
|
188
125
|
if (status !== import_status.APPROVAL_STATUS.DRAFT) {
|
|
189
126
|
return context.throw(400);
|
|
190
127
|
}
|
|
191
|
-
const repository =
|
|
128
|
+
const repository = import_server.utils.getRepositoryFromParams(context);
|
|
192
129
|
const approval = await repository.findOne({
|
|
193
130
|
filterByTk,
|
|
194
131
|
filter: {
|
|
@@ -198,12 +135,12 @@ const approvals = {
|
|
|
198
135
|
if (!approval) {
|
|
199
136
|
return context.throw(404);
|
|
200
137
|
}
|
|
201
|
-
return
|
|
138
|
+
return import_server.actions.destroy(context, next);
|
|
202
139
|
},
|
|
203
140
|
async withdraw(context, next) {
|
|
204
141
|
var _a;
|
|
205
142
|
const { filterByTk } = context.action.params;
|
|
206
|
-
const repository =
|
|
143
|
+
const repository = import_server.utils.getRepositoryFromParams(context);
|
|
207
144
|
const approval = await repository.findOne({
|
|
208
145
|
filterByTk,
|
|
209
146
|
appends: ["workflow"],
|
|
@@ -225,7 +162,7 @@ const approvals = {
|
|
|
225
162
|
limit: 1
|
|
226
163
|
});
|
|
227
164
|
execution.workflow = approval.workflow;
|
|
228
|
-
|
|
165
|
+
await context.db.sequelize.transaction(async (transaction) => {
|
|
229
166
|
const records = await approval.getRecords({
|
|
230
167
|
where: {
|
|
231
168
|
executionId: execution.id
|
|
@@ -278,12 +215,12 @@ const approvals = {
|
|
|
278
215
|
workflowId: centralizedApprovalFlow.map((item) => item.id)
|
|
279
216
|
}
|
|
280
217
|
});
|
|
281
|
-
return await
|
|
218
|
+
return await import_server.actions.list(context, next);
|
|
282
219
|
},
|
|
283
220
|
async reminder(context, next) {
|
|
284
221
|
var _a, _b, _c;
|
|
285
222
|
const { filterByTk } = context.action.params;
|
|
286
|
-
const repository =
|
|
223
|
+
const repository = import_server.utils.getRepositoryFromParams(context);
|
|
287
224
|
const approval = await repository.findOne({
|
|
288
225
|
filterByTk,
|
|
289
226
|
appends: ["records", "workflow", "createdBy.nickname"]
|
|
@@ -302,7 +239,7 @@ const approvals = {
|
|
|
302
239
|
}
|
|
303
240
|
const assignees = approval.records.map((record) => record.userId);
|
|
304
241
|
for (const userId of assignees) {
|
|
305
|
-
const [dataSourceName] = (0,
|
|
242
|
+
const [dataSourceName] = (0, import_server.parseCollectionName)(approval.collectionName);
|
|
306
243
|
const collection = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(approval.collectionName);
|
|
307
244
|
const message = {
|
|
308
245
|
userId,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,21 +14,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
var workflows_exports = {};
|
|
29
19
|
__export(workflows_exports, {
|
|
30
20
|
workflows: () => workflows
|
|
31
21
|
});
|
|
32
22
|
module.exports = __toCommonJS(workflows_exports);
|
|
33
|
-
var
|
|
23
|
+
var import_server = require("@tego/server");
|
|
34
24
|
const workflows = {
|
|
35
25
|
async listApprovalFlows(context, next) {
|
|
36
26
|
context.action.mergeParams({
|
|
@@ -40,7 +30,7 @@ const workflows = {
|
|
|
40
30
|
// TODO: 仅显示当前用户有权限的流程
|
|
41
31
|
}
|
|
42
32
|
});
|
|
43
|
-
return
|
|
33
|
+
return import_server.actions.list(context, next);
|
|
44
34
|
}
|
|
45
35
|
};
|
|
46
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionOptions;
|
|
2
2
|
export default _default;
|
|
@@ -20,9 +20,9 @@ __export(approvalCarbonCopy_exports, {
|
|
|
20
20
|
default: () => approvalCarbonCopy_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(approvalCarbonCopy_exports);
|
|
23
|
-
var
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
24
|
var import_constants = require("../../common/constants");
|
|
25
|
-
var approvalCarbonCopy_default = (0,
|
|
25
|
+
var approvalCarbonCopy_default = (0, import_server.defineCollection)({
|
|
26
26
|
namespace: "workflow.approvalCarbonCopy",
|
|
27
27
|
dumpRules: "required",
|
|
28
28
|
name: import_constants.COLLECTION_NAME_APPROVAL_CARBON_COPY,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionOptions;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(approvalExecutions_exports, {
|
|
|
20
20
|
default: () => approvalExecutions_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(approvalExecutions_exports);
|
|
23
|
-
var
|
|
24
|
-
var approvalExecutions_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var approvalExecutions_default = (0, import_server.defineCollection)({
|
|
25
25
|
namespace: "workflow.approvalExecutions",
|
|
26
26
|
dumpRules: "required",
|
|
27
27
|
name: "approvalExecutions",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionOptions;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(approvalRecords_exports, {
|
|
|
20
20
|
default: () => approvalRecords_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(approvalRecords_exports);
|
|
23
|
-
var
|
|
24
|
-
var approvalRecords_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var approvalRecords_default = (0, import_server.defineCollection)({
|
|
25
25
|
namespace: "workflow.approvalRecords",
|
|
26
26
|
dumpRules: "required",
|
|
27
27
|
name: "approvalRecords",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionOptions;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(approvals_exports, {
|
|
|
20
20
|
default: () => approvals_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(approvals_exports);
|
|
23
|
-
var
|
|
24
|
-
var approvals_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var approvals_default = (0, import_server.defineCollection)({
|
|
25
25
|
namespace: "workflow.approvals",
|
|
26
26
|
dumpRules: "required",
|
|
27
27
|
name: "approvals",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionDef;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(workflows_exports, {
|
|
|
20
20
|
default: () => workflows_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(workflows_exports);
|
|
23
|
-
var
|
|
24
|
-
var workflows_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var workflows_default = (0, import_server.extendCollection)({
|
|
25
25
|
name: "workflows",
|
|
26
26
|
fields: [
|
|
27
27
|
{
|
|
@@ -30,9 +30,8 @@ __export(Approval_exports, {
|
|
|
30
30
|
default: () => ApprovalInstruction
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(Approval_exports);
|
|
33
|
-
var import_data_source = require("@tachybase/data-source");
|
|
34
33
|
var import_module_workflow = require("@tachybase/module-workflow");
|
|
35
|
-
var
|
|
34
|
+
var import_server = require("@tego/server");
|
|
36
35
|
var import_status = require("../constants/status");
|
|
37
36
|
var import_Approval = __toESM(require("../triggers/Approval"));
|
|
38
37
|
var import_tools = require("./tools");
|
|
@@ -84,7 +83,7 @@ class ApprovalInstruction extends import_module_workflow.Instruction {
|
|
|
84
83
|
}
|
|
85
84
|
);
|
|
86
85
|
for (const userId of assignees) {
|
|
87
|
-
const [dataSourceName] = (0,
|
|
86
|
+
const [dataSourceName] = (0, import_server.parseCollectionName)(approval.collectionName);
|
|
88
87
|
const collection = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(approval.collectionName);
|
|
89
88
|
const message = {
|
|
90
89
|
userId,
|
|
@@ -177,7 +176,7 @@ class ApprovalInstruction extends import_module_workflow.Instruction {
|
|
|
177
176
|
}
|
|
178
177
|
try {
|
|
179
178
|
const approval = records[0].approval;
|
|
180
|
-
const [dataSourceName, collectionName] = (0,
|
|
179
|
+
const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(approval.collectionName);
|
|
181
180
|
const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
|
|
182
181
|
const workflow = await approval.getWorkflow({
|
|
183
182
|
where: {
|
|
@@ -217,7 +216,7 @@ class ApprovalInstruction extends import_module_workflow.Instruction {
|
|
|
217
216
|
});
|
|
218
217
|
return {
|
|
219
218
|
...node.config,
|
|
220
|
-
applyDetail: (result == null ? void 0 : result["x-uid"]) ?? (0,
|
|
219
|
+
applyDetail: (result == null ? void 0 : result["x-uid"]) ?? (0, import_server.uid)()
|
|
221
220
|
};
|
|
222
221
|
}
|
|
223
222
|
}
|
|
@@ -20,8 +20,8 @@ __export(ApprovalCarbonCopy_exports, {
|
|
|
20
20
|
default: () => ApprovalCarbonCopyInstruction
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(ApprovalCarbonCopy_exports);
|
|
23
|
-
var import_data_source = require("@tachybase/data-source");
|
|
24
23
|
var import_module_workflow = require("@tachybase/module-workflow");
|
|
24
|
+
var import_server = require("@tego/server");
|
|
25
25
|
var import_constants = require("../../common/constants");
|
|
26
26
|
var import_status = require("../constants/status");
|
|
27
27
|
var import_tools = require("../tools");
|
|
@@ -69,7 +69,7 @@ class ApprovalCarbonCopyInstruction extends import_module_workflow.Instruction {
|
|
|
69
69
|
transaction: processor.transaction
|
|
70
70
|
});
|
|
71
71
|
for (const userId of targetPersonList) {
|
|
72
|
-
const [dataSourceName] = (0,
|
|
72
|
+
const [dataSourceName] = (0, import_server.parseCollectionName)(approval.collectionName);
|
|
73
73
|
const collection = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(approval.collectionName);
|
|
74
74
|
const message = {
|
|
75
75
|
userId,
|
package/dist/server/plugin.d.ts
CHANGED
package/dist/server/plugin.js
CHANGED
|
@@ -31,9 +31,9 @@ __export(plugin_exports, {
|
|
|
31
31
|
default: () => plugin_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(plugin_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_node_path = __toESM(require("node:path"));
|
|
35
35
|
var import_module_workflow = require("@tachybase/module-workflow");
|
|
36
|
-
var import_server = require("@
|
|
36
|
+
var import_server = require("@tego/server");
|
|
37
37
|
var import_constants = require("../common/constants");
|
|
38
38
|
var import_actions = require("./actions");
|
|
39
39
|
var import_Approval = __toESM(require("./instructions/Approval"));
|
|
@@ -57,13 +57,13 @@ class PluginWorkflowApproval extends import_server.Plugin {
|
|
|
57
57
|
const { db } = this;
|
|
58
58
|
db.addMigrations({
|
|
59
59
|
namespace: "approval",
|
|
60
|
-
directory:
|
|
60
|
+
directory: import_node_path.default.resolve(__dirname, "migrations"),
|
|
61
61
|
context: {
|
|
62
62
|
plugin: this
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
await db.import({
|
|
66
|
-
directory:
|
|
66
|
+
directory: import_node_path.default.resolve(__dirname, "collections")
|
|
67
67
|
});
|
|
68
68
|
(0, import_actions.init)(this);
|
|
69
69
|
this.app.acl.allow("workflows", ["listApprovalFlows"], "loggedIn");
|
|
@@ -20,9 +20,8 @@ __export(Approval_exports, {
|
|
|
20
20
|
default: () => ApprovalTrigger
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(Approval_exports);
|
|
23
|
-
var import_data_source = require("@tachybase/data-source");
|
|
24
|
-
var import_database = require("@tachybase/database");
|
|
25
23
|
var import_module_workflow = require("@tachybase/module-workflow");
|
|
24
|
+
var import_server = require("@tego/server");
|
|
26
25
|
var import_lodash = require("lodash");
|
|
27
26
|
var import_sequelize = require("sequelize");
|
|
28
27
|
var import_status = require("../constants/status");
|
|
@@ -58,7 +57,7 @@ const _ApprovalTrigger = class _ApprovalTrigger extends import_module_workflow.T
|
|
|
58
57
|
if (!workflow || !isChangedStatus || !isAllowStatusList || isForbiddenWhenStatusChange) {
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
|
-
const [dataSourceName, collectionName] = (0,
|
|
60
|
+
const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(approval.collectionName);
|
|
62
61
|
const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
|
|
63
62
|
const data = await repository.findOne({
|
|
64
63
|
filterByTk: approval.get("dataKey"),
|
|
@@ -202,7 +201,7 @@ const _ApprovalTrigger = class _ApprovalTrigger extends import_module_workflow.T
|
|
|
202
201
|
await next();
|
|
203
202
|
workflows.forEach(async (workflow) => {
|
|
204
203
|
const trigger = triggers.find((trigger2) => trigger2[0] === workflow.key);
|
|
205
|
-
const [dataSourceName, collectionName] = (0,
|
|
204
|
+
const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(workflow.config.collection);
|
|
206
205
|
const collecton = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
|
|
207
206
|
const data = await collecton.repository.create({
|
|
208
207
|
values: {
|
|
@@ -241,7 +240,7 @@ const _ApprovalTrigger = class _ApprovalTrigger extends import_module_workflow.T
|
|
|
241
240
|
(item) => item.type === _ApprovalTrigger.TYPE && triggersKeysMap.has(item.key)
|
|
242
241
|
);
|
|
243
242
|
for (const workflow of workflows) {
|
|
244
|
-
const [dataSourceName, collectionName] = (0,
|
|
243
|
+
const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(workflow.config.collection);
|
|
245
244
|
const trigger = triggers.find((trigger2) => trigger2[0] === workflow.key);
|
|
246
245
|
const { body: data } = context;
|
|
247
246
|
if (!data) {
|
|
@@ -266,7 +265,7 @@ const _ApprovalTrigger = class _ApprovalTrigger extends import_module_workflow.T
|
|
|
266
265
|
if (payload.get(field)) {
|
|
267
266
|
payload = payload.get(field);
|
|
268
267
|
} else {
|
|
269
|
-
const association = (0,
|
|
268
|
+
const association = (0, import_server.modelAssociationByKey)(payload, field);
|
|
270
269
|
payload = await payload[association.accessors.get]();
|
|
271
270
|
}
|
|
272
271
|
}
|