next-workflow-builder 0.5.0 → 0.7.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 (52) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/README.md +1 -1
  3. package/dist/chunk-5J6TNMJG.js +1 -0
  4. package/dist/chunk-6UXAINJQ.js +1 -0
  5. package/dist/chunk-7WFHHPX4.js +1 -0
  6. package/dist/chunk-BNX2SV7E.js +1 -0
  7. package/dist/chunk-CYVALTSI.js +218 -0
  8. package/dist/chunk-DMHGXYVW.js +14 -0
  9. package/dist/chunk-HB2H2PVI.js +42 -0
  10. package/dist/chunk-IEOZJAW2.js +1 -0
  11. package/dist/chunk-KFTXS23Q.js +1 -0
  12. package/dist/chunk-NI6U7PHC.js +76 -0
  13. package/dist/chunk-PRVESNIO.js +1 -0
  14. package/dist/chunk-QRG4O4PE.js +2 -0
  15. package/dist/chunk-R5GS6TJS.js +1 -0
  16. package/dist/client/index.js +160 -13725
  17. package/dist/condition-CFAA7UDI.js +1 -0
  18. package/dist/database-query-OHFQUPLV.js +1 -0
  19. package/dist/handler-NWAMWKXW.js +1 -0
  20. package/dist/http-request-EHJHOTNA.js +1 -0
  21. package/dist/loop-5LPVY452.js +1 -0
  22. package/dist/merge-HYBHX22D.js +1 -0
  23. package/dist/next/index.d.ts +9 -0
  24. package/dist/next/index.js +1 -84
  25. package/dist/plugins/index.js +1 -54
  26. package/dist/server/api/index.d.ts +30 -1
  27. package/dist/server/api/index.js +18 -2360
  28. package/dist/server/index.js +1 -60
  29. package/dist/switch-ZPVREROE.js +1 -0
  30. package/drizzle.config.ts +9 -0
  31. package/package.json +27 -2
  32. package/src/plugins/types.ts +31 -0
  33. package/src/server/db/schema.ts +228 -0
  34. package/src/server/lib/utils/id.ts +26 -0
  35. package/dist/chunk-3XFDIK7H.js +0 -251
  36. package/dist/chunk-5H76TY4T.js +0 -51
  37. package/dist/chunk-5YYA34YV.js +0 -96
  38. package/dist/chunk-C7GDB4KC.js +0 -550
  39. package/dist/chunk-CKE7ETZL.js +0 -169
  40. package/dist/chunk-EMCA7GLF.js +0 -1305
  41. package/dist/chunk-J72T2LRL.js +0 -66
  42. package/dist/chunk-JUV5RBYM.js +0 -105
  43. package/dist/chunk-O3I2INCD.js +0 -71
  44. package/dist/chunk-OQHML4II.js +0 -36
  45. package/dist/chunk-PEVVELQ6.js +0 -438
  46. package/dist/condition-VHC4KYLI.js +0 -29
  47. package/dist/database-query-BYPF5CDB.js +0 -99
  48. package/dist/http-request-4OT32ZXA.js +0 -76
  49. package/dist/loop-S5H7DSCB.js +0 -47
  50. package/dist/merge-X5JAIZSZ.js +0 -107
  51. package/dist/style-prefixed.css +0 -5167
  52. package/dist/switch-WZBVDWWR.js +0 -68
