@salesforce/plugin-bre-to-cml 1.3.0 → 1.3.2

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 +41 -2
  6. package/lib/commands/cml/convert/underwriting-rules.js +141 -17
  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 +100 -13
  18. package/lib/shared/insurance/insurance-cml-merge.js +355 -54
  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 +28 -28
  49. package/oclif.manifest.json +127 -35
  50. package/package.json +16 -8
@@ -17,7 +17,7 @@ import { Flags } from '@salesforce/sf-plugins-core';
17
17
  import { Messages } from '@salesforce/core';
18
18
  import { InsuranceRuleConvertCommand, } from '../../../shared/insurance/insurance-rule-convert-command.js';
19
19
  import { decodeHtmlEntities } from '../../../shared/insurance/insurance-rule-generator.js';
20
- import { buildUnderwritingConstraintRules, fetchExistingConstraintModel, fetchProductTypeTags, mergeUnderwritingConstraints, splitProductPath, } from '../../../shared/insurance/insurance-cml-merge.js';
20
+ import { buildUnderwritingConstraintRules, fetchExistingConstraintModel, fetchProductTypeTags, mergeUnderwritingConstraints, splitProductPath, UNCONVERTIBLE_SKIP_PREFIX, } from '../../../shared/insurance/insurance-cml-merge.js';
21
21
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
22
  const messages = Messages.loadMessages('@salesforce/plugin-bre-to-cml', 'cml.convert.underwriting-rules');
23
23
  // eslint-disable-next-line sf-plugin/only-extend-SfCommand
@@ -41,6 +41,8 @@ export default class CmlConvertUnderwritingRules extends InsuranceRuleConvertCom
41
41
  // WHERE clause; records with a null DynamicRuleDefinition are skipped during parsing instead.
42
42
  soql = 'SELECT Id, Name, ApiName, DynamicRuleDefinition, ProductPath, RuleKey, UnderwritingRuleGroupId, UnderwritingRuleGroup.Name FROM UnderwritingRule WHERE RuleKey = null';
43
43
  recordUpdateKind = 'underwriting-update';
44
+ /** Merge-skip reason per UnderwritingRule id, populated by {@link runMergeConvert}. */
45
+ skipReasonByRecordId = new Map();
44
46
  async run() {
45
47
  const { flags } = await this.parse(CmlConvertUnderwritingRules);
46
48
  return this.runConvert({
@@ -74,9 +76,12 @@ export default class CmlConvertUnderwritingRules extends InsuranceRuleConvertCom
74
76
  productIds.add(id);
75
77
  }
76
78
  const productIdToType = await fetchProductTypeTags(conn, productIds);
77
- const rules = buildUnderwritingConstraintRules(this.keyPrefix, this.constraintLabel, ruleDefs, productIdToCode, productIdToType);
79
+ const rules = buildUnderwritingConstraintRules(this.keyPrefix, this.constraintLabel, ruleDefs, productIdToCode, productIdToType, this.attributeDataTypes);
78
80
  rules.forEach((r) => this.log(` -> ${r.recordName} => ${r.constraintName} (type: ${r.typeName ?? 'UNRESOLVED'})`));
79
81
  const { mergedCml, placements, skips, attributeWarnings } = mergeUnderwritingConstraints(existing.cmlText, rules);
82
+ // Kept so the withheld-flip warning can quote WHY each blocking rule missed the CML, instead of
83
+ // sending the operator back up the log to correlate SKIPPED lines with group ids by hand.
84
+ this.skipReasonByRecordId = new Map(skips.map((s) => [s.rule.recordId, s.reason]));
80
85
  this.log(`\nMerge summary: ${placements.filter((p) => p.status === 'inserted').length} inserted, ${placements.filter((p) => p.status === 'replaced').length} updated in place, ${skips.length} skipped.`);
81
86
  for (const s of skips)
82
87
  this.warn(` SKIPPED ${s.rule.recordName}: ${s.reason}`);
@@ -92,10 +97,14 @@ export default class CmlConvertUnderwritingRules extends InsuranceRuleConvertCom
92
97
  noTypeTag: 0,
93
98
  typeBlockMissing: 0,
94
99
  typeBlockAmbiguous: 0,
100
+ unconvertible: 0,
101
+ undeclaredAttribute: 0,
95
102
  other: 0,
96
103
  };
97
104
  for (const s of skips) {
98
- if (s.reason.startsWith('duplicate constraint name'))
105
+ if (s.reason.startsWith(UNCONVERTIBLE_SKIP_PREFIX))
106
+ counts.unconvertible += 1;
107
+ else if (s.reason.startsWith('duplicate constraint name'))
99
108
  counts.duplicateConstraint += 1;
100
109
  else if (s.reason.startsWith('empty ProductPath'))
101
110
  counts.emptyPath += 1;
@@ -105,12 +114,15 @@ export default class CmlConvertUnderwritingRules extends InsuranceRuleConvertCom
105
114
  counts.typeBlockMissing += 1;
106
115
  else if (s.reason.includes('is ambiguous'))
107
116
  counts.typeBlockAmbiguous += 1;
117
+ else if (s.reason.startsWith('undeclared attribute'))
118
+ counts.undeclaredAttribute += 1;
108
119
  else
109
120
  counts.other += 1;
110
121
  }
111
122
  this.log(`Skip breakdown: ${counts.duplicateConstraint} duplicate-constraint-name, ${counts.emptyPath} empty-ProductPath, ` +
112
123
  `${counts.noTypeTag} no-type-tag, ${counts.typeBlockMissing} type-block-missing, ` +
113
- `${counts.typeBlockAmbiguous} type-block-ambiguous, ${counts.other} other`);
124
+ `${counts.typeBlockAmbiguous} type-block-ambiguous, ${counts.unconvertible} unconvertible, ` +
125
+ `${counts.undeclaredAttribute} undeclared-attribute, ${counts.other} other`);
114
126
  }
