@nocobase/plugin-workflow 1.3.38-beta → 1.4.0-alpha
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/components/Calculation.d.ts +16 -0
- package/dist/client/components/Fieldset.d.ts +10 -0
- package/dist/client/components/index.d.ts +3 -0
- package/dist/client/index.js +32 -30
- package/dist/client/nodes/condition.d.ts +1 -6
- package/dist/client/nodes/index.d.ts +2 -3
- package/dist/client/nodes/query.d.ts +0 -1
- package/dist/client/schemas/collection.d.ts +0 -1
- package/dist/externalVersion.js +10 -10
- package/dist/locale/ja-JP.json +113 -4
- package/dist/locale/zh-CN.json +4 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/Plugin.js +2 -1
- package/dist/server/Processor.d.ts +6 -5
- package/dist/server/Processor.js +5 -7
- package/dist/server/actions/index.js +2 -1
- package/dist/server/actions/nodes.d.ts +1 -0
- package/dist/server/actions/nodes.js +31 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +2 -0
- package/dist/server/instructions/ConditionInstruction.d.ts +0 -3
- package/dist/server/instructions/ConditionInstruction.js +3 -77
- package/dist/server/instructions/index.d.ts +1 -0
- package/dist/server/logicCalculate.d.ts +24 -0
- package/dist/server/logicCalculate.js +118 -0
- package/package.json +3 -3
- package/dist/locale/ja_JP.json +0 -189
- /package/dist/locale/{ko_KR.json → ko-KR.json} +0 -0
|
@@ -10,11 +10,7 @@ import React from 'react';
|
|
|
10
10
|
import { Instruction } from '.';
|
|
11
11
|
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
12
12
|
import { useWorkflowVariableOptions, WorkflowVariableTextArea } from '../variable';
|
|
13
|
-
|
|
14
|
-
declare function CalculationConfig({ value, onChange }: {
|
|
15
|
-
value: any;
|
|
16
|
-
onChange: any;
|
|
17
|
-
}): React.JSX.Element;
|
|
13
|
+
import { CalculationConfig } from '../components/Calculation';
|
|
18
14
|
export default class extends Instruction {
|
|
19
15
|
title: string;
|
|
20
16
|
type: string;
|
|
@@ -105,4 +101,3 @@ export default class extends Instruction {
|
|
|
105
101
|
data: any;
|
|
106
102
|
}): React.JSX.Element;
|
|
107
103
|
}
|
|
108
|
-
export {};
|
|
@@ -30,9 +30,7 @@ export declare abstract class Instruction {
|
|
|
30
30
|
value: any;
|
|
31
31
|
key: string;
|
|
32
32
|
}[];
|
|
33
|
-
fieldset:
|
|
34
|
-
[key: string]: ISchema;
|
|
35
|
-
};
|
|
33
|
+
fieldset: Record<string, ISchema>;
|
|
36
34
|
/**
|
|
37
35
|
* @experimental
|
|
38
36
|
*/
|
|
@@ -56,6 +54,7 @@ export declare abstract class Instruction {
|
|
|
56
54
|
*/
|
|
57
55
|
isAvailable?(ctx: NodeAvailableContext): boolean;
|
|
58
56
|
end?: boolean | ((node: any) => boolean);
|
|
57
|
+
testable?: boolean;
|
|
59
58
|
}
|
|
60
59
|
export declare const NodeContext: React.Context<any>;
|
|
61
60
|
export declare function useNodeContext(): any;
|
package/dist/externalVersion.js
CHANGED
|
@@ -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.
|
|
14
|
+
"@nocobase/client": "1.4.0-alpha",
|
|
15
15
|
"react-router-dom": "6.21.0",
|
|
16
|
-
"@nocobase/utils": "1.
|
|
16
|
+
"@nocobase/utils": "1.4.0-alpha",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
18
|
"@formily/core": "2.3.0",
|
|
19
19
|
"@formily/react": "2.3.0",
|
|
20
20
|
"@formily/shared": "2.3.0",
|
|
21
21
|
"lodash": "4.17.21",
|
|
22
|
-
"@nocobase/database": "1.
|
|
23
|
-
"@nocobase/server": "1.
|
|
24
|
-
"@nocobase/logger": "1.
|
|
25
|
-
"@nocobase/evaluators": "1.
|
|
22
|
+
"@nocobase/database": "1.4.0-alpha",
|
|
23
|
+
"@nocobase/server": "1.4.0-alpha",
|
|
24
|
+
"@nocobase/logger": "1.4.0-alpha",
|
|
25
|
+
"@nocobase/evaluators": "1.4.0-alpha",
|
|
26
26
|
"@formily/antd-v5": "1.1.9",
|
|
27
27
|
"@formily/reactive": "2.3.0",
|
|
28
|
-
"@nocobase/actions": "1.
|
|
28
|
+
"@nocobase/actions": "1.4.0-alpha",
|
|
29
29
|
"dayjs": "1.11.10",
|
|
30
|
-
"@nocobase/data-source-manager": "1.
|
|
30
|
+
"@nocobase/data-source-manager": "1.4.0-alpha",
|
|
31
31
|
"sequelize": "6.35.2",
|
|
32
|
-
"@nocobase/plugin-workflow-test": "1.
|
|
33
|
-
"@nocobase/test": "1.
|
|
32
|
+
"@nocobase/plugin-workflow-test": "1.4.0-alpha",
|
|
33
|
+
"@nocobase/test": "1.4.0-alpha"
|
|
34
34
|
};
|
package/dist/locale/ja-JP.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Workflow": "ワークフロー",
|
|
3
3
|
"Execution history": "実行履歴",
|
|
4
|
+
"Executed": "実行済み",
|
|
4
5
|
"Trigger type": "トリガータイプ",
|
|
5
6
|
"Status": "状態",
|
|
6
7
|
"On": "有効",
|
|
7
8
|
"Off": "無効",
|
|
8
9
|
"Version": "バージョン",
|
|
9
10
|
"Copy to new version": "新しいバージョンにコピー",
|
|
11
|
+
"Duplicate": "複製",
|
|
12
|
+
"Loading": "読み込み中",
|
|
10
13
|
"Load failed": "読み込みに失敗しました",
|
|
11
14
|
"Trigger": "トリガー",
|
|
15
|
+
"Trigger variables": "トリガーフィールド",
|
|
16
|
+
"Trigger data": "トリガーデータ",
|
|
17
|
+
"Trigger time": "トリガー時間",
|
|
18
|
+
"Triggered at": "トリガー発生時",
|
|
12
19
|
"Collection event": "コレクションイベント",
|
|
13
20
|
"Trigger on": "トリガータイミング",
|
|
14
21
|
"After record added": "レコードを追加した後",
|
|
@@ -24,6 +31,7 @@
|
|
|
24
31
|
"Based on date field of collection": "コレクションのフィールド時間に基づく",
|
|
25
32
|
"Starts on": "開始",
|
|
26
33
|
"Ends on": "終了",
|
|
34
|
+
"No end": "終了なし",
|
|
27
35
|
"Exactly at": "ちょうど",
|
|
28
36
|
"Repeat mode": "繰り返しパターン",
|
|
29
37
|
"Repeat limit": "繰り返し回数",
|
|
@@ -45,26 +53,32 @@
|
|
|
45
53
|
"By custom date": "カスタム時間",
|
|
46
54
|
"Advanced": "アドバンスド",
|
|
47
55
|
"End": "終了",
|
|
48
|
-
"Trigger variables": "トリガーフィールド",
|
|
49
56
|
"Node result": "ノードの結果",
|
|
50
57
|
"Constant": "定数",
|
|
58
|
+
"Null": "ヌル",
|
|
51
59
|
"Boolean": "論理値",
|
|
52
60
|
"String": "文字列",
|
|
61
|
+
"Operator": "演算子",
|
|
53
62
|
"Arithmetic calculation": "算術演算",
|
|
54
63
|
"String operation": "文字列操作",
|
|
64
|
+
"Executed at": "実行時刻",
|
|
65
|
+
"Queueing": "キュー中",
|
|
55
66
|
"On going": "処理中",
|
|
56
67
|
"Succeeded": "成功",
|
|
57
68
|
"Failed": "失敗",
|
|
69
|
+
"Pending": "保留中",
|
|
58
70
|
"Canceled": "取消",
|
|
59
71
|
"This node contains branches, deleting will also be preformed to them, are you sure?": "ノードにはブランチが含まれており、そのすべてのブランチの下にあるすべての子ノードが同時に削除されます。続行してもよろしいですか?",
|
|
60
72
|
"Control": "プロセス制御",
|
|
61
73
|
"Collection operations": "フィールド操作",
|
|
74
|
+
"Extended types": "拡張タイプ",
|
|
62
75
|
"Node type": "ノードタイプ",
|
|
63
76
|
"Calculation": "演算",
|
|
64
77
|
"Configure calculation": "演算設定",
|
|
65
78
|
"Calculation result": "演算結果",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
79
|
+
"true": "真",
|
|
80
|
+
"false": "偽",
|
|
81
|
+
"concat": "連結",
|
|
68
82
|
"Condition": "条件",
|
|
69
83
|
"Mode": "モデル",
|
|
70
84
|
"Continue when \"Yes\"": "「はい」の場合に続行",
|
|
@@ -78,5 +92,100 @@
|
|
|
78
92
|
"Only update records matching conditions": "条件を満たすレコードのみ更新",
|
|
79
93
|
"Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.": "値が割り当てられていないフィールドはデフォルト値に設定され、デフォルト値がないフィールドは null に設定されます",
|
|
80
94
|
"Trigger in executed workflow cannot be modified": "すでにワークフローを実行したトリガーは変更できません",
|
|
81
|
-
"Node in executed workflow cannot be modified": "すでに実行されたワークフローのノードは変更できません"
|
|
95
|
+
"Node in executed workflow cannot be modified": "すでに実行されたワークフローのノードは変更できません",
|
|
96
|
+
"Can not delete": "削除できません",
|
|
97
|
+
"The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.": "このノードの結果は他のノードで参照されています({{nodes}})。削除する前に使用を解除してください。",
|
|
98
|
+
"Clear all executions": "すべての実行履歴を消去",
|
|
99
|
+
"Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?": "実行履歴を消去しても、実行回数はリセットされず、実行中のものも削除されません。すべての実行履歴を削除してもよろしいですか?",
|
|
100
|
+
"Sync": "同期",
|
|
101
|
+
"Sync enabled status of all workflows from database": "データベースからすべてのワークフローの有効状態を同期します",
|
|
102
|
+
"Duplicate to new workflow": "新しいワークフローにコピー",
|
|
103
|
+
"Delete a main version will cause all other revisions to be deleted too.": "メインバージョンを削除すると、他のすべてのリビジョンも同時に削除されます。",
|
|
104
|
+
"Use transaction": "トランザクションを有効にする",
|
|
105
|
+
"Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.": "ワークフロー内のノードは同じトランザクションで実行されます。失敗するとデータがロールバックされ、実行履歴もロールバックされます。",
|
|
106
|
+
"Auto delete history when execution is on end status": "実行が終了すると対応するステータスの履歴が自動的に削除されます。",
|
|
107
|
+
"Unknown trigger": "不明なトリガー",
|
|
108
|
+
"Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.": "不明なタイプのワークフローはエラーを引き起こします。このタイプを提供するプラグインを削除するか確認してください。",
|
|
109
|
+
"Execute mode": "実行モード",
|
|
110
|
+
"Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.": "トリガータイプに基づいてワークフローを非同期または同期的に実行し、作成後は変更できません。",
|
|
111
|
+
"Asynchronously": "非同期",
|
|
112
|
+
"Synchronously": "同期的に",
|
|
113
|
+
"Will be executed in the background as a queued task.": "キュータスクとしてバックグラウンドで実行されます。",
|
|
114
|
+
"For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.": "即時のフィードバックを必要とするユーザー操作に適しています。このモードでは非同期ノードを使用できず、同期モードで時間のかかる操作を実行することは推奨されません。",
|
|
115
|
+
"Go back": "戻る",
|
|
116
|
+
"Bind workflows": "ワークフローをバインドする",
|
|
117
|
+
"Workflow will be triggered before or after submitting succeeded based on workflow type (supports pre/post action event in local mode, and approval event).": "ワークフローは、送信が成功する前または後に、ワークフローの種類に基づいてトリガーされます(ローカルモードでのアクション前後のイベントと承認イベントをサポート)。",
|
|
118
|
+
"Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "ボタンをクリックするとデータを保存せずにワークフローが直接トリガーされます。「カスタムアクションイベント」にのみバインドできます。",
|
|
119
|
+
"Submit to workflow to \"Post-action event\" is deprecated, please use \"Custom action event\" instead.": "「ポストアクションイベント」にワークフローを送信することは廃止されましたので、「カスタムアクションイベント」を使用してください。",
|
|
120
|
+
"Workflow will be triggered before deleting succeeded (only supports pre-action event in local mode).": "削除が成功する前にワークフローがトリガーされます(ローカルモードではアクション前イベントのみサポート)。",
|
|
121
|
+
"Submit to workflow": "ワークフローに送信する",
|
|
122
|
+
"Add workflow": "ワークフローを追加",
|
|
123
|
+
"Select workflow": "ワークフローを選択",
|
|
124
|
+
"Trigger data context": "データコンテキストをトリガー",
|
|
125
|
+
"Full form data": "全てのフォームデータ",
|
|
126
|
+
"Select context": "コンテキストを選択",
|
|
127
|
+
"Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike \"Post-action event\", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use \"Post-action event\".": "コレクション内でデータが変更されたときにトリガーされます。たとえば、レコードの追加、更新、または削除後です。「ポストアクションイベント」とは異なり、コレクションイベントはHTTPリクエストではなくデータ変更を監視します。意味を理解していない限り、「ポストアクションイベント」の使用を推奨します。",
|
|
128
|
+
"Preload associations": "関連データを事前読み込み",
|
|
129
|
+
"Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.": "次のノードでアクセスする必要がある関連フィールドを選択してください。二つ以上の多対多の関連はパフォーマンス問題を引き起こす可能性があるため、注意して使用してください。",
|
|
130
|
+
"Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.": "あらかじめ設定された時間条件に従ってトリガーされます。通知の送信やデータの定期清掃など、一度限りまたは周期的なタスクに適しています。",
|
|
131
|
+
"Variable key of node": "ノードの変数キー",
|
|
132
|
+
"Scope variables": "スコープ変数",
|
|
133
|
+
"Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.": "計算エンジンを使用して式を計算し、その結果として値を取得します。式には、上流ノードの変数を使用できます。",
|
|
134
|
+
"System variables": "システム変数",
|
|
135
|
+
"System time": "システム時間",
|
|
136
|
+
"Date variables": "日付変数",
|
|
137
|
+
"Date range": "日付範囲",
|
|
138
|
+
"Resolved": "解決済み",
|
|
139
|
+
"Error": "エラー",
|
|
140
|
+
"Aborted": "中止",
|
|
141
|
+
"Rejected": "拒否された",
|
|
142
|
+
"Retry needed": "再試行が必要",
|
|
143
|
+
"View result": "結果を表示",
|
|
144
|
+
"Triggered but still waiting in queue to execute.": "トリガーされましたが、まだキューに実行待ちの状態です。",
|
|
145
|
+
"Started and executing, maybe waiting for an async callback (manual, delay etc.).": "開始され、実行中です。非同期コールバック(手動、遅延など)を待っている可能性があります。",
|
|
146
|
+
"Successfully finished.": "正常に完了しました。",
|
|
147
|
+
"Failed to satisfy node configurations.": "ノード構成が満たされず失敗しました。",
|
|
148
|
+
"Some node meets error.": "いくつかのノードでエラーが発生しました。",
|
|
149
|
+
"Running of some node was aborted by program flow.": "プログラムフローにより、いくつかのノードが中止されました。",
|
|
150
|
+
"Manually canceled whole execution when waiting.": "待機中に手動で全体の実行がキャンセルされました。",
|
|
151
|
+
"Rejected from a manual node.": "手動ノードで拒否されました。",
|
|
152
|
+
"General failed but should do another try.": "一般的な失敗ですが、再試行が必要です。",
|
|
153
|
+
"Cancel the execution": "実行をキャンセル",
|
|
154
|
+
"Are you sure you want to cancel the execution?": "実行をキャンセルしてもよろしいですか?",
|
|
155
|
+
"Operations": "操作",
|
|
156
|
+
"Manual": "手動",
|
|
157
|
+
"Unknown node": "不明なノード",
|
|
158
|
+
"Node with unknown type will cause error. Please delete it or check plugin which provide this type.": "不明なタイプのノードはエラーを引き起こします。このタイプを提供するプラグインを削除するか確認してください。",
|
|
159
|
+
"Calculation engine": "計算エンジン",
|
|
160
|
+
"Basic": "基本",
|
|
161
|
+
"Calculation expression": "計算式",
|
|
162
|
+
"Expression syntax error": "式の文法エラー",
|
|
163
|
+
"Syntax references: ": "文法リファレンス:",
|
|
164
|
+
"Based on boolean result of the calculation to determine whether to \"continue\" or \"exit\" the process, or continue on different branches of \"yes\" and \"no\".": "計算結果の真偽に基づき、プロセスを「続行」または「終了」するか、「はい」と「いいえ」の異なる分岐で続行します。",
|
|
165
|
+
"Condition expression": "条件式",
|
|
166
|
+
"Add new record to a collection. You can use variables from upstream nodes to assign values to fields.": "コレクションに新しいレコードを追加します。上流ノードの変数を使用してフィールドに値を割り当てることができます。",
|
|
167
|
+
"Update records of a collection. You can use variables from upstream nodes as query conditions and field values.": "コレクションのレコードを更新します。上流ノードの変数を使用してクエリ条件やフィールド値を指定できます。",
|
|
168
|
+
"Update mode": "更新モード",
|
|
169
|
+
"Update in a batch": "一括更新",
|
|
170
|
+
"Update one by one": "個別更新",
|
|
171
|
+
"Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.": "対象データを一括で更新します。データ量が多い場合にパフォーマンスが向上します。ただし、更新されたデータは他のワークフローをトリガーせず、監査ログも記録しません。",
|
|
172
|
+
"The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.": "更新されたデータは他のワークフローをトリガーでき、監査ログも記録されます。ただし、通常は数件から数十件のデータにしか適用されず、それ以上の量ではパフォーマンスの問題が発生する可能性があります。",
|
|
173
|
+
"Query records from a collection. You can use variables from upstream nodes as query conditions.": "コレクションからレコードをクエリします。上流ノードの変数をクエリ条件として使用できます。",
|
|
174
|
+
"Allow multiple records as result": "複数のレコードを結果として許可",
|
|
175
|
+
"If checked, when there are multiple records in the query result, an array will be returned as the result, which can be operated on one by one using a loop node. Otherwise, only one record will be returned.": "チェックされた場合、クエリ結果に複数のレコードが含まれる場合、配列が結果として返されます。これをループノードで1つずつ処理できます。チェックされない場合、1つのレコードだけが返されます。",
|
|
176
|
+
"Result type": "結果タイプ",
|
|
177
|
+
"Single record": "単一レコード",
|
|
178
|
+
"The result will be an object of the first matching record only, or null if no matched record.": "結果は最初に一致したレコードのオブジェクトであり、一致するレコードがない場合はnullが返されます。",
|
|
179
|
+
"The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.": "結果は一致するレコードを含む配列となり、一致するレコードがない場合は空の配列が返されます。これをループノードで処理できます。",
|
|
180
|
+
"Exit when query result is null": "クエリ結果がnullの場合、終了する",
|
|
181
|
+
"Please add at least one condition": "少なくとも1つの条件を追加してください",
|
|
182
|
+
"Unassigned fields will be set to default values, and those without default values will be set to null.": "未割り当てのフィールドはデフォルト値に設定され、デフォルト値がない場合はnullに設定されます。",
|
|
183
|
+
"Delete record": "レコードを削除",
|
|
184
|
+
"Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.": "コレクション内のレコードを削除します。ワークフローのコンテキストで変数をフィルターとして使用できます。フィルター条件に一致するすべてのレコードが削除されます。",
|
|
185
|
+
"Executed workflow cannot be modified. Could be copied to a new version to modify.": "実行済みのワークフローは変更できません。新しいバージョンにコピーして変更できます。",
|
|
186
|
+
"End process": "プロセスを終了",
|
|
187
|
+
"End the process immediately, with set status.": "設定されたステータスでプロセスを即時終了します。",
|
|
188
|
+
"End status": "終了ステータス",
|
|
189
|
+
"True": "真",
|
|
190
|
+
"False": "偽"
|
|
82
191
|
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -203,5 +203,8 @@
|
|
|
203
203
|
"End process": "结束流程",
|
|
204
204
|
"End the process immediately, with set status.": "以设置的状态立即结束流程。",
|
|
205
205
|
"End status": "结束状态",
|
|
206
|
-
"Succeeded": "成功"
|
|
206
|
+
"Succeeded": "成功",
|
|
207
|
+
"Test run": "测试执行",
|
|
208
|
+
"Test run will do the actual data manipulating or API calling, please use with caution.": "测试执行会进行实际的数据操作或 API 调用,请谨慎使用。",
|
|
209
|
+
"No variable": "无变量"
|
|
207
210
|
}
|
|
@@ -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-10-
|
|
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-10-24T14:10:21.363Z"}
|
|
@@ -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-10-
|
|
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-10-24T14:10:20.984Z"}
|
package/dist/server/Plugin.js
CHANGED
|
@@ -231,7 +231,8 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
231
231
|
"executions:cancel",
|
|
232
232
|
"executions:destroy",
|
|
233
233
|
"flow_nodes:update",
|
|
234
|
-
"flow_nodes:destroy"
|
|
234
|
+
"flow_nodes:destroy",
|
|
235
|
+
"flow_nodes:test"
|
|
235
236
|
]
|
|
236
237
|
});
|
|
237
238
|
this.app.acl.registerSnippet({
|
|
@@ -67,10 +67,8 @@ export default class Processor {
|
|
|
67
67
|
exit(s?: number): Promise<any>;
|
|
68
68
|
/**
|
|
69
69
|
* @experimental
|
|
70
|
-
* @param {JobModel | Record<string, any>} payload
|
|
71
|
-
* @returns {JobModel}
|
|
72
70
|
*/
|
|
73
|
-
saveJob(payload: any): Promise<
|
|
71
|
+
saveJob(payload: JobModel | Record<string, any>): Promise<JobModel>;
|
|
74
72
|
/**
|
|
75
73
|
* @experimental
|
|
76
74
|
*/
|
|
@@ -100,7 +98,7 @@ export default class Processor {
|
|
|
100
98
|
/**
|
|
101
99
|
* @experimental
|
|
102
100
|
*/
|
|
103
|
-
getScope(sourceNodeId: number): {
|
|
101
|
+
getScope(sourceNodeId: number, includeSelfScope?: boolean): {
|
|
104
102
|
$context: any;
|
|
105
103
|
$jobsMapByNodeKey: {
|
|
106
104
|
[key: string]: any;
|
|
@@ -111,5 +109,8 @@ export default class Processor {
|
|
|
111
109
|
/**
|
|
112
110
|
* @experimental
|
|
113
111
|
*/
|
|
114
|
-
getParsedValue(value: any, sourceNodeId: number, additionalScope?:
|
|
112
|
+
getParsedValue(value: any, sourceNodeId: number, { additionalScope, includeSelfScope }?: {
|
|
113
|
+
additionalScope?: {};
|
|
114
|
+
includeSelfScope?: boolean;
|
|
115
|
+
}): any;
|
|
115
116
|
}
|
package/dist/server/Processor.js
CHANGED
|
@@ -235,8 +235,6 @@ class Processor {
|
|
|
235
235
|
// TODO(optimize)
|
|
236
236
|
/**
|
|
237
237
|
* @experimental
|
|
238
|
-
* @param {JobModel | Record<string, any>} payload
|
|
239
|
-
* @returns {JobModel}
|
|
240
238
|
*/
|
|
241
239
|
async saveJob(payload) {
|
|
242
240
|
const { database } = this.execution.constructor;
|
|
@@ -342,7 +340,7 @@ class Processor {
|
|
|
342
340
|
/**
|
|
343
341
|
* @experimental
|
|
344
342
|
*/
|
|
345
|
-
getScope(sourceNodeId) {
|
|
343
|
+
getScope(sourceNodeId, includeSelfScope = false) {
|
|
346
344
|
const node = this.nodesMap.get(sourceNodeId);
|
|
347
345
|
const systemFns = {};
|
|
348
346
|
const scope = {
|
|
@@ -353,9 +351,9 @@ class Processor {
|
|
|
353
351
|
(0, import_set.default)(systemFns, name, fn.bind(scope));
|
|
354
352
|
}
|
|
355
353
|
const $scopes = {};
|
|
356
|
-
for (let n = this.findBranchParentNode(node); n; n = this.findBranchParentNode(n)) {
|
|
354
|
+
for (let n = includeSelfScope ? node : this.findBranchParentNode(node); n; n = this.findBranchParentNode(n)) {
|
|
357
355
|
const instruction = this.options.plugin.instructions.get(n.type);
|
|
358
|
-
if (typeof instruction.getScope === "function") {
|
|
356
|
+
if (typeof (instruction == null ? void 0 : instruction.getScope) === "function") {
|
|
359
357
|
$scopes[n.id] = $scopes[n.key] = instruction.getScope(n, this.jobsMapByNodeKey[n.key], this);
|
|
360
358
|
}
|
|
361
359
|
}
|
|
@@ -369,9 +367,9 @@ class Processor {
|
|
|
369
367
|
/**
|
|
370
368
|
* @experimental
|
|
371
369
|
*/
|
|
372
|
-
getParsedValue(value, sourceNodeId, additionalScope) {
|
|
370
|
+
getParsedValue(value, sourceNodeId, { additionalScope = {}, includeSelfScope = false } = {}) {
|
|
373
371
|
const template = (0, import_utils.parse)(value);
|
|
374
|
-
const scope = Object.assign(this.getScope(sourceNodeId), additionalScope);
|
|
372
|
+
const scope = Object.assign(this.getScope(sourceNodeId, includeSelfScope), additionalScope);
|
|
375
373
|
template.parameters.forEach(({ key }) => {
|
|
376
374
|
(0, import_evaluators.appendArrayColumn)(scope, key);
|
|
377
375
|
});
|
|
@@ -10,3 +10,4 @@ import { Context } from '@nocobase/actions';
|
|
|
10
10
|
export declare function create(context: Context, next: any): Promise<void>;
|
|
11
11
|
export declare function destroy(context: Context, next: any): Promise<void>;
|
|
12
12
|
export declare function update(context: Context, next: any): Promise<void>;
|
|
13
|
+
export declare function test(context: Context, next: any): Promise<void>;
|
|
@@ -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,16 +25,26 @@ 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 nodes_exports = {};
|
|
28
38
|
__export(nodes_exports, {
|
|
29
39
|
create: () => create,
|
|
30
40
|
destroy: () => destroy,
|
|
41
|
+
test: () => test,
|
|
31
42
|
update: () => update
|
|
32
43
|
});
|
|
33
44
|
module.exports = __toCommonJS(nodes_exports);
|
|
34
45
|
var import_actions = require("@nocobase/actions");
|
|
35
46
|
var import_database = require("@nocobase/database");
|
|
47
|
+
var import__ = __toESM(require(".."));
|
|
36
48
|
async function create(context, next) {
|
|
37
49
|
const { db } = context;
|
|
38
50
|
const repository = import_actions.utils.getRepositoryFromParams(context);
|
|
@@ -209,9 +221,28 @@ async function update(context, next) {
|
|
|
209
221
|
});
|
|
210
222
|
await next();
|
|
211
223
|
}
|
|
224
|
+
async function test(context, next) {
|
|
225
|
+
const { values = {} } = context.action.params;
|
|
226
|
+
const { type, config = {} } = values;
|
|
227
|
+
const plugin = context.app.pm.get(import__.default);
|
|
228
|
+
const instruction = plugin.instructions.get(type);
|
|
229
|
+
if (!instruction) {
|
|
230
|
+
context.throw(400, `instruction "${type}" not registered`);
|
|
231
|
+
}
|
|
232
|
+
if (typeof instruction.test !== "function") {
|
|
233
|
+
context.throw(400, `test method of instruction "${type}" not implemented`);
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
context.body = await instruction.test(config);
|
|
237
|
+
} catch (error) {
|
|
238
|
+
context.throw(500, error.message);
|
|
239
|
+
}
|
|
240
|
+
next();
|
|
241
|
+
}
|
|
212
242
|
// Annotate the CommonJS export names for ESM import in node:
|
|
213
243
|
0 && (module.exports = {
|
|
214
244
|
create,
|
|
215
245
|
destroy,
|
|
246
|
+
test,
|
|
216
247
|
update
|
|
217
248
|
});
|
package/dist/server/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './utils';
|
|
|
10
10
|
export * from './constants';
|
|
11
11
|
export * from './instructions';
|
|
12
12
|
export * from './functions';
|
|
13
|
+
export * from './logicCalculate';
|
|
13
14
|
export { Trigger } from './triggers';
|
|
14
15
|
export { default as Processor } from './Processor';
|
|
15
16
|
export { default } from './Plugin';
|
package/dist/server/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __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
48
|
__reExport(server_exports, require("./functions"), module.exports);
|
|
49
|
+
__reExport(server_exports, require("./logicCalculate"), module.exports);
|
|
49
50
|
var import_triggers = require("./triggers");
|
|
50
51
|
var import_Processor = __toESM(require("./Processor"));
|
|
51
52
|
var import_Plugin = __toESM(require("./Plugin"));
|
|
@@ -58,5 +59,6 @@ __reExport(server_exports, require("./types"), module.exports);
|
|
|
58
59
|
...require("./constants"),
|
|
59
60
|
...require("./instructions"),
|
|
60
61
|
...require("./functions"),
|
|
62
|
+
...require("./logicCalculate"),
|
|
61
63
|
...require("./types")
|
|
62
64
|
});
|
|
@@ -6,17 +6,14 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { Registry } from '@nocobase/utils';
|
|
10
9
|
import { Instruction } from '.';
|
|
11
10
|
import type Processor from '../Processor';
|
|
12
11
|
import type { FlowNodeModel, JobModel } from '../types';
|
|
13
|
-
type Comparer = (a: any, b: any) => boolean;
|
|
14
12
|
export declare const BRANCH_INDEX: {
|
|
15
13
|
readonly DEFAULT: any;
|
|
16
14
|
readonly ON_TRUE: 1;
|
|
17
15
|
readonly ON_FALSE: 0;
|
|
18
16
|
};
|
|
19
|
-
export declare const calculators: Registry<Comparer>;
|
|
20
17
|
export declare class ConditionInstruction extends Instruction {
|
|
21
18
|
run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
|
|
22
19
|
status: 1;
|
|
@@ -28,98 +28,25 @@ var ConditionInstruction_exports = {};
|
|
|
28
28
|
__export(ConditionInstruction_exports, {
|
|
29
29
|
BRANCH_INDEX: () => BRANCH_INDEX,
|
|
30
30
|
ConditionInstruction: () => ConditionInstruction,
|
|
31
|
-
calculators: () => calculators,
|
|
32
31
|
default: () => ConditionInstruction_default
|
|
33
32
|
});
|
|
34
33
|
module.exports = __toCommonJS(ConditionInstruction_exports);
|
|
35
34
|
var import_evaluators = require("@nocobase/evaluators");
|
|
36
|
-
var import_utils = require("@nocobase/utils");
|
|
37
35
|
var import__ = require(".");
|
|
38
36
|
var import_constants = require("../constants");
|
|
37
|
+
var import_logicCalculate = require("../logicCalculate");
|
|
39
38
|
const BRANCH_INDEX = {
|
|
40
39
|
DEFAULT: null,
|
|
41
40
|
ON_TRUE: 1,
|
|
42
41
|
ON_FALSE: 0
|
|
43
42
|
};
|
|
44
|
-
const calculators = new import_utils.Registry();
|
|
45
|
-
function equal(a, b) {
|
|
46
|
-
return a == b;
|
|
47
|
-
}
|
|
48
|
-
function notEqual(a, b) {
|
|
49
|
-
return a != b;
|
|
50
|
-
}
|
|
51
|
-
function gt(a, b) {
|
|
52
|
-
return a > b;
|
|
53
|
-
}
|
|
54
|
-
function gte(a, b) {
|
|
55
|
-
return a >= b;
|
|
56
|
-
}
|
|
57
|
-
function lt(a, b) {
|
|
58
|
-
return a < b;
|
|
59
|
-
}
|
|
60
|
-
function lte(a, b) {
|
|
61
|
-
return a <= b;
|
|
62
|
-
}
|
|
63
|
-
calculators.register("equal", equal);
|
|
64
|
-
calculators.register("notEqual", notEqual);
|
|
65
|
-
calculators.register("gt", gt);
|
|
66
|
-
calculators.register("gte", gte);
|
|
67
|
-
calculators.register("lt", lt);
|
|
68
|
-
calculators.register("lte", lte);
|
|
69
|
-
calculators.register("==", equal);
|
|
70
|
-
calculators.register("!=", notEqual);
|
|
71
|
-
calculators.register(">", gt);
|
|
72
|
-
calculators.register(">=", gte);
|
|
73
|
-
calculators.register("<", lt);
|
|
74
|
-
calculators.register("<=", lte);
|
|
75
|
-
function includes(a, b) {
|
|
76
|
-
return a.includes(b);
|
|
77
|
-
}
|
|
78
|
-
function notIncludes(a, b) {
|
|
79
|
-
return !a.includes(b);
|
|
80
|
-
}
|
|
81
|
-
function startsWith(a, b) {
|
|
82
|
-
return a.startsWith(b);
|
|
83
|
-
}
|
|
84
|
-
function notStartsWith(a, b) {
|
|
85
|
-
return !a.startsWith(b);
|
|
86
|
-
}
|
|
87
|
-
function endsWith(a, b) {
|
|
88
|
-
return a.endsWith(b);
|
|
89
|
-
}
|
|
90
|
-
function notEndsWith(a, b) {
|
|
91
|
-
return !a.endsWith(b);
|
|
92
|
-
}
|
|
93
|
-
calculators.register("includes", includes);
|
|
94
|
-
calculators.register("notIncludes", notIncludes);
|
|
95
|
-
calculators.register("startsWith", startsWith);
|
|
96
|
-
calculators.register("notStartsWith", notStartsWith);
|
|
97
|
-
calculators.register("endsWith", endsWith);
|
|
98
|
-
calculators.register("notEndsWith", notEndsWith);
|
|
99
|
-
function calculate(calculation = {}) {
|
|
100
|
-
let fn;
|
|
101
|
-
if (!(calculation.calculator && (fn = calculators.get(calculation.calculator)))) {
|
|
102
|
-
throw new Error(`no calculator function registered for "${calculation.calculator}"`);
|
|
103
|
-
}
|
|
104
|
-
return Boolean(fn(...calculation.operands ?? []));
|
|
105
|
-
}
|
|
106
|
-
function logicCalculate(calculation) {
|
|
107
|
-
if (!calculation) {
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
if (typeof calculation["group"] === "object") {
|
|
111
|
-
const method = calculation["group"].type === "and" ? "every" : "some";
|
|
112
|
-
return (calculation["group"].calculations ?? [])[method]((item) => logicCalculate(item));
|
|
113
|
-
}
|
|
114
|
-
return calculate(calculation);
|
|
115
|
-
}
|
|
116
43
|
class ConditionInstruction extends import__.Instruction {
|
|
117
44
|
async run(node, prevJob, processor) {
|
|
118
45
|
const { engine, calculation, expression, rejectOnFalse } = node.config || {};
|
|
119
46
|
const evaluator = import_evaluators.evaluators.get(engine);
|
|
120
47
|
let result = true;
|
|
121
48
|
try {
|
|
122
|
-
result = evaluator ? evaluator(expression, processor.getScope(node.id)) : logicCalculate(processor.getParsedValue(calculation, node.id));
|
|
49
|
+
result = evaluator ? evaluator(expression, processor.getScope(node.id)) : (0, import_logicCalculate.logicCalculate)(processor.getParsedValue(calculation, node.id));
|
|
123
50
|
} catch (e) {
|
|
124
51
|
return {
|
|
125
52
|
result: e.toString(),
|
|
@@ -162,6 +89,5 @@ var ConditionInstruction_default = ConditionInstruction;
|
|
|
162
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
90
|
0 && (module.exports = {
|
|
164
91
|
BRANCH_INDEX,
|
|
165
|
-
ConditionInstruction
|
|
166
|
-
calculators
|
|
92
|
+
ConditionInstruction
|
|
167
93
|
});
|