snow-flow 10.0.1-dev.489 → 10.0.1-dev.490

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "10.0.1-dev.489",
3
+ "version": "10.0.1-dev.490",
4
4
  "name": "snow-flow",
5
5
  "description": "Snow-Flow - ServiceNow Multi-Agent Development Framework powered by AI",
6
6
  "license": "Elastic-2.0",
@@ -241,7 +241,12 @@ async function buildActionInputsForInsert(
241
241
  };
242
242
  });
243
243
 
244
- return { inputs, resolvedInputs, actionParams };
244
+ // Check for mandatory fields that are missing a value
245
+ var missingMandatory = inputs
246
+ .filter(function (inp: any) { return inp.parameter?.mandatory && !inp.value?.value; })
247
+ .map(function (inp: any) { return inp.name + ' (' + (inp.parameter?.label || inp.name) + ')'; });
248
+
249
+ return { inputs, resolvedInputs, actionParams, missingMandatory };
245
250
  }
246
251
 
247
252
  /**
@@ -373,7 +378,12 @@ async function buildFlowLogicInputsForInsert(
373
378
  variables: '[]'
374
379
  };
375
380
 
376
- return { inputs, flowLogicDefinition, resolvedInputs, inputQueryError: inputQueryError || undefined, defParamsCount: defParams.length };
381
+ // Check for mandatory fields that are missing a value
382
+ var missingMandatory = inputs
383
+ .filter(function (inp: any) { return inp.parameter?.mandatory && !inp.value?.value; })
384
+ .map(function (inp: any) { return inp.name + ' (' + (inp.parameter?.label || inp.name) + ')'; });
385
+
386
+ return { inputs, flowLogicDefinition, resolvedInputs, inputQueryError: inputQueryError || undefined, defParamsCount: defParams.length, missingMandatory };
377
387
  }
378
388
 
379
389
  // Note: reordering of existing elements is NOT possible via Table API because
@@ -1127,6 +1137,12 @@ async function addActionViaGraphQL(
1127
1137
  steps.available_inputs = inputResult.actionParams.map((p: any) => ({ element: p.element, label: p.label }));
1128
1138
  steps.resolved_inputs = inputResult.resolvedInputs;
1129
1139
 
1140
+ // Validate mandatory fields
1141
+ if (inputResult.missingMandatory && inputResult.missingMandatory.length > 0) {
1142
+ steps.missing_mandatory = inputResult.missingMandatory;
1143
+ return { success: false, error: 'Missing required inputs for ' + actionType + ': ' + inputResult.missingMandatory.join(', ') + '. These fields are mandatory in Flow Designer.', steps };
1144
+ }
1145
+
1130
1146
  // Calculate insertion order
1131
1147
  const resolvedOrder = await calculateInsertOrder(client, flowId, parentUiId, order);
1132
1148
  steps.insert_order = resolvedOrder;
@@ -2017,6 +2033,12 @@ async function addFlowLogicViaGraphQL(
2017
2033
  steps.resolved_inputs = inputResult.resolvedInputs;
2018
2034
  steps.input_query_stats = { defParamsFound: inputResult.defParamsCount, inputsBuilt: inputResult.inputs.length, error: inputResult.inputQueryError };
2019
2035
 
2036
+ // Validate mandatory fields (e.g. condition for IF/ELSEIF)
2037
+ if (inputResult.missingMandatory && inputResult.missingMandatory.length > 0) {
2038
+ steps.missing_mandatory = inputResult.missingMandatory;
2039
+ return { success: false, error: 'Missing required inputs for ' + logicType + ': ' + inputResult.missingMandatory.join(', ') + '. These fields are mandatory in Flow Designer.', steps };
2040
+ }
2041
+
2020
2042
  // ── Detect condition that needs data pill transformation ────────────
2021
2043
  // Flow Designer sets conditions via a SEPARATE UPDATE after the element is created.
2022
2044
  // Three paths: