@nocobase/plugin-workflow 1.2.14-alpha → 1.3.0-alpha.20240710141659

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.
@@ -57,10 +57,23 @@ export declare const scopeOptions: {
57
57
  export declare const systemOptions: {
58
58
  label: string;
59
59
  value: string;
60
- useOptions({ types, fieldNames }: UseVariableOptions): {
60
+ useOptions({ types, fieldNames }: UseVariableOptions): ({
61
61
  [x: string]: string;
62
62
  key: string;
63
- }[];
63
+ children?: undefined;
64
+ } | {
65
+ [x: string]: string | {
66
+ key: string;
67
+ value: string;
68
+ label: any;
69
+ }[];
70
+ key: string;
71
+ children: {
72
+ key: string;
73
+ value: string;
74
+ label: any;
75
+ }[];
76
+ })[];
64
77
  };
65
78
  export declare const BaseTypeSets: {
66
79
  boolean: Set<string>;
@@ -11,24 +11,24 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "antd": "5.12.8",
13
13
  "@ant-design/icons": "5.2.6",
14
- "@nocobase/client": "1.2.14-alpha",
14
+ "@nocobase/client": "1.3.0-alpha.20240710141659",
15
15
  "react-router-dom": "6.21.0",
16
- "@nocobase/utils": "1.2.14-alpha",
16
+ "@nocobase/utils": "1.3.0-alpha.20240710141659",
17
17
  "react-i18next": "11.18.6",
18
18
  "@formily/core": "2.3.0",
19
19
  "@formily/react": "2.3.0",
20
20
  "lodash": "4.17.21",
21
- "@nocobase/database": "1.2.14-alpha",
22
- "@nocobase/server": "1.2.14-alpha",
23
- "@nocobase/logger": "1.2.14-alpha",
24
- "@nocobase/evaluators": "1.2.14-alpha",
21
+ "@nocobase/database": "1.3.0-alpha.20240710141659",
22
+ "@nocobase/server": "1.3.0-alpha.20240710141659",
23
+ "@nocobase/logger": "1.3.0-alpha.20240710141659",
24
+ "@nocobase/evaluators": "1.3.0-alpha.20240710141659",
25
25
  "@formily/antd-v5": "1.1.9",
26
26
  "@formily/reactive": "2.3.0",
27
27
  "@formily/shared": "2.3.0",
28
- "@nocobase/actions": "1.2.14-alpha",
29
- "@nocobase/data-source-manager": "1.2.14-alpha",
28
+ "@nocobase/actions": "1.3.0-alpha.20240710141659",
29
+ "dayjs": "1.11.10",
30
+ "@nocobase/data-source-manager": "1.3.0-alpha.20240710141659",
30
31
  "sequelize": "6.35.2",
31
- "@nocobase/plugin-workflow-test": "1.2.14-alpha",
32
- "@nocobase/test": "1.2.14-alpha",
33
- "dayjs": "1.11.10"
32
+ "@nocobase/plugin-workflow-test": "1.3.0-alpha.20240710141659",
33
+ "@nocobase/test": "1.3.0-alpha.20240710141659"
34
34
  };
@@ -87,6 +87,7 @@
87
87
  "System variables": "시스템 변수",
88
88
  "System time": "시스템 시간",
89
89
  "Date variables": "날짜 변수",
90
+ "Date range": "날짜 범위",
90
91
  "Executed at": "실행된 시각",
91
92
  "Queueing": "대기 중",
92
93
  "On going": "진행 중",
@@ -104,6 +104,7 @@
104
104
  "System variables": "系统变量",
105
105
  "System time": "系统时间",
106
106
  "Date variables": "日期变量",
107
+ "Date range": "日期范围",
107
108
 
108
109
  "Executed at": "执行于",
109
110
  "Queueing": "队列中",
@@ -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":"2024-07-11T04:43:31.332Z"}
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":"2024-07-10T14:32:06.563Z"}
@@ -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":"2024-07-11T04:43:30.990Z"}
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":"2024-07-10T14:32:06.208Z"}
@@ -36,6 +36,7 @@ export default class PluginWorkflowServer extends Plugin {
36
36
  private meter;
37
37
  private checker;
38
38
  private onBeforeSave;
39
+ private onSync;
39
40
  /**
40
41
  * @experimental
41
42
  */
@@ -110,6 +110,30 @@ class PluginWorkflowServer extends import_server.Plugin {
110
110
  this.toggle(previous, false);
111
111
  }
112
112
  };
113
+ onSync = async (message) => {
114
+ if (message.type === "statusChange") {
115
+ const workflowId = Number.parseInt(message.workflowId, 10);
116
+ const enabled = Number.parseInt(message.enabled, 10);
117
+ if (enabled) {
118
+ let workflow = this.enabledCache.get(workflowId);
119
+ if (workflow) {
120
+ await workflow.reload();
121
+ } else {
122
+ workflow = await this.db.getRepository("workflows").findOne({
123
+ filterByTk: workflowId
124
+ });
125
+ }
126
+ if (workflow) {
127
+ this.toggle(workflow, true, true);
128
+ }
129
+ } else {
130
+ const workflow = this.enabledCache.get(workflowId);
131
+ if (workflow) {
132
+ this.toggle(workflow, false, true);
133
+ }
134
+ }
135
+ }
136
+ };
113
137
  /**
114
138
  * @experimental
115
139
  */
@@ -222,11 +246,17 @@ class PluginWorkflowServer extends import_server.Plugin {
222
246
  }
223
247
  });
