@runtypelabs/react-flow 0.1.4 → 0.1.6

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,18 +1,18 @@
1
1
 
2
- > @runtypelabs/react-flow@0.1.4 build /home/runner/work/core/core/packages/react-flow
2
+ > @runtypelabs/react-flow@0.1.6 build /home/runner/_work/core/core/packages/react-flow
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.1
8
- CLI Using tsup config: /home/runner/work/core/core/packages/react-flow/tsup.config.ts
8
+ CLI Using tsup config: /home/runner/_work/core/core/packages/react-flow/tsup.config.ts
9
9
  CLI Target: es2020
10
10
  CLI Cleaning output folder
11
11
  CJS Build start
12
12
  ESM Build start
13
- CJS dist/index.js 104.29 KB
14
- CJS dist/index.js.map 224.04 KB
15
- CJS ⚡️ Build success in 2183ms
16
- ESM dist/index.mjs 100.24 KB
17
- ESM dist/index.mjs.map 223.72 KB
18
- ESM ⚡️ Build success in 2183ms
13
+ CJS dist/index.js 105.20 KB
14
+ CJS dist/index.js.map 224.71 KB
15
+ CJS ⚡️ Build success in 402ms
16
+ ESM dist/index.mjs 101.15 KB
17
+ ESM dist/index.mjs.map 224.39 KB
18
+ ESM ⚡️ Build success in 402ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @runtypelabs/react-flow
2
2
 
