@salesforce/packaging 0.0.32 → 0.0.33

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,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.33](https://github.com/forcedotcom/packaging/compare/v0.0.32...v0.0.33) (2022-09-08)
6
+
7
+ ### Bug Fixes
8
+
9
+ - add PackageVersion.listCreated, NUT ([31280aa](https://github.com/forcedotcom/packaging/commit/31280aaa79967e1bd9a2c039f028b7d7fe6d658b))
10
+
5
11
  ### [0.0.32](https://github.com/forcedotcom/packaging/compare/v0.0.31...v0.0.32) (2022-09-07)
6
12
 
7
13
  ### Bug Fixes
@@ -234,7 +234,7 @@ export declare type PackageVersionCreateOptions = Partial<PackageVersionOptions
234
234
  export declare type PackageVersionCreateRequestQueryOptions = {
235
235
  createdlastdays?: number;
236
236
  connection?: Connection;
237
- status?: string;
237
+ status?: 'Queued' | 'InProgress' | 'Success' | 'Error';
238
238
  };
239
239
  export declare type ProfileApiOptions = {
240
240
  project: SfProject;
@@ -1,5 +1,5 @@
1
1
  import { Duration } from '@salesforce/kit';
2
- import { PackageSaveResult, PackageVersionCreateOptions, PackageVersionCreateRequestResult, PackageVersionListOptions, PackageVersionListResult, PackageVersionOptions, PackageVersionReportResult, PackageVersionUpdateOptions } from '../interfaces';
2
+ import { PackageSaveResult, PackageVersionCreateOptions, PackageVersionCreateRequestQueryOptions, PackageVersionCreateRequestResult, PackageVersionListOptions, PackageVersionListResult, PackageVersionOptions, PackageVersionReportResult, PackageVersionUpdateOptions } from '../interfaces';
3
3
  export declare class PackageVersion {
4
4
  private options;
5
5
  private readonly project;
@@ -40,6 +40,7 @@ export declare class PackageVersion {
40
40
  * @param createPackageRequestId
41
41
  */
42
42
  getCreateVersionReport(createPackageRequestId: string): Promise<PackageVersionCreateRequestResult>;
43
+ createdList(options?: Omit<PackageVersionCreateRequestQueryOptions, 'connection'>): Promise<PackageVersionCreateRequestResult[]>;
43
44
  /**
44
45
  * Convenience function that will wait for a package version to be created.
45
46
  *
@@ -14,6 +14,7 @@ const packageVersionCreate_1 = require("./packageVersionCreate");
14
14
  const packageVersionReport_1 = require("./packageVersionReport");
15
15
  const packageVersionCreateRequestReport_1 = require("./packageVersionCreateRequestReport");
16
16
  const packageVersionList_1 = require("./packageVersionList");
17
+ const packageVersionCreateRequest_1 = require("./packageVersionCreateRequest");
17
18
  core_1.Messages.importMessagesDirectory(__dirname);
18
19
  class PackageVersion {
19
20
  constructor(options) {
@@ -89,6 +90,9 @@ class PackageVersion {
89
90
  throw (0, utils_1.applyErrorAction)(err);
90
91
  });
91
92
  }
93
+ async createdList(options) {
94
+ return await (0, packageVersionCreateRequest_1.list)({ ...options, connection: this.connection });
95
+ }
92
96
  /**
93
97
  * Convenience function that will wait for a package version to be created.
94
98
  *
@@ -19,9 +19,8 @@ const QUERY = 'SELECT Id, Status, Package2Id, Package2VersionId, Package2Version
19
19
  '%s' + // WHERE, if applicable
20
20
  'ORDER BY CreatedDate';
21
21
  const ERROR_QUERY = "SELECT Message FROM Package2VersionCreateRequestError WHERE ParentRequest.Id = '%s'";
22
- const STATUSES = ['Queued', 'InProgress', 'Success', 'Error'];
23
- async function list(options = {}) {
24
- const whereClause = _constructWhere();
22
+ async function list(options) {
23
+ const whereClause = _constructWhere(options);
25
24
  return _query(util.format(QUERY, whereClause), options.connection);
26
25
  }
27
26
  exports.list = list;
@@ -62,23 +61,15 @@ async function _queryErrors(packageVersionCreateRequestId, connection) {
62
61
  function _constructWhere(options) {
63
62
  const where = [];
64
63
  // filter on created date, days ago: 0 for today, etc
65
- if (!util.isNullOrUndefined(this.options.createdlastdays)) {
64
+ if (options?.createdlastdays) {
66
65
  if (options.createdlastdays < 0) {
67
66
  throw messages.createError('invalidDaysNumber', ['createdlastdays', options.createdlastdays]);
68
67
  }
69
- where.push(`CreatedDate = LAST_N_DAYS:${this.options.createdlastdays}`);
68
+ where.push(`CreatedDate = LAST_N_DAYS:${options.createdlastdays}`);
70
69
  }
71
70
  // filter on errors
72
- if (options.status) {
73
- const foundStatus = STATUSES.find((status) => status.toLowerCase() === this.options.status.toLowerCase());
74
- if (!foundStatus) {
75
- const args = [options.status];
76
- STATUSES.forEach((status) => {
77
- args.push(status);
78
- });
79
- throw messages.createError('invalidStatus', args);
80
- }
81
- where.push(`Status = '${foundStatus}'`);
71
+ if (options?.status) {
72
+ where.push(`Status = '${options.status.toLowerCase()}'`);
82
73
  }
83
74
  return where.length > 0 ? `WHERE ${where.join(' AND ')}` : '';
84
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "packing libraries to Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",