@salesforce/plugin-bre-to-cml 1.2.17 → 1.3.1

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.
Files changed (50) hide show
  1. package/README.md +117 -4
  2. package/lib/commands/cml/convert/surcharge-rules.d.ts +12 -0
  3. package/lib/commands/cml/convert/surcharge-rules.js +79 -5
  4. package/lib/commands/cml/convert/surcharge-rules.js.map +1 -1
  5. package/lib/commands/cml/convert/underwriting-rules.d.ts +51 -3
  6. package/lib/commands/cml/convert/underwriting-rules.js +206 -13
  7. package/lib/commands/cml/convert/underwriting-rules.js.map +1 -1
  8. package/lib/commands/insurance/import/record-updates.d.ts +66 -0
  9. package/lib/commands/insurance/import/record-updates.js +239 -0
  10. package/lib/commands/insurance/import/record-updates.js.map +1 -0
  11. package/lib/shared/cml-operators.d.ts +9 -1
  12. package/lib/shared/cml-operators.js +23 -5
  13. package/lib/shared/cml-operators.js.map +1 -1
  14. package/lib/shared/insurance/confirm-org-changes.d.ts +49 -0
  15. package/lib/shared/insurance/confirm-org-changes.js +43 -0
  16. package/lib/shared/insurance/confirm-org-changes.js.map +1 -0
  17. package/lib/shared/insurance/insurance-cml-merge.d.ts +198 -5
  18. package/lib/shared/insurance/insurance-cml-merge.js +504 -28
  19. package/lib/shared/insurance/insurance-cml-merge.js.map +1 -1
  20. package/lib/shared/insurance/insurance-context-tags.d.ts +124 -0
  21. package/lib/shared/insurance/insurance-context-tags.js +210 -0
  22. package/lib/shared/insurance/insurance-context-tags.js.map +1 -0
  23. package/lib/shared/insurance/insurance-org.d.ts +12 -0
  24. package/lib/shared/insurance/insurance-org.js +38 -2
  25. package/lib/shared/insurance/insurance-org.js.map +1 -1
  26. package/lib/shared/insurance/insurance-rule-convert-command.d.ts +27 -0
  27. package/lib/shared/insurance/insurance-rule-convert-command.js +57 -4
  28. package/lib/shared/insurance/insurance-rule-convert-command.js.map +1 -1
  29. package/lib/shared/insurance/insurance-rule-generator.d.ts +101 -8
  30. package/lib/shared/insurance/insurance-rule-generator.js +293 -42
  31. package/lib/shared/insurance/insurance-rule-generator.js.map +1 -1
  32. package/lib/shared/insurance/models.d.ts +2 -1
  33. package/lib/shared/insurance/planned-change-mapper.d.ts +15 -0
  34. package/lib/shared/insurance/planned-change-mapper.js +51 -0
  35. package/lib/shared/insurance/planned-change-mapper.js.map +1 -0
  36. package/lib/shared/insurance/planned-change.d.ts +83 -0
  37. package/lib/shared/insurance/planned-change.js +74 -0
  38. package/lib/shared/insurance/planned-change.js.map +1 -0
  39. package/lib/shared/insurance/record-update-apply.d.ts +100 -0
  40. package/lib/shared/insurance/record-update-apply.js +303 -0
  41. package/lib/shared/insurance/record-update-apply.js.map +1 -0
  42. package/lib/shared/insurance/record-update-plan.d.ts +104 -0
  43. package/lib/shared/insurance/record-update-plan.js +397 -0
  44. package/lib/shared/insurance/record-update-plan.js.map +1 -0
  45. package/messages/cml.convert.surcharge-rules.md +3 -1
  46. package/messages/cml.convert.underwriting-rules.md +1 -1
  47. package/messages/insurance.import.record-updates.md +176 -0
  48. package/oclif.lock +25 -25
  49. package/oclif.manifest.json +95 -3
  50. package/package.json +16 -8
@@ -16,17 +16,93 @@
16
16
  import { ASSOCIATION_TYPES, CML_DATA_TYPES, CONSTRAINT_TYPES } from '../constants/constants.js';
17
17
  import { Association, CmlAttribute, CmlConstraint, CmlModel, CmlType } from '../types/types.js';
18
18
  import { convertToCmlExpression, isKnownOperator, operatorRequiresValues } from '../cml-operators.js';
