@salesforce/packaging 0.0.4 → 0.0.7

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/constants.d.ts +21 -0
  3. package/lib/constants.js +40 -0
  4. package/lib/interfaces/packagingInterfacesAndType.d.ts +85 -4
  5. package/lib/interfaces/packagingSObjects.d.ts +2 -1
  6. package/lib/interfaces/packagingSObjects.js +0 -6
  7. package/lib/package/index.d.ts +4 -1
  8. package/lib/package/index.js +7 -2
  9. package/lib/package/packageConvert.d.ts +11 -0
  10. package/lib/package/packageConvert.js +84 -0
  11. package/lib/package/packageCreate.d.ts +26 -0
  12. package/lib/package/packageCreate.js +115 -0
  13. package/lib/package/packageDelete.d.ts +3 -0
  14. package/lib/package/packageDelete.js +26 -0
  15. package/lib/package/packageProfileApi.d.ts +59 -0
  16. package/lib/package/packageProfileApi.js +278 -0
  17. package/lib/package/packageVersion.d.ts +25 -0
  18. package/lib/package/packageVersion.js +73 -0
  19. package/lib/package/packageVersionCreate.d.ts +68 -0
  20. package/lib/package/packageVersionCreate.js +758 -0
  21. package/lib/package/packageVersionCreateRequest.d.ts +4 -0
  22. package/lib/package/packageVersionCreateRequest.js +85 -0
  23. package/lib/package/packageVersionList.d.ts +4 -24
  24. package/lib/package/packageVersionList.js +4 -5
  25. package/lib/utils/index.d.ts +1 -0
  26. package/lib/utils/index.js +1 -0
  27. package/lib/utils/packageUtils.d.ts +15 -14
  28. package/lib/utils/packageUtils.js +77 -39
  29. package/lib/utils/srcDevUtils.d.ts +12 -0
  30. package/lib/utils/srcDevUtils.js +66 -0
  31. package/lib/utils/versionNumber.d.ts +1 -0
  32. package/lib/utils/versionNumber.js +10 -5
  33. package/messages/messages.md +49 -0
  34. package/package.json +11 -16
  35. package/lib/package/packageVersion2GP.d.ts +0 -17
  36. package/lib/package/packageVersion2GP.js +0 -46
  37. package/lib/package/packageVersionCreateRequestApi.d.ts +0 -17
  38. package/lib/package/packageVersionCreateRequestApi.js +0 -92
@@ -189,3 +189,52 @@ Can’t create package version. Specifying an ancestor is available only for sec
189
189
 
190
190
  When calculating the number of items to be included in query "%s", when formatted, was too long.
191
191
  The item was (truncated): %s with a length of %s. The maximum length of items, when formatted is %s.
192
+
193
+ # unableToFindPackageWithId
194
+
195
+ Unable to find Package with Id: "%s"
196
+
197
+ # errorDuringSObjectCRUDOperation
198
+
199
+ An error occurred during CRUD operation %s on entity %s.
200
+ %s
201
+
202
+ # errorNoMatchingPackageDirectory
203
+
204
+ The %s value [%s], doesn’t match the %s value in any packageDirectories specified in sfdx-project.json.
205
+
206
+ # errorDirectoryIdMismatch
207
+
208
+ 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
+
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
219
+
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.
229
+
230
+ # packagingDirNotFoundInConfigFile
231
+
232
+ Config file %s does not contain a packaging directory for %s.
233
+
234
+ # unpackagedMDDirectoryDoesNotExist
235
+
236
+ Un-packaged metadata directory %s was specified but does not exist.
237
+
238
+ # directoryDoesNotExist
239
+
240
+ Directory %s does not exist.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "description": "packing libraries to Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -35,22 +35,18 @@
35
35
  "!lib/**/*.map"
36
36
  ],
