@salesforce/packaging 0.0.18 → 0.0.21

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.
@@ -1,4 +1,4 @@
1
1
  import { Connection } from '@salesforce/core';
2
2
  import { PackageVersionCreateRequestResult, PackageVersionCreateRequestQueryOptions } from '../interfaces';
3
3
  export declare function list(options?: PackageVersionCreateRequestQueryOptions): Promise<PackageVersionCreateRequestResult[]>;
4
- export declare function byId(packageVersionCreateRequestId: any, connection: Connection): Promise<PackageVersionCreateRequestResult[]>;
4
+ export declare function byId(packageVersionCreateRequestId: string, connection: Connection): Promise<PackageVersionCreateRequestResult[]>;
@@ -40,17 +40,16 @@ async function getPackageVersionReport(options) {
40
40
  const record = records[0];
41
41
  record.Version = [record.MajorVersion, record.MinorVersion, record.PatchVersion, record.BuildNumber].join('.');
42
42
  const containerOptions = await pkgUtils.getContainerOptions([record.Package2Id], options.connection);
43
- const packageType = containerOptions.get(record.Package2Id);
44
- let ancestorVersion = null;
43
+ record.PackageType = containerOptions.get(record.Package2Id);
44
+ record.AncestorVersion = null;
45
45
  if (record.AncestorId) {
46
46
  // lookup AncestorVersion value
47
47
  const ancestorVersionMap = await pkgUtils.getPackageVersionStrings([record.AncestorId], options.connection);
48
- ancestorVersion = ancestorVersionMap.get(record.AncestorId);
48
+ record.AncestorVersion = ancestorVersionMap.get(record.AncestorId);
49
49
  }
50
50
  else {
51
- // otherwise display 'N/A' if package is Unlocked Packages
52
- if (packageType !== 'Managed') {
53
- ancestorVersion = null;
51
+ if (record.PackageType !== 'Managed') {
52
+ record.AncestorVersion = null;
54
53
  record.AncestorId = null;
55
54
  }
56
55
  }
@@ -58,10 +57,9 @@ async function getPackageVersionReport(options) {
58
57
  record.Package2.IsOrgDependent === true || record.ValidationSkipped === true
59
58
  ? null
60
59
  : record.HasPassedCodeCoverageCheck;
61
- record.Package2.IsOrgDependent = packageType === 'Managed' ? null : !!record.Package2.IsOrgDependent;
60
+ record.Package2.IsOrgDependent = record.PackageType === 'Managed' ? null : !!record.Package2.IsOrgDependent;
62
61
  // set HasMetadataRemoved to null Unlocked, otherwise use existing value
63
- record.HasMetadataRemoved = packageType !== 'Managed' ? null : !!record.HasMetadataRemoved;
64
- record.AncestorVersion = ancestorVersion;
62
+ record.HasMetadataRemoved = record.PackageType !== 'Managed' ? null : !!record.HasMetadataRemoved;
65
63
  return records;
66
64
  }
67
65
  return [];
@@ -2,7 +2,7 @@ import { Connection } from '@salesforce/core';
2
2
  import { Package1Display } from '../interfaces';
3
3
  /**
4
4
  * Lists package versions available in dev org. If package ID is supplied, only list versions of that package,
5
- * otherwise, list all package versions
5
+ * otherwise, list all package versions
6
6
  *
7
7
  * @param connection: sfdx-core Connection to the org
8
8
  * @param metadataPackageId: optional, if present ID of package to list versions for (starts with 033)
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.package1VersionList = void 0;
10
10
  /**
11
11
  * Lists package versions available in dev org. If package ID is supplied, only list versions of that package,
12
- * otherwise, list all package versions
12
+ * otherwise, list all package versions
13
13
  *
14
14
  * @param connection: sfdx-core Connection to the org
15
15
  * @param metadataPackageId: optional, if present ID of package to list versions for (starts with 033)
@@ -2,7 +2,7 @@ import { Connection, NamedPackageDir, PackageDir, SfdcUrl, SfError, SfProject }
2
2
  import { Duration } from '@salesforce/kit';
3
3
  import { Many, Nullable } from '@salesforce/ts-types';
4
4
  import { SaveError } from 'jsforce';
5
- import { PackagingSObjects, PackageVersionCreateRequestResult, PackageVersionCreateOptions } from '../interfaces';
5
+ import { PackageType, PackageVersionCreateRequestResult, PackagingSObjects } from '../interfaces';
6
6
  export declare const VERSION_NUMBER_SEP = ".";
7
7
  export declare type IdRegistryValue = {
8
8
  prefix: string;
@@ -24,10 +24,9 @@ export declare const DEFAULT_PACKAGE_DIR: {
24
24
  export declare const BY_PREFIX: IdRegistry;
25
25
  export declare const BY_LABEL: IdRegistry;
26
26
  export declare function validateId(idObj: Many<IdRegistryValue>, value: string): void;
27
- export declare function validateIdNoThrow(idObj: Many<IdRegistryValue>, value: any): any;
28
- export declare function validateVersionNumber(versionNumberString: string, supportedBuildNumberToken: string, supportedBuildNumberToken2: string): string;
27
+ export declare function validateIdNoThrow(idObj: Many<IdRegistryValue>, value: any): IdRegistryValue | false;
28
+ export declare function validateVersionNumber(versionNumberString: string, supportedBuildNumberToken: string, supportedBuildNumberToken2?: string): string;
29
29
  export declare function validatePatchVersion(connection: Connection, versionNumberString: string, packageId: string): Promise<void>;
30
- export declare function validUrl(url: string): boolean;
31
30
  export declare function isErrorFromSPVQueryRestriction(err: Error): boolean;
32
31
  export declare function isErrorPackageNotAvailable(err: Error): boolean;
33
32
  export declare function massageErrorMessage(err: Error): Error;
@@ -47,7 +46,7 @@ export declare function escapeInstallationKey(key?: string): Nullable<string>;
47
46
  * @param connection For tooling query
48
47
  * @throws Error with message when package2 cannot be found
49
48
  */
50
- export declare function getPackageType(packageId: string, connection: Connection): Promise<string>;
49
+ export declare function getPackageType(packageId: string, connection: Connection): Promise<PackageType>;
51
50
  /**
52
51
  * Given 04t the package type type (Managed, Unlocked, Locked(deprecated?))
53
52
  *
@@ -71,7 +70,7 @@ export declare function getSubscriberPackageVersionId(versionId: string, connect
71
70
  * @param packageIds The list of package IDs
72
71
  * @param connection For tooling query
73
72
  */
74
- export declare function getContainerOptions(packageIds: string[], connection: Connection): Promise<Map<string, string>>;
73
+ export declare function getContainerOptions(packageIds: string[], connection: Connection): Promise<Map<string, PackageType>>;
75
74
  /**
76
75
  * Return the Package2Version.HasMetadataRemoved field value for the given Id (05i)
77
76
  *
@@ -99,20 +98,9 @@ export declare function getPackageVersionStrings(subscriberPackageVersionIds: st
99
98
  */
100
99
  export declare function queryWithInConditionChunking<T = Record<string, unknown>>(query: string, items: string[], replaceToken: string, connection: Connection): Promise<T[]>;
101
100
  /**
102
- * Returns the number of items that can be included in a quoted comma-separated string (e.g., "'item1','item2'") not exceeding maxLength
101
+ * Returns the number of items that can be included in a quoted comma-separated string (e.g., "'item1','item2'") not exceeding maxLength
103
102
  */
104
103
  export declare function getInClauseItemsCount(items: string[], startIndex: number, maxLength: number): number;
105
- /**
106
- * Given a package descriptor, return the ancestor ID. This code was duplicated to scratchOrgInfoGenerator.getAncestorIds,
107
- * changes here may need to be duplicated there until that code, and/or this code is moved to a separate plugin.
108
- *
109
- * @param packageDescriptorJson JSON for packageDirectories element in sfdx-project.json
110
- * @param connection For tooling query
111
- * @param project The project to use for looking up the ancestor ID
112
- * @param versionNumberString The version number string to use for looking up the ancestor ID
113
- * @param skipAncestorCheck If true, skip the check for the ancestor ID
114
- */
115
- export declare function getAncestorId(packageDescriptorJson: PackageDir, connection: Connection, project: SfProject, versionNumberString: string, skipAncestorCheck: boolean): Promise<string>;
116
104
  export declare function validateAncestorId(ancestorId: string, highestReleasedVersion: PackagingSObjects.Package2Version, explicitUseNoAncestor: boolean, isPatch: boolean, skipAncestorCheck: boolean, origSpecifiedAncestor: string): string;
117
105
  export declare function getAncestorIdHighestRelease(connection: Connection, packageId: string, versionNumberString: string, explicitUseHighestRelease: boolean, skipAncestorCheck: boolean): Promise<{
118
106
  finalAncestorId: string;
@@ -148,7 +136,21 @@ export declare function convertCamelCaseStringToSentence(stringIn: string): stri
148
136
  export declare function getPackageAliasesFromId(packageId: string, project: SfProject): string[];
149
137
  export declare function findOrCreatePackage(seedPackage: string, connection: Connection): Promise<string>;
150
138
  export declare function pollForStatusWithInterval(id: string, retries: number, packageId: string, branch: string, withProject: SfProject, connection: Connection, interval: Duration): Promise<PackageVersionCreateRequestResult>;
151
- export declare function getSoqlWhereClauseMaxLength(): number;
139
+ /**
140
+ * Generate package alias json entry for this package version that can be written to sfdx-project.json
141
+ *
142
+ * @param connection
143
+ * @param project SfProject instance for the project
144
+ * @param packageVersionId 04t id of the package to create the alias entry for
145
+ * @param packageVersionNumber that will be appended to the package name to form the alias
146
+ * @param branch
147
+ * @param packageId the 0Ho id
148
+ * @private
149
+ */
150
+ export declare function generatePackageAliasEntry(connection: Connection, project: SfProject, packageVersionId: string, packageVersionNumber: string, branch: string, packageId: string): Promise<{
151
+ packageAliases: {
152
+ [p: string]: string;
153
+ };
154
+ }>;
152
155
  export declare function formatDate(date: Date): string;
153
156
  export declare function combineSaveErrors(sObject: string, crudOperation: string, errors: SaveError[]): SfError;
154
- export declare function resolveCanonicalPackageProperty(options: PackageVersionCreateOptions): "id" | "package";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveCanonicalPackageProperty = exports.combineSaveErrors = exports.formatDate = exports.getSoqlWhereClauseMaxLength = exports.pollForStatusWithInterval = exports.findOrCreatePackage = exports.getPackageAliasesFromId = exports.convertCamelCaseStringToSentence = exports.getPackageIdFromAlias = exports.getConfigPackageDirectory = exports.getConfigPackageDirectories = exports.getPackageVersionNumber = exports.concatVersion = exports.getAncestorIdHighestRelease = exports.validateAncestorId = exports.getAncestorId = exports.getInClauseItemsCount = exports.queryWithInConditionChunking = exports.getPackageVersionStrings = exports.getHasMetadataRemoved = exports.getContainerOptions = exports.getSubscriberPackageVersionId = exports.getPackageTypeBy04t = exports.getPackageType = exports.escapeInstallationKey = exports.getPackageVersionId = exports.applyErrorAction = exports.massageErrorMessage = exports.isErrorPackageNotAvailable = exports.isErrorFromSPVQueryRestriction = exports.validUrl = exports.validatePatchVersion = exports.validateVersionNumber = exports.validateIdNoThrow = exports.validateId = exports.BY_LABEL = exports.BY_PREFIX = exports.DEFAULT_PACKAGE_DIR = exports.POLL_INTERVAL_SECONDS = exports.SOQL_WHERE_CLAUSE_MAX_LENGTH = exports.INSTALL_URL_BASE = exports.VERSION_NUMBER_SEP = void 0;
3
+ exports.combineSaveErrors = exports.formatDate = exports.generatePackageAliasEntry = exports.pollForStatusWithInterval = exports.findOrCreatePackage = exports.getPackageAliasesFromId = exports.convertCamelCaseStringToSentence = exports.getPackageIdFromAlias = exports.getConfigPackageDirectory = exports.getConfigPackageDirectories = exports.getPackageVersionNumber = exports.concatVersion = exports.getAncestorIdHighestRelease = exports.validateAncestorId = exports.getInClauseItemsCount = exports.queryWithInConditionChunking = exports.getPackageVersionStrings = exports.getHasMetadataRemoved = exports.getContainerOptions = exports.getSubscriberPackageVersionId = exports.getPackageTypeBy04t = exports.getPackageType = exports.escapeInstallationKey = exports.getPackageVersionId = exports.applyErrorAction = exports.massageErrorMessage = exports.isErrorPackageNotAvailable = exports.isErrorFromSPVQueryRestriction = exports.validatePatchVersion = exports.validateVersionNumber = exports.validateIdNoThrow = exports.validateId = exports.BY_LABEL = exports.BY_PREFIX = exports.DEFAULT_PACKAGE_DIR = exports.POLL_INTERVAL_SECONDS = exports.SOQL_WHERE_CLAUSE_MAX_LENGTH = exports.INSTALL_URL_BASE = exports.VERSION_NUMBER_SEP = void 0;
4
4
  /*
5
5
  * Copyright (c) 2022, salesforce.com, inc.
6
6
  * All rights reserved.
@@ -107,11 +107,6 @@ async function validatePatchVersion(connection, versionNumberString, packageId)
107
107
  }
108
108
  exports.validatePatchVersion = validatePatchVersion;
109
109
  // TODO: let's get rid of this in favor of SfdcUrl.isValidUrl()
110
- // check that the provided url has a valid format
111
- function validUrl(url) {
112
- return core_1.SfdcUrl.isValidUrl(url);
113
- }
114
- exports.validUrl = validUrl;
115
110
  // determines if error is from malformed SubscriberPackageVersion query
116
111
  // this is in place to allow cli to run against app version 214, where SPV queries
117
112
  // do not require installation key
@@ -225,7 +220,7 @@ exports.escapeInstallationKey = escapeInstallationKey;
225
220
  async function getPackageType(packageId, connection) {
226
221
  const query = `SELECT ContainerOptions FROM Package2 WHERE id ='${packageId}'`;
227
222
  const queryResult = await connection.tooling.query(query);
228
- if (!queryResult || queryResult.records === null || queryResult.records.length === 0) {
223
+ if (queryResult.records.length === 0) {
229
224
  throw messages.createError('errorInvalidPackageId', [packageId]);
230
225
  }
231
226
  return queryResult.records[0].ContainerOptions;
@@ -380,7 +375,7 @@ async function queryWithInConditionChunking(query, items, replaceToken, connecti
380
375
  }
381
376
  exports.queryWithInConditionChunking = queryWithInConditionChunking;
382
377
  /**
383
- * Returns the number of items that can be included in a quoted comma-separated string (e.g., "'item1','item2'") not exceeding maxLength
378
+ * Returns the number of items that can be included in a quoted comma-separated string (e.g., "'item1','item2'") not exceeding maxLength
384
379
  */
385
380
  // TODO: this function cannot handle a single item that is longer than maxLength - what to do, since this could be the root cause of an infinite loop?
386
381
  function getInClauseItemsCount(items, startIndex, maxLength) {
@@ -401,106 +396,6 @@ function getInClauseItemsCount(items, startIndex, maxLength) {
401
396
  return includedCount;
402
397
  }
403
398
  exports.getInClauseItemsCount = getInClauseItemsCount;
404
- /**
405
- * Given a package descriptor, return the ancestor ID. This code was duplicated to scratchOrgInfoGenerator.getAncestorIds,
406
- * changes here may need to be duplicated there until that code, and/or this code is moved to a separate plugin.
407
- *
408
- * @param packageDescriptorJson JSON for packageDirectories element in sfdx-project.json
409
- * @param connection For tooling query
410
- * @param project The project to use for looking up the ancestor ID
411
- * @param versionNumberString The version number string to use for looking up the ancestor ID
412
- * @param skipAncestorCheck If true, skip the check for the ancestor ID
413
- */
414
- async function getAncestorId(packageDescriptorJson, connection, project, versionNumberString, skipAncestorCheck) {
415
- // eslint-disable-next-line complexity
416
- return Promise.resolve().then(async () => {
417
- // If an id property is present, use it. Otherwise, look up the package id from the package property.
418
- const packageId = packageDescriptorJson['id'] ?? getPackageIdFromAlias(packageDescriptorJson.package, project);
419
- // No need to proceed if Unlocked
420
- const packageType = await getPackageType(packageId, connection);
421
- if (packageType === 'Unlocked') {
422
- return '';
423
- }
424
- let ancestorId = '';
425
- // ancestorID can be alias, 05i, or 04t;
426
- // validate and convert to 05i, as needed
427
- const versionNumber = versionNumberString.split(exports.VERSION_NUMBER_SEP);
428
- const isPatch = versionNumber[2] !== '0';
429
- let origSpecifiedAncestor = packageDescriptorJson.ancestorId;
430
- let highestReleasedVersion = null;
431
- const explicitUseHighestRelease = packageDescriptorJson.ancestorId === versionNumber_1.BuildNumberToken.HIGHEST_VERSION_NUMBER_TOKEN ||
432
- packageDescriptorJson.ancestorVersion === versionNumber_1.BuildNumberToken.HIGHEST_VERSION_NUMBER_TOKEN;
433
- const explicitUseNoAncestor = packageDescriptorJson.ancestorId === versionNumber_1.BuildNumberToken.NONE_VERSION_NUMBER_TOKEN ||
434
- packageDescriptorJson.ancestorVersion === versionNumber_1.BuildNumberToken.NONE_VERSION_NUMBER_TOKEN;
435
- if ((explicitUseHighestRelease || explicitUseNoAncestor) &&
436
- packageDescriptorJson.ancestorId &&
437
- packageDescriptorJson.ancestorVersion) {
438
- if (packageDescriptorJson.ancestorId !== packageDescriptorJson.ancestorVersion) {
439
- // both ancestorId and ancestorVersion specified, HIGHEST and/or NONE are used, the values disagree
440
- throw messages.createError('errorAncestorIdVersionHighestOrNoneMismatch', [
441
- packageDescriptorJson.ancestorId,
442
- packageDescriptorJson.ancestorVersion,
443
- ]);
444
- }
445
- }
446
- if (explicitUseNoAncestor && skipAncestorCheck) {
447
- return '';
448
- }
449
- else {
450
- const result = await getAncestorIdHighestRelease(connection, packageId, versionNumberString, explicitUseHighestRelease, skipAncestorCheck);
451
- if (result.finalAncestorId) {
452
- return result.finalAncestorId;
453
- }
454
- highestReleasedVersion = result.highestReleasedVersion;
455
- }
456
- // at this point if explicitUseHighestRelease=true, we have returned the ancestorId or thrown an error
457
- // highestReleasedVersion should be null only if skipAncestorCheck or if there is no existing released package version
458
- if (!explicitUseNoAncestor && packageDescriptorJson.ancestorId) {
459
- ancestorId = getPackageIdFromAlias(packageDescriptorJson.ancestorId, project);
460
- validateId([exports.BY_LABEL.SUBSCRIBER_PACKAGE_VERSION_ID, exports.BY_LABEL.PACKAGE_VERSION_ID], ancestorId);
461
- ancestorId = await getPackageVersionId(ancestorId, connection);
462
- }
463
- if (!explicitUseNoAncestor && packageDescriptorJson.ancestorVersion) {
464
- const regNumbers = new RegExp('^[0-9]+$');
465
- const versionNumber = packageDescriptorJson.ancestorVersion.split(exports.VERSION_NUMBER_SEP);
466
- if (versionNumber.length < 3 ||
467
- versionNumber.length > 4 ||
468
- !versionNumber[0].match(regNumbers) ||
469
- !versionNumber[1].match(regNumbers) ||
470
- !versionNumber[2].match(regNumbers)) {
471
- throw messages.createError('errorInvalidAncestorVersionFormat', [packageDescriptorJson.ancestorVersion]);
472
- }
473
- const query = 'SELECT Id, IsReleased FROM Package2Version ' +
474
- `WHERE Package2Id = '${packageId}' AND MajorVersion = ${versionNumber[0]} AND MinorVersion = ${versionNumber[1]} AND PatchVersion = ${versionNumber[2]}`;
475
- let queriedAncestorId;
476
- const ancestorVersionResult = await connection.tooling.query(query);
477
- if (!ancestorVersionResult || !ancestorVersionResult.totalSize) {
478
- throw messages.createError('errorNoMatchingAncestor', [packageDescriptorJson.ancestorVersion, packageId]);
479
- }
480
- else {
481
- const releasedAncestor = ancestorVersionResult.records.find((rec) => rec.IsReleased === true);
482
- if (!releasedAncestor) {
483
- throw messages.createError('errorAncestorNotReleased', [packageDescriptorJson.ancestorVersion]);
484
- }
485
- else {
486
- queriedAncestorId = releasedAncestor.Id;
487
- }
488
- }
489
- // check for discrepancy between queried ancestorId and descriptor's ancestorId
490
- if (Object.prototype.hasOwnProperty.call(packageDescriptorJson, 'ancestorId') &&
491
- ancestorId !== queriedAncestorId) {
492
- throw messages.createError('errorAncestorIdVersionMismatch', [
493
- packageDescriptorJson.ancestorVersion,
494
- packageDescriptorJson.ancestorId,
495
- ]);
496
- }
497
- ancestorId = queriedAncestorId;
498
- origSpecifiedAncestor = packageDescriptorJson.ancestorVersion;
499
- }
500
- return validateAncestorId(ancestorId, highestReleasedVersion, explicitUseNoAncestor, isPatch, skipAncestorCheck, origSpecifiedAncestor);
501
- });
502
- }
503
- exports.getAncestorId = getAncestorId;
504
399
  function validateAncestorId(ancestorId, highestReleasedVersion, explicitUseNoAncestor, isPatch, skipAncestorCheck, origSpecifiedAncestor) {
505
400
  if (explicitUseNoAncestor) {
506
401
  if (!highestReleasedVersion) {
@@ -682,11 +577,11 @@ async function pollForStatusWithInterval(id, retries, packageId, branch, withPro
682
577
  const record = pkgQueryResult.records[0];
683
578
  return `${record.MajorVersion}.${record.MinorVersion}.${record.PatchVersion}-${record.BuildNumber}`;
684
579
  });
685
- const newConfig = await _generatePackageAliasEntry(connection, withProject, results[0].SubscriberPackageVersionId, packageVersionVersionString, branch, packageId);
580
+ const newConfig = await generatePackageAliasEntry(connection, withProject, results[0].SubscriberPackageVersionId, packageVersionVersionString, branch, packageId);
686
581
  withProject.getSfProjectJson().set('packageAliases', newConfig);
687
582
  await withProject.getSfProjectJson().write();
688
583
  }
689
- core_1.Lifecycle.getInstance().emit(Package2VersionStatus.success, {
584
+ await core_1.Lifecycle.getInstance().emit(Package2VersionStatus.success, {
690
585
  id,
691
586
  packageVersionCreateRequestResult: results[0],
692
587
  projectUpdated,
@@ -700,25 +595,26 @@ async function pollForStatusWithInterval(id, retries, packageId, branch, withPro
700
595
  // for multiple errors, display one per line prefixed with (x)
701
596
  if (results[0].Error.length > 1) {
702
597
  results[0].Error.forEach((error) => {
598
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
703
599
  errors.push(`(${errors.length + 1}) ${error}`);
704
600
  });
705
601
  errors.unshift(messages.getMessage('versionCreateFailedWithMultipleErrors'));
706
602
  }
707
603
  status = errors.length !== 0 ? errors.join('\n') : results[0].Error.join('\n');
708
604
  }
709
- core_1.Lifecycle.getInstance().emit(Package2VersionStatus.error, { id, status });
605
+ await core_1.Lifecycle.getInstance().emit(Package2VersionStatus.error, { id, status });
710
606
  throw new core_1.SfError(status);
711
607
  }
712
608
  }
713
609
  else {
714
610
  const remainingTime = kit_1.Duration.milliseconds(interval.milliseconds * remainingRetries);
715
- core_1.Lifecycle.getInstance().emit(Package2VersionStatus.inProgress, {
611
+ await core_1.Lifecycle.getInstance().emit(Package2VersionStatus.inProgress, {
716
612
  id,
717
613
  packageVersionCreateRequestResult: results[0],
718
614
  message: '',
719
615
  remainingTime,
720
616
  });
721
- logger.info(`Request in progress. Sleeping ${interval} seconds. Will wait a total of ${remainingTime.seconds} more seconds before timing out. Current Status='${convertCamelCaseStringToSentence(results[0]?.Status)}'`);
617
+ logger.info(`Request in progress. Sleeping ${interval.seconds} seconds. Will wait a total of ${remainingTime.seconds} more seconds before timing out. Current Status='${convertCamelCaseStringToSentence(results[0]?.Status)}'`);
722
618
  remainingRetries--;
723
619
  return { completed: false, payload: results[0] };
724
620
  }
@@ -740,16 +636,15 @@ exports.pollForStatusWithInterval = pollForStatusWithInterval;
740
636
  * @param packageId the 0Ho id
741
637
  * @private
742
638
  */
743
- async function _generatePackageAliasEntry(connection, project, packageVersionId, packageVersionNumber, branch, packageId) {
639
+ async function generatePackageAliasEntry(connection, project, packageVersionId, packageVersionNumber, branch, packageId) {
744
640
  const configContent = project.getSfProjectJson().getContents();
745
641
  const packageAliases = configContent.packageAliases || {};
746
642
  const aliasForPackageId = getPackageAliasesFromId(packageId, project);
747
643
  let packageName;
748
644
  if (!aliasForPackageId || aliasForPackageId.length === 0) {
749
645
  const query = `SELECT Name FROM Package2 WHERE Id = '${packageId}'`;
750
- packageName = await connection.tooling
751
- .query(query)
752
- .then((pkgQueryResult) => pkgQueryResult.records[0]?.Name);
646
+ const package2 = await connection.singleRecordQuery(query, { tooling: true });
647
+ packageName = package2.Name;
753
648
  }
754
649
  else {
755
650
  packageName = aliasForPackageId[0];
@@ -760,6 +655,7 @@ async function _generatePackageAliasEntry(connection, project, packageVersionId,
760
655
  packageAliases[packageAlias] = packageVersionId;
761
656
  return { packageAliases };
762
657
  }
658
+ exports.generatePackageAliasEntry = generatePackageAliasEntry;
763
659
  /**
764
660
  * Return true if the queryResult.records[0].Status is equal to one of the values in statuses.
765
661
  *
@@ -770,14 +666,9 @@ async function _generatePackageAliasEntry(connection, project, packageVersionId,
770
666
  function _isStatusEqualTo(results, statuses) {
771
667
  return results?.length <= 0 ? false : statuses?.some((status) => results[0].Status === status);
772
668
  }
773
- // added for unit testing
774
- function getSoqlWhereClauseMaxLength() {
775
- return exports.SOQL_WHERE_CLAUSE_MAX_LENGTH;
776
- }
777
- exports.getSoqlWhereClauseMaxLength = getSoqlWhereClauseMaxLength;
778
669
  function formatDate(date) {
779
670
  const pad = (num) => {
780
- return num < 10 ? `0${num}` : num;
671
+ return num < 10 ? `0${num}` : `${num}`;
781
672
  };
782
673
  return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
783
674
  }
@@ -787,39 +678,7 @@ function combineSaveErrors(sObject, crudOperation, errors) {
787
678
  const fieldsString = error.fields?.length > 0 ? `Fields: [${error.fields.join(', ')}]` : '';
788
679
  return `Error: ${error.errorCode} Message: ${error.message} ${fieldsString}`;
789
680
  });
790
- const sfError = messages.createError('errorDuringSObjectCRUDOperation', [
791
- crudOperation,
792
- sObject,
793
- errorMessages.join(os.EOL),
794
- ]);
795
- return sfError;
681
+ return messages.createError('errorDuringSObjectCRUDOperation', [crudOperation, sObject, errorMessages.join(os.EOL)]);
796
682
  }
797
683
  exports.combineSaveErrors = combineSaveErrors;
798
- function resolveCanonicalPackageProperty(options) {
799
- let canonicalPackageProperty;
800
- if (!options.package) {
801
- const packageValProp = this.getPackageValuePropertyFromDirectory(options.path, options);
802
- options.package = packageValProp.packageValue;
803
- canonicalPackageProperty = packageValProp.packageProperty;
804
- }
805
- else if (!options.path) {
806
- canonicalPackageProperty = this.getPackagePropertyFromPackage(this.project.getPackageDirectories(), options);
807
- options.path = this.getConfigPackageDirectoriesValue(this.project.getPackageDirectories(), 'path', canonicalPackageProperty, options.package, 'package', options);
808
- }
809
- else {
810
- canonicalPackageProperty = this.getPackagePropertyFromPackage(this.project.getPackageDirectories(), options);
811
- this.getConfigPackageDirectoriesValue(this.project.getPackageDirectories(), canonicalPackageProperty, 'path', options.path, 'path', options);
812
- const expectedPackageId = this.getConfigPackageDirectoriesValue(this.packageDirs, canonicalPackageProperty, 'path', options.path, 'path', options);
813
- // This will throw an error if the package id flag value doesn't match
814
- // any of the :id values in the package dirs.
815
- this.getConfigPackageDirectoriesValue(this.project.getPackageDirectories(), 'path', canonicalPackageProperty, options.package, 'package', options);
816
- // This will throw an error if the package id flag value doesn't match
817
- // the correct corresponding directory with that packageId.
818
- if (options.package !== expectedPackageId) {
819
- throw messages.createError('errorDirectoryIdMismatch', ['--path', options.path, '--package', options.package]);
820
- }
821
- }
822
- return canonicalPackageProperty;
823
- }
824
- exports.resolveCanonicalPackageProperty = resolveCanonicalPackageProperty;
825
684
  //# sourceMappingURL=packageUtils.js.map
@@ -177,14 +177,6 @@ Only one package in a Dev Hub is allowed per converted from first-generation pac
177
177
 
178
178
  Multiple errors occurred:
179
179
 
180
- # errorScriptsNotApplicableToUnlockedPackage
181
-
182
- We can’t create the package version. This parameter is available only for second-generation managed packages. Create the package version without the postinstallscript or uninstallscript parameters.,
183
-
184
- # errorAncestorNotApplicableToUnlockedPackage
185
-
186
- Can’t create package version. Specifying an ancestor is available only for second-generation managed packages. Remove the ancestorId or ancestorVersion from your sfdx-project.json file, and then create the package version again.,
187
-
188
180
  # itemDoesNotFitWithinMaxLength
189
181
 
190
182
  When calculating the number of items to be included in query "%s", when formatted, was too long.
@@ -207,34 +199,14 @@ The %s value [%s], doesn’t match the %s value in any packageDirectories specif
207
199
 
208
200
  The %s value, [%s], and %s value, [%s], were both found in sfdx-project.json but don’t match. If you supply both values, they must match the path and package values in one of the packageDirectories.,
209
201
 
210
- # tempFileLocation
211
-
212
- The temp files are located at: %s.
213
-
214
- # failedToCreatePVCRequest
215
-
216
- Failed to create request %s: %s
217
-
218
- # versionNumberNotFoundInDevHub
202
+ # errorInvalidPackageId
219
203
 
220
- No version number was found in Dev Hub for package id %s and branch %s and version number %s that resolved to build number %s.
221
-
222
- # noReleaseVersionFound
223
-
224
- No released version was found in Dev Hub for package id %s and version number %s.
225
-
226
- # noReleaseVersionFoundForBranch
227
-
228
- No version number was found in Dev Hub for package id $s and branch %s and version number %s.
204
+ The provided package ID '%s' is invalid.
229
205
 
230
206
  # packagingDirNotFoundInConfigFile
231
207
 
232
208
  Config file %s does not contain a packaging directory for %s.
233
209
 
234
- # unpackagedMDDirectoryDoesNotExist
235
-
236
- Un-packaged metadata directory %s was specified but does not exist.
237
-
238
210
  # directoryDoesNotExist
239
211
 
240
212
  Directory %s does not exist.
@@ -255,3 +227,7 @@ Can't uninstall the package %s during uninstall request %s.
255
227
  # uninstallErrorAction
256
228
 
257
229
  Verify installed package ID and resolve errors, then try again.
230
+
231
+ # errorNoSubscriberPackageRecord
232
+
233
+ No subscriber package was found for seed id: %s'
@@ -0,0 +1,71 @@
1
+ # errorPackageAndPackageIdCollision
2
+
3
+ You can’t have both "package" and "packageId" (deprecated) defined as dependencies in sfdx-project.json.
4
+
5
+ # errorDependencyPair
6
+
7
+ Dependency must specify either a subscriberPackageVersionId or both packageId and versionNumber: %s
8
+
9
+ # errorNoIdInHub
10
+
11
+ No package ID was found in Dev Hub for package ID: %s.
12
+
13
+ # versionNumberNotFoundInDevHub
14
+
15
+ No version number was found in Dev Hub for package id %s and branch %s and version number %s that resolved to build number %s.
16
+
17
+ # buildNumberResolvedForLatest
18
+
19
+ Dependency on package %s was resolved to version number %s, branch %s, %s.
20
+
21
+ # buildNumberResolvedForReleased
22
+
23
+ Dependency on package %s was resolved to the released version number %s, %s.
24
+
25
+ # noReleaseVersionFound
26
+
27
+ No released version was found in Dev Hub for package id %s and version number %s.
28
+
29
+ # noReleaseVersionFoundForBranch
30
+
31
+ No version number was found in Dev Hub for package id $s and branch %s and version number %s.
32
+
33
+ # tempFileLocation
34
+
35
+ The temp files are located at: %s.
36
+
37
+ # signupDuplicateSettingsSpecified
38
+
39
+ You cannot use 'settings' and 'orgPreferences' in your scratch definition file, please specify one or the other.
40
+
41
+ # unpackagedMDDirectoryDoesNotExist
42
+
43
+ Un-packaged metadata directory %s was specified but does not exist.
44
+
45
+ # errorEmptyPackageDirs
46
+
47
+ sfdx-project.json must contain a packageDirectories entry for a package. You can run the force:package:create command to auto-populate such an entry.
48
+
49
+ # failedToCreatePVCRequest
50
+
51
+ Failed to create request %s: %s
52
+
53
+ # errorScriptsNotApplicableToUnlockedPackage
54
+
55
+ We can’t create the package version. This parameter is available only for second-generation managed packages. Create the package version without the postinstallscript or uninstallscript parameters.
56
+
57
+ # errorAncestorNotApplicableToUnlockedPackage
58
+
59
+ Can’t create package version. Specifying an ancestor is available only for second-generation managed packages. Remove the ancestorId or ancestorVersion from your sfdx-project.json file, and then create the package version again.
60
+
61
+ # defaultVersionName
62
+
63
+ versionName is blank in sfdx-project.json, so it will be set to this default value based on the versionNumber: %s
64
+
65
+ # releaseNotesUrl
66
+
67
+ release notes URL
68
+
69
+ # postInstallUrl
70
+
71
+ post-install URL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "0.0.18",
3
+ "version": "0.0.21",
4
4
  "description": "packing libraries to Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -35,7 +35,7 @@
35
35
  "!lib/**/*.map"
36
36
  ],
37
37
  "dependencies": {
38
- "@salesforce/core": "^3.24.0",
38
+ "@salesforce/core": "^3.26.1",
39
39
  "@salesforce/kit": "^1.5.44",
40
40
  "@salesforce/schemas": "^1.2.0",
41
41
  "@salesforce/source-deploy-retrieve": "^6.2.0",