snow-flow-test 10.0.1-test.184 → 10.0.1-test.185
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
|
@@ -1560,22 +1560,79 @@ async function transformActionInputsForRecordAction(
|
|
|
1560
1560
|
// ── 4. Build labelCache entries for data pills ────────────────────
|
|
1561
1561
|
if (dataPillBase && usedInstances.length > 0) {
|
|
1562
1562
|
var tableRef = triggerInfo.tableRef || triggerInfo.table || '';
|
|
1563
|
-
var
|
|
1563
|
+
var tblLabel = triggerInfo.tableLabel || '';
|
|
1564
1564
|
|
|
1565
|
-
// Record-level data pill entry
|
|
1565
|
+
// Record-level data pill entry (for the `record` input — selecting the whole record)
|
|
1566
1566
|
labelCacheEntries.push({
|
|
1567
1567
|
name: dataPillBase,
|
|
1568
|
-
label: 'Trigger - Record ' + triggerInfo.triggerName + '\u27a1' +
|
|
1568
|
+
label: 'Trigger - Record ' + triggerInfo.triggerName + '\u27a1' + tblLabel + ' Record',
|
|
1569
1569
|
reference: tableRef,
|
|
1570
|
-
reference_display:
|
|
1570
|
+
reference_display: tblLabel,
|
|
1571
1571
|
type: 'reference',
|
|
1572
1572
|
base_type: 'reference',
|
|
1573
|
-
|
|
1573
|
+
parent_table_name: tableRef,
|
|
1574
|
+
column_name: '',
|
|
1574
1575
|
usedInstances: usedInstances,
|
|
1575
1576
|
choices: {}
|
|
1576
1577
|
});
|
|
1577
1578
|
|
|
1578
|
-
|
|
1579
|
+
// Field-level data pill entries for any field references in the `values` string
|
|
1580
|
+
var valuesStr = '';
|
|
1581
|
+
var valuesInp = actionInputs.find(function (inp: any) { return inp.name === 'values'; });
|
|
1582
|
+
if (valuesInp) valuesStr = valuesInp.value?.value || '';
|
|
1583
|
+
|
|
1584
|
+
if (valuesStr && valuesStr.includes('{{')) {
|
|
1585
|
+
// Extract field-level pills from values like "assigned_to={{dataPillBase.assigned_to}}"
|
|
1586
|
+
var pillRegex = /\{\{([^}]+)\}\}/g;
|
|
1587
|
+
var pillMatch;
|
|
1588
|
+
var seenPills: Record<string, boolean> = {};
|
|
1589
|
+
seenPills[dataPillBase] = true;
|
|
1590
|
+
|
|
1591
|
+
while ((pillMatch = pillRegex.exec(valuesStr)) !== null) {
|
|
1592
|
+
var fullPillName = pillMatch[1];
|
|
1593
|
+
if (seenPills[fullPillName]) continue;
|
|
1594
|
+
seenPills[fullPillName] = true;
|
|
1595
|
+
|
|
1596
|
+
// Extract field name from pill (e.g. "Created or Updated_1.current.assigned_to" → "assigned_to")
|
|
1597
|
+
var dotParts = fullPillName.split('.');
|
|
1598
|
+
var fieldCol = dotParts.length > 2 ? dotParts[dotParts.length - 1] : '';
|
|
1599
|
+
|
|
1600
|
+
if (fieldCol) {
|
|
1601
|
+
// Look up field metadata from sys_dictionary
|
|
1602
|
+
var fMeta: { type: string; label: string } = { type: 'string', label: fieldCol.replace(/_/g, ' ').replace(/\b\w/g, function (c: string) { return c.toUpperCase(); }) };
|
|
1603
|
+
try {
|
|
1604
|
+
var dictResp = await client.get('/api/now/table/sys_dictionary', {
|
|
1605
|
+
params: {
|
|
1606
|
+
sysparm_query: 'name=' + tableRef + '^element=' + fieldCol,
|
|
1607
|
+
sysparm_fields: 'element,column_label,internal_type',
|
|
1608
|
+
sysparm_display_value: 'false',
|
|
1609
|
+
sysparm_limit: 1
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
var dictRec = dictResp.data.result?.[0];
|
|
1613
|
+
if (dictRec) {
|
|
1614
|
+
fMeta.type = str(dictRec.internal_type?.value || dictRec.internal_type || 'string');
|
|
1615
|
+
fMeta.label = str(dictRec.column_label) || fMeta.label;
|
|
1616
|
+
}
|
|
1617
|
+
} catch (_) {}
|
|
1618
|
+
|
|
1619
|
+
labelCacheEntries.push({
|
|
1620
|
+
name: fullPillName,
|
|
1621
|
+
label: 'Trigger - Record ' + triggerInfo.triggerName + '\u27a1' + tblLabel + ' Record\u27a1' + fMeta.label,
|
|
1622
|
+
reference: '',
|
|
1623
|
+
reference_display: fMeta.label,
|
|
1624
|
+
type: fMeta.type,
|
|
1625
|
+
base_type: fMeta.type,
|
|
1626
|
+
parent_table_name: tableRef,
|
|
1627
|
+
column_name: fieldCol,
|
|
1628
|
+
usedInstances: [{ uiUniqueIdentifier: uuid, inputName: fieldCol }],
|
|
1629
|
+
choices: {}
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
steps.label_cache = { count: labelCacheEntries.length, pills: labelCacheEntries.map(function (e: any) { return e.name; }), usedInstances: usedInstances.length };
|
|
1579
1636
|
}
|
|
1580
1637
|
|
|
1581
1638
|
return { inputs: actionInputs, labelCacheEntries, steps };
|