37
37
  "dependencies": {
38
- "@salesforce/core": "^3.21.0",
38
+ "@salesforce/core": "^3.23.7",
39
39
  "@salesforce/kit": "^1.5.42",
40
40
  "@salesforce/schemas": "^1.2.0",
41
+ "@salesforce/source-deploy-retrieve": "^6.2.0",
41
42
  "@salesforce/ts-types": "^1.5.20",
42
- "@types/graceful-fs": "^4.1.5",
43
- "@types/mkdirp": "^1.0.2",
44
- "@types/semver": "^7.3.9",
45
- "ajv": "^8.11.0",
46
- "archiver": "^5.3.1",
47
- "change-case": "^4.1.2",
48
43
  "debug": "^4.3.4",
49
- "graceful-fs": "^4.2.10",
44
+ "globby": "^11",
50
45
  "js2xmlparser": "^4.0.2",
51
- "jsforce": "2.0.0-beta.10",
52
- "mkdirp": "1.0.4",
53
- "ts-retry-promise": "^0.6.1"
46
+ "jsforce": "2.0.0-beta.14",
47
+ "jszip": "^3.10.0",
48
+ "xml2js": "^0.4.23",
49
+ "xmldom-sfdx-encoding": "^0.1.30"
54
50
  },
55
51
  "devDependencies": {
56
52
  "@salesforce/cli-plugins-testkit": "^2.3.0",
@@ -58,11 +54,10 @@
58
54
  "@salesforce/dev-scripts": "^2.0.2",
59
55
  "@salesforce/prettier-config": "^0.0.2",
60
56
  "@salesforce/ts-sinon": "^1.3.21",
61
- "@types/archiver": "^5.3.1",
62
57
  "@types/debug": "4.1.7",
63
- "@types/jsen": "0.0.21",
64
- "@types/jsonwebtoken": "8.5.8",
65
- "@types/shelljs": "0.8.11",
58
+ "@types/globby": "^9.1.0",
59
+ "@types/jszip": "^3.4.1",
60
+ "@types/xml2js": "^0.4.11",
66
61
  "@typescript-eslint/eslint-plugin": "^5.27.1",
67
62
  "@typescript-eslint/parser": "5.27.1",
68
63
  "chai": "^4.3.6",
@@ -1,17 +0,0 @@
1
- import { AsyncCreatable } from '@salesforce/kit';
2
- import { IPackageVersion2GP, PackageVersion2Options } from '../interfaces';
3
- /**
4
- * Package2Version class - Class to be used with 2nd generation package versions
5
- */
6
- export declare class PackageVersion2GP extends AsyncCreatable<PackageVersion2Options> implements IPackageVersion2GP {
7
- private options;
8
- constructor(options: PackageVersion2Options);
9
- convert(): Promise<void>;
10
- create(): Promise<void>;
11
- delete(): Promise<void>;
12
- install(): Promise<void>;
13
- list(): Promise<void>;
14
- uninstall(): Promise<void>;
15
- update(): Promise<void>;
16
- protected init(): Promise<void>;
17
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PackageVersion2GP = void 0;
4
- /*
5
- * Copyright (c) 2022, 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
- const kit_1 = require("@salesforce/kit");
11
- /**
12
- * Package2Version class - Class to be used with 2nd generation package versions
13
- */
14
- class PackageVersion2GP extends kit_1.AsyncCreatable {
15
- // @ts-ignore
16
- constructor(options) {
17
- super(options);
18
- this.options = options;
19
- }
20
- convert() {
21
- return Promise.resolve(undefined);
22
- }
23
- create() {
24
- return Promise.resolve(undefined);
25
- }
26
- delete() {
27
- return Promise.resolve(undefined);
28
- }
29
- install() {
30
- return Promise.resolve(undefined);
31
- }
32
- list() {
33
- return Promise.resolve(undefined);
34
- }
35
- uninstall() {
36
- return Promise.resolve(undefined);
37
- }
38
- update() {
39
- return Promise.resolve(undefined);
40
- }
41
- init() {
42
- return Promise.resolve(undefined);
43
- }
44
- }
45
- exports.PackageVersion2GP = PackageVersion2GP;
46
- //# sourceMappingURL=packageVersion2GP.js.map
@@ -1,17 +0,0 @@
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 {};
@@ -1,92 +0,0 @@
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