@clipform/mcp-server 1.41.0 → 1.42.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.
@@ -17229,42 +17229,34 @@ Example: A form that asks a question, collects contact info, then finishes:
17229
17229
  }
17230
17230
  }
17231
17231
  }
17232
+ for (const q of nodes) {
17233
+ applyNodeDefaults(q);
17234
+ }
17235
+ const settings = {};
17236
+ if (show_step_counter !== void 0) settings.show_step_counter = show_step_counter;
17237
+ if (disable_back_navigation !== void 0) settings.disable_back_navigation = disable_back_navigation;
17238
+ if (primary_color !== void 0) settings.primary_color = primary_color;
17239
+ if (background_color !== void 0) settings.background_color = background_color;
17232
17240
  const createResult = await callApi("/forms", {
17233
17241
  method: "POST",
17234
- body: { title, workspace_id: workspaceId }
17242
+ body: {
17243
+ title,
17244
+ workspace_id: workspaceId,
17245
+ nodes,
17246
+ ...Object.keys(settings).length > 0 ? { settings } : {}
17247
+ }
17235
17248
  });
17236
17249
  if (!createResult.ok) {
17237
- return errorResult(createResult.error);
17250
+ return errorResult(`Form NOT created (nothing was saved): ${createResult.error}`);
17238
17251
  }
17239
17252
  const { data } = createResult;
17240
17253
  const formId = data.form_id;
17241
17254
  const formUrl = data.form_url ?? void 0;
17242
- const settingsBody = {};
17243
- if (show_step_counter !== void 0) settingsBody.show_step_counter = show_step_counter;
17244
- if (disable_back_navigation !== void 0) settingsBody.disable_back_navigation = disable_back_navigation;
17245
- if (primary_color !== void 0) settingsBody.primary_color = primary_color;
17246
- if (background_color !== void 0) settingsBody.background_color = background_color;
17247
- if (font_family !== void 0) settingsBody.font_family = font_family;
17248
- if (Object.keys(settingsBody).length > 0) {
17255
+ const createdNodes = data.nodes ?? [];
17256
+ if (font_family !== void 0) {
17249
17257
  await callApi(`/forms/${formId}`, {
17250
17258
  method: "PATCH",
17251
- body: settingsBody
17252
- });
17253
- }
17254
- const createdNodes = [];
17255
- for (const q of nodes) {
17256
- applyNodeDefaults(q);
17257
- const addResult = await callApi(`/forms/${formId}/nodes`, {
17258
- method: "POST",
17259
- body: { node: q }
17260
- });
17261
- if (!addResult.ok) {
17262
- return errorResult(`Failed to add node "${q.prompt}": ${addResult.error}`);
17263
- }
17264
- createdNodes.push({
17265
- id: addResult.data.node_id,
17266
- type: q.type,
17267
- prompt: q.prompt
17259
+ body: { font_family }
17268
17260
  });
17269
17261
  }
17270
17262
  if (tags && tags.length > 0) {
@@ -19014,4 +19006,4 @@ export {
19014
19006
  JSONRPCMessageSchema,
19015
19007
  createServer
19016
19008
  };
19017
- //# sourceMappingURL=chunk-CILPQ5ZL.js.map
19009
+ //# sourceMappingURL=chunk-GP5MEBVL.js.map