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.
- package/README.md +165 -0
- package/dist/chunk-3MSAF2TH.js +438 -0
- package/dist/chunk-5YYA34YV.js +96 -0
- package/dist/chunk-7MUXUHEL.js +66 -0
- package/dist/chunk-BNYDOC3I.js +169 -0
- package/dist/chunk-D44JFQYX.js +546 -0
- package/dist/chunk-DJ7ANVJ3.js +51 -0
- package/dist/chunk-O3I2INCD.js +71 -0
- package/dist/chunk-OQHML4II.js +36 -0
- package/dist/chunk-P3DTV3QS.js +105 -0
- package/dist/chunk-XJ67EFQA.js +1162 -0
- package/dist/chunk-Z3BJJYHM.js +246 -0
- package/dist/client/index.d.ts +32 -0
- package/dist/client/index.js +13700 -0
- package/dist/condition-SFT7Y5YJ.js +29 -0
- package/dist/database-query-GRWP3S3M.js +99 -0
- package/dist/http-request-2HVCXQHK.js +76 -0
- package/dist/next/index.d.ts +42 -0
- package/dist/next/index.js +66 -0
- package/dist/plugins/index.d.ts +113 -0
- package/dist/plugins/index.js +52 -0
- package/dist/server/api/index.d.ts +8 -0
- package/dist/server/api/index.js +2672 -0
- package/dist/server/index.d.ts +2911 -0
- package/dist/server/index.js +60 -0
- package/dist/style-prefixed.css +5167 -0
- package/dist/styles.css +5167 -0
- package/dist/types-BACZx2Ft.d.ts +139 -0
- package/package.json +112 -0
- package/src/scripts/nwb.ts +54 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// src/plugins/index.ts
|
|
2
|
+
var integrationRegistry = /* @__PURE__ */ new Map();
|
|
3
|
+
var codegenTemplateRegistry = /* @__PURE__ */ new Map();
|
|
4
|
+
var outputDisplayConfigRegistry = /* @__PURE__ */ new Map();
|
|
5
|
+
function registerCodegenTemplates(templates) {
|
|
6
|
+
for (const [actionId, template] of Object.entries(templates)) {
|
|
7
|
+
codegenTemplateRegistry.set(actionId, template);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function getCodegenTemplate(actionId) {
|
|
11
|
+
return codegenTemplateRegistry.get(actionId);
|
|
12
|
+
}
|
|
13
|
+
function registerOutputDisplayConfigs(configs) {
|
|
14
|
+
for (const [actionId, config] of Object.entries(configs)) {
|
|
15
|
+
outputDisplayConfigRegistry.set(actionId, config);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function getOutputDisplayConfig(actionId) {
|
|
19
|
+
return outputDisplayConfigRegistry.get(actionId);
|
|
20
|
+
}
|
|
21
|
+
function computeActionId(integrationType, actionSlug) {
|
|
22
|
+
return `${integrationType}/${actionSlug}`;
|
|
23
|
+
}
|
|
24
|
+
function parseActionId(actionId) {
|
|
25
|
+
if (!actionId || typeof actionId !== "string") {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const parts = actionId.split("/");
|
|
29
|
+
if (parts.length !== 2) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return { integration: parts[0], slug: parts[1] };
|
|
33
|
+
}
|
|
34
|
+
function registerIntegration(plugin) {
|
|
35
|
+
integrationRegistry.set(plugin.type, plugin);
|
|
36
|
+
}
|
|
37
|
+
function getIntegration(type) {
|
|
38
|
+
return integrationRegistry.get(type);
|
|
39
|
+
}
|
|
40
|
+
function getAllIntegrations() {
|
|
41
|
+
return Array.from(integrationRegistry.values());
|
|
42
|
+
}
|
|
43
|
+
function getIntegrationTypes() {
|
|
44
|
+
return Array.from(integrationRegistry.keys());
|
|
45
|
+
}
|
|
46
|
+
function getAllActions() {
|
|
47
|
+
const actions = [];
|
|
48
|
+
for (const plugin of integrationRegistry.values()) {
|
|
49
|
+
for (const action of plugin.actions) {
|
|
50
|
+
actions.push({
|
|
51
|
+
...action,
|
|
52
|
+
id: computeActionId(plugin.type, action.slug),
|
|
53
|
+
integration: plugin.type
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return actions;
|
|
58
|
+
}
|
|
59
|
+
function getActionsByCategory() {
|
|
60
|
+
const categories = {};
|
|
61
|
+
for (const plugin of integrationRegistry.values()) {
|
|
62
|
+
for (const action of plugin.actions) {
|
|
63
|
+
if (!categories[action.category]) {
|
|
64
|
+
categories[action.category] = [];
|
|
65
|
+
}
|
|
66
|
+
categories[action.category].push({
|
|
67
|
+
...action,
|
|
68
|
+
id: computeActionId(plugin.type, action.slug),
|
|
69
|
+
integration: plugin.type
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return categories;
|
|
74
|
+
}
|
|
75
|
+
function findActionById(actionId) {
|
|
76
|
+
if (!actionId) {
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
const parsed = parseActionId(actionId);
|
|
80
|
+
if (parsed) {
|
|
81
|
+
const plugin = integrationRegistry.get(parsed.integration);
|
|
82
|
+
if (plugin) {
|
|
83
|
+
const action = plugin.actions.find((a) => a.slug === parsed.slug);
|
|
84
|
+
if (action) {
|
|
85
|
+
return {
|
|
86
|
+
...action,
|
|
87
|
+
id: actionId,
|
|
88
|
+
integration: plugin.type
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const plugin of integrationRegistry.values()) {
|
|
94
|
+
const action = plugin.actions.find((a) => a.label === actionId);
|
|
95
|
+
if (action) {
|
|
96
|
+
return {
|
|
97
|
+
...action,
|
|
98
|
+
id: computeActionId(plugin.type, action.slug),
|
|
99
|
+
integration: plugin.type
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
function getIntegrationLabels() {
|
|
106
|
+
const labels = {};
|
|
107
|
+
for (const plugin of integrationRegistry.values()) {
|
|
108
|
+
labels[plugin.type] = plugin.label;
|
|
109
|
+
}
|
|
110
|
+
return labels;
|
|
111
|
+
}
|
|
112
|
+
function getIntegrationDescriptions() {
|
|
113
|
+
const descriptions = {};
|
|
114
|
+
for (const plugin of integrationRegistry.values()) {
|
|
115
|
+
descriptions[plugin.type] = plugin.description;
|
|
116
|
+
}
|
|
117
|
+
return descriptions;
|
|
118
|
+
}
|
|
119
|
+
function getSortedIntegrationTypes() {
|
|
120
|
+
return Array.from(integrationRegistry.keys()).sort();
|
|
121
|
+
}
|
|
122
|
+
function getAllDependencies() {
|
|
123
|
+
const deps = {};
|
|
124
|
+
for (const plugin of integrationRegistry.values()) {
|
|
125
|
+
if (plugin.dependencies) {
|
|
126
|
+
Object.assign(deps, plugin.dependencies);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return deps;
|
|
130
|
+
}
|
|
131
|
+
function getDependenciesForActions(actionIds) {
|
|
132
|
+
const deps = {};
|
|
133
|
+
const integrations = /* @__PURE__ */ new Set();
|
|
134
|
+
for (const actionId of actionIds) {
|
|
135
|
+
const action = findActionById(actionId);
|
|
136
|
+
if (action) {
|
|
137
|
+
integrations.add(action.integration);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
for (const integrationType of integrations) {
|
|
141
|
+
const plugin = integrationRegistry.get(integrationType);
|
|
142
|
+
if (plugin?.dependencies) {
|
|
143
|
+
Object.assign(deps, plugin.dependencies);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return deps;
|
|
147
|
+
}
|
|
148
|
+
function getPluginEnvVars(plugin) {
|
|
149
|
+
const envVars = [];
|
|
150
|
+
for (const field of plugin.formFields) {
|
|
151
|
+
if (field.envVar) {
|
|
152
|
+
envVars.push({
|
|
153
|
+
name: field.envVar,
|
|
154
|
+
description: field.helpText || field.label
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return envVars;
|
|
159
|
+
}
|
|
160
|
+
function getAllEnvVars() {
|
|
161
|
+
const envVars = [];
|
|
162
|
+
for (const plugin of integrationRegistry.values()) {
|
|
163
|
+
envVars.push(...getPluginEnvVars(plugin));
|
|
164
|
+
}
|
|
165
|
+
return envVars;
|
|
166
|
+
}
|
|
167
|
+
function getCredentialMapping(plugin, config) {
|
|
168
|
+
const creds = {};
|
|
169
|
+
for (const field of plugin.formFields) {
|
|
170
|
+
if (field.envVar && config[field.configKey]) {
|
|
171
|
+
creds[field.envVar] = String(config[field.configKey]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return creds;
|
|
175
|
+
}
|
|
176
|
+
function isFieldGroup(field) {
|
|
177
|
+
return field.type === "group";
|
|
178
|
+
}
|
|
179
|
+
function flattenConfigFields(fields) {
|
|
180
|
+
const result = [];
|
|
181
|
+
for (const field of fields) {
|
|
182
|
+
if (isFieldGroup(field)) {
|
|
183
|
+
result.push(...field.fields);
|
|
184
|
+
} else {
|
|
185
|
+
result.push(field);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
function generateAIActionPrompts() {
|
|
191
|
+
const lines = [];
|
|
192
|
+
for (const plugin of integrationRegistry.values()) {
|
|
193
|
+
for (const action of plugin.actions) {
|
|
194
|
+
const fullId = computeActionId(plugin.type, action.slug);
|
|
195
|
+
const exampleConfig = {
|
|
196
|
+
actionType: fullId
|
|
197
|
+
};
|
|
198
|
+
const flatFields = flattenConfigFields(action.configFields);
|
|
199
|
+
for (const field of flatFields) {
|
|
200
|
+
if (field.showWhen) continue;
|
|
201
|
+
if (field.example !== void 0) {
|
|
202
|
+
exampleConfig[field.key] = field.example;
|
|
203
|
+
} else if (field.defaultValue !== void 0) {
|
|
204
|
+
exampleConfig[field.key] = field.defaultValue;
|
|
205
|
+
} else if (field.type === "number") {
|
|
206
|
+
exampleConfig[field.key] = 10;
|
|
207
|
+
} else if (field.type === "select" && field.options?.[0]) {
|
|
208
|
+
exampleConfig[field.key] = field.options[0].value;
|
|
209
|
+
} else {
|
|
210
|
+
exampleConfig[field.key] = `Your ${field.label.toLowerCase()}`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
lines.push(
|
|
214
|
+
`- ${action.label} (${fullId}): ${JSON.stringify(exampleConfig)}`
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return lines.join("\n");
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export {
|
|
222
|
+
registerCodegenTemplates,
|
|
223
|
+
getCodegenTemplate,
|
|
224
|
+
registerOutputDisplayConfigs,
|
|
225
|
+
getOutputDisplayConfig,
|
|
226
|
+
computeActionId,
|
|
227
|
+
parseActionId,
|
|
228
|
+
registerIntegration,
|
|
229
|
+
getIntegration,
|
|
230
|
+
getAllIntegrations,
|
|
231
|
+
getIntegrationTypes,
|
|
232
|
+
getAllActions,
|
|
233
|
+
getActionsByCategory,
|
|
234
|
+
findActionById,
|
|
235
|
+
getIntegrationLabels,
|
|
236
|
+
getIntegrationDescriptions,
|
|
237
|
+
getSortedIntegrationTypes,
|
|
238
|
+
getAllDependencies,
|
|
239
|
+
getDependenciesForActions,
|
|
240
|
+
getPluginEnvVars,
|
|
241
|
+
getAllEnvVars,
|
|
242
|
+
getCredentialMapping,
|
|
243
|
+
isFieldGroup,
|
|
244
|
+
flattenConfigFields,
|
|
245
|
+
generateAIActionPrompts
|
|
246
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AuthUIProviderProps } from '@daveyplate/better-auth-ui';
|
|
3
|
+
|
|
4
|
+
declare const WorkflowPage: () => react_jsx_runtime.JSX.Element | null;
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
workflowId: string;
|
|
8
|
+
};
|
|
9
|
+
declare const WorkflowEditor: ({ workflowId }: Props) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
declare const Layout: (props: Omit<AuthUIProviderProps, "authClient">) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* AI Gateway Managed Keys Configuration
|
|
15
|
+
*
|
|
16
|
+
* This feature allows signed-in users to use their own Vercel AI Gateway
|
|
17
|
+
* API keys (and credits) instead of manually entering an API key.
|
|
18
|
+
*
|
|
19
|
+
* The AI Gateway itself is available to everyone via AI_GATEWAY_API_KEY.
|
|
20
|
+
* This feature flag only controls the ability to create API keys on behalf
|
|
21
|
+
* of users through OAuth - which is an internal Vercel feature.
|
|
22
|
+
*
|
|
23
|
+
* Set AI_GATEWAY_MANAGED_KEYS_ENABLED=true to enable.
|
|
24
|
+
*/
|
|
25
|
+
declare function isAiGatewayManagedKeysEnabled(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Check if managed keys feature is enabled on the client side
|
|
28
|
+
* Uses NEXT_PUBLIC_ prefix for client-side access
|
|
29
|
+
*/
|
|
30
|
+
declare function isAiGatewayManagedKeysEnabledClient(): boolean;
|
|
31
|
+
|
|
32
|
+
export { Layout, WorkflowEditor, WorkflowPage, isAiGatewayManagedKeysEnabled, isAiGatewayManagedKeysEnabledClient };
|