@salesforce/core 6.1.4 → 6.2.1

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/lib/sfError.d.ts CHANGED
@@ -16,7 +16,7 @@ import { JsonMap } from '@salesforce/ts-types';
16
16
  * throw new SfError(message.getMessage('myError'), 'MyErrorName');
17
17
  * ```
18
18
  */
19
- export declare class SfError extends NamedError {
19
+ export declare class SfError<T = unknown> extends NamedError {
20
20
  #private;
21
21
  /**
22
22
  * Action messages. Hints to the users regarding what can be done to fix related issues.
@@ -30,7 +30,7 @@ export declare class SfError extends NamedError {
30
30
  * The related context for this error.
31
31
  */
32
32
  context?: string;
33
- data?: unknown;
33
+ data?: T;
34
34
  /**
35
35
  * Create an SfError.
36
36
  *
@@ -60,7 +60,7 @@ export declare class SfError extends NamedError {
60
60
  *
61
61
  * @param data The payload data.
62
62
  */
63
- setData(data: unknown): SfError;
63
+ setData(data: T): SfError;
64
64
  /**
65
65
  * Convert an {@link SfError} state to an object. Returns a plain object representing the state of this error.
66
66
  */
package/lib/sfError.js CHANGED
@@ -112,7 +112,7 @@ class SfError extends kit_1.NamedError {
112
112
  toObject() {
113
113
  const obj = {
114
114
  name: this.name,
115
- message: this.message || this.name,
115
+ message: this.message ?? this.name,
116
116
  exitCode: this.exitCode,
117
117
  actions: this.actions,
118
118
  };
@@ -120,7 +120,9 @@ class SfError extends kit_1.NamedError {
120
120
  obj.context = this.context;
121
121
  }
122
122
  if (this.data) {
123
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
123
+ // DANGER: data was previously typed as `unknown` and this assertion was here on the toObject.
124
+ // TODO in next major release: put proper type constraint on SfError.data to something that can serialize
125
+ // while we're making breaking changes, provide a more definite type for toObject
124
126
  obj.data = this.data;
125
127
  }
126
128
  return obj;
@@ -269,7 +269,7 @@ export declare const restoreContext: (testContext: TestContext) => void;
269
269
  *
270
270
  * **See** {@link shouldThrow}
271
271
  */
272
- export declare const unexpectedResult: SfError;
272
+ export declare const unexpectedResult: SfError<unknown>;
273
273
  /**
274
274
  * Use for this testing pattern:
275
275
  * ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "6.1.4",
3
+ "version": "6.2.1",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -41,7 +41,7 @@
41
41
  "@salesforce/kit": "^3.0.15",
42
42
  "@salesforce/schemas": "^1.6.1",
43
43
  "@salesforce/ts-types": "^2.0.9",
44
- "@types/semver": "^7.5.4",
44
+ "@types/semver": "^7.5.6",
45
45
  "ajv": "^8.12.0",
46
46
  "change-case": "^4.1.2",
47
47
  "faye": "^1.4.0",
@@ -58,12 +58,12 @@
58
58
  "ts-retry-promise": "^0.7.1"
59
59
  },
60
60
  "devDependencies": {
61
- "@salesforce/dev-scripts": "^6.0.4",
61
+ "@salesforce/dev-scripts": "^7.1.1",
62
62
  "@salesforce/ts-sinon": "^1.4.19",
63
- "@types/benchmark": "^2.1.3",
63
+ "@types/benchmark": "^2.1.5",
64
64
  "@types/chai-string": "^1.4.5",
65
65
  "@types/jsonwebtoken": "9.0.5",
66
- "@types/proper-lockfile": "^4.1.2",
66
+ "@types/proper-lockfile": "^4.1.4",
67
67
  "benchmark": "^2.1.4",
68
68
  "chai-string": "^1.5.0",
69
69
  "ts-node": "^10.9.1",