@notmrabhi/flowforge 0.1.30 → 0.1.32

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./subWorkflowDescriptor-JDKi2INh.js");class o{constructor(){this.descriptors=new Map}register(r){return this.descriptors.set(r.type,r),this}forType(r){return this.descriptors.get(r)}forId(r){for(const t of this.descriptors.values())if(t.matches(r))return t}list(){return[...this.descriptors.values()]}}const s=new o;exports.baseNodeDefaults=e.baseNodeDefaults;exports.conditionBranchDescriptor=e.conditionBranchDescriptor;exports.defineNode=e.defineNode;exports.endEventDescriptor=e.endEventDescriptor;exports.makeSubWorkflowDescriptor=e.makeSubWorkflowDescriptor;exports.notificationDescriptor=e.notificationDescriptor;exports.restApiDescriptor=e.restApiDescriptor;exports.startEventDescriptor=e.startEventDescriptor;exports.subWorkflowDescriptor=e.subWorkflowDescriptor;exports.webhookTriggerDescriptor=e.webhookTriggerDescriptor;exports.webhookTriggerTemplate=e.webhookTriggerTemplate;exports.NodeTypeRegistry=o;exports.nodeTypeRegistry=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),r=require("react-icons/md"),d=require("./canvasTokens-gKNYrPl4.js"),s={formSchema:[],bpmnEntry:e=>e,bpmnExit:e=>e,emitBpmnElements:e=>[{id:e,$type:"bpmn:Task"}]};function o(e){return{...s,...e}}const u=o({type:"startEvent",label:"Start",icon:a.createElement(r.MdPlayCircleOutline,{size:18,color:"#616161"}),matches:e=>e==="start",reactFlowType:"startNode",emitBpmnElements:e=>[{id:e,$type:"bpmn:StartEvent"}],maxPerWorkflow:1}),b=o({type:"endEvent",label:"End",icon:a.createElement(r.MdStopCircle,{size:18,color:"#616161"}),matches:e=>e==="end"||e.startsWith("end-"),reactFlowType:"endNode",emitBpmnElements:e=>[{id:e,$type:"bpmn:EndEvent"}]}),h=o({type:"restApi",label:"REST API Call",icon:a.createElement(r.MdHttp,{size:18,color:"#546e7a"}),matches:e=>e.startsWith("restApi-"),reactFlowType:"restApiNode",formSchema:[{id:"method",type:"select",label:"HTTP Method",required:!0,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}]},{id:"url",type:"text",label:"URL",required:!0,placeholder:"https://api.example.com/endpoint",formulaEnabled:!0},{id:"headers",type:"key-value",label:"Request Headers",placeholder:"Add headers..."},{id:"queryParams",type:"key-value",label:"Query Parameters",shouldHide:({values:e})=>e.method!=="GET"&&e.method!=="DELETE"},{id:"body",type:"json-editor",label:"Request Body (JSON)",shouldHide:({values:e})=>e.method==="GET"||e.method==="DELETE"},{id:"responseMapping",type:"array",label:"Map Response Fields to Variables",children:[{id:"jsonPath",type:"text",label:"JSON Path",placeholder:"$.data.userId",required:!0},{id:"variableName",type:"text",label:"Variable Name",placeholder:"userId",required:!0}]},{id:"timeoutMs",type:"number",label:"Timeout (ms)",placeholder:"5000"},{id:"continueOnError",type:"toggle",label:"Continue workflow on error"}],bpmnEntry:e=>`REST API Call: ${e}`,bpmnExit:e=>`End REST API Call: ${e}`,emitBpmnElements:(e,t)=>{const l=t;return[{id:e,$type:"bpmn:ServiceTask",name:`${l.method??"HTTP"} ${l.url??""}`.trim()}]}}),m=o({type:"notification",label:"Send Notification",icon:a.createElement(r.MdNotifications,{size:18,color:"#7b1fa2"}),matches:e=>e.startsWith("notification-"),reactFlowType:"notificationNode",formSchema:[{id:"channel",type:"descriptive-select",label:"Notification Channel",required:!0,options:[{value:"email",label:"Email",description:"Send via SMTP or email provider"},{value:"slack",label:"Slack",description:"Post to a Slack channel or DM"},{value:"teams",label:"Microsoft Teams",description:"Post to a Teams channel or chat"},{value:"sms",label:"SMS",description:"Send a text message"},{value:"in-app",label:"In-App",description:"miniOrange notification center"},{value:"webhook",label:"Webhook",description:"POST to an external URL"}]},{id:"emailTo",type:"tags",label:"To",placeholder:"Add email address...",required:!0,shouldHide:({values:e})=>e.channel!=="email",formulaEnabled:!0},{id:"emailCc",type:"tags",label:"CC",placeholder:"Add email address...",shouldHide:({values:e})=>e.channel!=="email"},{id:"emailSubject",type:"text",label:"Subject",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="email"},{id:"emailBody",type:"rich-text",label:"Body",required:!0,shouldHide:({values:e})=>e.channel!=="email"},{id:"slackChannel",type:"text",label:"Channel / DM",required:!0,placeholder:"#general or @username",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="slack"},{id:"slackMessage",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="slack"},{id:"teamsWebhookUrl",type:"text",label:"Incoming Webhook URL",required:!0,placeholder:"https://...",shouldHide:({values:e})=>e.channel!=="teams"},{id:"teamsMessage",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="teams"},{id:"smsTo",type:"text",label:"Phone Number",required:!0,placeholder:"+1234567890",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="sms"},{id:"smsBody",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="sms"},{id:"inAppRecipient",type:"text",label:"Recipient (User ID or Username)",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"inAppTitle",type:"text",label:"Title",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"inAppBody",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"webhookUrl",type:"text",label:"Webhook URL",required:!0,placeholder:"https://...",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="webhook"},{id:"webhookPayload",type:"json-editor",label:"Payload (JSON)",shouldHide:({values:e})=>e.channel!=="webhook"},{id:"sendOnFailure",type:"toggle",label:"Also send notification on workflow failure"},{id:"deduplicationKey",type:"text",label:"Deduplication Key",placeholder:"Optional — prevents duplicate sends",formulaEnabled:!0}],bpmnEntry:e=>`Send Notification: ${e}`,bpmnExit:e=>`End Notification: ${e}`,emitBpmnElements:(e,t)=>[{id:e,$type:"bpmn:SendTask",name:`Notify via ${t.channel??"channel"}`}]}),y=[{label:"equals (=)",value:"eq"},{label:"not equals (≠)",value:"neq"},{label:"greater than (>)",value:"gt"},{label:"greater or equal (≥)",value:"gte"},{label:"less than (<)",value:"lt"},{label:"less or equal (≤)",value:"lte"},{label:"contains",value:"contains"},{label:"starts with",value:"startsWith"},{label:"ends with",value:"endsWith"},{label:"is empty",value:"isEmpty"},{label:"is not empty",value:"isNotEmpty"}],E=o({type:"conditionBranch",label:"Condition Branch",icon:a.createElement(r.MdCallSplit,{size:18,color:"#512da8"}),matches:e=>e.startsWith("conditionBranch-"),reactFlowType:"conditionBranchNode",branchLabels:{branch1:"IF · Branch 1",branch2:"ELSE IF · Branch 2",default:"ELSE"},formSchema:[{id:"title",type:"text",label:"Node Label",placeholder:"e.g. Route by User Role"},{id:"branchConfigs",type:"array",label:"Branches",required:!0,children:[{id:"kind",type:"select",label:"Branch Type",required:!0,options:[{label:"IF",value:"if"},{label:"ELSE IF",value:"elseif"},{label:"ELSE",value:"else"}],placeholder:"elseif"},{id:"key",type:"text",label:"Branch Key",required:!0,placeholder:"e.g. admin (no spaces)"},{id:"label",type:"text",label:"Branch Label",required:!0,placeholder:"e.g. Admin Users"},{id:"conditions",type:"array",label:"Conditions",shouldHide:({values:e})=>e.kind==="else",children:[{id:"field",type:"text",label:"Field / Variable",required:!0,placeholder:"e.g. user.role",formulaEnabled:!0},{id:"operator",type:"select",label:"Operator",required:!0,options:y},{id:"value",type:"text",label:"Value",placeholder:"e.g. admin",formulaEnabled:!0,shouldHide:({values:e})=>e.operator==="isEmpty"||e.operator==="isNotEmpty"},{id:"logicalOperator",type:"select",label:"Combine with next",options:[{label:"AND",value:"AND"},{label:"OR",value:"OR"}]}]}]},{id:"defaultBranch",type:"text",label:"Default Branch Key (fallback if no condition matches)",placeholder:"e.g. default"}],bpmnEntry:e=>`Condition Branch: ${e}`,bpmnExit:e=>`End Condition Branch: ${e}`,emitBpmnElements:(e,t)=>{const l=t,i=l.branchConfigs??[];return[{id:e,$type:"bpmn:ExclusiveGateway",name:l.title??"Condition Branch"},...i.map(n=>({id:`${e}-${n.key}`,$type:"bpmn:SequenceFlow",name:n.label}))]}}),f=o({type:"webhookTrigger",label:"Webhook Trigger",icon:a.createElement(r.MdWebhook,{size:d.NODE_DESCRIPTOR_ICON_SIZE,color:"#1565c0"}),matches:e=>e.startsWith("webhookTrigger-"),reactFlowType:"webhookTriggerNode",formSchema:[{id:"endpointUrl",type:"text",label:"Endpoint URL",disabled:!0,placeholder:"Generated after saving"},{id:"authMethod",type:"select",label:"Authentication",required:!0,options:[{label:"None",value:"none"},{label:"API Key",value:"api-key"},{label:"HMAC Signature",value:"hmac"}]},{id:"apiKeyHeader",type:"text",label:"API Key Header Name",placeholder:"e.g. X-API-Key",shouldHide:({values:e})=>e.authMethod!=="api-key"},{id:"hmacSecret",type:"text",label:"HMAC Secret",placeholder:"Shared secret for signature verification",shouldHide:({values:e})=>e.authMethod!=="hmac"},{id:"payloadDescription",type:"textarea",label:"Expected Payload Description",placeholder:"Describe the expected JSON payload fields..."}],bpmnEntry:e=>`Webhook Trigger: ${e}`,bpmnExit:e=>`End Webhook Trigger: ${e}`,emitBpmnElements:e=>[{id:e,$type:"bpmn:StartEvent",name:"Webhook Trigger"}]}),g={triggerKey:"WEBHOOK_TRIGGER",label:"Incoming Webhook",description:"Start this workflow when an HTTP POST is received at a generated endpoint.",triggerCategory:"webhook",icon:a.createElement(r.MdWebhook,{size:d.NODE_DESCRIPTOR_ICON_SIZE,color:"#1565c0"})};function p(e={}){return o({type:"subWorkflow",label:"Sub-Workflow",icon:a.createElement(r.MdAccountTree,{size:18,color:"#00695c"}),matches:t=>t.startsWith("subWorkflow-"),reactFlowType:"subWorkflowNode",formSchema:[{id:"workflowId",type:"select",label:"Workflow to Call",required:!0,placeholder:"Select a workflow...",...e.fetchWorkflowOptions?{fetchOptions:e.fetchWorkflowOptions}:{options:[]}},{id:"workflowLabel",type:"text",label:"Display Name (optional)",placeholder:"Override display name shown on canvas"},{id:"inputMapping",type:"key-value",label:"Input Mapping",placeholder:"Map parent variables → sub-workflow inputs",formulaEnabled:!0},{id:"outputMapping",type:"key-value",label:"Output Mapping",placeholder:"Map sub-workflow outputs → parent variables"},{id:"waitForCompletion",type:"toggle",label:"Wait for sub-workflow to complete before continuing"},{id:"continueOnError",type:"toggle",label:"Continue parent workflow if sub-workflow fails"}],bpmnEntry:t=>`Sub-Workflow Call: ${t}`,bpmnExit:t=>`End Sub-Workflow Call: ${t}`,emitBpmnElements:(t,l)=>{const i=l;return[{id:t,$type:"bpmn:CallActivity",name:i.workflowLabel||i.workflowId||"Sub-Workflow",calledElement:i.workflowId}]}})}const k=p();class c{constructor(){this.descriptors=new Map}register(t){return this.descriptors.set(t.type,t),this}forType(t){return this.descriptors.get(t)}forId(t){for(const l of this.descriptors.values())if(l.matches(t))return l}list(){return[...this.descriptors.values()]}}const w=new c;exports.NodeTypeRegistry=c;exports.baseNodeDefaults=s;exports.conditionBranchDescriptor=E;exports.defineNode=o;exports.endEventDescriptor=b;exports.makeSubWorkflowDescriptor=p;exports.nodeTypeRegistry=w;exports.notificationDescriptor=m;exports.restApiDescriptor=h;exports.startEventDescriptor=u;exports.subWorkflowDescriptor=k;exports.webhookTriggerDescriptor=f;exports.webhookTriggerTemplate=g;
@@ -105,7 +105,20 @@ declare interface FieldConditionDef {
105
105
  }