115
127
  const ruleKeyMapping = placements.map((p) => ({
116
128
  recordId: p.rule.recordId,
@@ -143,23 +155,64 @@ export default class CmlConvertUnderwritingRules extends InsuranceRuleConvertCom
143
155
  * Pure transform — the file-only successor to the old live updateOrgRecords. Produces the exact
144
156
  * org-record changes convert previously applied: (1) each UnderwritingRuleGroup flipped to
145
157
  * RuleEngineType=ConstraintEngine, then (2) each BRE UnderwritingRule's DynamicRuleDefinition blob
146
- * rewritten with the converted ruleKey (and the nested underwritingRuleGroup.ruleEngineType, when
147
- * present). Groups are emitted first so a faithful apply mirrors the original ordering. The blob
158
+ * rewritten with the converted ruleKey (and, only when this plan also flips that rule's group, the
159
+ * nested underwritingRuleGroup.ruleEngineType). Groups are emitted first so a faithful apply
160
+ * mirrors the original ordering, and so step (2) can read back which groups step (1) flipped. The blob
148
161
  * rewrite uses a RAW JSON.parse of the org's stored value (NOT decodeHtmlEntities) — byte-for-byte
149
162
  * the same mutation the live path performed.
163
+ *
164
+ * `ruleKeyMapping` is the authoritative "landed in the CML" set: runMergeConvert builds it from
165
+ * the merge's `placements` (inserted + replaced) only, so every skipped rule is absent from it.
150
166
  */
151
167
  buildRecordUpdates(records, ruleKeyMapping) {
152
168
  const updates = [];
153
- // (1) UnderwritingRuleGroup flips — union of every referenced group, name resolved from the
154
- // queried relationship so the apply-time identity guard has something to cross-check.
155
- const groupNames = new Map();
169
+ // (1) UnderwritingRuleGroup flips. The flip is the migration's point of no return: once a group
170
+ // is on ConstraintEngine the platform stops evaluating its BRE rules and evaluates the CML
171
+ // constraints instead. So a group may only be flipped when EVERY one of its rules in this run
172
+ // actually landed in the merged CML — deriving the set from all queried records flipped groups
173
+ // whose rules were skipped (blank ProductPath, unresolved type tag, missing/ambiguous type
174
+ // block, duplicate constraint name), silently disabling rules with nothing behind them.
175
+ //
176
+ // Partial groups (some rules placed, some skipped) are withheld too, and warned about. Neither
177
+ // choice is free: withholding leaves the placed constraints inert, flipping disables the
178
+ // skipped rules' logic. Withholding is the safer default because it is recoverable — the org is
179
+ // left exactly as it was, and re-running after fixing the skip reasons flips the group with all
180
+ // its constraints in place. Flipping is not: the disabled rules stop firing immediately, with
181
+ // nothing in the plan or the org to indicate which logic went dark.
182
+ const placedRecordIds = new Set(ruleKeyMapping.map((m) => m.recordId));
183
+ const groups = new Map();
156
184
  for (const record of records) {
157
- if (record.UnderwritingRuleGroupId) {
158
- groupNames.set(record.UnderwritingRuleGroupId, record.UnderwritingRuleGroup?.Name ?? null);
185
+ const groupId = record.UnderwritingRuleGroupId;
186
+ if (!groupId)
187
+ continue;
188
+ const state = groups.get(groupId) ?? { name: null, placed: [], unplaced: [] };
189
+ // Name resolved from the queried relationship so the apply-time identity guard has something
190
+ // to cross-check; first non-null wins (the rows of one group should agree on it).
191
+ state.name = state.name ?? record.UnderwritingRuleGroup?.Name ?? null;
192
+ if (placedRecordIds.has(record.Id)) {
193
+ state.placed.push(record.Name);
194
+ }
195
+ else {
196
+ const segments = splitProductPath(record.ProductPath);
197
+ state.unplaced.push({ id: record.Id, name: record.Name, leafProductId: segments[segments.length - 1] });
159
198
  }
199
+ groups.set(groupId, state);
160
200
  }
161
- for (const [groupId, groupName] of groupNames) {
162
- if (!groupName) {
201
+ const withheld = [];
202
+ for (const [groupId, state] of groups) {
203
+ if (state.placed.length === 0) {
204
+ // Nothing of this group reached the CML. Every one of its rules was already reported as
205
+ // SKIPPED with a reason, so a per-group warning would only repeat that; the count is logged
206
+ // below so the operator can reconcile it against the merge summary.
207
+ withheld.push(groupId);
208
+ continue;
209
+ }
210
+ if (state.unplaced.length > 0) {
211
+ this.warn(this.partialGroupWarning(groupId, state));
212
+ withheld.push(groupId);
213
+ continue;
214
+ }
215
+ if (!state.name) {
163
216
  // Without a Name the apply can't run its identity guard; skip rather than write blind.
164
217
  this.warn(`Skipping UnderwritingRuleGroup ${groupId}: no Name resolved (cannot verify identity on apply)`);
165
218
  continue;
@@ -167,24 +220,95 @@ export default class CmlConvertUnderwritingRules extends InsuranceRuleConvertCom
167
220
  updates.push({
168
221
  sobject: 'UnderwritingRuleGroup',
169
222
  id: groupId,
170
- name: groupName,
223
+ name: state.name,
171
224
  fields: [{ field: 'RuleEngineType', value: 'ConstraintEngine' }],
172
225
  });
173
226
  }
227
+ if (withheld.length > 0) {
228
+ this.log(`Withheld ${withheld.length} UnderwritingRuleGroup flip(s) whose rules did not all reach the merged CML: ${withheld.join(', ')}`);
229
+ }
174
230
  // (2) UnderwritingRule DynamicRuleDefinition rewrites — same subset and same mutation as live.
231
+ // The flipped set is read back off the group updates actually pushed above rather than
232
+ // re-derived from the withhold conditions, so all three no-flip paths (zero placed, partial,
233
+ // no Name resolved) are covered by construction and the two decisions cannot drift apart.
234
+ const flippedGroupIds = new Set(updates.filter((u) => u.sobject === 'UnderwritingRuleGroup').map((u) => u.id));
235
+ updates.push(...this.buildBlobRewrites(records, ruleKeyMapping, flippedGroupIds));
236
+ return updates;
237
+ }
238
+ /**
239
+ * The withheld-flip warning for a partially-migrated group. This message is the only thing the
240
+ * operator has to act on, so it has to name a remedy rather than a symptom:
241
+ *
242
+ * The reason it most often quotes, `no CML type tag found for the leaf product of X`, names a
243
+ * symptom. `fetchProductTypeTags` reads that tag from ExpressionSetConstraintObj rows with
244
+ * ConstraintModelTagType='Type', so the remedy is to add the row binding that leaf Product2 to a
245
+ * type block — stated here rather than left to be reverse-engineered out of the merge internals.
246
+ *
247
+ * And "fix it and re-run" is the wrong instruction when the leaf product is not in the org's
248
+ * Product2 at all: nothing can bind a type tag to a product that is not there, so the group stays
249
+ * withheld however many times it is re-run. Convert already warned about exactly those ids while
250
+ * resolving product codes, so that case is separated out instead of folded into "fix and re-run".
251
+ */
252
+ partialGroupWarning(groupId, state) {
253
+ const total = state.placed.length + state.unplaced.length;
254
+ const blockers = state.unplaced.map((r) => r.name).join(', ');
255
+ const unplaceable = state.unplaced.flatMap((r) => r.leafProductId && this.productIdsMissingFromOrg.has(r.leafProductId)
256
+ ? [`${r.name} (leaf product ${r.leafProductId})`]
257
+ : []);
258
+ const parts = [
259
+ `Not flipping UnderwritingRuleGroup '${state.name ?? groupId}' (${groupId}): ${state.unplaced.length} of its ${total} rules were not merged into the CML (${blockers}). Flipping it would stop those rules being ` +
260
+ `evaluated with no constraint behind them; instead the converted constraint(s) for ${state.placed.join(', ')} ` +
261
+ 'stay inert until every rule in the group merges.',
262
+ ];
263
+ // Only promise a re-run when at least one blocker could actually be placed by one.
264
+ if (unplaceable.length < state.unplaced.length) {
265
+ parts.push("Each blocking rule's reason is on its SKIPPED line above; fix those and re-run to flip the group.");
266
+ }
267
+ if (state.unplaced.some((r) => this.skipReasonByRecordId.get(r.id)?.startsWith('no CML type tag'))) {
268
+ parts.push("A 'no CML type tag' reason means that rule's leaf product is not bound to any type block in this model: add " +
269
+ "an ExpressionSetConstraintObj row with ConstraintModelTagType='Type', ReferenceObjectId set to the leaf " +
270
+ "Product2 and ConstraintModelTag set to the target type name (or repoint the rule's ProductPath at a product " +
271
+ 'that already has one).');
272
+ }
273
+ if (unplaceable.length > 0) {
274
+ parts.push(`Re-running will not help for ${unplaceable.join(', ')}: that product was not returned by the Product2 query (warned above), so no type tag can be ` +
275
+ 'bound to it and the rule cannot be placed in this org until the product exists and is visible to this user.');
276
+ }
277
+ return parts.join(' ');
278
+ }
279
+ /**
280
+ * Step (2) of the plan: rewrite each placed BRE rule's DynamicRuleDefinition blob. Uses a RAW
281
+ * JSON.parse of the org's stored value (NOT decodeHtmlEntities) and re-stringifies — byte-for-byte
282
+ * the same mutation the old live code path performed; the document is never reformatted or re-keyed.
283
+ *
284
+ * The nested `underwritingRuleGroup.ruleEngineType` is stamped ONLY when this same plan also flips
285
+ * that rule's group record. Setting it unconditionally left the plan internally inconsistent
286
+ * whenever a flip was withheld: the applied blob asserted ConstraintEngine while the group record
287
+ * it belongs to still carried its old RuleEngineType, and nothing in the apply preview surfaces
288
+ * the disagreement. Whether the platform READS the nested copy is not established — the sibling
289
+ * `underwritingRuleGroupId` is null in every stored blob and appears not to be maintained by the
290
+ * platform — so this is a consistency fix, not a known runtime failure. When the group is not
291
+ * flipped the nested value is left exactly as the org stored it: not deleted, not substituted.
292
+ *
293
+ * The `ruleKey` rewrite happens either way — it is what the placed constraint needs, and the
294
+ * reason the record update is still emitted for a withheld group's placed rules at all.
295
+ */
296
+ buildBlobRewrites(records, ruleKeyMapping, flippedGroupIds) {
297
+ const rewrites = [];
175
298
  const ruleKeyMap = new Map(ruleKeyMapping.map((m) => [m.recordId, m.ruleKey]));
176
299
  const breRecords = records.filter((r) => !r.RuleKey && r.DynamicRuleDefinition);
177
300
  for (const record of breRecords) {
178
301
  const ruleKey = ruleKeyMap.get(record.Id);
179
302
  if (!ruleKey || !record.DynamicRuleDefinition)
180
303
  continue;
304
+ const groupIsFlipping = !!record.UnderwritingRuleGroupId && flippedGroupIds.has(record.UnderwritingRuleGroupId);
181
305
  try {
182
306
  const defn = JSON.parse(record.DynamicRuleDefinition);
183
307
  defn.ruleKey = ruleKey;
184
- if (defn.underwritingRuleGroup && typeof defn.underwritingRuleGroup === 'object') {
308
+ if (groupIsFlipping && defn.underwritingRuleGroup && typeof defn.underwritingRuleGroup === 'object') {
185
309
  defn.underwritingRuleGroup.ruleEngineType = 'ConstraintEngine';
186
310
  }
187
- updates.push({
311
+ rewrites.push({
188
312
  sobject: 'UnderwritingRule',
189
313
  id: record.Id,
190
314
  name: record.Name,
@@ -196,7 +320,7 @@ export default class CmlConvertUnderwritingRules extends InsuranceRuleConvertCom
196
320
  this.warn(` Failed to parse DynamicRuleDefinition for ${record.Name}`);
197
321
  }
198
322
  }
199
- return updates;
323
+ return rewrites;
200
324
  }
201
325
  }
202
326
  //# sourceMappingURL=underwriting-rules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"underwriting-rules.js","sourceRoot":"","sources":["../../../../src/commands/cml/convert/underwriting-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAc,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EACL,2BAA2B,GAI5B,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EACL,gCAAgC,EAChC,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,kDAAkD,CAAC;AAE1D,QAAQ,CAAC,kCAAkC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CAAC,qBAAqB,IAAI,OAAO,IAAI,CAAC,qBAAqB,KAAK,QAAQ,EAAE,CAAC;oBACnG,IAAI,CAAC,qBAAiD,CAAC,cAAc,GAAG,kBAAkB,CAAC;gBAC9F,CAAC;gBACD,QAAQ,CAAC,IAAI,CAAC;oBACZ,OAAO,EAAE,kBAAkB;oBAC3B,EAAE,EAAE,MAAM,CAAC,EAAE;oBACb,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,SAAS;oBACpC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC1E,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,CAAC,IAAI,CAAC,+CAA+C,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { RecordUpdatePlan } from '../../../shared/insurance/models.js';
3
+ import { RecordUpdateSkipResult } from '../../../shared/insurance/planned-change-mapper.js';
4
+ import { PlannedChange } from '../../../shared/insurance/planned-change.js';
5
+ export { RecordUpdateSkipResult };
6
+ export type RecordUpdateFailureResult = {
7
+ id: string;
8
+ errors: string[];
9
+ /** True when the request failed after it was sent, so the org may or may not hold the change. */
10
+ outcomeUnknown: boolean;
11
+ };
12
+ export type CmlImportRecordUpdatesResult = {
13
+ file: string;
14
+ kind: RecordUpdatePlan['kind'];
15
+ cmlApi: string;
16
+ dryRun: boolean;
17
+ /** Every field-level change the command resolved from a fresh org re-read, including skips. */
18
+ plannedChanges: PlannedChange[];
19
+ /**
20
+ * Pre-write counts over `plannedChanges` — exactly the numbers the operator was shown before
21
+ * confirming, in the same field-level unit. Populated on every run that gets as far as the
22
+ * preview, including `--dry-run`, so a `--json` consumer never has to re-derive them from
23
+ * `plannedChanges` or scrape the display text.
24
+ */
25
+ plannedCounts: {
26
+ updates: number;
27
+ alreadyCurrent: number;
28
+ };
29
+ /** Records written. */
30
+ applied: number;
31
+ skipped: RecordUpdateSkipResult[];
32
+ failed: RecordUpdateFailureResult[];
33
+ };
34
+ /**
35
+ * Applies a `<cmlApi>_{Surcharge,Underwriting}Update.json` plan to the org.
36
+ *
37
+ * One unified importer keyed off the file's `kind`, per the export/review/import design recorded on
38
+ * work item W-23654540 (§3): both files share an envelope, and the
39
+ * per-kind differences (allowed fields, the underwriting blob compare, the surcharge RuleKey
40
+ * verification) are data-driven rather than separate commands.
41
+ */
42
+ export default class CmlImportRecordUpdates extends SfCommand<CmlImportRecordUpdatesResult> {
43
+ static readonly summary: string;
44
+ static readonly description: string;
45
+ static readonly examples: string[];
46
+ static readonly flags: {
47
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
48
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
49
+ file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
50
+ 'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
51
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
52
+ };
53
+ run(): Promise<CmlImportRecordUpdatesResult>;
54
+ /**
55
+ * Renders the read-only preview the operator consents to, and returns the counts it displayed.
56
+ *
57
+ * `countPlannedChanges` is shared and buckets all five operations, but `toPlannedChange` emits
58
+ * only 'Update' and 'Skip (already current)'. Reporting the create/reuse buckets here would print
59
+ * two permanent zeros AND contradict the skip count: "0 already current (reused)" immediately
60
+ * followed by "N to skip" — where those N are skipped precisely because they ARE current. This is
61
+ * the last line the operator reads before authorizing writes, so it names only the two outcomes
62
+ * this command can actually produce.
63
+ */
64
+ private renderPreview;
65
+ private loadPlan;
66
+ }
@@ -0,0 +1,239 @@
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 * as fs from 'node:fs/promises';
17
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
+ import { Messages } from '@salesforce/core';
19
+ import { RecordUpdatePlanError, parseRecordUpdatePlan } from '../../../shared/insurance/record-update-plan.js';
20
+ import { toPlannedChange, toSkipResult, } from '../../../shared/insurance/planned-change-mapper.js';
21
+ import { applyRecordUpdates, planRecordUpdates, verifySurchargeUpdates, } from '../../../shared/insurance/record-update-apply.js';
22
+ import { countPlannedChanges, renderPlannedChanges, } from '../../../shared/insurance/planned-change.js';
23
+ import { confirmOrThrow } from '../../../shared/insurance/confirm-org-changes.js';
24
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
25
+ const messages = Messages.loadMessages('@salesforce/plugin-bre-to-cml', 'insurance.import.record-updates');
26
+ /**
27
+ * Applies a `<cmlApi>_{Surcharge,Underwriting}Update.json` plan to the org.
28
+ *
29
+ * One unified importer keyed off the file's `kind`, per the export/review/import design recorded on
30
+ * work item W-23654540 (§3): both files share an envelope, and the
31
+ * per-kind differences (allowed fields, the underwriting blob compare, the surcharge RuleKey
32
+ * verification) are data-driven rather than separate commands.
33
+ */
34
+ export default class CmlImportRecordUpdates extends SfCommand {
35
+ static summary = messages.getMessage('summary');
36
+ static description = messages.getMessage('description');
37
+ static examples = messages.getMessages('examples');
38
+ static flags = {
39
+ 'target-org': Flags.requiredOrg(),
40
+ 'api-version': Flags.orgApiVersion(),
41
+ file: Flags.file({
42
+ summary: messages.getMessage('flags.file.summary'),
43
+ char: 'f',
44
+ required: true,
45
+ exists: true,
46
+ }),
47
+ 'no-prompt': Flags.boolean({
48
+ summary: messages.getMessage('flags.no-prompt.summary'),
49
+ char: 'p',
50
+ default: false,
51
+ }),
52
+ 'dry-run': Flags.boolean({
53
+ summary: messages.getMessage('flags.dry-run.summary'),
54
+ default: false,
55
+ }),
56
+ };
57
+ async run() {
58
+ const { flags } = await this.parse(CmlImportRecordUpdates);
59
+ const file = flags.file;
60
+ const targetOrg = flags['target-org'];
61
+ const username = targetOrg.getUsername() ?? 'unknown';
62
+ const dryRun = flags['dry-run'];
63
+ const plan = await this.loadPlan(file);
64
+ this.log(`Target org: ${username}`);
65
+ this.log(`File: ${file}`);
66
+ this.log(`Kind: ${plan.kind}`);
67
+ this.log(`CML API: ${plan.cmlApi}`);
68
+ this.log(`Updates: ${plan.updates.length}`);
69
+ const result = {
70
+ file,
71
+ kind: plan.kind,
72
+ cmlApi: plan.cmlApi,
73
+ dryRun,
74
+ plannedChanges: [],
75
+ plannedCounts: { updates: 0, alreadyCurrent: 0 },
76
+ applied: 0,
77
+ skipped: [],
78
+ failed: [],
79
+ };
80
+ // An empty plan is a valid "nothing to do" — convert always emits the file, even with zero
81
+ // records — so it is a logged no-op, not a prompt and not an error.
82
+ if (plan.updates.length === 0) {
83
+ this.log(messages.getMessage('info.nothingToApply'));
84
+ return result;
85
+ }
86
+ const conn = targetOrg.getConnection(flags['api-version']);
87
+ // Read phase: everything below happens before a single write, so the operator sees the real
88
+ // current-vs-new values and identity problems are caught before they can corrupt a record.
89
+ const { changes, identityErrors, advisories } = await planRecordUpdates(conn, plan);
90
+ if (identityErrors.length > 0)
91
+ throw identityError(identityErrors);
92
+ result.plannedChanges = changes.map(toPlannedChange);
93
+ result.skipped = changes.filter((c) => c.alreadyCurrent).map(toSkipResult);
94
+ const counts = this.renderPreview(result.plannedChanges, username, dryRun);
95
+ result.plannedCounts = { updates: counts.updates, alreadyCurrent: counts.skips };
96
+ for (const advisory of advisories)
97
+ this.warn(advisory);
98
+ if (dryRun) {
99
+ this.log(messages.getMessage('info.dryRun'));
100
+ return result;
101
+ }
102
+ // Two independent reasons the prompt cannot run, kept apart so the error names the real one.
103
+ // Under --json the suppression is deliberate, not a property of the terminal: `confirm` against
104
+ // an unanswerable stdin writes prompt text to stdout and throws, which would corrupt the JSON
105
+ // stream. An operator sitting at a real terminal must not be told their terminal is the problem
106
+ // and sent to "run interactively", which they already are.
107
+ const jsonMode = this.jsonEnabled();
108
+ const ttyInteractive = Boolean(process.stdout.isTTY && process.stdin.isTTY);
109
+ await confirmOrThrow(this, {
110
+ noPrompt: flags['no-prompt'],
111
+ interactive: ttyInteractive && !jsonMode,
112
+ }, {
113
+ skippingPrompt: messages.getMessage('warn.skippingPrompt'),
114
+ confirmApply: messages.getMessage('confirm.apply'),
115
+ confirmationRequired: () => messages.createError(jsonMode ? 'error.confirmationRequiredJson' : 'error.confirmationRequired'),
116
+ aborted: () => messages.createError('error.aborted'),
117
+ });
118
+ const { applied, failures } = await applyRecordUpdates(conn, changes);
119
+ result.applied = applied;
120
+ result.failed = failures.map((f) => ({ id: f.id, errors: f.errors, outcomeUnknown: f.outcomeUnknown }));
121
+ for (const failure of failures) {
122
+ const detail = failure.errors.join('; ') || 'unknown error';
123
+ this.warn(failure.outcomeUnknown
124
+ ? messages.getMessage('warn.outcomeUnknown', [failure.name, failure.id, detail])
125
+ : `FAILED ${failure.name} (${failure.id}): ${detail}`);
126
+ }
127
+ // The flip regenerates ProductSurcharge.RuleKey server-side; read it back so the operator can
128
+ // see whether the surcharge will actually fire. Advisory only — the writes already succeeded.
129
+ if (plan.kind === 'surcharge-update') {
130
+ const verification = await verifySurchargeUpdates(conn, plan.updates);
131
+ for (const record of verification.records) {
132
+ this.log(` ${record.Id} ${record.Name}: RuleEngineType=${record.RuleEngineType ?? '<none>'} RuleKey=${record.RuleKey ?? '<none>'} RuleApiName=${record.RuleApiName ?? '<none>'}`);
133
+ }
134
+ for (const warning of verification.warnings)
135
+ this.warn(warning);
136
+ }
137
+ // All three counts are records. `result.skipped` is deliberately field-level for the JSON
138
+ // result, so it cannot be presented as a peer of `applied` and `failures.length`, which are not.
139
+ const skippedRecords = new Set(changes.filter((c) => c.alreadyCurrent).map((c) => c.update.id));
140
+ for (const change of changes)
141
+ if (!change.alreadyCurrent)
142
+ skippedRecords.delete(change.update.id);
143
+ this.log(messages.getMessage('info.applySummary', [applied, skippedRecords.size, failures.length]));
144
+ if (failures.length > 0) {
145
+ const error = applyFailuresError(failures, applied, `sf insurance import record-updates --file ${file} --target-org ${username}`);
146
+ // The apply is not transactional, so a throw discards a result that describes a real,
147
+ // partially-migrated org. Under --json the count alone leaves automation nothing to act on.
148
+ error.data = result;
149
+ throw error;
150
+ }
151
+ return result;
152
+ }
153
+ /**
154
+ * Renders the read-only preview the operator consents to, and returns the counts it displayed.
155
+ *
156
+ * `countPlannedChanges` is shared and buckets all five operations, but `toPlannedChange` emits
157
+ * only 'Update' and 'Skip (already current)'. Reporting the create/reuse buckets here would print
158
+ * two permanent zeros AND contradict the skip count: "0 already current (reused)" immediately
159
+ * followed by "N to skip" — where those N are skipped precisely because they ARE current. This is
160
+ * the last line the operator reads before authorizing writes, so it names only the two outcomes
161
+ * this command can actually produce.
162
+ */
163
+ renderPreview(changes, username, dryRun) {
164
+ const counts = countPlannedChanges(changes);
165
+ renderPlannedChanges(this, changes, {
166
+ header: messages.getMessage('warn.header', [username]),
167
+ summary: messages.getMessage('warn.summary', [counts.updates, counts.skips, username]),
168
+ // A dry run writes nothing, so there is no partial-migration hazard to caution about. Warning
169
+ // anyway would put boilerplate in every --json run's `warnings` array, where the ProductCode
170
+ // drift advisory and the per-record save failures need to stand out.
171
+ notTransactional: dryRun ? undefined : messages.getMessage('warn.notTransactional'),
172
+ });
173
+ return counts;
174
+ }
175
+ async loadPlan(file) {
176
+ let raw;
177
+ try {
178
+ // --file rejects a directory itself, but it does not check readability: a file the user
179
+ // cannot read reaches here and must surface as an SfError with actions, not a raw Node error.
180
+ raw = await fs.readFile(file, 'utf8');
181
+ }
182
+ catch (e) {
183
+ throw messages.createError('error.unreadableFile', [file, e.message]);
184
+ }
185
+ try {
186
+ return parseRecordUpdatePlan(raw, file, { onWarn: (message) => this.warn(message) });
187
+ }
188
+ catch (e) {
189
+ // A repeated record id gets its own key: "correct the reported problem by hand" does not say
190
+ // which of the two entries to keep, and that choice is the whole remediation.
191
+ if (e instanceof RecordUpdatePlanError && e.code === 'duplicateRecordId') {
192
+ throw messages.createError('error.duplicateRecordId', [e.message]);
193
+ }
194
+ throw messages.createError('error.invalidFile', [e.message]);
195
+ }
196
+ }
197
+ }
198
+ /**
199
+ * Which kind titles the error when a run finds several. Ordered least-actionable first: a plugin
200
+ * defect needs reporting and an unreadable org value needs repairing in the org, and neither is
201
+ * discoverable from a title that talks about correcting the file.
202
+ */
203
+ const IDENTITY_PROBLEM_PRECEDENCE = [
204
+ 'identityCheckUnavailable',
205
+ 'unreadableOrgBlob',
206
+ 'recordIdentityMismatch',
207
+ ];
208
+ /**
209
+ * Builds the pre-write refusal. The three kinds need different things from the operator, so each has
210
+ * its own message key, and the actions are the union of every kind the run actually found — the body
211
+ * lists all of the problems, so remediation for only the titling kind would leave the rest with
212
+ * none.
213
+ */
214
+ function identityError(problems) {
215
+ const kinds = IDENTITY_PROBLEM_PRECEDENCE.filter((kind) => problems.some((p) => p.kind === kind));
216
+ const detail = problems.map((p) => ` ${p.message}`).join('\n');
217
+ const error = messages.createError(`error.${kinds[0]}`, [detail]);
218
+ error.actions = kinds.flatMap((kind) => messages.getMessages(`error.${kind}.actions`));
219
+ return error;
220
+ }
221
+ /**
222
+ * The end-of-run failure, in the only three states this command can be in.
223
+ *
224
+ * "Earlier updates were applied and are not rolled back" is false on a run where nothing landed —
225
+ * which is not hypothetical: a plan whose surcharges all have a null parent `Surcharge.Code` has
226
+ * every flip rejected by the org's save hook. And "nothing was applied" would be false-confident
227
+ * whenever a request failed *after* being sent, which is exactly what `outcomeUnknown` records: a
228
+ * timeout or a 500 can arrive after the server committed, so neither claim can be made.
229
+ */
230
+ function applyFailuresError(failures, applied, rerun) {
231
+ const unknown = failures.filter((f) => f.outcomeUnknown).length;
232
+ if (unknown > 0) {
233
+ return messages.createError('error.applyFailuresOutcomeUnknown', [failures.length, applied, unknown], [rerun]);
234
+ }
235
+ if (applied === 0)
236
+ return messages.createError('error.applyFailuresNoneApplied', [failures.length], [rerun]);
237
+ return messages.createError('error.applyFailures', [failures.length, applied], [rerun]);
238
+ }
239
+ //# sourceMappingURL=record-updates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-updates.js","sourceRoot":"","sources":["../../../../src/commands/insurance/import/record-updates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAW,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAC/G,OAAO,EAEL,eAAe,EACf,YAAY,GACb,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAIL,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAGL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAElF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,+BAA+B,EAAE,iCAAiC,CAAC,CAAC;AAkC3G;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB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,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACjH,CAAC;IACD,IAAI,OAAO,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC,WAAW,CAAC,gCAAgC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7G,OAAO,QAAQ,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1F,CAAC"}
@@ -2,7 +2,15 @@ import { RuleConditionOperator } from './models.js';
2
2
  export declare function escapeQuotes(str: string): string;
3
3
  export declare function doubleQuoted(str: string | undefined): string;
4
4
  export declare function doubleQuotedIfNeeded(value: string | string[] | undefined, dataType: string | undefined): string;
5
- export declare function generateInCmlExpression(left: string, right: string | string[]): string;
5
+ /**
6
+ * Expands an In list into a chain of `==` comparisons. Because those are equality comparisons, the
7
+ * values follow the same quoting rule Equals follows: quoted only for `string`. Quoting a value
8
+ * against an attribute the model declares `decimal` compares a number with a string literal, and
9
+ * the comparison never fires.
10
+ *
11
+ * `dataType` is optional and last so existing callers that pass none keep emitting quoted values.
12
+ */
13
+ export declare function generateInCmlExpression(left: string, right: string | string[], dataType?: string): string;
6
14
  export declare function convertToCmlExpression(left: string, ruleExprOperator: RuleConditionOperator, right?: string | string[], dataType?: string): string;
7
15
  export declare function isKnownOperator(op: string): op is RuleConditionOperator;
8
16
  export declare function operatorRequiresValues(op: RuleConditionOperator): boolean;