sf-plugin-data 0.5.1 → 0.5.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.
|
@@ -1480,6 +1480,8 @@ export default class Deploy extends SfCommand {
|
|
|
1480
1480
|
};
|
|
1481
1481
|
let failed = false;
|
|
1482
1482
|
let blocked = false;
|
|
1483
|
+
// Items whose own preflight stopped the run: their reason is also the execute item's.
|
|
1484
|
+
const stoppers = new Set();
|
|
1483
1485
|
for (const input of inputs) {
|
|
1484
1486
|
// A parent created by an earlier stage of this preview does not exist yet: report the
|
|
1485
1487
|
// item as planned instead of comparing it against a target that cannot hold it.
|
|
@@ -1531,6 +1533,7 @@ export default class Deploy extends SfCommand {
|
|
|
1531
1533
|
(preview.outcome === 'create' &&
|
|
1532
1534
|
!effects.includes('generated-output-provisioning')))) {
|
|
1533
1535
|
blocked = true;
|
|
1536
|
+
stoppers.add(input.path);
|
|
1534
1537
|
preview.diagnostics.push({
|
|
1535
1538
|
code: 'PROCESSING_ACKNOWLEDGEMENT_REQUIRED',
|
|
1536
1539
|
message: 'IR processing and CREATE generated-output provisioning require explicit --allow-processing. No batch writes were attempted.',
|
|
@@ -1546,6 +1549,7 @@ export default class Deploy extends SfCommand {
|
|
|
1546
1549
|
['create', 'update'].includes(preview.outcome) &&
|
|
1547
1550
|
(flags['allow-processing'] !== true || !effects?.includes('processing'))) {
|
|
1548
1551
|
blocked = true;
|
|
1552
|
+
stoppers.add(input.path);
|
|
1549
1553
|
preview.diagnostics.push({
|
|
1550
1554
|
code: 'PROCESSING_ACKNOWLEDGEMENT_REQUIRED',
|
|
1551
1555
|
message: 'Segment create and update start processing in Data Cloud and need --allow-processing. Nothing was written.',
|
|
@@ -1559,11 +1563,14 @@ export default class Deploy extends SfCommand {
|
|
|
1559
1563
|
operation: 'preview',
|
|
1560
1564
|
path: input.path,
|
|
1561
1565
|
});
|
|
1562
|
-
if (preview.outcome === 'blocked' || preview.outcome === 'blocked-changes')
|
|
1566
|
+
if (preview.outcome === 'blocked' || preview.outcome === 'blocked-changes') {
|
|
1563
1567
|
blocked = true;
|
|
1568
|
+
stoppers.add(input.path);
|
|
1569
|
+
}
|
|
1564
1570
|
}
|
|
1565
1571
|
catch (error) {
|
|
1566
1572
|
failed = true;
|
|
1573
|
+
stoppers.add(input.path);
|
|
1567
1574
|
envelope.result.items.push({
|
|
1568
1575
|
identity: reportedIdentity(input.document, effectiveScope),
|
|
1569
1576
|
operation: 'preview',
|
|
@@ -1631,7 +1638,7 @@ export default class Deploy extends SfCommand {
|
|
|
1631
1638
|
.requiredEffects,
|
|
1632
1639
|
}
|
|
1633
1640
|
: {}),
|
|
1634
|
-
diagnostics: [],
|
|
1641
|
+
diagnostics: stoppers.has(input.path) ? [...diagnostics] : [],
|
|
1635
1642
|
};
|
|
1636
1643
|
});
|
|
1637
1644
|
// Keep whole-selection evidence, but never mistake admission for attempted execution.
|
|
@@ -48,6 +48,40 @@ function safeMessage(value) {
|
|
|
48
48
|
return;
|
|
49
49
|
return message;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Salesforce's segment criteria validator answers with a serialized list of error blocks
|
|
53
|
+
* (`... Errors: [class DbtSqlValidationErrorBlock {\n errorCode: X\n arguments: [text]\n}]`),
|
|
54
|
+
* which safeMessage refuses for its brackets and line breaks. Keep the lead sentence and the code
|
|
55
|
+
* and text of each block (at most three); every text part passes safeMessage on its own, and a
|
|
56
|
+
* block whose text does not keeps its code alone. The joined message must pass safeMessage too.
|
|
57
|
+
* @param {unknown} value Structured API message leaf.
|
|
58
|
+
* @returns {string | undefined} The rewritten message, or undefined for any other shape.
|
|
59
|
+
*/
|
|
60
|
+
function validationBlocks(value) {
|
|
61
|
+
if (typeof value !== 'string' || value.length > 4000)
|
|
62
|
+
return;
|
|
63
|
+
const start = value.indexOf(' Errors: [class ');
|
|
64
|
+
if (start === -1)
|
|
65
|
+
return;
|
|
66
|
+
const lead = safeMessage(value.slice(0, start))?.replace(/\.$/u, '');
|
|
67
|
+
const blocks = [
|
|
68
|
+
...value
|
|
69
|
+
.slice(start)
|
|
70
|
+
.matchAll(/\{\s*errorCode: ([A-Z][A-Z0-9_]{0,79})\s+arguments: \[([^\n]*)\]\s*\}/gu),
|
|
71
|
+
]
|
|
72
|
+
.slice(0, 3)
|
|
73
|
+
.map(([, code, text]) => {
|
|
74
|
+
const safe = safeMessage(text);
|
|
75
|
+
return safe ? `${code}: ${safe}` : code;
|
|
76
|
+
});
|
|
77
|
+
while (blocks.length > 0 && `${lead}: ${blocks.join('; ')}`.length > 400)
|
|
78
|
+
blocks.pop();
|
|
79
|
+
if (!lead || blocks.length === 0)
|
|
80
|
+
return;
|
|
81
|
+
// Parts that pass one by one can still form a refused pattern together (select … from).
|
|
82
|
+
const message = `${lead}: ${blocks.join('; ')}`;
|
|
83
|
+
return safeMessage(message) === undefined ? undefined : message;
|
|
84
|
+
}
|
|
51
85
|
/**
|
|
52
86
|
* Normalize only REST error records/arrays and their known data/errors containers.
|
|
53
87
|
* No arbitrary keys, native Error.message, causes or raw objects are retained.
|
|
@@ -95,7 +129,7 @@ function apiErrors(candidate) {
|
|
|
95
129
|
if (budget < 0)
|
|
96
130
|
return;
|
|
97
131
|
const code = typeof rawCode === 'string' && /^[A-Z][A-Z0-9_]{0,79}$/u.test(rawCode) ? rawCode : undefined;
|
|
98
|
-
const message = safeMessage(rawMessage);
|
|
132
|
+
const message = safeMessage(rawMessage) ?? validationBlocks(rawMessage);
|
|
99
133
|
const size = result.reduce((total, entry) => total + (entry.code?.length ?? 0) + (entry.message?.length ?? 0) + 4, 0);
|
|
100
134
|
if ((code || message) && size + (code?.length ?? 0) + (message?.length ?? 0) + 4 <= 1300)
|
|
101
135
|
result.push(Object.freeze({ ...(code ? { code } : {}), ...(message ? { message } : {}) }));
|