next-workflow-builder 0.4.4 → 0.4.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.
@@ -217,6 +217,10 @@ function generateAIActionPrompts() {
217
217
  }
218
218
  return lines.join("\n");
219
219
  }
220
+ function integrationRequiresCredentials(type) {
221
+ const plugin = integrationRegistry.get(type);
222
+ return !!plugin && plugin.formFields.length > 0;
223
+ }
220
224
 
221
225
  export {
222
226
  registerCodegenTemplates,
@@ -242,5 +246,6 @@ export {
242
246
  getCredentialMapping,
243
247
  isFieldGroup,
244
248
  flattenConfigFields,
245
- generateAIActionPrompts
249
+ generateAIActionPrompts,
250
+ integrationRequiresCredentials
246
251
  };
@@ -13,7 +13,7 @@ import {
13
13
  computeActionId,
14
14
  getAllIntegrations,
15
15
  getIntegrationTypes
16
- } from "./chunk-Z3BJJYHM.js";
16
+ } from "./chunk-3XFDIK7H.js";
17
17
 
18
18
  // src/plugins/discover.ts
19
19
  import { createJiti } from "jiti";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  findActionById,
3
3
  flattenConfigFields
4
- } from "./chunk-Z3BJJYHM.js";
4
+ } from "./chunk-3XFDIK7H.js";
5
5
 
6
6
  // src/client/lib/workflow-codegen-shared.ts
7
7
  var TEMPLATE_PATTERN = /\{\{([^}]+)\}\}/g;
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getCredentialMapping,
6
6
  getIntegration
7
- } from "./chunk-Z3BJJYHM.js";
7
+ } from "./chunk-3XFDIK7H.js";
8
8
 
9
9
  // src/server/lib/credential-fetcher.ts
10
10
  var SYSTEM_CREDENTIAL_MAPPERS = {
@@ -4,7 +4,7 @@ import {
4
4
  databaseQueryAction,
5
5
  generateWorkflowCode,
6
6
  httpRequestAction
7
- } from "../chunk-XJ67EFQA.js";
7
+ } from "../chunk-MIBRBQIJ.js";
8
8
  import {
9
9
  cn
10
10
  } from "../chunk-5YYA34YV.js";
@@ -19,8 +19,9 @@ import {
19
19
  getIntegrationLabels,
20
20
  getOutputDisplayConfig,
21
21
  getSortedIntegrationTypes,
22
+ integrationRequiresCredentials,
22
23
  isFieldGroup
23
- } from "../chunk-Z3BJJYHM.js";
24
+ } from "../chunk-3XFDIK7H.js";
24
25
 
25
26
  // src/client/components/pages/workflow-page.tsx
26
27
  import { AuthView } from "@daveyplate/better-auth-ui";
@@ -5103,7 +5104,9 @@ function ActionConfig({
5103
5104
  return SYSTEM_ACTION_INTEGRATIONS2[actionType];
5104
5105
  }
5105
5106
  const action = findActionById(actionType);
5106
- return action?.integration;
5107
+ const type = action?.integration;
5108
+ if (type && !integrationRequiresCredentials(type)) return void 0;
5109
+ return type;
5107
5110
  }, [actionType]);
5108
5111
  const shouldUseManagedKeys = integrationType === "ai-gateway" && aiGatewayStatus?.enabled && aiGatewayStatus?.isVercelUser;
