@notmrabhi/flowforge 0.1.0

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 (56) hide show
  1. package/README.md +70 -0
  2. package/dist/GatewayBranchEdge-C-AVfqfT.js +1 -0
  3. package/dist/GatewayBranchEdge-gncIBR-0.js +854 -0
  4. package/dist/SchemaBuilderDrawer-DFyGUCZM.js +3235 -0
  5. package/dist/SchemaBuilderDrawer-zci9aEUc.js +4 -0
  6. package/dist/_commonjsHelpers-DKOUU3wS.js +1 -0
  7. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  8. package/dist/bpmn-CcuE2X_Q.js +2 -0
  9. package/dist/bpmn-CtfWDaOY.js +33 -0
  10. package/dist/canvas.cjs +1 -0
  11. package/dist/canvas.d.ts +646 -0
  12. package/dist/canvas.js +28 -0
  13. package/dist/canvasTokens-CAD6G24b.js +32 -0
  14. package/dist/canvasTokens-gKNYrPl4.js +1 -0
  15. package/dist/core.cjs +1 -0
  16. package/dist/core.d.ts +333 -0
  17. package/dist/core.js +24 -0
  18. package/dist/defaultUi.cjs +1 -0
  19. package/dist/defaultUi.d.ts +83 -0
  20. package/dist/defaultUi.js +18 -0
  21. package/dist/form.cjs +1 -0
  22. package/dist/form.d.ts +857 -0
  23. package/dist/form.js +43 -0
  24. package/dist/index-B31-Y5uO.js +11 -0
  25. package/dist/index-B3aHpb84.js +13 -0
  26. package/dist/index-BnzttJ4w.js +13758 -0
  27. package/dist/index-BysKSEtZ.js +1 -0
  28. package/dist/index-C-CpxcAF.js +8132 -0
  29. package/dist/index-C9lDjGKB.js +2553 -0
  30. package/dist/index-CChSmn-Q.js +6 -0
  31. package/dist/index-CIbEqy9U.js +7319 -0
  32. package/dist/index-CkjEllpd.js +1 -0
  33. package/dist/index-CpKKFxCT.js +2 -0
  34. package/dist/index-Cw9DC-tf.js +76 -0
  35. package/dist/index-CzPi8KQC.js +1310 -0
  36. package/dist/index-D14V8rKX.js +1 -0
  37. package/dist/index-DVIy64gf.js +41 -0
  38. package/dist/index-gtgq_241.js +3 -0
  39. package/dist/index-l6kvDx-m.js +1360 -0
  40. package/dist/index-lcviy90e.js +613 -0
  41. package/dist/index-wOnYb3DO.js +567 -0
  42. package/dist/index.cjs +1 -0
  43. package/dist/index.d.ts +1354 -0
  44. package/dist/index.js +106 -0
  45. package/dist/messages-CO299wPN.js +22 -0
  46. package/dist/messages-O9Tw_XXR.js +1 -0
  47. package/dist/nodeRegistry.cjs +1 -0
  48. package/dist/nodeRegistry.d.ts +293 -0
  49. package/dist/nodeRegistry.js +538 -0
  50. package/dist/style.css +6 -0
  51. package/dist/templateRegistry.cjs +1 -0
  52. package/dist/templateRegistry.d.ts +83 -0
  53. package/dist/templateRegistry.js +43 -0
  54. package/dist/templateSkeletons-B3DkIUbY.js +1 -0
  55. package/dist/templateSkeletons-D60ixh5T.js +2617 -0
  56. package/package.json +112 -0
