@salesforce/packaging 1.4.19 → 1.5.0

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.
@@ -31,6 +31,7 @@ export type PackageUpdateOptions = {
31
31
  Name?: string;
32
32
  Description?: string;
33
33
  PackageErrorUsername?: string;
34
+ AppAnalyticsEnabled?: boolean;
34
35
  };
35
36
  export type PackageIdType = 'PackageId' | 'SubscriberPackageVersionId' | 'PackageInstallRequestId' | 'PackageUninstallRequestId';
36
37
  export type PackageVersionOptions1GP = Record<string, unknown>;
@@ -18,6 +18,7 @@ export declare namespace PackagingSObjects {
18
18
  IsOrgDependent: boolean;
19
19
  ConvertedFromPackageId: string;
20
20
  PackageErrorUsername: string;
21
+ AppAnalyticsEnabled?: boolean;
21
22
  };
22
23
  type Package2Version = {
23
24
  Id: string;
@@ -69,6 +69,7 @@ export declare class Package {
69
69
  * @param project
70
70
  */
71
71
  static convert(pkgId: string, connection: Connection, options: ConvertPackageOptions, project?: SfProject): Promise<PackageVersionCreateRequestResult>;
72
+ private static getPackage2Fields;
72
73
  /**
73
74
  * Returns the package ID of the package.
74
75
  *
@@ -39,6 +39,7 @@ exports.Package2Fields = [
39
39
  'IsOrgDependent',
40
40
  'ConvertedFromPackageId',
41
41
  'PackageErrorUsername',
42
+ 'AppAnalyticsEnabled',
42
43
  ];
43
44
  /**
44
45
  * Provides the ability to list, create, update, delete, convert, and get version
@@ -93,7 +94,7 @@ class Package {
93
94
  * @param connection
94
95
  */
95
96
  static async list(connection) {
96
- return (await connection.tooling.query(`select ${exports.Package2Fields.toString()} from Package2 ORDER BY NamespacePrefix, Name`, {
97
+ return (await connection.tooling.query(`select ${this.getPackage2Fields(connection).toString()} from Package2 ORDER BY NamespacePrefix, Name`, {
97
98
  autoFetch: true,
98
99
  maxFetch: 10000,
99
100
  }))?.records;
@@ -149,6 +150,10 @@ class Package {
149
150
  static async convert(pkgId, connection, options, project) {
150
151
  return (0, packageConvert_1.convertPackage)(pkgId, connection, options, project);
151
152
  }
153
+ static getPackage2Fields(connection) {
154
+ const apiVersion = connection.getApiVersion();
155
+ return exports.Package2Fields.filter((field) => (apiVersion >= '59.0' ? true : field !== 'AppAnalyticsEnabled'));
156
+ }
152
157
  /**
153
158
  * Returns the package ID of the package.
154
159
  *
@@ -205,6 +210,9 @@ class Package {
205
210
  try {
206
211
  // filter out any undefined values and their keys
207
212
  const opts = Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));
213
+ if (opts.AppAnalyticsEnabled !== undefined && this.options.connection.getApiVersion() < '59.0') {
214
+ throw messages.createError('appAnalyticsEnabledApiPriorTo59Error');
215
+ }
208
216
  const result = await this.options.connection.tooling.update('Package2', opts);
209
217
  if (!result.success) {
210
218
  throw new core_1.SfError(result.errors.join(', '));
@@ -21,3 +21,7 @@ Package alias %s not found in project.
21
21
  # packageNotFound
22
22
 
23
23
  A package with id %s was not found.
24
+
25
+ # appAnalyticsEnabledApiPriorTo59Error
26
+
27
+ Enabling App Analytics is only possible with API version 59.0 or higher.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "1.4.19",
3
+ "version": "1.5.0",
4
4
  "description": "Packaging library for the Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -39,7 +39,7 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "@oclif/core": "^2.8.2",
42
- "@salesforce/core": "^3.35.0",
42
+ "@salesforce/core": "^3.36.0",
43
43
  "@salesforce/kit": "^1.9.2",
44
44
  "@salesforce/schemas": "^1.5.1",
45
45
  "@salesforce/source-deploy-retrieve": "^8.0.4",
@@ -60,7 +60,7 @@
60
60
  "devDependencies": {
61
61
  "@salesforce/cli-plugins-testkit": "^3.3.4",
62
62
  "@salesforce/dev-config": "^3.1.0",
63
- "@salesforce/dev-scripts": "^4.3.0",
63
+ "@salesforce/dev-scripts": "^4.3.1",
64
64
  "@salesforce/prettier-config": "^0.0.2",
65
65
  "@salesforce/ts-sinon": "^1.4.6",
66
66
  "@types/debug": "4.1.7",
@@ -78,7 +78,7 @@
78
78
  "eslint-config-salesforce-typescript": "^1.1.1",
79
79
  "eslint-plugin-header": "3.1.1",
80
80
  "eslint-plugin-import": "^2.27.5",
81
- "eslint-plugin-jsdoc": "^41.1.1",
81
+ "eslint-plugin-jsdoc": "^41.1.2",
82
82
  "eslint-plugin-sf-plugin": "^1.15.1",
83
83
  "husky": "^8.0.3",
84
84
  "mocha": "^10.2.0",