@salesforce/packaging 4.17.0 → 4.17.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.
package/lib/package/package.js
CHANGED
|
@@ -247,6 +247,12 @@ class Package {
|
|
|
247
247
|
if (opts.RecommendedVersionId !== undefined && this.options.connection.getApiVersion() < '66.0') {
|
|
248
248
|
throw messages.createError('recommendedVersionIdApiPriorTo66Error');
|
|
249
249
|
}
|
|
250
|
+
if (opts.RecommendedVersionId !== undefined) {
|
|
251
|
+
const trimmedId = opts.RecommendedVersionId.trim();
|
|
252
|
+
if (trimmedId === '' || !trimmedId.startsWith('04t') || (trimmedId.length !== 15 && trimmedId.length !== 18)) {
|
|
253
|
+
throw messages.createError('invalidRecommendedVersionError');
|
|
254
|
+
}
|
|
255
|
+
}
|
|
250
256
|
if (skipAncestorCheck === true && opts.RecommendedVersionId === undefined) {
|
|
251
257
|
throw messages.createError('skipAncestorCheckRequiresRecommendedVersionIdError');
|
|
252
258
|
}
|
|
@@ -305,23 +311,30 @@ class Package {
|
|
|
305
311
|
return;
|
|
306
312
|
}
|
|
307
313
|
const graph = new graphology_1.DirectedGraph();
|
|
308
|
-
const
|
|
309
|
-
const
|
|
314
|
+
const truncatedRecommendedVersionId = opts.RecommendedVersionId.substring(0, 15);
|
|
315
|
+
const stack = [truncatedRecommendedVersionId];
|
|
316
|
+
const visited = new Set([truncatedRecommendedVersionId]);
|
|
310
317
|
result.records.forEach((record) => {
|
|
311
|
-
|
|
318
|
+
const truncatedSubscriberId = record.SubscriberPackageVersionId.substring(0, 15);
|
|
319
|
+
graph.addNode(truncatedSubscriberId);
|
|
312
320
|
if (record.AncestorId) {
|
|
313
|
-
|
|
314
|
-
|
|
321
|
+
const truncatedAncestorId = record.AncestorId.substring(0, 15);
|
|
322
|
+
if (!graph.hasNode(truncatedAncestorId)) {
|
|
323
|
+
graph.addNode(truncatedAncestorId);
|
|
315
324
|
}
|
|
316
|
-
graph.addEdge(
|
|
325
|
+
graph.addEdge(truncatedSubscriberId, truncatedAncestorId);
|
|
317
326
|
}
|
|
318
327
|
});
|
|
319
|
-
if (graph.
|
|
320
|
-
|
|
328
|
+
if (!graph.hasNode(truncatedRecommendedVersionId)) {
|
|
329
|
+
throw messages.createError('unassociatedRecommendedVersionError');
|
|
330
|
+
}
|
|
331
|
+
const truncatedPriorRecommendedVersionId = priorRecommendedVersionId?.substring(0, 15);
|
|
332
|
+
if (graph.outDegree(truncatedRecommendedVersionId) > 0 &&
|
|
333
|
+
result.records.some((record) => record.SubscriberPackageVersionId.substring(0, 15) === truncatedPriorRecommendedVersionId)) {
|
|
321
334
|
while (stack.length > 0) {
|
|
322
335
|
const node = stack.pop();
|
|
323
336
|
for (const neighbor of graph.neighbors(node)) {
|
|
324
|
-
if (neighbor ===
|
|
337
|
+
if (neighbor === truncatedPriorRecommendedVersionId) {
|
|
325
338
|
return;
|
|
326
339
|
}
|
|
327
340
|
if (!visited.has(neighbor)) {
|
|
@@ -331,7 +344,7 @@ class Package {
|
|
|
331
344
|
}
|
|
332
345
|
}
|
|
333
346
|
}
|
|
334
|
-
else if (graph.outDegree(
|
|
347
|
+
else if (graph.outDegree(truncatedRecommendedVersionId) === 0 && result.records.length === 1) {
|
|
335
348
|
return;
|
|
336
349
|
}
|
|
337
350
|
throw messages.createError('recommendedVersionNotAncestorOfPriorVersionError');
|
package/messages/package.md
CHANGED
|
@@ -61,3 +61,11 @@ No package versions were found for the given Package 2 ID (0Ho). At least one re
|
|
|
61
61
|
# recommendedVersionNotAncestorOfPriorVersionError
|
|
62
62
|
|
|
63
63
|
The new recommended version is not a descendant of the previous recommended version. To bypass this check, use the --skip-ancestor-check CLI flag.
|
|
64
|
+
|
|
65
|
+
# invalidRecommendedVersionError
|
|
66
|
+
|
|
67
|
+
Provide a valid subscriber package version (04t) for the recommended version.
|
|
68
|
+
|
|
69
|
+
# unassociatedRecommendedVersionError
|
|
70
|
+
|
|
71
|
+
The provided recommended version isn't associated with this package.
|
|
@@ -92,11 +92,11 @@ Provide a valid positive number for %s. %d
|
|
|
92
92
|
|
|
93
93
|
# errorAncestorNoneNotAllowed
|
|
94
94
|
|
|
95
|
-
Can’t create package version because you didn’t specify a package ancestor. Set the ancestor version to %s
|
|
95
|
+
Can’t create package version because you didn’t specify a package ancestor. Set the ancestor version to %s and try creating the package version again. You can also specify --skip-ancestor-check to override the ancestry requirement.
|
|
96
96
|
|
|
97
97
|
# errorAncestorNotHighest
|
|
98
98
|
|
|
99
|
-
Can’t create package version. The ancestor version [%s] you specified isn’t the highest released package version. Set the ancestor version to %s
|
|
99
|
+
Can’t create package version. The ancestor version [%s] you specified isn’t the highest released package version. Set the ancestor version to %s and try creating the package version again. You can also specify --skip-ancestor-check to override the ancestry requirement.
|
|
100
100
|
|
|
101
101
|
# errorInvalidBuildNumberForKeywords
|
|
102
102
|
|