19
+ /**
20
+ * Source data type -> CML data type. Keyed uppercase because payloads are inconsistent about case
21
+ * ('Datetime' and 'DateTime' both occur in real RuleDefinitions) — the same normalization
22
+ * PcmGenerator's `dataTypeToCmlType` applies to its own keys.
23
+ *
24
+ * PcmGenerator declares these same attributes into the same model, so wherever both maps hold a
25
+ * key they must resolve it identically or one attribute ends up with two contradictory
26
+ * declarations. They do not otherwise mirror each other: this map additionally carries the
27
+ * spellings only a condition payload or an AttributePicklist produces (INTEGER, DECIMAL, DOUBLE,
28
+ * BOOLEAN, DATETIME), for which PcmGenerator has no entry.
29
+ */
30
+ const SOURCE_DATA_TYPE_TO_CML = {
31
+ // decimal, not int: a Salesforce Number attribute may carry decimal places, and PcmGenerator
32
+ // declares one `decimal` in this same model.
33
+ NUMBER: CML_DATA_TYPES.DECIMAL,
34
+ INTEGER: CML_DATA_TYPES.INTEGER,
35
+ PERCENT: CML_DATA_TYPES.DECIMAL,
36
+ CURRENCY: CML_DATA_TYPES.DECIMAL,
37
+ DECIMAL: CML_DATA_TYPES.DECIMAL,
38
+ DOUBLE: CML_DATA_TYPES.DECIMAL,
39
+ BOOLEAN: CML_DATA_TYPES.BOOLEAN,
40
+ // 'Checkbox' is what AttributeDefinition.DataType calls a boolean attribute (AttributePicklist
41
+ // spells the same thing 'Boolean'), and fetchAttributeDataTypes passes it through verbatim.
42
+ CHECKBOX: CML_DATA_TYPES.BOOLEAN,
43
+ DATE: CML_DATA_TYPES.DATE,
44
+ DATETIME: CML_DATA_TYPES.DATE,
45
+ TEXT: CML_DATA_TYPES.STRING,
46
+ STRING: CML_DATA_TYPES.STRING,
47
+ };
48
+ /**
49
+ * Resolves a source data type to a CML data type. An absent or unrecognized type falls back to
50
+ * STRING, which quotes the value — the conservative direction, since an unquoted value reaches the
51
+ * curated model verbatim.
52
+ *
53
+ * The `!dataType` guard also covers the empty string. Returning '' would be neither a known type
54
+ * nor STRING, so the value would take the unquoted path, fail the safe-literal guard, drop its
55
+ * condition, and collapse the whole declaration to `true` — a rule that then applies to everything.
56
+ */
19
57
  function dataTypeToCml(dataType) {
20
- const types = {
21
- Number: CML_DATA_TYPES.INTEGER,
22
- Integer: CML_DATA_TYPES.INTEGER,
23
- Percent: CML_DATA_TYPES.DECIMAL,
24
- Currency: CML_DATA_TYPES.DECIMAL,
25
- Boolean: CML_DATA_TYPES.BOOLEAN,
26
- Date: CML_DATA_TYPES.DATE,
27
- DateTime: CML_DATA_TYPES.DATE,
28
- };
29
- return (dataType && types[dataType]) ?? CML_DATA_TYPES.STRING;
58
+ if (!dataType)
59
+ return CML_DATA_TYPES.STRING;
60
+ return SOURCE_DATA_TYPE_TO_CML[dataType.trim().toUpperCase()] ?? CML_DATA_TYPES.STRING;
61
+ }
62
+ /**
63
+ * The org is authoritative for a reference's type, so a resolved entry wins over the condition's own
64
+ * `dataType` snapshot: an AttributeDefinition for a condition carrying an `attributeId`, a
65
+ * ContextAttribute for a Tag condition (`attributeId` null, keyed by `contextTagName`). A Tag
66
+ * condition whose tag did not resolve still falls back to the snapshot — its rule is withheld
67
+ * downstream by the absent-reference gate, so the fallback only has to stay harmless, not correct.
68
+ */
69
+ function conditionDataType(condition, attributeDataTypes, contextTagDataTypes) {
70
+ if (condition.attributeId) {
71
+ return attributeDataTypes?.get(condition.attributeId) ?? condition.dataType;
72
+ }
73
+ const tag = condition.contextTagName;
74
+ const resolved = tag ? contextTagDataTypes?.get(tag)?.sourceDataType : undefined;
75
+ return resolved ?? condition.dataType;
76
+ }
77
+ /**
78
+ * The context tags a rule actually EMITS a reference to — the Tag-condition counterpart of
79
+ * {@link collectEmittedAttributes}, and its exact discipline: a condition the safe-literal guard,
80
+ * an unknown operator or a missing value dropped contributes nothing, because its tag never reaches
81
+ * the declaration and so needs no binding.
82
+ *
83
+ * Names are returned RAW (not sanitized): the raw title is what resolves against ContextTag.Title
84
+ * and what the emitted `tagName` / `contextPath` annotation must carry. Sanitizing is the
85
+ * identifier's problem, not the binding's.
86
+ */
87
+ export function collectEmittedContextTags(ruleDefs, attributeDataTypes, contextTagDataTypes) {
88
+ const tags = new Set();
89
+ for (const { ruleDef } of ruleDefs) {
90
+ for (const criteria of ruleDef.ruleCriteria ?? []) {
91
+ for (const cond of criteria.conditions ?? []) {
92
+ // Only a Tag condition needs a context binding. An Attribute condition (attributeId present)
93
+ // names a product attribute the curated model is expected to already declare, and is
94
+ // deliberately never auto-declared — see the merge module's absent-reference gate.
95
+ if (cond.attributeId)
96
+ continue;
97
+ if (!cond.contextTagName)
98
+ continue;
99
+ if (buildConditionExpression(cond, attributeDataTypes, contextTagDataTypes) === null)
100
+ continue;
101
+ tags.add(cond.contextTagName);
102
+ }
103
+ }
104
+ }
105
+ return tags;
30
106
  }
