@nocobase/plugin-workflow-date-calculation 2.0.3

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.
Files changed (47) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +99 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/DateCalculationInstruction.d.ts +162 -0
  6. package/dist/client/constants.d.ts +5 -0
  7. package/dist/client/dateFunctions.d.ts +386 -0
  8. package/dist/client/e189cd1809d7de1b.js +10 -0
  9. package/dist/client/f46a3514e6461e53.js +10 -0
  10. package/dist/client/index.d.ts +7 -0
  11. package/dist/client/index.js +10 -0
  12. package/dist/externalVersion.js +24 -0
  13. package/dist/index.d.ts +11 -0
  14. package/dist/index.js +50 -0
  15. package/dist/locale/de-DE.json +52 -0
  16. package/dist/locale/en-US.json +52 -0
  17. package/dist/locale/es-ES.json +52 -0
  18. package/dist/locale/fr-FR.json +52 -0
  19. package/dist/locale/hu-HU.json +52 -0
  20. package/dist/locale/id-ID.json +52 -0
  21. package/dist/locale/index.d.ts +12 -0
  22. package/dist/locale/index.js +54 -0
  23. package/dist/locale/it-IT.json +52 -0
  24. package/dist/locale/ja-JP.json +52 -0
  25. package/dist/locale/ko-KR.json +52 -0
  26. package/dist/locale/ko_KR.json +47 -0
  27. package/dist/locale/nl-NL.json +52 -0
  28. package/dist/locale/pt-BR.json +52 -0
  29. package/dist/locale/ru-RU.json +52 -0
  30. package/dist/locale/tr-TR.json +52 -0
  31. package/dist/locale/uk-UA.json +52 -0
  32. package/dist/locale/vi-VN.json +52 -0
  33. package/dist/locale/zh-CN.json +52 -0
  34. package/dist/locale/zh-TW.json +52 -0
  35. package/dist/server/DateCalculationInstruction.d.ts +43 -0
  36. package/dist/server/DateCalculationInstruction.js +93 -0
  37. package/dist/server/dateFunction.d.ts +15 -0
  38. package/dist/server/dateFunction.js +205 -0
  39. package/dist/server/index.d.ts +9 -0
  40. package/dist/server/index.js +42 -0
  41. package/dist/server/plugin.d.ts +11 -0
  42. package/dist/server/plugin.js +68 -0
  43. package/dist/utils/index.d.ts +1 -0
  44. package/dist/utils/index.js +39 -0
  45. package/package.json +30 -0
  46. package/server.d.ts +2 -0
  47. package/server.js +1 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Processor, Instruction, FlowNodeModel } from '@nocobase/plugin-workflow';
