@nocobase/plugin-workflow 0.14.0-alpha.6 → 0.14.0-alpha.7

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.
@@ -79,6 +79,9 @@ declare const _default: {
79
79
  title: string;
80
80
  'x-decorator': string;
81
81
  'x-component': string;
82
+ 'x-component-props': {
83
+ changeOnSelect: boolean;
84
+ };
82
85
  'x-reactions': {
83
86
  dependencies: string[];
84
87
  fulfill: {
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import { ISchema } from '@formily/react';
2
+ import React from 'react';
3
3
  import { SchemaInitializerItemOptions } from '@nocobase/client';
4
4
  import { JOB_STATUS } from '../../constants';
5
5
  type ValueOf<T> = T[keyof T];
@@ -16,7 +16,9 @@ export type FormType = {
16
16
  export type ManualFormType = {
17
17
  title: string;
18
18
  config: {
19
- useInitializer: () => SchemaInitializerItemOptions;
19
+ useInitializer: ({ collections }?: {
20
+ collections: any[];
21
+ }) => SchemaInitializerItemOptions;
20
22
  initializers?: {
21
23
  [key: string]: React.FC;
22
24
  };
@@ -20,6 +20,7 @@ export type OptionsOfUseVariableOptions = {
20
20
  value?: string;
21
21
  children?: string;
22
22
  };
23
+ appends?: string[] | null;
23
24
  };
24
25
  export declare const defaultFieldNames: {
25
26
  readonly label: "label";
@@ -1,24 +1,24 @@
1
1
  module.exports = {
2
2
  "@ant-design/icons": "5.1.4",
3
- "@nocobase/client": "0.14.0-alpha.6",
3
+ "@nocobase/client": "0.14.0-alpha.7",
4
4
  "antd": "5.8.6",
5
5
  "react": "18.2.0",
6
- "@nocobase/utils": "0.14.0-alpha.6",
6
+ "@nocobase/utils": "0.14.0-alpha.7",
7
7
  "react-router-dom": "6.14.1",
8
8
  "react-i18next": "11.18.6",
9
9
  "winston": "3.9.0",
10
- "@nocobase/database": "0.14.0-alpha.6",
11
- "@nocobase/server": "0.14.0-alpha.6",
12
- "@nocobase/logger": "0.14.0-alpha.6",
13
- "@nocobase/evaluators": "0.14.0-alpha.6",
10
+ "@nocobase/database": "0.14.0-alpha.7",
11
+ "@nocobase/server": "0.14.0-alpha.7",
12
+ "@nocobase/logger": "0.14.0-alpha.7",
13
+ "@nocobase/evaluators": "0.14.0-alpha.7",
14
14
  "@formily/react": "2.2.27",
15
15
  "@formily/core": "2.2.27",
16
16
  "@formily/antd-v5": "1.1.0",
17
17
  "lodash": "4.17.21",
18
- "@nocobase/actions": "0.14.0-alpha.6",
18
+ "@nocobase/actions": "0.14.0-alpha.7",
19
19
  "axios": "0.26.1",
20
20
  "sequelize": "6.32.1",
21
21
  "@emotion/css": "11.11.2",
22
22
  "dayjs": "1.11.9",
23
- "@nocobase/resourcer": "0.14.0-alpha.6"
23
+ "@nocobase/resourcer": "0.14.0-alpha.7"
24
24
  };
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2023-09-22T08:39:52.776Z"}
1
+ {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2023-10-07T08:33:03.346Z"}
@@ -1 +1 @@
1
- {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2023-09-22T08:39:52.241Z"}
1
+ {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2023-10-07T08:33:02.747Z"}
@@ -38,7 +38,7 @@ export default class Processor {
38
38
  findBranchParentNode(node: FlowNodeModel): FlowNodeModel | null;
39
39
  findBranchEndNode(node: FlowNodeModel): FlowNodeModel | null;
40
40
  findBranchParentJob(job: JobModel, node: FlowNodeModel): JobModel | null;
41
- findBranchLastJob(node: FlowNodeModel): JobModel | null;
41
+ findBranchLastJob(node: FlowNodeModel, job: JobModel): JobModel | null;
42
42
  getScope(sourceNodeId: number): {
43
43
  $context: any;
44
44
  $jobsMapByNodeId: {
@@ -260,11 +260,18 @@ class Processor {
260
260
  }
261
261
  return null;
262
262
  }
263
- findBranchLastJob(node) {
263
+ findBranchLastJob(node, job) {
264
+ const allJobs = Array.from(this.jobsMap.values());
265
+ const branchJobs = [];
264
266
  for (let n = this.findBranchEndNode(node); n && n !== node.upstream; n = n.upstream) {
265
- const jobs = Array.from(this.jobsMap.values()).filter((item) => item.nodeId === n.id).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
266
- if (jobs.length) {
267
- return jobs[jobs.length - 1];
267
+ branchJobs.push(...allJobs.filter((item) => item.nodeId === n.id));
268
+ }
269
+ branchJobs.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
270
+ for (let i = branchJobs.length - 1; i >= 0; i -= 1) {
271
+ for (let j = branchJobs[i]; j && j.id !== job.id; j = this.jobsMap.get(j.upstreamId)) {
272
+ if (j.upstreamId === job.id) {
273
+ return branchJobs[i];
274
+ }
268
275
  }
269
276
  }
270
277
  return null;
@@ -1,4 +1,5 @@
1
1
  export * from './constants';
2
+ export type * from './instructions';
2
3
  export { Trigger } from './triggers';
3
4
  export { default as Processor } from './Processor';
4
5
  export { default } from './Plugin';
@@ -1,12 +1,12 @@
1
1
  import Plugin from '..';
2
2
  import Processor from '../Processor';
3
3
  import type { FlowNodeModel } from '../types';
4
- export type Job = {
4
+ export interface IJob {
5
5
  status: number;
6
6
  result?: unknown;
7
7
  [key: string]: unknown;
8
- } | null;
9
- export type InstructionResult = Job | Promise<Job>;
8
+ }
9
+ export type InstructionResult = IJob | Promise<IJob> | null;
10
10
  export type Runner = (node: FlowNodeModel, input: any, processor: Processor) => InstructionResult;
11
11
  export interface Instruction {
12
12
  run: Runner;
@@ -58,9 +58,17 @@ async function submit(context, next) {
58
58
  return context.throw(403);
59
59
  }
60
60
  const presetValues = processor.getParsedValue(actionItem.values ?? {}, userJob.nodeId, {
61
+ // @deprecated
61
62
  currentUser: currentUser.toJSON(),
63
+ // @deprecated
62
64
  currentRecord: values.result[formKey],
63
- currentTime: /* @__PURE__ */ new Date()
65
+ // @deprecated
66
+ currentTime: /* @__PURE__ */ new Date(),
67
+ $user: currentUser.toJSON(),
68
+ $nForm: values.result[formKey],
69
+ $nDate: {
70
+ now: /* @__PURE__ */ new Date()
71
+ }
64
72
  });
65
73
  userJob.set({
66
74
  status: actionItem.status,
@@ -89,7 +89,7 @@ var parallel_default = {
89
89
  return previous;
90
90
  }
91
91
  await processor.run(branch, job);
92
- return processor.findBranchLastJob(branch);
92
+ return processor.findBranchLastJob(branch, job);
93
93
  }),
94
94
  Promise.resolve()
95
95
  );
@@ -23,6 +23,7 @@ module.exports = __toCommonJS(form_exports);
23
23
  var import_lodash = require("lodash");
24
24
  var import__ = require(".");
25
25
  var import_database = require("@nocobase/database");
26
+ var import_utils = require("../utils");
26
27
  class FormTrigger extends import__.Trigger {
27
28
  constructor(plugin) {
28
29
  super(plugin);
@@ -93,7 +94,7 @@ class FormTrigger extends import__.Trigger {
93
94
  appends
94
95
  });
95
96
  }
96
- this.plugin.trigger(workflow, { data: payload, user: currentUser });
97
+ this.plugin.trigger(workflow, { data: (0, import_utils.toJSON)(payload), user: (0, import_utils.toJSON)(currentUser) });
97
98
  });
98
99
  } else {
99
100
  const data = trigger[1] ? (0, import_lodash.get)(values, trigger[1]) : values;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": "A powerful workflow plugin designed to support business process management and automation.",
6
6
  "description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
7
- "version": "0.14.0-alpha.6",
7
+ "version": "0.14.0-alpha.7",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "devDependencies": {
@@ -42,5 +42,5 @@
42
42
  "@nocobase/test": "0.x",
43
43
  "@nocobase/utils": "0.x"
44
44
  },
45
- "gitHead": "7f2858222231c207030b57704a0bb6ebc98e4e45"
45
+ "gitHead": "dc958417d27ed0753439bcef192be91a03dfc30f"
46
46
  }