next-workflow-builder 0.3.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.
@@ -0,0 +1,139 @@
1
+ type IntegrationType = "database" | "loop" | "switch" | string;
2
+ /**
3
+ * Output Display Config (serializable subset for built-in types only)
4
+ */
5
+ type SerializableOutputDisplayConfig = {
6
+ type: "image" | "video" | "url";
7
+ field: string;
8
+ };
9
+
10
+ /**
11
+ * Select Option
12
+ * Used for select/dropdown fields
13
+ */
14
+ type SelectOption = {
15
+ value: string;
16
+ label: string;
17
+ };
18
+ /**
19
+ * Base Action Config Field
20
+ * Declarative definition of a config field for an action
21
+ */
22
+ type ActionConfigFieldBase = {
23
+ key: string;
24
+ label: string;
25
+ type: "template-input" | "template-textarea" | "text" | "number" | "select" | "schema-builder";
26
+ placeholder?: string;
27
+ defaultValue?: string;
28
+ example?: string;
29
+ options?: SelectOption[];
30
+ rows?: number;
31
+ min?: number;
32
+ required?: boolean;
33
+ showWhen?: {
34
+ field: string;
35
+ equals: string;
36
+ };
37
+ };
38
+ /**
39
+ * Config Field Group
40
+ * Groups related fields together in a collapsible section
41
+ */
42
+ type ActionConfigFieldGroup = {
43
+ label: string;
44
+ type: "group";
45
+ fields: ActionConfigFieldBase[];
46
+ defaultExpanded?: boolean;
47
+ };
48
+ /**
49
+ * Action Config Field
50
+ * Can be either a regular field or a group of fields
51
+ */
52
+ type ActionConfigField = ActionConfigFieldBase | ActionConfigFieldGroup;
53
+ /**
54
+ * Output Field Definition
55
+ * Describes an output field available for template autocomplete
56
+ */
57
+ type OutputField = {
58
+ field: string;
59
+ description: string;
60
+ };
61
+ /**
62
+ * Result Component Props
63
+ * Props passed to custom result components
64
+ */
65
+ type ResultComponentProps = {
66
+ output: unknown;
67
+ input?: unknown;
68
+ };
69
+ /**
70
+ * Output Display Config
71
+ * Specifies how to render step output in the workflow runs panel
72
+ */
73
+ type OutputDisplayConfig = {
74
+ type: "image" | "video" | "url";
75
+ field: string;
76
+ } | {
77
+ type: "component";
78
+ component: React.ComponentType<ResultComponentProps>;
79
+ };
80
+ /**
81
+ * Action Definition
82
+ * Describes a single action provided by a plugin
83
+ */
84
+ type PluginAction = {
85
+ slug: string;
86
+ label: string;
87
+ description: string;
88
+ category: string;
89
+ stepFunction: string;
90
+ stepImportPath: string;
91
+ configFields: ActionConfigField[];
92
+ outputFields?: OutputField[];
93
+ outputConfig?: OutputDisplayConfig;
94
+ codegenTemplate?: string;
95
+ };
96
+ /**
97
+ * Integration Plugin Definition
98
+ * All information needed to register a new integration in one place
99
+ */
100
+ type IntegrationPlugin = {
101
+ type: IntegrationType;
102
+ label: string;
103
+ description: string;
104
+ icon: React.ComponentType<{
105
+ className?: string;
106
+ }>;
107
+ formFields: Array<{
108
+ id: string;
109
+ label: string;
110
+ type: "text" | "password" | "url";
111
+ placeholder?: string;
112
+ helpText?: string;
113
+ helpLink?: {
114
+ text: string;
115
+ url: string;
116
+ };
117
+ configKey: string;
118
+ envVar?: string;
119
+ }>;
120
+ testConfig?: {
121
+ getTestFunction: () => Promise<(credentials: Record<string, string>) => Promise<{
122
+ success: boolean;
123
+ error?: string;
124
+ }>>;
125
+ };
126
+ dependencies?: Record<string, string>;
127
+ actions: PluginAction[];
128
+ };
129
+ /**
130
+ * Action with full ID
131
+ * Includes the computed full action ID (integration/slug)
132
+ */
133
+ type ActionWithFullId = PluginAction & {
134
+ id: string;
135
+ integration: IntegrationType;
136
+ };
137
+ type WorkflowCredentials = Record<string, string | undefined>;
138
+
139
+ export type { ActionWithFullId as A, IntegrationType as I, PluginAction as P, ResultComponentProps as R, SerializableOutputDisplayConfig as S, WorkflowCredentials as W, ActionConfigField as a, ActionConfigFieldBase as b, IntegrationPlugin as c, ActionConfigFieldGroup as d };
package/package.json ADDED
@@ -0,0 +1,112 @@
1
+ {
2
+ "name": "next-workflow-builder",
3
+ "version": "0.3.0",
4
+ "type": "module",
5
+ "description": "Next.js plugin for Workflow Builder",
6
+ "repository": "https://github.com/emulienfou/next-workflow-builder",
7
+ "license": "MIT",
8
+ "engines": {
9
+ "node": ">=22.0.0"
10
+ },
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ "./package.json": "./package.json",
14
+ "./styles.css": "./dist/styles.css",
15
+ ".": {
16
+ "types": "./dist/next/index.d.ts",
17
+ "import": "./dist/next/index.js",
18
+ "require": "./dist/next/index.js"
19
+ },
20
+ "./client": {
21
+ "types": "./dist/client/index.d.ts",
22
+ "import": "./dist/client/index.js",
23
+ "require": "./dist/client/index.js"
24
+ },
25
+ "./plugins": {
26
+ "types": "./dist/plugins/index.d.ts",
27
+ "import": "./dist/plugins/index.js",
28
+ "require": "./dist/plugins/index.js"
29
+ },
30
+ "./server": {
31
+ "types": "./dist/server/index.d.ts",
32
+ "import": "./dist/server/index.js",
33
+ "require": "./dist/server/index.js"
34
+ },
35
+ "./api": {
36
+ "types": "./dist/server/api/index.d.ts",
37
+ "import": "./dist/server/api/index.js",
38
+ "require": "./dist/server/api/index.js"
39
+ },
40
+ "./server/db/schema": {
41
+ "types": "./dist/server/db/schema.d.ts",
42
+ "import": "./dist/server/db/schema.js",
43
+ "require": "./dist/server/db/schema.js"
44
+ }
45
+ },
46
+ "bin": {
47
+ "nwb": "src/scripts/nwb.ts"
48
+ },
49
+ "files": [
50
+ "dist"
51
+ ],
52
+ "scripts": {
53
+ "build": "NODE_ENV=production tsup",
54
+ "dev": "tsup --watch",
55
+ "prepublishOnly": "pnpm build",
56
+ "types:check": "tsc --noEmit"
57
+ },
58
+ "dependencies": {
59
+ "@daveyplate/better-auth-ui": "^3.3.15",
60
+ "@inquirer/prompts": "^8.0.1",
61
+ "@monaco-editor/react": "^4.7.0",
62
+ "@radix-ui/react-checkbox": "^1.3.3",
63
+ "@radix-ui/react-collapsible": "^1.1.12",
64
+ "@radix-ui/react-context-menu": "^2.2.16",
65
+ "@radix-ui/react-dialog": "^1.1.15",
66
+ "@radix-ui/react-tooltip": "^1.2.8",
67
+ "@xyflow/react": "^12.9.2",
68
+ "better-auth": "^1.4",
69
+ "class-variance-authority": "^0.7.1",
70
+ "clsx": "^2.1.1",
71
+ "drizzle-orm": "^0.44.7",
72
+ "jiti": "^2.0.0",
73
+ "jotai": "^2.15.1",
74
+ "jszip": "^3.10.1",
75
+ "lucide-react": "^0.552.0",
76
+ "motion": "^12.23.24",
77
+ "nanoid": "^5.1.6",
78
+ "next": "^16",
79
+ "next-themes": "^0.4.6",
80
+ "postgres": "^3.4.7",
81
+ "radix-ui": "^1.4.3",
82
+ "react-resizable-panels": "^3.0.6",
83
+ "server-only": "^0.0.1",
84
+ "sonner": "^2.0.7",
85
+ "tailwind-merge": "^3.3.1",
86
+ "vaul": "^1.1.2",
87
+ "workflow": "4.0.1-beta.17",
88
+ "zod": "^4.1.12"
89
+ },
90
+ "peerDependencies": {
91
+ "next": ">=16",
92
+ "react": ">=19",
93
+ "react-dom": ">=19"
94
+ },
95
+ "devDependencies": {
96
+ "@tailwindcss/postcss": "^4",
97
+ "@types/node": "^22.0.0",
98
+ "@types/react": "^19.2.3",
99
+ "@types/react-dom": "^19.2.3",
100
+ "drizzle-kit": "^0.31.6",
101
+ "next": "^16",
102
+ "prettier": "^3.7.3",
103
+ "react": "^19",
104
+ "react-dom": "^19",
105
+ "tailwindcss": "4.1.10",
106
+ "tsup": "^8.0.0",
107
+ "tw-animate-css": "^1.4.0",
108
+ "typescript": "^5",
109
+ "zx": "^8.2.4"
110
+ },
111
+ "sideEffects": false
112
+ }
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env tsx
2
+
3
+ /**
4
+ * nwb - Next Workflow Builder CLI
5
+ *
6
+ * Entry point for running workflow builder scripts from consumer projects.
7
+ *
8
+ * Usage:
9
+ * npx nwb <command>
10
+ *
11
+ * Commands:
12
+ * discover-plugins Discover plugins and generate registry files
13
+ * create-plugin Scaffold a new plugin from templates
14
+ * migrate-prod Run database migrations for production (Vercel)
15
+ */
16
+
17
+ const command = process.argv[2];
18
+
19
+ const COMMANDS: Record<string, string> = {
20
+ "discover-plugins": "./discover-plugins.ts",
21
+ "create-plugin": "./create-plugin.ts",
22
+ "migrate-prod": "./migrate-prod.ts",
23
+ };
24
+
25
+ function printUsage(): void {
26
+ console.log(`
27
+ nwb - Next Workflow Builder CLI
28
+
29
+ Usage:
30
+ npx nwb <command>
31
+
32
+ Commands:
33
+ discover-plugins Discover plugins and generate registry files
34
+ create-plugin Scaffold a new plugin from templates
35
+ migrate-prod Run database migrations for production (Vercel)
36
+ `);
37
+ }
38
+
39
+ if (!command || command === "--help" || command === "-h") {
40
+ printUsage();
41
+ process.exit(0);
42
+ }
43
+
44
+ const scriptPath = COMMANDS[command];
45
+
46
+ if (!scriptPath) {
47
+ console.error(`Unknown command: ${ command }\n`);
48
+ printUsage();
49
+ process.exit(1);
50
+ }
51
+
52
+ await import(scriptPath);
53
+
54
+ export {};