package/dist/index.js ADDED
@@ -0,0 +1,106 @@
1
+ import { D as d, F as c, a as u, b as m, I as f, V as g, c as F, d as b, e as h, f as k, g as T, h as w, i as S, j as y, k as x, l as D, m as N, n as R, o as W, p as P, q as v, s as A, r as E, t as C, u as I, v as B, w as V, x as z, y as L } from "./index-CIbEqy9U.js";
2
+ import { F as q, a as H, S as M, b as _, T as j, c as Y, d as G, u as J } from "./SchemaBuilderDrawer-DFyGUCZM.js";
3
+ import "react";
4
+ import "@mui/material";
5
+ import "react-icons/md";
6
+ import { NodeTypeRegistry as Q, baseNodeDefaults as U, conditionBranchDescriptor as X, defineNode as Z, endEventDescriptor as $, makeSubWorkflowDescriptor as ee, nodeTypeRegistry as ae, notificationDescriptor as se, restApiDescriptor as re, startEventDescriptor as oe, subWorkflowDescriptor as te, webhookTriggerDescriptor as ie, webhookTriggerTemplate as le } from "./nodeRegistry.js";
7
+ import { TemplateRegistry as pe, templateRegistry as de } from "./templateRegistry.js";
8
+ import { F as ue, S as me, F as fe, W as ge, a as Fe, b as be, o as he, u as ke, w as Te } from "./templateSkeletons-D60ixh5T.js";
9
+ import { d as Se } from "./messages-CO299wPN.js";
10
+ import { l as xe, s as De } from "./bpmn-CtfWDaOY.js";
11
+ import { A as Re, b as We, E as Pe, c as ve, F as Ae, R as Ee, S as Ce, T as Ie, W as Be, e as Ve } from "./GatewayBranchEdge-gncIBR-0.js";
12
+ class s {
13
+ constructor() {
14
+ this.channels = /* @__PURE__ */ new Map();
15
+ }
16
+ register(e, a) {
17
+ this.channels.set(e, a);
18
+ }
19
+ get(e) {
20
+ return this.channels.get(e);
21
+ }
22
+ list() {
23
+ return Array.from(this.channels.entries()).map(([e, a]) => ({ key: e, ...a }));
24
+ }
25
+ has(e) {
26
+ return this.channels.has(e);
27
+ }
28
+ }
29
+ const l = new s();
30
+ export {
31
+ Re as ActionNode,
32
+ We as ApprovalNode,
33
+ d as DynamicFormRenderer,
34
+ Pe as EdgeWithPlusLabel,
35
+ ve as EndNode,
36
+ c as FF,
37
+ q as FIELD_TYPE_OPTIONS,
38
+ Ae as FilterNode,
39
+ ue as FlowForgeCanvas,
40
+ H as FlowForgeRegistry,
41
+ u as FlowForm,
42
+ m as FormulaInput,
43
+ f as InfiniteSelectField,
44
+ Q as NodeTypeRegistry,
45
+ Ee as RestApiNode,
46
+ M as SchemaBuilder,
47
+ _ as SchemaBuilderDrawer,
48
+ Ce as StartNode,
49
+ me as SubWorkflowPreviewDrawer,
50
+ j as TablePickerField,
51
+ pe as TemplateRegistry,
52
+ Ie as TriggerNode,
53
+ g as VariablePicker,
54
+ F as VariablePickerProvider,
55
+ Be as WebhookTriggerNode,
56
+ fe as WorkflowCanvas,
57
+ ge as WorkflowExecutionHistory,
58
+ Fe as WorkflowTemplateLibrary,
59
+ be as accessRequestSkeleton,
60
+ b as astHasRefs,
61
+ h as astToTokens,
62
+ U as baseNodeDefaults,
63
+ k as buildEvaluationPayload,
64
+ T as buildFieldConfig,
65
+ w as buildFormulaPath,
66
+ S as buildSelectStyles,
67
+ Y as buildValidationSchema,
68
+ Ve as builtInNodeTypes,
69
+ X as conditionBranchDescriptor,
70
+ G as dataSourceRegistry,
71
+ Se as defaultFlowForgeMessages,
72
+ Z as defineNode,
73
+ $ as endEventDescriptor,
74
+ y as errorTextStyle,
75
+ x as extractLabel,
76
+ D as fieldRegistry,
77
+ N as hasFormulaTokens,
78
+ R as helperTextStyle,
79
+ W as inputStyle,
80
+ P as isFormula,
81
+ xe as loadWorkflowFromBpmn,
82
+ ee as makeSubWorkflowDescriptor,
83
+ ae as nodeTypeRegistry,
84
+ l as notificationChannelRegistry,
85
+ se as notificationDescriptor,
86
+ he as offboardingSkeleton,
87
+ v as parseToAST,
88
+ re as restApiDescriptor,
89
+ De as saveWorkflowToBpmn,
90
+ A as serializeAST,
91
+ E as serializeASTAsConfig,
92
+ C as serializeConditionExpressions,
93
+ oe as startEventDescriptor,
94
+ I as stripFormulaTokens,
95
+ te as subWorkflowDescriptor,
96
+ de as templateRegistry,
97
+ B as tokenize,
98
+ V as unwrapFormula,
99
+ J as useFlowForm,
100
+ z as useVariablePickerContext,
101
+ ke as userOnboardingSkeleton,
102
+ Te as webhookIntegrationSkeleton,
103
+ ie as webhookTriggerDescriptor,
104
+ le as webhookTriggerTemplate,
105
+ L as wrapFormula
106
+ };
@@ -0,0 +1,22 @@
1
+ const e = {
2
+ addTriggerTitle: "Add Trigger",
3
+ addTriggerTooltip: "Click to add a trigger for your workflow",
4
+ addTriggerButton: "Add Trigger",
5
+ chooseTrigger: "Choose a trigger to start the workflow.",
6
+ noTriggers: "No triggers registered.",
7
+ addStepTitle: "Add Step",
8
+ chooseAction: "Choose an action to add to the workflow.",
9
+ noActions: "No actions available for this trigger.",
10
+ configureStep: "Configure Step",
11
+ loadingConfiguration: "Loading configuration...",
12
+ noConfigurationNeeded: "No configuration needed for this step.",
13
+ save: "Save",
14
+ cancel: "Cancel"
15
+ }, r = (o) => ({
16
+ ...e,
17
+ ...o ?? {}
18
+ });
19
+ export {
20
+ e as d,
21
+ r as m
22
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e={addTriggerTitle:"Add Trigger",addTriggerTooltip:"Click to add a trigger for your workflow",addTriggerButton:"Add Trigger",chooseTrigger:"Choose a trigger to start the workflow.",noTriggers:"No triggers registered.",addStepTitle:"Add Step",chooseAction:"Choose an action to add to the workflow.",noActions:"No actions available for this trigger.",configureStep:"Configure Step",loadingConfiguration:"Loading configuration...",noConfigurationNeeded:"No configuration needed for this step.",save:"Save",cancel:"Cancel"},r=o=>({...e,...o??{}});exports.defaultFlowForgeMessages=e;exports.mergeMessages=r;
@@ -0,0 +1 @@
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"}],f=o({type:"conditionBranch",label:"Condition Branch",icon:a.createElement(r.MdCallSplit,{size:18,color:"#512da8"}),matches:e=>e.startsWith("conditionBranch-"),reactFlowType:"conditionBranchNode",branchLabels:{branch1:"Branch 1",branch2:"Branch 2",default:"Default"},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:"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",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}))]}}),E=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=f;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=E;exports.webhookTriggerTemplate=g;
@@ -0,0 +1,293 @@
1
+ import { AnySchema } from 'yup';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * Base defaults shared by every node descriptor. A new node only has to specify
6
+ * what makes it different — these fill in the rest.
7
+ *
8
+ * - `formSchema: []` → no config form unless the node defines one
9
+ * - `bpmnEntry` / `bpmnExit` → incoming/outgoing flow connects to the node id itself
10
+ * - `emitBpmnElements` → a single generic bpmn:Task; override for real output
11
+ */
12
+ export declare const baseNodeDefaults: Pick<NodeDescriptor, 'formSchema' | 'bpmnEntry' | 'bpmnExit' | 'emitBpmnElements'>;
13
+
14
+ declare interface BpmnElement {
15
+ id: string;
16
+ $type: string;
17
+ [key: string]: unknown;
18
+ }
19
+
20
+ declare type BranchChain = CanvasSlot[];
21
+
22
+ declare interface BranchMap {
23
+ [filterId: string]: {
24
+ [branchKey: string]: BranchChain;
25
+ };
26
+ }
27
+
28
+ declare interface CanvasSlot {
29
+ id: string;
30
+ kind: SlotKind;
31
+ reactFlowType: string;
32
+ descriptorType?: string;
33
+ formData?: Record<string, unknown>;
34
+ nodeData?: Record<string, unknown>;
35
+ deletable?: boolean;
36
+ label?: string;
37
+ /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' } */
38
+ branchLabels?: Record<string, string>;
39
+ }
40
+
41
+ export declare const conditionBranchDescriptor: NodeDescriptor;
42
+
43
+ /** One column in a per-field condition row */
44
+ declare interface ConditionFieldDef {
45
+ /** Key used to store this column's value in ConditionEntry */
46
+ id: string;
47
+ /**
48
+ * 'select' — native <select> with user-supplied options
49
+ * 'operator' — native <select> pre-filled with the standard operator list (no options needed)
50
+ * 'text' — plain <input>
51
+ * any other string — falls back to <input>
52
+ */
53
+ type: 'select' | 'operator' | 'text' | string;
54
+ colSpan?: number;
55
+ label?: string;
56
+ placeholder?: string;
57
+ /** Options for select columns — user defines these, renderer just renders them */
58
+ options?: Array<{
59
+ value: string;
60
+ label: string;
61
+ }>;
62
+ /** When true, renders a FormulaInput chip editor instead of a plain <input> */
63
+ formula?: boolean;
64
+ }
65
+
66
+ /**
67
+ * Build a node descriptor on top of {@link baseNodeDefaults}.
68
+ *
69
+ * Supply the four required identity fields plus only the behaviour you want to
70
+ * override. Everything else inherits the base.
71
+ *
72
+ * export const startEventDescriptor = defineNode({
73
+ * type: 'startEvent',
74
+ * label: 'Start',
75
+ * matches: (id) => id === 'start',
76
+ * reactFlowType: 'startNode',
77
+ * emitBpmnElements: (id) => [{ id, $type: 'bpmn:StartEvent' }], // override
78
+ * });
79
+ */
80
+ export declare function defineNode(overrides: RequiredNodeFields & Partial<NodeDescriptor>): NodeDescriptor;
81
+
82
+ declare interface DmnDefinition {
83
+ id: string;
84
+ [key: string]: unknown;
85
+ }
86
+
87
+ /**
88
+ * End event — a fixed skeleton node with no user-editable form.
89
+ * The canvas seeds the main-spine end as the literal slot id `'end'`, and one
90
+ * end per branch as `'end-${filterId}-${branch}'` (see WorkflowCanvas.tsx).
91
+ * `matches` must cover both shapes so every terminal node resolves via `forId`
92
+ * during descriptor-driven BPMN load — otherwise branch ends get skipped.
93
+ *
94
+ * Inherits formSchema (none) and bpmnEntry/bpmnExit from the base node.
95
+ */
96
+ export declare const endEventDescriptor: NodeDescriptor;
97
+
98
+ /** Condition definition attached to a FieldDescriptor */
99
+ declare interface FieldConditionDef {
100
+ fields: ConditionFieldDef[];
101
+ /** Enables nested condition groups. Defaults to false. */
102
+ allowGroups?: boolean;
103
+ /** Optional depth limit for nested groups when allowGroups is true. */
104
+ maxGroupDepth?: number;
105
+ }
106
+
107
+ declare interface FieldContext {
108
+ values: Record<string, unknown>;
109
+ }
110
+
111
+ declare interface FieldDescriptor {
112
+ /**
113
+ * The formik key for this field.
114
+ * Use `id` (preferred) or `name` — both are accepted.
115
+ * `id` takes precedence if both are provided.
116
+ */
117
+ id?: string;
118
+ name?: string;
119
+ type: FieldType | string;
120
+ /** Child field descriptors — used by type: 'object' to render a nested group. */
121
+ children?: FieldDescriptor[];
122
+ /** Optional per-field condition guard — renders a condition row below this field. */
123
+ condition?: FieldConditionDef;
124
+ label?: string;
125
+ placeholder?: string;
126
+ required?: boolean;
127
+ showOptional?: boolean;
128
+ disabled?: boolean | ((ctx: FieldContext) => boolean);
129
+ hidden?: boolean;
130
+ colSpan?: number;
131
+ dividerAfter?: boolean;
132
+ info?: string;
133
+ helperText?: string;
134
+ dataTestId?: string;
135
+ validation?: AnySchema;
136
+ shouldHide?: (ctx: FieldContext) => boolean;
137
+ shouldDisable?: (ctx: FieldContext) => boolean;
138
+ shouldRequire?: (ctx: FieldContext) => boolean;
139
+ compute?: (ctx: FieldContext) => unknown;
140
+ transform?: FieldTransform;
141
+ onChange?: (value: unknown, ctx: FieldContext & {
142
+ setFieldValue: (name: string, value: unknown) => void;
143
+ }) => void;
144
+ [key: string]: unknown;
145
+ }
146
+
147
+ declare interface FieldTransform {
148
+ in?: (value: unknown) => unknown;
149
+ out?: (value: unknown) => unknown;
150
+ }
151
+
152
+ declare type FieldType = 'text' | 'textarea' | 'number' | 'toggle' | 'radio-group' | 'select' | 'descriptive-select' | 'key-value' | 'array' | 'object' | 'reference' | 'cron' | 'schema';
153
+
154
+ declare interface FixedEdge {
155
+ id: string;
156
+ source: string;
157
+ target: string;
158
+ }
159
+
160
+ declare interface FixedNode {
161
+ id: string;
162
+ type: string;
163
+ data?: Record<string, unknown>;
164
+ deletable?: false;
165
+ }
166
+
167
+ export declare function makeSubWorkflowDescriptor(opts?: SubWorkflowDescriptorOptions): NodeDescriptor;
168
+
169
+ export declare interface NodeDescriptor {
170
+ type: string;
171
+ label: string;
172
+ icon?: ReactNode;
173
+ /**
174
+ * Optional "app" this action belongs to (Slack, Salesforce, …). When present,
175
+ * the node picker drills down: stage 1 lists unique apps, stage 2 lists this
176
+ * app's actions, stage 3 is the action's config form. Descriptors without an
177
+ * `app` field appear ungrouped at stage 1, alongside the app cards.
178
+ */
179
+ app?: {
180
+ key: string;
181
+ label: string;
182
+ icon?: ReactNode;
183
+ description?: string;
184
+ };
185
+ matches: (id: string) => boolean;
186
+ bpmnEntry: (nodeId: string) => string;
187
+ bpmnExit: (nodeId: string) => string;
188
+ emitBpmnElements: (nodeId: string, nodeData: unknown) => BpmnElement[];
189
+ emitDmnDefinition?: (nodeId: string, nodeData: unknown) => DmnDefinition;
190
+ outgoingCondition?: (nodeId: string, targetId: string, nodeData: unknown) => string;
191
+ reactFlowType: string;
192
+ previewNodeType?: string;
193
+ /**
194
+ * Optional custom node-card body. When provided, the node renderer shows this
195
+ * instead of the default value badges — lets a node author fully design the
196
+ * card body while keeping the shared frame (title, edit/delete, handles).
197
+ * Receives the node's saved formData.
198
+ */
199
+ renderNode?: (nodeData: Record<string, unknown>) => ReactNode;
200
+ /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' }. Only applies to branching nodes (filterNode, approvalNode). */
201
+ branchLabels?: Record<string, string>;
202
+ formSchema: FieldDescriptor[] | ((nodeId: string) => Promise<FieldDescriptor[]>);
203
+ maxPerWorkflow?: number;
204
+ relatedNodePrefixes?: string[];
205
+ }
206
+
207
+ export declare class NodeTypeRegistry {
208
+ private descriptors;
209
+ register(descriptor: NodeDescriptor): this;
210
+ forType(type: string): NodeDescriptor | undefined;
211
+ forId(id: string): NodeDescriptor | undefined;
212
+ list(): NodeDescriptor[];
213
+ }
214
+
215
+ export declare const nodeTypeRegistry: NodeTypeRegistry;
216
+
217
+ export declare const notificationDescriptor: NodeDescriptor;
218
+
219
+ /** The fields every node MUST provide — there is no sensible default for these. */
220
+ declare type RequiredNodeFields = Pick<NodeDescriptor, 'type' | 'label' | 'matches' | 'reactFlowType'>;
221
+
222
+ export declare const restApiDescriptor: NodeDescriptor;
223
+
224
+ declare type SlotKind = 'start' | 'end' | 'addTrigger' | 'triggerFixed' | 'userTask' | 'addStep' | 'filter' | 'approval';
225
+
226
+ /**
227
+ * Start event — a fixed skeleton node with no user-editable form.
228
+ * The canvas seeds it as the literal slot id `'start'` (see buildInitialSlots
229
+ * in WorkflowCanvas.tsx). This descriptor exists so the registry can resolve
230
+ * that id via `forId('start')` and emit it during descriptor-driven BPMN save.
231
+ *
232
+ * Inherits formSchema (none) and bpmnEntry/bpmnExit from the base node.
233
+ */
234
+ export declare const startEventDescriptor: NodeDescriptor;
235
+
236
+ /** Pre-built static descriptor (no dynamic workflow list). Swap for makeSubWorkflowDescriptor when you have an API. */
237
+ export declare const subWorkflowDescriptor: NodeDescriptor;
238
+
239
+ /**
240
+ * Sub-Workflow node — calls another saved workflow by ID.
241
+ *
242
+ * The host app must provide `fetchWorkflowOptions` at registration time so the
243
+ * `workflowId` select field can populate. Inject it via the descriptor factory:
244
+ *
245
+ * import { makeSubWorkflowDescriptor } from '@miniorange/flowforge';
246
+ * nodeTypeRegistry.register(makeSubWorkflowDescriptor({
247
+ * fetchWorkflowOptions: async () => myApi.listWorkflows(),
248
+ * }));
249
+ */
250
+ export declare interface SubWorkflowDescriptorOptions {
251
+ /** Return a list of available workflows for the workflowId select field */
252
+ fetchWorkflowOptions?: () => Promise<Array<{
253
+ label: string;
254
+ value: string;
255
+ }>>;
256
+ }
257
+
258
+ export declare const webhookTriggerDescriptor: NodeDescriptor;
259
+
260
+ export declare const webhookTriggerTemplate: WorkflowTemplate;
261
+
262
+ declare interface WorkflowState {
263
+ slots: CanvasSlot[];
264
+ branches: BranchMap;
265
+ }
266
+
267
+ declare interface WorkflowTemplate {
268
+ triggerKey: string;
269
+ label: string;
270
+ description?: string;
271
+ icon?: ReactNode;
272
+ triggerCategory?: 'event' | 'scheduler' | 'webhook' | string;
273
+ availableTasks?: string[];
274
+ maxTasks?: number;
275
+ taskLabels?: Record<string, string>;
276
+ fixedNodes?: FixedNode[];
277
+ fixedEdges?: FixedEdge[];
278
+ insertionPoints?: string[];
279
+ source?: string;
280
+ product?: string;
281
+ /** Pre-built workflow state to clone when user selects this template */
282
+ skeletonState?: WorkflowState;
283
+ /** Tags for filtering in the template library */
284
+ tags?: string[];
285
+ /** Category grouping in the library */
286
+ category?: string;
287
+ /** Team or author that owns this template */
288
+ author?: string;
289
+ /** Relative popularity score (higher = shown first in library) */
290
+ popularity?: number;
291
+ }
292
+
293
+ export { }