Skip to content

Commit e8db083

Browse files
committed
fix: fix schedule based on comments
1 parent 524f59d commit e8db083

File tree

3 files changed

+7
-111
lines changed

3 files changed

+7
-111
lines changed

command-snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
{
199199
"alias": [],
200200
"command": "package:pushupgrade:schedule",
201-
"flagAliases": ["target-hub-org", "targetdevhubusername"],
201+
"flagAliases": ["targetdevhubusername"],
202202
"flagChars": ["l", "p", "t", "v"],
203203
"flags": [
204204
"api-version",
Lines changed: 1 addition & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$ref": "#/definitions/PushScheduleResult",
3+
"$ref": "#/definitions/PackagePushScheduleResult",
44
"definitions": {
5-
"PushScheduleResult": {
6-
"anyOf": [
7-
{
8-
"$ref": "#/definitions/PackagePushScheduleResult"
9-
},
10-
{
11-
"$ref": "#/definitions/SfError"
12-
}
13-
]
14-
},
155
"PackagePushScheduleResult": {
166
"type": "object",
177
"properties": {
@@ -27,93 +17,6 @@
2717
},
2818
"required": ["PushRequestId", "ScheduledStartTime", "Status"],
2919
"additionalProperties": false
30-
},
31-
"SfError": {
32-
"type": "object",
33-
"properties": {
34-
"name": {
35-
"type": "string"
36-
},
37-
"message": {
38-
"type": "string"
39-
},
40-
"stack": {
41-
"type": "string"
42-
},
43-
"actions": {
44-
"type": "array",
45-
"items": {
46-
"type": "string"
47-
},
48-
"description": "Action messages. Hints to the users regarding what can be done to fix related issues."
49-
},
50-
"exitCode": {
51-
"type": "number",
52-
"description": "SfdxCommand can return this process exit code."
53-
},
54-
"context": {
55-
"type": "string",
56-
"description": "The related context for this error."
57-
},
58-
"data": {
59-
"$ref": "#/definitions/AnyJson"
60-
}
61-
},
62-
"required": ["exitCode", "message", "name"],
63-
"additionalProperties": false,
64-
"description": "A generalized sfdx error which also contains an action. The action is used in the CLI to help guide users past the error.\n\nTo throw an error in a synchronous function you must either pass the error message and actions directly to the constructor, e.g.\n\n``` // To load a message bundle (Note that __dirname should contain a messages folder) Messages.importMessagesDirectory(__dirname); const messages = Messages.load('myPackageName', 'myBundleName');\n\n// To throw a non-bundle based error: throw new SfError(message.getMessage('myError'), 'MyErrorName'); ```"
65-
},
66-
"AnyJson": {
67-
"anyOf": [
68-
{
69-
"$ref": "#/definitions/JsonPrimitive"
70-
},
71-
{
72-
"$ref": "#/definitions/JsonCollection"
73-
}
74-
],
75-
"description": "Any valid JSON value."
76-
},
77-
"JsonPrimitive": {
78-
"type": ["null", "boolean", "number", "string"],
79-
"description": "Any valid JSON primitive value."
80-
},
81-
"JsonCollection": {
82-
"anyOf": [
83-
{
84-
"$ref": "#/definitions/JsonMap"
85-
},
86-
{
87-
"$ref": "#/definitions/JsonArray"
88-
}
89-
],
90-
"description": "Any valid JSON collection value."
91-
},
92-
"JsonMap": {
93-
"type": "object",
94-
"additionalProperties": {
95-
"$ref": "#/definitions/Optional%3CAnyJson%3E"
96-
},
97-
"properties": {},
98-
"description": "Any JSON-compatible object."
99-
},
100-
"Optional<AnyJson>": {
101-
"anyOf": [
102-
{
103-
"$ref": "#/definitions/AnyJson"
104-
},
105-
{
106-
"not": {}
107-
}
108-
],
109-
"description": "A union type for either the parameterized type `T` or `undefined` -- the opposite of {@link NonOptional } ."
110-
},
111-
"JsonArray": {
112-
"type": "array",
113-
"items": {
114-
"$ref": "#/definitions/AnyJson"
115-
},
116-
"description": "Any JSON-compatible array."
11720
}
11821
}
11922
}

src/commands/package/pushupgrade/schedule.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,21 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
import fs from 'node:fs/promises';
8-
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
8+
import { Flags, SfCommand, requiredHubFlagWithDeprecations } from '@salesforce/sf-plugins-core';
99
import { Messages, SfError } from '@salesforce/core';
1010
import { PackagePushScheduleResult, PackagePushUpgrade } from '@salesforce/packaging';
11-
import { requiredHubFlag } from '../../../utils/hubFlag.js';
1211

1312
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
1413
const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package_pushupgrade_schedule');
1514

16-
export type PushScheduleResult = PackagePushScheduleResult | SfError;
17-
18-
export class PackagePushScheduleCommand extends SfCommand<PushScheduleResult> {
15+
export class PackagePushScheduleCommand extends SfCommand<PackagePushScheduleResult> {
1916
public static readonly summary = messages.getMessage('summary');
2017
public static readonly description = messages.getMessage('description');
2118
public static readonly examples = messages.getMessages('examples');
2219
public static readonly hidden = true;
2320
public static state = 'beta';
2421
public static readonly flags = {
25-
'target-dev-hub': requiredHubFlag,
22+
'target-dev-hub': requiredHubFlagWithDeprecations,
2623
'api-version': Flags.orgApiVersion(),
2724
'package-version-id': Flags.salesforceId({
2825
length: 'both',
@@ -43,7 +40,7 @@ export class PackagePushScheduleCommand extends SfCommand<PushScheduleResult> {
4340
}),
4441
};
4542

46-
public async run(): Promise<PushScheduleResult> {
43+
public async run(): Promise<PackagePushScheduleResult> {
4744
const { flags } = await this.parse(PackagePushScheduleCommand);
4845

4946
// Read and validate org list
@@ -60,11 +57,7 @@ export class PackagePushScheduleCommand extends SfCommand<PushScheduleResult> {
6057
orgList
6158
);
6259

63-
if ((result as PushScheduleResult) && !(result instanceof SfError)) {
64-
this.log(messages.getMessage('output', [result?.PushRequestId]));
65-
} else {
66-
throw result;
67-
}
60+
this.log(messages.getMessage('output', [result?.PushRequestId]));
6861

6962
return result;
7063
}

0 commit comments

Comments
 (0)