10
+ import { Registry } from '@nocobase/utils';
11
+ export default class extends Instruction {
12
+ functions: Registry<Function>;
13
+ constructor(workflow: any);
14
+ calculate({ steps, input, inputType }: {
15
+ steps?: any[];
16
+ input?: Date;
17
+ inputType?: string;
18
+ }): {
19
+ result: any;
20
+ status: -2;
21
+ } | {
22
+ result: number | Date;
23
+ status: 1;
24
+ };
25
+ run(node: FlowNodeModel, _: any, processor: Processor): Promise<{
26
+ result: any;
27
+ status: -2;
28
+ } | {
29
+ result: number | Date;
30
+ status: 1;
31
+ }>;
32
+ test({ steps, input, inputType }: {
33
+ steps?: any[];
34
+ input?: Date;
35
+ inputType?: string;
36
+ }): Promise<{
37
+ result: any;
38
+ status: -2;
39
+ } | {
40
+ result: number | Date;
41
+ status: 1;
42
+ }>;
43
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
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
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var DateCalculationInstruction_exports = {};
38
+ __export(DateCalculationInstruction_exports, {
39
+ default: () => DateCalculationInstruction_default
40
+ });
41
+ module.exports = __toCommonJS(DateCalculationInstruction_exports);
42
+ var import_plugin_workflow = require("@nocobase/plugin-workflow");
43
+ var import_dayjs = __toESM(require("dayjs"));
44
+ var import_isLeapYear = __toESM(require("dayjs/plugin/isLeapYear"));
45
+ var import_dateFunction = require("./dateFunction");
46
+ var import__ = require("..");
47
+ var import_utils = require("@nocobase/utils");
48
+ import_dayjs.default.extend(import_isLeapYear.default);
49
+ class DateCalculationInstruction_default extends import_plugin_workflow.Instruction {
50
+ functions = new import_utils.Registry();
51
+ constructor(workflow) {
52
+ super(workflow);
53
+ for (const key in import_dateFunction.functions) {
54
+ this.functions.register(key, import_dateFunction.functions[key]);
55
+ }
56
+ }
57
+ calculate({ steps = [], input = /* @__PURE__ */ new Date(), inputType = "date" }) {
58
+ let result;
59
+ if (inputType === "date" && (0, import__.isDate)(input)) {
60
+ result = (0, import_dayjs.default)(input);
61
+ } else if (inputType === "number" && typeof input === "number") {
62
+ result = input;
63
+ } else {
64
+ return {
65
+ result: "Invalid input",
66
+ status: import_plugin_workflow.JOB_STATUS.ERROR
67
+ };
68
+ }
69
+ for (let i = 0; i < steps.length; i++) {
70
+ const step = steps[i];
71
+ const calculate = this.functions.get(step.function);
72
+ try {
73
+ result = calculate(result, step.arguments);
74
+ } catch (e) {
75
+ return {
76
+ result: e.toString(),
77
+ status: import_plugin_workflow.JOB_STATUS.ERROR
78
+ };
79
+ }
80
+ }
81
+ return {
82
+ result: import_dayjs.default.isDayjs(result) ? result.toDate() : result,
83
+ status: import_plugin_workflow.JOB_STATUS.RESOLVED
84
+ };
85
+ }
86
+ async run(node, _, processor) {
87
+ const { steps = [], input = /* @__PURE__ */ new Date(), inputType = "date" } = processor.getParsedValue(node.config, node.id);
88
+ return this.calculate({ steps, input, inputType });
89
+ }
90
+ async test({ steps = [], input = /* @__PURE__ */ new Date(), inputType = "date" }) {
91
+ return this.calculate({ steps, input, inputType });
92
+ }
93
+ }
@@ -0,0 +1,15 @@
1
+ import dayjs from 'dayjs';
2
+ export declare const functions: {
3
+ add(input: any, args: any): any;
4
+ subtract(input: any, args: any): any;
5
+ diff(input: any, args: any): any;
6
+ get(input: any, args: any): any;
7
+ startOfTime(input: any, args: any): any;
8
+ endOfTime(input: any, args: any): any;
9
+ isLeapYear(input: any, args: any): any;
10
+ format(input: any, args: any): any;
11
+ transDuration(input: any, args: any): any;
12
+ toTimestamp(input: any, args: any): any;
13
+ tsToDate(input: any, args: any): dayjs.Dayjs;
14
+ changeTimezone(input: any, args: any): any;
15
+ };
@@ -0,0 +1,205 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
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
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var dateFunction_exports = {};
38
+ __export(dateFunction_exports, {
39
+ functions: () => functions
40
+ });
41
+ module.exports = __toCommonJS(dateFunction_exports);
42
+ var import_dayjs = __toESM(require("dayjs"));
43
+ var import_duration = __toESM(require("dayjs/plugin/duration"));
44
+ var import_quarterOfYear = __toESM(require("dayjs/plugin/quarterOfYear"));
45
+ var import__ = require("..");
46
+ import_dayjs.default.extend(import_duration.default);
47
+ import_dayjs.default.extend(import_quarterOfYear.default);
48
+ const methodsMap = {
49
+ year: "asYears",
50
+ month: "asMonths",
51
+ week: "asWeeks",
52
+ day: "asDays",
53
+ hour: "asHours",
54
+ minute: "asMinutes",
55
+ second: "asSeconds",
56
+ millisecond: "asMilliseconds"
57
+ };
58
+ const getMethodsMap = {
59
+ year: "year",
60
+ month: "month",
61
+ quarter: "quarter",
62
+ week: "day",
63
+ day: "date",
64
+ hour: "hour",
65
+ minute: "minute",
66
+ second: "second",
67
+ millisecond: "millisecond"
68
+ };
69
+ const transDurationMethodsMap = {
70
+ year: "years",
71
+ month: "months",
72
+ week: "weeks",
73
+ day: "days",
74
+ hour: "hours",
75
+ minute: "minutes",
76
+ second: "seconds",
77
+ millisecond: "milliseconds"
78
+ };
79
+ const startOfTimeMethodsMap = {
80
+ year: "year",
81
+ quarter: "quarter",
82
+ month: "month",
83
+ week: "isoWeek",
84
+ day: "day",
85
+ hour: "hour",
86
+ minute: "minute",
87
+ second: "second",
88
+ millisecond: "millisecond"
89
+ };
90
+ const endOfTimeMethodsMap = {
91
+ year: "year",
92
+ quarter: "quarter",
93
+ month: "month",
94
+ week: "isoWeek",
95
+ day: "day",
96
+ hour: "hour",
97
+ minute: "minute",
98
+ second: "second",
99
+ millisecond: "millisecond"
100
+ };
101
+ const timestampUnitFnsMap = {
102
+ second: "unix",
103
+ millisecond: "valueOf"
104
+ };
105
+ const functions = {
106
+ add(input, args) {
107
+ const { number, unit } = args;
108
+ return input.add(number, unit);
109
+ },
110
+ subtract(input, args) {
111
+ const { number, unit } = args;
112
+ return input.subtract(number, unit);
113
+ },
114
+ diff(input, args) {
115
+ const { date, unit, isAbs, round } = args;
116
+ if (!(0, import__.isDate)(date)) {
117
+ throw new Error(`Diff date [${date}] is not a valid date`);
118
+ }
119
+ const diffDay = (0, import_dayjs.default)(date);
120
+ let diff = input.diff(diffDay, unit, true);
121
+ if (isAbs) {
122
+ diff = Math.abs(diff);
123
+ }
124
+ if (round === -1) {
125
+ diff = Math.floor(diff);
126
+ } else if (round === 0) {
127
+ diff = Math.round(diff);
128
+ } else if (round === 1) {
129
+ diff = Math.ceil(diff);
130
+ }
131
+ return diff;
132
+ },
133
+ get(input, args) {
134
+ const { unit } = args;
135
+ const method = getMethodsMap[unit];
136
+ if (!method) {
137
+ return input.millisecond();
138
+ }
139
+ if (input[method]) {
140
+ const result = input[method]();
141
+ return unit === "month" ? result + 1 : result;
142
+ }
143
+ return input;
144
+ },
145
+ startOfTime(input, args) {
146
+ const { unit } = args;
147
+ return input.startOf(startOfTimeMethodsMap[unit]);
148
+ },
149
+ endOfTime(input, args) {
150
+ const { unit } = args;
151
+ return input.endOf(endOfTimeMethodsMap[unit]);
152
+ },
153
+ isLeapYear(input, args) {
154
+ return input.isLeapYear();
155
+ },
156
+ format(input, args) {
157
+ const { format } = args;
158
+ if (typeof format !== "string") {
159
+ throw new TypeError(`[${format}] is not a string`);
160
+ }
161
+ return input.format(format);
162
+ },
163
+ transDuration(input, args) {
164
+ const { unitBefore, unitAfter, round } = args;
165
+ if (!transDurationMethodsMap[unitBefore]) {
166
+ throw new TypeError(`[${unitBefore}] is not a unit string`);
167
+ }
168
+ if (!methodsMap[unitAfter]) {
169
+ throw new TypeError(`[${unitAfter}] is not a unit string`);
170
+ }
171
+ const duration2 = import_dayjs.default.duration(input, transDurationMethodsMap[unitBefore]);
172
+ let result = duration2[methodsMap[unitAfter]]();
173
+ if (round === -1) {
174
+ result = Math.floor(result);
175
+ } else if (round === 0) {
176
+ result = Math.round(result);
177
+ } else if (round === 1) {
178
+ result = Math.ceil(result);
179
+ }
180
+ return result;
181
+ },
182
+ toTimestamp(input, args) {
183
+ const { unit = "second" } = args;
184
+ const method = timestampUnitFnsMap[unit];
185
+ if (!method) {
186
+ throw new TypeError(`[${unit}] is not valid, only accept second or millisecond`);
187
+ }
188
+ return input[method]();
189
+ },
190
+ tsToDate(input, args) {
191
+ const { unit = "second" } = args;
192
+ if (!["second", "millisecond"].includes(unit)) {
193
+ throw new TypeError(`[${unit}] is not valid, only accept second or millisecond`);
194
+ }
195
+ return unit === "second" ? import_dayjs.default.unix(input) : (0, import_dayjs.default)(input);
196
+ },
197
+ changeTimezone(input, args) {
198
+ const { timezone } = args;
199
+ return input.tz(timezone);
200
+ }
201
+ };
202
+ // Annotate the CommonJS export names for ESM import in node:
203
+ 0 && (module.exports = {
204
+ functions
205
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export { default } from './plugin';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
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
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var server_exports = {};
38
+ __export(server_exports, {
39
+ default: () => import_plugin.default
40
+ });
41
+ module.exports = __toCommonJS(server_exports);
42
+ var import_plugin = __toESM(require("./plugin"));
@@ -0,0 +1,11 @@
1
+ import { Plugin } from '@nocobase/server';
2
+ export declare class PluginWorkflowDateCalculationServer extends Plugin {
3
+ afterAdd(): Promise<void>;
4
+ beforeLoad(): Promise<void>;
5
+ load(): Promise<void>;
6
+ install(): Promise<void>;
7
+ afterEnable(): Promise<void>;
8
+ afterDisable(): Promise<void>;
9
+ remove(): Promise<void>;
10
+ }
11
+ export default PluginWorkflowDateCalculationServer;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
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
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var plugin_exports = {};
38
+ __export(plugin_exports, {
39
+ PluginWorkflowDateCalculationServer: () => PluginWorkflowDateCalculationServer,
40
+ default: () => plugin_default
41
+ });
42
+ module.exports = __toCommonJS(plugin_exports);
43
+ var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
44
+ var import_server = require("@nocobase/server");
45
+ var import_DateCalculationInstruction = __toESM(require("./DateCalculationInstruction"));
46
+ class PluginWorkflowDateCalculationServer extends import_server.Plugin {
47
+ async afterAdd() {
48
+ }
49
+ async beforeLoad() {
50
+ }
51
+ async load() {
52
+ const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
53
+ workflowPlugin.registerInstruction("dateCalculation", import_DateCalculationInstruction.default);
54
+ }
55
+ async install() {
56
+ }
57
+ async afterEnable() {
58
+ }
59
+ async afterDisable() {
60
+ }
61
+ async remove() {
62
+ }
63
+ }
64
+ var plugin_default = PluginWorkflowDateCalculationServer;
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ PluginWorkflowDateCalculationServer
68
+ });
@@ -0,0 +1 @@
1
+ export declare function isDate(value: any): boolean;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var utils_exports = {};
28
+ __export(utils_exports, {
29
+ isDate: () => isDate
30
+ });
31
+ module.exports = __toCommonJS(utils_exports);
32
+ function isDate(value) {
33
+ const date = new Date(value);
34
+ return date.toString() !== "Invalid Date";
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ isDate
39
+ });
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@nocobase/plugin-workflow-date-calculation",
3
+ "displayName": "Workflow: date calculation node",
4
+ "displayName.zh-CN": "工作流: 日期计算节点",
5
+ "description": "Used to do date calculation in workflows, such as manipulating, comparing and formatting, etc.",
6
+ "description.zh-CN": "可用于在工作流中对日期进行操作求值,如加减、比较操作,格式化等。",
7
+ "version": "2.0.3",
8
+ "main": "dist/server/index.js",
9
+ "devDependencies": {
10
+ "moment-timezone": "0.5.48"
11
+ },
12
+ "nocobase": {
13
+ "supportedVersions": [
14
+ "1.x",
15
+ "2.x"
16
+ ],
17
+ "editionLevel": 0
18
+ },
19
+ "peerDependencies": {
20
+ "@nocobase/client": "2.x",
21
+ "@nocobase/plugin-workflow": "2.x",
22
+ "@nocobase/server": "2.x",
23
+ "@nocobase/test": "2.x"
24
+ },
25
+ "keywords": [
26
+ "Workflow"
27
+ ],
28
+ "license": "Apache-2.0",
29
+ "gitHead": "5bcb42fc092f85adb9511c1a351b388bd7aaf66e"
30
+ }
package/server.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/server';
2
+ export { default } from './dist/server';
package/server.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/server/index.js');