sf-raven 1.1.0 → 1.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/README.md +88 -45
- package/lib/commands/raven/deploy/cancel.d.ts +15 -0
- package/lib/commands/raven/deploy/cancel.js +185 -0
- package/lib/commands/raven/deploy/cancel.js.map +1 -0
- package/lib/commands/raven/object/display/fields.d.ts +1 -0
- package/lib/commands/raven/object/display/fields.js +82 -20
- package/lib/commands/raven/object/display/fields.js.map +1 -1
- package/lib/commands/raven/object/display/recordtypes.d.ts +1 -0
- package/lib/commands/raven/object/display/recordtypes.js +82 -20
- package/lib/commands/raven/object/display/recordtypes.js.map +1 -1
- package/lib/commands/raven/query/ids.d.ts +28 -0
- package/lib/commands/raven/query/ids.js +246 -0
- package/lib/commands/raven/query/ids.js.map +1 -0
- package/messages/raven.deploy.cancel.md +73 -0
- package/messages/raven.object.display.fields.md +13 -1
- package/messages/raven.object.display.recordtypes.md +13 -1
- package/messages/raven.query.ids.md +85 -0
- package/oclif.lock +217 -233
- package/oclif.manifest.json +170 -132
- package/package.json +18 -1
- package/lib/commands/raven/query.d.ts +0 -22
- package/lib/commands/raven/query.js +0 -115
- package/lib/commands/raven/query.js.map +0 -1
- package/messages/raven.query.md +0 -59
package/README.md
CHANGED
|
@@ -6,22 +6,6 @@ A plugin for the Salesforce CLI built by Tom Carman.
|
|
|
6
6
|
|
|
7
7
|
[sf-raven](https://github.com/tomcarman/sf-raven) now replaces [sfdx-raven](https://github.com/tomcarman/sfdx-raven/).
|
|
8
8
|
|
|
9
|
-
## Why a new plugin?
|
|
10
|
-
|
|
11
|
-
I originally built [sfdx-raven](https://github.com/tomcarman/sfdx-raven/) in 2020, but the Salesforce CLI landscape has changed a lot since then. Rather than attempting to [migrate the original plugin from sfdx to sf](https://github.com/salesforcecli/cli/wiki/Migrate-Plugins-Built-for-sfdx), it felt cleaner to start a new project and leverage the new architecture and scaffolding tools that come with the new sf cli.
|
|
12
|
-
|
|
13
|
-
## Improvements over sfdx-raven
|
|
14
|
-
|
|
15
|
-
- Built on [sf not sfdx](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_move_to_sf_v2.htm).
|
|
16
|
-
- Uses the latest version of [oclif](https://oclif.io/blog/2022/01/12/announcing-oclif-v2/).
|
|
17
|
-
- Commands now follow the [sf command structure](https://github.com/salesforcecli/cli/wiki/Design-Guidelines#Command-Structure) guidelines - `<topic> <action> <resource | sub-action> [flags]`. For example:
|
|
18
|
-
- `info:fields` becomes `object display fields`
|
|
19
|
-
- `utils:event:listen` becomes `event subscribe`
|
|
20
|
-
- Code now meets ESlint rules for TypeScript, including the Salesforce CLI Plugin custom rules.
|
|
21
|
-
- The [Salesforce tooling / documentation](https://github.com/salesforcecli/cli/wiki/Code-Your-Plugin) for building custom plugins has matured a lot over the past couple years, which will make it easier to update the plugin going forward.
|
|
22
|
-
|
|
23
|
-
More commands will be ported/added over time - see [Todo](#Todo).
|
|
24
|
-
|
|
25
9
|
## Command Quick Reference
|
|
26
10
|
|
|
27
11
|
Full details, usage, examples etc are further down, or can be accessed via `--help` on the commands.
|
|
@@ -41,14 +25,24 @@ Full details, usage, examples etc are further down, or can be accessed via `--he
|
|
|
41
25
|
#### sf raven event
|
|
42
26
|
|
|
43
27
|
- [sf raven event subscribe](#sf-raven-event-subscribe)
|
|
44
|
-
- Subscribe to Platform Events.
|
|
28
|
+
- Subscribe to Platform Events, streamed to your terminal.
|
|
29
|
+
|
|
30
|
+
#### sf raven deploy
|
|
31
|
+
|
|
32
|
+
- [sf raven deploy cancel](#sf-raven-deploy-cancel)
|
|
33
|
+
- Query an org for pending or in progress Salesforce deployments, and cancel them.
|
|
34
|
+
|
|
35
|
+
#### sf raven query
|
|
36
|
+
|
|
37
|
+
- [sf raven query ids](#sf-raven-query-ids)
|
|
38
|
+
- Run a SOQL query against a large list of Salesforce IDs.
|
|
45
39
|
|
|
46
40
|
#### sf raven pull
|
|
47
41
|
|
|
48
42
|
- [sf raven pull](#sf-raven-pull)
|
|
49
|
-
-
|
|
43
|
+
- Update Salesforce metadata into the local project via a fuzzy finder.
|
|
50
44
|
- [sf raven pull remote](#sf-raven-pull-remote)
|
|
51
|
-
-
|
|
45
|
+
- Retrieve Salesforce metadata that exists in the org but not locally, via a fuzzy finder.
|
|
52
46
|
|
|
53
47
|
<!-- #### sfdx:raven:utils
|
|
54
48
|
* [sfdx raven:utils:deploy:branch2org](#sfdx-ravenutilsdeploybranch2org)
|
|
@@ -60,6 +54,9 @@ Full details, usage, examples etc are further down, or can be accessed via `--he
|
|
|
60
54
|
|
|
61
55
|
## Setup
|
|
62
56
|
|
|
57
|
+
### Dependencies
|
|
58
|
+
* [fzf](https://github.com/junegunn/fzf) is required for the [sf raven pull](#sf-raven-pull) commands, and should be available on your path. (IMO they are probably the most useful commands in this plugin, so its worth setting up fzf if you don't have it.)
|
|
59
|
+
|
|
63
60
|
### Quick Install
|
|
64
61
|
|
|
65
62
|
Assuming you already have the [sf cli](https://developer.salesforce.com/tools/salesforcecli) installed, the plugin can be installed by running:
|
|
@@ -86,36 +83,18 @@ The plugin can be updated to the latest version using
|
|
|
86
83
|
- **macOS**
|
|
87
84
|
- Plugin has been built on macOS and will always run on macOS
|
|
88
85
|
|
|
89
|
-
<!-- * **Windows**
|
|
90
|
-
* Work on Windows 10 1803+ (this is that latest build I have access to)
|
|
91
|
-
* Known Issues:
|
|
92
|
-
* Emoji will not work in cmd.exe / powershell - so you may seem some funny characters when running the plugin - this can be ignored. Emoji may work in Windows Terminal, but I have not managed to test yet
|
|
93
|
-
* I don't think 'diff' is available on windows cli, so `sfdx:raven:utils:diff` is not likely to work.
|
|
94
|
-
|
|
95
|
-
* **Linux**
|
|
96
|
-
* Only tested on an Ubuntu installation on [WSL](https://docs.microsoft.com/en-us/windows/wsl/about), but should work. -->
|
|
97
|
-
|
|
98
|
-
## Todo
|
|
99
|
-
|
|
100
|
-
- Migrate remaining commands from [sfdx-raven](https://github.com/tomcarman/sfdx-raven/)
|
|
101
|
-
- sfdx raven:utils:deploy:branch2org
|
|
102
|
-
- sfdx raven:utils:diff
|
|
103
|
-
- sfdx raven:utils:dashboarduser:update - tbc
|
|
104
|
-
- Get the sObject Type for a given Id
|
|
105
|
-
- Get the picklist values for a given picklist
|
|
106
|
-
- Clone a record
|
|
107
|
-
|
|
108
86
|
## sf raven object display fields
|
|
109
87
|
|
|
110
88
|
Show field information for a given sObject.
|
|
111
89
|
|
|
112
90
|
```
|
|
113
91
|
USAGE
|
|
114
|
-
$ sf raven object display fields -o <value> -s <value> [--json]
|
|
92
|
+
$ sf raven object display fields -o <value> -s <value> [--json] [-c <value>]
|
|
115
93
|
|
|
116
94
|
FLAGS
|
|
95
|
+
-c, --csv=<value> Path to write field information as CSV. When supplied, table output is suppressed.
|
|
117
96
|
-o, --target-org=<value> (required) Login username or alias for the target org.
|
|
118
|
-
-s, --sobject=<value> (required) The API name of the sObject that you want to view fields for.
|
|
97
|
+
-s, --sobject=<value> (required) The API name of the sObject that you want to view fields for. Use a comma-delimited list to query multiple objects.
|
|
119
98
|
|
|
120
99
|
GLOBAL FLAGS
|
|
121
100
|
--json Format output as json.
|
|
@@ -130,6 +109,10 @@ EXAMPLES
|
|
|
130
109
|
|
|
131
110
|
$ sf raven object display fields --target-org dev --sobject My_Custom_Object__c
|
|
132
111
|
|
|
112
|
+
$ sf raven object display fields --target-org dev --sobject Account,Contact
|
|
113
|
+
|
|
114
|
+
$ sf raven object display fields --target-org dev --sobject Account --csv account-fields.csv
|
|
115
|
+
|
|
133
116
|
|
|
134
117
|
OUTPUT
|
|
135
118
|
|
|
@@ -147,11 +130,12 @@ Show RecordType information for a given sObject.
|
|
|
147
130
|
|
|
148
131
|
```
|
|
149
132
|
USAGE
|
|
150
|
-
$ sf raven object display recordtypes -o <value> -s <value> [--json]
|
|
133
|
+
$ sf raven object display recordtypes -o <value> -s <value> [--json] [-c <value>]
|
|
151
134
|
|
|
152
135
|
FLAGS
|
|
136
|
+
-c, --csv=<value> Path to write Record Type information as CSV. When supplied, table output is suppressed.
|
|
153
137
|
-o, --target-org=<value> (required) Login username or alias for the target org.
|
|
154
|
-
-s, --sobject=<value> (required) The API name of the sObject that you want to view Record Types for.
|
|
138
|
+
-s, --sobject=<value> (required) The API name of the sObject that you want to view Record Types for. Use a comma-delimited list to query multiple objects.
|
|
155
139
|
|
|
156
140
|
GLOBAL FLAGS
|
|
157
141
|
--json Format output as json.
|
|
@@ -166,6 +150,10 @@ EXAMPLES
|
|
|
166
150
|
|
|
167
151
|
$ sf raven object display recordtypes --target-org dev --sobject My_Custom_Object__c
|
|
168
152
|
|
|
153
|
+
$ sf raven object display recordtypes --target-org dev --sobject Account,Opportunity
|
|
154
|
+
|
|
155
|
+
$ sf raven object display recordtypes --target-org dev --sobject Account --csv account-record-types.csv
|
|
156
|
+
|
|
169
157
|
|
|
170
158
|
OUTPUT
|
|
171
159
|
|
|
@@ -178,7 +166,7 @@ Person Account PersonAccount 0124J000000YYYYDEF
|
|
|
178
166
|
|
|
179
167
|
## sf raven pull
|
|
180
168
|
|
|
181
|
-
|
|
169
|
+
Update Salesforce metadata into the local project via a fuzzy finder.
|
|
182
170
|
|
|
183
171
|
```
|
|
184
172
|
USAGE
|
|
@@ -206,7 +194,7 @@ EXAMPLES
|
|
|
206
194
|
|
|
207
195
|
## sf raven pull remote
|
|
208
196
|
|
|
209
|
-
|
|
197
|
+
Retrieve Salesforce metadata that exists in the org but not locally, via a fuzzy finder.
|
|
210
198
|
|
|
211
199
|
```
|
|
212
200
|
USAGE
|
|
@@ -227,6 +215,61 @@ EXAMPLES
|
|
|
227
215
|
$ sf raven pull remote --target-org dev
|
|
228
216
|
```
|
|
229
217
|
|
|
218
|
+
## sf raven deploy cancel
|
|
219
|
+
|
|
220
|
+
Cancel a pending or in-progress Salesforce deploy.
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
USAGE
|
|
224
|
+
$ sf raven deploy cancel [--json] [-o <value>]
|
|
225
|
+
|
|
226
|
+
FLAGS
|
|
227
|
+
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
|
|
228
|
+
|
|
229
|
+
GLOBAL FLAGS
|
|
230
|
+
--json Format output as json.
|
|
231
|
+
|
|
232
|
+
DESCRIPTION
|
|
233
|
+
Query the target org for pending or in-progress deploy requests, select one from an interactive list, confirm the cancellation, and submit an asynchronous deploy cancel request.
|
|
234
|
+
|
|
235
|
+
EXAMPLES
|
|
236
|
+
$ sf raven deploy cancel
|
|
237
|
+
|
|
238
|
+
$ sf raven deploy cancel --target-org dev
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## sf raven query ids
|
|
242
|
+
|
|
243
|
+
Run a SOQL query against a large list of Salesforce IDs.
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
USAGE
|
|
247
|
+
$ sf raven query ids -f <value> -q <value> [--json] [-o <value>] [-b <value>] [-c <value>] [-l <value>]
|
|
248
|
+
|
|
249
|
+
FLAGS
|
|
250
|
+
-b, --batch-size=<value> Number of IDs to include in each query batch. By default, batches are sized to fit Salesforce URI limits.
|
|
251
|
+
-c, --csv=<value> Path to write query results as CSV. When supplied, table output is suppressed.
|
|
252
|
+
-f, --file=<value> (required) Path to a file containing one Salesforce ID per row.
|
|
253
|
+
-l, --limit=<value> Process only the first N unique valid IDs from the file.
|
|
254
|
+
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
|
|
255
|
+
-q, --query=<value> (required) SOQL query to run. Must include the {ids} placeholder where the ID list should be inserted.
|
|
256
|
+
|
|
257
|
+
GLOBAL FLAGS
|
|
258
|
+
--json Format output as json.
|
|
259
|
+
|
|
260
|
+
DESCRIPTION
|
|
261
|
+
Read Salesforce IDs from a file, deduplicate and validate them, split them into safe query batches, and run a SOQL query with the IDs inserted at the {ids} placeholder.
|
|
262
|
+
|
|
263
|
+
EXAMPLES
|
|
264
|
+
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}"
|
|
265
|
+
|
|
266
|
+
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Opportunity WHERE AccountId IN {ids}"
|
|
267
|
+
|
|
268
|
+
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --limit 25
|
|
269
|
+
|
|
270
|
+
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --csv results.csv
|
|
271
|
+
```
|
|
272
|
+
|
|
230
273
|
## sf raven audit display
|
|
231
274
|
|
|
232
275
|
Show recent entries in the Setup Audit Trail.
|
|
@@ -269,7 +312,7 @@ Date Username Type Action
|
|
|
269
312
|
|
|
270
313
|
## sf raven event subscribe
|
|
271
314
|
|
|
272
|
-
Subscribe to Platform Events.
|
|
315
|
+
Subscribe to Platform Events, streamed to your terminal.
|
|
273
316
|
|
|
274
317
|
```
|
|
275
318
|
USAGE
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type DeployCancelResult = {
|
|
3
|
+
cancelled: boolean;
|
|
4
|
+
jobId?: string;
|
|
5
|
+
targetOrg?: string;
|
|
6
|
+
};
|
|
7
|
+
export default class DeployCancel extends SfCommand<DeployCancelResult> {
|
|
8
|
+
static readonly summary: string;
|
|
9
|
+
static readonly description: string;
|
|
10
|
+
static readonly examples: string[];
|
|
11
|
+
static readonly flags: {
|
|
12
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<DeployCancelResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { spawn } from 'node:child_process';
|
|
11
|
+
import select, { Separator } from '@inquirer/select';
|
|
12
|
+
import { Messages } from '@salesforce/core';
|
|
13
|
+
import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core';
|
|
14
|
+
import dayjs from 'dayjs';
|
|
15
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
16
|
+
const messages = Messages.loadMessages('sf-raven', 'raven.deploy.cancel');
|
|
17
|
+
const cancelSelection = 'cancel';
|
|
18
|
+
class DeployCancel extends SfCommand {
|
|
19
|
+
run() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const { flags } = yield this.parse(DeployCancel);
|
|
22
|
+
const ux = new Ux({ jsonEnabled: this.jsonEnabled() });
|
|
23
|
+
const org = flags['target-org'];
|
|
24
|
+
if (org == null) {
|
|
25
|
+
throw messages.createError('error.noTargetOrg');
|
|
26
|
+
}
|
|
27
|
+
const targetOrg = org.getUsername();
|
|
28
|
+
if (targetOrg == null) {
|
|
29
|
+
throw messages.createError('error.noTargetOrg');
|
|
30
|
+
}
|
|
31
|
+
ux.spinner.start(messages.getMessage('info.loadingDeploys'));
|
|
32
|
+
let deployRequests;
|
|
33
|
+
try {
|
|
34
|
+
deployRequests = yield getActiveDeployRequests(org.getConnection());
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
ux.spinner.stop();
|
|
38
|
+
}
|
|
39
|
+
if (deployRequests.length === 0) {
|
|
40
|
+
ux.log(messages.getMessage('info.noDeploys'));
|
|
41
|
+
return {
|
|
42
|
+
cancelled: false,
|
|
43
|
+
targetOrg,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const selectedDeployRequest = yield selectDeployRequest(deployRequests);
|
|
47
|
+
if (selectedDeployRequest === cancelSelection || selectedDeployRequest == null) {
|
|
48
|
+
ux.log(messages.getMessage('info.noSelection'));
|
|
49
|
+
return {
|
|
50
|
+
cancelled: false,
|
|
51
|
+
targetOrg,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const confirmed = yield this.confirm({
|
|
55
|
+
message: messages.getMessage('prompt.confirmCancel', [selectedDeployRequest.Id]),
|
|
56
|
+
defaultAnswer: false,
|
|
57
|
+
});
|
|
58
|
+
if (!confirmed) {
|
|
59
|
+
ux.log(messages.getMessage('info.cancelAborted'));
|
|
60
|
+
return {
|
|
61
|
+
cancelled: false,
|
|
62
|
+
jobId: selectedDeployRequest.Id,
|
|
63
|
+
targetOrg,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const exitCode = yield cancelDeploy(selectedDeployRequest.Id, targetOrg);
|
|
67
|
+
if (exitCode !== 0) {
|
|
68
|
+
throw messages.createError('error.cancelFailed', [exitCode.toString()]);
|
|
69
|
+
}
|
|
70
|
+
ux.log(messages.getMessage('info.cancelSubmitted', [selectedDeployRequest.Id]));
|
|
71
|
+
return {
|
|
72
|
+
cancelled: true,
|
|
73
|
+
jobId: selectedDeployRequest.Id,
|
|
74
|
+
targetOrg,
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
DeployCancel.summary = messages.getMessage('summary');
|
|
80
|
+
DeployCancel.description = messages.getMessage('description');
|
|
81
|
+
DeployCancel.examples = messages.getMessages('examples');
|
|
82
|
+
DeployCancel.flags = {
|
|
83
|
+
'target-org': Flags.optionalOrg({
|
|
84
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
85
|
+
char: 'o',
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
export default DeployCancel;
|
|
89
|
+
const getActiveDeployRequests = (connection) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
const result = yield connection.tooling.query(`
|
|
91
|
+
SELECT Id, Status, StartDate,
|
|
92
|
+
NumberComponentsDeployed, NumberComponentsTotal, NumberComponentErrors,
|
|
93
|
+
NumberTestsCompleted, NumberTestsTotal, NumberTestErrors
|
|
94
|
+
FROM DeployRequest
|
|
95
|
+
WHERE Status IN ('InProgress', 'Pending')
|
|
96
|
+
ORDER BY StartDate DESC
|
|
97
|
+
`);
|
|
98
|
+
return result.records;
|
|
99
|
+
});
|
|
100
|
+
const formatDeployRequest = (deployRequest) => {
|
|
101
|
+
if (deployRequest.Status === 'Pending') {
|
|
102
|
+
return [deployRequest.Status, deployRequest.Id].join(' | ');
|
|
103
|
+
}
|
|
104
|
+
const startDate = deployRequest.StartDate == null ? messages.getMessage('label.unknownStartDate') : dayjs(deployRequest.StartDate).format('DD/MM/YYYY HH:mm');
|
|
105
|
+
return [
|
|
106
|
+
startDate,
|
|
107
|
+
deployRequest.Status,
|
|
108
|
+
deployRequest.Id,
|
|
109
|
+
`Metadata: ${formatProgress(deployRequest.NumberComponentsDeployed, deployRequest.NumberComponentsTotal, deployRequest.NumberComponentErrors)}`,
|
|
110
|
+
`Apex Tests: ${formatProgress(deployRequest.NumberTestsCompleted, deployRequest.NumberTestsTotal, deployRequest.NumberTestErrors)}`,
|
|
111
|
+
].join(' | ');
|
|
112
|
+
};
|
|
113
|
+
const selectDeployRequest = (deployRequests) => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
try {
|
|
115
|
+
return yield select({
|
|
116
|
+
message: messages.getMessage('prompt.selectDeploy'),
|
|
117
|
+
choices: getDeployChoices(deployRequests),
|
|
118
|
+
pageSize: 10,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (isPromptForceCloseError(error)) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const getDeployChoices = (deployRequests) => {
|
|
129
|
+
const inProgressDeployRequests = deployRequests.filter((deployRequest) => deployRequest.Status === 'InProgress');
|
|
130
|
+
const pendingDeployRequests = deployRequests.filter((deployRequest) => deployRequest.Status === 'Pending');
|
|
131
|
+
return [
|
|
132
|
+
{ name: messages.getMessage('label.cancel'), value: cancelSelection },
|
|
133
|
+
new Separator(),
|
|
134
|
+
...getGroupedDeployChoices(messages.getMessage('label.inProgress'), inProgressDeployRequests),
|
|
135
|
+
...getGroupedDeployChoices(messages.getMessage('label.pending'), pendingDeployRequests),
|
|
136
|
+
];
|
|
137
|
+
};
|
|
138
|
+
const getGroupedDeployChoices = (label, deployRequests) => deployRequests.length === 0
|
|
139
|
+
? []
|
|
140
|
+
: [
|
|
141
|
+
new Separator(label),
|
|
142
|
+
...deployRequests.map((deployRequest) => ({
|
|
143
|
+
name: formatDeployRequest(deployRequest),
|
|
144
|
+
value: deployRequest,
|
|
145
|
+
})),
|
|
146
|
+
];
|
|
147
|
+
const isPromptForceCloseError = (error) => error instanceof Error && error.message.includes('User force closed the prompt');
|
|
148
|
+
const formatProgress = (completed, total, errors) => {
|
|
149
|
+
const completedValue = completed !== null && completed !== void 0 ? completed : 0;
|
|
150
|
+
const totalValue = total !== null && total !== void 0 ? total : 0;
|
|
151
|
+
const errorValue = errors !== null && errors !== void 0 ? errors : 0;
|
|
152
|
+
const percentage = totalValue > 0 ? Math.floor((completedValue / totalValue) * 100) : 0;
|
|
153
|
+
return `${completedValue}/${totalValue} (${percentage}% - ${errorValue} errors)`;
|
|
154
|
+
};
|
|
155
|
+
const cancelDeploy = (jobId, targetOrg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
+
var _a;
|
|
157
|
+
const result = yield runChildProcess((_a = process.env.SF_BINPATH) !== null && _a !== void 0 ? _a : 'sf', [
|
|
158
|
+
'project',
|
|
159
|
+
'deploy',
|
|
160
|
+
'cancel',
|
|
161
|
+
'--job-id',
|
|
162
|
+
jobId,
|
|
163
|
+
'--target-org',
|
|
164
|
+
targetOrg,
|
|
165
|
+
'--async',
|
|
166
|
+
]);
|
|
167
|
+
return result.exitCode;
|
|
168
|
+
});
|
|
169
|
+
const runChildProcess = (command, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
|
+
return new Promise((resolve, reject) => {
|
|
171
|
+
const childProcess = spawn(command, args, {
|
|
172
|
+
stdio: 'inherit',
|
|
173
|
+
env: process.env,
|
|
174
|
+
});
|
|
175
|
+
childProcess.on('error', (error) => {
|
|
176
|
+
reject(error);
|
|
177
|
+
});
|
|
178
|
+
childProcess.on('close', (code) => {
|
|
179
|
+
resolve({
|
|
180
|
+
exitCode: code !== null && code !== void 0 ? code : 0,
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../../src/commands/raven/deploy/cancel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAkC1E,MAAM,eAAe,GAAG,QAAiB,CAAC;AAK1C,MAAqB,YAAa,SAAQ,SAA6B;IAYxD,GAAG;;YACd,MAAM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AAK,CAAC,OAAO,EAAE,IAAI,EAAE;YACxC,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAC;QAEH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAChC,OAAO,CAAC;gBACN,QAAQ,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC;aACpB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAA;EAAA,CAAC"}
|
|
@@ -9,6 +9,7 @@ export default class ObjectDisplayFields extends SfCommand<ObjectDisplayFieldsRe
|
|
|
9
9
|
static readonly flags: {
|
|
10
10
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
sobject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
csv: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
};
|
|
13
14
|
run(): Promise<ObjectDisplayFieldsResult>;
|
|
14
15
|
}
|
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { writeFileSync } from 'node:fs';
|
|
10
11
|
import { SfCommand, Flags, Ux } from '@salesforce/sf-plugins-core';
|
|
11
12
|
import { Messages } from '@salesforce/core';
|
|
12
13
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
@@ -14,31 +15,42 @@ const messages = Messages.loadMessages('sf-raven', 'raven.object.display.fields'
|
|
|
14
15
|
class ObjectDisplayFields extends SfCommand {
|
|
15
16
|
run() {
|
|
16
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
this.spinner.start('Loading...');
|
|
18
18
|
const { flags } = yield this.parse(ObjectDisplayFields);
|
|
19
19
|
const ux = new Ux({ jsonEnabled: this.jsonEnabled() });
|
|
20
20
|
const org = flags['target-org'];
|
|
21
21
|
const conn = org.getConnection();
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
this.spinner.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
const sobjects = parseSobjects(flags.sobject);
|
|
23
|
+
const records = [];
|
|
24
|
+
this.spinner.start('Loading...');
|
|
25
|
+
try {
|
|
26
|
+
yield sobjects.reduce((previousQuery, sobject) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
yield previousQuery;
|
|
28
|
+
const query = `SELECT EntityDefinition.QualifiedApiName, Label, QualifiedApiName, DataType FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = '${sobject}' ORDER BY QualifiedApiName`;
|
|
29
|
+
const queryResult = (yield conn.query(query));
|
|
30
|
+
records.push(...queryResult.records);
|
|
31
|
+
}), Promise.resolve());
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
this.spinner.stop();
|
|
35
|
+
}
|
|
36
|
+
const result = {
|
|
37
|
+
totalSize: records.length,
|
|
38
|
+
done: true,
|
|
39
|
+
records,
|
|
40
|
+
};
|
|
41
|
+
const includeObjectColumn = sobjects.length > 1;
|
|
42
|
+
if (flags.csv) {
|
|
43
|
+
writeCsv(flags.csv, result.records, includeObjectColumn);
|
|
44
|
+
ux.log(messages.getMessage('info.csvWritten', [result.records.length.toString(), flags.csv]));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Return table of fields
|
|
48
|
+
ux.table(result.records, getTableColumns(includeObjectColumn));
|
|
49
|
+
}
|
|
40
50
|
// Return url
|
|
41
|
-
|
|
51
|
+
if (sobjects.length === 1) {
|
|
52
|
+
ux.log(`\n${conn.instanceUrl}/lightning/setup/ObjectManager/${sobjects[0]}/FieldsAndRelationships/view`);
|
|
53
|
+
}
|
|
42
54
|
// Return an object to be displayed with --json
|
|
43
55
|
return result;
|
|
44
56
|
});
|
|
@@ -58,6 +70,56 @@ ObjectDisplayFields.flags = {
|
|
|
58
70
|
char: 's',
|
|
59
71
|
required: true,
|
|
60
72
|
}),
|
|
73
|
+
csv: Flags.file({
|
|
74
|
+
summary: messages.getMessage('flags.csv.summary'),
|
|
75
|
+
char: 'c',
|
|
76
|
+
}),
|
|
61
77
|
};
|
|
62
78
|
export default ObjectDisplayFields;
|
|
79
|
+
const parseSobjects = (sobjectFlag) => {
|
|
80
|
+
const sobjects = sobjectFlag
|
|
81
|
+
.split(',')
|
|
82
|
+
.map((sobject) => sobject.trim())
|
|
83
|
+
.filter((sobject) => sobject.length > 0);
|
|
84
|
+
return Array.from(new Set(sobjects));
|
|
85
|
+
};
|
|
86
|
+
const getTableColumns = (includeObjectColumn) => (Object.assign(Object.assign({}, (includeObjectColumn
|
|
87
|
+
? {
|
|
88
|
+
object: {
|
|
89
|
+
header: 'Object',
|
|
90
|
+
get: (row) => row.EntityDefinition.QualifiedApiName,
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
: {})), { label: {
|
|
94
|
+
header: 'Name',
|
|
95
|
+
get: (row) => row.Label,
|
|
96
|
+
}, qualifiedApiName: {
|
|
97
|
+
header: 'Developer Name',
|
|
98
|
+
get: (row) => row.QualifiedApiName,
|
|
99
|
+
}, dataType: {
|
|
100
|
+
header: 'Type',
|
|
101
|
+
get: (row) => row.DataType,
|
|
102
|
+
} }));
|
|
103
|
+
const writeCsv = (filePath, records, includeObjectColumn) => {
|
|
104
|
+
const columns = includeObjectColumn ? ['Object', 'Name', 'Developer Name', 'Type'] : ['Name', 'Developer Name', 'Type'];
|
|
105
|
+
const rows = [
|
|
106
|
+
columns.map(escapeCsvValue).join(','),
|
|
107
|
+
...records.map((record) => (includeObjectColumn
|
|
108
|
+
? [record.EntityDefinition.QualifiedApiName, record.Label, record.QualifiedApiName, record.DataType]
|
|
109
|
+
: [record.Label, record.QualifiedApiName, record.DataType])
|
|
110
|
+
.map(escapeCsvValue)
|
|
111
|
+
.join(',')),
|
|
112
|
+
];
|
|
113
|
+
writeFileSync(filePath, `${rows.join('\n')}\n`, 'utf8');
|
|
114
|
+
};
|
|
115
|
+
const escapeCsvValue = (value) => {
|
|
116
|
+
if (value == null) {
|
|
117
|
+
return '';
|
|
118
|
+
}
|
|
119
|
+
const stringValue = String(value);
|
|
120
|
+
if (/[",\n\r]/.test(stringValue)) {
|
|
121
|
+
return `"${stringValue.replace(/"/g, '""')}"`;
|
|
122
|
+
}
|
|
123
|
+
return stringValue;
|
|
124
|
+
};
|
|
63
125
|
//# sourceMappingURL=fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../src/commands/raven/object/display/fields.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC;AAMlF,MAAqB,mBAAoB,SAAQ,SAAoC;
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../src/commands/raven/object/display/fields.ts"],"names":[],"mappings":";;;;;;;;;AAAA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AC;IAElC,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;IAChD,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -9,6 +9,7 @@ export default class ObjectDisplayRecordtypes extends SfCommand<ObjectDisplayRec
|
|
|
9
9
|
static readonly flags: {
|
|
10
10
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
sobject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
csv: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
};
|
|
13
14
|
run(): Promise<ObjectDisplayRecordtypesResult>;
|
|
14
15
|
}
|