Skip to content

Commit 56a141d

Browse files
committed
remove targetusername parameter
1 parent ae464a4 commit 56a141d

File tree

1 file changed

+2
-41
lines changed

1 file changed

+2
-41
lines changed

src/commands/flow/scan.ts

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { SfCommand, Flags } from "@salesforce/sf-plugins-core";
2-
import { Messages, SfError } from "@salesforce/core";
2+
import { Messages } from "@salesforce/core";
33
import chalk from "chalk";
4-
import { exec } from "child_process";
54

65
import { loadScannerOptions } from "../../libs/ScannerConfig.js";
76
import { FindFlows } from "../../libs/FindFlows.js";
@@ -73,31 +72,17 @@ export default class Scan extends SfCommand<Output> {
7372
description: "List of source flows paths to scan",
7473
charAliases: ["p"],
7574
exclusive: ["directory"],
76-
}),
77-
targetusername: Flags.string({
78-
char: "u",
79-
description:
80-
"Retrieve the latest metadata from the target before the scan.",
81-
required: false,
82-
charAliases: ["o"],
83-
}),
75+
})
8476
};
8577

8678
public async run(): Promise<Output> {
87-
// 🚨 Step 0: Block risky APIs before anything else
8879
this.enforceSecurityGuards();
89-
90-
// Step 1: Parse CLI flags
9180
const { flags } = await this.parse(Scan);
9281
this.failOn = flags.failon || "error";
9382

9483
this.spinner.start("Loading Lightning Flow Scanner");
9584
this.userConfig = await loadScannerOptions(flags.config);
9685

97-
if (flags.targetusername) {
98-
await this.retrieveFlowsFromOrg(flags.targetusername);
99-
}
100-
10186
const targets: string[] = flags.files;
10287

10388
// Step 2: Find flows to scan
@@ -280,28 +265,4 @@ public async run(): Promise<Output> {
280265
return dynamicImport(...args);
281266
};
282267
}
283-
284-
285-
private async retrieveFlowsFromOrg(targetusername: string) {
286-
let errored = false;
287-
this.spinner.start(chalk.yellowBright("Retrieving Metadata..."));
288-
const retrieveCommand = `sf project retrieve start -m Flow -o "${targetusername}"`;
289-
try {
290-
await exec(retrieveCommand, { maxBuffer: 1000000 * 1024 });
291-
} catch (exception) {
292-
errored = true;
293-
this.toErrorJson(exception);
294-
this.spinner.stop(chalk.redBright("Retrieve Operation Failed."));
295-
}
296-
if (errored) {
297-
throw new SfError(
298-
messages.getMessage("errorRetrievingMetadata"),
299-
"",
300-
[],
301-
1,
302-
);
303-
} else {
304-
this.spinner.stop(chalk.greenBright("Retrieve Completed ✔."));
305-
}
306-
}
307268
}

0 commit comments

Comments
 (0)