@tenonhq/dovetail-servicenow 0.0.43 → 0.0.44
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.
|
@@ -301,5 +301,6 @@ export interface PlanActionDefinitionParams {
|
|
|
301
301
|
* before/after views; throws on any invalid or dangling reference.
|
|
302
302
|
*/
|
|
303
303
|
export declare function planActionDefinition(params: PlanActionDefinitionParams): DefineActionPlan;
|
|
304
|
+
export declare function compareForVerify(expected: ActionView, actual: ActionView): DefineActionVerify;
|
|
304
305
|
export declare function defineActionType(params: DefineActionTypeParams): Promise<DefineActionTypeResult>;
|
|
305
306
|
export {};
|
|
@@ -50,6 +50,7 @@ exports.canonValue = canonValue;
|
|
|
50
50
|
exports.viewAction = viewAction;
|
|
51
51
|
exports.diffViews = diffViews;
|
|
52
52
|
exports.planActionDefinition = planActionDefinition;
|
|
53
|
+
exports.compareForVerify = compareForVerify;
|
|
53
54
|
exports.defineActionType = defineActionType;
|
|
54
55
|
const crypto_1 = require("crypto");
|
|
55
56
|
const actionTypeApi_1 = require("./actionTypeApi");
|
|
@@ -1547,9 +1548,28 @@ async function resolveAliasDisplays(client, ids) {
|
|
|
1547
1548
|
}
|
|
1548
1549
|
return out;
|
|
1549
1550
|
}
|
|
1551
|
+
// Variable attributes the server assigns a default to on save when the spec left
|
|
1552
|
+
// them unset (live-observed 2026-09-30: a new boolean input came back with
|
|
1553
|
+
// maxLength 40). A blank expected value for one of these is "unspecified", not a
|
|
1554
|
+
// mismatch; an explicitly specified value is still verified.
|
|
1555
|
+
var SERVER_DEFAULTED_FIELDS = ["maxLength"];
|
|
1556
|
+
function dropServerDefaults(changed) {
|
|
1557
|
+
return changed
|
|
1558
|
+
.map(function (c) {
|
|
1559
|
+
var kept = c.changes.filter(function (f) {
|
|
1560
|
+
return !(SERVER_DEFAULTED_FIELDS.indexOf(f.field) !== -1 && f.before === "");
|
|
1561
|
+
});
|
|
1562
|
+
return Object.assign({}, c, { changes: kept });
|
|
1563
|
+
})
|
|
1564
|
+
.filter(function (c) {
|
|
1565
|
+
return c.changes.length > 0;
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1550
1568
|
function compareForVerify(expected, actual) {
|
|
1551
1569
|
var notes = [];
|
|
1552
1570
|
var d = diffViews(expected, actual, {});
|
|
1571
|
+
d.inputs.changed = dropServerDefaults(d.inputs.changed);
|
|
1572
|
+
d.outputs.changed = dropServerDefaults(d.outputs.changed);
|
|
1553
1573
|
// Expected -> actual: any difference means the save did not land as planned.
|
|
1554
1574
|
d.action.forEach(function (c) {
|
|
1555
1575
|
notes.push("action." + c.field + " is '" + c.after + "', expected '" + c.before + "'");
|
|
@@ -1585,10 +1605,13 @@ function compareForVerify(expected, actual) {
|
|
|
1585
1605
|
d.steps.changed.forEach(function (s) {
|
|
1586
1606
|
notes.push("step '" + s.label + "': " + s.changes.join("; "));
|
|
1587
1607
|
});
|
|
1588
|
-
|
|
1608
|
+
// ok is derived from the filtered notes, not d.empty: server-defaulted fields
|
|
1609
|
+
// were dropped above and must not fail the verify.
|
|
1610
|
+
var ok = notes.length === 0;
|
|
1611
|
+
if (ok) {
|
|
1589
1612
|
notes.push("read-back matches the planned definition");
|
|
1590
1613
|
}
|
|
1591
|
-
return { ok:
|
|
1614
|
+
return { ok: ok, notes: notes };
|
|
1592
1615
|
}
|
|
1593
1616
|
async function defineActionType(params) {
|
|
1594
1617
|
var client = params.client;
|