@salesforce/packaging 0.0.2 → 0.0.5

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 CHANGED
@@ -2,6 +2,22 @@
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.5](https://github.com/forcedotcom/packaging/compare/v0.0.4...v0.0.5) (2022-07-06)
6
+
7
+ ### [0.0.4](https://github.com/forcedotcom/packaging/compare/v0.0.3...v0.0.4) (2022-06-23)
8
+
9
+ ### [0.0.3](https://github.com/forcedotcom/packaging/compare/v0.0.2-test-02...v0.0.3) (2022-06-16)
10
+
11
+ ### Bug Fixes
12
+
13
+ - fix version number ([ba522bb](https://github.com/forcedotcom/packaging/commit/ba522bb387160e61c1bf9eb5c85d38e5a5fe7e71))
14
+
15
+ ### [0.0.2-test-02](https://github.com/forcedotcom/packaging/compare/v0.0.2...v0.0.2-test-02) (2022-06-16)
16
+
17
+ ### Bug Fixes
18
+
19
+ - next round of refactoring plus utests ([d5a615b](https://github.com/forcedotcom/packaging/commit/d5a615bbf8cb2d5c33a55ddeaf5027bb6e1d3e51))
20
+
5
21
  ### 0.0.2 (2022-06-13)
6
22
 
7
23
  ### Bug Fixes
package/lib/exported.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './interfaces';
2
2
  export * from './package';
3
3
  export * from './package1';
4
+ export * from './utils';
package/lib/exported.js CHANGED
@@ -23,4 +23,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  __exportStar(require("./interfaces"), exports);
24
24
  __exportStar(require("./package"), exports);
25
25
  __exportStar(require("./package1"), exports);
26
+ __exportStar(require("./utils"), exports);
26
27
  //# sourceMappingURL=exported.js.map
@@ -1 +1,2 @@
1
1
  export * from './packagingInterfacesAndType';
2
+ export * from './packagingSObjects';
@@ -21,4 +21,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
22
22
  */
23
23
  __exportStar(require("./packagingInterfacesAndType"), exports);
24
+ __exportStar(require("./packagingSObjects"), exports);
24
25
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,6 @@
1
+ import { Duration } from '@salesforce/kit';
2
+ import { PackagingSObjects } from './packagingSObjects';
3
+ import Package2VersionStatus = PackagingSObjects.Package2VersionStatus;
1
4
  export interface IPackage {
2
5
  create(): Promise<void>;
3
6
  convert(): Promise<void>;
@@ -7,7 +10,7 @@ export interface IPackage {
7
10
  uninstall(): Promise<void>;
8
11
  update(): Promise<void>;
9
12
  }
10
- export interface IPackage1Version {
13
+ export interface IPackageVersion1GP {
11
14
  create(): Promise<void>;
12
15
  convert(): Promise<void>;
13
16
  delete(): Promise<void>;
@@ -16,7 +19,7 @@ export interface IPackage1Version {
16
19
  uninstall(): Promise<void>;
17
20
  update(): Promise<void>;
18
21
  }
19
- export interface IPackage2Version {
22
+ export interface IPackageVersion2GP {
20
23
  create(): Promise<void>;
21
24
  convert(): Promise<void>;
22
25
  delete(): Promise<void>;
@@ -27,4 +30,62 @@ export interface IPackage2Version {
27
30
  }
28
31
  export declare type PackageOptions = Record<string, unknown>;
29
32
  export declare type PackageVersion2Options = Record<string, unknown>;
30
- export declare type PackageVersion1Options = Record<string, unknown>;
33
+ export declare type PackageVersionOptions1GP = Record<string, unknown>;
34
+ export declare type Package2VersionCreateRequestResult = {
35
+ Id: string;
36
+ Status: Package2VersionStatus;
37
+ Package2Id: string;
38
+ Package2VersionId: string;
39
+ SubscriberPackageVersionId: string | null;
40
+ Tag: string;
41
+ Branch: string;
42
+ Error: any[];
43
+ CreatedDate: string;
44
+ HasMetadataRemoved: boolean | null;
45
+ CreatedBy: string;
46
+ };
47
+ export declare type Package2VersionCreateRequestError = {
48
+ Message: string;
49
+ };
50
+ export declare type Package2VersionCreateEventData = {
51
+ id: string;
52
+ packageUpdated?: boolean;
53
+ package2VersionCreateRequestResult: Package2VersionCreateRequestResult;
54
+ message?: string;
55
+ timeRemaining?: Duration;
56
+ };
57
+ export declare type PackageVersionListResult = {
58
+ Id: string;
59
+ Package2Id: string;
60
+ SubscriberPackageVersionId: string;
61
+ Name: string;
62
+ Package2: {
63
+ [key: string]: unknown;
64
+ Name: string;
65
+ NamespacePrefix: string;
66
+ IsOrgDependent?: boolean;
67
+ };
68
+ Description: string;
69
+ Tag: string;
70
+ Branch: string;
71
+ MajorVersion: string;
72
+ MinorVersion: string;
73
+ PatchVersion: string;
74
+ BuildNumber: string;
75
+ IsReleased: boolean;
76
+ CreatedDate: string;
77
+ LastModifiedDate: string;
78
+ IsPasswordProtected: boolean;
79
+ AncestorId: string;
80
+ ValidationSkipped: boolean;
81
+ CreatedById: string;
82
+ CodeCoverage?: {
83
+ [key: string]: unknown;
84
+ ApexCodeCoveragePercentage: number;
85
+ };
86
+ HasPassedCodeCoverageCheck?: boolean;
87
+ ConvertedFromVersionId?: string;
88
+ ReleaseVersion?: string;
89
+ BuildDurationInSeconds?: number;
90
+ HasMetadataRemoved?: boolean;
91
+ };
@@ -1,3 +1,9 @@
1
1
  "use strict";
2
+ /*
3
+ * Copyright (c) 2022, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  //# sourceMappingURL=packagingInterfacesAndType.js.map
@@ -0,0 +1,225 @@
1
+ export declare namespace PackagingSObjects {
2
+ type Package2 = {
3
+ Id: string;
4
+ IsDeleted: boolean;
5
+ CreatedDate: number;
6
+ CreatedById: string;
7
+ LastModifiedDate: number;
8
+ LastModifiedById: string;
9
+ SystemModstamp: number;
10
+ SubscriberPackageId: string;
11
+ Name: string;
12
+ Description: string;
13
+ NamespacePrefix: string;
14
+ ContainerOptions: string;
15
+ IsDeprecated: boolean;
16
+ IsOrgDependent: boolean;
17
+ ConvertedFromPackageId: string;
18
+ PackageErrorUsername: string;
19
+ };
20
+ type Package2Version = {
21
+ Id: string;
22
+ IsDeleted: boolean;
23
+ CreatedDate: number;
24
+ CreatedById: string;
25
+ LastModifiedDate: number;
26
+ LastModifiedById: string;
27
+ SystemModstamp: number;
28
+ Package2Id: string;
29
+ SubscriberPackageVersionId: string;
30
+ Tag: string;
31
+ Branch: string;
32
+ AncestorId: string;
33
+ ValidationSkipped: boolean;
34
+ Name: string;
35
+ Description: string;
36
+ MajorVersion: number;
37
+ MinorVersion: number;
38
+ PatchVersion: number;
39
+ BuildNumber: number;
40
+ IsDeprecated: boolean;
41
+ IsPasswordProtected: boolean;
42
+ CodeCoverage: unknown;
43
+ HasPassedCodeCoverageCheck: boolean;
44
+ InstallKey: string;
45
+ IsReleased: boolean;
46
+ ConvertedFromVersionId: string;
47
+ ReleaseVersion: number;
48
+ BuildDurationInSeconds: number;
49
+ HasMetadataRemoved: boolean;
50
+ };
51
+ enum Package2VersionStatus {
52
+ queued = "Queued",
53
+ inProgress = "InProgress",
54
+ success = "Success",
55
+ error = "Error"
56
+ }
57
+ type Package2VersionCreateRequest = {
58
+ Id: string;
59
+ IsDeleted: boolean;
60
+ CreatedDate: number;
61
+ CreatedById: string;
62
+ LastModifiedDate: number;
63
+ LastModifiedById: string;
64
+ SystemModstamp: number;
65
+ Package2Id: string;
66
+ Package2VersionId: string;
67
+ Tag: string;
68
+ Branch: string;
69
+ Status: Package2VersionStatus;
70
+ Instance: string;
71
+ IsPasswordProtected: boolean;
72
+ InstallKey: string;
73
+ CalculateCodeCoverage: boolean;
74
+ SkipValidation: boolean;
75
+ IsConversionRequest: boolean;
76
+ VersionInfo: string;
77
+ };
78
+ type Package2VersionCreateRequestError = {
79
+ Id: string;
80
+ IsDeleted: boolean;
81
+ CreatedDate: number;
82
+ CreatedById: string;
83
+ LastModifiedDate: number;
84
+ LastModifiedById: string;
85
+ SystemModstamp: number;
86
+ ParentRequestId: string;
87
+ Message: string;
88
+ };
89
+ type SubscriberPackage = {
90
+ Id: string;
91
+ Name: string;
92
+ NamespacePrefix: string;
93
+ Description: string;
94
+ IsPackageValid: boolean;
95
+ };
96
+ type SubscriberPackageVersion = {
97
+ Id: string;
98
+ SubscriberPackageId: string;
99
+ Name: string;
100
+ Description: string;
101
+ PublisherName: string;
102
+ MajorVersion: number;
103
+ MinorVersion: number;
104
+ PatchVersion: number;
105
+ BuildNumber: number;
106
+ ReleaseState: string;
107
+ IsManaged: boolean;
108
+ IsDeprecated: boolean;
109
+ IsPasswordProtected: boolean;
110
+ IsBeta: boolean;
111
+ Package2ContainerOptions: string;
112
+ IsSecurityReviewed: boolean;
113
+ IsOrgDependent: boolean;
114
+ AppExchangePackageName: string;
115
+ AppExchangeDescription: string;
116
+ AppExchangePublisherName: string;
117
+ AppExchangeLogoUrl: string;
118
+ ReleaseNotesUrl: string;
119
+ PostInstallUrl: string;
120
+ RemoteSiteSettings: unknown;
121
+ CspTrustedSites: unknown;
122
+ Profiles: unknown;
123
+ Dependencies: unknown;
124
+ InstallValidationStatus: string;
125
+ };
126
+ type SubscriberPackageVersionUninstallRequest = {
127
+ Id: string;
128
+ IsDeleted: boolean;
129
+ CreatedDate: number;
130
+ CreatedById: string;
131
+ LastModifiedDate: number;
132
+ LastModifiedById: string;
133
+ SystemModstamp: number;
134
+ SubscriberPackageVersionId: string;
135
+ Status: string;
136
+ };
137
+ type PackageVersionUninstallRequestError = {
138
+ Id: string;
139
+ IsDeleted: boolean;
140
+ CreatedDate: number;
141
+ CreatedById: string;
142
+ LastModifiedDate: number;
143
+ LastModifiedById: string;
144
+ SystemModstamp: number;
145
+ SubscriberPackageVersionId: string;
146
+ Status: string;
147
+ };
148
+ type PackageInstallRequest = {
149
+ Id: string;
150
+ IsDeleted: boolean;
151
+ CreatedDate: number;
152
+ CreatedById: string;
153
+ LastModifiedDate: number;
154
+ LastModifiedById: string;
155
+ SystemModstamp: number;
156
+ SubscriberPackageVersionKey: string;
157
+ NameConflictResolution: string;
158
+ SecurityType: string;
159
+ PackageInstallSource: string;
160
+ ProfileMappings: unknown;
161
+ Password: string;
162
+ EnableRss: boolean;
163
+ UpgradeType: string;
164
+ ApexCompileType: string;
165
+ Status: string;
166
+ Errors: any[];
167
+ };
168
+ type PackageUploadRequest = {
169
+ Id: string;
170
+ IsDeleted: boolean;
171
+ CreatedDate: number;
172
+ CreatedById: string;
173
+ LastModifiedDate: number;
174
+ LastModifiedById: string;
175
+ SystemModstamp: number;
176
+ MetadataPackageId: string;
177
+ MetadataPackageVersionId: string;
178
+ IsReleaseVersion: boolean;
179
+ VersionName: string;
180
+ Description: string;
181
+ MajorVersion: number;
182
+ MinorVersion: number;
183
+ ReleaseNotesUrl: string;
184
+ PostInstallUrl: string;
185
+ Password: string;
186
+ Status: string;
187
+ Errors: any[];
188
+ };
189
+ type InstalledSubscriberPackageVersion = {
190
+ Id: string;
191
+ SubscriberPackageId: string;
192
+ Name: string;
193
+ Description: string;
194
+ PublisherName: string;
195
+ MajorVersion: number;
196
+ MinorVersion: number;
197
+ PatchVersion: number;
198
+ BuildNumber: number;
199
+ ReleaseState: string;
200
+ IsManaged: boolean;
201
+ IsDeprecated: boolean;
202
+ IsPasswordProtected: boolean;
203
+ IsBeta: boolean;
204
+ Package2ContainerOptions: string;
205
+ IsSecurityReviewed: boolean;
206
+ IsOrgDependent: boolean;
207
+ AppExchangePackageName: string;
208
+ AppExchangeDescription: string;
209
+ AppExchangePublisherName: string;
210
+ AppExchangeLogoUrl: string;
211
+ ReleaseNotesUrl: string;
212
+ PostInstallUrl: string;
213
+ RemoteSiteSettings: unknown;
214
+ CspTrustedSites: unknown;
215
+ Profiles: unknown;
216
+ Dependencies: unknown;
217
+ InstallValidationStatus: string;
218
+ };
219
+ type InstalledSubscriberPackage = {
220
+ Id: string;
221
+ SubscriberPackageId: string;
222
+ SubscriberPackageVersionId: string;
223
+ MinPackageVersionId: string;
224
+ };
225
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackagingSObjects = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ var PackagingSObjects;
11
+ (function (PackagingSObjects) {
12
+ let Package2VersionStatus;
13
+ (function (Package2VersionStatus) {
14
+ Package2VersionStatus["queued"] = "Queued";
15
+ Package2VersionStatus["inProgress"] = "InProgress";
16
+ Package2VersionStatus["success"] = "Success";
17
+ Package2VersionStatus["error"] = "Error";
18
+ })(Package2VersionStatus = PackagingSObjects.Package2VersionStatus || (PackagingSObjects.Package2VersionStatus = {}));
19
+ })(PackagingSObjects = exports.PackagingSObjects || (exports.PackagingSObjects = {}));
20
+ //# sourceMappingURL=packagingSObjects.js.map
@@ -1,2 +1,4 @@
1
1
  export * from './package';
2
- export * from './package2Version';
2
+ export * from './packageVersion2GP';
3
+ export * from './packageList';
4
+ export { listPackageVersions } from './packageVersionList';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.listPackageVersions = void 0;
17
18
  /*
18
19
  * Copyright (c) 2022, salesforce.com, inc.
19
20
  * All rights reserved.
@@ -21,5 +22,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
22
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
22
23
  */
23
24
  __exportStar(require("./package"), exports);
24
- __exportStar(require("./package2Version"), exports);
25
+ __exportStar(require("./packageVersion2GP"), exports);
26
+ __exportStar(require("./packageList"), exports);
27
+ var packageVersionList_1 = require("./packageVersionList");
28
+ Object.defineProperty(exports, "listPackageVersions", { enumerable: true, get: function () { return packageVersionList_1.listPackageVersions; } });
25
29
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ import { Connection } from '@salesforce/core';
2
+ import { QueryResult } from 'jsforce';
3
+ import { PackagingSObjects } from '../interfaces';
4
+ export declare function listPackages(connection: Connection): Promise<QueryResult<PackagingSObjects.Package2>>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2022, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.listPackages = void 0;
10
+ const QUERY = 'SELECT Id, SubscriberPackageId, Name, Description, NamespacePrefix, ContainerOptions, IsOrgDependent, ConvertedFromPackageId, ' +
11
+ 'PackageErrorUsername, CreatedById ' +
12
+ 'FROM Package2 ' +
13
+ 'WHERE IsDeprecated != true ' +
14
+ 'ORDER BY NamespacePrefix, Name';
15
+ async function listPackages(connection) {
16
+ return connection.tooling.query(QUERY);
17
+ }
18
+ exports.listPackages = listPackages;
19
+ //# sourceMappingURL=packageList.js.map
@@ -1,9 +1,9 @@
1
1
  import { AsyncCreatable } from '@salesforce/kit';
2
- import { IPackage2Version, PackageVersion2Options } from '../interfaces';
2
+ import { IPackageVersion2GP, PackageVersion2Options } from '../interfaces';
3
3
  /**
4
4
  * Package2Version class - Class to be used with 2nd generation package versions
5
5
  */
6
- export declare class Package2Version extends AsyncCreatable<PackageVersion2Options> implements IPackage2Version {
6
+ export declare class PackageVersion2GP extends AsyncCreatable<PackageVersion2Options> implements IPackageVersion2GP {
7
7
  private options;
8
8
  constructor(options: PackageVersion2Options);
9
9
  convert(): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Package2Version = void 0;
3
+ exports.PackageVersion2GP = void 0;
4
4
  /*
5
5
  * Copyright (c) 2022, salesforce.com, inc.
6
6
  * All rights reserved.
@@ -11,7 +11,7 @@ const kit_1 = require("@salesforce/kit");
11
11
  /**
12
12
  * Package2Version class - Class to be used with 2nd generation package versions
13
13
  */
14
- class Package2Version extends kit_1.AsyncCreatable {
14
+ class PackageVersion2GP extends kit_1.AsyncCreatable {
15
15
  // @ts-ignore
16
16
  constructor(options) {
17
17
  super(options);
@@ -42,5 +42,5 @@ class Package2Version extends kit_1.AsyncCreatable {
42
42
  return Promise.resolve(undefined);
43
43
  }
44
44
  }
45
- exports.Package2Version = Package2Version;
46
- //# sourceMappingURL=package2Version.js.map
45
+ exports.PackageVersion2GP = PackageVersion2GP;
46
+ //# sourceMappingURL=packageVersion2GP.js.map
@@ -0,0 +1,17 @@
1
+ import { Connection } from '@salesforce/core';
2
+ import { Package2VersionCreateRequestResult } from '../interfaces';
3
+ declare type PackageVersionCreateRequestApiOptions = {
4
+ createdlastdays?: number;
5
+ connection?: Connection;
6
+ status?: string;
7
+ };
8
+ export declare class PackageVersionCreateRequestApi {
9
+ private options;
10
+ constructor(options: PackageVersionCreateRequestApiOptions);
11
+ list(options?: PackageVersionCreateRequestApiOptions): Promise<Package2VersionCreateRequestResult[]>;
12
+ byId(package2VersionCreateRequestId: any): Promise<Package2VersionCreateRequestResult[]>;
13
+ private _query;
14
+ private _queryErrors;
15
+ private _constructWhere;
16
+ }
17
+ export {};
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2020, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PackageVersionCreateRequestApi = void 0;
10
+ // Node
11
+ const util = require("util");
12
+ // Local
13
+ const core_1 = require("@salesforce/core");
14
+ core_1.Messages.importMessagesDirectory(__dirname);
15
+ const messages = core_1.Messages.loadMessages('@salesforce/packaging', 'messages');
16
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
17
+ const packageUtils = require('../utils/packageUtils');
18
+ const STATUS_ERROR = 'Error';
19
+ const QUERY = 'SELECT Id, Status, Package2Id, Package2VersionId, Package2Version.SubscriberPackageVersionId, Tag, Branch, ' +
20
+ 'CreatedDate, Package2Version.HasMetadataRemoved, CreatedById ' +
21
+ 'FROM Package2VersionCreateRequest ' +
22
+ '%s' + // WHERE, if applicable
23
+ 'ORDER BY CreatedDate';
24
+ const ERROR_QUERY = "SELECT Message FROM Package2VersionCreateRequestError WHERE ParentRequest.Id = '%s'";
25
+ const STATUSES = ['Queued', 'InProgress', 'Success', 'Error'];
26
+ class PackageVersionCreateRequestApi {
27
+ constructor(options) {
28
+ this.options = options;
29
+ }
30
+ list(options = {}) {
31
+ const whereClause = this._constructWhere();
32
+ return this._query(util.format(QUERY, whereClause));
33
+ }
34
+ async byId(package2VersionCreateRequestId) {
35
+ const results = await this._query(util.format(QUERY, `WHERE Id = '${package2VersionCreateRequestId}' `));
36
+ if (results && results.length === 1 && results[0].Status === STATUS_ERROR) {
37
+ results[0].Error = await this._queryErrors(package2VersionCreateRequestId);
38
+ }
39
+ return results;
40
+ }
41
+ async _query(query) {
42
+ const queryResult = await this.options.connection.tooling.query(query);
43
+ return (queryResult.records ? queryResult.records : []).map((record) => ({
44
+ Id: record.Id,
45
+ Status: record.Status,
46
+ Package2Id: record.Package2Id,
47
+ Package2VersionId: record.Package2VersionId,
48
+ SubscriberPackageVersionId: record.Package2Version != null ? record.Package2Version.SubscriberPackageVersionId : null,
49
+ Tag: record.Tag,
50
+ Branch: record.Branch,
51
+ Error: [],
52
+ CreatedDate: packageUtils.formatDate(new Date(record.CreatedDate)),
53
+ HasMetadataRemoved: record.Package2Version != null ? record.Package2Version.HasMetadataRemoved : null,
54
+ CreatedBy: record.CreatedById,
55
+ }));
56
+ }
57
+ async _queryErrors(package2VersionCreateRequestId) {
58
+ const errorResults = [];
59
+ const queryResult = await this.options.connection.tooling.query(util.format(ERROR_QUERY, package2VersionCreateRequestId));
60
+ if (queryResult.records) {
61
+ queryResult.records.forEach((record) => {
62
+ errorResults.push(record.Message);
63
+ });
64
+ }
65
+ return errorResults;
66
+ }
67
+ _constructWhere() {
68
+ const where = [];
69
+ // filter on created date, days ago: 0 for today, etc
70
+ if (!util.isNullOrUndefined(this.options.createdlastdays)) {
71
+ if (this.options.createdlastdays < 0) {
72
+ throw new Error(messages.getMessage('invalidDaysNumber', ['createdlastdays', this.options.createdlastdays]));
73
+ }
74
+ where.push(`CreatedDate = LAST_N_DAYS:${this.options.createdlastdays}`);
75
+ }
76
+ // filter on errors
77
+ if (this.options.status) {
78
+ const foundStatus = STATUSES.find((status) => status.toLowerCase() === this.options.status.toLowerCase());
79
+ if (!foundStatus) {
80
+ const args = [this.options.status];
81
+ STATUSES.forEach((status) => {
82
+ args.push(status);
83
+ });
84
+ throw new Error(messages.getMessage('invalidStatus', args));
85
+ }
86
+ where.push(`Status = '${foundStatus}'`);
87
+ }
88
+ return where.length > 0 ? `WHERE ${where.join(' AND ')}` : '';
89
+ }
90
+ }
91
+ exports.PackageVersionCreateRequestApi = PackageVersionCreateRequestApi;
92
+ //# sourceMappingURL=packageVersionCreateRequestApi.js.map
@@ -0,0 +1,29 @@
1
+ import { Connection, SfProject } from '@salesforce/core';
2
+ import { QueryResult } from 'jsforce';
3
+ import { PackageVersionListResult } from '../interfaces';
4
+ export declare const DEFAULT_ORDER_BY_FIELDS = "Package2Id, Branch, MajorVersion, MinorVersion, PatchVersion, BuildNumber";
5
+ export declare function listPackageVersions(options: {
6
+ project: SfProject;
7
+ orderBy: string;
8
+ modifiedLastDays: number;
9
+ createdLastDays: number;
10
+ packages: string[];
11
+ connection: Connection;
12
+ verbose: boolean;
13
+ concise: boolean;
14
+ isReleased: boolean;
15
+ }): Promise<QueryResult<PackageVersionListResult>>;
16
+ export declare function _constructQuery(options: {
17
+ project: SfProject;
18
+ orderBy: string;
19
+ modifiedLastDays: number;
20
+ createdLastDays: number;
21
+ packages: string[];
22
+ connection: Connection;
23
+ verbose: boolean;
24
+ concise: boolean;
25
+ isReleased: boolean;
26
+ }): string;
27
+ export declare function _assembleQueryParts(select: string, where: string[], orderBy?: string): string;
28
+ export declare function _constructWhere(idsOrAliases: string[], createdLastDays: number, lastModLastDays: number, project: SfProject): string[];
29
+ export declare function _getLastDays(paramName: string, lastDays: number): number;