3
+ ## 0.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0140d17]
8
+ - @runtypelabs/sdk@0.5.0
9
+
10
+ ## 0.1.5
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [cf6fcdc]
15
+ - @runtypelabs/sdk@0.4.0
16
+
3
17
  ## 0.1.4
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -54,13 +54,13 @@ function MyFlowEditor() {
54
54
 
55
55
  ## Supported Step Types
56
56
 
57
- | Step Type | Node Component | Description |
58
- |-----------|---------------|-------------|
59
- | `prompt` | PromptNode | AI text generation with model selection |
60
- | `fetch-url` | FetchUrlNode | HTTP requests to fetch data |
61
- | `transform-data` | CodeNode | JavaScript code execution |
62
- | `conditional` | ConditionalNode | Branch execution based on conditions |
63
- | `send-email` | SendEmailNode | Send emails |
57
+ | Step Type | Node Component | Description |
58
+ | ---------------- | --------------- | --------------------------------------- |
59
+ | `prompt` | PromptNode | AI text generation with model selection |
60
+ | `fetch-url` | FetchUrlNode | HTTP requests to fetch data |
61
+ | `transform-data` | CodeNode | JavaScript code execution |
62
+ | `conditional` | ConditionalNode | Branch execution based on conditions |
63
+ | `send-email` | SendEmailNode | Send emails |
64
64
 
65
65
  ## Components
66
66
 
@@ -86,19 +86,19 @@ The main editor component that wraps React Flow with Runtype integration.
86
86
 
87
87
  **Props:**
88
88
 
89
- | Prop | Type | Description |
90
- |------|------|-------------|
91
- | `client` | `RuntypeClient` | Required. Runtype API client instance |
92
- | `flowId` | `string` | ID of an existing flow to load |
93
- | `initialName` | `string` | Initial flow name for new flows |
94
- | `initialDescription` | `string` | Initial flow description |
95
- | `initialSteps` | `FlowStep[]` | Initial steps to populate |
96
- | `onSave` | `(flow) => void` | Callback when flow is saved |
97
- | `onChange` | `(nodes, edges) => void` | Callback when flow changes |
98
- | `onStepSelect` | `(step) => void` | Callback when a step is selected |
99
- | `showToolbar` | `boolean` | Whether to show the toolbar (default: true) |
100
- | `readOnly` | `boolean` | Whether the editor is read-only (default: false) |
101
- | `className` | `string` | Custom class name for the container |
89
+ | Prop | Type | Description |
90
+ | -------------------- | ------------------------ | ------------------------------------------------ |
91
+ | `client` | `RuntypeClient` | Required. Runtype API client instance |
92
+ | `flowId` | `string` | ID of an existing flow to load |
93
+ | `initialName` | `string` | Initial flow name for new flows |
94
+ | `initialDescription` | `string` | Initial flow description |
95
+ | `initialSteps` | `FlowStep[]` | Initial steps to populate |
96
+ | `onSave` | `(flow) => void` | Callback when flow is saved |
97
+ | `onChange` | `(nodes, edges) => void` | Callback when flow changes |
98
+ | `onStepSelect` | `(step) => void` | Callback when a step is selected |
99
+ | `showToolbar` | `boolean` | Whether to show the toolbar (default: true) |
100
+ | `readOnly` | `boolean` | Whether the editor is read-only (default: false) |
101
+ | `className` | `string` | Custom class name for the container |
102
102
 
103
103
  ## Hooks
104
104
 
@@ -273,6 +273,7 @@ This package exports TypeScript types directly from source files to ensure compa
273
273
  ### Peer Dependencies
274
274
 
275
275
  This package requires the following peer dependencies:
276
+
276
277
  - `react` ^18.0.0
277
278
  - `react-dom` ^18.0.0
278
279
  - `@xyflow/react` ^12.0.0
@@ -288,4 +289,3 @@ import '@xyflow/react/dist/style.css'
288
289
  ## License
289
290
 
290
291
  MIT
291
-
package/dist/index.js CHANGED
@@ -95,7 +95,9 @@ function flowStepsToNodes(steps, options) {
95
95
  }
96
96
  if (maxBranchLength > 0) {
97
97
  const advance = BRANCH_OFFSET_X + maxBranchLength * (NODE_WIDTH + NODE_SPACING_X);
98
- console.log(`[flowStepsToNodes] Conditional "${step.name}" has ${maxBranchLength} branch steps, advancing currentX by ${advance}`);
98
+ console.log(
99
+ `[flowStepsToNodes] Conditional "${step.name}" has ${maxBranchLength} branch steps, advancing currentX by ${advance}`
100
+ );
99
101
  currentX += advance;
100
102
  console.log(`[flowStepsToNodes] After conditional, currentX = ${currentX}`);
101
103
  } else {
@@ -108,7 +110,9 @@ function flowStepsToNodes(steps, options) {
108
110
  return nodes;
109
111
  }
110
112
  function nodesToFlowSteps(nodes) {
111
- const topLevelNodes = nodes.filter((n) => !n.parentId && !n.id.includes("-true-") && !n.id.includes("-false-"));
113
+ const topLevelNodes = nodes.filter(
114
+ (n) => !n.parentId && !n.id.includes("-true-") && !n.id.includes("-false-")
115
+ );
112
116
  const sortedNodes = [...topLevelNodes].sort((a, b) => a.position.x - b.position.x);
113
117
  return sortedNodes.map((node, index) => {
114
118
  const step = node.data.step;
@@ -160,7 +164,9 @@ function createEdgesFromNodes(nodes) {
160
164
  data: { stepOrder: i }
161
165
  });
162
166
  }
163
- const conditionalNodes = nodes.filter((n) => n.data.step.type === "conditional" && !isBranchNode(n));
167
+ const conditionalNodes = nodes.filter(
168
+ (n) => n.data.step.type === "conditional" && !isBranchNode(n)
169
+ );
164
170
  for (const conditionalNode of conditionalNodes) {
165
171
  const conditionalId = conditionalNode.id;
166
172
  const conditionalIndex = topLevelNodes.findIndex((n) => n.id === conditionalId);
@@ -290,13 +296,13 @@ function createEdgesFromNodes(nodes) {
290
296
  }
291
297
  function getDefaultStepName(type) {
292
298
  const names = {
293
- "prompt": "AI Prompt",
299
+ prompt: "AI Prompt",
294
300
  "fetch-url": "Fetch URL",
295
301
  "retrieve-record": "Retrieve Record",
296
302
  "fetch-github": "Fetch GitHub",
297
303
  "api-call": "API Call",
298
304
  "transform-data": "Transform Data",
299
- "conditional": "Conditional",
305
+ conditional: "Conditional",
300
306
  "set-variable": "Set Variable",
301
307
  "upsert-record": "Upsert Record",
302
308
  "send-email": "Send Email",
@@ -304,7 +310,7 @@ function getDefaultStepName(type) {
304
310
  "send-event": "Send Event",
305
311
  "send-stream": "Send Stream",
306
312
  "update-record": "Update Record",
307
- "search": "Search",
313
+ search: "Search",
308
314
  "generate-embedding": "Generate Embedding",
309
315
  "vector-search": "Vector Search",
310
316
  "tool-call": "Tool Call",
@@ -624,9 +630,7 @@ function useRuntypeFlow(options) {
624
630
  const handleStepDelete = react.useCallback(
625
631
  (stepId) => {
626
632
  setNodes((nds) => nds.filter((node) => node.id !== stepId));
627
- setEdges(
628
- (eds) => eds.filter((edge) => edge.source !== stepId && edge.target !== stepId)
629
- );
633
+ setEdges((eds) => eds.filter((edge) => edge.source !== stepId && edge.target !== stepId));
630
634
  setHasUnsavedChanges(true);
631
635
  },
632
636
  [setNodes, setEdges]
@@ -1085,10 +1089,7 @@ function useFlowValidation(options) {
1085
1089
  warnings
1086
1090
  };
1087
1091
  }, [steps]);
1088
- const validateStepFn = react.useCallback(
1089
- (step) => validateStep(step, steps),
1090
- [steps]
1091
- );
1092
+ const validateStepFn = react.useCallback((step) => validateStep(step, steps), [steps]);
1092
1093
  const isStepValid = react.useCallback(
1093
1094
  (stepId) => {
1094
1095
  return !result.errors.some((e) => e.stepId === stepId);
@@ -1542,10 +1543,21 @@ var PromptNode = react.memo(function PromptNode2(props) {
1542
1543
  )
1543
1544
  ] }),
1544
1545
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles2.field, children: [
1545
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "4px" }, children: [
1546
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: styles2.label, children: "Mode" }),
1547
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles2.modeBadge(isAgentMode), children: isAgentMode ? "Agent" : "Instruction" })
1548
- ] }),
1546
+ /* @__PURE__ */ jsxRuntime.jsxs(
1547
+ "div",
1548
+ {
1549
+ style: {
1550
+ display: "flex",
1551
+ justifyContent: "space-between",
1552
+ alignItems: "center",
1553
+ marginBottom: "4px"
1554
+ },
1555
+ children: [
1556
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: styles2.label, children: "Mode" }),
1557
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles2.modeBadge(isAgentMode), children: isAgentMode ? "Agent" : "Instruction" })
1558
+ ]
1559
+ }
1560
+ ),
1549
1561
  /* @__PURE__ */ jsxRuntime.jsxs(
1550
1562
  "select",
1551
1563
  {
@@ -1821,10 +1833,21 @@ var FetchUrlNode = react.memo(function FetchUrlNode2(props) {
1821
1833
  )
1822
1834
  ] }),