31
107
  export function sanitizeName(name) {
32
108
  return name.replace(/[^a-zA-Z0-9]/g, '_');
@@ -71,18 +147,29 @@ const ALWAYS_UNQUOTED_OPERATORS = new Set([
71
147
  'GreaterThan',
72
148
  'GreaterThanOrEquals',
73
149
  ]);
74
- // Operators that emit a value via doubleQuotedIfNeeded — unquoted unless cmlDataType === STRING.
75
- const VALUE_EQUALITY_OPERATORS = new Set(['Equals', 'NotEquals']);
150
+ // Operators whose values are emitted unquoted unless cmlDataType === STRING. Equals/NotEquals go
151
+ // through doubleQuotedIfNeeded; In/NotIn expand into a chain of `==` comparisons that follows the
152
+ // same rule. In/NotIn are also the only multi-value operators here, so the guard below has to clear
153
+ // every element of the list, not just the first.
154
+ const VALUE_EQUALITY_OPERATORS = new Set(['Equals', 'NotEquals', 'In', 'NotIn']);
76
155
  function isSafeNumericLiteral(value) {
77
156
  return /^-?\d+(\.\d+)?$/.test(value.trim());
78
157
  }
79
158
  function isSafeBooleanLiteral(value) {
80
159
  return /^(true|false)$/.test(value.trim());
81
160
  }
82
- // Bare date / datetime literal: YYYY-MM-DD optionally followed by an ISO-8601 time component. No
83
- // parens, operators, or whitespace that could break out of the unquoted slot.
161
+ // Bare date literal: YYYY-MM-DD and nothing else. No parens, operators, or whitespace that could
162
+ // break out of the unquoted slot — and no time component, because the only slot CML offers is
163
+ // `date`, which cannot hold one (see {@link isDateTimeLiteral}).
84
164
  function isSafeDateLiteral(value) {
85
- return /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(value.trim());
165
+ return /^\d{4}-\d{2}-\d{2}$/.test(value.trim());
166
+ }
167
+ // A bare date carrying an ISO-8601 time component. Well-formed, but unrepresentable: CML's
168
+ // primitives are boolean/date/decimal/double/int/string/string[] — there is no datetime and no
169
+ // time. PcmGenerator takes the same view from the other side, filtering Datetime attributes out of
170
+ // the model entirely rather than declaring them as something else.
171
+ function isDateTimeLiteral(value) {
172
+ return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/.test(value.trim());
86
173
  }
87
174
  // A value is safe to emit unquoted only if it is a bare literal of the target CML type. Anything
88
175
  // that isn't (including strings, which must never reach an unquoted slot) is rejected.
@@ -122,7 +209,138 @@ export function isSafeAssociationReferenceValue(value) {
122
209
  return false;
123
210
  return !/[,'"\\\r\n]/.test(value);
124
211
  }
125
- function buildConditionExpression(condition) {
212
+ /**
213
+ * Whether this operator/dataType pair emits its RHS UNQUOTED. Relational operators always do;
214
+ * Equals/NotEquals do whenever the cmlDataType is not STRING. On the unquoted path every value must
215
+ * be a bare safe literal; otherwise the value would land in the curated model verbatim and could
216
+ * inject CML or produce a type-unsafe comparison. A failing value drops the condition (callers
217
+ * filter nulls), exactly as an unknown operator or missing value does.
218
+ */
219
+ function emitsUnquoted(op, cmlDataType) {
220
+ // DATE is the exception to "non-string emits bare", and it is not a style choice: an unquoted ISO
221
+ // literal does not compile against a `date` variable. Verified against a live model — `EndDate ==
222
+ // 2026-12-31` is folded to a constant and rejected with `false cannot be converted to the
223
+ // constraint`, and `EndDate > 2020-01-01` reports `Operator greatThan is not supported between
224
+ // DateExternalVar(EndDate) and DecimalConst(-2020.0000)`: the compiler reads the bare literal as
225
+ // arithmetic, not a date. Either one fails the DEPLOY, which takes down the whole model and every
226
+ // rule in it. The quoted form is a true date comparison — `> "2020-01-01"` / `> "2030-01-01"`
227
+ // ordered correctly against a live `2027-07-25` and tracked the field when it changed.
228
+ if (cmlDataType === CML_DATA_TYPES.DATE)
229
+ return false;
230
+ return (ALWAYS_UNQUOTED_OPERATORS.has(op) || (VALUE_EQUALITY_OPERATORS.has(op) && cmlDataType !== CML_DATA_TYPES.STRING));
231
+ }
232
+ // Operators the shared emitter turns into a CML `strcontain(...)` call — a string function, with no
233
+ // numeric, boolean or date counterpart.
234
+ const SUBSTRING_OPERATORS = new Set(['Contains', 'DoesNotContain']);
235
+ /**
236
+ * The reasons, if any, why a rule cannot be converted faithfully — one per offending condition.
237
+ * A rule with any reason must be SKIPPED with those reasons reported, never partially converted.
238
+ *
239
+ * Dropping just the offending condition is not an option: `buildConstraintDeclaration` returns
240
+ * `true` once every condition of a criteria is gone, and nothing downstream withholds a rule whose
241
+ * declaration is `true`, so a rule that lost its conditions arrives matching everything. That is
242
+ * the empty-`dataType` defect, and the guard exists so a new cause cannot re-create it. Dropping
243
+ * one condition of several is no better — it widens what the rule matches.
244
+ *
245
+ * Two of the three causes today are a condition CML has no primitive for.
246
+ *
247
+ * A date-typed condition whose value carries a time: CML has no datetime primitive, so the
248
+ * alternatives were to emit a timestamp into a `date` slot (platform behavior unverified) or to
249
+ * silently truncate it to its date part (changes what the rule matches, with no signal).
250
+ *
251
+ * A substring test (Contains / DoesNotContain) on an attribute that is not a string: `strcontain`
252
+ * is a string function, and against a `decimal`, `boolean` or `date` attribute there is nothing
253
+ * faithful to emit — quoting the value produces the never-fires type mismatch, and unquoting it is
254
+ * not a substring test at all.
255
+ *
256
+ * In both cases declining the rule and saying so beats emitting something that quietly does nothing.
257
+ *
258
+ * The third reason is not about one condition but about the rule as a whole: a rule whose criteria
259
+ * existed and lost EVERY condition — see {@link collapsesToUnconditional}. It is raised here rather
260
+ * than through a second mechanism because this function is the single point all three skip-reason
261
+ * collectors (`buildCmlModel`, `buildPathedSurchargeRules`, `buildUnderwritingConstraintRules`)
262
+ * already consult, so every caller withholds the rule the same way and a future caller cannot get
263
+ * half the behaviour.
264
+ */
265
+ export function findUnconvertibleConditions(
266
+ // `apiName` / `name` are read only to name the rule in the whole-rule reason below; every real
267
+ // caller passes a ParsedRuleDefinition, which carries both.
268
+ ruleDef, attributeDataTypes, contextTagDataTypes) {
269
+ const reasons = [];
270
+ for (const criteria of ruleDef.ruleCriteria ?? []) {
271
+ for (const condition of criteria.conditions ?? []) {
272
+ // An unknown operator or a missing value already drops the condition for reasons this guard
273
+ // does not own; only classify conditions that would otherwise have emitted.
274
+ if (!isKnownOperator(condition.operator))
275
+ continue;
276
+ const values = condition.values ?? [];
277
+ if (values.length === 0)
278
+ continue;
279
+ const cmlDataType = dataTypeToCml(conditionDataType(condition, attributeDataTypes, contextTagDataTypes));
280
+ const attrName = condition.attributeName ?? condition.contextTagName ?? 'unknown';
281
+ if (SUBSTRING_OPERATORS.has(condition.operator) && cmlDataType !== CML_DATA_TYPES.STRING) {
282
+ reasons.push(`condition on '${attrName}' applies the substring test '${condition.operator}' to an attribute the model ` +
283
+ `declares ${cmlDataType}, which CML cannot represent — strcontain() is a string function, and there is ` +
284
+ 'no numeric, boolean or date counterpart. Converting the rule would have to compare the value as text ' +
285
+ 'against a non-text attribute, which imports cleanly and never fires, so the rule is left on the rule ' +
286
+ 'engine. Re-model the condition as an equality or range comparison, or migrate this rule by hand.');
287
+ continue;
288
+ }
289
+ // Applies to every date-typed condition, quoted or not. It once keyed off the unquoted path
290
+ // because that was the only path a date took; now that dates are quoted, keying off it would
291
+ // silence the check entirely and let a timestamp through as a quoted string.
292
+ if (cmlDataType !== CML_DATA_TYPES.DATE)
293
+ continue;
294
+ const offending = values.find((v) => isDateTimeLiteral(v));
295
+ if (!offending)
296
+ continue;
297
+ reasons.push(`condition on '${attrName}' compares the timestamp '${offending.trim()}', which CML cannot represent — it ` +
298
+ 'has no datetime primitive, and a `date` cannot carry a time. Converting the rule would have to drop the ' +
299
+ 'time and change what it matches, so the rule is left on the rule engine. Re-model the condition against ' +
300
+ 'a date-only attribute, or migrate this rule by hand.');
301
+ }
302
+ }
303
+ // Checked last, and only when nothing above spoke: a condition-specific refusal already says why
304
+ // the rule is withheld, so the whole-rule reason would just repeat it less usefully.
305
+ if (reasons.length === 0 && collapsesToUnconditional(ruleDef, attributeDataTypes, contextTagDataTypes)) {
306
+ const ruleName = ruleDef.apiName ?? ruleDef.name ?? 'unknown';
307
+ reasons.push(`the conditions of rule '${ruleName}' could not be converted — every one of them was dropped (an ` +
308
+ 'unrecognized operator, a missing value, or a value the safe-literal / quotable-string guards ' +
309
+ 'refused), leaving nothing to compare. Converting the rule would emit the unconditional ' +
310
+ 'declaration `true`, which matches every quote rather than the set the rule selects, so the rule ' +
311
+ 'is left on the rule engine. Correct the offending condition values or operators and re-run, or ' +
312
+ 'migrate this rule by hand.');
313
+ }
314
+ return reasons;
315
+ }
316
+ /**
317
+ * Whether every condition of a rule that HAD conditions was dropped, leaving
318
+ * {@link buildConstraintDeclaration} nothing to build from.
319
+ *
320
+ * That function answers `'true'` from two places that mean opposite things. A rule with no criteria
321
+ * genuinely applies always, and curated models contain such lines — that `true` is correct. A rule
322
+ * whose criteria existed but lost every expression is a conversion FAILURE reported as success: the
323
+ * rule is placed as `rule(true, ...)` (or an always-satisfied constraint) and matches every quote.
324
+ * For a surcharge that means charging every customer. Only the second is a reason to withhold, and
325
+ * by the time the declaration exists the two are indistinguishable, so the distinction is drawn
326
+ * here from the criteria themselves.
327
+ *
328
+ * A criteria carrying no conditions dropped nothing either, so a rule made only of those is the
329
+ * genuinely-applies-always case in a different spelling, not a failure — hence the condition count
330
+ * rather than a `ruleCriteria.length` test.
331
+ *
332
+ * Losing SOME conditions is a related but distinct defect and deliberately out of scope: a criteria
333
+ * ANDs its conditions, so dropping one widens what the rule matches without collapsing it. That
334
+ * rule still emits.
335
+ */
336
+ function collapsesToUnconditional(ruleDef, attributeDataTypes, contextTagDataTypes) {
337
+ const criteria = ruleDef.ruleCriteria ?? [];
338
+ const conditionCount = criteria.reduce((total, c) => total + (c.conditions?.length ?? 0), 0);
339
+ if (conditionCount === 0)
340
+ return false;
341
+ return criteria.every((c) => buildCriteriaExpression(c, attributeDataTypes, contextTagDataTypes) === null);
342
+ }
343
+ function buildConditionExpression(condition, attributeDataTypes, contextTagDataTypes) {
126
344
  if (!isKnownOperator(condition.operator))
127
345
  return null;
128
346
  const op = condition.operator;
@@ -130,41 +348,59 @@ function buildConditionExpression(condition) {
130
348
  return null;
131
349
  }
132
350
  const values = condition.values ?? [];
133
- const cmlDataType = dataTypeToCml(condition.dataType);
134
- // Determine whether this operator/dataType pair emits its RHS UNQUOTED. Relational operators
135
- // always do; Equals/NotEquals do whenever the cmlDataType is not STRING. On the unquoted path we
136
- // require every value to be a bare safe literal; otherwise the value would land in the curated
137
- // model verbatim and could inject CML or produce a type-unsafe comparison. A failing value drops
138
- // the condition (the caller filters nulls), exactly as an unknown operator or missing value does.
139
- const emitsUnquoted = ALWAYS_UNQUOTED_OPERATORS.has(op) || (VALUE_EQUALITY_OPERATORS.has(op) && cmlDataType !== CML_DATA_TYPES.STRING);
140
- if (emitsUnquoted) {
351
+ const cmlDataType = dataTypeToCml(conditionDataType(condition, attributeDataTypes, contextTagDataTypes));
352
+ if (emitsUnquoted(op, cmlDataType)) {
141
353
  if (!values.every((v) => isSafeUnquotedLiteral(v, cmlDataType))) {
142
354
  return null;
143
355
  }
144
356
  }
357
+ else if (cmlDataType === CML_DATA_TYPES.DATE) {
358
+ // A date is quoted (see {@link emitsUnquoted}) but is NOT a free-form string: the quotes make
359
+ // the compiler accept anything, so `EndDate == "next tuesday"` would deploy and never fire.
360
+ // Hold it to the same bare-date shape the unquoted path demanded.
361
+ if (!values.every(isSafeDateLiteral)) {
362
+ return null;
363
+ }
364
+ }
145
365
  else if (!values.every(isSafeQuotableString)) {
146
366
  // String-quoted path: reject values the shared escaper cannot safely contain (backslash, etc.).
147
367
  return null;
148
368
  }
149
369
  const attrName = sanitizeName(condition.attributeName ?? condition.contextTagName ?? 'unknown');
150
- return convertToCmlExpression(attrName, op, condition.values, cmlDataType);
370
+ // The shared emitter quotes only `string`, and never quotes a relational RHS at all — it is shared
371
+ // with the Revenue Cloud generator, whose date attributes are declared in-type rather than as the
372
+ // externs this evidence covers, so teaching it about dates would change a path this proof does not
373
+ // reach. Quote here instead. Safe to do by hand: isSafeDateLiteral above admits only YYYY-MM-DD,
374
+ // so there is nothing for escapeQuotes to escape.
375
+ const emitValues = cmlDataType === CML_DATA_TYPES.DATE && values.length > 0 ? values.map((v) => `"${v.trim()}"`) : condition.values;
376
+ return convertToCmlExpression(attrName, op, emitValues, cmlDataType);
151
377
  }
152
- function buildCriteriaExpression(criteria) {
378
+ function buildCriteriaExpression(criteria, attributeDataTypes, contextTagDataTypes) {
153
379
  const parts = [];
154
380
  if (criteria.conditions) {
155
381
  for (const condition of criteria.conditions) {
156
- const expr = buildConditionExpression(condition);
382
+ const expr = buildConditionExpression(condition, attributeDataTypes, contextTagDataTypes);
157
383
  if (expr)
158
384
  parts.push(expr);
159
385
  }
160
386
  }
161
387
  return parts.length > 0 ? parts.join(' && ') : null;
162
388
  }
163
- export function buildConstraintDeclaration(ruleDef) {
389
+ /**
390
+ * Both `'true'` returns below are deliberate and stay total — the function must answer for any
391
+ * input, because merge mode builds a rule's statement before deciding whether to place it, and
392
+ * throwing here would bypass a caller's skip handling. Only the FIRST is a faithful conversion (a
393
+ * rule with no criteria really does always apply). The second means every expression was dropped,
394
+ * which {@link findUnconvertibleConditions} classifies as unconvertible so the callers that collect
395
+ * skip reasons withhold the rule instead of placing this declaration.
396
+ */
397
+ export function buildConstraintDeclaration(ruleDef, attributeDataTypes, contextTagDataTypes) {
164
398
  if (!ruleDef.ruleCriteria || ruleDef.ruleCriteria.length === 0) {
165
399
  return 'true';
166
400
  }
167
- const expressions = ruleDef.ruleCriteria.map(buildCriteriaExpression).filter((e) => e !== null);
401
+ const expressions = ruleDef.ruleCriteria
402
+ .map((criteria) => buildCriteriaExpression(criteria, attributeDataTypes, contextTagDataTypes))
403
+ .filter((e) => e !== null);
168
404
  if (expressions.length === 0)
169
405
  return 'true';
170
406
  if (expressions.length === 1)
@@ -193,12 +429,12 @@ export function collectAttributes(ruleDefs) {
193
429
  * noise on exactly the inputs the guard sanitized. Unlike `collectAttributes`, names are returned
194
430
  * sanitized to match how they appear in the emitted declaration.
195
431
  */
196
- export function collectEmittedAttributes(ruleDefs) {
432
+ export function collectEmittedAttributes(ruleDefs, attributeDataTypes, contextTagDataTypes) {
197
433
  const attrs = new Set();
198
434
  for (const { ruleDef } of ruleDefs) {
199
435
  for (const criteria of ruleDef.ruleCriteria ?? []) {
200
436
  for (const cond of criteria.conditions ?? []) {
201
- if (buildConditionExpression(cond) === null)
437
+ if (buildConditionExpression(cond, attributeDataTypes, contextTagDataTypes) === null)
202
438
  continue;
203
439
  const name = cond.attributeName ?? cond.contextTagName;
204
440
  if (name)
@@ -209,12 +445,15 @@ export function collectEmittedAttributes(ruleDefs) {
209
445
  return attrs;
210
446
  }
211
447
  /**
212
- * Derives the real CML data type for each collected attribute from its condition `dataType`.
213
- * When an attribute appears with more than one distinct CML type (a conflict), or its type is
214
- * unknown, it falls back to STRING. Returned alongside (not replacing) the Set from
215
- * collectAttributes, which merge mode still depends on.
448
+ * Derives the real CML data type for each collected attribute from its resolved data type (falling
449
+ * back to the condition's own `dataType`). When an attribute appears with more than one distinct CML
450
+ * type (a conflict), or its type is unknown, it falls back to STRING. Returned alongside (not
451
+ * replacing) the Set from collectAttributes, which merge mode still depends on.
452
+ *
453
+ * Shares `conditionDataType` with the declaration builder so an attribute is never declared as one
454
+ * type and then compared as another.
216
455
  */
217
- export function collectAttributeTypes(ruleDefs) {
456
+ export function collectAttributeTypes(ruleDefs, attributeDataTypes) {
218
457
  const types = new Map();
219
458
  const conflicting = new Set();
220
459
  for (const { ruleDef } of ruleDefs) {
@@ -223,7 +462,7 @@ export function collectAttributeTypes(ruleDefs) {
223
462
  const name = cond.attributeName ?? cond.contextTagName;
224
463
  if (!name)
225
464
  continue;
226
- const cmlType = dataTypeToCml(cond.dataType);
465
+ const cmlType = dataTypeToCml(conditionDataType(cond, attributeDataTypes));
227
466
  const existing = types.get(name);
228
467
  if (existing === undefined) {
229
468
  types.set(name, cmlType);
@@ -250,15 +489,27 @@ ruleType,
250
489
  // drops the binding. Optional + last so the legacy (code-as-reference) call sites stay valid; the
251
490
  // convert layer supplies only Names that passed isSafeAssociationReferenceValue, hence the
252
491
  // unconditional ProductCode fallback below for any product missing a safe Name.
253
- productIdToName) {
492
+ productIdToName,
493
+ // Org-resolved attribute types, so a picklist attribute is declared and compared as the type
494
+ // behind the picklist (e.g. decimal for a Currency picklist) rather than degrading to string.
495
+ attributeDataTypes) {
254
496
  const cmlModel = new CmlModel();
497
+ const skipped = [];
255
498
  const rulesByProduct = new Map();
256
499
  for (const entry of ruleDefs) {
500
+ // Withheld here rather than at declaration time so an unconvertible rule contributes neither a
501
+ // constraint nor a ruleKeyMapping entry — the record is then never flipped to the constraint
502
+ // engine, leaving the rule live on the rule engine instead of disabled with nothing behind it.
503
+ const unconvertible = findUnconvertibleConditions(entry.ruleDef, attributeDataTypes);
504
+ if (unconvertible.length > 0) {
505
+ skipped.push({ recordId: entry.record.Id, name: entry.record.Name, reason: unconvertible.join(' ') });
506
+ continue;
507
+ }
257
508
  // Trim the root segment so leading/trailing whitespace can't split one product into two
258
509
  // groups, and skip a rule with a blank ProductPath (it can't be nested under any product)
259
510
  // instead of materializing an empty-named type. Mirrors the trimming in
260
511
  // collectAllProductIds / collectRootProductIds.
261
- const rootProductId = entry.record.ProductPath.split('/')[0]?.trim();
512
+ const rootProductId = (entry.record.ProductPath ?? '').split('/')[0]?.trim();
262
513
  if (!rootProductId)
263
514
  continue;
264
515
  if (!rulesByProduct.has(rootProductId)) {
@@ -272,7 +523,7 @@ productIdToName) {
272
523
  const typeName = sanitizeName(productCode);
273
524
  const productType = new CmlType(typeName, undefined, undefined);
274
525
  const attrs = collectAttributes(productRules);
275
- const attrTypes = collectAttributeTypes(productRules);
526
+ const attrTypes = collectAttributeTypes(productRules, attributeDataTypes);
276
527
  for (const attrName of attrs) {
277
528
  const cmlType = attrTypes.get(attrName) ?? CML_DATA_TYPES.STRING;
278
529
  productType.addAttribute(new CmlAttribute(null, sanitizeName(attrName), cmlType));
@@ -281,7 +532,7 @@ productIdToName) {
281
532
  const apiName = ruleDef.apiName ?? record.Name;
282
533
  const stageTransition = buildStageTransition(ruleDef.underwritingRuleGroup);
283
534
  const ruleKey = generateRuleKey(keyPrefix, productCode, apiName, stageTransition);
284
- const declaration = buildConstraintDeclaration(ruleDef);
535
+ const declaration = buildConstraintDeclaration(ruleDef, attributeDataTypes);
285
536
  const constraint = ruleType
286
537
  ? CmlConstraint.createRuleConstraint(declaration, ruleType, ruleKey, 'True')
287
538
  : new CmlConstraint(CONSTRAINT_TYPES.CONSTRAINT, declaration, `"${constraintLabel}: ${record.Name}"`);
@@ -298,6 +549,6 @@ productIdToName) {
298
549
  const referenceValue = productIdToName?.get(rootProductId) ?? productCode;
299
550
  cmlModel.addAssociation(new Association(null, typeName, ASSOCIATION_TYPES.TYPE, rootProductId, 'Product2', referenceValue));
300
551
  }
301
- return { cmlModel, ruleKeyMapping };
552
+ return { cmlModel, ruleKeyMapping, skipped };
302
553
  }
303
554
  //# sourceMappingURL=insurance-rule-generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insurance-rule-generator.js","sourceRoot":"","sources":["../../../src/shared/insurance/insurance-rule-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAUtG,SAAS,aAAa,CAAC,QAAiB;IACtC,MAAM,KAAK,GAA2B;QACpC,MAAM,EAAE,cAAc,CAAC,OAAO;QAC9B,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,QAAQ,EAAE,cAAc,CAAC,OAAO;QAChC,OAAO,EA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AAc,EAAE,OAAO,EAAE,CAAC;AAC/C,CAAC"}
@@ -31,11 +31,12 @@ export type ParsedRuleDefinition = {
31
31
  description?: string;
32
32
  ruleCriteria?: RuleCriteria[];
33
33
  underwritingRuleGroup?: UnderwritingRuleGroup;
34
+ surchargeId?: string;
34
35
  };
35
36
  export type RuleRecord = {
36
37
  Id: string;
37
38
  Name: string;
38
- ProductPath: string;
39
+ ProductPath: string | null;
39
40
  };
40
41
  export type RuleKeyEntry = {
41
42
  recordId: string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Turns the apply layer's {@link PlannedRecordChange} into the shapes the operator and a `--json`
3
+ * consumer see. Kept out of `planned-change.ts` because rendering a blob change needs
4
+ * `record-update-plan.ts`, which already imports `planned-change.ts` — putting these there would
5
+ * close an import cycle.
6
+ */
7
+ import { PlannedRecordChange } from './record-update-apply.js';
8
+ import { PlannedChange } from './planned-change.js';
9
+ export type RecordUpdateSkipResult = {
10
+ id: string;
11
+ field: string;
12
+ reason: string;
13
+ };
14
+ export declare function toPlannedChange(change: PlannedRecordChange): PlannedChange;
15
+ export declare function toSkipResult(change: PlannedRecordChange): RecordUpdateSkipResult;
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { JSON_BLOB_FIELD, formatBlobChange, formatBlobSummary } from './record-update-plan.js';
17
+ import { NO_VALUE, formatChange, truncateCell } from './planned-change.js';
18
+ export function toPlannedChange(change) {
19
+ return {
20
+ operation: change.alreadyCurrent ? 'Skip (already current)' : 'Update',
21
+ object: change.update.sobject,
22
+ id: change.update.id,
23
+ name: change.update.name,
24
+ field: change.field.field,
25
+ change: describeChange(change),
26
+ currentValue: change.currentValue,
27
+ newValue: change.field.value,
28
+ };
29
+ }
30
+ export function toSkipResult(change) {
31
+ return {
32
+ id: change.update.id,
33
+ field: change.field.field,
34
+ reason: 'org already matches the requested value',
35
+ };
36
+ }
37
+ /**
38
+ * Builds the operator-facing `Change` cell. `DynamicRuleDefinition` is rendered as a semantic diff
39
+ * of the fields convert mutates, because the raw blob's first 60 characters are identical before
40
+ * and after — a truncated raw diff shows the operator the same string twice.
41
+ */
42
+ function describeChange(change) {
43
+ const isBlob = change.field.field === JSON_BLOB_FIELD;
44
+ if (change.alreadyCurrent) {
45
+ const summary = isBlob ? formatBlobSummary(change.currentValue) : undefined;
46
+ return `${summary ?? truncateCell(change.currentValue ?? NO_VALUE)} (unchanged)`;
47
+ }
48
+ const semantic = isBlob ? formatBlobChange(change.currentValue, change.field.value) : undefined;
49
+ return semantic ?? formatChange(change.currentValue, change.field.value);
50
+ }
51
+ //# sourceMappingURL=planned-change-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planned-change-mapper.js","sourceRoot":"","sources":["../../../src/shared/insurance/planned-change-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAiB,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQ1F,MAAM,UAAU,eAAe,CAAC,MAA2B;IACzD,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,QAAQ;QACtE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO;QAC7B,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;Q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