sf-flow-coverage 0.3.0 → 0.4.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.
- package/CHANGELOG.md +12 -0
- package/README.md +117 -19
- package/lib/commands/flowcov/gate.js +3 -1
- package/lib/commands/flowcov/gate.js.map +1 -1
- package/lib/commands/flowcov/readiness.js +25 -3
- package/lib/commands/flowcov/readiness.js.map +1 -1
- package/lib/commands/flowcov/transform.d.ts +15 -0
- package/lib/commands/flowcov/transform.js +78 -0
- package/lib/commands/flowcov/transform.js.map +1 -0
- package/lib/core/apexTemplate.d.ts +11 -2
- package/lib/core/apexTemplate.js +307 -199
- package/lib/core/apexTemplate.js.map +1 -1
- package/lib/core/conditions.d.ts +107 -0
- package/lib/core/conditions.js +481 -0
- package/lib/core/conditions.js.map +1 -0
- package/lib/core/coverageCheck.d.ts +8 -0
- package/lib/core/coverageCheck.js +12 -0
- package/lib/core/coverageCheck.js.map +1 -0
- package/lib/core/coverageFormats.d.ts +7 -0
- package/lib/core/coverageFormats.js +77 -0
- package/lib/core/coverageFormats.js.map +1 -0
- package/lib/core/criteria.d.ts +40 -0
- package/lib/core/criteria.js +262 -0
- package/lib/core/criteria.js.map +1 -0
- package/lib/core/elementCoverage.d.ts +9 -0
- package/lib/core/elementCoverage.js +27 -0
- package/lib/core/elementCoverage.js.map +1 -0
- package/lib/core/flowElementLines.d.ts +13 -0
- package/lib/core/flowElementLines.js +44 -0
- package/lib/core/flowElementLines.js.map +1 -0
- package/lib/core/flowFingerprint.d.ts +10 -0
- package/lib/core/flowFingerprint.js +14 -0
- package/lib/core/flowFingerprint.js.map +1 -1
- package/lib/core/flowGraph.d.ts +63 -13
- package/lib/core/flowGraph.js +125 -134
- package/lib/core/flowGraph.js.map +1 -1
- package/lib/core/flowSettings.d.ts +16 -0
- package/lib/core/flowSettings.js +49 -0
- package/lib/core/flowSettings.js.map +1 -0
- package/lib/core/flowTypes.d.ts +6 -0
- package/lib/core/flowTypes.js +17 -0
- package/lib/core/flowTypes.js.map +1 -1
- package/lib/core/formula.d.ts +48 -0
- package/lib/core/formula.js +227 -0
- package/lib/core/formula.js.map +1 -0
- package/lib/core/gate.js +19 -1
- package/lib/core/gate.js.map +1 -1
- package/lib/core/orgCoverageSource.d.ts +3 -0
- package/lib/core/orgCoverageSource.js +26 -5
- package/lib/core/orgCoverageSource.js.map +1 -1
- package/lib/core/readiness.d.ts +5 -0
- package/lib/core/readiness.js +24 -10
- package/lib/core/readiness.js.map +1 -1
- package/lib/core/requiredFields.d.ts +29 -7
- package/lib/core/requiredFields.js +60 -19
- package/lib/core/requiredFields.js.map +1 -1
- package/lib/core/scaffold.js +30 -11
- package/lib/core/scaffold.js.map +1 -1
- package/lib/core/toolingQuery.d.ts +5 -0
- package/lib/core/toolingQuery.js +9 -1
- package/lib/core/toolingQuery.js.map +1 -1
- package/lib/core/transform.d.ts +36 -0
- package/lib/core/transform.js +62 -0
- package/lib/core/transform.js.map +1 -0
- package/lib/core/types.d.ts +52 -2
- package/lib/index.d.ts +6 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/messages/flowcov.gate.md +3 -1
- package/messages/flowcov.readiness.md +4 -2
- package/messages/flowcov.scaffold.md +4 -2
- package/messages/flowcov.transform.md +33 -0
- package/oclif.manifest.json +98 -4
- package/package.json +1 -1
- package/lib/core/filterFormula.d.ts +0 -10
- package/lib/core/filterFormula.js +0 -153
- package/lib/core/filterFormula.js.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Condition, type ConditionLabel } from './conditions.js';
|
|
2
|
+
/** What the solver knows about the record a test builds. */
|
|
3
|
+
export type SolveContext = {
|
|
4
|
+
/** The triggering object. */
|
|
5
|
+
object: string;
|
|
6
|
+
/** `insert` for create, delete, and platform event tests; `update` when the test updates an inserted record. */
|
|
7
|
+
context: 'insert' | 'update';
|
|
8
|
+
/** Values the insert sets anyway (required fields). */
|
|
9
|
+
inserted: Record<string, string>;
|
|
10
|
+
/** A value per field the test can set, including lookup Ids (`accountParent.Id`). */
|
|
11
|
+
fieldValues: Record<string, string>;
|
|
12
|
+
/** A second value per field, different from `fieldValues`. */
|
|
13
|
+
changedValues: Record<string, string>;
|
|
14
|
+
/** Lookup field per relationship name, such as `Account` to `AccountId`. */
|
|
15
|
+
relationships: Record<string, string>;
|
|
16
|
+
/** The object each lookup field points to. */
|
|
17
|
+
lookups: Record<string, string>;
|
|
18
|
+
/** Values for a parent object's fields, for criteria on related records. */
|
|
19
|
+
parentFieldValues(object: string): Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
/** Field values that meet a condition, and what they couldn't meet. */
|
|
22
|
+
export type CriteriaPlan = {
|
|
23
|
+
/** Record fields to set: in the insert, or in the update. */
|
|
24
|
+
set: Map<string, string>;
|
|
25
|
+
/** In an update, values the insert sets so `$Record__Prior` conditions hold. */
|
|
26
|
+
prior: Map<string, string>;
|
|
27
|
+
/** Record fields that must stay empty or unchanged. */
|
|
28
|
+
keep: Set<string>;
|
|
29
|
+
/** Fields to set on parent records, per parent object. */
|
|
30
|
+
parents: Map<string, Map<string, string>>;
|
|
31
|
+
/** Conditions the plan doesn't meet, for TODOs. */
|
|
32
|
+
unmet: Array<{
|
|
33
|
+
label: ConditionLabel;
|
|
34
|
+
text: string;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
/** A value past (or at) a comparison bound: numbers step by 1, dates by a day, datetimes by a second. */
|
|
38
|
+
export declare function boundValue(apex: string, step: number): string | undefined;
|
|
39
|
+
/** Plans field values that meet `condition`, starting from `base` when given. */
|
|
40
|
+
export declare function solveCriteria(condition: Condition, ctx: SolveContext, base?: CriteriaPlan): CriteriaPlan;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { knownOf, negate, } from './conditions.js';
|
|
2
|
+
import { escapeApexString } from './flowValues.js';
|
|
3
|
+
import { isApexDate, isApexDatetime } from './formula.js';
|
|
4
|
+
const emptyPlan = () => ({
|
|
5
|
+
set: new Map(),
|
|
6
|
+
prior: new Map(),
|
|
7
|
+
keep: new Set(),
|
|
8
|
+
parents: new Map(),
|
|
9
|
+
unmet: [],
|
|
10
|
+
});
|
|
11
|
+
const clonePlan = (plan) => ({
|
|
12
|
+
set: new Map(plan.set),
|
|
13
|
+
prior: new Map(plan.prior),
|
|
14
|
+
keep: new Set(plan.keep),
|
|
15
|
+
parents: new Map([...plan.parents].map(([object, fields]) => [object, new Map(fields)])),
|
|
16
|
+
unmet: [...plan.unmet],
|
|
17
|
+
});
|
|
18
|
+
const STEPS = {
|
|
19
|
+
GreaterThan: 1,
|
|
20
|
+
GreaterThanOrEqualTo: 0,
|
|
21
|
+
LessThan: -1,
|
|
22
|
+
LessThanOrEqualTo: 0,
|
|
23
|
+
};
|
|
24
|
+
/** A value past (or at) a comparison bound: numbers step by 1, dates by a day, datetimes by a second. */
|
|
25
|
+
export function boundValue(apex, step) {
|
|
26
|
+
if (/^-?\d+(\.\d+)?$/.test(apex))
|
|
27
|
+
return String(Number((Number(apex) + step).toFixed(10)));
|
|
28
|
+
if (!isApexDate(apex) && !isApexDatetime(apex))
|
|
29
|
+
return undefined;
|
|
30
|
+
if (step === 0)
|
|
31
|
+
return apex;
|
|
32
|
+
return isApexDate(apex) ? `${apex}.addDays(${step})` : `${apex}.addSeconds(${step})`;
|
|
33
|
+
}
|
|
34
|
+
const isNullish = (apex) => apex === undefined || /^null\b/.test(apex);
|
|
35
|
+
/** A candidate whose value is known to differ from `right`. */
|
|
36
|
+
function differentValue(right, candidates) {
|
|
37
|
+
const target = knownOf(right);
|
|
38
|
+
if (target.kind === 'set')
|
|
39
|
+
return undefined;
|
|
40
|
+
return candidates.find((candidate) => {
|
|
41
|
+
if (candidate === undefined)
|
|
42
|
+
return false;
|
|
43
|
+
const known = knownOf(candidate);
|
|
44
|
+
if (target.kind === 'null')
|
|
45
|
+
return known.kind !== 'null';
|
|
46
|
+
// An empty candidate (a lookup TODO) or one whose value isn't known can't be shown to differ.
|
|
47
|
+
if (known.kind === 'null' || known.kind === 'set' || known.kind !== target.kind)
|
|
48
|
+
return false;
|
|
49
|
+
// Text that differs only in case might compare equal.
|
|
50
|
+
return known.kind === 'string' && target.kind === 'string'
|
|
51
|
+
? known.value.toLowerCase() !== target.value.toLowerCase()
|
|
52
|
+
: known.value !== target.value;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** Meets one comparison on one side (a record field, its prior value, or a parent field). */
|
|
56
|
+
function meet(side, op, right, wanted) {
|
|
57
|
+
const current = side.current();
|
|
58
|
+
switch (op) {
|
|
59
|
+
case 'IsNull':
|
|
60
|
+
if (wanted)
|
|
61
|
+
return side.keepEmpty();
|
|
62
|
+
if (current !== undefined && !isNullish(current))
|
|
63
|
+
return true;
|
|
64
|
+
return side.values[side.field] !== undefined && side.assign(side.values[side.field]);
|
|
65
|
+
case 'EqualTo':
|
|
66
|
+
return right !== undefined && side.assign(right);
|
|
67
|
+
case 'NotEqualTo': {
|
|
68
|
+
if (right === undefined)
|
|
69
|
+
return false;
|
|
70
|
+
if (current !== undefined)
|
|
71
|
+
return differentValue(right, [current]) !== undefined;
|
|
72
|
+
const value = differentValue(right, [side.values[side.field], side.alternates[side.field]]);
|
|
73
|
+
return value !== undefined && side.assign(value);
|
|
74
|
+
}
|
|
75
|
+
case 'Contains':
|
|
76
|
+
case 'StartsWith':
|
|
77
|
+
case 'EndsWith':
|
|
78
|
+
// A string contains, starts with, and ends with itself.
|
|
79
|
+
return right?.startsWith("'") === true && side.assign(right);
|
|
80
|
+
default: {
|
|
81
|
+
const step = STEPS[op];
|
|
82
|
+
const value = right === undefined || step === undefined ? undefined : boundValue(right, step);
|
|
83
|
+
return value !== undefined && side.assign(value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** The Apex value of the right-hand side, planning a value for a field it compares with. */
|
|
88
|
+
function rightValue(right, plan, ctx) {
|
|
89
|
+
if (!right)
|
|
90
|
+
return undefined;
|
|
91
|
+
if (right.kind === 'value')
|
|
92
|
+
return right.apex;
|
|
93
|
+
if (right.kind === 'user')
|
|
94
|
+
return 'UserInfo.getUserId()';
|
|
95
|
+
if (right.kind !== 'field' || right.prior || right.path.length !== 1)
|
|
96
|
+
return undefined;
|
|
97
|
+
const field = right.path[0];
|
|
98
|
+
const planned = plan.set.get(field) ?? (ctx.context === 'insert' ? ctx.inserted[field] : undefined);
|
|
99
|
+
if (planned !== undefined && !isNullish(planned))
|
|
100
|
+
return planned;
|
|
101
|
+
const value = ctx.fieldValues[field];
|
|
102
|
+
if (value === undefined || plan.keep.has(field))
|
|
103
|
+
return undefined;
|
|
104
|
+
plan.set.set(field, value);
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
function recordSide(field, plan, ctx) {
|
|
108
|
+
return {
|
|
109
|
+
field,
|
|
110
|
+
values: ctx.fieldValues,
|
|
111
|
+
alternates: ctx.changedValues,
|
|
112
|
+
current: () => plan.set.get(field) ?? (ctx.context === 'insert' ? ctx.inserted[field] : undefined),
|
|
113
|
+
assign: (value) => {
|
|
114
|
+
const existing = plan.set.get(field);
|
|
115
|
+
if (existing !== undefined)
|
|
116
|
+
return existing === value;
|
|
117
|
+
if (plan.keep.has(field))
|
|
118
|
+
return false;
|
|
119
|
+
plan.set.set(field, value);
|
|
120
|
+
return true;
|
|
121
|
+
},
|
|
122
|
+
keepEmpty: () => {
|
|
123
|
+
if (plan.set.has(field))
|
|
124
|
+
return false;
|
|
125
|
+
// The insert sets required fields; in an update the field must also start empty.
|
|
126
|
+
if (!isNullish(ctx.inserted[field]) || !isNullish(plan.prior.get(field)))
|
|
127
|
+
return false;
|
|
128
|
+
plan.keep.add(field);
|
|
129
|
+
return true;
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function priorSide(field, plan, ctx) {
|
|
134
|
+
return {
|
|
135
|
+
field,
|
|
136
|
+
values: ctx.fieldValues,
|
|
137
|
+
alternates: ctx.changedValues,
|
|
138
|
+
current: () => plan.prior.get(field) ?? ctx.inserted[field],
|
|
139
|
+
assign: (value) => {
|
|
140
|
+
const existing = plan.prior.get(field) ?? ctx.inserted[field];
|
|
141
|
+
if (existing !== undefined && !isNullish(existing))
|
|
142
|
+
return existing === value;
|
|
143
|
+
plan.prior.set(field, value);
|
|
144
|
+
return true;
|
|
145
|
+
},
|
|
146
|
+
keepEmpty: () => isNullish(plan.prior.get(field) ?? ctx.inserted[field]),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function parentSide(object, field, plan, ctx) {
|
|
150
|
+
const fields = () => {
|
|
151
|
+
if (!plan.parents.has(object))
|
|
152
|
+
plan.parents.set(object, new Map());
|
|
153
|
+
return plan.parents.get(object);
|
|
154
|
+
};
|
|
155
|
+
const values = ctx.parentFieldValues(object);
|
|
156
|
+
return {
|
|
157
|
+
field,
|
|
158
|
+
values,
|
|
159
|
+
alternates: {},
|
|
160
|
+
current: () => plan.parents.get(object)?.get(field),
|
|
161
|
+
assign: (value) => {
|
|
162
|
+
const existing = fields().get(field);
|
|
163
|
+
if (existing !== undefined)
|
|
164
|
+
return existing === value;
|
|
165
|
+
fields().set(field, value);
|
|
166
|
+
return true;
|
|
167
|
+
},
|
|
168
|
+
// The parent's own required fields may set it; don't promise it stays empty.
|
|
169
|
+
keepEmpty: () => false,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/** Meets an atom, or returns false. */
|
|
173
|
+
function meetAtom(atom, plan, ctx) {
|
|
174
|
+
const { left, op } = atom;
|
|
175
|
+
if (left.kind !== 'field')
|
|
176
|
+
return false;
|
|
177
|
+
const wanted = atom.right?.kind === 'value' ? atom.right.apex === 'true' : undefined;
|
|
178
|
+
if (left.prior) {
|
|
179
|
+
if (ctx.context !== 'update' || left.path.length !== 1 || op === 'IsChanged')
|
|
180
|
+
return false;
|
|
181
|
+
return meet(priorSide(left.path[0], plan, ctx), op, rightValue(atom.right, plan, ctx), wanted);
|
|
182
|
+
}
|
|
183
|
+
if (left.path.length === 2) {
|
|
184
|
+
const [relationship, field] = left.path;
|
|
185
|
+
if (relationship === 'RecordType' && field === 'DeveloperName' && op === 'EqualTo') {
|
|
186
|
+
const name = atom.right?.kind === 'value' ? knownOf(atom.right.apex) : undefined;
|
|
187
|
+
if (name?.kind !== 'string')
|
|
188
|
+
return false;
|
|
189
|
+
const id = `Schema.SObjectType.${ctx.object}.getRecordTypeInfosByDeveloperName().get('${escapeApexString(name.value)}').getRecordTypeId()`;
|
|
190
|
+
return recordSide('RecordTypeId', plan, ctx).assign(id);
|
|
191
|
+
}
|
|
192
|
+
const lookup = ctx.relationships[relationship];
|
|
193
|
+
const parent = lookup ? ctx.lookups[lookup] : undefined;
|
|
194
|
+
const id = lookup ? ctx.fieldValues[lookup] : undefined;
|
|
195
|
+
if (!lookup || !parent || !id || !/Parent\.Id$/.test(id))
|
|
196
|
+
return false;
|
|
197
|
+
if (!recordSide(lookup, plan, ctx).assign(id))
|
|
198
|
+
return false;
|
|
199
|
+
return meet(parentSide(parent, field, plan, ctx), op, rightValue(atom.right, plan, ctx), wanted);
|
|
200
|
+
}
|
|
201
|
+
if (left.path.length !== 1)
|
|
202
|
+
return false;
|
|
203
|
+
const field = left.path[0];
|
|
204
|
+
const side = recordSide(field, plan, ctx);
|
|
205
|
+
if (op === 'IsChanged') {
|
|
206
|
+
if (ctx.context !== 'update' || wanted === undefined)
|
|
207
|
+
return false;
|
|
208
|
+
if (!wanted) {
|
|
209
|
+
if (plan.set.has(field))
|
|
210
|
+
return false;
|
|
211
|
+
plan.keep.add(field);
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
const before = plan.prior.get(field) ?? ctx.inserted[field];
|
|
215
|
+
const planned = plan.set.get(field);
|
|
216
|
+
if (planned !== undefined)
|
|
217
|
+
return planned !== before;
|
|
218
|
+
const value = ctx.changedValues[field];
|
|
219
|
+
return value !== undefined && value !== before && side.assign(value);
|
|
220
|
+
}
|
|
221
|
+
return meet(side, op, rightValue(atom.right, plan, ctx), wanted);
|
|
222
|
+
}
|
|
223
|
+
/** `IsChanged` atoms go last, so a field another condition sets counts as changed. */
|
|
224
|
+
const changeLast = (items) => [
|
|
225
|
+
...items.filter((c) => !(c.kind === 'atom' && c.op === 'IsChanged')),
|
|
226
|
+
...items.filter((c) => c.kind === 'atom' && c.op === 'IsChanged'),
|
|
227
|
+
];
|
|
228
|
+
function solveInto(condition, plan, ctx) {
|
|
229
|
+
switch (condition.kind) {
|
|
230
|
+
case 'and':
|
|
231
|
+
return changeLast(condition.items).reduce((current, item) => solveInto(item, current, ctx), plan);
|
|
232
|
+
case 'or': {
|
|
233
|
+
if (condition.items.length === 0)
|
|
234
|
+
return { ...plan, unmet: [...plan.unmet, { label: 'entry criteria formula', text: 'FALSE' }] };
|
|
235
|
+
// Meet the first branch that can be met in full; otherwise the one with the fewest TODOs.
|
|
236
|
+
let best;
|
|
237
|
+
for (const item of condition.items) {
|
|
238
|
+
const attempt = solveInto(item, clonePlan(plan), ctx);
|
|
239
|
+
if (attempt.unmet.length === plan.unmet.length)
|
|
240
|
+
return attempt;
|
|
241
|
+
if (!best || attempt.unmet.length < best.unmet.length)
|
|
242
|
+
best = attempt;
|
|
243
|
+
}
|
|
244
|
+
return best;
|
|
245
|
+
}
|
|
246
|
+
case 'not':
|
|
247
|
+
return solveInto(negate(condition.item), plan, ctx);
|
|
248
|
+
case 'opaque':
|
|
249
|
+
return { ...plan, unmet: [...plan.unmet, { label: condition.label, text: condition.text }] };
|
|
250
|
+
default: {
|
|
251
|
+
const attempt = clonePlan(plan);
|
|
252
|
+
if (meetAtom(condition, attempt, ctx))
|
|
253
|
+
return attempt;
|
|
254
|
+
return { ...plan, unmet: [...plan.unmet, { label: condition.label, text: condition.text }] };
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/** Plans field values that meet `condition`, starting from `base` when given. */
|
|
259
|
+
export function solveCriteria(condition, ctx, base = emptyPlan()) {
|
|
260
|
+
return solveInto(condition, clonePlan(base), ctx);
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=criteria.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"criteria.js","sourceRoot":"","sources":["../../src/core/criteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,OAAO,EACP,MAAM,GAEP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoC1D,MAAM,SAAS,GAAG,GAAiB,EAAE,CAAC,CAAC;IACrC,GAAG,EAAE,IAAI,GAAG,EAAE;IACd,KAAK,EAAE,IAAI,GAAG,EAAE;IAChB,IAAI,EAAE,IAAI,GAAG,EAAE;IACf,OAAO,EAAE,IAAI,GAAG,EAAE;IAClB,KAAK,EAAE,EAAE;CACV,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,CAAC,IAAkB,EAAgB,EAAE,CAAC,CAAC;IACvD,GAAG,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;IACtB,KAAK,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;IAC1B,IAAI,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxF,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,KAAK,GAA+C;IACxD,WAAW,EAAE,CAAC;IACd,oBAAoB,EAAE,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC;IACZ,iBAAiB,EAAE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;YAChC,IAAI,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,CAAC;gBAAE,OAAO,OAAO,CAAC;YACtD,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC/F,CAAC;IACH,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,aAAa,CAAC,SAAoB,EAAE,GAAiB,EAAE,IAAI,GAAiB,SAAS,EAAE;IACrG,OAAO,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CoverageSource, FlowCoverage, UncoveredElement } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The elements of a covered Flow version that no Apex test ran, read from the version's content
|
|
4
|
+
* in the org. Undefined for Flows no test runs (every element is uncovered), and when the
|
|
5
|
+
* source can't read element coverage or the version's content.
|
|
6
|
+
*/
|
|
7
|
+
export declare function findUncoveredElements(source: CoverageSource, flow: FlowCoverage): Promise<UncoveredElement[] | undefined>;
|
|
8
|
+
/** `Name (type)` for each element, shortened after the first few. */
|
|
9
|
+
export declare function describeElements(elements: UncoveredElement[], max?: number): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { executableElements } from './flowFingerprint.js';
|
|
2
|
+
/**
|
|
3
|
+
* The elements of a covered Flow version that no Apex test ran, read from the version's content
|
|
4
|
+
* in the org. Undefined for Flows no test runs (every element is uncovered), and when the
|
|
5
|
+
* source can't read element coverage or the version's content.
|
|
6
|
+
*/
|
|
7
|
+
export async function findUncoveredElements(source, flow) {
|
|
8
|
+
if (!flow.covered)
|
|
9
|
+
return undefined;
|
|
10
|
+
if (flow.elementsTotal > 0 && flow.elementsCovered >= flow.elementsTotal)
|
|
11
|
+
return [];
|
|
12
|
+
if (!flow.coveredElementNames || !source.getFlowFingerprint)
|
|
13
|
+
return undefined;
|
|
14
|
+
const fingerprint = await source.getFlowFingerprint(flow.flowVersionId);
|
|
15
|
+
if (!fingerprint)
|
|
16
|
+
return undefined;
|
|
17
|
+
// FlowElementTestCoverage reports element names in lower case.
|
|
18
|
+
const covered = new Set(flow.coveredElementNames.map((name) => name.toLowerCase()));
|
|
19
|
+
return executableElements(fingerprint).filter((element) => !covered.has(element.name.toLowerCase()));
|
|
20
|
+
}
|
|
21
|
+
const MAX_LISTED = 5;
|
|
22
|
+
/** `Name (type)` for each element, shortened after the first few. */
|
|
23
|
+
export function describeElements(elements, max = MAX_LISTED) {
|
|
24
|
+
const shown = elements.slice(0, max).map((e) => `${e.name} (${e.type})`);
|
|
25
|
+
return elements.length > max ? `${shown.join(', ')} and ${elements.length - max} more` : shown.join(', ');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=elementCoverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementCoverage.js","sourceRoot":"","sources":["../../src/core/elementCoverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAsB,EACtB,IAAkB;IAElB,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IACpC,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IACpF,IAAI,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,MAAM,CAAC,kBAAkB;QAAE,OAAO,SAAS,CAAC;IAC9E,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACxE,IAAI,CAAC,WAAW;QAAE,OAAO,SAAS,CAAC;IACnC,+DAA+D;IAC/D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACpF,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACvG,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,qEAAqE;AACrE,MAAM,UAAU,gBAAgB,CAAC,QAA4B,EAAE,GAAG,GAAG,UAAU;IAC7E,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IACzE,OAAO,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,QAAQ,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** An executable Flow element and the line of its `<name>` in the source file. */
|
|
2
|
+
export type FlowElementLine = {
|
|
3
|
+
name: string;
|
|
4
|
+
/** Singular element type, such as `decision`. */
|
|
5
|
+
type: string;
|
|
6
|
+
/** 1-based line of the element's `<name>` tag. */
|
|
7
|
+
line: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Finds each executable element in a Flow metadata file and the line its name is on, in file
|
|
11
|
+
* order. Coverage formats need a line per element; the name line identifies the element.
|
|
12
|
+
*/
|
|
13
|
+
export declare function flowElementLines(xml: string): FlowElementLine[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EXECUTABLE_ELEMENT_TYPES } from './flowFingerprint.js';
|
|
2
|
+
// Tags, plus the constructs that can contain `<` without being tags.
|
|
3
|
+
const TOKEN = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([A-Za-z_][\w.:-]*)[^>]*?(\/?)>/g;
|
|
4
|
+
/**
|
|
5
|
+
* Finds each executable element in a Flow metadata file and the line its name is on, in file
|
|
6
|
+
* order. Coverage formats need a line per element; the name line identifies the element.
|
|
7
|
+
*/
|
|
8
|
+
export function flowElementLines(xml) {
|
|
9
|
+
const elements = [];
|
|
10
|
+
let depth = 0;
|
|
11
|
+
let line = 1;
|
|
12
|
+
let scanned = 0;
|
|
13
|
+
let current;
|
|
14
|
+
for (const match of xml.matchAll(TOKEN)) {
|
|
15
|
+
const [token, closing, tag, selfClosing] = match;
|
|
16
|
+
const index = match.index;
|
|
17
|
+
for (let i = scanned; i < index; i++)
|
|
18
|
+
if (xml.charCodeAt(i) === 10)
|
|
19
|
+
line++;
|
|
20
|
+
scanned = index;
|
|
21
|
+
if (!tag)
|
|
22
|
+
continue;
|
|
23
|
+
if (closing) {
|
|
24
|
+
depth--;
|
|
25
|
+
if (depth === 1 && current) {
|
|
26
|
+
if (current.name && current.line)
|
|
27
|
+
elements.push({ name: current.name, type: current.type, line: current.line });
|
|
28
|
+
current = undefined;
|
|
29
|
+
}
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (depth === 1 && EXECUTABLE_ELEMENT_TYPES.has(tag))
|
|
33
|
+
current = { type: tag.replace(/s$/, '') };
|
|
34
|
+
if (depth === 2 && current && tag === 'name' && !selfClosing) {
|
|
35
|
+
const end = xml.indexOf('<', index + token.length);
|
|
36
|
+
current.name = xml.slice(index + token.length, end === -1 ? undefined : end).trim();
|
|
37
|
+
current.line = line;
|
|
38
|
+
}
|
|
39
|
+
if (!selfClosing)
|
|
40
|
+
depth++;
|
|
41
|
+
}
|
|
42
|
+
return elements;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=flowElementLines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowElementLines.js","sourceRoot":"","sources":["../../src/core/flowElementLines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAWhE,qEAAqE;AACrE,MAAM,KAAK,GAAG,gGAAgG,CAAC;AAE/G;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,OAAmE,CAAC;IACxE,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC;QACjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;YAAE,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE;gBAAE,IAAI,EAAE,CAAC;QAC3E,OAAO,GAAG,KAAK,CAAC;QAChB,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,EAAE,CAAC;YACR,IAAI,KAAK,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;gBAC3B,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;oBAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;gBAChH,OAAO,GAAG,SAAS,CAAC;YACtB,CAAC;YACD,SAAS;QACX,CAAC;QACD,IAAI,KAAK,KAAK,CAAC,IAAI,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAChG,IAAI,KAAK,KAAK,CAAC,IAAI,OAAO,IAAI,GAAG,KAAK,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAC7D,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YACnD,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACpF,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,WAAW;YAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -16,6 +16,16 @@ export type FlowFingerprint = {
|
|
|
16
16
|
/** Elements and resources as `type:name`, sorted. */
|
|
17
17
|
elements: string[];
|
|
18
18
|
};
|
|
19
|
+
/** Metadata element types Salesforce counts for element coverage. */
|
|
20
|
+
export declare const EXECUTABLE_ELEMENT_TYPES: ReadonlySet<string>;
|
|
21
|
+
/**
|
|
22
|
+
* The elements Salesforce counts for element coverage: every element but the start and
|
|
23
|
+
* resources. Types are singular (`decision`, `recordUpdate`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function executableElements(fingerprint: FlowFingerprint): Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}>;
|
|
19
29
|
/** Fingerprints a Flow metadata file. Throws when the content is not a Flow. */
|
|
20
30
|
export declare function fingerprintFromXml(xml: string): FlowFingerprint;
|
|
21
31
|
/** Fingerprints the `Metadata` field of a Tooling API `Flow` record. */
|
|
@@ -26,6 +26,20 @@ const ELEMENT_TYPES = [
|
|
|
26
26
|
'variables',
|
|
27
27
|
'waits',
|
|
28
28
|
];
|
|
29
|
+
/** Resources, which Salesforce leaves out of a Flow's element coverage. */
|
|
30
|
+
const RESOURCE_TYPES = new Set(['choices', 'constants', 'dynamicChoiceSets', 'formulas', 'textTemplates', 'variables']);
|
|
31
|
+
/** Metadata element types Salesforce counts for element coverage. */
|
|
32
|
+
export const EXECUTABLE_ELEMENT_TYPES = new Set(ELEMENT_TYPES.filter((type) => !RESOURCE_TYPES.has(type)));
|
|
33
|
+
/**
|
|
34
|
+
* The elements Salesforce counts for element coverage: every element but the start and
|
|
35
|
+
* resources. Types are singular (`decision`, `recordUpdate`).
|
|
36
|
+
*/
|
|
37
|
+
export function executableElements(fingerprint) {
|
|
38
|
+
return fingerprint.elements.flatMap((element) => {
|
|
39
|
+
const [type, name] = element.split(':');
|
|
40
|
+
return RESOURCE_TYPES.has(type) ? [] : [{ name, type: type.replace(/s$/, '') }];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
29
43
|
const FILTER_VALUE_KEYS = [
|
|
30
44
|
'stringValue',
|
|
31
45
|
'booleanValue',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowFingerprint.js","sourceRoot":"","sources":["../../src/core/flowFingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuB5C,+DAA+D;AAC/D,MAAM,aAAa,GAAG;IACpB,aAAa;IACb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AC,IAAI,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,aAAa,KAAK,GAAG,CAAC,aAAa,EAAE,CAAC;QACvG,WAAW,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,SAAS,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACvF,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAClF,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/lib/core/flowGraph.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { type Condition } from './conditions.js';
|
|
1
2
|
import { type FlowValue, type XmlRecord } from './flowValues.js';
|
|
3
|
+
import { type Expr } from './formula.js';
|
|
2
4
|
/**
|
|
3
|
-
* The parts of a Flow's elements that decide what a test can assert: which `$Record` fields
|
|
4
|
-
* each element writes,
|
|
5
|
+
* The parts of a Flow's elements that decide what a test can assert: which `$Record` fields and
|
|
6
|
+
* variables each element writes, which records it creates or looks up, how decisions branch,
|
|
7
|
+
* and where custom errors stop the save.
|
|
5
8
|
*/
|
|
6
9
|
export type FlowGraph = {
|
|
7
10
|
/** The element the start element connects to. */
|
|
8
11
|
start?: string;
|
|
9
12
|
nodes: Record<string, FlowNode>;
|
|
13
|
+
/** Formula resources by name, for decisions that read them. */
|
|
14
|
+
formulas: Record<string, Expr>;
|
|
10
15
|
};
|
|
11
16
|
/** A write to a field of the triggering record. */
|
|
12
17
|
export type FieldWrite = {
|
|
@@ -15,23 +20,32 @@ export type FieldWrite = {
|
|
|
15
20
|
/** The element that writes it. */
|
|
16
21
|
element: string;
|
|
17
22
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
/** A write to a variable. */
|
|
24
|
+
export type VariableWrite = {
|
|
25
|
+
variable: string;
|
|
26
|
+
value: FlowValue;
|
|
27
|
+
element: string;
|
|
28
|
+
};
|
|
29
|
+
/** A record the Flow creates, with the fields it sets. */
|
|
30
|
+
export type RecordCreate = {
|
|
31
|
+
element: string;
|
|
32
|
+
object: string;
|
|
33
|
+
fields: Array<{
|
|
34
|
+
field: string;
|
|
35
|
+
value: FlowValue;
|
|
36
|
+
}>;
|
|
22
37
|
};
|
|
23
38
|
export type DecisionRule = {
|
|
24
39
|
name: string;
|
|
25
40
|
label: string;
|
|
26
|
-
|
|
27
|
-
logic?: string;
|
|
28
|
-
conditions: FlowCondition[];
|
|
41
|
+
condition: Condition;
|
|
29
42
|
next?: string;
|
|
30
43
|
};
|
|
31
44
|
export type FlowNode = {
|
|
32
45
|
kind: 'write';
|
|
33
46
|
name: string;
|
|
34
47
|
writes: FieldWrite[];
|
|
48
|
+
variables: VariableWrite[];
|
|
35
49
|
nexts: string[];
|
|
36
50
|
} | {
|
|
37
51
|
kind: 'decision';
|
|
@@ -47,6 +61,21 @@ export type FlowNode = {
|
|
|
47
61
|
message?: string;
|
|
48
62
|
nexts: string[];
|
|
49
63
|
}
|
|
64
|
+
/** Get Records that stores its result in `output`. */
|
|
65
|
+
| {
|
|
66
|
+
kind: 'lookup';
|
|
67
|
+
name: string;
|
|
68
|
+
object: string;
|
|
69
|
+
output: string;
|
|
70
|
+
nexts: string[];
|
|
71
|
+
}
|
|
72
|
+
/** Create Records with its fields set one by one. */
|
|
73
|
+
| {
|
|
74
|
+
kind: 'create';
|
|
75
|
+
name: string;
|
|
76
|
+
create: RecordCreate;
|
|
77
|
+
nexts: string[];
|
|
78
|
+
}
|
|
50
79
|
/** Loops, waits, screens: a walk can't tell what happens past them. */
|
|
51
80
|
| {
|
|
52
81
|
kind: 'stop';
|
|
@@ -62,20 +91,34 @@ export declare const GRAPH_ARRAY_PATHS: string[];
|
|
|
62
91
|
/** Reads the element graph from a parsed `<Flow>` record. */
|
|
63
92
|
export declare function parseFlowGraph(flow: XmlRecord): FlowGraph;
|
|
64
93
|
/**
|
|
65
|
-
* What the test knows
|
|
66
|
-
* `
|
|
94
|
+
* What the test knows when the Flow runs, by reference (`$Record.Status__c`,
|
|
95
|
+
* `$Record__Prior.Status__c`, `myVariable`): an Apex literal, `null` for a known-empty value, and
|
|
96
|
+
* no entry for a value it can't know.
|
|
67
97
|
*/
|
|
68
98
|
export type FieldState = Map<string, string | null>;
|
|
69
99
|
/** Effects on one outcome of a decision the walk couldn't decide. */
|
|
70
100
|
export type UndecidedOutcome = {
|
|
71
101
|
label: string;
|
|
72
102
|
writes: FieldWrite[];
|
|
103
|
+
variables: VariableWrite[];
|
|
104
|
+
creates: RecordCreate[];
|
|
73
105
|
/** True when a custom error can stop the save on this outcome. */
|
|
74
106
|
customError: boolean;
|
|
75
107
|
};
|
|
108
|
+
/** A decision the walk took, and the rule it took (undefined for the default outcome). */
|
|
109
|
+
export type DecisionTaken = {
|
|
110
|
+
element: string;
|
|
111
|
+
rule?: DecisionRule;
|
|
112
|
+
};
|
|
76
113
|
export type FlowWalk = {
|
|
77
|
-
/**
|
|
114
|
+
/** `$Record` writes certain to happen, in order. */
|
|
78
115
|
writes: FieldWrite[];
|
|
116
|
+
/** Variable writes certain to happen, in order. */
|
|
117
|
+
variables?: VariableWrite[];
|
|
118
|
+
/** Records the Flow is certain to create. */
|
|
119
|
+
creates?: RecordCreate[];
|
|
120
|
+
/** Decisions taken, in order. */
|
|
121
|
+
decisions?: DecisionTaken[];
|
|
79
122
|
/** A custom error certain to stop the save. */
|
|
80
123
|
customError?: {
|
|
81
124
|
element: string;
|
|
@@ -87,8 +130,15 @@ export type FlowWalk = {
|
|
|
87
130
|
outcomes: UndecidedOutcome[];
|
|
88
131
|
};
|
|
89
132
|
};
|
|
133
|
+
export type WalkOptions = {
|
|
134
|
+
/**
|
|
135
|
+
* Whether the org has no records of `object` the Flow could find. Apex tests see no org data,
|
|
136
|
+
* so this holds for data the test (and the Flow, before the lookup) doesn't create.
|
|
137
|
+
*/
|
|
138
|
+
emptyObject?(object: string): boolean;
|
|
139
|
+
};
|
|
90
140
|
/**
|
|
91
141
|
* Follows the Flow from its start for a record in the given state, through every decision the
|
|
92
142
|
* state decides, and reports what is certain to happen.
|
|
93
143
|
*/
|
|
94
|
-
export declare function walkFlow(graph: FlowGraph, initial: FieldState): FlowWalk;
|
|
144
|
+
export declare function walkFlow(graph: FlowGraph, initial: FieldState, options?: WalkOptions): FlowWalk;
|