106
106
 
107
107
  declare interface FieldContext {
108
+ /** Full top-level form values (always). */
108
109
  values: Record<string, unknown>;
110
+ /**
111
+ * Item-scoped values for a field rendered INSIDE an array item.
112
+ * Lets `shouldHide` / `shouldDisable` / `shouldRequire` / `compute` see
113
+ * sibling-in-same-row fields without having to splice paths manually:
114
+ *
115
+ * { id: 'template', shouldHide: ({ item }) => item?.valueSource !== 'template' }
116
+ *
117
+ * `undefined` when the field is NOT inside an array item (i.e. top-level
118
+ * fields and fields inside plain `type: 'object'` children at top level).
119
+ * Nested arrays update `item` to the immediate parent row's values.
120
+ */
121
+ item?: Record<string, unknown>;
109
122
  }
110
123
 
111
124
  declare interface FieldDescriptor {
@@ -1,35 +1,555 @@
1
- import { b as c, c as n, d as p, e as d, m as f, n as u, r as h, s as D, a as g, w as l, f as w } from "./subWorkflowDescriptor-DYOYgBzX.js";
2
- class s {
1
+ import a from "react";
2
+ import { MdPlayCircleOutline as s, MdStopCircle as p, MdHttp as c, MdNotifications as u, MdCallSplit as b, MdWebhook as n, MdAccountTree as h } from "react-icons/md";
3
+ import { N as d } from "./canvasTokens-CAD6G24b.js";
4
+ const m = {
5
+ formSchema: [],
6
+ bpmnEntry: (e) => e,
7
+ bpmnExit: (e) => e,
8
+ emitBpmnElements: (e) => [{ id: e, $type: "bpmn:Task" }]
9
+ };
10
+ function r(e) {
11
+ return { ...m, ...e };
12
+ }
13
+ const T = r({
14
+ type: "startEvent",
15
+ label: "Start",
16
+ icon: a.createElement(s, { size: 18, color: "#616161" }),
17
+ matches: (e) => e === "start",
18
+ reactFlowType: "startNode",
19
+ emitBpmnElements: (e) => [{ id: e, $type: "bpmn:StartEvent" }],
20
+ maxPerWorkflow: 1
21
+ }), v = r({
22
+ type: "endEvent",
23
+ label: "End",
24
+ icon: a.createElement(p, { size: 18, color: "#616161" }),
25
+ matches: (e) => e === "end" || e.startsWith("end-"),
26
+ reactFlowType: "endNode",
27
+ emitBpmnElements: (e) => [{ id: e, $type: "bpmn:EndEvent" }]
28
+ }), S = r({
29
+ type: "restApi",
30
+ label: "REST API Call",
31
+ icon: a.createElement(c, { size: 18, color: "#546e7a" }),
32
+ matches: (e) => e.startsWith("restApi-"),
33
+ reactFlowType: "restApiNode",
34
+ formSchema: [
35
+ {
36
+ id: "method",
37
+ type: "select",
38
+ label: "HTTP Method",
39
+ required: !0,
40
+ options: [
41
+ { label: "GET", value: "GET" },
42
+ { label: "POST", value: "POST" },
43
+ { label: "PUT", value: "PUT" },
44
+ { label: "PATCH", value: "PATCH" },
45
+ { label: "DELETE", value: "DELETE" }
46
+ ]
47
+ },
48
+ {
49
+ id: "url",
50
+ type: "text",
51
+ label: "URL",
52
+ required: !0,
53
+ placeholder: "https://api.example.com/endpoint",
54
+ formulaEnabled: !0
55
+ },
56
+ {
57
+ id: "headers",
58
+ type: "key-value",
59
+ label: "Request Headers",
60
+ placeholder: "Add headers..."
61
+ },
62
+ {
63
+ id: "queryParams",
64
+ type: "key-value",
65
+ label: "Query Parameters",
66
+ shouldHide: ({ values: e }) => e.method !== "GET" && e.method !== "DELETE"
67
+ },
68
+ {
69
+ id: "body",
70
+ type: "json-editor",
71
+ label: "Request Body (JSON)",
72
+ shouldHide: ({ values: e }) => e.method === "GET" || e.method === "DELETE"
73
+ },
74
+ {
75
+ id: "responseMapping",
76
+ type: "array",
77
+ label: "Map Response Fields to Variables",
78
+ children: [
79
+ {
80
+ id: "jsonPath",
81
+ type: "text",
82
+ label: "JSON Path",
83
+ placeholder: "$.data.userId",
84
+ required: !0
85
+ },
86
+ {
87
+ id: "variableName",
88
+ type: "text",
89
+ label: "Variable Name",
90
+ placeholder: "userId",
91
+ required: !0
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ id: "timeoutMs",
97
+ type: "number",
98
+ label: "Timeout (ms)",
99
+ placeholder: "5000"
100
+ },
101
+ {
102
+ id: "continueOnError",
103
+ type: "toggle",
104
+ label: "Continue workflow on error"
105
+ }
106
+ ],
107
+ bpmnEntry: (e) => `REST API Call: ${e}`,
108
+ bpmnExit: (e) => `End REST API Call: ${e}`,
109
+ emitBpmnElements: (e, t) => {
110
+ const l = t;
111
+ return [{
112
+ id: e,
113
+ $type: "bpmn:ServiceTask",
114
+ name: `${l.method ?? "HTTP"} ${l.url ?? ""}`.trim()
115
+ }];
116
+ }
117
+ }), x = r({
118
+ type: "notification",
119
+ label: "Send Notification",
120
+ icon: a.createElement(u, { size: 18, color: "#7b1fa2" }),
121
+ matches: (e) => e.startsWith("notification-"),
122
+ reactFlowType: "notificationNode",
123
+ formSchema: [
124
+ {
125
+ id: "channel",
126
+ type: "descriptive-select",
127
+ label: "Notification Channel",
128
+ required: !0,
129
+ options: [
130
+ { value: "email", label: "Email", description: "Send via SMTP or email provider" },
131
+ { value: "slack", label: "Slack", description: "Post to a Slack channel or DM" },
132
+ { value: "teams", label: "Microsoft Teams", description: "Post to a Teams channel or chat" },
133
+ { value: "sms", label: "SMS", description: "Send a text message" },
134
+ { value: "in-app", label: "In-App", description: "miniOrange notification center" },
135
+ { value: "webhook", label: "Webhook", description: "POST to an external URL" }
136
+ ]
137
+ },
138
+ // ── Email fields ──────────────────────────────────────────────────────────
139
+ {
140
+ id: "emailTo",
141
+ type: "tags",
142
+ label: "To",
143
+ placeholder: "Add email address...",
144
+ required: !0,
145
+ shouldHide: ({ values: e }) => e.channel !== "email",
146
+ formulaEnabled: !0
147
+ },
148
+ {
149
+ id: "emailCc",
150
+ type: "tags",
151
+ label: "CC",
152
+ placeholder: "Add email address...",
153
+ shouldHide: ({ values: e }) => e.channel !== "email"
154
+ },
155
+ {
156
+ id: "emailSubject",
157
+ type: "text",
158
+ label: "Subject",
159
+ required: !0,
160
+ formulaEnabled: !0,
161
+ shouldHide: ({ values: e }) => e.channel !== "email"
162
+ },
163
+ {
164
+ id: "emailBody",
165
+ type: "rich-text",
166
+ label: "Body",
167
+ required: !0,
168
+ shouldHide: ({ values: e }) => e.channel !== "email"
169
+ },
170
+ // ── Slack fields ──────────────────────────────────────────────────────────
171
+ {
172
+ id: "slackChannel",
173
+ type: "text",
174
+ label: "Channel / DM",
175
+ required: !0,
176
+ placeholder: "#general or @username",
177
+ formulaEnabled: !0,
178
+ shouldHide: ({ values: e }) => e.channel !== "slack"
179
+ },
180
+ {
181
+ id: "slackMessage",
182
+ type: "textarea",
183
+ label: "Message",
184
+ required: !0,
185
+ formulaEnabled: !0,
186
+ shouldHide: ({ values: e }) => e.channel !== "slack"
187
+ },
188
+ // ── Teams fields ──────────────────────────────────────────────────────────
189
+ {
190
+ id: "teamsWebhookUrl",
191
+ type: "text",
192
+ label: "Incoming Webhook URL",
193
+ required: !0,
194
+ placeholder: "https://...",
195
+ shouldHide: ({ values: e }) => e.channel !== "teams"
196
+ },
197
+ {
198
+ id: "teamsMessage",
199
+ type: "textarea",
200
+ label: "Message",
201
+ required: !0,
202
+ formulaEnabled: !0,
203
+ shouldHide: ({ values: e }) => e.channel !== "teams"
204
+ },
205
+ // ── SMS fields ────────────────────────────────────────────────────────────
206
+ {
207
+ id: "smsTo",
208
+ type: "text",
209
+ label: "Phone Number",
210
+ required: !0,
211
+ placeholder: "+1234567890",
212
+ formulaEnabled: !0,
213
+ shouldHide: ({ values: e }) => e.channel !== "sms"
214
+ },
215
+ {
216
+ id: "smsBody",
217
+ type: "textarea",
218
+ label: "Message",
219
+ required: !0,
220
+ formulaEnabled: !0,
221
+ shouldHide: ({ values: e }) => e.channel !== "sms"
222
+ },
223
+ // ── In-App fields ─────────────────────────────────────────────────────────
224
+ {
225
+ id: "inAppRecipient",
226
+ type: "text",
227
+ label: "Recipient (User ID or Username)",
228
+ required: !0,
229
+ formulaEnabled: !0,
230
+ shouldHide: ({ values: e }) => e.channel !== "in-app"
231
+ },
232
+ {
233
+ id: "inAppTitle",
234
+ type: "text",
235
+ label: "Title",
236
+ required: !0,
237
+ formulaEnabled: !0,
238
+ shouldHide: ({ values: e }) => e.channel !== "in-app"
239
+ },
240
+ {
241
+ id: "inAppBody",
242
+ type: "textarea",
243
+ label: "Message",
244
+ required: !0,
245
+ formulaEnabled: !0,
246
+ shouldHide: ({ values: e }) => e.channel !== "in-app"
247
+ },
248
+ // ── Webhook fields ────────────────────────────────────────────────────────
249
+ {
250
+ id: "webhookUrl",
251
+ type: "text",
252
+ label: "Webhook URL",
253
+ required: !0,
254
+ placeholder: "https://...",
255
+ formulaEnabled: !0,
256
+ shouldHide: ({ values: e }) => e.channel !== "webhook"
257
+ },
258
+ {
259
+ id: "webhookPayload",
260
+ type: "json-editor",
261
+ label: "Payload (JSON)",
262
+ shouldHide: ({ values: e }) => e.channel !== "webhook"
263
+ },
264
+ // ── Shared options ────────────────────────────────────────────────────────
265
+ {
266
+ id: "sendOnFailure",
267
+ type: "toggle",
268
+ label: "Also send notification on workflow failure"
269
+ },
270
+ {
271
+ id: "deduplicationKey",
272
+ type: "text",
273
+ label: "Deduplication Key",
274
+ placeholder: "Optional — prevents duplicate sends",
275
+ formulaEnabled: !0
276
+ }
277
+ ],
278
+ bpmnEntry: (e) => `Send Notification: ${e}`,
279
+ bpmnExit: (e) => `End Notification: ${e}`,
280
+ emitBpmnElements: (e, t) => [{ id: e, $type: "bpmn:SendTask", name: `Notify via ${t.channel ?? "channel"}` }]
281
+ }), y = [
282
+ { label: "equals (=)", value: "eq" },
283
+ { label: "not equals (≠)", value: "neq" },
284
+ { label: "greater than (>)", value: "gt" },
285
+ { label: "greater or equal (≥)", value: "gte" },
286
+ { label: "less than (<)", value: "lt" },
287
+ { label: "less or equal (≤)", value: "lte" },
288
+ { label: "contains", value: "contains" },
289
+ { label: "starts with", value: "startsWith" },
290
+ { label: "ends with", value: "endsWith" },
291
+ { label: "is empty", value: "isEmpty" },
292
+ { label: "is not empty", value: "isNotEmpty" }
293
+ ], q = r({
294
+ type: "conditionBranch",
295
+ label: "Condition Branch",
296
+ icon: a.createElement(b, { size: 18, color: "#512da8" }),
297
+ matches: (e) => e.startsWith("conditionBranch-"),
298
+ reactFlowType: "conditionBranchNode",
299
+ /** Initial branch labels — canvas uses these keys to initialise BranchMap on insert.
300
+ * Pre-seeded as Workato-style IF / ELSE IF / ELSE chain. */
301
+ branchLabels: { branch1: "IF · Branch 1", branch2: "ELSE IF · Branch 2", default: "ELSE" },
302
+ formSchema: [
303
+ {
304
+ id: "title",
305
+ type: "text",
306
+ label: "Node Label",
307
+ placeholder: "e.g. Route by User Role"
308
+ },
309
+ {
310
+ id: "branchConfigs",
311
+ type: "array",
312
+ label: "Branches",
313
+ required: !0,
314
+ children: [
315
+ {
316
+ id: "kind",
317
+ type: "select",
318
+ label: "Branch Type",
319
+ required: !0,
320
+ options: [
321
+ { label: "IF", value: "if" },
322
+ { label: "ELSE IF", value: "elseif" },
323
+ { label: "ELSE", value: "else" }
324
+ ],
325
+ // Default for new branches is "elseif" so the chain reads correctly when
326
+ // appended between the first IF and the trailing ELSE.
327
+ placeholder: "elseif"
328
+ },
329
+ {
330
+ id: "key",
331
+ type: "text",
332
+ label: "Branch Key",
333
+ required: !0,
334
+ placeholder: "e.g. admin (no spaces)"
335
+ },
336
+ {
337
+ id: "label",
338
+ type: "text",
339
+ label: "Branch Label",
340
+ required: !0,
341
+ placeholder: "e.g. Admin Users"
342
+ },
343
+ {
344
+ id: "conditions",
345
+ type: "array",
346
+ label: "Conditions",
347
+ // ELSE branches have no condition by definition — hide the array.
348
+ shouldHide: ({ values: e }) => e.kind === "else",
349
+ children: [
350
+ {
351
+ id: "field",
352
+ type: "text",
353
+ label: "Field / Variable",
354
+ required: !0,
355
+ placeholder: "e.g. user.role",
356
+ formulaEnabled: !0
357
+ },
358
+ {
359
+ id: "operator",
360
+ type: "select",
361
+ label: "Operator",
362
+ required: !0,
363
+ options: y
364
+ },
365
+ {
366
+ id: "value",
367
+ type: "text",
368
+ label: "Value",
369
+ placeholder: "e.g. admin",
370
+ formulaEnabled: !0,
371
+ shouldHide: ({ values: e }) => e.operator === "isEmpty" || e.operator === "isNotEmpty"
372
+ },
373
+ {
374
+ id: "logicalOperator",
375
+ type: "select",
376
+ label: "Combine with next",
377
+ options: [
378
+ { label: "AND", value: "AND" },
379
+ { label: "OR", value: "OR" }
380
+ ]
381
+ }
382
+ ]
383
+ }
384
+ ]
385
+ },
386
+ {
387
+ id: "defaultBranch",
388
+ type: "text",
389
+ label: "Default Branch Key (fallback if no condition matches)",
390
+ placeholder: "e.g. default"
391
+ }
392
+ ],
393
+ bpmnEntry: (e) => `Condition Branch: ${e}`,
394
+ bpmnExit: (e) => `End Condition Branch: ${e}`,
395
+ emitBpmnElements: (e, t) => {
396
+ const l = t, o = l.branchConfigs ?? [];
397
+ return [
398
+ { id: e, $type: "bpmn:ExclusiveGateway", name: l.title ?? "Condition Branch" },
399
+ ...o.map((i) => ({
400
+ id: `${e}-${i.key}`,
401
+ $type: "bpmn:SequenceFlow",
402
+ name: i.label
403
+ }))
404
+ ];
405
+ }
406
+ }), N = r({
407
+ type: "webhookTrigger",
408
+ label: "Webhook Trigger",
409
+ icon: a.createElement(n, { size: d, color: "#1565c0" }),
410
+ matches: (e) => e.startsWith("webhookTrigger-"),
411
+ reactFlowType: "webhookTriggerNode",
412
+ formSchema: [
413
+ {
414
+ id: "endpointUrl",
415
+ type: "text",
416
+ label: "Endpoint URL",
417
+ disabled: !0,
418
+ placeholder: "Generated after saving"
419
+ },
420
+ {
421
+ id: "authMethod",
422
+ type: "select",
423
+ label: "Authentication",
424
+ required: !0,
425
+ options: [
426
+ { label: "None", value: "none" },
427
+ { label: "API Key", value: "api-key" },
428
+ { label: "HMAC Signature", value: "hmac" }
429
+ ]
430
+ },
431
+ {
432
+ id: "apiKeyHeader",
433
+ type: "text",
434
+ label: "API Key Header Name",
435
+ placeholder: "e.g. X-API-Key",
436
+ shouldHide: ({ values: e }) => e.authMethod !== "api-key"
437
+ },
438
+ {
439
+ id: "hmacSecret",
440
+ type: "text",
441
+ label: "HMAC Secret",
442
+ placeholder: "Shared secret for signature verification",
443
+ shouldHide: ({ values: e }) => e.authMethod !== "hmac"
444
+ },
445
+ {
446
+ id: "payloadDescription",
447
+ type: "textarea",
448
+ label: "Expected Payload Description",
449
+ placeholder: "Describe the expected JSON payload fields..."
450
+ }
451
+ ],
452
+ bpmnEntry: (e) => `Webhook Trigger: ${e}`,
453
+ bpmnExit: (e) => `End Webhook Trigger: ${e}`,
454
+ emitBpmnElements: (e) => [{ id: e, $type: "bpmn:StartEvent", name: "Webhook Trigger" }]
455
+ }), C = {
456
+ triggerKey: "WEBHOOK_TRIGGER",
457
+ label: "Incoming Webhook",
458
+ description: "Start this workflow when an HTTP POST is received at a generated endpoint.",
459
+ triggerCategory: "webhook",
460
+ icon: a.createElement(n, { size: d, color: "#1565c0" })
461
+ };
462
+ function E(e = {}) {
463
+ return r({
464
+ type: "subWorkflow",
465
+ label: "Sub-Workflow",
466
+ icon: a.createElement(h, { size: 18, color: "#00695c" }),
467
+ matches: (t) => t.startsWith("subWorkflow-"),
468
+ reactFlowType: "subWorkflowNode",
469
+ formSchema: [
470
+ {
471
+ id: "workflowId",
472
+ type: "select",
473
+ label: "Workflow to Call",
474
+ required: !0,
475
+ placeholder: "Select a workflow...",
476
+ ...e.fetchWorkflowOptions ? { fetchOptions: e.fetchWorkflowOptions } : { options: [] }
477
+ },
478
+ {
479
+ id: "workflowLabel",
480
+ type: "text",
481
+ label: "Display Name (optional)",
482
+ placeholder: "Override display name shown on canvas"
483
+ },
484
+ {
485
+ id: "inputMapping",
486
+ type: "key-value",
487
+ label: "Input Mapping",
488
+ placeholder: "Map parent variables → sub-workflow inputs",
489
+ formulaEnabled: !0
490
+ },
491
+ {
492
+ id: "outputMapping",
493
+ type: "key-value",
494
+ label: "Output Mapping",
495
+ placeholder: "Map sub-workflow outputs → parent variables"
496
+ },
497
+ {
498
+ id: "waitForCompletion",
499
+ type: "toggle",
500
+ label: "Wait for sub-workflow to complete before continuing"
501
+ },
502
+ {
503
+ id: "continueOnError",
504
+ type: "toggle",
505
+ label: "Continue parent workflow if sub-workflow fails"
506
+ }
507
+ ],
508
+ bpmnEntry: (t) => `Sub-Workflow Call: ${t}`,
509
+ bpmnExit: (t) => `End Sub-Workflow Call: ${t}`,
510
+ emitBpmnElements: (t, l) => {
511
+ const o = l;
512
+ return [{
513
+ id: t,
514
+ $type: "bpmn:CallActivity",
515
+ name: o.workflowLabel || o.workflowId || "Sub-Workflow",
516
+ calledElement: o.workflowId
517
+ }];
518
+ }
519
+ });
520
+ }
521
+ const M = E();
522
+ class f {
3
523
  constructor() {
4
524
  this.descriptors = /* @__PURE__ */ new Map();
5
525
  }
6
- register(r) {
7
- return this.descriptors.set(r.type, r), this;
526
+ register(t) {
527
+ return this.descriptors.set(t.type, t), this;
8
528
  }
9
- forType(r) {
10
- return this.descriptors.get(r);
529
+ forType(t) {
530
+ return this.descriptors.get(t);
11
531
  }
12
- forId(r) {
13
- for (const e of this.descriptors.values())
14
- if (e.matches(r)) return e;
532
+ forId(t) {
533
+ for (const l of this.descriptors.values())
534
+ if (l.matches(t)) return l;
15
535
  }
16
536
  list() {
17
537
  return [...this.descriptors.values()];
18
538
  }
19
539
  }
20
- const o = new s();
540
+ const H = new f();
21
541
  export {
22
- s as NodeTypeRegistry,
23
- c as baseNodeDefaults,
24
- n as conditionBranchDescriptor,
25
- p as defineNode,
26
- d as endEventDescriptor,
27
- f as makeSubWorkflowDescriptor,
28
- o as nodeTypeRegistry,
29
- u as notificationDescriptor,
30
- h as restApiDescriptor,
31
- D as startEventDescriptor,
32
- g as subWorkflowDescriptor,
33
- l as webhookTriggerDescriptor,
34
- w as webhookTriggerTemplate
542
+ f as NodeTypeRegistry,
543
+ m as baseNodeDefaults,
544
+ q as conditionBranchDescriptor,
545
+ r as defineNode,
546
+ v as endEventDescriptor,
547
+ E as makeSubWorkflowDescriptor,
548
+ H as nodeTypeRegistry,
549
+ x as notificationDescriptor,
550
+ S as restApiDescriptor,
551
+ T as startEventDescriptor,
552
+ M as subWorkflowDescriptor,
553
+ N as webhookTriggerDescriptor,
554
+ C as webhookTriggerTemplate
35
555
  };