224
248
  db.on("workflows.beforeSave", this.onBeforeSave);
225
- db.on("workflows.afterSave", (model) => this.toggle(model));
226
- db.on("workflows.afterDestroy", (model) => this.toggle(model, false));
249
+ db.on("workflows.afterCreate", (model) => {
250
+ if (model.enabled) {
251
+ this.toggle(model);
252
+ }
253
+ });
254
+ db.on("workflows.afterUpdate", (model) => this.toggle(model));
255
+ db.on("workflows.beforeDestroy", (model) => this.toggle(model, false));
227
256
  this.app.on("afterStart", async () => {
228
257
  this.app.setMaintainingMessage("check for not started executions");
229
258
  this.ready = true;
259
+ this.app.syncManager.subscribe(this.name, this.onSync);
230
260
  const collection = db.getCollection("workflows");
231
261
  const workflows = await collection.repository.find({
232
262
  filter: { enabled: true }
@@ -240,13 +270,10 @@ class PluginWorkflowServer extends import_server.Plugin {
240
270
  this.dispatch();
241
271
  });
242
272
  this.app.on("beforeStop", async () => {
243
- const repository = db.getRepository("workflows");
244
- const workflows = await repository.find({
245
- filter: { enabled: true }
246
- });
247
- workflows.forEach((workflow) => {
273
+ for (const workflow of this.enabledCache.values()) {
248
274
  this.toggle(workflow, false);
249
- });
275
+ }
276
+ this.app.syncManager.unsubscribe("workflow", this.onSync);
250
277
  this.ready = false;
251
278
  if (this.events.length) {
252
279
  await this.prepare();
@@ -259,14 +286,15 @@ class PluginWorkflowServer extends import_server.Plugin {
259
286
  }
260
287
  });
261
288
  }
262
- toggle(workflow, enable) {
289
+ toggle(workflow, enable, silent = false) {
263
290
  const type = workflow.get("type");
264
291
  const trigger = this.triggers.get(type);
265
292
  if (!trigger) {
266
293
  this.getLogger(workflow.id).error(`trigger type ${workflow.type} of workflow ${workflow.id} is not implemented`);
267
294
  return;
268
295
  }
269
- if (enable ?? workflow.get("enabled")) {
296
+ const next = enable ?? workflow.get("enabled");
297
+ if (next) {
270
298
  const prev = workflow.previous();
271
299
  if (prev.config) {
272
300
  trigger.off({ ...workflow.get(), ...prev });
@@ -277,6 +305,13 @@ class PluginWorkflowServer extends import_server.Plugin {
277
305
  trigger.off(workflow);
278
306
  this.enabledCache.delete(workflow.id);
279
307
  }
308
+ if (!silent) {
309
+ this.app.syncManager.publish(this.name, {
310
+ type: "statusChange",
311
+ workflowId: `${workflow.id}`,
312
+ enabled: `${Number(next)}`
313
+ });
314
+ }
280
315
  }
281
316
  trigger(workflow, context, options = {}) {
282
317
  const logger = this.getLogger(workflow.id);
@@ -7,9 +7,11 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
+ var __create = Object.create;
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
13
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
13
15
  var __hasOwnProp = Object.prototype.hasOwnProperty;
14
16
  var __export = (target, all) => {
15
17
  for (var name in all)
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
23
25
  }
24
26
  return to;
25
27
  };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
26
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
37
  var Processor_exports = {};
28
38
  __export(Processor_exports, {
@@ -32,6 +42,7 @@ module.exports = __toCommonJS(Processor_exports);
32
42
  var import_database = require("@nocobase/database");
33
43
  var import_evaluators = require("@nocobase/evaluators");
34
44
  var import_utils = require("@nocobase/utils");
45
+ var import_set = __toESM(require("lodash/set"));
35
46
  var import_constants = require("./constants");
36
47
  class Processor {
37
48
  constructor(execution, options) {
@@ -333,7 +344,7 @@ class Processor {
333
344
  node
334
345
  };
335
346
  for (const [name, fn] of this.options.plugin.functions.getEntities()) {
336
- systemFns[name] = fn.bind(scope);
347
+ (0, import_set.default)(systemFns, name, fn.bind(scope));
337
348
  }
338
349
  const $scopes = {};
339
350
  for (let n = this.findBranchParentNode(node); n; n = this.findBranchParentNode(n)) {
@@ -12,6 +12,29 @@ export type CustomFunction = (this: {
12
12
  execution: ExecutionModel;
13
13
  node?: FlowNodeModel;
14
14
  }) => any;
15
+ export declare const dateRangeFns: {
16
+ yesterday(): any;
17
+ today(): any;
18
+ tomorrow(): any;
19
+ lastWeek(): any;
20
+ thisWeek(): any;
21
+ nextWeek(): any;
22
+ lastMonth(): any;
23
+ thisMonth(): any;
24
+ nextMonth(): any;
25
+ lastQuarter(): any;
26
+ thisQuarter(): any;
27
+ nextQuarter(): any;
28
+ lastYear(): any;
29
+ thisYear(): any;
30
+ nextYear(): any;
31
+ last7Days(): (string | number)[];
32
+ next7Days(): (string | number)[];
33
+ last30Days(): (string | number)[];
34
+ next30Days(): (string | number)[];
35
+ last90Days(): (string | number)[];
36
+ next90Days(): (string | number)[];
37
+ };
15
38
  export default function ({ functions }: Plugin, more?: {
16
39
  [key: string]: CustomFunction;
17
40
  }): void;
@@ -26,15 +26,99 @@ var __copyProps = (to, from, except, desc) => {
26
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
27
  var functions_exports = {};
28
28
  __export(functions_exports, {
29
+ dateRangeFns: () => dateRangeFns,
29
30
  default: () => functions_default
30
31
  });
31
32
  module.exports = __toCommonJS(functions_exports);
33
+ var import_utils = require("@nocobase/utils");
34
+ function getTimezone() {
35
+ const offset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
36
+ const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
37
+ const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
38
+ const sign = offset <= 0 ? "+" : "-";
39
+ return `${sign}${hours}:${minutes}`;
40
+ }
41
+ const getRangeByDay = (offset) => (0, import_utils.utc2unit)({ now: /* @__PURE__ */ new Date(), unit: "day", offset, timezone: getTimezone() });
42
+ const getOffsetFromMS = (start, end) => Math.floor((end - start) / 1e3 / 60 / 60 / 24);
32
43
  function now() {
33
44
  return /* @__PURE__ */ new Date();
34
45
  }
46
+ const dateVars = (0, import_utils.getDateVars)();
47
+ const dateRangeFns = {
48
+ yesterday() {
49
+ return dateVars.yesterday({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
50
+ },
51
+ today() {
52
+ return dateVars.today({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
53
+ },
54
+ tomorrow() {
55
+ return dateVars.tomorrow({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
56
+ },
57
+ lastWeek() {
58
+ return dateVars.lastWeek({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
59
+ },
60
+ thisWeek() {
61
+ return dateVars.thisWeek({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
62
+ },
63
+ nextWeek() {
64
+ return dateVars.nextWeek({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
65
+ },
66
+ lastMonth() {
67
+ return dateVars.lastMonth({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
68
+ },
69
+ thisMonth() {
70
+ return dateVars.thisMonth({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
71
+ },
72
+ nextMonth() {
73
+ return dateVars.nextMonth({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
74
+ },
75
+ lastQuarter() {
76
+ return dateVars.lastQuarter({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
77
+ },
78
+ thisQuarter() {
79
+ return dateVars.thisQuarter({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
80
+ },
81
+ nextQuarter() {
82
+ return dateVars.nextQuarter({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
83
+ },
84
+ lastYear() {
85
+ return dateVars.lastYear({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
86
+ },
87
+ thisYear() {
88
+ return dateVars.thisYear({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
89
+ },
90
+ nextYear() {
91
+ return dateVars.nextYear({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
92
+ },
93
+ last7Days() {
94
+ return dateVars.last7Days({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
95
+ },
96
+ next7Days() {
97
+ return dateVars.next7Days({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
98
+ },
99
+ last30Days() {
100
+ return dateVars.last30Days({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
101
+ },
102
+ next30Days() {
103
+ return dateVars.next30Days({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
104
+ },
105
+ last90Days() {
106
+ return dateVars.last90Days({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
107
+ },
108
+ next90Days() {
109
+ return dateVars.next90Days({ now: /* @__PURE__ */ new Date(), timezone: getTimezone() });
110
+ }
111
+ };
35
112
  function functions_default({ functions }, more = {}) {
36
113
  functions.register("now", now);
114
+ Object.keys(dateRangeFns).forEach((key) => {
115
+ functions.register(`dateRange.${key}`, dateRangeFns[key]);
116
+ });
37
117
  for (const [name, fn] of Object.entries(more)) {
38
118
  functions.register(name, fn);
39
119
  }
40
120
  }
121
+ // Annotate the CommonJS export names for ESM import in node:
122
+ 0 && (module.exports = {
123
+ dateRangeFns
124
+ });
@@ -9,6 +9,7 @@
9
9
  export * from './utils';
10
10
  export * from './constants';
11
11
  export * from './instructions';
12
+ export * from './functions';
12
13
  export { Trigger } from './triggers';
13
14
  export { default as Processor } from './Processor';
14
15
  export { default } from './Plugin';
@@ -45,6 +45,7 @@ module.exports = __toCommonJS(server_exports);
45
45
  __reExport(server_exports, require("./utils"), module.exports);
46
46
  __reExport(server_exports, require("./constants"), module.exports);
47
47
  __reExport(server_exports, require("./instructions"), module.exports);
48
+ __reExport(server_exports, require("./functions"), module.exports);
48
49
  var import_triggers = require("./triggers");
49
50
  var import_Processor = __toESM(require("./Processor"));
50
51
  var import_Plugin = __toESM(require("./Plugin"));
@@ -56,5 +57,6 @@ __reExport(server_exports, require("./types"), module.exports);
56
57
  ...require("./utils"),
57
58
  ...require("./constants"),
58
59
  ...require("./instructions"),
60
+ ...require("./functions"),
59
61
  ...require("./types")
60
62
  });
package/package.json CHANGED
@@ -4,13 +4,13 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
6
6
  "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
7
- "version": "1.2.14-alpha",
7
+ "version": "1.3.0-alpha.20240710141659",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow",
11
11
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
12
12
  "dependencies": {
13
- "@nocobase/plugin-workflow-test": "1.2.14-alpha"
13
+ "@nocobase/plugin-workflow-test": "1.3.0-alpha.20240710141659"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@ant-design/icons": "5.x",
@@ -44,7 +44,7 @@
44
44
  "@nocobase/test": "1.x",
45
45
  "@nocobase/utils": "1.x"
46
46
  },
47
- "gitHead": "717c71eee8cec8d230f1856759d97d6a843f8be6",
47
+ "gitHead": "cb8b234443034da0dfa57dd5d6cca1f3b3db6f08",
48
48
  "keywords": [
49
49
  "Workflow"
50
50
  ]