5109
5112
  const hasExistingConnections = useMemo4(() => {
@@ -11479,6 +11482,9 @@ function getMissingIntegrations(nodes, userIntegrations) {
11479
11482
  if (!requiredIntegrationType) {
11480
11483
  continue;
11481
11484
  }
11485
+ if (!integrationRequiresCredentials(requiredIntegrationType)) {
11486
+ continue;
11487
+ }
11482
11488
  const configuredIntegrationId = node.data.config?.integrationId;
11483
11489
  const hasValidIntegration = configuredIntegrationId && userIntegrationIds.has(configuredIntegrationId);
11484
11490
  if (hasValidIntegration) {
@@ -12267,43 +12273,55 @@ function WorkflowMenuComponent({
12267
12273
  actions
12268
12274
  }) {
12269
12275
  return /* @__PURE__ */ jsxs51("div", { className: "flex flex-col gap-1", children: [
12270
- /* @__PURE__ */ jsx73("div", { className: "flex h-9 max-w-[160px] items-center overflow-hidden rounded-md border bg-secondary text-secondary-foreground sm:max-w-none", children: /* @__PURE__ */ jsxs51(DropdownMenu, { onOpenChange: (open) => open && actions.loadWorkflows(), children: [
12271
- /* @__PURE__ */ jsxs51(DropdownMenuTrigger, { className: "flex h-full cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-black/5 dark:hover:bg-white/5", children: [
12272
- /* @__PURE__ */ jsx73(WorkflowIcon, { className: "size-4 shrink-0" }),
12273
- /* @__PURE__ */ jsx73("p", { className: "truncate font-medium text-sm", children: workflowId ? state.workflowName : /* @__PURE__ */ jsxs51(Fragment17, { children: [
12274
- /* @__PURE__ */ jsx73("span", { className: "sm:hidden", children: "New" }),
12275
- /* @__PURE__ */ jsx73("span", { className: "hidden sm:inline", children: "New Workflow" })
12276
- ] }) }),
12277
- /* @__PURE__ */ jsx73(ChevronDown3, { className: "size-3 shrink-0 opacity-50" })
12278
- ] }),
12279
- /* @__PURE__ */ jsxs51(DropdownMenuContent, { align: "start", className: "w-64", children: [
12280
- /* @__PURE__ */ jsx73(
12281
- DropdownMenuItem,
12282
- {
12283
- asChild: true,
12284
- className: "flex items-center justify-between",
12285
- children: /* @__PURE__ */ jsxs51("a", { href: "/", children: [
12286
- "New Workflow",
12287
- " ",
12288
- !workflowId && /* @__PURE__ */ jsx73(Check5, { className: "size-4 shrink-0" })
12289
- ] })
12290
- }
12291
- ),
12292
- /* @__PURE__ */ jsx73(DropdownMenuSeparator, {}),
12293
- state.allWorkflows.length === 0 ? /* @__PURE__ */ jsx73(DropdownMenuItem, { disabled: true, children: "No workflows found" }) : state.allWorkflows.filter((w) => w.name !== "__current__").map((workflow) => /* @__PURE__ */ jsxs51(
12294
- DropdownMenuItem,
12295
- {
12296
- className: "flex items-center justify-between",
12297
- onClick: () => state.router.push(`/workflows/${workflow.id}`),
12298
- children: [
12299
- /* @__PURE__ */ jsx73("span", { className: "truncate", children: workflow.name }),
12300
- workflow.id === state.currentWorkflowId && /* @__PURE__ */ jsx73(Check5, { className: "size-4 shrink-0" })
12301
- ]
12302
- },
12303
- workflow.id
12304
- ))
12305
- ] })
12306
- ] }) }),
12276
+ /* @__PURE__ */ jsx73(
12277
+ "div",
12278
+ {
12279
+ className: "flex h-9 max-w-[160px] items-center overflow-hidden rounded-md border bg-secondary text-secondary-foreground sm:max-w-none",
12280
+ children: /* @__PURE__ */ jsxs51(DropdownMenu, { onOpenChange: (open) => open && actions.loadWorkflows(), children: [
12281
+ /* @__PURE__ */ jsxs51(
12282
+ DropdownMenuTrigger,
12283
+ {
12284
+ className: "flex h-full cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-black/5 dark:hover:bg-white/5",
12285
+ children: [
12286
+ /* @__PURE__ */ jsx73(WorkflowIcon, { className: "size-4 shrink-0" }),
12287
+ /* @__PURE__ */ jsx73("p", { className: "truncate font-medium text-sm", children: workflowId ? state.workflowName : /* @__PURE__ */ jsxs51(Fragment17, { children: [
12288
+ /* @__PURE__ */ jsx73("span", { className: "sm:hidden", children: "New" }),
12289
+ /* @__PURE__ */ jsx73("span", { className: "hidden sm:inline", children: "New Workflow" })
12290
+ ] }) }),
12291
+ /* @__PURE__ */ jsx73(ChevronDown3, { className: "size-3 shrink-0 opacity-50" })
12292
+ ]
12293
+ }
12294
+ ),
12295
+ /* @__PURE__ */ jsxs51(DropdownMenuContent, { align: "start", className: "w-64", children: [
12296
+ /* @__PURE__ */ jsx73(
12297
+ DropdownMenuItem,
12298
+ {
12299
+ asChild: true,
12300
+ className: "flex items-center justify-between",
12301
+ children: /* @__PURE__ */ jsxs51("a", { href: "/", children: [
12302
+ "New Workflow",
12303
+ " ",
12304
+ !workflowId && /* @__PURE__ */ jsx73(Check5, { className: "size-4 shrink-0" })
12305
+ ] })
12306
+ }
12307
+ ),
12308
+ /* @__PURE__ */ jsx73(DropdownMenuSeparator, {}),
12309
+ state.allWorkflows.length === 0 ? /* @__PURE__ */ jsx73(DropdownMenuItem, { disabled: true, children: "No workflows found" }) : state.allWorkflows.filter((w) => w.name !== "__current__").map((workflow) => /* @__PURE__ */ jsxs51(
12310
+ DropdownMenuItem,
12311
+ {
12312
+ className: "flex items-center justify-between",
12313
+ onClick: () => state.router.push(`/workflows/${workflow.id}`),
12314
+ children: [
12315
+ /* @__PURE__ */ jsx73("span", { className: "truncate", children: workflow.name }),
12316
+ workflow.id === state.currentWorkflowId && /* @__PURE__ */ jsx73(Check5, { className: "size-4 shrink-0" })
12317
+ ]
12318
+ },
12319
+ workflow.id
12320
+ ))
12321
+ ] })
12322
+ ] })
12323
+ }
12324
+ ),
12307
12325
  workflowId && !state.isOwner && /* @__PURE__ */ jsx73("span", { className: "text-muted-foreground text-xs uppercase lg:hidden", children: "Read-only" })
12308
12326
  ] });
12309
12327
  }
@@ -12662,7 +12680,8 @@ var requiresIntegration = (actionType) => {
12662
12680
  return true;
12663
12681
  }
12664
12682
  const action = findActionById(actionType);
12665
- return action !== void 0;
12683
+ if (!action) return false;
12684
+ return integrationRequiresCredentials(action.integration);
12666
12685
  };
12667
12686
  var getProviderLogo = (actionType) => {
12668
12687
  switch (actionType) {
@@ -1,11 +1,11 @@
1
1
  import "./chunk-KZNRU3LB.js";
2
- import "./chunk-TFNZVQEH.js";
2
+ import "./chunk-C7GDB4KC.js";
3
3
  import "./chunk-F6HAK4HT.js";
4
4
  import "./chunk-5YYA34YV.js";
5
5
  import "./chunk-OQHML4II.js";
6
- import "./chunk-2IJUDWUK.js";
6
+ import "./chunk-X5GOM4L4.js";
7
7
  import "./chunk-BL6QJDNB.js";
8
- import "./chunk-Z3BJJYHM.js";
8
+ import "./chunk-3XFDIK7H.js";
9
9
  import "./chunk-O3I2INCD.js";
10
10
  import {
11
11
  withStepLogging
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  fetchCredentials
3
- } from "./chunk-2IJUDWUK.js";
3
+ } from "./chunk-X5GOM4L4.js";
4
4
  import "./chunk-BL6QJDNB.js";
5
- import "./chunk-Z3BJJYHM.js";
5
+ import "./chunk-3XFDIK7H.js";
6
6
  import {
7
7
  withStepLogging
8
8
  } from "./chunk-PGG52OSJ.js";
@@ -1,11 +1,11 @@
1
1
  import "./chunk-KZNRU3LB.js";
2
- import "./chunk-TFNZVQEH.js";
2
+ import "./chunk-C7GDB4KC.js";
3
3
  import "./chunk-F6HAK4HT.js";
4
4
  import "./chunk-5YYA34YV.js";
5
5
  import "./chunk-OQHML4II.js";
6
- import "./chunk-2IJUDWUK.js";
6
+ import "./chunk-X5GOM4L4.js";
7
7
  import "./chunk-BL6QJDNB.js";
8
- import "./chunk-Z3BJJYHM.js";
8
+ import "./chunk-3XFDIK7H.js";
9
9
  import "./chunk-O3I2INCD.js";
10
10
  import {
11
11
  withStepLogging
@@ -1,11 +1,11 @@
1
1
  import "./chunk-KZNRU3LB.js";
2
- import "./chunk-TFNZVQEH.js";
2
+ import "./chunk-C7GDB4KC.js";
3
3
  import "./chunk-F6HAK4HT.js";
4
4
  import "./chunk-5YYA34YV.js";
5
5
  import "./chunk-OQHML4II.js";
6
- import "./chunk-2IJUDWUK.js";
6
+ import "./chunk-X5GOM4L4.js";
7
7
  import "./chunk-BL6QJDNB.js";
8
- import "./chunk-Z3BJJYHM.js";
8
+ import "./chunk-3XFDIK7H.js";
9
9
  import "./chunk-O3I2INCD.js";
10
10
  import {
11
11
  withStepLogging
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  discoverPlugins
3
- } from "../chunk-TFNZVQEH.js";
3
+ } from "../chunk-C7GDB4KC.js";
4
4
  import "../chunk-OQHML4II.js";
5
- import "../chunk-Z3BJJYHM.js";
5
+ import "../chunk-3XFDIK7H.js";
6
6
 
7
7
  // src/next/index.ts
8
8
  import { join } from "path";
@@ -109,5 +109,10 @@ declare function flattenConfigFields(fields: ActionConfigField[]): ActionConfigF
109
109
  * This dynamically builds the action types documentation for the AI
110
110
  */
111
111
  declare function generateAIActionPrompts(): string;
112
+ /**
113
+ * Check if an integration type requires credentials (has formFields).
114
+ * Plugins with no formFields (e.g. facebook-event-scraper) don't need a connection.
115
+ */
116
+ declare function integrationRequiresCredentials(type: IntegrationType): boolean;
112
117
 
113
- export { ActionConfigField, ActionConfigFieldBase, ActionConfigFieldGroup, ActionWithFullId, IntegrationPlugin, computeActionId, findActionById, flattenConfigFields, generateAIActionPrompts, getActionsByCategory, getAllActions, getAllDependencies, getAllEnvVars, getAllIntegrations, getCodegenTemplate, getCredentialMapping, getDependenciesForActions, getIntegration, getIntegrationDescriptions, getIntegrationLabels, getIntegrationTypes, getOutputDisplayConfig, getPluginEnvVars, getSortedIntegrationTypes, isFieldGroup, parseActionId, registerCodegenTemplates, registerIntegration, registerOutputDisplayConfigs };
118
+ export { ActionConfigField, ActionConfigFieldBase, ActionConfigFieldGroup, ActionWithFullId, IntegrationPlugin, computeActionId, findActionById, flattenConfigFields, generateAIActionPrompts, getActionsByCategory, getAllActions, getAllDependencies, getAllEnvVars, getAllIntegrations, getCodegenTemplate, getCredentialMapping, getDependenciesForActions, getIntegration, getIntegrationDescriptions, getIntegrationLabels, getIntegrationTypes, getOutputDisplayConfig, getPluginEnvVars, getSortedIntegrationTypes, integrationRequiresCredentials, isFieldGroup, parseActionId, registerCodegenTemplates, registerIntegration, registerOutputDisplayConfigs };
@@ -18,12 +18,13 @@ import {
18
18
  getOutputDisplayConfig,
19
19
  getPluginEnvVars,
20
20
  getSortedIntegrationTypes,
21
+ integrationRequiresCredentials,
21
22
  isFieldGroup,
22
23
  parseActionId,
23
24
  registerCodegenTemplates,
24
25
  registerIntegration,
25
26
  registerOutputDisplayConfigs
26
- } from "../chunk-Z3BJJYHM.js";
27
+ } from "../chunk-3XFDIK7H.js";
27
28
  export {
28
29
  computeActionId,
29
30
  findActionById,
@@ -44,6 +45,7 @@ export {
44
45
  getOutputDisplayConfig,
45
46
  getPluginEnvVars,
46
47
  getSortedIntegrationTypes,
48
+ integrationRequiresCredentials,
47
49
  isFieldGroup,
48
50
  parseActionId,
49
51
  registerCodegenTemplates,
@@ -11,7 +11,7 @@ import {
11
11
  sanitizeFunctionName,
12
12
  sanitizeStepName,
13
13
  sanitizeVarName
14
- } from "../../chunk-XJ67EFQA.js";
14
+ } from "../../chunk-MIBRBQIJ.js";
15
15
  import {
16
16
  auth,
17
17
  getAuthConfig
@@ -38,7 +38,7 @@ import {
38
38
  findActionById,
39
39
  getAllEnvVars,
40
40
  getDependenciesForActions
41
- } from "../../chunk-Z3BJJYHM.js";
41
+ } from "../../chunk-3XFDIK7H.js";
42
42
  import {
43
43
  accounts,
44
44
  apiKeys,
@@ -416,7 +416,7 @@ triggerStep.maxRetries = 0;
416
416
  var SYSTEM_ACTIONS = {
417
417
  "Database Query": {
418
418
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic module import
419
- importer: () => import("../../database-query-Q2JDUQ3N.js"),
419
+ importer: () => import("../../database-query-C4GDVVDK.js"),
420
420
  stepFunction: "databaseQueryStep"
421
421
  },
422
422
  "HTTP Request": {
@@ -426,22 +426,22 @@ var SYSTEM_ACTIONS = {
426
426
  },
427
427
  Condition: {
428
428
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic module import
429
- importer: () => import("../../condition-YFHUXD7D.js"),
429
+ importer: () => import("../../condition-IWTKYMBN.js"),
430
430
  stepFunction: "conditionStep"
431
431
  },
432
432
  Loop: {
433
433
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic module import
434
- importer: () => import("../../loop-37IXIL3L.js"),
434
+ importer: () => import("../../loop-2237QQBO.js"),
435
435
  stepFunction: "loopStep"
436
436
  },
437
437
  Switch: {
438
438
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic module import
439
- importer: () => import("../../switch-SG2SNUUJ.js"),
439
+ importer: () => import("../../switch-H2N4F2YX.js"),
440
440
  stepFunction: "switchStep"
441
441
  },
442
442
  Merge: {
443
443
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic module import
444
- importer: () => import("../../merge-2GBB4W2S.js"),
444
+ importer: () => import("../../merge-Q5YUAT6F.js"),
445
445
  stepFunction: "mergeStep"
446
446
  }
447
447
  };
@@ -660,10 +660,14 @@ async function executeWorkflow(input) {
660
660
  const results = {};
661
661
  const nodeMap = new Map(nodes.map((n) => [n.id, n]));
662
662
  const edgesBySource = /* @__PURE__ */ new Map();
663
+ const edgesByTarget = /* @__PURE__ */ new Map();
663
664
  for (const edge of edges) {
664
665
  const targets = edgesBySource.get(edge.source) || [];
665
666
  targets.push(edge.target);
666
667
  edgesBySource.set(edge.source, targets);
668
+ const sources = edgesByTarget.get(edge.target) || [];
669
+ sources.push(edge.source);
670
+ edgesByTarget.set(edge.target, sources);
667
671
  }
668
672
  const nodesWithIncoming = new Set(edges.map((e) => e.target));
669
673
  const triggerNodes = nodes.filter(
@@ -788,10 +792,27 @@ async function executeWorkflow(input) {
788
792
  nodeName: getNodeName(node),
789
793
  nodeType: actionType
790
794
  };
795
+ const predecessorData = {};
796
+ const predecessorIds = edgesByTarget.get(nodeId) || [];
797
+ for (const predId of predecessorIds) {
798
+ const sanitizedPredId = predId.replace(/[^a-zA-Z0-9]/g, "_");
799
+ const predOutput = outputs[sanitizedPredId];
800
+ if (predOutput?.data && typeof predOutput.data === "object") {
801
+ let payload = predOutput.data;
802
+ if ("success" in payload && "data" in payload && payload.data && typeof payload.data === "object") {
803
+ payload = payload.data;
804
+ }
805
+ for (const [key, value] of Object.entries(payload)) {
806
+ if (key !== "success" && key !== "error") {
807
+ predecessorData[key] = value;
808
+ }
809
+ }
810
+ }
811
+ }
791
812
  console.log("[Workflow Executor] Calling executeActionStep");
792
813
  const stepResult = await executeActionStep({
793
814
  actionType,
794
- config: processedConfig,
815
+ config: { ...predecessorData, ...processedConfig },
795
816
  outputs,
796
817
  context: stepContext
797
818
  });
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-KZNRU3LB.js";
4
4
  import {
5
5
  discoverPlugins
6
- } from "../chunk-TFNZVQEH.js";
6
+ } from "../chunk-C7GDB4KC.js";
7
7
  import {
8
8
  auth
9
9
  } from "../chunk-F6HAK4HT.js";
@@ -13,12 +13,12 @@ import {
13
13
  import "../chunk-OQHML4II.js";
14
14
  import {
15
15
  fetchCredentials
16
- } from "../chunk-2IJUDWUK.js";
16
+ } from "../chunk-X5GOM4L4.js";
17
17
  import {
18
18
  decrypt,
19
19
  encrypt
20
20
  } from "../chunk-BL6QJDNB.js";
21
- import "../chunk-Z3BJJYHM.js";
21
+ import "../chunk-3XFDIK7H.js";
22
22
  import {
23
23
  getErrorMessage
24
24
  } from "../chunk-O3I2INCD.js";
@@ -1,11 +1,11 @@
1
1
  import "./chunk-KZNRU3LB.js";
2
- import "./chunk-TFNZVQEH.js";
2
+ import "./chunk-C7GDB4KC.js";
3
3
  import "./chunk-F6HAK4HT.js";
4
4
  import "./chunk-5YYA34YV.js";
5
5
  import "./chunk-OQHML4II.js";
6
- import "./chunk-2IJUDWUK.js";
6
+ import "./chunk-X5GOM4L4.js";
7
7
  import "./chunk-BL6QJDNB.js";
8
- import "./chunk-Z3BJJYHM.js";
8
+ import "./chunk-3XFDIK7H.js";
9
9
  import "./chunk-O3I2INCD.js";
10
10
  import {
11
11
  withStepLogging
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-workflow-builder",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "type": "module",
5
5
  "description": "Next.js plugin for Workflow Builder",
6
6
  "repository": "https://github.com/emulienfou/next-workflow-builder",