@salesforce/packaging 0.0.27 → 0.0.28
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/CHANGELOG.md +6 -0
- package/lib/interfaces/packagingInterfacesAndType.d.ts +4 -3
- package/lib/package/packageVersion.d.ts +2 -2
- package/lib/package/packageVersion.js +3 -2
- package/lib/package/packageVersionList.d.ts +5 -7
- package/lib/package/packageVersionList.js +20 -27
- package/lib/utils/packageUtils.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.28](https://github.com/forcedotcom/packaging/compare/v0.0.27...v0.0.28) (2022-08-26)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- finish pvl, implement a few missing things ([9bb825c](https://github.com/forcedotcom/packaging/commit/9bb825c97b6cb8c8b9522ddcb5e5fb32e5653995))
|
|
10
|
+
|
|
5
11
|
### [0.0.27](https://github.com/forcedotcom/packaging/compare/v0.0.26...v0.0.27) (2022-08-26)
|
|
6
12
|
|
|
7
13
|
### Bug Fixes
|
|
@@ -147,17 +147,18 @@ export declare type PackageVersionCreateRequest = {
|
|
|
147
147
|
CalculateCodeCoverage: boolean;
|
|
148
148
|
SkipValidation: boolean;
|
|
149
149
|
};
|
|
150
|
-
export declare type
|
|
151
|
-
project: SfProject;
|
|
150
|
+
export declare type PackageVersionListOptions = {
|
|
152
151
|
orderBy: string;
|
|
153
152
|
modifiedLastDays: number;
|
|
154
153
|
createdLastDays: number;
|
|
155
154
|
packages: string[];
|
|
156
|
-
connection: Connection;
|
|
157
155
|
verbose: boolean;
|
|
158
156
|
concise: boolean;
|
|
159
157
|
isReleased: boolean;
|
|
160
158
|
};
|
|
159
|
+
export declare type ListPackageVersionOptions = PackageVersionListOptions & {
|
|
160
|
+
connection: Connection;
|
|
161
|
+
};
|
|
161
162
|
export declare type PackageSaveResult = SaveResult;
|
|
162
163
|
export declare type PackageVersionCreateRequestOptions = {
|
|
163
164
|
path: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Duration } from '@salesforce/kit';
|
|
2
|
-
import { PackageSaveResult, PackageVersionCreateOptions, PackageVersionCreateRequestResult, PackageVersionOptions, PackageVersionReportResult } from '../interfaces';
|
|
2
|
+
import { PackageSaveResult, PackageVersionCreateOptions, PackageVersionCreateRequestResult, PackageVersionListOptions, PackageVersionListResult, PackageVersionOptions, PackageVersionReportResult } from '../interfaces';
|
|
3
3
|
export declare class PackageVersion {
|
|
4
4
|
private options;
|
|
5
5
|
private readonly project;
|
|
@@ -56,7 +56,7 @@ export declare class PackageVersion {
|
|
|
56
56
|
}): Promise<PackageVersionCreateRequestResult>;
|
|
57
57
|
convert(): Promise<void>;
|
|
58
58
|
install(): Promise<void>;
|
|
59
|
-
list(): Promise<
|
|
59
|
+
list(options: PackageVersionListOptions): Promise<PackageVersionListResult[]>;
|
|
60
60
|
uninstall(): Promise<void>;
|
|
61
61
|
promote(id: string): Promise<PackageSaveResult>;
|
|
62
62
|
update(): Promise<void>;
|
|
@@ -13,6 +13,7 @@ const utils_1 = require("../utils");
|
|
|
13
13
|
const packageVersionCreate_1 = require("./packageVersionCreate");
|
|
14
14
|
const packageVersionReport_1 = require("./packageVersionReport");
|
|
15
15
|
const packageVersionCreateRequestReport_1 = require("./packageVersionCreateRequestReport");
|
|
16
|
+
const packageVersionList_1 = require("./packageVersionList");
|
|
16
17
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
18
|
class PackageVersion {
|
|
18
19
|
constructor(options) {
|
|
@@ -153,8 +154,8 @@ class PackageVersion {
|
|
|
153
154
|
install() {
|
|
154
155
|
return Promise.resolve(undefined);
|
|
155
156
|
}
|
|
156
|
-
list() {
|
|
157
|
-
return
|
|
157
|
+
async list(options) {
|
|
158
|
+
return (await (0, packageVersionList_1.listPackageVersions)({ ...options, ...{ connection: this.connection } })).records;
|
|
158
159
|
}
|
|
159
160
|
uninstall() {
|
|
160
161
|
return Promise.resolve(undefined);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { SfProject } from '@salesforce/core';
|
|
2
1
|
import { QueryResult } from 'jsforce';
|
|
3
|
-
import { PackageVersionListResult,
|
|
2
|
+
import { PackageVersionListResult, ListPackageVersionOptions } from '../interfaces';
|
|
4
3
|
export declare const DEFAULT_ORDER_BY_FIELDS = "Package2Id, Branch, MajorVersion, MinorVersion, PatchVersion, BuildNumber";
|
|
5
|
-
export declare function listPackageVersions(options:
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function _getLastDays(paramName: string, lastDays: number): number;
|
|
4
|
+
export declare function listPackageVersions(options: ListPackageVersionOptions): Promise<QueryResult<PackageVersionListResult>>;
|
|
5
|
+
export declare function assembleQueryParts(select: string, where: string[], orderBy?: string): string;
|
|
6
|
+
export declare function constructWhere(packageIds: string[], createdLastDays: number, lastModLastDays: number, isReleased: boolean): string[];
|
|
7
|
+
export declare function validateDays(paramName: string, lastDays: number): number;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.validateDays = exports.constructWhere = exports.assembleQueryParts = exports.listPackageVersions = exports.DEFAULT_ORDER_BY_FIELDS = void 0;
|
|
10
10
|
const core_1 = require("@salesforce/core");
|
|
11
11
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
12
|
const utils_1 = require("../utils");
|
|
@@ -25,67 +25,60 @@ const VERBOSE_SELECT = 'SELECT Id, Package2Id, SubscriberPackageVersionId, Name,
|
|
|
25
25
|
exports.DEFAULT_ORDER_BY_FIELDS = 'Package2Id, Branch, MajorVersion, MinorVersion, PatchVersion, BuildNumber';
|
|
26
26
|
const logger = core_1.Logger.childFromRoot('packageVersionList');
|
|
27
27
|
async function listPackageVersions(options) {
|
|
28
|
-
return options.connection.tooling.query(
|
|
28
|
+
return options.connection.tooling.query(constructQuery(options));
|
|
29
29
|
}
|
|
30
30
|
exports.listPackageVersions = listPackageVersions;
|
|
31
|
-
function
|
|
31
|
+
function constructQuery(options) {
|
|
32
32
|
// construct custom WHERE clause, if applicable
|
|
33
|
-
const where =
|
|
34
|
-
|
|
35
|
-
where.push('IsReleased = true');
|
|
36
|
-
}
|
|
37
|
-
return _assembleQueryParts(options.verbose === true ? VERBOSE_SELECT : DEFAULT_SELECT, where, options.orderBy);
|
|
33
|
+
const where = constructWhere(options.packages, options.createdLastDays, options.modifiedLastDays, options.isReleased);
|
|
34
|
+
return assembleQueryParts(options.verbose === true ? VERBOSE_SELECT : DEFAULT_SELECT, where, options.orderBy);
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
function _assembleQueryParts(select, where, orderBy = exports.DEFAULT_ORDER_BY_FIELDS) {
|
|
36
|
+
function assembleQueryParts(select, where, orderBy) {
|
|
41
37
|
// construct ORDER BY clause
|
|
42
|
-
// TODO: validate given fields
|
|
43
38
|
const orderByPart = `ORDER BY ${orderBy ? orderBy : exports.DEFAULT_ORDER_BY_FIELDS}`;
|
|
44
39
|
const wherePart = where.length > 0 ? `WHERE ${where.join(' AND ')}` : '';
|
|
45
40
|
const query = `${select} ${wherePart} ${orderByPart}`;
|
|
46
41
|
logger.debug(query);
|
|
47
42
|
return query;
|
|
48
43
|
}
|
|
49
|
-
exports.
|
|
44
|
+
exports.assembleQueryParts = assembleQueryParts;
|
|
50
45
|
// construct custom WHERE clause parts
|
|
51
|
-
function
|
|
46
|
+
function constructWhere(packageIds, createdLastDays, lastModLastDays, isReleased) {
|
|
52
47
|
const where = [];
|
|
53
48
|
// filter on given package ids
|
|
54
|
-
if (
|
|
49
|
+
if (packageIds?.length > 0) {
|
|
55
50
|
// remove dups
|
|
56
|
-
const
|
|
57
|
-
// resolve any aliases
|
|
58
|
-
const packageIds = aliasesOrIds.map((idOrAlias) => (0, utils_1.getPackageIdFromAlias)(idOrAlias, project));
|
|
51
|
+
const uniquePackageIds = [...new Set(packageIds)];
|
|
59
52
|
// validate ids
|
|
60
|
-
|
|
53
|
+
uniquePackageIds.forEach((packageId) => {
|
|
61
54
|
(0, utils_1.validateId)(utils_1.BY_LABEL.PACKAGE_ID, packageId);
|
|
62
55
|
});
|
|
63
56
|
// stash where part
|
|
64
|
-
where.push(`Package2Id IN ('${
|
|
57
|
+
where.push(`Package2Id IN ('${uniquePackageIds.join("','")}')`);
|
|
65
58
|
}
|
|
66
59
|
// filter on created date, days ago: 0 for today, etc
|
|
67
60
|
if ((0, ts_types_1.isNumber)(createdLastDays)) {
|
|
68
|
-
createdLastDays =
|
|
61
|
+
createdLastDays = validateDays('createdlastdays', createdLastDays);
|
|
69
62
|
where.push(`CreatedDate = LAST_N_DAYS:${createdLastDays}`);
|
|
70
63
|
}
|
|
71
64
|
// filter on last mod date, days ago: 0 for today, etc
|
|
72
65
|
if ((0, ts_types_1.isNumber)(lastModLastDays)) {
|
|
73
|
-
lastModLastDays =
|
|
66
|
+
lastModLastDays = validateDays('modifiedlastdays', lastModLastDays);
|
|
74
67
|
where.push(`LastModifiedDate = LAST_N_DAYS:${lastModLastDays}`);
|
|
75
68
|
}
|
|
69
|
+
if (isReleased) {
|
|
70
|
+
where.push('IsReleased = true');
|
|
71
|
+
}
|
|
76
72
|
// exclude deleted
|
|
77
73
|
where.push('IsDeprecated = false');
|
|
78
74
|
return where;
|
|
79
75
|
}
|
|
80
|
-
exports.
|
|
81
|
-
function
|
|
82
|
-
if (isNaN(lastDays)) {
|
|
83
|
-
return 0;
|
|
84
|
-
}
|
|
76
|
+
exports.constructWhere = constructWhere;
|
|
77
|
+
function validateDays(paramName, lastDays) {
|
|
85
78
|
if (lastDays < 0) {
|
|
86
79
|
throw messages.createError('invalidDaysNumber', [paramName, `${lastDays}`]);
|
|
87
80
|
}
|
|
88
81
|
return lastDays;
|
|
89
82
|
}
|
|
90
|
-
exports.
|
|
83
|
+
exports.validateDays = validateDays;
|
|
91
84
|
//# sourceMappingURL=packageVersionList.js.map
|
|
@@ -324,7 +324,9 @@ async function getPackageVersionStrings(subscriberPackageVersionIds, connection)
|
|
|
324
324
|
}
|
|
325
325
|
// remove any duplicate Ids
|
|
326
326
|
const ids = [...new Set(subscriberPackageVersionIds)];
|
|
327
|
-
const query =
|
|
327
|
+
const query = `SELECT SubscriberPackageVersionId, MajorVersion, MinorVersion, PatchVersion, BuildNumber FROM Package2Version WHERE SubscriberPackageVersionId IN (${ids
|
|
328
|
+
.map((id) => `'${id}'`)
|
|
329
|
+
.join(',')})`;
|
|
328
330
|
const records = await queryWithInConditionChunking(query, ids, '%IDS%', connection);
|
|
329
331
|
if (records && records.length > 0) {
|
|
330
332
|
results = new Map(records.map((record) => {
|