@@ -0,0 +1,76 @@
1
+ import{GitBranch as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";var a={id:"Condition",label:"Condition",description:"Branch based on a condition",category:"System",icon:e(t,{className:"size-12 text-pink-300",strokeWidth:1.5}),codeGenerator:`export async function conditionStep(input: {
2
+ condition: boolean;
3
+ dataType?: string;
4
+ operator?: string;
5
+ leftValue?: unknown;
6
+ rightValue?: unknown;
7
+ }) {
8
+ "use step";
9
+
10
+ // Evaluate structured condition
11
+ return { condition: input.condition };
12
+ }`};import{Database as o}from"lucide-react";import{jsx as n}from"react/jsx-runtime";var u={id:"Database Query",label:"Database Query",description:"Query your database",category:"System",icon:n(o,{className:"size-12 text-blue-300",strokeWidth:1.5}),codeGenerator:`export async function databaseQueryStep(input: {
13
+ query: string;
14
+ }) {
15
+ "use step";
16
+
17
+ const databaseUrl = process.env.DATABASE_URL;
18
+ if (!databaseUrl) {
19
+ return { success: false, error: "DATABASE_URL environment variable is not set" };
20
+ }
21
+
22
+ const postgres = await import("postgres");
23
+ const sql = postgres.default(databaseUrl, { max: 1 });
24
+
25
+ try {
26
+ const result = await sql.unsafe(input.query);
27
+ await sql.end();
28
+ return { success: true, rows: result, count: result.length };
29
+ } catch (error) {
30
+ await sql.end();
31
+ const message = error instanceof Error ? error.message : String(error);
32
+ return { success: false, error: \`Database query failed: \${message}\` };
33
+ }
34
+ }`};import{Zap as r}from"lucide-react";import{jsx as s}from"react/jsx-runtime";var f={id:"HTTP Request",label:"HTTP Request",description:"Make an HTTP request to any API",category:"System",icon:s(r,{className:"size-12 text-amber-300",strokeWidth:1.5}),codeGenerator:`export async function httpRequestStep(input: {
35
+ endpoint: string;
36
+ httpMethod: string;
37
+ httpHeaders?: string;
38
+ httpBody?: string;
39
+ }) {
40
+ "use step";
41
+
42
+ let headers = {};
43
+ if (input.httpHeaders) {
44
+ try {
45
+ headers = JSON.parse(input.httpHeaders);
46
+ } catch {
47
+ // If parsing fails, use empty headers
48
+ }
49
+ }
50
+
51
+ let body: string | undefined;
52
+ if (input.httpMethod !== "GET" && input.httpBody) {
53
+ try {
54
+ const parsedBody = JSON.parse(input.httpBody);
55
+ if (Object.keys(parsedBody).length > 0) {
56
+ body = JSON.stringify(parsedBody);
57
+ }
58
+ } catch {
59
+ if (input.httpBody.trim() && input.httpBody.trim() !== "{}") {
60
+ body = input.httpBody;
61
+ }
62
+ }
63
+ }
64
+
65
+ const response = await fetch(input.endpoint, {
66
+ method: input.httpMethod,
67
+ headers,
68
+ body,
69
+ });
70
+
71
+ const contentType = response.headers.get("content-type");
72
+ if (contentType?.includes("application/json")) {
73
+ return await response.json();
74
+ }
75
+ return await response.text();
76
+ }`};export{a,u as b,f as c};
@@ -0,0 +1 @@
1
+ import{e as a}from"./chunk-KFTXS23Q.js";import{h as o,u as i}from"./chunk-QRG4O4PE.js";var l={database:t=>{let e={};return t.url&&(e.DATABASE_URL=t.url),e}};function s(t,e){let n=l[t];if(n)return n(e);let r=o(t);return r?i(r,e):{}}async function f(t){console.log("[Credential Fetcher] Fetching integration:",t);let e=await a(t);if(!e)return console.log("[Credential Fetcher] Integration not found"),{};console.log("[Credential Fetcher] Found integration:",e.type);let n=s(e.type,e.config);return console.log("[Credential Fetcher] Returning credentials for type:",e.type),n}export{f as a};
@@ -0,0 +1,2 @@
1
+ var r=new Map,c=new Map,l=new Map;function A(n){for(let[t,e]of Object.entries(n))c.set(t,e)}function I(n){return c.get(n)}function x(n){for(let[t,e]of Object.entries(n))l.set(t,e)}function m(n){return l.get(n)}function g(n,t){return`${n}/${t}`}function a(n){if(!n||typeof n!="string")return null;let t=n.split("/");return t.length!==2?null:{integration:t[0],slug:t[1]}}function C(n){r.set(n.type,n)}function F(n){return r.get(n)}function R(){return Array.from(r.values())}function T(){return Array.from(r.keys())}function v(){let n=[];for(let t of r.values())for(let e of t.actions)n.push({...e,id:g(t.type,e.slug),integration:t.type});return n}function h(){let n={};for(let t of r.values())for(let e of t.actions)n[e.category]||(n[e.category]=[]),n[e.category].push({...e,id:g(t.type,e.slug),integration:t.type});return n}function f(n){if(!n)return;let t=a(n);if(t){let e=r.get(t.integration);if(e){let i=e.actions.find(o=>o.slug===t.slug);if(i)return{...i,id:n,integration:e.type}}}for(let e of r.values()){let i=e.actions.find(o=>o.label===n);if(i)return{...i,id:g(e.type,i.slug),integration:e.type}}}function b(){let n={};for(let t of r.values())n[t.type]=t.label;return n}function O(){let n={};for(let t of r.values())n[t.type]=t.description;return n}function P(){return Array.from(r.keys()).sort()}function D(){let n={};for(let t of r.values())t.dependencies&&Object.assign(n,t.dependencies);return n}function V(n){let t={},e=new Set;for(let i of n){let o=f(i);o&&e.add(o.integration)}for(let i of e){let o=r.get(i);o?.dependencies&&Object.assign(t,o.dependencies)}return t}function p(n){let t=[];for(let e of n.formFields)e.envVar&&t.push({name:e.envVar,description:e.helpText||e.label});return t}function k(){let n=[];for(let t of r.values())n.push(...p(t));return n}function S(n,t){let e={};for(let i of n.formFields)i.envVar&&t[i.configKey]&&(e[i.envVar]=String(t[i.configKey]));return e}function d(n){return n.type==="group"}function y(n){let t=[];for(let e of n)d(e)?t.push(...e.fields):t.push(e);return t}function W(){let n=[];for(let t of r.values())for(let e of t.actions){let i=g(t.type,e.slug),o={actionType:i},u=y(e.configFields);for(let s of u)s.showWhen||(s.example!==void 0?o[s.key]=s.example:s.defaultValue!==void 0?o[s.key]=s.defaultValue:s.type==="number"?o[s.key]=10:s.type==="select"&&s.options?.[0]?o[s.key]=s.options[0].value:o[s.key]=`Your ${s.label.toLowerCase()}`);n.push(`- ${e.label} (${i}): ${JSON.stringify(o)}`)}return n.join(`
2
+ `)}function w(n){let t=r.get(n);return!!t&&t.formFields.length>0}export{A as a,I as b,x as c,m as d,g as e,a as f,C as g,F as h,R as i,T as j,v as k,h as l,f as m,b as n,O as o,P as p,D as q,V as r,p as s,k as t,S as u,d as v,y as w,W as x,w as y};
@@ -0,0 +1 @@
1
+ import{i as a,o as s}from"./chunk-5J6TNMJG.js";import{eq as p}from"drizzle-orm";async function u({params:f}){let{slug:r}=await f;if(r?.[0]!=="workflows"||!r?.[1])return null;let e=r[1],o="Workflow",t=!1;try{let l=await s.query.workflows.findFirst({where:p(a.id,e),columns:{name:!0,visibility:!0}});l&&(t=l.visibility==="public",t&&(o=l.name))}catch{}let i=process.env.NEXT_PUBLIC_APP_URL||"https://workflow-builder.dev",n=`${i}/workflows/${e}`,w=t?`${i}/api/og/workflow/${e}`:`${i}/og-default.png`;return{title:`${o} | AI Workflow Builder`,description:`View and explore the "${o}" workflow built with AI Workflow Builder.`,openGraph:{title:`${o} | AI Workflow Builder`,description:`View and explore the "${o}" workflow built with AI Workflow Builder.`,type:"website",url:n,siteName:"AI Workflow Builder",images:[{url:w,width:1200,height:630,alt:`${o} workflow visualization`}]},twitter:{card:"summary_large_image",title:`${o} | AI Workflow Builder`,description:`View and explore the "${o}" workflow built with AI Workflow Builder.`,images:[w]}}}export{u as a};