snow-flow 10.0.1-dev.460 → 10.0.1-dev.461
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
|
@@ -206,20 +206,39 @@ async function buildFlowLogicInputsForInsert(
|
|
|
206
206
|
defId: string,
|
|
207
207
|
defRecord: { name?: string; type?: string; description?: string; order?: string; attributes?: string; compilation_class?: string; quiescence?: string; visible?: string; category?: string; connected_to?: string },
|
|
208
208
|
userValues?: Record<string, string>
|
|
209
|
-
): Promise<{ inputs: any[]; flowLogicDefinition: any; resolvedInputs: Record<string, string
|
|
209
|
+
): Promise<{ inputs: any[]; flowLogicDefinition: any; resolvedInputs: Record<string, string>; inputQueryError?: string; defParamsCount: number }> {
|
|
210
210
|
// Query sys_hub_flow_logic_input for this definition's inputs (separate table from sys_hub_action_input)
|
|
211
|
+
// Field names verified from actual sys_hub_flow_logic_input XML schema
|
|
211
212
|
var defParams: any[] = [];
|
|
213
|
+
var inputQueryError = '';
|
|
212
214
|
try {
|
|
213
215
|
var resp = await client.get('/api/now/table/sys_hub_flow_logic_input', {
|
|
214
216
|
params: {
|
|
215
217
|
sysparm_query: 'model=' + defId,
|
|
216
|
-
sysparm_fields: 'sys_id,element,label,internal_type,mandatory,default_value,order,max_length,hint,read_only,
|
|
218
|
+
sysparm_fields: 'sys_id,element,label,internal_type,mandatory,default_value,order,max_length,hint,read_only,attributes,sys_class_name,reference,choice,dependent,dependent_on_field,use_dependent_field,column_label',
|
|
217
219
|
sysparm_display_value: 'false',
|
|
218
220
|
sysparm_limit: 50
|
|
219
221
|
}
|
|
220
222
|
});
|
|
221
223
|
defParams = resp.data.result || [];
|
|
222
|
-
} catch (
|
|
224
|
+
} catch (e: any) {
|
|
225
|
+
inputQueryError = e.message || 'unknown error';
|
|
226
|
+
// Fallback: try with minimal fields
|
|
227
|
+
try {
|
|
228
|
+
var resp2 = await client.get('/api/now/table/sys_hub_flow_logic_input', {
|
|
229
|
+
params: {
|
|
230
|
+
sysparm_query: 'model=' + defId,
|
|
231
|
+
sysparm_fields: 'sys_id,element,label,internal_type,mandatory,order,max_length,attributes',
|
|
232
|
+
sysparm_display_value: 'false',
|
|
233
|
+
sysparm_limit: 50
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
defParams = resp2.data.result || [];
|
|
237
|
+
inputQueryError = '';
|
|
238
|
+
} catch (e2: any) {
|
|
239
|
+
inputQueryError += '; fallback also failed: ' + (e2.message || '');
|
|
240
|
+
}
|
|
241
|
+
}
|
|
223
242
|
|
|
224
243
|
// Fuzzy-match user-provided values to actual field names
|
|
225
244
|
var resolvedInputs: Record<string, string> = {};
|
|
@@ -304,7 +323,7 @@ async function buildFlowLogicInputsForInsert(
|
|
|
304
323
|
variables: '[]'
|
|
305
324
|
};
|
|
306
325
|
|
|
307
|
-
return { inputs, flowLogicDefinition, resolvedInputs };
|
|
326
|
+
return { inputs, flowLogicDefinition, resolvedInputs, inputQueryError: inputQueryError || undefined, defParamsCount: defParams.length };
|
|
308
327
|
}
|
|
309
328
|
|
|
310
329
|
// Note: reordering of existing elements is NOT possible via Table API because
|
|
@@ -446,7 +465,8 @@ async function addTriggerViaGraphQL(
|
|
|
446
465
|
},
|
|
447
466
|
{
|
|
448
467
|
name: 'condition',
|
|
449
|
-
displayValue: { schemaless: false, schemalessValue: '', value: condition || '^EQ' }
|
|
468
|
+
displayValue: { schemaless: false, schemalessValue: '', value: condition || '^EQ' },
|
|
469
|
+
value: { schemaless: false, schemalessValue: '', value: condition || '^EQ' }
|
|
450
470
|
}
|
|
451
471
|
];
|
|
452
472
|
try {
|
|
@@ -662,6 +682,7 @@ async function addFlowLogicViaGraphQL(
|
|
|
662
682
|
const inputResult = await buildFlowLogicInputsForInsert(client, defId, defRecord, inputs);
|
|
663
683
|
steps.available_inputs = inputResult.inputs.map((i: any) => ({ name: i.name, label: i.parameter?.label }));
|
|
664
684
|
steps.resolved_inputs = inputResult.resolvedInputs;
|
|
685
|
+
steps.input_query_stats = { defParamsFound: inputResult.defParamsCount, inputsBuilt: inputResult.inputs.length, error: inputResult.inputQueryError };
|
|
665
686
|
|
|
666
687
|
// Calculate insertion order
|
|
667
688
|
const resolvedOrder = await calculateInsertOrder(client, flowId, parentUiId, order);
|