1823
1835
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles3.field, children: [
1824
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "4px" }, children: [
1825
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: styles3.label, children: "Method" }),
1826
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles3.methodBadge(method), children: method })
1827
- ] }),
1836
+ /* @__PURE__ */ jsxRuntime.jsxs(
1837
+ "div",
1838
+ {
1839
+ style: {
1840
+ display: "flex",
1841
+ justifyContent: "space-between",
1842
+ alignItems: "center",
1843
+ marginBottom: "4px"
1844
+ },
1845
+ children: [
1846
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: styles3.label, children: "Method" }),
1847
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles3.methodBadge(method), children: method })
1848
+ ]
1849
+ }
1850
+ ),
1828
1851
  /* @__PURE__ */ jsxRuntime.jsxs(
1829
1852
  "select",
1830
1853
  {
@@ -2103,10 +2126,21 @@ var CodeNode = react.memo(function CodeNode2(props) {
2103
2126
  )
2104
2127
  ] }),
2105
2128
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles4.field, children: [
2106
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "4px" }, children: [
2107
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: styles4.label, children: "Code" }),
2108
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles4.languageBadge(language), children: language })
2109
- ] }),
2129
+ /* @__PURE__ */ jsxRuntime.jsxs(
2130
+ "div",
2131
+ {
2132
+ style: {
2133
+ display: "flex",
2134
+ justifyContent: "space-between",
2135
+ alignItems: "center",
2136
+ marginBottom: "4px"
2137
+ },
2138
+ children: [
2139
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: styles4.label, children: "Code" }),
2140
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles4.languageBadge(language), children: language })
2141
+ ]
2142
+ }
2143
+ ),
2110
2144
  /* @__PURE__ */ jsxRuntime.jsx(
2111
2145
  "textarea",
2112
2146
  {
@@ -3176,43 +3210,109 @@ function RuntypeFlowEditor({
3176
3210
  ] });
3177
3211
  }
