rflib-plugin 0.7.3 → 0.8.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 +23 -1
- package/lib/commands/rflib/logging/apex/instrument.js +18 -2
- package/lib/commands/rflib/logging/apex/instrument.js.map +1 -1
- package/lib/commands/rflib/logging/flow/instrument.d.ts +6 -1
- package/lib/commands/rflib/logging/flow/instrument.js +264 -9
- package/lib/commands/rflib/logging/flow/instrument.js.map +1 -1
- package/messages/rflib.logging.flow.instrument.md +16 -6
- package/oclif.lock +234 -37
- package/oclif.manifest.json +9 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Plugin for Salesforce CLI to help with the adoption of [RFLIB](https://github.co
|
|
|
9
9
|
- Automatically instruments Apex classes with RFLIB logging statements
|
|
10
10
|
- Automatically instruments LWC components with RFLIB logging statements
|
|
11
11
|
- Automatically instruments Aura components with RFLIB logging statements
|
|
12
|
+
- Automatically instruments Salesforce Flows with RFLIB logging actions
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
14
15
|
|
|
@@ -73,7 +74,7 @@ sf rflib logging lwc instrument --sourcepath force-app --skip-instrumented
|
|
|
73
74
|
Adds RFLIB logging statements to Aura Components.
|
|
74
75
|
|
|
75
76
|
```bash
|
|
76
|
-
# Add logging to all
|
|
77
|
+
# Add logging to all Aura component files
|
|
77
78
|
sf rflib logging aura instrument --sourcepath force-app
|
|
78
79
|
|
|
79
80
|
# Preview changes without modifying files
|
|
@@ -93,6 +94,27 @@ sf rflib logging aura instrument --sourcepath force-app --skip-instrumented
|
|
|
93
94
|
- `--prettier (-p)`: Format modified files using Prettier
|
|
94
95
|
- `--skip-instrumented`: Do not instrument files where RFLIB logging is already present
|
|
95
96
|
|
|
97
|
+
### `sf rflib logging flow instrument`
|
|
98
|
+
|
|
99
|
+
Adds RFLIB logging actions to Salesforce Flows.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Add logging to all Flow files
|
|
103
|
+
sf rflib logging flow instrument --sourcepath force-app
|
|
104
|
+
|
|
105
|
+
# Preview changes without modifying files
|
|
106
|
+
sf rflib logging flow instrument --sourcepath force-app --dryrun
|
|
107
|
+
|
|
108
|
+
# Skip instrumenting flows where logging is already present
|
|
109
|
+
sf rflib logging flow instrument --sourcepath force-app --skip-instrumented
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Command Options
|
|
113
|
+
|
|
114
|
+
- `--sourcepath (-s)`: Directory containing Flow files to instrument
|
|
115
|
+
- `--dryrun (-d)`: Preview changes without modifying files
|
|
116
|
+
- `--skip-instrumented`: Do not instrument files where RFLIB logging is already present
|
|
117
|
+
|
|
96
118
|
## Contributing
|
|
97
119
|
|
|
98
120
|
1. Fork the repository
|
|
@@ -247,8 +247,24 @@ export default class RflibLoggingApexInstrument extends SfCommand {
|
|
|
247
247
|
if (content !== originalContent) {
|
|
248
248
|
this.stats.modifiedFiles++;
|
|
249
249
|
if (!isDryRun) {
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
try {
|
|
251
|
+
const finalContent = instrumentationOpts.prettier
|
|
252
|
+
? await ApexInstrumentationService.formatContent(content)
|
|
253
|
+
: content;
|
|
254
|
+
await fs.promises.writeFile(filePath, finalContent);
|
|
255
|
+
if (instrumentationOpts.prettier) {
|
|
256
|
+
this.stats.formattedFiles++;
|
|
257
|
+
this.logger.info(`Modified and formatted test file: ${filePath}`);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.logger.info(`Modified test file: ${filePath}`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
this.logger.warn(`Failed to format ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
265
|
+
await fs.promises.writeFile(filePath, content);
|
|
266
|
+
this.logger.info(`Modified test file without formatting: ${filePath}`);
|
|
267
|
+
}
|
|
252
268
|
}
|
|
253
269
|
else {
|
|
254
270
|
this.logger.info(`Would modify test file: ${filePath}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/apex/instrument.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAsCrC,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,cAAc,EAAE,+BAA+B,CAAC,CAAC;AAExF,MAAM,0BAA0B;IACvB,MAAM,CAAU,gBAAgB,GACrC,gGAAgG,CAAC;IAE3F,MAAM,CAAU,YAAY,GAClC,uJAAuJ,CAAC;IAClJ,MAAM,CAAU,WAAW,GAAG,mBAAmB,CAAC;IAClD,MAAM,CAAU,kBAAkB,GAAG,+DAA+D,CAAC;IACrG,MAAM,CAAU,kBAAkB,GAAG,UAAU,CAAC;IAChD,MAAM,CAAU,WAAW,GAAG,oCAAoC,CAAC;IACnE,MAAM,CAAU,kBAAkB,GACxC,0FAA0F,CAAC;IACrF,MAAM,CAAU,UAAU,GAAG,gFAAgF,CAAC;IAC9G,MAAM,CAAU,qBAAqB,GAAG,uCAAuC,CAAC;IAChF,MAAM,CAAU,kBAAkB,GAAG,iDAAiD,CAAC;IAEvF,MAAM,CAAU,eAAe,GAAG,IAAI,GAAG,CAAC;QAChD,QAAQ;QACR,SAAS;QACT,MAAM;QACN,SAAS;QACT,QAAQ;QACR,SAAS;QACT,MAAM;QACN,UAAU;QACV,MAAM;QACN,IAAI;KACL,CAAC,CAAC;IAEK,M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and, Flags } from '@salesforce/sf-plugins-core';\nimport { Messages, Logger } from '@salesforce/core';\nimport * as prettier from 'prettier';\n\ntype ApexMethodMatch = {\n auraEnabled?: string;\n access: string;\n isStatic?: string;\n returnType: string;\n methodName: string;\n args: string;\n}\n\ntype IfCondition = {\n condition: string;\n position: number;\n}\n\ntype InstrumentationOptions = {\n readonly prettier: boolean;\n readonly noIf: boolean;\n readonly skipInstrumented: boolean;\n}\n\ntype LoggerInfo = {\n readonly exists: boolean;\n readonly variableName: string;\n}\n\ntype ProcessedParameters = {\n readonly paramList: readonly string[];\n readonly logArgs: string;\n}\n\nexport type RflibLoggingApexInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n formattedFiles: number;\n}\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.apex.instrument');\n\nclass ApexInstrumentationService {\n public static readonly TEST_SETUP_REGEX =\n /@TestSetup\\s+((public|private|protected|global)s+)?(?:static\\s+)?void\\s+(\\w+)\\s*\\([^)]*\\)\\s*{/g;\n\n private static readonly METHOD_REGEX =\n /(@AuraEnabled\\s*[\\s\\S]*?)?\\b(public|private|protected|global)\\s+(static\\s+)?(?:(\\w+(?:\\s*<(?:[^<>]|<[^<>]*>)*>)?)|void)\\s+(\\w+)\\s*\\(([\\s\\S]*?)\\)\\s*{/g;\n private static readonly CLASS_REGEX = /\\bclass\\s+\\w+\\s*{/;\n private static readonly CLASS_LOGGER_REGEX = /\\bprivate\\s+(?:static\\s+)?(?:final\\s+)?rflib_Logger\\s+(\\w+)\\b/;\n private static readonly GENERIC_ARGS_REGEX = /<[^>]+>/g;\n private static readonly CATCH_REGEX = /catch\\s*\\(\\s*\\w+\\s+(\\w+)\\s*\\)\\s*{/g;\n private static readonly IF_STATEMENT_REGEX =\n /if\\s*\\((.*?)\\)\\s*(?:{([^]*?(?:(?<!{){(?:[^]*?)}(?!})[^]*?)*)}|([^{].*?)(?=\\s*(?:;|$));)/g;\n private static readonly ELSE_REGEX = /\\s*else(?!\\s*if\\b)\\s*(?:{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}|([^{;]*(?:;|$)))/g;\n private static readonly IS_INSTRUMENTED_REGEX = /(\\brflib_Logger\\b|\\brflib_TestUtil\\b)/;\n private static readonly SYSTEM_DEBUG_REGEX = /System\\.debug\\s*\\(\\s*['\"]([^'\"]*)['\"]\\s*\\)\\s*;/g;\n\n private static readonly PRIMITIVE_TYPES = new Set([\n 'STRING',\n 'INTEGER',\n 'LONG',\n 'DECIMAL',\n 'DOUBLE',\n 'BOOLEAN',\n 'DATE',\n 'DATETIME',\n 'TIME',\n 'ID',\n ]);\n\n private static readonly PRETTIER_CONFIG: prettier.Options = {\n parser: 'apex',\n plugins: ['prettier-plugin-apex'],\n printWidth: 120,\n tabWidth: 4,\n useTabs: false,\n singleQuote: true,\n };\n\n public static async formatContent(content: string): Promise<string> {\n try {\n return await prettier.format(content, this.PRETTIER_CONFIG);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Formatting failed: ${error.message}`);\n }\n throw new Error('Formatting failed with unknown error');\n }\n }\n\n public static isInstrumented(content: string): boolean {\n return this.IS_INSTRUMENTED_REGEX.test(content);\n }\n\n public static detectLogger(content: string): LoggerInfo {\n const match = content.match(this.CLASS_LOGGER_REGEX);\n return {\n exists: this.CLASS_LOGGER_REGEX.test(content),\n variableName: match ? match[1] : 'LOGGER',\n };\n }\n\n public static addLoggerDeclaration(content: string, className: string): string {\n const { exists, variableName } = this.detectLogger(content);\n if (!exists) {\n const loggerDecl = `private static final rflib_Logger ${variableName} = rflib_LoggerUtil.getFactory().createLogger('${className}');`;\n return content.replace(this.CLASS_REGEX, `$&\\n ${loggerDecl}`);\n }\n return content;\n }\n\n public static processMethodDeclarations(content: string, loggerName: string): string {\n return content.replace(this.METHOD_REGEX, (match: string, ...args: unknown[]) => {\n const methodInfo: ApexMethodMatch = {\n auraEnabled: args[0] as string,\n access: args[1] as string,\n isStatic: args[2] as string,\n returnType: args[3] as string,\n methodName: args[4] as string,\n args: args[5] as string,\n };\n\n const { paramList, logArgs } = this.processParameters(methodInfo.args);\n\n return `${match}\\n ${loggerName}.info('${methodInfo.methodName}(${paramList\n .map((_, i) => `{${i}}`)\n .join(', ')})'${logArgs});\\n`;\n });\n }\n\n public static processCatchBlocks(content: string, loggerName: string): string {\n return content.replace(this.CATCH_REGEX, (match: string, exceptionVar: string, offset: number) => {\n const contentBeforeCatch = content.substring(0, offset);\n const methodMatches = [...contentBeforeCatch.matchAll(this.METHOD_REGEX)];\n const lastMethodMatch = methodMatches[methodMatches.length - 1];\n const methodName = lastMethodMatch ? lastMethodMatch[5] : 'unknown';\n\n return `${match}\\n ${loggerName}.error('An error occurred in ${methodName}()', ${exceptionVar.trim()});`;\n });\n }\n\n public static processIfStatements(content: string, loggerName: string): string {\n const conditions: IfCondition[] = [];\n\n let modified = content.replace(\n this.IF_STATEMENT_REGEX,\n (match: string, condition: string, blockBody: string, singleLineBody: string, offset: number) => {\n const cleanedUpCondition = condition.trim().replaceAll(\"'\", \"\\\\'\");\n conditions.push({\n condition: cleanedUpCondition,\n position: offset,\n });\n\n const logStatement = `${loggerName}.debug('if (${cleanedUpCondition})');\\n `;\n\n if (blockBody) {\n return `if (${condition}) {\\n ${logStatement}${blockBody}}\\n`;\n } else if (singleLineBody) {\n const cleanBody = singleLineBody.replace(/;$/, '').trim();\n return `if (${condition}) {\\n ${logStatement}${cleanBody};\\n }\\n`;\n }\n return match;\n },\n );\n\n modified = modified.replace(\n this.ELSE_REGEX,\n (match: string, blockBody?: string, singleLineBody?: string, offset?: number) => {\n const nearestIf = conditions\n .filter((c) => c.position < (offset ?? 0))\n .reduce((prev, curr) => (!prev || curr.position > prev.position ? curr : prev));\n\n const logStatement = nearestIf\n ? `${loggerName}.debug('else for if (${nearestIf.condition})');\\n `\n : `${loggerName}.debug('else statement');\\n `;\n\n if (blockBody) {\n return ` else {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n return ` else {\\n ${logStatement}${singleLineBody}\\n }`;\n }\n return match;\n },\n );\n\n return modified;\n }\n\n public static processSystemDebugStatements(content: string, loggerName: string): string {\n return content.replace(this.SYSTEM_DEBUG_REGEX, (match, debugMessage) => `${loggerName}.debug('${debugMessage}');`);\n }\n\n private static isComplexType(paramType: string): boolean {\n return (\n paramType.includes('<') ||\n paramType.includes('[') ||\n paramType === 'Object' ||\n !this.PRIMITIVE_TYPES.has(paramType.toUpperCase())\n );\n }\n\n private static processParameters(args: string): ProcessedParameters {\n const parameters = args\n ? args\n .replaceAll(this.GENERIC_ARGS_REGEX, '')\n .split(',')\n .map((param) => param.trim())\n : [];\n\n const logArgs =\n parameters.length > 0 && parameters[0] !== ''\n ? `, new Object[] { ${parameters\n .map((p) => {\n const [paramType, ...rest] = p.split(' ');\n const paramName = rest.length > 0 ? rest.join(' ') : paramType;\n return this.isComplexType(paramType) ? `JSON.serialize(${paramName})` : paramName;\n })\n .join(', ')} }`\n : '';\n\n return { paramList: parameters, logArgs };\n }\n}\n\nexport default class RflibLoggingApexInstrument extends SfCommand<RflibLoggingApexInstrumentResult> {\n public static readonly summary = messages.getMessage('summary');\n public static readonly description = messages.getMessage('description');\n public static readonly examples = messages.getMessages('examples');\n\n public static readonly flags = {\n sourcepath: Flags.string({\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n char: 's',\n required: true,\n }),\n dryrun: Flags.boolean({\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n char: 'd',\n default: false,\n }),\n prettier: Flags.boolean({\n summary: messages.getMessage('flags.prettier.summary'),\n description: messages.getMessage('flags.prettier.description'),\n char: 'p',\n default: false,\n }),\n 'no-if': Flags.boolean({\n summary: messages.getMessage('flags.no-if.summary'),\n description: messages.getMessage('flags.no-if.description'),\n default: false,\n }),\n 'skip-instrumented': Flags.boolean({\n summary: messages.getMessage('flags.skip-instrumented.summary'),\n description: messages.getMessage('flags.skip-instrumented.description'),\n default: false,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingApexInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n formattedFiles: 0,\n };\n\n public async run(): Promise<RflibLoggingApexInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const startTime = Date.now();\n\n const { flags } = await this.parse(RflibLoggingApexInstrument);\n const sourcePath = flags.sourcepath;\n const isDryRun = flags.dryrun;\n\n const instrumentationOpts: InstrumentationOptions = {\n prettier: flags.prettier,\n noIf: flags['no-if'],\n skipInstrumented: flags['skip-instrumented'],\n };\n\n this.log(`Scanning Apex classes in ${sourcePath} and sub directories`);\n this.logger.debug(`Dry run mode: ${isDryRun}`);\n\n this.spinner.start('Running...');\n await this.processDirectory(sourcePath, isDryRun, instrumentationOpts);\n this.spinner.stop();\n\n const duration = Date.now() - startTime;\n this.logger.debug(`Completed instrumentation in ${duration}ms`);\n\n this.log('\\nInstrumentation complete.');\n this.log(`Processed files: ${this.stats.processedFiles}`);\n this.log(`Modified files: ${this.stats.modifiedFiles}`);\n this.log(`Formatted files: ${this.stats.formattedFiles}`);\n\n return { ...this.stats };\n }\n\n private async processDirectory(\n dirPath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n this.logger.debug(`Processing directory: ${dirPath}`);\n const files = await fs.promises.readdir(dirPath);\n\n for (const file of files) {\n const filePath = path.join(dirPath, file);\n const stat = await fs.promises.stat(filePath);\n\n if (stat.isDirectory()) {\n await this.processDirectory(filePath, isDryRun, instrumentationOpts);\n } else if (file.includes('Test') && file.endsWith('.cls')) {\n await this.processTestFile(filePath, isDryRun, instrumentationOpts);\n } else if (file.endsWith('.cls')) {\n await this.instrumentApexClass(filePath, isDryRun, instrumentationOpts);\n }\n }\n }\n\n private async processTestFile(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n this.logger.debug(`Processing test file: ${filePath}`);\n let content = await fs.promises.readFile(filePath, 'utf8');\n const originalContent = content;\n\n if (instrumentationOpts.skipInstrumented && ApexInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented test class: ${filePath}`);\n return;\n }\n\n content = content.replace(\n ApexInstrumentationService.TEST_SETUP_REGEX,\n (match) => `${match}\\n rflib_TestUtil.prepareLoggerForUnitTests();`,\n );\n\n if (content !== originalContent) {\n this.stats.modifiedFiles++;\n if (!isDryRun) {\n await fs.promises.writeFile(filePath, content);\n this.logger.info(`Modified test file: ${filePath}`);\n } else {\n this.logger.info(`Would modify test file: ${filePath}`);\n }\n }\n }\n\n private async instrumentApexClass(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n const className = path.basename(filePath, '.cls');\n this.logger.debug(`Processing class: ${className}`);\n\n try {\n this.stats.processedFiles++;\n let content = await fs.promises.readFile(filePath, 'utf8');\n const originalContent = content;\n\n if (instrumentationOpts.skipInstrumented && ApexInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented class: ${className}`);\n return;\n }\n\n const { variableName } = ApexInstrumentationService.detectLogger(content);\n content = ApexInstrumentationService.addLoggerDeclaration(content, className);\n content = ApexInstrumentationService.processMethodDeclarations(content, variableName);\n content = ApexInstrumentationService.processSystemDebugStatements(content, variableName);\n content = ApexInstrumentationService.processCatchBlocks(content, variableName);\n\n if (!instrumentationOpts.noIf) {\n content = ApexInstrumentationService.processIfStatements(content, variableName);\n }\n\n if (content !== originalContent) {\n this.stats.modifiedFiles++;\n if (!isDryRun) {\n try {\n const finalContent = instrumentationOpts.prettier\n ? await ApexInstrumentationService.formatContent(content)\n : content;\n\n await fs.promises.writeFile(filePath, finalContent);\n\n if (instrumentationOpts.prettier) {\n this.stats.formattedFiles++;\n this.logger.info(`Modified and formatted: ${filePath}`);\n } else {\n this.logger.info(`Modified: ${filePath}`);\n }\n } catch (error) {\n this.logger.warn(`Failed to format ${filePath}: ${error instanceof Error ? error.message : String(error)}`);\n await fs.promises.writeFile(filePath, content);\n this.logger.info(`Modified without formatting: ${filePath}`);\n }\n } else {\n this.logger.info(`Would modify: ${filePath}`);\n }\n }\n } catch (error) {\n this.logger.error(`Error processing class ${className}`, error);\n throw error;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/apex/instrument.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAsCrC,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,cAAc,EAAE,+BAA+B,CAAC,CAAC;AAExF,MAAM,0BAA0B;IACvB,MAAM,CAAU,gBAAgB,GACrC,gGAAgG,CAAC;IAE3F,MAAM,CAAU,YAAY,GAClC,uJAAuJ,CAAC;IAClJ,MAAM,CAAU,WAAW,GAAG,mBAAmB,CAAC;IAClD,MAAM,CAAU,kBAAkB,GAAG,+DAA+D,CAAC;IACrG,MAAM,CAAU,kBAAkB,GAAG,UAAU,CAAC;IAChD,MAAM,CAAU,WAAW,GAAG,oCAAoC,CAAC;IACnE,MAAM,CAAU,kBAAkB,GACxC,0FAA0F,CAAC;IACrF,MAAM,CAAU,UAAU,GAAG,gFAAgF,CAAC;IAC9G,MAAM,CAAU,qBAAqB,GAAG,uCAAuC,CAAC;IAChF,MAAM,CAAU,kBAAkB,GAAG,iDAAiD,CAAC;IAEvF,MAAM,CAAU,eAAe,GAAG,IAAI,G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A2B,QAAQ,EAAE,CAAC,CAAC;wBAC1D,CAAC;6BAAM,CAAC;4BACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;wBAC5C,CAAC;oBACH,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,QAAQ,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;wBAC5G,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;wBAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;oBAC/D,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;YAChE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["/* eslint-disable no-await-in-loop */\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-core';\nimport { Messages, Logger } from '@salesforce/core';\nimport * as prettier from 'prettier';\n\ntype ApexMethodMatch = {\n auraEnabled?: string;\n access: string;\n isStatic?: string;\n returnType: string;\n methodName: string;\n args: string;\n}\n\ntype IfCondition = {\n condition: string;\n position: number;\n}\n\ntype InstrumentationOptions = {\n readonly prettier: boolean;\n readonly noIf: boolean;\n readonly skipInstrumented: boolean;\n}\n\ntype LoggerInfo = {\n readonly exists: boolean;\n readonly variableName: string;\n}\n\ntype ProcessedParameters = {\n readonly paramList: readonly string[];\n readonly logArgs: string;\n}\n\nexport type RflibLoggingApexInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n formattedFiles: number;\n}\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.apex.instrument');\n\nclass ApexInstrumentationService {\n public static readonly TEST_SETUP_REGEX =\n /@TestSetup\\s+((public|private|protected|global)s+)?(?:static\\s+)?void\\s+(\\w+)\\s*\\([^)]*\\)\\s*{/g;\n\n private static readonly METHOD_REGEX =\n /(@AuraEnabled\\s*[\\s\\S]*?)?\\b(public|private|protected|global)\\s+(static\\s+)?(?:(\\w+(?:\\s*<(?:[^<>]|<[^<>]*>)*>)?)|void)\\s+(\\w+)\\s*\\(([\\s\\S]*?)\\)\\s*{/g;\n private static readonly CLASS_REGEX = /\\bclass\\s+\\w+\\s*{/;\n private static readonly CLASS_LOGGER_REGEX = /\\bprivate\\s+(?:static\\s+)?(?:final\\s+)?rflib_Logger\\s+(\\w+)\\b/;\n private static readonly GENERIC_ARGS_REGEX = /<[^>]+>/g;\n private static readonly CATCH_REGEX = /catch\\s*\\(\\s*\\w+\\s+(\\w+)\\s*\\)\\s*{/g;\n private static readonly IF_STATEMENT_REGEX =\n /if\\s*\\((.*?)\\)\\s*(?:{([^]*?(?:(?<!{){(?:[^]*?)}(?!})[^]*?)*)}|([^{].*?)(?=\\s*(?:;|$));)/g;\n private static readonly ELSE_REGEX = /\\s*else(?!\\s*if\\b)\\s*(?:{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}|([^{;]*(?:;|$)))/g;\n private static readonly IS_INSTRUMENTED_REGEX = /(\\brflib_Logger\\b|\\brflib_TestUtil\\b)/;\n private static readonly SYSTEM_DEBUG_REGEX = /System\\.debug\\s*\\(\\s*['\"]([^'\"]*)['\"]\\s*\\)\\s*;/g;\n\n private static readonly PRIMITIVE_TYPES = new Set([\n 'STRING',\n 'INTEGER',\n 'LONG',\n 'DECIMAL',\n 'DOUBLE',\n 'BOOLEAN',\n 'DATE',\n 'DATETIME',\n 'TIME',\n 'ID',\n ]);\n\n private static readonly PRETTIER_CONFIG: prettier.Options = {\n parser: 'apex',\n plugins: ['prettier-plugin-apex'],\n printWidth: 120,\n tabWidth: 4,\n useTabs: false,\n singleQuote: true,\n };\n\n public static async formatContent(content: string): Promise<string> {\n try {\n return await prettier.format(content, this.PRETTIER_CONFIG);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Formatting failed: ${error.message}`);\n }\n throw new Error('Formatting failed with unknown error');\n }\n }\n\n public static isInstrumented(content: string): boolean {\n return this.IS_INSTRUMENTED_REGEX.test(content);\n }\n\n public static detectLogger(content: string): LoggerInfo {\n const match = content.match(this.CLASS_LOGGER_REGEX);\n return {\n exists: this.CLASS_LOGGER_REGEX.test(content),\n variableName: match ? match[1] : 'LOGGER',\n };\n }\n\n public static addLoggerDeclaration(content: string, className: string): string {\n const { exists, variableName } = this.detectLogger(content);\n if (!exists) {\n const loggerDecl = `private static final rflib_Logger ${variableName} = rflib_LoggerUtil.getFactory().createLogger('${className}');`;\n return content.replace(this.CLASS_REGEX, `$&\\n ${loggerDecl}`);\n }\n return content;\n }\n\n public static processMethodDeclarations(content: string, loggerName: string): string {\n return content.replace(this.METHOD_REGEX, (match: string, ...args: unknown[]) => {\n const methodInfo: ApexMethodMatch = {\n auraEnabled: args[0] as string,\n access: args[1] as string,\n isStatic: args[2] as string,\n returnType: args[3] as string,\n methodName: args[4] as string,\n args: args[5] as string,\n };\n\n const { paramList, logArgs } = this.processParameters(methodInfo.args);\n\n return `${match}\\n ${loggerName}.info('${methodInfo.methodName}(${paramList\n .map((_, i) => `{${i}}`)\n .join(', ')})'${logArgs});\\n`;\n });\n }\n\n public static processCatchBlocks(content: string, loggerName: string): string {\n return content.replace(this.CATCH_REGEX, (match: string, exceptionVar: string, offset: number) => {\n const contentBeforeCatch = content.substring(0, offset);\n const methodMatches = [...contentBeforeCatch.matchAll(this.METHOD_REGEX)];\n const lastMethodMatch = methodMatches[methodMatches.length - 1];\n const methodName = lastMethodMatch ? lastMethodMatch[5] : 'unknown';\n\n return `${match}\\n ${loggerName}.error('An error occurred in ${methodName}()', ${exceptionVar.trim()});`;\n });\n }\n\n public static processIfStatements(content: string, loggerName: string): string {\n const conditions: IfCondition[] = [];\n\n let modified = content.replace(\n this.IF_STATEMENT_REGEX,\n (match: string, condition: string, blockBody: string, singleLineBody: string, offset: number) => {\n const cleanedUpCondition = condition.trim().replaceAll(\"'\", \"\\\\'\");\n conditions.push({\n condition: cleanedUpCondition,\n position: offset,\n });\n\n const logStatement = `${loggerName}.debug('if (${cleanedUpCondition})');\\n `;\n\n if (blockBody) {\n return `if (${condition}) {\\n ${logStatement}${blockBody}}\\n`;\n } else if (singleLineBody) {\n const cleanBody = singleLineBody.replace(/;$/, '').trim();\n return `if (${condition}) {\\n ${logStatement}${cleanBody};\\n }\\n`;\n }\n return match;\n },\n );\n\n modified = modified.replace(\n this.ELSE_REGEX,\n (match: string, blockBody?: string, singleLineBody?: string, offset?: number) => {\n const nearestIf = conditions\n .filter((c) => c.position < (offset ?? 0))\n .reduce((prev, curr) => (!prev || curr.position > prev.position ? curr : prev));\n\n const logStatement = nearestIf\n ? `${loggerName}.debug('else for if (${nearestIf.condition})');\\n `\n : `${loggerName}.debug('else statement');\\n `;\n\n if (blockBody) {\n return ` else {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n return ` else {\\n ${logStatement}${singleLineBody}\\n }`;\n }\n return match;\n },\n );\n\n return modified;\n }\n\n public static processSystemDebugStatements(content: string, loggerName: string): string {\n return content.replace(this.SYSTEM_DEBUG_REGEX, (match, debugMessage) => `${loggerName}.debug('${debugMessage}');`);\n }\n\n private static isComplexType(paramType: string): boolean {\n return (\n paramType.includes('<') ||\n paramType.includes('[') ||\n paramType === 'Object' ||\n !this.PRIMITIVE_TYPES.has(paramType.toUpperCase())\n );\n }\n\n private static processParameters(args: string): ProcessedParameters {\n const parameters = args\n ? args\n .replaceAll(this.GENERIC_ARGS_REGEX, '')\n .split(',')\n .map((param) => param.trim())\n : [];\n\n const logArgs =\n parameters.length > 0 && parameters[0] !== ''\n ? `, new Object[] { ${parameters\n .map((p) => {\n const [paramType, ...rest] = p.split(' ');\n const paramName = rest.length > 0 ? rest.join(' ') : paramType;\n return this.isComplexType(paramType) ? `JSON.serialize(${paramName})` : paramName;\n })\n .join(', ')} }`\n : '';\n\n return { paramList: parameters, logArgs };\n }\n}\n\nexport default class RflibLoggingApexInstrument extends SfCommand<RflibLoggingApexInstrumentResult> {\n public static readonly summary = messages.getMessage('summary');\n public static readonly description = messages.getMessage('description');\n public static readonly examples = messages.getMessages('examples');\n\n public static readonly flags = {\n sourcepath: Flags.string({\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n char: 's',\n required: true,\n }),\n dryrun: Flags.boolean({\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n char: 'd',\n default: false,\n }),\n prettier: Flags.boolean({\n summary: messages.getMessage('flags.prettier.summary'),\n description: messages.getMessage('flags.prettier.description'),\n char: 'p',\n default: false,\n }),\n 'no-if': Flags.boolean({\n summary: messages.getMessage('flags.no-if.summary'),\n description: messages.getMessage('flags.no-if.description'),\n default: false,\n }),\n 'skip-instrumented': Flags.boolean({\n summary: messages.getMessage('flags.skip-instrumented.summary'),\n description: messages.getMessage('flags.skip-instrumented.description'),\n default: false,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingApexInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n formattedFiles: 0,\n };\n\n public async run(): Promise<RflibLoggingApexInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const startTime = Date.now();\n\n const { flags } = await this.parse(RflibLoggingApexInstrument);\n const sourcePath = flags.sourcepath;\n const isDryRun = flags.dryrun;\n\n const instrumentationOpts: InstrumentationOptions = {\n prettier: flags.prettier,\n noIf: flags['no-if'],\n skipInstrumented: flags['skip-instrumented'],\n };\n\n this.log(`Scanning Apex classes in ${sourcePath} and sub directories`);\n this.logger.debug(`Dry run mode: ${isDryRun}`);\n\n this.spinner.start('Running...');\n await this.processDirectory(sourcePath, isDryRun, instrumentationOpts);\n this.spinner.stop();\n\n const duration = Date.now() - startTime;\n this.logger.debug(`Completed instrumentation in ${duration}ms`);\n\n this.log('\\nInstrumentation complete.');\n this.log(`Processed files: ${this.stats.processedFiles}`);\n this.log(`Modified files: ${this.stats.modifiedFiles}`);\n this.log(`Formatted files: ${this.stats.formattedFiles}`);\n\n return { ...this.stats };\n }\n\n private async processDirectory(\n dirPath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n this.logger.debug(`Processing directory: ${dirPath}`);\n const files = await fs.promises.readdir(dirPath);\n\n for (const file of files) {\n const filePath = path.join(dirPath, file);\n const stat = await fs.promises.stat(filePath);\n\n if (stat.isDirectory()) {\n await this.processDirectory(filePath, isDryRun, instrumentationOpts);\n } else if (file.includes('Test') && file.endsWith('.cls')) {\n await this.processTestFile(filePath, isDryRun, instrumentationOpts);\n } else if (file.endsWith('.cls')) {\n await this.instrumentApexClass(filePath, isDryRun, instrumentationOpts);\n }\n }\n }\n\n private async processTestFile(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n this.logger.debug(`Processing test file: ${filePath}`);\n let content = await fs.promises.readFile(filePath, 'utf8');\n const originalContent = content;\n\n if (instrumentationOpts.skipInstrumented && ApexInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented test class: ${filePath}`);\n return;\n }\n\n content = content.replace(\n ApexInstrumentationService.TEST_SETUP_REGEX,\n (match) => `${match}\\n rflib_TestUtil.prepareLoggerForUnitTests();`,\n );\n\n if (content !== originalContent) {\n this.stats.modifiedFiles++;\n if (!isDryRun) {\n try {\n const finalContent = instrumentationOpts.prettier\n ? await ApexInstrumentationService.formatContent(content)\n : content;\n\n await fs.promises.writeFile(filePath, finalContent);\n\n if (instrumentationOpts.prettier) {\n this.stats.formattedFiles++;\n this.logger.info(`Modified and formatted test file: ${filePath}`);\n } else {\n this.logger.info(`Modified test file: ${filePath}`);\n }\n } catch (error) {\n this.logger.warn(`Failed to format ${filePath}: ${error instanceof Error ? error.message : String(error)}`);\n await fs.promises.writeFile(filePath, content);\n this.logger.info(`Modified test file without formatting: ${filePath}`);\n }\n } else {\n this.logger.info(`Would modify test file: ${filePath}`);\n }\n }\n }\n\n private async instrumentApexClass(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n const className = path.basename(filePath, '.cls');\n this.logger.debug(`Processing class: ${className}`);\n\n try {\n this.stats.processedFiles++;\n let content = await fs.promises.readFile(filePath, 'utf8');\n const originalContent = content;\n\n if (instrumentationOpts.skipInstrumented && ApexInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented class: ${className}`);\n return;\n }\n\n const { variableName } = ApexInstrumentationService.detectLogger(content);\n content = ApexInstrumentationService.addLoggerDeclaration(content, className);\n content = ApexInstrumentationService.processMethodDeclarations(content, variableName);\n content = ApexInstrumentationService.processSystemDebugStatements(content, variableName);\n content = ApexInstrumentationService.processCatchBlocks(content, variableName);\n\n if (!instrumentationOpts.noIf) {\n content = ApexInstrumentationService.processIfStatements(content, variableName);\n }\n\n if (content !== originalContent) {\n this.stats.modifiedFiles++;\n if (!isDryRun) {\n try {\n const finalContent = instrumentationOpts.prettier\n ? await ApexInstrumentationService.formatContent(content)\n : content;\n\n await fs.promises.writeFile(filePath, finalContent);\n\n if (instrumentationOpts.prettier) {\n this.stats.formattedFiles++;\n this.logger.info(`Modified and formatted: ${filePath}`);\n } else {\n this.logger.info(`Modified: ${filePath}`);\n }\n } catch (error) {\n this.logger.warn(`Failed to format ${filePath}: ${error instanceof Error ? error.message : String(error)}`);\n await fs.promises.writeFile(filePath, content);\n this.logger.info(`Modified without formatting: ${filePath}`);\n }\n } else {\n this.logger.info(`Would modify: ${filePath}`);\n }\n }\n } catch (error) {\n this.logger.error(`Error processing class ${className}`, error);\n throw error;\n }\n }\n}\n"]}
|
|
@@ -10,8 +10,13 @@ export declare class FlowInstrumentationService {
|
|
|
10
10
|
static buildFlowContent(flowObj: any): string;
|
|
11
11
|
static hasRFLIBLogger(flowObj: any): boolean;
|
|
12
12
|
static isFlowType(flowObj: any): boolean;
|
|
13
|
-
static instrumentFlow(flowObj: any, flowName: string): any;
|
|
13
|
+
static instrumentFlow(flowObj: any, flowName: string, skipInstrumented?: boolean): any;
|
|
14
|
+
private static instrumentDecisions;
|
|
15
|
+
private static addActionCallToFlow;
|
|
16
|
+
private static createDecisionPathLogger;
|
|
14
17
|
private static generateUniqueId;
|
|
18
|
+
private static sanitizeForName;
|
|
19
|
+
private static truncateLabel;
|
|
15
20
|
private static createLoggingAction;
|
|
16
21
|
private static enhanceLoggingWithVariables;
|
|
17
22
|
}
|
|
@@ -59,16 +59,16 @@ export class FlowInstrumentationService {
|
|
|
59
59
|
action.actionName === 'rflib_ApplicationEventLoggerAction' ||
|
|
60
60
|
(action.name && typeof action.name === 'string' && action.name.startsWith('RFLIB_Flow_Logger')));
|
|
61
61
|
}
|
|
62
|
-
// Helper to check if flow is of type
|
|
62
|
+
// Helper to check if flow is of type that we want to instrument
|
|
63
63
|
static isFlowType(flowObj) {
|
|
64
64
|
return flowObj?.Flow?.processType === 'Flow';
|
|
65
65
|
}
|
|
66
66
|
// Main instrumentation function
|
|
67
|
-
static instrumentFlow(flowObj, flowName) {
|
|
67
|
+
static instrumentFlow(flowObj, flowName, skipInstrumented = false) {
|
|
68
68
|
// Deep clone the object to avoid modifying the original
|
|
69
69
|
const instrumentedFlow = JSON.parse(JSON.stringify(flowObj));
|
|
70
|
-
// Skip if already instrumented
|
|
71
|
-
if (this.hasRFLIBLogger(instrumentedFlow)) {
|
|
70
|
+
// Skip if already instrumented and skipInstrumented flag is set
|
|
71
|
+
if (skipInstrumented && this.hasRFLIBLogger(instrumentedFlow)) {
|
|
72
72
|
return instrumentedFlow;
|
|
73
73
|
}
|
|
74
74
|
// Make sure Flow exists in the object
|
|
@@ -134,20 +134,275 @@ export class FlowInstrumentationService {
|
|
|
134
134
|
else if (!Array.isArray(instrumentedFlow.Flow.variables)) {
|
|
135
135
|
instrumentedFlow.Flow.variables = [instrumentedFlow.Flow.variables];
|
|
136
136
|
}
|
|
137
|
+
// Instrument decisions with logging for each outcome
|
|
138
|
+
if (instrumentedFlow.Flow.decisions) {
|
|
139
|
+
this.instrumentDecisions(instrumentedFlow, flowName);
|
|
140
|
+
}
|
|
137
141
|
return instrumentedFlow;
|
|
138
142
|
}
|
|
139
|
-
// Helper to
|
|
143
|
+
// Helper to instrument decision paths with logging
|
|
144
|
+
static instrumentDecisions(flowObj, flowName) {
|
|
145
|
+
if (!flowObj.Flow.decisions) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Convert to array if there's only one decision
|
|
149
|
+
const decisions = Array.isArray(flowObj.Flow.decisions)
|
|
150
|
+
? flowObj.Flow.decisions
|
|
151
|
+
: [flowObj.Flow.decisions];
|
|
152
|
+
// Process each decision
|
|
153
|
+
decisions.forEach((decision) => {
|
|
154
|
+
// Skip if decision doesn't have a name
|
|
155
|
+
if (!decision.name) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const decisionName = decision.name;
|
|
159
|
+
const decisionLabel = decision.label || decisionName;
|
|
160
|
+
// Process default connector if it exists
|
|
161
|
+
if (decision.defaultConnector?.targetReference) {
|
|
162
|
+
const defaultTarget = decision.defaultConnector.targetReference;
|
|
163
|
+
const defaultConnectorLabel = decision.defaultConnectorLabel || 'Default Outcome';
|
|
164
|
+
// Create a logger for the default path
|
|
165
|
+
const defaultLogger = this.createDecisionPathLogger(flowName, String(decisionName), String(decisionLabel), 'default', String(defaultConnectorLabel));
|
|
166
|
+
// Connect logger to the original target
|
|
167
|
+
defaultLogger.connector = {
|
|
168
|
+
targetReference: defaultTarget
|
|
169
|
+
};
|
|
170
|
+
// Add logger to actionCalls first, before updating the decision connector
|
|
171
|
+
this.addActionCallToFlow(flowObj, defaultLogger);
|
|
172
|
+
// Update the decision's default connector to point to our logger
|
|
173
|
+
// We're inside a forEach callback, so we have to modify the original object
|
|
174
|
+
/* eslint-disable no-param-reassign */
|
|
175
|
+
decision.defaultConnector.targetReference = defaultLogger.name;
|
|
176
|
+
/* eslint-enable no-param-reassign */
|
|
177
|
+
}
|
|
178
|
+
// Process each rule if they exist
|
|
179
|
+
if (decision.rules) {
|
|
180
|
+
const rules = Array.isArray(decision.rules) ? decision.rules : [decision.rules];
|
|
181
|
+
rules.forEach((rule) => {
|
|
182
|
+
// Skip if rule doesn't have a connector or name
|
|
183
|
+
if (!rule.connector?.targetReference || !rule.name) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const ruleTarget = rule.connector.targetReference;
|
|
187
|
+
const ruleName = rule.name;
|
|
188
|
+
const ruleLabel = rule.label || ruleName;
|
|
189
|
+
// Create a logger for this rule outcome
|
|
190
|
+
const ruleLogger = this.createDecisionPathLogger(flowName, String(decisionName), String(decisionLabel), String(ruleName), String(ruleLabel));
|
|
191
|
+
// Connect logger to the original target
|
|
192
|
+
ruleLogger.connector = {
|
|
193
|
+
targetReference: ruleTarget
|
|
194
|
+
};
|
|
195
|
+
// Add logger to actionCalls first, before updating the rule connector
|
|
196
|
+
this.addActionCallToFlow(flowObj, ruleLogger);
|
|
197
|
+
// Update the rule's connector to point to our logger
|
|
198
|
+
// We're inside a forEach callback, so we have to modify the original object
|
|
199
|
+
/* eslint-disable no-param-reassign */
|
|
200
|
+
rule.connector.targetReference = ruleLogger.name;
|
|
201
|
+
/* eslint-enable no-param-reassign */
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
// Helper to add action calls to the flow object
|
|
207
|
+
// Note: This method does modify the parameter directly - we accepted the eslint warning
|
|
208
|
+
// since we need to modify the flow object within callback functions where returning a new value isn't possible
|
|
209
|
+
static addActionCallToFlow(flowObj, actionCall) {
|
|
210
|
+
/* eslint-disable no-param-reassign */
|
|
211
|
+
if (!flowObj.Flow.actionCalls) {
|
|
212
|
+
flowObj.Flow.actionCalls = actionCall;
|
|
213
|
+
}
|
|
214
|
+
else if (Array.isArray(flowObj.Flow.actionCalls)) {
|
|
215
|
+
flowObj.Flow.actionCalls.push(actionCall);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
// If only one action exists, convert to array
|
|
219
|
+
flowObj.Flow.actionCalls = [flowObj.Flow.actionCalls, actionCall];
|
|
220
|
+
}
|
|
221
|
+
/* eslint-enable no-param-reassign */
|
|
222
|
+
}
|
|
223
|
+
// Helper to create a logging action for decision paths
|
|
224
|
+
static createDecisionPathLogger(flowName, decisionName, decisionLabel, outcomeName, outcomeLabel) {
|
|
225
|
+
const loggerId = this.generateUniqueId();
|
|
226
|
+
// Ensure we're working with strings
|
|
227
|
+
const decisionNameStr = String(decisionName);
|
|
228
|
+
const outcomeNameStr = String(outcomeName);
|
|
229
|
+
const decisionLabelStr = String(decisionLabel);
|
|
230
|
+
const outcomeLabelStr = String(outcomeLabel);
|
|
231
|
+
// Calculate maximum lengths to stay under 80 characters
|
|
232
|
+
const prefixLength = 'RFLIB_Flow_Logger_Decision_'.length;
|
|
233
|
+
const separatorsLength = 2; // Two underscores
|
|
234
|
+
const maxTotalNameLength = 80 - prefixLength - loggerId.length - separatorsLength;
|
|
235
|
+
// Allocate half of available space to each name (decision and outcome)
|
|
236
|
+
const maxIndividualLength = Math.floor(maxTotalNameLength / 2);
|
|
237
|
+
// Sanitize names to fit Salesforce naming rules
|
|
238
|
+
const sanitizedDecisionName = this.sanitizeForName(decisionNameStr, maxIndividualLength);
|
|
239
|
+
const sanitizedOutcomeName = this.sanitizeForName(outcomeNameStr, maxIndividualLength);
|
|
240
|
+
// Create a name that's guaranteed to be under 80 chars and follow Salesforce rules
|
|
241
|
+
const name = `RFLIB_Flow_Logger_Decision_${sanitizedDecisionName}_${sanitizedOutcomeName}_${loggerId}`;
|
|
242
|
+
// Create and truncate the label to ensure it's under 80 chars
|
|
243
|
+
const label = this.truncateLabel(`Log Decision: ${decisionLabelStr} - ${outcomeLabelStr}`);
|
|
244
|
+
// Fallback if still too long
|
|
245
|
+
if (name.length > 80) {
|
|
246
|
+
return {
|
|
247
|
+
actionName: 'rflib_LoggerFlowAction',
|
|
248
|
+
actionType: 'apex',
|
|
249
|
+
name: `RFLIBLogDec${loggerId}`,
|
|
250
|
+
label,
|
|
251
|
+
locationX: 176,
|
|
252
|
+
locationY: 50,
|
|
253
|
+
inputParameters: [
|
|
254
|
+
{
|
|
255
|
+
name: 'context',
|
|
256
|
+
value: {
|
|
257
|
+
stringValue: flowName,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'logLevel',
|
|
262
|
+
value: {
|
|
263
|
+
stringValue: 'INFO',
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: 'message',
|
|
268
|
+
value: {
|
|
269
|
+
stringValue: `Decision '${decisionLabelStr}' outcome: ${outcomeLabelStr}`,
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
actionName: 'rflib_LoggerFlowAction',
|
|
277
|
+
actionType: 'apex',
|
|
278
|
+
name,
|
|
279
|
+
label,
|
|
280
|
+
locationX: 176,
|
|
281
|
+
locationY: 50,
|
|
282
|
+
inputParameters: [
|
|
283
|
+
{
|
|
284
|
+
name: 'context',
|
|
285
|
+
value: {
|
|
286
|
+
stringValue: flowName,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: 'logLevel',
|
|
291
|
+
value: {
|
|
292
|
+
stringValue: 'INFO',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: 'message',
|
|
297
|
+
value: {
|
|
298
|
+
stringValue: `Decision '${decisionLabelStr}' outcome: ${outcomeLabelStr}`,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
// Helper to generate unique IDs for new flow elements (compact for 80-char limit)
|
|
305
|
+
// that follow Salesforce Flow Action naming rules
|
|
140
306
|
static generateUniqueId() {
|
|
141
|
-
|
|
307
|
+
// Use timestamp in base36 + 4 random chars to keep it short but unique
|
|
308
|
+
// Ensure we don't start with a number or have consecutive/trailing underscores
|
|
309
|
+
const timestamp = Date.now().toString(36);
|
|
310
|
+
const random = Math.random().toString(36).substring(2, 6);
|
|
311
|
+
// Combine parts without underscore to avoid potential consecutive underscores
|
|
312
|
+
return `ID${timestamp}${random}`;
|
|
313
|
+
}
|
|
314
|
+
// Helper to sanitize and truncate text to fit within the 80-char name limit
|
|
315
|
+
// and to follow Salesforce Flow Action naming rules:
|
|
316
|
+
// - Only alphanumeric characters and underscores
|
|
317
|
+
// - Must begin with a letter
|
|
318
|
+
// - No spaces
|
|
319
|
+
// - No underscore at the end
|
|
320
|
+
// - No consecutive underscores
|
|
321
|
+
static sanitizeForName(text, maxLength) {
|
|
322
|
+
if (!text) {
|
|
323
|
+
return 'X'; // Default to 'X' for empty inputs to ensure we start with a letter
|
|
324
|
+
}
|
|
325
|
+
// First, replace any non-alphanumeric characters with underscores
|
|
326
|
+
let sanitized = text.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
327
|
+
// Ensure it starts with a letter
|
|
328
|
+
if (!/^[a-zA-Z]/.test(sanitized)) {
|
|
329
|
+
sanitized = 'X' + sanitized;
|
|
330
|
+
}
|
|
331
|
+
// Replace consecutive underscores with a single underscore
|
|
332
|
+
sanitized = sanitized.replace(/__+/g, '_');
|
|
333
|
+
// Remove trailing underscore if present
|
|
334
|
+
sanitized = sanitized.replace(/_+$/, '');
|
|
335
|
+
// If empty after sanitization, return a default value
|
|
336
|
+
if (!sanitized) {
|
|
337
|
+
return 'X';
|
|
338
|
+
}
|
|
339
|
+
// Truncate if longer than maxLength
|
|
340
|
+
if (sanitized.length > maxLength) {
|
|
341
|
+
// Truncate and ensure it doesn't end with an underscore
|
|
342
|
+
sanitized = sanitized.substring(0, maxLength).replace(/_+$/, '');
|
|
343
|
+
// If we removed trailing underscores and now it's empty or too short, add a fallback
|
|
344
|
+
if (sanitized.length < 1) {
|
|
345
|
+
sanitized = 'X';
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return sanitized;
|
|
349
|
+
}
|
|
350
|
+
// Helper to truncate label text to fit within the 80-char limit
|
|
351
|
+
static truncateLabel(label, maxLength = 80) {
|
|
352
|
+
if (!label || label.length <= maxLength) {
|
|
353
|
+
return label;
|
|
354
|
+
}
|
|
355
|
+
// If text is too long, truncate it and add ellipsis
|
|
356
|
+
return label.substring(0, maxLength - 3) + '...';
|
|
142
357
|
}
|
|
143
358
|
// Helper to create a logging action element
|
|
144
359
|
static createLoggingAction(flowName) {
|
|
145
360
|
const loggerId = this.generateUniqueId();
|
|
361
|
+
// Ensure name is under 80 characters and follows Salesforce naming rules
|
|
362
|
+
const prefixLength = 'RFLIB_Flow_Logger_'.length;
|
|
363
|
+
const maxFlowNameLength = 80 - prefixLength - loggerId.length - 1; // -1 for underscore
|
|
364
|
+
const sanitizedFlowName = this.sanitizeForName(flowName, maxFlowNameLength);
|
|
365
|
+
// Create a name that's guaranteed to be under 80 chars and follow Salesforce rules
|
|
366
|
+
const name = `RFLIB_Flow_Logger_${sanitizedFlowName}_${loggerId}`;
|
|
367
|
+
// Create and truncate the label to ensure it's under 80 chars
|
|
368
|
+
const label = this.truncateLabel(`Log Flow Invocation: ${flowName}`);
|
|
369
|
+
// Verify name length
|
|
370
|
+
if (name.length > 80) {
|
|
371
|
+
// If still too long, use a simpler naming scheme (fallback)
|
|
372
|
+
return {
|
|
373
|
+
actionName: 'rflib_LoggerFlowAction',
|
|
374
|
+
actionType: 'apex',
|
|
375
|
+
name: `RFLIBLogger${loggerId}`,
|
|
376
|
+
label,
|
|
377
|
+
locationX: 176,
|
|
378
|
+
locationY: 50,
|
|
379
|
+
inputParameters: [
|
|
380
|
+
{
|
|
381
|
+
name: 'context',
|
|
382
|
+
value: {
|
|
383
|
+
stringValue: flowName,
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: 'logLevel',
|
|
388
|
+
value: {
|
|
389
|
+
stringValue: 'INFO',
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
name: 'message',
|
|
394
|
+
value: {
|
|
395
|
+
stringValue: `Flow ${flowName} started`,
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
],
|
|
399
|
+
};
|
|
400
|
+
}
|
|
146
401
|
return {
|
|
147
402
|
actionName: 'rflib_LoggerFlowAction',
|
|
148
403
|
actionType: 'apex',
|
|
149
|
-
name
|
|
150
|
-
label
|
|
404
|
+
name,
|
|
405
|
+
label,
|
|
151
406
|
locationX: 176,
|
|
152
407
|
locationY: 50,
|
|
153
408
|
inputParameters: [
|
|
@@ -274,7 +529,7 @@ export default class RflibLoggingFlowInstrument extends SfCommand {
|
|
|
274
529
|
this.logger.info(`Skipping already instrumented flow: ${flowName}`);
|
|
275
530
|
return;
|
|
276
531
|
}
|
|
277
|
-
const instrumentedFlow = FlowInstrumentationService.instrumentFlow(flowObj, flowName);
|
|
532
|
+
const instrumentedFlow = FlowInstrumentationService.instrumentFlow(flowObj, flowName, skipInstrumented);
|
|
278
533
|
const newContent = FlowInstrumentationService.buildFlowContent(instrumentedFlow);
|
|
279
534
|
if (content !== newContent) {
|
|
280
535
|
this.stats.modifiedFiles++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/flow/instrument.ts"],"names":[],"mappings":"A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I,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,QAAQ,iBAAiB,OAAO,EAAE,IAAI,EAAE,WAAW,IAAI,WAAW,GAAG,CAAC,CAAC;gBACpH,OAAO;YACT,CAAC;YAED,6DAA6D;YAC7D,IAAI,gBAAgB,IAAI,0BAA0B,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAuC,QAAQ,EAAE,CAAC,CAAC;gBACpE,OAAO;YACT,CAAC;YAED,MAAM,gBAAgB,GAAG,0BAA0B,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACtF,MAAM,UAAU,GAAG,0BAA0B,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;YAEjF,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;gBAC3B,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;oBAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;gBAC5C,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;YAC9D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["/* eslint-disable no-await-in-loop */\n/* eslint-disable @typescript-eslint/return-await */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-core';\nimport { Messages, Logger } from '@salesforce/core';\nimport * as xml2js from 'xml2js';\n\nexport type RflibLoggingFlowInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n};\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.flow.instrument');\n\n// Type definition removed to fix compiler error\n// This was used to document valid Flow variable types: 'String' | 'Number' | 'Boolean' | 'SObject' | 'SObjectCollection'\n\nexport class FlowInstrumentationService {\n private static readonly parser = new xml2js.Parser({\n explicitArray: false,\n preserveChildrenOrder: true,\n xmlns: false\n });\n\n private static readonly builder = new xml2js.Builder({\n xmldec: { version: '1.0', encoding: 'UTF-8' },\n cdata: true\n });\n\n public static async parseFlowContent(content: string): Promise<any> {\n try {\n return await this.parser.parseStringPromise(content);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Flow parsing failed: ${error.message}`);\n }\n throw new Error('Flow parsing failed with unknown error');\n }\n }\n\n public static buildFlowContent(flowObj: any): string {\n try {\n return this.builder.buildObject(flowObj);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Flow building failed: ${error.message}`);\n }\n throw new Error('Flow building failed with unknown error');\n }\n }\n\n // Helper to check if flow already contains RFLIB logger\n public static hasRFLIBLogger(flowObj: any): boolean {\n if (!flowObj?.Flow?.actionCalls) {\n return false;\n }\n\n const actionCalls = Array.isArray(flowObj.Flow.actionCalls)\n ? flowObj.Flow.actionCalls\n : [flowObj.Flow.actionCalls];\n\n return actionCalls.some(\n (action: any) => \n action.actionName === 'rflib:Logger' || \n action.actionName === 'rflib_LoggerFlowAction' ||\n action.actionName === 'rflib_ApplicationEventLoggerAction' ||\n (action.name && typeof action.name === 'string' && action.name.startsWith('RFLIB_Flow_Logger'))\n );\n }\n\n // Helper to check if flow is of type \"Flow\" that we want to instrument\n public static isFlowType(flowObj: any): boolean {\n return flowObj?.Flow?.processType === 'Flow';\n }\n\n // Main instrumentation function\n public static instrumentFlow(flowObj: any, flowName: string): any {\n // Deep clone the object to avoid modifying the original\n const instrumentedFlow = JSON.parse(JSON.stringify(flowObj));\n\n // Skip if already instrumented\n if (this.hasRFLIBLogger(instrumentedFlow)) {\n return instrumentedFlow;\n }\n\n // Make sure Flow exists in the object\n if (!instrumentedFlow.Flow) {\n return instrumentedFlow;\n }\n\n // Create logging action element\n let loggingAction = this.createLoggingAction(flowName);\n\n // Add variables to the logging message if available\n loggingAction = this.enhanceLoggingWithVariables(loggingAction, instrumentedFlow);\n\n // Add logging action to actionCalls\n if (!instrumentedFlow.Flow.actionCalls) {\n instrumentedFlow.Flow.actionCalls = loggingAction;\n } else if (Array.isArray(instrumentedFlow.Flow.actionCalls)) {\n instrumentedFlow.Flow.actionCalls.push(loggingAction);\n } else {\n // If only one action exists, convert to array\n instrumentedFlow.Flow.actionCalls = [instrumentedFlow.Flow.actionCalls, loggingAction];\n }\n\n // Find startElementReference and connect logger to it\n if (instrumentedFlow.Flow.startElementReference) {\n // Save the original start reference\n const startNodeReference = instrumentedFlow.Flow.startElementReference;\n \n // Create connector between logger and original start element\n loggingAction.connector = {\n targetReference: startNodeReference\n };\n \n // Update flow startElementReference to point to our logger\n instrumentedFlow.Flow.startElementReference = loggingAction.name;\n } else {\n // If no start element, try to find another entry point\n // Common patterns: decisions, screens, or first element in the process\n if (Array.isArray(instrumentedFlow.Flow.decisions) && instrumentedFlow.Flow.decisions.length > 0) {\n // Find the first decision and connect to it\n const firstDecision = instrumentedFlow.Flow.decisions[0];\n loggingAction.connector = {\n targetReference: firstDecision.name\n };\n } else if (Array.isArray(instrumentedFlow.Flow.screens) && instrumentedFlow.Flow.screens.length > 0) {\n // Find the first screen and connect to it\n const firstScreen = instrumentedFlow.Flow.screens[0];\n loggingAction.connector = {\n targetReference: firstScreen.name\n };\n }\n\n // Create a startElementReference pointing to our logger if none exists\n instrumentedFlow.Flow.startElementReference = loggingAction.name;\n }\n\n // Add interviewLabel if not present\n if (!instrumentedFlow.Flow.interviewLabel) {\n instrumentedFlow.Flow.interviewLabel = `${flowName} {!$Flow.CurrentDateTime}`;\n }\n\n // Ensure processType is set to 'Flow'\n instrumentedFlow.Flow.processType = 'Flow';\n\n // Add variables if not present (needed for variable references)\n if (!instrumentedFlow.Flow.variables) {\n instrumentedFlow.Flow.variables = [];\n } else if (!Array.isArray(instrumentedFlow.Flow.variables)) {\n instrumentedFlow.Flow.variables = [instrumentedFlow.Flow.variables];\n }\n\n return instrumentedFlow;\n }\n\n // Helper to generate unique IDs for new flow elements\n private static generateUniqueId(): string {\n return `RFLIB_LOG_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;\n }\n\n // Helper to create a logging action element\n private static createLoggingAction(flowName: string): any {\n const loggerId = this.generateUniqueId();\n return {\n actionName: 'rflib_LoggerFlowAction',\n actionType: 'apex',\n name: `RFLIB_Flow_Logger_${loggerId}`,\n label: 'Log Flow Invocation',\n locationX: 176,\n locationY: 50,\n inputParameters: [\n {\n name: 'context',\n value: {\n stringValue: flowName,\n },\n },\n {\n name: 'logLevel',\n value: {\n stringValue: 'INFO',\n },\n },\n {\n name: 'message',\n value: {\n stringValue: `Flow ${flowName} started`,\n },\n },\n ],\n };\n }\n\n // Helper to add variable references to the logging message when available\n private static enhanceLoggingWithVariables(loggingAction: any, flowObj: any): any {\n // Find input variables or parameters that might be useful to log\n const variables = flowObj.Flow.variables || [];\n const inputVariables = Array.isArray(variables)\n ? variables.filter((v: any) => v.isInput === 'true' || v.isCollection === 'true')\n : (variables.isInput === 'true' || variables.isCollection === 'true' ? [variables] : []);\n\n if (inputVariables.length > 0) {\n // Find the message parameter - case insensitive search\n const messageParamIndex = loggingAction.inputParameters.findIndex(\n (p: any) => p.name?.toLowerCase() === 'message'\n );\n\n if (messageParamIndex >= 0) {\n // Enhance the message with variable information\n const varRefs = inputVariables\n .map((v: any) => `${v.name}: {!${v.name}}`)\n .join(', ');\n\n const baseMessage = loggingAction.inputParameters[messageParamIndex];\n const originalMessage = baseMessage.value.stringValue;\n baseMessage.value.stringValue = `${originalMessage} with ${varRefs}`;\n }\n }\n\n return loggingAction;\n }\n}\n\nexport default class RflibLoggingFlowInstrument extends SfCommand<RflibLoggingFlowInstrumentResult> {\n public static readonly summary = messages.getMessage('summary');\n public static readonly description = messages.getMessage('description');\n public static readonly examples = messages.getMessages('examples');\n\n public static readonly flags = {\n sourcepath: Flags.string({\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n char: 's',\n required: true,\n }),\n dryrun: Flags.boolean({\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n char: 'd',\n default: false,\n }),\n 'skip-instrumented': Flags.boolean({\n summary: messages.getMessage('flags.skip-instrumented.summary') || 'Skip flows that already have RFLIB logging',\n description: messages.getMessage('flags.skip-instrumented.description') || 'Do not instrument flows where RFLIB logging is already present',\n default: false,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingFlowInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n };\n\n public async run(): Promise<RflibLoggingFlowInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const startTime = Date.now();\n\n const { flags } = await this.parse(RflibLoggingFlowInstrument);\n const sourcePath = flags.sourcepath;\n const isDryRun = flags.dryrun;\n const skipInstrumented = flags['skip-instrumented'];\n\n this.log(`Scanning Flow files in ${sourcePath} and sub directories`);\n this.logger.debug(`Dry run mode: ${isDryRun}`);\n this.logger.debug(`Skip instrumented: ${skipInstrumented}`);\n\n this.spinner.start('Running...');\n await this.processDirectory(sourcePath, isDryRun, skipInstrumented);\n this.spinner.stop();\n\n const duration = Date.now() - startTime;\n this.logger.debug(`Completed instrumentation in ${duration}ms`);\n\n this.log('\\nInstrumentation complete.');\n this.log(`Processed files: ${this.stats.processedFiles}`);\n this.log(`Modified files: ${this.stats.modifiedFiles}`);\n\n return { ...this.stats };\n }\n\n private async processDirectory(dirPath: string, isDryRun: boolean, skipInstrumented: boolean): Promise<void> {\n this.logger.debug(`Processing directory: ${dirPath}`);\n const files = await fs.promises.readdir(dirPath);\n\n for (const file of files) {\n const filePath = path.join(dirPath, file);\n const stat = await fs.promises.stat(filePath);\n\n if (stat.isDirectory()) {\n await this.processDirectory(filePath, isDryRun, skipInstrumented);\n } else if (file.endsWith('.flow-meta.xml')) {\n await this.instrumentFlowFile(filePath, isDryRun, skipInstrumented);\n }\n }\n }\n\n private async instrumentFlowFile(filePath: string, isDryRun: boolean, skipInstrumented: boolean): Promise<void> {\n const flowName = path.basename(filePath, '.flow-meta.xml');\n this.logger.debug(`Processing flow: ${flowName}`);\n\n try {\n this.stats.processedFiles++;\n const content = await fs.promises.readFile(filePath, 'utf8');\n const flowObj = await FlowInstrumentationService.parseFlowContent(content);\n\n // Only instrument flows with processType=\"Flow\", skip all others\n if (!FlowInstrumentationService.isFlowType(flowObj)) {\n this.logger.debug(`Skipping non-Flow type: ${flowName} (processType=${flowObj?.Flow?.processType || 'undefined'})`);\n return;\n }\n\n // Check if flow already has RFLIB logging and skip if needed\n if (skipInstrumented && FlowInstrumentationService.hasRFLIBLogger(flowObj)) {\n this.logger.info(`Skipping already instrumented flow: ${flowName}`);\n return;\n }\n\n const instrumentedFlow = FlowInstrumentationService.instrumentFlow(flowObj, flowName);\n const newContent = FlowInstrumentationService.buildFlowContent(instrumentedFlow);\n\n if (content !== newContent) {\n this.stats.modifiedFiles++;\n if (!isDryRun) {\n await fs.promises.writeFile(filePath, newContent);\n this.logger.info(`Modified: ${filePath}`);\n } else {\n this.logger.info(`Would modify: ${filePath}`);\n }\n }\n } catch (error) {\n this.logger.error(`Error processing flow ${flowName}`, error);\n throw error;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"instrument.js","sourceRo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UAAU,CAAC,CAAC;oBAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;gBAC5C,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;YAC9D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["/* eslint-disable no-await-in-loop */\n/* eslint-disable @typescript-eslint/return-await */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-core';\nimport { Messages, Logger } from '@salesforce/core';\nimport * as xml2js from 'xml2js';\n\nexport type RflibLoggingFlowInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n};\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.flow.instrument');\n\n// Type definition removed to fix compiler error\n// This was used to document valid Flow variable types: 'String' | 'Number' | 'Boolean' | 'SObject' | 'SObjectCollection'\n\nexport class FlowInstrumentationService {\n private static readonly parser = new xml2js.Parser({\n explicitArray: false,\n preserveChildrenOrder: true,\n xmlns: false\n });\n\n private static readonly builder = new xml2js.Builder({\n xmldec: { version: '1.0', encoding: 'UTF-8' },\n cdata: true\n });\n\n public static async parseFlowContent(content: string): Promise<any> {\n try {\n return await this.parser.parseStringPromise(content);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Flow parsing failed: ${error.message}`);\n }\n throw new Error('Flow parsing failed with unknown error');\n }\n }\n\n public static buildFlowContent(flowObj: any): string {\n try {\n return this.builder.buildObject(flowObj);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Flow building failed: ${error.message}`);\n }\n throw new Error('Flow building failed with unknown error');\n }\n }\n\n // Helper to check if flow already contains RFLIB logger\n public static hasRFLIBLogger(flowObj: any): boolean {\n if (!flowObj?.Flow?.actionCalls) {\n return false;\n }\n\n const actionCalls = Array.isArray(flowObj.Flow.actionCalls)\n ? flowObj.Flow.actionCalls\n : [flowObj.Flow.actionCalls];\n\n return actionCalls.some(\n (action: any) => \n action.actionName === 'rflib:Logger' || \n action.actionName === 'rflib_LoggerFlowAction' ||\n action.actionName === 'rflib_ApplicationEventLoggerAction' ||\n (action.name && typeof action.name === 'string' && action.name.startsWith('RFLIB_Flow_Logger'))\n );\n }\n\n // Helper to check if flow is of type that we want to instrument\n public static isFlowType(flowObj: any): boolean {\n return flowObj?.Flow?.processType === 'Flow';\n }\n\n // Main instrumentation function\n public static instrumentFlow(flowObj: any, flowName: string, skipInstrumented = false): any {\n // Deep clone the object to avoid modifying the original\n const instrumentedFlow = JSON.parse(JSON.stringify(flowObj));\n\n // Skip if already instrumented and skipInstrumented flag is set\n if (skipInstrumented && this.hasRFLIBLogger(instrumentedFlow)) {\n return instrumentedFlow;\n }\n\n // Make sure Flow exists in the object\n if (!instrumentedFlow.Flow) {\n return instrumentedFlow;\n }\n\n // Create logging action element\n let loggingAction = this.createLoggingAction(flowName);\n\n // Add variables to the logging message if available\n loggingAction = this.enhanceLoggingWithVariables(loggingAction, instrumentedFlow);\n\n // Add logging action to actionCalls\n if (!instrumentedFlow.Flow.actionCalls) {\n instrumentedFlow.Flow.actionCalls = loggingAction;\n } else if (Array.isArray(instrumentedFlow.Flow.actionCalls)) {\n instrumentedFlow.Flow.actionCalls.push(loggingAction);\n } else {\n // If only one action exists, convert to array\n instrumentedFlow.Flow.actionCalls = [instrumentedFlow.Flow.actionCalls, loggingAction];\n }\n\n // Find startElementReference and connect logger to it\n if (instrumentedFlow.Flow.startElementReference) {\n // Save the original start reference\n const startNodeReference = instrumentedFlow.Flow.startElementReference;\n \n // Create connector between logger and original start element\n loggingAction.connector = {\n targetReference: startNodeReference\n };\n \n // Update flow startElementReference to point to our logger\n instrumentedFlow.Flow.startElementReference = loggingAction.name;\n } else {\n // If no start element, try to find another entry point\n // Common patterns: decisions, screens, or first element in the process\n if (Array.isArray(instrumentedFlow.Flow.decisions) && instrumentedFlow.Flow.decisions.length > 0) {\n // Find the first decision and connect to it\n const firstDecision = instrumentedFlow.Flow.decisions[0];\n loggingAction.connector = {\n targetReference: firstDecision.name\n };\n } else if (Array.isArray(instrumentedFlow.Flow.screens) && instrumentedFlow.Flow.screens.length > 0) {\n // Find the first screen and connect to it\n const firstScreen = instrumentedFlow.Flow.screens[0];\n loggingAction.connector = {\n targetReference: firstScreen.name\n };\n }\n\n // Create a startElementReference pointing to our logger if none exists\n instrumentedFlow.Flow.startElementReference = loggingAction.name;\n }\n\n // Add interviewLabel if not present\n if (!instrumentedFlow.Flow.interviewLabel) {\n instrumentedFlow.Flow.interviewLabel = `${flowName} {!$Flow.CurrentDateTime}`;\n }\n\n // Ensure processType is set to 'Flow'\n instrumentedFlow.Flow.processType = 'Flow';\n\n // Add variables if not present (needed for variable references)\n if (!instrumentedFlow.Flow.variables) {\n instrumentedFlow.Flow.variables = [];\n } else if (!Array.isArray(instrumentedFlow.Flow.variables)) {\n instrumentedFlow.Flow.variables = [instrumentedFlow.Flow.variables];\n }\n\n // Instrument decisions with logging for each outcome\n if (instrumentedFlow.Flow.decisions) {\n this.instrumentDecisions(instrumentedFlow, flowName);\n }\n\n return instrumentedFlow;\n }\n \n // Helper to instrument decision paths with logging\n private static instrumentDecisions(flowObj: any, flowName: string): void {\n if (!flowObj.Flow.decisions) {\n return;\n }\n\n // Convert to array if there's only one decision\n const decisions = Array.isArray(flowObj.Flow.decisions) \n ? flowObj.Flow.decisions \n : [flowObj.Flow.decisions];\n \n // Process each decision\n decisions.forEach((decision: any) => {\n // Skip if decision doesn't have a name\n if (!decision.name) {\n return;\n }\n\n const decisionName = decision.name;\n const decisionLabel = decision.label || decisionName;\n \n // Process default connector if it exists\n if (decision.defaultConnector?.targetReference) {\n const defaultTarget = decision.defaultConnector.targetReference;\n const defaultConnectorLabel = decision.defaultConnectorLabel || 'Default Outcome';\n \n // Create a logger for the default path\n const defaultLogger = this.createDecisionPathLogger(\n flowName, \n String(decisionName), \n String(decisionLabel),\n 'default',\n String(defaultConnectorLabel)\n );\n \n // Connect logger to the original target\n defaultLogger.connector = {\n targetReference: defaultTarget\n };\n \n // Add logger to actionCalls first, before updating the decision connector\n this.addActionCallToFlow(flowObj, defaultLogger);\n \n // Update the decision's default connector to point to our logger\n // We're inside a forEach callback, so we have to modify the original object\n /* eslint-disable no-param-reassign */\n decision.defaultConnector.targetReference = defaultLogger.name;\n /* eslint-enable no-param-reassign */\n }\n \n // Process each rule if they exist\n if (decision.rules) {\n const rules = Array.isArray(decision.rules) ? decision.rules : [decision.rules];\n \n rules.forEach((rule: any) => {\n // Skip if rule doesn't have a connector or name\n if (!rule.connector?.targetReference || !rule.name) {\n return;\n }\n \n const ruleTarget = rule.connector.targetReference;\n const ruleName = rule.name;\n const ruleLabel = rule.label || ruleName;\n \n // Create a logger for this rule outcome\n const ruleLogger = this.createDecisionPathLogger(\n flowName, \n String(decisionName), \n String(decisionLabel),\n String(ruleName),\n String(ruleLabel)\n );\n \n // Connect logger to the original target\n ruleLogger.connector = {\n targetReference: ruleTarget\n };\n \n // Add logger to actionCalls first, before updating the rule connector\n this.addActionCallToFlow(flowObj, ruleLogger);\n \n // Update the rule's connector to point to our logger\n // We're inside a forEach callback, so we have to modify the original object\n /* eslint-disable no-param-reassign */\n rule.connector.targetReference = ruleLogger.name;\n /* eslint-enable no-param-reassign */\n });\n }\n });\n }\n \n // Helper to add action calls to the flow object\n // Note: This method does modify the parameter directly - we accepted the eslint warning\n // since we need to modify the flow object within callback functions where returning a new value isn't possible\n private static addActionCallToFlow(flowObj: any, actionCall: any): void {\n /* eslint-disable no-param-reassign */\n if (!flowObj.Flow.actionCalls) {\n flowObj.Flow.actionCalls = actionCall;\n } else if (Array.isArray(flowObj.Flow.actionCalls)) {\n flowObj.Flow.actionCalls.push(actionCall);\n } else {\n // If only one action exists, convert to array\n flowObj.Flow.actionCalls = [flowObj.Flow.actionCalls, actionCall];\n }\n /* eslint-enable no-param-reassign */\n }\n \n // Helper to create a logging action for decision paths\n private static createDecisionPathLogger(\n flowName: string, \n decisionName: string, \n decisionLabel: string,\n outcomeName: string,\n outcomeLabel: string\n ): any {\n const loggerId = this.generateUniqueId();\n \n // Ensure we're working with strings\n const decisionNameStr = String(decisionName);\n const outcomeNameStr = String(outcomeName);\n const decisionLabelStr = String(decisionLabel);\n const outcomeLabelStr = String(outcomeLabel);\n \n // Calculate maximum lengths to stay under 80 characters\n const prefixLength = 'RFLIB_Flow_Logger_Decision_'.length;\n const separatorsLength = 2; // Two underscores\n const maxTotalNameLength = 80 - prefixLength - loggerId.length - separatorsLength;\n \n // Allocate half of available space to each name (decision and outcome)\n const maxIndividualLength = Math.floor(maxTotalNameLength / 2);\n \n // Sanitize names to fit Salesforce naming rules\n const sanitizedDecisionName = this.sanitizeForName(decisionNameStr, maxIndividualLength);\n const sanitizedOutcomeName = this.sanitizeForName(outcomeNameStr, maxIndividualLength);\n \n // Create a name that's guaranteed to be under 80 chars and follow Salesforce rules\n const name = `RFLIB_Flow_Logger_Decision_${sanitizedDecisionName}_${sanitizedOutcomeName}_${loggerId}`;\n \n // Create and truncate the label to ensure it's under 80 chars\n const label = this.truncateLabel(`Log Decision: ${decisionLabelStr} - ${outcomeLabelStr}`);\n \n // Fallback if still too long\n if (name.length > 80) {\n return {\n actionName: 'rflib_LoggerFlowAction',\n actionType: 'apex',\n name: `RFLIBLogDec${loggerId}`,\n label,\n locationX: 176,\n locationY: 50,\n inputParameters: [\n {\n name: 'context',\n value: {\n stringValue: flowName,\n },\n },\n {\n name: 'logLevel',\n value: {\n stringValue: 'INFO',\n },\n },\n {\n name: 'message',\n value: {\n stringValue: `Decision '${decisionLabelStr}' outcome: ${outcomeLabelStr}`,\n },\n },\n ],\n };\n }\n \n return {\n actionName: 'rflib_LoggerFlowAction',\n actionType: 'apex',\n name,\n label,\n locationX: 176,\n locationY: 50,\n inputParameters: [\n {\n name: 'context',\n value: {\n stringValue: flowName,\n },\n },\n {\n name: 'logLevel',\n value: {\n stringValue: 'INFO',\n },\n },\n {\n name: 'message',\n value: {\n stringValue: `Decision '${decisionLabelStr}' outcome: ${outcomeLabelStr}`,\n },\n },\n ],\n };\n }\n\n // Helper to generate unique IDs for new flow elements (compact for 80-char limit)\n // that follow Salesforce Flow Action naming rules\n private static generateUniqueId(): string {\n // Use timestamp in base36 + 4 random chars to keep it short but unique\n // Ensure we don't start with a number or have consecutive/trailing underscores\n const timestamp = Date.now().toString(36);\n const random = Math.random().toString(36).substring(2, 6);\n \n // Combine parts without underscore to avoid potential consecutive underscores\n return `ID${timestamp}${random}`;\n }\n \n // Helper to sanitize and truncate text to fit within the 80-char name limit\n // and to follow Salesforce Flow Action naming rules:\n // - Only alphanumeric characters and underscores\n // - Must begin with a letter\n // - No spaces\n // - No underscore at the end\n // - No consecutive underscores\n private static sanitizeForName(text: string, maxLength: number): string {\n if (!text) {\n return 'X'; // Default to 'X' for empty inputs to ensure we start with a letter\n }\n \n // First, replace any non-alphanumeric characters with underscores\n let sanitized = text.replace(/[^a-zA-Z0-9_]/g, '_');\n \n // Ensure it starts with a letter\n if (!/^[a-zA-Z]/.test(sanitized)) {\n sanitized = 'X' + sanitized;\n }\n \n // Replace consecutive underscores with a single underscore\n sanitized = sanitized.replace(/__+/g, '_');\n \n // Remove trailing underscore if present\n sanitized = sanitized.replace(/_+$/, '');\n \n // If empty after sanitization, return a default value\n if (!sanitized) {\n return 'X';\n }\n \n // Truncate if longer than maxLength\n if (sanitized.length > maxLength) {\n // Truncate and ensure it doesn't end with an underscore\n sanitized = sanitized.substring(0, maxLength).replace(/_+$/, '');\n \n // If we removed trailing underscores and now it's empty or too short, add a fallback\n if (sanitized.length < 1) {\n sanitized = 'X';\n }\n }\n \n return sanitized;\n }\n\n // Helper to truncate label text to fit within the 80-char limit\n private static truncateLabel(label: string, maxLength: number = 80): string {\n if (!label || label.length <= maxLength) {\n return label;\n }\n \n // If text is too long, truncate it and add ellipsis\n return label.substring(0, maxLength - 3) + '...';\n }\n\n // Helper to create a logging action element\n private static createLoggingAction(flowName: string): any {\n const loggerId = this.generateUniqueId();\n \n // Ensure name is under 80 characters and follows Salesforce naming rules\n const prefixLength = 'RFLIB_Flow_Logger_'.length;\n const maxFlowNameLength = 80 - prefixLength - loggerId.length - 1; // -1 for underscore\n const sanitizedFlowName = this.sanitizeForName(flowName, maxFlowNameLength);\n \n // Create a name that's guaranteed to be under 80 chars and follow Salesforce rules\n const name = `RFLIB_Flow_Logger_${sanitizedFlowName}_${loggerId}`;\n \n // Create and truncate the label to ensure it's under 80 chars\n const label = this.truncateLabel(`Log Flow Invocation: ${flowName}`);\n \n // Verify name length\n if (name.length > 80) {\n // If still too long, use a simpler naming scheme (fallback)\n return {\n actionName: 'rflib_LoggerFlowAction',\n actionType: 'apex',\n name: `RFLIBLogger${loggerId}`,\n label,\n locationX: 176,\n locationY: 50,\n inputParameters: [\n {\n name: 'context',\n value: {\n stringValue: flowName,\n },\n },\n {\n name: 'logLevel',\n value: {\n stringValue: 'INFO',\n },\n },\n {\n name: 'message',\n value: {\n stringValue: `Flow ${flowName} started`,\n },\n },\n ],\n };\n }\n \n return {\n actionName: 'rflib_LoggerFlowAction',\n actionType: 'apex',\n name,\n label,\n locationX: 176,\n locationY: 50,\n inputParameters: [\n {\n name: 'context',\n value: {\n stringValue: flowName,\n },\n },\n {\n name: 'logLevel',\n value: {\n stringValue: 'INFO',\n },\n },\n {\n name: 'message',\n value: {\n stringValue: `Flow ${flowName} started`,\n },\n },\n ],\n };\n }\n\n // Helper to add variable references to the logging message when available\n private static enhanceLoggingWithVariables(loggingAction: any, flowObj: any): any {\n // Find input variables or parameters that might be useful to log\n const variables = flowObj.Flow.variables || [];\n const inputVariables = Array.isArray(variables)\n ? variables.filter((v: any) => v.isInput === 'true' || v.isCollection === 'true')\n : (variables.isInput === 'true' || variables.isCollection === 'true' ? [variables] : []);\n\n if (inputVariables.length > 0) {\n // Find the message parameter - case insensitive search\n const messageParamIndex = loggingAction.inputParameters.findIndex(\n (p: any) => p.name?.toLowerCase() === 'message'\n );\n\n if (messageParamIndex >= 0) {\n // Enhance the message with variable information\n const varRefs = inputVariables\n .map((v: any) => `${v.name}: {!${v.name}}`)\n .join(', ');\n\n const baseMessage = loggingAction.inputParameters[messageParamIndex];\n const originalMessage = baseMessage.value.stringValue;\n baseMessage.value.stringValue = `${originalMessage} with ${varRefs}`;\n }\n }\n\n return loggingAction;\n }\n}\n\nexport default class RflibLoggingFlowInstrument extends SfCommand<RflibLoggingFlowInstrumentResult> {\n public static readonly summary = messages.getMessage('summary');\n public static readonly description = messages.getMessage('description');\n public static readonly examples = messages.getMessages('examples');\n\n public static readonly flags = {\n sourcepath: Flags.string({\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n char: 's',\n required: true,\n }),\n dryrun: Flags.boolean({\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n char: 'd',\n default: false,\n }),\n 'skip-instrumented': Flags.boolean({\n summary: messages.getMessage('flags.skip-instrumented.summary') || 'Skip flows that already have RFLIB logging',\n description: messages.getMessage('flags.skip-instrumented.description') || 'Do not instrument flows where RFLIB logging is already present',\n default: false,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingFlowInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n };\n\n public async run(): Promise<RflibLoggingFlowInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const startTime = Date.now();\n\n const { flags } = await this.parse(RflibLoggingFlowInstrument);\n const sourcePath = flags.sourcepath;\n const isDryRun = flags.dryrun;\n const skipInstrumented = flags['skip-instrumented'];\n\n this.log(`Scanning Flow files in ${sourcePath} and sub directories`);\n this.logger.debug(`Dry run mode: ${isDryRun}`);\n this.logger.debug(`Skip instrumented: ${skipInstrumented}`);\n\n this.spinner.start('Running...');\n await this.processDirectory(sourcePath, isDryRun, skipInstrumented);\n this.spinner.stop();\n\n const duration = Date.now() - startTime;\n this.logger.debug(`Completed instrumentation in ${duration}ms`);\n\n this.log('\\nInstrumentation complete.');\n this.log(`Processed files: ${this.stats.processedFiles}`);\n this.log(`Modified files: ${this.stats.modifiedFiles}`);\n\n return { ...this.stats };\n }\n\n private async processDirectory(dirPath: string, isDryRun: boolean, skipInstrumented: boolean): Promise<void> {\n this.logger.debug(`Processing directory: ${dirPath}`);\n const files = await fs.promises.readdir(dirPath);\n\n for (const file of files) {\n const filePath = path.join(dirPath, file);\n const stat = await fs.promises.stat(filePath);\n\n if (stat.isDirectory()) {\n await this.processDirectory(filePath, isDryRun, skipInstrumented);\n } else if (file.endsWith('.flow-meta.xml')) {\n await this.instrumentFlowFile(filePath, isDryRun, skipInstrumented);\n }\n }\n }\n\n private async instrumentFlowFile(filePath: string, isDryRun: boolean, skipInstrumented: boolean): Promise<void> {\n const flowName = path.basename(filePath, '.flow-meta.xml');\n this.logger.debug(`Processing flow: ${flowName}`);\n\n try {\n this.stats.processedFiles++;\n const content = await fs.promises.readFile(filePath, 'utf8');\n const flowObj = await FlowInstrumentationService.parseFlowContent(content);\n\n // Only instrument flows with processType=\"Flow\", skip all others\n if (!FlowInstrumentationService.isFlowType(flowObj)) {\n this.logger.debug(`Skipping non-Flow type: ${flowName} (processType=${flowObj?.Flow?.processType || 'undefined'})`);\n return;\n }\n\n // Check if flow already has RFLIB logging and skip if needed\n if (skipInstrumented && FlowInstrumentationService.hasRFLIBLogger(flowObj)) {\n this.logger.info(`Skipping already instrumented flow: ${flowName}`);\n return;\n }\n\n const instrumentedFlow = FlowInstrumentationService.instrumentFlow(flowObj, flowName, skipInstrumented);\n const newContent = FlowInstrumentationService.buildFlowContent(instrumentedFlow);\n\n if (content !== newContent) {\n this.stats.modifiedFiles++;\n if (!isDryRun) {\n await fs.promises.writeFile(filePath, newContent);\n this.logger.info(`Modified: ${filePath}`);\n } else {\n this.logger.info(`Would modify: ${filePath}`);\n }\n }\n } catch (error) {\n this.logger.error(`Error processing flow ${flowName}`, error);\n throw error;\n }\n }\n}"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# summary
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Adds RFLIB logging statements to Salesforce Flows.
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Automatically adds RFLIB logging statements to Salesforce Flows to provide enhanced tracking and debugging capabilities. Instruments flow invocations and decision paths with logging actions.
|
|
8
8
|
|
|
9
9
|
# flags.sourcepath.summary
|
|
10
10
|
|
|
11
|
-
Directory containing
|
|
11
|
+
Directory containing Flow files to instrument with logging.
|
|
12
12
|
|
|
13
13
|
# flags.sourcepath.description
|
|
14
14
|
|
|
15
|
-
Path to the source directory containing
|
|
15
|
+
Path to the source directory containing Flow files that should be instrumented with RFLIB logging statements. Only processes .flow-meta.xml files with processType="Flow".
|
|
16
16
|
|
|
17
17
|
# flags.dryrun.summary
|
|
18
18
|
|
|
@@ -22,15 +22,25 @@ Preview changes without modifying files.
|
|
|
22
22
|
|
|
23
23
|
When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.
|
|
24
24
|
|
|
25
|
+
# flags.prettier.summary
|
|
26
|
+
|
|
27
|
+
Format output files with prettier.
|
|
28
|
+
|
|
29
|
+
# flags.prettier.description
|
|
30
|
+
|
|
31
|
+
Use prettier to format the output files.
|
|
32
|
+
|
|
25
33
|
# flags.skip-instrumented.summary
|
|
26
34
|
|
|
27
35
|
Skips any files where a logger is already present.
|
|
28
36
|
|
|
29
37
|
# flags.skip-instrumented.description
|
|
30
38
|
|
|
31
|
-
When provided, the command will not add log statements to any Flows that already
|
|
39
|
+
When provided, the command will not add log statements to any Flows that already contain RFLIB logging actions.
|
|
32
40
|
|
|
33
41
|
# examples
|
|
34
42
|
|
|
35
|
-
- <%= config.bin %> <%= command.id %>
|
|
43
|
+
- <%= config.bin %> <%= command.id %> --sourcepath force-app
|
|
44
|
+
- <%= config.bin %> <%= command.id %> --sourcepath force-app --dryrun
|
|
45
|
+
- <%= config.bin %> <%= command.id %> --sourcepath force-app --skip-instrumented
|
|
36
46
|
|
package/oclif.lock
CHANGED
|
@@ -134,32 +134,32 @@
|
|
|
134
134
|
"@smithy/util-waiter" "^4.0.3"
|
|
135
135
|
tslib "^2.6.2"
|
|
136
136
|
|
|
137
|
-
"@aws-sdk/client-s3@^3.
|
|
138
|
-
version "3.
|
|
139
|
-
resolved "https://registry.yarnpkg.com/@aws-sdk/client-s3/-/client-s3-3.
|
|
140
|
-
integrity sha512-
|
|
137
|
+
"@aws-sdk/client-s3@^3.782.0":
|
|
138
|
+
version "3.787.0"
|
|
139
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/client-s3/-/client-s3-3.787.0.tgz#ebb55ec36cd8f0b7e5e89e48c4d1b6ed1f6156dc"
|
|
140
|
+
integrity sha512-eGLCWkN0NlntJ9yPU6OKUggVS4cFvuZJog+cFg1KD5hniLqz7Y0YRtB4uBxW212fK3XCfddgyscEOEeHaTQQTw==
|
|
141
141
|
dependencies:
|
|
142
142
|
"@aws-crypto/sha1-browser" "5.2.0"
|
|
143
143
|
"@aws-crypto/sha256-browser" "5.2.0"
|
|
144
144
|
"@aws-crypto/sha256-js" "5.2.0"
|
|
145
145
|
"@aws-sdk/core" "3.775.0"
|
|
146
|
-
"@aws-sdk/credential-provider-node" "3.
|
|
146
|
+
"@aws-sdk/credential-provider-node" "3.787.0"
|
|
147
147
|
"@aws-sdk/middleware-bucket-endpoint" "3.775.0"
|
|
148
148
|
"@aws-sdk/middleware-expect-continue" "3.775.0"
|
|
149
|
-
"@aws-sdk/middleware-flexible-checksums" "3.
|
|
149
|
+
"@aws-sdk/middleware-flexible-checksums" "3.787.0"
|
|
150
150
|
"@aws-sdk/middleware-host-header" "3.775.0"
|
|
151
151
|
"@aws-sdk/middleware-location-constraint" "3.775.0"
|
|
152
152
|
"@aws-sdk/middleware-logger" "3.775.0"
|
|
153
153
|
"@aws-sdk/middleware-recursion-detection" "3.775.0"
|
|
154
154
|
"@aws-sdk/middleware-sdk-s3" "3.775.0"
|
|
155
155
|
"@aws-sdk/middleware-ssec" "3.775.0"
|
|
156
|
-
"@aws-sdk/middleware-user-agent" "3.
|
|
156
|
+
"@aws-sdk/middleware-user-agent" "3.787.0"
|
|
157
157
|
"@aws-sdk/region-config-resolver" "3.775.0"
|
|
158
158
|
"@aws-sdk/signature-v4-multi-region" "3.775.0"
|
|
159
159
|
"@aws-sdk/types" "3.775.0"
|
|
160
|
-
"@aws-sdk/util-endpoints" "3.
|
|
160
|
+
"@aws-sdk/util-endpoints" "3.787.0"
|
|
161
161
|
"@aws-sdk/util-user-agent-browser" "3.775.0"
|
|
162
|
-
"@aws-sdk/util-user-agent-node" "3.
|
|
162
|
+
"@aws-sdk/util-user-agent-node" "3.787.0"
|
|
163
163
|
"@aws-sdk/xml-builder" "3.775.0"
|
|
164
164
|
"@smithy/config-resolver" "^4.1.0"
|
|
165
165
|
"@smithy/core" "^3.2.0"
|
|
@@ -240,6 +240,50 @@
|
|
|
240
240
|
"@smithy/util-utf8" "^4.0.0"
|
|
241
241
|
tslib "^2.6.2"
|
|
242
242
|
|
|
243
|
+
"@aws-sdk/client-sso@3.787.0":
|
|
244
|
+
version "3.787.0"
|
|
245
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.787.0.tgz#39f1182296b586cb957b449b5f0dabd8f378cf1a"
|
|
246
|
+
integrity sha512-L8R+Mh258G0DC73ktpSVrG4TT9i2vmDLecARTDR/4q5sRivdDQSL5bUp3LKcK80Bx+FRw3UETIlX6mYMLL9PJQ==
|
|
247
|
+
dependencies:
|
|
248
|
+
"@aws-crypto/sha256-browser" "5.2.0"
|
|
249
|
+
"@aws-crypto/sha256-js" "5.2.0"
|
|
250
|
+
"@aws-sdk/core" "3.775.0"
|
|
251
|
+
"@aws-sdk/middleware-host-header" "3.775.0"
|
|
252
|
+
"@aws-sdk/middleware-logger" "3.775.0"
|
|
253
|
+
"@aws-sdk/middleware-recursion-detection" "3.775.0"
|
|
254
|
+
"@aws-sdk/middleware-user-agent" "3.787.0"
|
|
255
|
+
"@aws-sdk/region-config-resolver" "3.775.0"
|
|
256
|
+
"@aws-sdk/types" "3.775.0"
|
|
257
|
+
"@aws-sdk/util-endpoints" "3.787.0"
|
|
258
|
+
"@aws-sdk/util-user-agent-browser" "3.775.0"
|
|
259
|
+
"@aws-sdk/util-user-agent-node" "3.787.0"
|
|
260
|
+
"@smithy/config-resolver" "^4.1.0"
|
|
261
|
+
"@smithy/core" "^3.2.0"
|
|
262
|
+
"@smithy/fetch-http-handler" "^5.0.2"
|
|
263
|
+
"@smithy/hash-node" "^4.0.2"
|
|
264
|
+
"@smithy/invalid-dependency" "^4.0.2"
|
|
265
|
+
"@smithy/middleware-content-length" "^4.0.2"
|
|
266
|
+
"@smithy/middleware-endpoint" "^4.1.0"
|
|
267
|
+
"@smithy/middleware-retry" "^4.1.0"
|
|
268
|
+
"@smithy/middleware-serde" "^4.0.3"
|
|
269
|
+
"@smithy/middleware-stack" "^4.0.2"
|
|
270
|
+
"@smithy/node-config-provider" "^4.0.2"
|
|
271
|
+
"@smithy/node-http-handler" "^4.0.4"
|
|
272
|
+
"@smithy/protocol-http" "^5.1.0"
|
|
273
|
+
"@smithy/smithy-client" "^4.2.0"
|
|
274
|
+
"@smithy/types" "^4.2.0"
|
|
275
|
+
"@smithy/url-parser" "^4.0.2"
|
|
276
|
+
"@smithy/util-base64" "^4.0.0"
|
|
277
|
+
"@smithy/util-body-length-browser" "^4.0.0"
|
|
278
|
+
"@smithy/util-body-length-node" "^4.0.0"
|
|
279
|
+
"@smithy/util-defaults-mode-browser" "^4.0.8"
|
|
280
|
+
"@smithy/util-defaults-mode-node" "^4.0.8"
|
|
281
|
+
"@smithy/util-endpoints" "^3.0.2"
|
|
282
|
+
"@smithy/util-middleware" "^4.0.2"
|
|
283
|
+
"@smithy/util-retry" "^4.0.2"
|
|
284
|
+
"@smithy/util-utf8" "^4.0.0"
|
|
285
|
+
tslib "^2.6.2"
|
|
286
|
+
|
|
243
287
|
"@aws-sdk/core@3.775.0":
|
|
244
288
|
version "3.775.0"
|
|
245
289
|
resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.775.0.tgz#5d22ba78f07c07b48fb4d5b18172b9a896c0cbd0"
|
|
@@ -303,6 +347,25 @@
|
|
|
303
347
|
"@smithy/types" "^4.2.0"
|
|
304
348
|
tslib "^2.6.2"
|
|
305
349
|
|
|
350
|
+
"@aws-sdk/credential-provider-ini@3.787.0":
|
|
351
|
+
version "3.787.0"
|
|
352
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.787.0.tgz#906ece004141462ae695504b6c07d1200688fd6c"
|
|
353
|
+
integrity sha512-hc2taRoDlXn2uuNuHWDJljVWYrp3r9JF1a/8XmOAZhVUNY+ImeeStylHXhXXKEA4JOjW+5PdJj0f1UDkVCHJiQ==
|
|
354
|
+
dependencies:
|
|
355
|
+
"@aws-sdk/core" "3.775.0"
|
|
356
|
+
"@aws-sdk/credential-provider-env" "3.775.0"
|
|
357
|
+
"@aws-sdk/credential-provider-http" "3.775.0"
|
|
358
|
+
"@aws-sdk/credential-provider-process" "3.775.0"
|
|
359
|
+
"@aws-sdk/credential-provider-sso" "3.787.0"
|
|
360
|
+
"@aws-sdk/credential-provider-web-identity" "3.787.0"
|
|
361
|
+
"@aws-sdk/nested-clients" "3.787.0"
|
|
362
|
+
"@aws-sdk/types" "3.775.0"
|
|
363
|
+
"@smithy/credential-provider-imds" "^4.0.2"
|
|
364
|
+
"@smithy/property-provider" "^4.0.2"
|
|
365
|
+
"@smithy/shared-ini-file-loader" "^4.0.2"
|
|
366
|
+
"@smithy/types" "^4.2.0"
|
|
367
|
+
tslib "^2.6.2"
|
|
368
|
+
|
|
306
369
|
"@aws-sdk/credential-provider-node@3.782.0":
|
|
307
370
|
version "3.782.0"
|
|
308
371
|
resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.782.0.tgz#81a798710d0567b26cd20a105790b49586e68d40"
|
|
@@ -321,6 +384,24 @@
|
|
|
321
384
|
"@smithy/types" "^4.2.0"
|
|
322
385
|
tslib "^2.6.2"
|
|
323
386
|
|
|
387
|
+
"@aws-sdk/credential-provider-node@3.787.0":
|
|
388
|
+
version "3.787.0"
|
|
389
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.787.0.tgz#3e5cdafb0fecca25b7430f848cbca85000b25c33"
|
|
390
|
+
integrity sha512-JioVi44B1vDMaK2CdzqimwvJD3uzvzbQhaEWXsGMBcMcNHajXAXf08EF50JG3ZhLrhhUsT1ObXpbTaPINOhh+g==
|
|
391
|
+
dependencies:
|
|
392
|
+
"@aws-sdk/credential-provider-env" "3.775.0"
|
|
393
|
+
"@aws-sdk/credential-provider-http" "3.775.0"
|
|
394
|
+
"@aws-sdk/credential-provider-ini" "3.787.0"
|
|
395
|
+
"@aws-sdk/credential-provider-process" "3.775.0"
|
|
396
|
+
"@aws-sdk/credential-provider-sso" "3.787.0"
|
|
397
|
+
"@aws-sdk/credential-provider-web-identity" "3.787.0"
|
|
398
|
+
"@aws-sdk/types" "3.775.0"
|
|
399
|
+
"@smithy/credential-provider-imds" "^4.0.2"
|
|
400
|
+
"@smithy/property-provider" "^4.0.2"
|
|
401
|
+
"@smithy/shared-ini-file-loader" "^4.0.2"
|
|
402
|
+
"@smithy/types" "^4.2.0"
|
|
403
|
+
tslib "^2.6.2"
|
|
404
|
+
|
|
324
405
|
"@aws-sdk/credential-provider-process@3.775.0":
|
|
325
406
|
version "3.775.0"
|
|
326
407
|
resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.775.0.tgz#7ab90383f12461c5d20546e933924e654660542b"
|
|
@@ -347,6 +428,20 @@
|
|
|
347
428
|
"@smithy/types" "^4.2.0"
|
|
348
429
|
tslib "^2.6.2"
|
|
349
430
|
|
|
431
|
+
"@aws-sdk/credential-provider-sso@3.787.0":
|
|
432
|
+
version "3.787.0"
|
|
433
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.787.0.tgz#77ab6c01e4497d7ff2e6c7f081f3d8695744884b"
|
|
434
|
+
integrity sha512-fHc08bsvwm4+dEMEQKnQ7c1irEQmmxbgS+Fq41y09pPvPh31nAhoMcjBSTWAaPHvvsRbTYvmP4Mf12ZGr8/nfg==
|
|
435
|
+
dependencies:
|
|
436
|
+
"@aws-sdk/client-sso" "3.787.0"
|
|
437
|
+
"@aws-sdk/core" "3.775.0"
|
|
438
|
+
"@aws-sdk/token-providers" "3.787.0"
|
|
439
|
+
"@aws-sdk/types" "3.775.0"
|
|
440
|
+
"@smithy/property-provider" "^4.0.2"
|
|
441
|
+
"@smithy/shared-ini-file-loader" "^4.0.2"
|
|
442
|
+
"@smithy/types" "^4.2.0"
|
|
443
|
+
tslib "^2.6.2"
|
|
444
|
+
|
|
350
445
|
"@aws-sdk/credential-provider-web-identity@3.782.0":
|
|
351
446
|
version "3.782.0"
|
|
352
447
|
resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.782.0.tgz#5dbab53a7b49dcf8390d71415855e78b911a4742"
|
|
@@ -359,6 +454,18 @@
|
|
|
359
454
|
"@smithy/types" "^4.2.0"
|
|
360
455
|
tslib "^2.6.2"
|
|
361
456
|
|
|
457
|
+
"@aws-sdk/credential-provider-web-identity@3.787.0":
|
|
458
|
+
version "3.787.0"
|
|
459
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.787.0.tgz#d492d1f4a90b70f3a71a65f11b8d3ef79fb2759e"
|
|
460
|
+
integrity sha512-SobmCwNbk6TfEsF283mZPQEI5vV2j6eY5tOCj8Er4Lzraxu9fBPADV+Bib2A8F6jlB1lMPJzOuDCbEasSt/RIw==
|
|
461
|
+
dependencies:
|
|
462
|
+
"@aws-sdk/core" "3.775.0"
|
|
463
|
+
"@aws-sdk/nested-clients" "3.787.0"
|
|
464
|
+
"@aws-sdk/types" "3.775.0"
|
|
465
|
+
"@smithy/property-provider" "^4.0.2"
|
|
466
|
+
"@smithy/types" "^4.2.0"
|
|
467
|
+
tslib "^2.6.2"
|
|
468
|
+
|
|
362
469
|
"@aws-sdk/middleware-bucket-endpoint@3.775.0":
|
|
363
470
|
version "3.775.0"
|
|
364
471
|
resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.775.0.tgz#e4eb2d33f01c11565bb518278b3f7ec0987d5190"
|
|
@@ -382,10 +489,10 @@
|
|
|
382
489
|
"@smithy/types" "^4.2.0"
|
|
383
490
|
tslib "^2.6.2"
|
|
384
491
|
|
|
385
|
-
"@aws-sdk/middleware-flexible-checksums@3.
|
|
386
|
-
version "3.
|
|
387
|
-
resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.
|
|
388
|
-
integrity sha512-
|
|
492
|
+
"@aws-sdk/middleware-flexible-checksums@3.787.0":
|
|
493
|
+
version "3.787.0"
|
|
494
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.787.0.tgz#bc887dcfd0193a41eef6b58c18c682478a108b07"
|
|
495
|
+
integrity sha512-X71qEwWoixFmwowWzlPoZUR3u1CWJ7iAzU0EzIxqmPhQpQJLFmdL1+SRjqATynDPZQzLs1a5HBtPT++EnZ+Quw==
|
|
389
496
|
dependencies:
|
|
390
497
|
"@aws-crypto/crc32" "5.2.0"
|
|
391
498
|
"@aws-crypto/crc32c" "5.2.0"
|
|
@@ -481,6 +588,19 @@
|
|
|
481
588
|
"@smithy/types" "^4.2.0"
|
|
482
589
|
tslib "^2.6.2"
|
|
483
590
|
|
|
591
|
+
"@aws-sdk/middleware-user-agent@3.787.0":
|
|
592
|
+
version "3.787.0"
|
|
593
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.787.0.tgz#3d657c0ba1aec72bca079f4691ba20f25569fcfc"
|
|
594
|
+
integrity sha512-Lnfj8SmPLYtrDFthNIaNj66zZsBCam+E4XiUDr55DIHTGstH6qZ/q6vg0GfbukxwSmUcGMwSR4Qbn8rb8yd77g==
|
|
595
|
+
dependencies:
|
|
596
|
+
"@aws-sdk/core" "3.775.0"
|
|
597
|
+
"@aws-sdk/types" "3.775.0"
|
|
598
|
+
"@aws-sdk/util-endpoints" "3.787.0"
|
|
599
|
+
"@smithy/core" "^3.2.0"
|
|
600
|
+
"@smithy/protocol-http" "^5.1.0"
|
|
601
|
+
"@smithy/types" "^4.2.0"
|
|
602
|
+
tslib "^2.6.2"
|
|
603
|
+
|
|
484
604
|
"@aws-sdk/nested-clients@3.782.0":
|
|
485
605
|
version "3.782.0"
|
|
486
606
|
resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.782.0.tgz#73f56fc4d22e1be342e00b7eba9de4d192521a05"
|
|
@@ -525,6 +645,50 @@
|
|
|
525
645
|
"@smithy/util-utf8" "^4.0.0"
|
|
526
646
|
tslib "^2.6.2"
|
|
527
647
|
|
|
648
|
+
"@aws-sdk/nested-clients@3.787.0":
|
|
649
|
+
version "3.787.0"
|
|
650
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.787.0.tgz#e8a5a6e7d0b599a7f9f15b900d3223ad080b0a81"
|
|
651
|
+
integrity sha512-xk03q1xpKNHgbuo+trEf1dFrI239kuMmjKKsqLEsHlAZbuFq4yRGMlHBrVMnKYOPBhVFDS/VineM991XI52fKg==
|
|
652
|
+
dependencies:
|
|
653
|
+
"@aws-crypto/sha256-browser" "5.2.0"
|
|
654
|
+
"@aws-crypto/sha256-js" "5.2.0"
|
|
655
|
+
"@aws-sdk/core" "3.775.0"
|
|
656
|
+
"@aws-sdk/middleware-host-header" "3.775.0"
|
|
657
|
+
"@aws-sdk/middleware-logger" "3.775.0"
|
|
658
|
+
"@aws-sdk/middleware-recursion-detection" "3.775.0"
|
|
659
|
+
"@aws-sdk/middleware-user-agent" "3.787.0"
|
|
660
|
+
"@aws-sdk/region-config-resolver" "3.775.0"
|
|
661
|
+
"@aws-sdk/types" "3.775.0"
|
|
662
|
+
"@aws-sdk/util-endpoints" "3.787.0"
|
|
663
|
+
"@aws-sdk/util-user-agent-browser" "3.775.0"
|
|
664
|
+
"@aws-sdk/util-user-agent-node" "3.787.0"
|
|
665
|
+
"@smithy/config-resolver" "^4.1.0"
|
|
666
|
+
"@smithy/core" "^3.2.0"
|
|
667
|
+
"@smithy/fetch-http-handler" "^5.0.2"
|
|
668
|
+
"@smithy/hash-node" "^4.0.2"
|
|
669
|
+
"@smithy/invalid-dependency" "^4.0.2"
|
|
670
|
+
"@smithy/middleware-content-length" "^4.0.2"
|
|
671
|
+
"@smithy/middleware-endpoint" "^4.1.0"
|
|
672
|
+
"@smithy/middleware-retry" "^4.1.0"
|
|
673
|
+
"@smithy/middleware-serde" "^4.0.3"
|
|
674
|
+
"@smithy/middleware-stack" "^4.0.2"
|
|
675
|
+
"@smithy/node-config-provider" "^4.0.2"
|
|
676
|
+
"@smithy/node-http-handler" "^4.0.4"
|
|
677
|
+
"@smithy/protocol-http" "^5.1.0"
|
|
678
|
+
"@smithy/smithy-client" "^4.2.0"
|
|
679
|
+
"@smithy/types" "^4.2.0"
|
|
680
|
+
"@smithy/url-parser" "^4.0.2"
|
|
681
|
+
"@smithy/util-base64" "^4.0.0"
|
|
682
|
+
"@smithy/util-body-length-browser" "^4.0.0"
|
|
683
|
+
"@smithy/util-body-length-node" "^4.0.0"
|
|
684
|
+
"@smithy/util-defaults-mode-browser" "^4.0.8"
|
|
685
|
+
"@smithy/util-defaults-mode-node" "^4.0.8"
|
|
686
|
+
"@smithy/util-endpoints" "^3.0.2"
|
|
687
|
+
"@smithy/util-middleware" "^4.0.2"
|
|
688
|
+
"@smithy/util-retry" "^4.0.2"
|
|
689
|
+
"@smithy/util-utf8" "^4.0.0"
|
|
690
|
+
tslib "^2.6.2"
|
|
691
|
+
|
|
528
692
|
"@aws-sdk/region-config-resolver@3.775.0":
|
|
529
693
|
version "3.775.0"
|
|
530
694
|
resolved "https://registry.yarnpkg.com/@aws-sdk/region-config-resolver/-/region-config-resolver-3.775.0.tgz#592b52498e68501fe46480be3dfb185e949d1eab"
|
|
@@ -561,6 +725,18 @@
|
|
|
561
725
|
"@smithy/types" "^4.2.0"
|
|
562
726
|
tslib "^2.6.2"
|
|
563
727
|
|
|
728
|
+
"@aws-sdk/token-providers@3.787.0":
|
|
729
|
+
version "3.787.0"
|
|
730
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.787.0.tgz#18c761fb21ee25c8c3a35703876f0c733b4ae743"
|
|
731
|
+
integrity sha512-d7/NIqxq308Zg0RPMNrmn0QvzniL4Hx8Qdwzr6YZWLYAbUSvZYS2ppLR3BFWSkV6SsTJUx8BuDaj3P8vttkrog==
|
|
732
|
+
dependencies:
|
|
733
|
+
"@aws-sdk/nested-clients" "3.787.0"
|
|
734
|
+
"@aws-sdk/types" "3.775.0"
|
|
735
|
+
"@smithy/property-provider" "^4.0.2"
|
|
736
|
+
"@smithy/shared-ini-file-loader" "^4.0.2"
|
|
737
|
+
"@smithy/types" "^4.2.0"
|
|
738
|
+
tslib "^2.6.2"
|
|
739
|
+
|
|
564
740
|
"@aws-sdk/types@3.775.0":
|
|
565
741
|
version "3.775.0"
|
|
566
742
|
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.775.0.tgz#09863a9e68c080947db7c3d226d1c56b8f0f5150"
|
|
@@ -594,6 +770,16 @@
|
|
|
594
770
|
"@smithy/util-endpoints" "^3.0.2"
|
|
595
771
|
tslib "^2.6.2"
|
|
596
772
|
|
|
773
|
+
"@aws-sdk/util-endpoints@3.787.0":
|
|
774
|
+
version "3.787.0"
|
|
775
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/util-endpoints/-/util-endpoints-3.787.0.tgz#1398f0bd87f19e615ae920c73e16d9d5e5cb76d1"
|
|
776
|
+
integrity sha512-fd3zkiOkwnbdbN0Xp9TsP5SWrmv0SpT70YEdbb8wAj2DWQwiCmFszaSs+YCvhoCdmlR3Wl9Spu0pGpSAGKeYvQ==
|
|
777
|
+
dependencies:
|
|
778
|
+
"@aws-sdk/types" "3.775.0"
|
|
779
|
+
"@smithy/types" "^4.2.0"
|
|
780
|
+
"@smithy/util-endpoints" "^3.0.2"
|
|
781
|
+
tslib "^2.6.2"
|
|
782
|
+
|
|
597
783
|
"@aws-sdk/util-locate-window@^3.0.0":
|
|
598
784
|
version "3.693.0"
|
|
599
785
|
resolved "https://registry.yarnpkg.com/@aws-sdk/util-locate-window/-/util-locate-window-3.693.0.tgz#1160f6d055cf074ca198eb8ecf89b6311537ad6c"
|
|
@@ -622,6 +808,17 @@
|
|
|
622
808
|
"@smithy/types" "^4.2.0"
|
|
623
809
|
tslib "^2.6.2"
|
|
624
810
|
|
|
811
|
+
"@aws-sdk/util-user-agent-node@3.787.0":
|
|
812
|
+
version "3.787.0"
|
|
813
|
+
resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.787.0.tgz#58e63e99586cde1c1314f74b94596780321442f5"
|
|
814
|
+
integrity sha512-mG7Lz8ydfG4SF9e8WSXiPQ/Lsn3n8A5B5jtPROidafi06I3ckV2WxyMLdwG14m919NoS6IOfWHyRGSqWIwbVKA==
|
|
815
|
+
dependencies:
|
|
816
|
+
"@aws-sdk/middleware-user-agent" "3.787.0"
|
|
817
|
+
"@aws-sdk/types" "3.775.0"
|
|
818
|
+
"@smithy/node-config-provider" "^4.0.2"
|
|
819
|
+
"@smithy/types" "^4.2.0"
|
|
820
|
+
tslib "^2.6.2"
|
|
821
|
+
|
|
625
822
|
"@aws-sdk/xml-builder@3.775.0":
|
|
626
823
|
version "3.775.0"
|
|
627
824
|
resolved "https://registry.yarnpkg.com/@aws-sdk/xml-builder/-/xml-builder-3.775.0.tgz#7ca5bd4e186373ecbacc8f2d7f9dd14f4a8f6529"
|
|
@@ -1473,7 +1670,7 @@
|
|
|
1473
1670
|
"@nodelib/fs.scandir" "2.1.5"
|
|
1474
1671
|
fastq "^1.6.0"
|
|
1475
1672
|
|
|
1476
|
-
"@oclif/core@^4", "@oclif/core@^4.2.10"
|
|
1673
|
+
"@oclif/core@^4", "@oclif/core@^4.2.10":
|
|
1477
1674
|
version "4.2.10"
|
|
1478
1675
|
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.2.10.tgz#31dfb7481c79887c3e672e10c981fcc01fcbaeb3"
|
|
1479
1676
|
integrity sha512-fAqcXgqkUm4v5FYy7qWP4w1HaOlVSVJveah+yVTo5Nm5kTiXhmD5mQQ7+knGeBaStyrtQy6WardoC2xSic9rlQ==
|
|
@@ -1623,10 +1820,10 @@
|
|
|
1623
1820
|
strip-ansi "6.0.1"
|
|
1624
1821
|
ts-retry-promise "^0.8.1"
|
|
1625
1822
|
|
|
1626
|
-
"@salesforce/core@^8", "@salesforce/core@^8.
|
|
1627
|
-
version "8.
|
|
1628
|
-
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.
|
|
1629
|
-
integrity sha512-
|
|
1823
|
+
"@salesforce/core@^8", "@salesforce/core@^8.8.0", "@salesforce/core@^8.8.5", "@salesforce/core@^8.9.0":
|
|
1824
|
+
version "8.9.0"
|
|
1825
|
+
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.9.0.tgz#318dead8c9399c016df5a8e526665d69dca17fb9"
|
|
1826
|
+
integrity sha512-p3ihmhGRfMrbup9unQ+YjDQb0o7WiNPUg38KB9J11YRMd2zKvERE1ncQcsnfOQ1MLRxvDMUchlKNrAe5Xw7RZw==
|
|
1630
1827
|
dependencies:
|
|
1631
1828
|
"@jsforce/jsforce-node" "^3.7.0"
|
|
1632
1829
|
"@salesforce/kit" "^3.2.2"
|
|
@@ -1702,15 +1899,15 @@
|
|
|
1702
1899
|
integrity sha512-LiN37zG5ODT6z70sL1fxF7BQwtCX9JOWofSU8iliSNIM+WDEeinnoFtVqPInRSNt8I0RiJxIKCrqstsmQRBNvA==
|
|
1703
1900
|
|
|
1704
1901
|
"@salesforce/sf-plugins-core@^12":
|
|
1705
|
-
version "12.1
|
|
1706
|
-
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-12.1.
|
|
1707
|
-
integrity sha512-
|
|
1902
|
+
version "12.2.1"
|
|
1903
|
+
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-12.2.1.tgz#1048a5d1245f07f0e864f0f76e8818fd21a84fe6"
|
|
1904
|
+
integrity sha512-b3eRSzGO0weBLL1clHaJNgNP1aKkD1Qy2DQEc0ieteEm+fh1FfPA0QpJ9rh/hdmkJRip2x2R2zz9tflJ0wflbg==
|
|
1708
1905
|
dependencies:
|
|
1709
1906
|
"@inquirer/confirm" "^3.1.22"
|
|
1710
1907
|
"@inquirer/password" "^2.2.0"
|
|
1711
|
-
"@oclif/core" "^4.2.
|
|
1908
|
+
"@oclif/core" "^4.2.10"
|
|
1712
1909
|
"@oclif/table" "^0.4.6"
|
|
1713
|
-
"@salesforce/core" "^8.5
|
|
1910
|
+
"@salesforce/core" "^8.8.5"
|
|
1714
1911
|
"@salesforce/kit" "^3.2.3"
|
|
1715
1912
|
"@salesforce/ts-types" "^2.0.12"
|
|
1716
1913
|
ansis "^3.3.2"
|
|
@@ -4109,12 +4306,12 @@ eslint-plugin-jsdoc@^46.10.1:
|
|
|
4109
4306
|
semver "^7.5.4"
|
|
4110
4307
|
spdx-expression-parse "^4.0.0"
|
|
4111
4308
|
|
|
4112
|
-
eslint-plugin-sf-plugin@^1.20.
|
|
4113
|
-
version "1.20.
|
|
4114
|
-
resolved "https://registry.yarnpkg.com/eslint-plugin-sf-plugin/-/eslint-plugin-sf-plugin-1.20.
|
|
4115
|
-
integrity sha512-
|
|
4309
|
+
eslint-plugin-sf-plugin@^1.20.19:
|
|
4310
|
+
version "1.20.19"
|
|
4311
|
+
resolved "https://registry.yarnpkg.com/eslint-plugin-sf-plugin/-/eslint-plugin-sf-plugin-1.20.19.tgz#e13f4bc60fab1f8b76b6bff2c11558e9ce4a3d00"
|
|
4312
|
+
integrity sha512-HBvwvwZ/YcnZxq/h2tdUc9ch8KzsGQL2JtKm76J2yiILuLywuKnMALVKCn3tuBCtFW/OUUWNa7cR56ipU6Uh8w==
|
|
4116
4313
|
dependencies:
|
|
4117
|
-
"@salesforce/core" "^8.
|
|
4314
|
+
"@salesforce/core" "^8.9.0"
|
|
4118
4315
|
"@typescript-eslint/utils" "^7.18.0"
|
|
4119
4316
|
|
|
4120
4317
|
eslint-plugin-unicorn@^50.0.1:
|
|
@@ -6457,13 +6654,13 @@ object.values@^1.2.0:
|
|
|
6457
6654
|
define-properties "^1.2.1"
|
|
6458
6655
|
es-object-atoms "^1.0.0"
|
|
6459
6656
|
|
|
6460
|
-
oclif@^4.17.
|
|
6461
|
-
version "4.17.
|
|
6462
|
-
resolved "https://registry.yarnpkg.com/oclif/-/oclif-4.17.
|
|
6463
|
-
integrity sha512-
|
|
6657
|
+
oclif@^4.17.43:
|
|
6658
|
+
version "4.17.43"
|
|
6659
|
+
resolved "https://registry.yarnpkg.com/oclif/-/oclif-4.17.43.tgz#8845eb74f8708912475ef3eb3dfb76746d09c356"
|
|
6660
|
+
integrity sha512-yvZX0XQtKtt6+4xKpl83TSY6c8k4AvnZne8u+I1up3eVaMQkt2hsGR+VWIoY0Jl0OG2WJG+6fNkgC0uKPtP8/g==
|
|
6464
6661
|
dependencies:
|
|
6465
6662
|
"@aws-sdk/client-cloudfront" "^3.764.0"
|
|
6466
|
-
"@aws-sdk/client-s3" "^3.
|
|
6663
|
+
"@aws-sdk/client-s3" "^3.782.0"
|
|
6467
6664
|
"@inquirer/confirm" "^3.1.22"
|
|
6468
6665
|
"@inquirer/input" "^2.2.4"
|
|
6469
6666
|
"@inquirer/select" "^2.5.0"
|
|
@@ -8115,10 +8312,10 @@ typedoc@^0.26.5:
|
|
|
8115
8312
|
shiki "^1.16.2"
|
|
8116
8313
|
yaml "^2.5.1"
|
|
8117
8314
|
|
|
8118
|
-
"typescript@^4.6.4 || ^5.2.2", typescript@^5.5.4, typescript@^5.
|
|
8119
|
-
version "5.
|
|
8120
|
-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.
|
|
8121
|
-
integrity sha512-
|
|
8315
|
+
"typescript@^4.6.4 || ^5.2.2", typescript@^5.5.4, typescript@^5.8.3:
|
|
8316
|
+
version "5.8.3"
|
|
8317
|
+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e"
|
|
8318
|
+
integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==
|
|
8122
8319
|
|
|
8123
8320
|
typescript@~5.4.2:
|
|
8124
8321
|
version "5.4.5"
|
package/oclif.manifest.json
CHANGED
|
@@ -223,9 +223,11 @@
|
|
|
223
223
|
"rflib:logging:flow:instrument": {
|
|
224
224
|
"aliases": [],
|
|
225
225
|
"args": {},
|
|
226
|
-
"description": "
|
|
226
|
+
"description": "Automatically adds RFLIB logging statements to Salesforce Flows to provide enhanced tracking and debugging capabilities. Instruments flow invocations and decision paths with logging actions.",
|
|
227
227
|
"examples": [
|
|
228
|
-
"<%= config.bin %> <%= command.id %>"
|
|
228
|
+
"<%= config.bin %> <%= command.id %> --sourcepath force-app",
|
|
229
|
+
"<%= config.bin %> <%= command.id %> --sourcepath force-app --dryrun",
|
|
230
|
+
"<%= config.bin %> <%= command.id %> --sourcepath force-app --skip-instrumented"
|
|
229
231
|
],
|
|
230
232
|
"flags": {
|
|
231
233
|
"json": {
|
|
@@ -245,10 +247,10 @@
|
|
|
245
247
|
},
|
|
246
248
|
"sourcepath": {
|
|
247
249
|
"char": "s",
|
|
248
|
-
"description": "Path to the source directory containing
|
|
250
|
+
"description": "Path to the source directory containing Flow files that should be instrumented with RFLIB logging statements. Only processes .flow-meta.xml files with processType=\"Flow\".",
|
|
249
251
|
"name": "sourcepath",
|
|
250
252
|
"required": true,
|
|
251
|
-
"summary": "Directory containing
|
|
253
|
+
"summary": "Directory containing Flow files to instrument with logging.",
|
|
252
254
|
"hasDynamicHelp": false,
|
|
253
255
|
"multiple": false,
|
|
254
256
|
"type": "option"
|
|
@@ -262,7 +264,7 @@
|
|
|
262
264
|
"type": "boolean"
|
|
263
265
|
},
|
|
264
266
|
"skip-instrumented": {
|
|
265
|
-
"description": "When provided, the command will not add log statements to any Flows that already
|
|
267
|
+
"description": "When provided, the command will not add log statements to any Flows that already contain RFLIB logging actions.",
|
|
266
268
|
"name": "skip-instrumented",
|
|
267
269
|
"summary": "Skips any files where a logger is already present.",
|
|
268
270
|
"allowNo": false,
|
|
@@ -276,7 +278,7 @@
|
|
|
276
278
|
"pluginName": "rflib-plugin",
|
|
277
279
|
"pluginType": "core",
|
|
278
280
|
"strict": true,
|
|
279
|
-
"summary": "
|
|
281
|
+
"summary": "Adds RFLIB logging statements to Salesforce Flows.",
|
|
280
282
|
"enableJsonFlag": true,
|
|
281
283
|
"isESM": true,
|
|
282
284
|
"relativePath": [
|
|
@@ -426,5 +428,5 @@
|
|
|
426
428
|
]
|
|
427
429
|
}
|
|
428
430
|
},
|
|
429
|
-
"version": "0.
|
|
431
|
+
"version": "0.8.1"
|
|
430
432
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rflib-plugin",
|
|
3
3
|
"description": "Utility commands to help with the adoption of the RFLIB open-source library for Salesforce.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4",
|
|
7
7
|
"@salesforce/core": "^8",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"@salesforce/cli-plugins-testkit": "^5.3.10",
|
|
19
19
|
"@salesforce/dev-scripts": "^10.2.11",
|
|
20
20
|
"c8": "^10.1.3",
|
|
21
|
-
"eslint-plugin-sf-plugin": "^1.20.
|
|
21
|
+
"eslint-plugin-sf-plugin": "^1.20.19",
|
|
22
22
|
"husky": "^8.0.0",
|
|
23
|
-
"oclif": "^4.17.
|
|
23
|
+
"oclif": "^4.17.43",
|
|
24
24
|
"source-map-support": "^0.5.21",
|
|
25
25
|
"ts-node": "^10.9.2",
|
|
26
26
|
"tsconfig-paths": "^4.2.0",
|
|
27
|
-
"typescript": "^5.
|
|
27
|
+
"typescript": "^5.8.3"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=18.0.0"
|