@nocobase/plugin-workflow 0.7.0-alpha.33 → 0.7.0-alpha.34
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/esm/collections/flow_nodes.js +2 -9
- package/esm/collections/flow_nodes.js.map +1 -1
- package/esm/instructions/create.d.ts +1 -1
- package/esm/instructions/create.js +2 -1
- package/esm/instructions/create.js.map +1 -1
- package/esm/instructions/query.js +5 -1
- package/esm/instructions/query.js.map +1 -1
- package/esm/instructions/update.d.ts +2 -1
- package/esm/instructions/update.js.map +1 -1
- package/lib/collections/flow_nodes.js +2 -9
- package/lib/collections/flow_nodes.js.map +1 -1
- package/lib/instructions/create.d.ts +1 -1
- package/lib/instructions/create.js +2 -1
- package/lib/instructions/create.js.map +1 -1
- package/lib/instructions/query.js +5 -1
- package/lib/instructions/query.js.map +1 -1
- package/lib/instructions/update.d.ts +2 -1
- package/lib/instructions/update.js.map +1 -1
- package/package.json +7 -7
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
type: 'integer',
|
|
39
39
|
title: 'branch index'
|
|
40
40
|
},
|
|
41
|
-
// for reasons:
|
|
41
|
+
// Note: for reasons:
|
|
42
42
|
// 1. redirect type node to solve cycle flow.
|
|
43
43
|
// 2. recognize as real next node after branches.
|
|
44
44
|
{
|
|
@@ -51,14 +51,7 @@ export default {
|
|
|
51
51
|
interface: 'select',
|
|
52
52
|
type: 'string',
|
|
53
53
|
name: 'type',
|
|
54
|
-
title: '类型'
|
|
55
|
-
// TODO: data for test only now
|
|
56
|
-
dataSource: [
|
|
57
|
-
{ label: '数据处理', value: 'data' },
|
|
58
|
-
{ label: '数据查询', value: 'query' },
|
|
59
|
-
{ label: '等待人工输入', value: 'prompt' },
|
|
60
|
-
{ label: '条件判断', value: 'condition' },
|
|
61
|
-
]
|
|
54
|
+
title: '类型'
|
|
62
55
|
},
|
|
63
56
|
{
|
|
64
57
|
interface: 'json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow_nodes.js","sourceRoot":"","sources":["../../src/collections/flow_nodes.ts"],"names":[],"mappings":"AAEA,eAAe;IACb,IAAI,EAAE,YAAY;IAClB,0BAA0B;IAC1B,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE;QACN;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,IAAI;SACZ;QACD,4BAA4B;QAC5B;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;SAClB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,YAAY;SACrB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,YAAY;YACpB,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,YAAY;SACzB;QACD,mFAAmF;QACnF,mFAAmF;QACnF,6CAA6C;QAC7C;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,cAAc;SACtB;QACD,
|
|
1
|
+
{"version":3,"file":"flow_nodes.js","sourceRoot":"","sources":["../../src/collections/flow_nodes.ts"],"names":[],"mappings":"AAEA,eAAe;IACb,IAAI,EAAE,YAAY;IAClB,0BAA0B;IAC1B,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE;QACN;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,IAAI;SACZ;QACD,4BAA4B;QAC5B;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;SAClB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,YAAY;SACrB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,YAAY;YACpB,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,YAAY;SACzB;QACD,mFAAmF;QACnF,mFAAmF;QACnF,6CAA6C;QAC7C;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,cAAc;SACtB;QACD,qBAAqB;QACrB,6CAA6C;QAC7C,iDAAiD;QACjD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,YAAY;SACrB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;SACZ;QACD;YACE,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,EAAE;SACjB;KACF;CACmB,CAAC","sourcesContent":["import { CollectionOptions } from '@nocobase/database';\n\nexport default {\n name: 'flow_nodes',\n // model: 'FlowNodeModel',\n title: 'Workflow Nodes',\n fields: [\n {\n interface: 'string',\n type: 'string',\n name: 'title',\n title: '名称'\n },\n // which workflow belongs to\n {\n interface: 'linkTo',\n name: 'workflow',\n type: 'belongsTo',\n },\n {\n interface: 'linkTo',\n name: 'upstream',\n type: 'belongsTo',\n target: 'flow_nodes'\n },\n {\n interface: 'linkTo',\n name: 'branches',\n type: 'hasMany',\n target: 'flow_nodes',\n sourceKey: 'id',\n foreignKey: 'upstreamId',\n },\n // only works when upstream node is branching type, such as condition and parallel.\n // put here because the design of flow-links model is not really necessary for now.\n // or it should be put into flow-links model.\n {\n interface: 'select',\n name: 'branchIndex',\n type: 'integer',\n title: 'branch index'\n },\n // Note: for reasons:\n // 1. redirect type node to solve cycle flow.\n // 2. recognize as real next node after branches.\n {\n interface: 'linkTo',\n name: 'downstream',\n type: 'belongsTo',\n target: 'flow_nodes'\n },\n {\n interface: 'select',\n type: 'string',\n name: 'type',\n title: '类型'\n },\n {\n interface: 'json',\n type: 'jsonb',\n name: 'config',\n title: '配置',\n defaultValue: {}\n }\n ]\n} as CollectionOptions;\n"]}
|
|
@@ -16,7 +16,8 @@ export default {
|
|
|
16
16
|
const options = execution.getParsedValue(params);
|
|
17
17
|
const result = yield repo.create(Object.assign(Object.assign({}, options), { transaction: execution.tx }));
|
|
18
18
|
return {
|
|
19
|
-
|
|
19
|
+
// NOTE: get() for non-proxied instance (#380)
|
|
20
|
+
result: result.get(),
|
|
20
21
|
status: JOB_STATUS.RESOLVED
|
|
21
22
|
};
|
|
22
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/instructions/create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,iCAC3B,OAAO,KACV,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,MAAM;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/instructions/create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,iCAC3B,OAAO,KACV,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,8CAA8C;gBAC9C,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE;gBACpB,MAAM,EAAE,UAAU,CAAC,QAAQ;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAA","sourcesContent":["import { JOB_STATUS } from \"../constants\";\nimport FlowNodeModel from \"../models/FlowNode\";\n\nexport default {\n async run(this: FlowNodeModel, input, execution) {\n const {\n collection,\n params = {}\n } = this.config;\n\n const repo = (<typeof FlowNodeModel>this.constructor).database.getRepository(collection);\n const options = execution.getParsedValue(params);\n const result = await repo.create({\n ...options,\n transaction: execution.tx\n });\n\n return {\n // NOTE: get() for non-proxied instance (#380)\n result: result.get(),\n status: JOB_STATUS.RESOLVED\n };\n }\n}\n"]}
|
|
@@ -14,7 +14,11 @@ export default {
|
|
|
14
14
|
const { collection, multiple, params = {} } = this.config;
|
|
15
15
|
const repo = this.constructor.database.getRepository(collection);
|
|
16
16
|
const options = execution.getParsedValue(params);
|
|
17
|
-
const result = yield (multiple ? repo.find : repo.findOne).call(repo, Object.assign(Object.assign({}, options), {
|
|
17
|
+
const result = yield (multiple ? repo.find : repo.findOne).call(repo, Object.assign(Object.assign({}, options), {
|
|
18
|
+
// NOTE: `raw` to avoid getting undefined value from Proxied model instance (#380)
|
|
19
|
+
// e.g. Object.prototype.hasOwnProperty.call(result, 'id') // false
|
|
20
|
+
// so the properties can not be get by json-templates(object-path)
|
|
21
|
+
raw: true, transaction: execution.tx }));
|
|
18
22
|
return {
|
|
19
23
|
result,
|
|
20
24
|
status: JOB_STATUS.RESOLVED
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/instructions/query.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,kCAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/instructions/query.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,kCAC/D,OAAO;gBACV,kFAAkF;gBAClF,mEAAmE;gBACnE,kEAAkE;gBAClE,GAAG,EAAE,IAAI,EACT,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,MAAM;gBACN,MAAM,EAAE,UAAU,CAAC,QAAQ;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC","sourcesContent":["import { JOB_STATUS } from \"../constants\";\nimport FlowNodeModel from \"../models/FlowNode\";\n\nexport default {\n async run(this: FlowNodeModel, input, execution) {\n const {\n collection,\n multiple,\n params = {}\n } = this.config;\n\n const repo = (<typeof FlowNodeModel>this.constructor).database.getRepository(collection);\n const options = execution.getParsedValue(params);\n const result = await (multiple ? repo.find : repo.findOne).call(repo, {\n ...options,\n // NOTE: `raw` to avoid getting undefined value from Proxied model instance (#380)\n // e.g. Object.prototype.hasOwnProperty.call(result, 'id') // false\n // so the properties can not be get by json-templates(object-path)\n raw: true,\n transaction: execution.tx\n });\n\n return {\n result,\n status: JOB_STATUS.RESOLVED\n };\n }\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import ExecutionModel from "../models/Execution";
|
|
1
2
|
import FlowNodeModel from "../models/FlowNode";
|
|
2
3
|
declare const _default: {
|
|
3
|
-
run(this: FlowNodeModel, input: any, execution:
|
|
4
|
+
run(this: FlowNodeModel, input: any, execution: ExecutionModel): Promise<{
|
|
4
5
|
result: import("@nocobase/database").Model<any, any> | import("@nocobase/database").Model<any, any>[];
|
|
5
6
|
status: number;
|
|
6
7
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/instructions/update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/instructions/update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,eAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAyB;;YAC7D,MAAM,EACJ,UAAU,EACV,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,iCAC3B,OAAO,KACV,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;gBAC/C,MAAM,EAAE,UAAU,CAAC,QAAQ;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAA","sourcesContent":["import { JOB_STATUS } from \"../constants\";\nimport ExecutionModel from \"../models/Execution\";\nimport FlowNodeModel from \"../models/FlowNode\";\n\nexport default {\n async run(this: FlowNodeModel, input, execution: ExecutionModel) {\n const {\n collection,\n multiple = false,\n params = {}\n } = this.config;\n\n const repo = (<typeof FlowNodeModel>this.constructor).database.getRepository(collection);\n const options = execution.getParsedValue(params);\n const result = await repo.update({\n ...options,\n transaction: execution.tx\n });\n\n return {\n result: multiple ? result : (result[0] || null),\n status: JOB_STATUS.RESOLVED\n };\n }\n}\n"]}
|
|
@@ -40,7 +40,7 @@ exports.default = {
|
|
|
40
40
|
type: 'integer',
|
|
41
41
|
title: 'branch index'
|
|
42
42
|
},
|
|
43
|
-
// for reasons:
|
|
43
|
+
// Note: for reasons:
|
|
44
44
|
// 1. redirect type node to solve cycle flow.
|
|
45
45
|
// 2. recognize as real next node after branches.
|
|
46
46
|
{
|
|
@@ -53,14 +53,7 @@ exports.default = {
|
|
|
53
53
|
interface: 'select',
|
|
54
54
|
type: 'string',
|
|
55
55
|
name: 'type',
|
|
56
|
-
title: '类型'
|
|
57
|
-
// TODO: data for test only now
|
|
58
|
-
dataSource: [
|
|
59
|
-
{ label: '数据处理', value: 'data' },
|
|
60
|
-
{ label: '数据查询', value: 'query' },
|
|
61
|
-
{ label: '等待人工输入', value: 'prompt' },
|
|
62
|
-
{ label: '条件判断', value: 'condition' },
|
|
63
|
-
]
|
|
56
|
+
title: '类型'
|
|
64
57
|
},
|
|
65
58
|
{
|
|
66
59
|
interface: 'json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow_nodes.js","sourceRoot":"","sources":["../../src/collections/flow_nodes.ts"],"names":[],"mappings":";;AAEA,kBAAe;IACb,IAAI,EAAE,YAAY;IAClB,0BAA0B;IAC1B,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE;QACN;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,IAAI;SACZ;QACD,4BAA4B;QAC5B;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;SAClB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,YAAY;SACrB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,YAAY;YACpB,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,YAAY;SACzB;QACD,mFAAmF;QACnF,mFAAmF;QACnF,6CAA6C;QAC7C;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,cAAc;SACtB;QACD,
|
|
1
|
+
{"version":3,"file":"flow_nodes.js","sourceRoot":"","sources":["../../src/collections/flow_nodes.ts"],"names":[],"mappings":";;AAEA,kBAAe;IACb,IAAI,EAAE,YAAY;IAClB,0BAA0B;IAC1B,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE;QACN;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,IAAI;SACZ;QACD,4BAA4B;QAC5B;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;SAClB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,YAAY;SACrB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,YAAY;YACpB,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,YAAY;SACzB;QACD,mFAAmF;QACnF,mFAAmF;QACnF,6CAA6C;QAC7C;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,cAAc;SACtB;QACD,qBAAqB;QACrB,6CAA6C;QAC7C,iDAAiD;QACjD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,YAAY;SACrB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;SACZ;QACD;YACE,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,EAAE;SACjB;KACF;CACmB,CAAC","sourcesContent":["import { CollectionOptions } from '@nocobase/database';\n\nexport default {\n name: 'flow_nodes',\n // model: 'FlowNodeModel',\n title: 'Workflow Nodes',\n fields: [\n {\n interface: 'string',\n type: 'string',\n name: 'title',\n title: '名称'\n },\n // which workflow belongs to\n {\n interface: 'linkTo',\n name: 'workflow',\n type: 'belongsTo',\n },\n {\n interface: 'linkTo',\n name: 'upstream',\n type: 'belongsTo',\n target: 'flow_nodes'\n },\n {\n interface: 'linkTo',\n name: 'branches',\n type: 'hasMany',\n target: 'flow_nodes',\n sourceKey: 'id',\n foreignKey: 'upstreamId',\n },\n // only works when upstream node is branching type, such as condition and parallel.\n // put here because the design of flow-links model is not really necessary for now.\n // or it should be put into flow-links model.\n {\n interface: 'select',\n name: 'branchIndex',\n type: 'integer',\n title: 'branch index'\n },\n // Note: for reasons:\n // 1. redirect type node to solve cycle flow.\n // 2. recognize as real next node after branches.\n {\n interface: 'linkTo',\n name: 'downstream',\n type: 'belongsTo',\n target: 'flow_nodes'\n },\n {\n interface: 'select',\n type: 'string',\n name: 'type',\n title: '类型'\n },\n {\n interface: 'json',\n type: 'jsonb',\n name: 'config',\n title: '配置',\n defaultValue: {}\n }\n ]\n} as CollectionOptions;\n"]}
|
|
@@ -18,7 +18,8 @@ exports.default = {
|
|
|
18
18
|
const options = execution.getParsedValue(params);
|
|
19
19
|
const result = yield repo.create(Object.assign(Object.assign({}, options), { transaction: execution.tx }));
|
|
20
20
|
return {
|
|
21
|
-
|
|
21
|
+
// NOTE: get() for non-proxied instance (#380)
|
|
22
|
+
result: result.get(),
|
|
22
23
|
status: constants_1.JOB_STATUS.RESOLVED
|
|
23
24
|
};
|
|
24
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/instructions/create.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAA0C;AAG1C,kBAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,iCAC3B,OAAO,KACV,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,MAAM;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/instructions/create.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAA0C;AAG1C,kBAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,iCAC3B,OAAO,KACV,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,8CAA8C;gBAC9C,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE;gBACpB,MAAM,EAAE,sBAAU,CAAC,QAAQ;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAA","sourcesContent":["import { JOB_STATUS } from \"../constants\";\nimport FlowNodeModel from \"../models/FlowNode\";\n\nexport default {\n async run(this: FlowNodeModel, input, execution) {\n const {\n collection,\n params = {}\n } = this.config;\n\n const repo = (<typeof FlowNodeModel>this.constructor).database.getRepository(collection);\n const options = execution.getParsedValue(params);\n const result = await repo.create({\n ...options,\n transaction: execution.tx\n });\n\n return {\n // NOTE: get() for non-proxied instance (#380)\n result: result.get(),\n status: JOB_STATUS.RESOLVED\n };\n }\n}\n"]}
|
|
@@ -16,7 +16,11 @@ exports.default = {
|
|
|
16
16
|
const { collection, multiple, params = {} } = this.config;
|
|
17
17
|
const repo = this.constructor.database.getRepository(collection);
|
|
18
18
|
const options = execution.getParsedValue(params);
|
|
19
|
-
const result = yield (multiple ? repo.find : repo.findOne).call(repo, Object.assign(Object.assign({}, options), {
|
|
19
|
+
const result = yield (multiple ? repo.find : repo.findOne).call(repo, Object.assign(Object.assign({}, options), {
|
|
20
|
+
// NOTE: `raw` to avoid getting undefined value from Proxied model instance (#380)
|
|
21
|
+
// e.g. Object.prototype.hasOwnProperty.call(result, 'id') // false
|
|
22
|
+
// so the properties can not be get by json-templates(object-path)
|
|
23
|
+
raw: true, transaction: execution.tx }));
|
|
20
24
|
return {
|
|
21
25
|
result,
|
|
22
26
|
status: constants_1.JOB_STATUS.RESOLVED
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/instructions/query.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAA0C;AAG1C,kBAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,kCAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/instructions/query.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAA0C;AAG1C,kBAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAS;;YAC7C,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,kCAC/D,OAAO;gBACV,kFAAkF;gBAClF,mEAAmE;gBACnE,kEAAkE;gBAClE,GAAG,EAAE,IAAI,EACT,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,MAAM;gBACN,MAAM,EAAE,sBAAU,CAAC,QAAQ;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC","sourcesContent":["import { JOB_STATUS } from \"../constants\";\nimport FlowNodeModel from \"../models/FlowNode\";\n\nexport default {\n async run(this: FlowNodeModel, input, execution) {\n const {\n collection,\n multiple,\n params = {}\n } = this.config;\n\n const repo = (<typeof FlowNodeModel>this.constructor).database.getRepository(collection);\n const options = execution.getParsedValue(params);\n const result = await (multiple ? repo.find : repo.findOne).call(repo, {\n ...options,\n // NOTE: `raw` to avoid getting undefined value from Proxied model instance (#380)\n // e.g. Object.prototype.hasOwnProperty.call(result, 'id') // false\n // so the properties can not be get by json-templates(object-path)\n raw: true,\n transaction: execution.tx\n });\n\n return {\n result,\n status: JOB_STATUS.RESOLVED\n };\n }\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import ExecutionModel from "../models/Execution";
|
|
1
2
|
import FlowNodeModel from "../models/FlowNode";
|
|
2
3
|
declare const _default: {
|
|
3
|
-
run(this: FlowNodeModel, input: any, execution:
|
|
4
|
+
run(this: FlowNodeModel, input: any, execution: ExecutionModel): Promise<{
|
|
4
5
|
result: import("@nocobase/database").Model<any, any> | import("@nocobase/database").Model<any, any>[];
|
|
5
6
|
status: number;
|
|
6
7
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/instructions/update.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAA0C;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/instructions/update.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAA0C;AAI1C,kBAAe;IACP,GAAG,CAAsB,KAAK,EAAE,SAAyB;;YAC7D,MAAM,EACJ,UAAU,EACV,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,EAAE,EACZ,GAAG,IAAI,CAAC,MAAM,CAAC;YAEhB,MAAM,IAAI,GAA0B,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,iCAC3B,OAAO,KACV,WAAW,EAAE,SAAS,CAAC,EAAE,IACzB,CAAC;YAEH,OAAO;gBACL,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;gBAC/C,MAAM,EAAE,sBAAU,CAAC,QAAQ;aAC5B,CAAC;QACJ,CAAC;KAAA;CACF,CAAA","sourcesContent":["import { JOB_STATUS } from \"../constants\";\nimport ExecutionModel from \"../models/Execution\";\nimport FlowNodeModel from \"../models/FlowNode\";\n\nexport default {\n async run(this: FlowNodeModel, input, execution: ExecutionModel) {\n const {\n collection,\n multiple = false,\n params = {}\n } = this.config;\n\n const repo = (<typeof FlowNodeModel>this.constructor).database.getRepository(collection);\n const options = execution.getParsedValue(params);\n const result = await repo.update({\n ...options,\n transaction: execution.tx\n });\n\n return {\n result: multiple ? result : (result[0] || null),\n status: JOB_STATUS.RESOLVED\n };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-workflow",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.34",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"licenses": [
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@nocobase/actions": "0.7.0-alpha.
|
|
19
|
-
"@nocobase/database": "0.7.0-alpha.
|
|
20
|
-
"@nocobase/server": "0.7.0-alpha.
|
|
21
|
-
"@nocobase/utils": "0.7.0-alpha.
|
|
18
|
+
"@nocobase/actions": "0.7.0-alpha.34",
|
|
19
|
+
"@nocobase/database": "0.7.0-alpha.34",
|
|
20
|
+
"@nocobase/server": "0.7.0-alpha.34",
|
|
21
|
+
"@nocobase/utils": "0.7.0-alpha.34",
|
|
22
22
|
"json-templates": "^4.2.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@nocobase/test": "0.7.0-alpha.
|
|
25
|
+
"@nocobase/test": "0.7.0-alpha.34"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "48b2b4bc7bbc39533e461d34d7f026a4ad1a9b5c"
|
|
28
28
|
}
|