3178
3212
  function PlusIcon() {
3179
- return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
3180
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
3181
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
3182
- ] });
3213
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3214
+ "svg",
3215
+ {
3216
+ width: "14",
3217
+ height: "14",
3218
+ viewBox: "0 0 24 24",
3219
+ fill: "none",
3220
+ stroke: "currentColor",
3221
+ strokeWidth: "2",
3222
+ children: [
3223
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
3224
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
3225
+ ]
3226
+ }
3227
+ );
3183
3228
  }
3184
3229
  function PromptIcon() {
3185
- return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
3186
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z" }),
3187
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z" })
3188
- ] });
3230
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3231
+ "svg",
3232
+ {
3233
+ width: "14",
3234
+ height: "14",
3235
+ viewBox: "0 0 24 24",
3236
+ fill: "none",
3237
+ stroke: "currentColor",
3238
+ strokeWidth: "2",
3239
+ children: [
3240
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z" }),
3241
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z" })
3242
+ ]
3243
+ }
3244
+ );
3189
3245
  }
3190
3246
  function GlobeIcon2() {
3191
- return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
3192
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
3193
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }),
3194
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12h20" })
3195
- ] });
3247
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3248
+ "svg",
3249
+ {
3250
+ width: "14",
3251
+ height: "14",
3252
+ viewBox: "0 0 24 24",
3253
+ fill: "none",
3254
+ stroke: "currentColor",
3255
+ strokeWidth: "2",
3256
+ children: [
3257
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
3258
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }),
3259
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12h20" })
3260
+ ]
3261
+ }
3262
+ );
3196
3263
  }
3197
3264
  function CodeIcon2() {
3198
- return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
3199
- /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 18 22 12 16 6" }),
3200
- /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "8 6 2 12 8 18" })
3201
- ] });
3265
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3266
+ "svg",
3267
+ {
3268
+ width: "14",
3269
+ height: "14",
3270
+ viewBox: "0 0 24 24",
3271
+ fill: "none",
3272
+ stroke: "currentColor",
3273
+ strokeWidth: "2",
3274
+ children: [
3275
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 18 22 12 16 6" }),
3276
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "8 6 2 12 8 18" })
3277
+ ]
3278
+ }
3279
+ );
3202
3280
  }
3203
3281
  function BranchIcon() {
3204
- return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
3205
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "3", x2: "6", y2: "15" }),
3206
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "6", r: "3" }),
3207
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "18", r: "3" }),
3208
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 9a9 9 0 0 1-9 9" })
3209
- ] });
3282
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3283
+ "svg",
3284
+ {
3285
+ width: "14",
3286
+ height: "14",
3287
+ viewBox: "0 0 24 24",
3288
+ fill: "none",
3289
+ stroke: "currentColor",
3290
+ strokeWidth: "2",
3291
+ children: [
3292
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "3", x2: "6", y2: "15" }),
3293
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "6", r: "3" }),
3294
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "18", r: "3" }),
3295
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 9a9 9 0 0 1-9 9" })
3296
+ ]
3297
+ }
3298
+ );
3210
3299
  }
3211
3300
  function MailIcon2() {
3212
- return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
3213
- /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "20", height: "16", x: "2", y: "4", rx: "2" }),
3214
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" })
3215
- ] });
3301
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3302
+ "svg",
3303
+ {
3304
+ width: "14",
3305
+ height: "14",
3306
+ viewBox: "0 0 24 24",
3307
+ fill: "none",
3308
+ stroke: "currentColor",
3309
+ strokeWidth: "2",
3310
+ children: [
3311
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "20", height: "16", x: "2", y: "4", rx: "2" }),
3312
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" })
3313
+ ]
3314
+ }
3315
+ );
3216
3316
  }
3217
3317
 
3218
3318
  exports.BaseNode = BaseNode;