diff --git a/package-lock.json b/package-lock.json index ffe6a6c..498fd3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,14 @@ "version": "2.43.0", "license": "AGPL-3.0", "dependencies": { - "@oclif/core": "^4.2.4", + "@oclif/core": "^4.2.5", "@salesforce/core": "^8.8.2", "@salesforce/sf-plugins-core": "^12.1.3", "chalk": "^5.4.1", "cosmiconfig": "^9.0.0", "fs-extra": "^11.3.0", "glob": "^11.0.1", - "lightning-flow-scanner-core": "4.15.0" + "lightning-flow-scanner-core": "4.16.0" }, "devDependencies": { "@oclif/plugin-help": "^6.2.23", @@ -27,18 +27,18 @@ "@types/chai": "^5", "@types/jsforce": "^1.11.5", "@types/mocha": "^10.0.10", - "@types/node": "^22.10.10", + "@types/node": "^22.13.0", "@types/sinon": "^17.0.3", "@types/sinonjs__fake-timers": "^8.1.5", - "@typescript-eslint/eslint-plugin": "^8.21.0", - "@typescript-eslint/parser": "^8.21.0", + "@typescript-eslint/eslint-plugin": "^8.22.0", + "@typescript-eslint/parser": "^8.22.0", "chai": "^5", "eslint": "^9.19.0", "eslint-config-prettier": "^10.0.1", "globby": "^14.0.2", "mocha": "^11.1.0", "nyc": "^17", - "oclif": "^4.17.19", + "oclif": "^4.17.21", "prettier": "^3.4.2", "sinon": "^19.0.2", "ts-node": "^10.9.2", @@ -3688,9 +3688,9 @@ } }, "node_modules/@oclif/core": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@oclif/core/-/core-4.2.4.tgz", - "integrity": "sha512-JDqdhX6fBbijY3ouubfmX7yFBXy95YSpiAVk0TAaXXCoSqoo/2WMcV2Ufv2V+8zriafPU/rvKgI+ZE07/7HwfQ==", + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/@oclif/core/-/core-4.2.5.tgz", + "integrity": "sha512-bdXOojq8GaPnWnDgVOw030JlUROJEiDLXiV3XUUGUQDEp6YpVQvEYLIrUsEvyfASU3z3FGg3DC9k0kprcOYdhw==", "license": "MIT", "dependencies": { "ansi-escapes": "^4.3.2", @@ -5237,9 +5237,9 @@ } }, "node_modules/@types/node": { - "version": "22.10.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.10.tgz", - "integrity": "sha512-X47y/mPNzxviAGY5TcYPtYL8JsY3kAq2n8fMmKoRCxq/c4v4pyGNCzM2R6+M5/umG4ZfHuT+sgqDYqWc9rJ6ww==", + "version": "22.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.0.tgz", + "integrity": "sha512-ClIbNe36lawluuvq3+YYhnIN2CELi+6q8NpnM7PYp4hBn/TatfboPgVSm2rwKRfnV2M+Ty9GWDFI64KEe+kysA==", "license": "MIT", "dependencies": { "undici-types": "~6.20.0" @@ -5284,17 +5284,17 @@ "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.21.0.tgz", - "integrity": "sha512-eTH+UOR4I7WbdQnG4Z48ebIA6Bgi7WO8HvFEneeYBxG8qCOYgTOFPSg6ek9ITIDvGjDQzWHcoWHCDO2biByNzA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.22.0.tgz", + "integrity": "sha512-4Uta6REnz/xEJMvwf72wdUnC3rr4jAQf5jnTkeRQ9b6soxLxhDEbS/pfMPoJLDfFPNVRdryqWUIV/2GZzDJFZw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.21.0", - "@typescript-eslint/type-utils": "8.21.0", - "@typescript-eslint/utils": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/type-utils": "8.22.0", + "@typescript-eslint/utils": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -5314,16 +5314,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.21.0.tgz", - "integrity": "sha512-Wy+/sdEH9kI3w9civgACwabHbKl+qIOu0uFZ9IMKzX3Jpv9og0ZBJrZExGrPpFAY7rWsXuxs5e7CPPP17A4eYA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.22.0.tgz", + "integrity": "sha512-MqtmbdNEdoNxTPzpWiWnqNac54h8JDAmkWtJExBVVnSrSmi9z+sZUt0LfKqk9rjqmKOIeRhO4fHHJ1nQIjduIQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.21.0", - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/typescript-estree": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/typescript-estree": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "debug": "^4.3.4" }, "engines": { @@ -5339,14 +5339,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.21.0.tgz", - "integrity": "sha512-G3IBKz0/0IPfdeGRMbp+4rbjfSSdnGkXsM/pFZA8zM9t9klXDnB/YnKOBQ0GoPmoROa4bCq2NeHgJa5ydsQ4mA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.22.0.tgz", + "integrity": "sha512-/lwVV0UYgkj7wPSw0o8URy6YI64QmcOdwHuGuxWIYznO6d45ER0wXUbksr9pYdViAofpUCNJx/tAzNukgvaaiQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0" + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -5357,14 +5357,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.21.0.tgz", - "integrity": "sha512-95OsL6J2BtzoBxHicoXHxgk3z+9P3BEcQTpBKriqiYzLKnM2DeSqs+sndMKdamU8FosiadQFT3D+BSL9EKnAJQ==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.22.0.tgz", + "integrity": "sha512-NzE3aB62fDEaGjaAYZE4LH7I1MUwHooQ98Byq0G0y3kkibPJQIXVUspzlFOmOfHhiDLwKzMlWxaNv+/qcZurJA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.21.0", - "@typescript-eslint/utils": "8.21.0", + "@typescript-eslint/typescript-estree": "8.22.0", + "@typescript-eslint/utils": "8.22.0", "debug": "^4.3.4", "ts-api-utils": "^2.0.0" }, @@ -5381,9 +5381,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.21.0.tgz", - "integrity": "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz", + "integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==", "dev": true, "license": "MIT", "engines": { @@ -5395,14 +5395,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.21.0.tgz", - "integrity": "sha512-x+aeKh/AjAArSauz0GiQZsjT8ciadNMHdkUSwBB9Z6PrKc/4knM4g3UfHml6oDJmKC88a6//cdxnO/+P2LkMcg==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.22.0.tgz", + "integrity": "sha512-SJX99NAS2ugGOzpyhMza/tX+zDwjvwAtQFLsBo3GQxiGcvaKlqGBkmZ+Y1IdiSi9h4Q0Lr5ey+Cp9CGWNY/F/w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -5438,16 +5438,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.21.0.tgz", - "integrity": "sha512-xcXBfcq0Kaxgj7dwejMbFyq7IOHgpNMtVuDveK7w3ZGwG9owKzhALVwKpTF2yrZmEwl9SWdetf3fxNzJQaVuxw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.22.0.tgz", + "integrity": "sha512-T8oc1MbF8L+Bk2msAvCUzjxVB2Z2f+vXYfcucE2wOmYs7ZUwco5Ep0fYZw8quNwOiw9K8GYVL+Kgc2pETNTLOg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.21.0", - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/typescript-estree": "8.21.0" + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/typescript-estree": "8.22.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -5462,13 +5462,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.21.0.tgz", - "integrity": "sha512-BkLMNpdV6prozk8LlyK/SOoWLmUFi+ZD+pcqti9ILCbVvHGk1ui1g4jJOc2WDLaeExz2qWwojxlPce5PljcT3w==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz", + "integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/types": "8.22.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -8611,12 +8611,11 @@ } }, "node_modules/lightning-flow-scanner-core": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/lightning-flow-scanner-core/-/lightning-flow-scanner-core-4.15.0.tgz", - "integrity": "sha512-hQX/Cgy4LUfuqfww37wz3rKTxJrESe9pjrjx/K4rpin0GkrMNNiiq3r50BBGG8gIwP1ZvrOvgJC5Gu3r5+y4Ww==", + "version": "4.16.0", + "resolved": "https://registry.npmjs.org/lightning-flow-scanner-core/-/lightning-flow-scanner-core-4.16.0.tgz", + "integrity": "sha512-40AXGemfwE698cqJ5WuS2W8OFRsYdqSA8WcdaQTE7YfMBGfVD5gB1Jl/8USWD7ahNtBgvX+sEzTpj5m+SayeJg==", "license": "MIT", "dependencies": { - "path-browserify": "^1.0.1", "xmlbuilder2": "^3.1.1" }, "engines": { @@ -9472,9 +9471,9 @@ } }, "node_modules/oclif": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/oclif/-/oclif-4.17.19.tgz", - "integrity": "sha512-qXcEdVFa0iSe7p3sDXbu5Ljc8qO0GKOAM/0cmRMTJTF1i+ceeY3FeT3CtDC0bORLwO9vujTg8QEBG2DWrHNa5w==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/oclif/-/oclif-4.17.21.tgz", + "integrity": "sha512-ix0H1xSWrk12jxALgub+6Eo9uvV+t42EQVeapDmPCUw78QVivOxmnpTws5ZU2DDbviLGDDIZrWGywfK8OS87rQ==", "dev": true, "license": "MIT", "dependencies": { @@ -9751,12 +9750,6 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "license": "MIT" - }, "node_modules/path-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", diff --git a/package.json b/package.json index a21a4aa..d252d78 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,14 @@ "version": "2.43.0", "bugs": "https://github.com/Lightning-Flow-Scanner/lightning-flow-scanner-sfdx/issues", "dependencies": { - "@oclif/core": "^4.2.4", + "@oclif/core": "^4.2.5", "@salesforce/core": "^8.8.2", "@salesforce/sf-plugins-core": "^12.1.3", "chalk": "^5.4.1", "cosmiconfig": "^9.0.0", "fs-extra": "^11.3.0", "glob": "^11.0.1", - "lightning-flow-scanner-core": "4.15.0" + "lightning-flow-scanner-core": "4.16.0" }, "devDependencies": { "@oclif/plugin-help": "^6.2.23", @@ -21,18 +21,18 @@ "@types/chai": "^5", "@types/jsforce": "^1.11.5", "@types/mocha": "^10.0.10", - "@types/node": "^22.10.10", + "@types/node": "^22.13.0", "@types/sinon": "^17.0.3", "@types/sinonjs__fake-timers": "^8.1.5", - "@typescript-eslint/eslint-plugin": "^8.21.0", - "@typescript-eslint/parser": "^8.21.0", + "@typescript-eslint/eslint-plugin": "^8.22.0", + "@typescript-eslint/parser": "^8.22.0", "chai": "^5", "eslint": "^9.19.0", "eslint-config-prettier": "^10.0.1", "globby": "^14.0.2", "mocha": "^11.1.0", "nyc": "^17", - "oclif": "^4.17.19", + "oclif": "^4.17.21", "prettier": "^3.4.2", "sinon": "^19.0.2", "ts-node": "^10.9.2", diff --git a/src/commands/flow/scan.ts b/src/commands/flow/scan.ts index 14c1872..d11e21e 100644 --- a/src/commands/flow/scan.ts +++ b/src/commands/flow/scan.ts @@ -8,13 +8,14 @@ import { loadScannerOptions } from "../../libs/ScannerConfig.js"; import { FindFlows } from "../../libs/FindFlows.js"; import { ScanResult } from "../../models/ScanResult.js"; -import pkg, { +import { ScanResult as ScanResults, RuleResult, ResultDetails, + parse as parseFlows, + scan as scanFlows, + ParsedFlow, } from "lightning-flow-scanner-core"; -const { parse: parseFlows, scan: scanFlows } = pkg; -import type { ParsedFlow } from "lightning-flow-scanner-core/main/models/ParsedFlow.js"; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); @@ -28,7 +29,7 @@ export default class Scan extends SfCommand { "sf flow scan -c path/to/config.json", "sf flow scan -c path/to/config.json --failon warning", "sf flow scan -d path/to/flows/directory", - "sf flow scan -p path/to/single/file.flow-meta.xml,path/to/another/file.flow-meta.xml", + "[DEPRECATION WARNING USE --files] sf flow scan -p path/to/single/file.flow-meta.xml,path/to/another/file.flow-meta.xml", "sf flow scan --files path/to/single/file.flow-meta.xml path/to/another/file.flow-meta.xml", ]; @@ -37,7 +38,7 @@ export default class Scan extends SfCommand { public static requiresProject = false; protected static supportsUsername = true; - protected userConfig; + protected userConfig: object; protected failOn = "error"; protected errorCounters: Map = new Map(); diff --git a/src/libs/CoreFixService.ts b/src/libs/CoreFixService.ts index b47cc08..48855ba 100644 --- a/src/libs/CoreFixService.ts +++ b/src/libs/CoreFixService.ts @@ -3,8 +3,7 @@ import { writeFileSync } from "node:fs"; import { FindFlows } from "./FindFlows.js"; -import pkg from "lightning-flow-scanner-core"; -const { fix: fixFlows, parse: parseFlows, scan: scanFlows } = pkg; +import { scan, parse, fix as fixFlows } from "lightning-flow-scanner-core"; import type { ScanResult as FlowScanResults } from "lightning-flow-scanner-core"; @@ -17,13 +16,8 @@ export default class CoreFixService { public async fix(): Promise { //find flow file(s) - let flowFiles; - if (this.dir) { - flowFiles = this.findFlowsByDir(this.dir); - } else { - flowFiles = this.findFlowsByPath(this.file); - } - const parsedFlows = await parseFlows(flowFiles); + const flowFiles = this.findFlows(); + const parsedFlows = await parse(flowFiles); // make on the fly rule const flatRules = this.rules @@ -39,7 +33,7 @@ export default class CoreFixService { ) as IRulesConfig; // scan - const scanResults: FlowScanResults[] = scanFlows(parsedFlows, flatRules); + const scanResults: FlowScanResults[] = scan(parsedFlows, flatRules); // fix const fixFlow: FlowScanResults[] = fixFlows(scanResults); @@ -50,6 +44,13 @@ export default class CoreFixService { return fixFlow.map((fixedOut) => fixedOut.flow.fsPath); } + private findFlows(): string[] { + if (this.dir) { + return this.findFlowsByDir(this.dir); + } + return this.findFlowsByPath(this.file); + } + private findFlowsByDir(dir: string[]): string[] { return dir .map((dirName) => {