rflib-plugin 0.10.0 → 0.11.0
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.
|
@@ -134,8 +134,6 @@ export class FlowInstrumentationService {
|
|
|
134
134
|
};
|
|
135
135
|
// Update the start element connector to point to our logger
|
|
136
136
|
startElement.connector.targetReference = loggingAction.name;
|
|
137
|
-
// Also set the startElementReference for consistency
|
|
138
|
-
instrumentedFlow.Flow.startElementReference = loggingAction.name;
|
|
139
137
|
}
|
|
140
138
|
// Set the CanvasMode to AUTO_LAYOUT_CANVAS
|
|
141
139
|
this.setCanvasMode(instrumentedFlow);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/flow/instrument.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,oDAAoD;AACpD,uDAAuD;AACvD,sDAAsD;AACtD,4DAA4D;AAC5D,wDAAwD;AACxD,+DAA+D;AAC/D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAOjC,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,OAAO,0BAA0B;IAC7B,MAAM,CAAU,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC;QACjD,aAAa,EAAE,KAAK;QACpB,qBAAqB,EAAE,IAAI;QAC3B,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;IAEK,MAA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AC,KAAK,CAAC,yBAAyB,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;YAC9D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["/* eslint-disable sf-plugin/only-extend-SfCommand */\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 { Messages, Logger } from '@salesforce/core';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-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\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 renderOpts: {\n pretty: true,\n indent: ' ',\n newline: '\\n'\n }\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 if (!flowObj?.Flow) {\n throw new Error('Invalid flow object structure');\n }\n\n // Create a new Flow object with ordered properties\n const orderedFlow = {\n '$': { 'xmlns': 'http://soap.sforce.com/2006/04/metadata' }\n } as Record<string, unknown>;\n\n // Add actionCalls first if it exists\n if (flowObj.Flow.actionCalls) {\n orderedFlow.actionCalls = flowObj.Flow.actionCalls;\n }\n\n // Add all other properties in their original order\n Object.entries(flowObj.Flow as Record<string, unknown>).forEach(([key, value]) => {\n if (key !== 'actionCalls' && key !== '$') {\n orderedFlow[key] = value;\n }\n });\n\n // Use the builder with just the Flow object, not wrapped in another object\n return this.builder.buildObject({ Flow: orderedFlow });\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 has a supported process type for instrumentation\n public static isSupportedProcessType(flowObj: any): boolean {\n const processType = flowObj?.Flow?.processType;\n const triggerType = flowObj?.Flow?.start?.triggerType;\n\n return processType === 'Flow' ||\n (processType === 'AutoLaunchedFlow' && triggerType === 'RecordAfterSave');\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.unshift(loggingAction);\n } else {\n instrumentedFlow.Flow.actionCalls = [loggingAction, instrumentedFlow.Flow.actionCalls];\n }\n\n // Find startElementReference or start element 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 if (instrumentedFlow.Flow.start?.connector?.targetReference) {\n // Handle flow with start element: create connector and update start reference\n const startElement = instrumentedFlow.Flow.start;\n const originalTarget = startElement.connector.targetReference;\n\n // Create connector between logger and the original target\n loggingAction.connector = {\n targetReference: originalTarget\n };\n\n // Update the start element connector to point to our logger\n startElement.connector.targetReference = loggingAction.name;\n // Also set the startElementReference for consistency\n instrumentedFlow.Flow.startElementReference = loggingAction.name;\n }\n\n // Set the CanvasMode to AUTO_LAYOUT_CANVAS\n this.setCanvasMode(instrumentedFlow);\n\n // Instrument decisions with logging for each outcome\n if (instrumentedFlow.Flow.decisions) {\n this.instrumentDecisions(instrumentedFlow, flowName);\n }\n\n // Reorder Flow properties\n const originalFlow = instrumentedFlow.Flow as Record<string, unknown>;\n const orderedFlow: Record<string, unknown> = {\n $: originalFlow.$,\n actionCalls: originalFlow.actionCalls\n };\n\n Object.keys(originalFlow).forEach(key => {\n if (key !== 'actionCalls' && key !== '$') {\n orderedFlow[key] = originalFlow[key];\n }\n });\n\n instrumentedFlow.Flow = orderedFlow;\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 // Support decision name as 'name' or legacy 'n'\n const decisionNameRaw = decision.name ?? decision.n;\n if (!decisionNameRaw) {\n return;\n }\n const decisionName = decisionNameRaw;\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 (support 'name' or legacy 'n')\n const ruleNameRaw = rule.name ?? rule.n;\n if (!rule.connector?.targetReference || !ruleNameRaw) {\n return;\n }\n const ruleTarget = rule.connector.targetReference;\n const ruleName = ruleNameRaw;\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 // Add new action at the beginning of the array\n flowObj.Flow.actionCalls.unshift(actionCall);\n } else {\n // If only one action exists, convert to array with new action first\n flowObj.Flow.actionCalls = [actionCall, flowObj.Flow.actionCalls];\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 // Create a name for the flow invocation logger (omit flowName to avoid conflicts)\n const name = `RFLIB_Flow_Logger_${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 set CanvasMode to AUTO_LAYOUT_CANVAS for better flow layout\n private static setCanvasMode(flowObj: any): void {\n // No longer automatically setting canvas mode - preserve original mode\n if (!flowObj.Flow) {\n return;\n }\n\n // Preserve original processMetadataValues state\n const originalMeta = flowObj.Flow.processMetadataValues;\n const hadProcessMetadataValues = !!originalMeta;\n // Normalize to array\n const metadataValues = !originalMeta\n ? []\n : Array.isArray(originalMeta)\n ? originalMeta\n : [originalMeta];\n\n // Prepare CanvasMode entry\n const canvasModeEntry = {\n name: 'CanvasMode',\n value: {\n stringValue: 'AUTO_LAYOUT_CANVAS'\n }\n };\n // Check if CanvasMode metadata exists\n const canvasModeIndex = metadataValues.findIndex((meta: any) =>\n meta.name === 'CanvasMode'\n );\n\n if (canvasModeIndex === -1) {\n // Add AUTO_LAYOUT_CANVAS entry\n metadataValues.push(canvasModeEntry);\n // Duplicate entry for flows that had no metadata to ensure array output on single entry\n if (!hadProcessMetadataValues) {\n metadataValues.push({\n name: canvasModeEntry.name,\n value: { stringValue: canvasModeEntry.value.stringValue }\n });\n }\n } else {\n metadataValues[canvasModeIndex].value.stringValue = 'AUTO_LAYOUT_CANVAS';\n }\n\n // Assign back the potentially modified array\n /* eslint-disable no-param-reassign */\n flowObj.Flow.processMetadataValues = metadataValues;\n /* eslint-enable no-param-reassign */\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 entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (entry.isDirectory()) {\n await this.processDirectory(filePath, isDryRun, skipInstrumented);\n return;\n }\n\n if (entry.name.endsWith('.flow-meta.xml')) {\n await this.instrumentFlowFile(filePath, isDryRun, skipInstrumented);\n }\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 supported process types\n if (!FlowInstrumentationService.isSupportedProcessType(flowObj)) {\n this.logger.debug(`Skipping unsupported 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
|
+
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/flow/instrument.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,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AC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YACxG,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 sf-plugin/only-extend-SfCommand */\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 { Messages, Logger } from '@salesforce/core';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-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\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 renderOpts: {\n pretty: true,\n indent: ' ',\n newline: '\\n'\n }\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 if (!flowObj?.Flow) {\n throw new Error('Invalid flow object structure');\n }\n\n // Create a new Flow object with ordered properties\n const orderedFlow = {\n '$': { 'xmlns': 'http://soap.sforce.com/2006/04/metadata' }\n } as Record<string, unknown>;\n\n // Add actionCalls first if it exists\n if (flowObj.Flow.actionCalls) {\n orderedFlow.actionCalls = flowObj.Flow.actionCalls;\n }\n\n // Add all other properties in their original order\n Object.entries(flowObj.Flow as Record<string, unknown>).forEach(([key, value]) => {\n if (key !== 'actionCalls' && key !== '$') {\n orderedFlow[key] = value;\n }\n });\n\n // Use the builder with just the Flow object, not wrapped in another object\n return this.builder.buildObject({ Flow: orderedFlow });\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 has a supported process type for instrumentation\n public static isSupportedProcessType(flowObj: any): boolean {\n const processType = flowObj?.Flow?.processType;\n const triggerType = flowObj?.Flow?.start?.triggerType;\n\n return processType === 'Flow' ||\n (processType === 'AutoLaunchedFlow' && triggerType === 'RecordAfterSave');\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.unshift(loggingAction);\n } else {\n instrumentedFlow.Flow.actionCalls = [loggingAction, instrumentedFlow.Flow.actionCalls];\n }\n\n // Find startElementReference or start element 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 if (instrumentedFlow.Flow.start?.connector?.targetReference) {\n // Handle flow with start element: create connector and update start reference\n const startElement = instrumentedFlow.Flow.start;\n const originalTarget = startElement.connector.targetReference;\n\n // Create connector between logger and the original target\n loggingAction.connector = {\n targetReference: originalTarget\n };\n\n // Update the start element connector to point to our logger\n startElement.connector.targetReference = loggingAction.name;\n }\n\n // Set the CanvasMode to AUTO_LAYOUT_CANVAS\n this.setCanvasMode(instrumentedFlow);\n\n // Instrument decisions with logging for each outcome\n if (instrumentedFlow.Flow.decisions) {\n this.instrumentDecisions(instrumentedFlow, flowName);\n }\n\n // Reorder Flow properties\n const originalFlow = instrumentedFlow.Flow as Record<string, unknown>;\n const orderedFlow: Record<string, unknown> = {\n $: originalFlow.$,\n actionCalls: originalFlow.actionCalls\n };\n\n Object.keys(originalFlow).forEach(key => {\n if (key !== 'actionCalls' && key !== '$') {\n orderedFlow[key] = originalFlow[key];\n }\n });\n\n instrumentedFlow.Flow = orderedFlow;\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 // Support decision name as 'name' or legacy 'n'\n const decisionNameRaw = decision.name ?? decision.n;\n if (!decisionNameRaw) {\n return;\n }\n const decisionName = decisionNameRaw;\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 (support 'name' or legacy 'n')\n const ruleNameRaw = rule.name ?? rule.n;\n if (!rule.connector?.targetReference || !ruleNameRaw) {\n return;\n }\n const ruleTarget = rule.connector.targetReference;\n const ruleName = ruleNameRaw;\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 // Add new action at the beginning of the array\n flowObj.Flow.actionCalls.unshift(actionCall);\n } else {\n // If only one action exists, convert to array with new action first\n flowObj.Flow.actionCalls = [actionCall, flowObj.Flow.actionCalls];\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 // Create a name for the flow invocation logger (omit flowName to avoid conflicts)\n const name = `RFLIB_Flow_Logger_${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 set CanvasMode to AUTO_LAYOUT_CANVAS for better flow layout\n private static setCanvasMode(flowObj: any): void {\n // No longer automatically setting canvas mode - preserve original mode\n if (!flowObj.Flow) {\n return;\n }\n\n // Preserve original processMetadataValues state\n const originalMeta = flowObj.Flow.processMetadataValues;\n const hadProcessMetadataValues = !!originalMeta;\n // Normalize to array\n const metadataValues = !originalMeta\n ? []\n : Array.isArray(originalMeta)\n ? originalMeta\n : [originalMeta];\n\n // Prepare CanvasMode entry\n const canvasModeEntry = {\n name: 'CanvasMode',\n value: {\n stringValue: 'AUTO_LAYOUT_CANVAS'\n }\n };\n // Check if CanvasMode metadata exists\n const canvasModeIndex = metadataValues.findIndex((meta: any) =>\n meta.name === 'CanvasMode'\n );\n\n if (canvasModeIndex === -1) {\n // Add AUTO_LAYOUT_CANVAS entry\n metadataValues.push(canvasModeEntry);\n // Duplicate entry for flows that had no metadata to ensure array output on single entry\n if (!hadProcessMetadataValues) {\n metadataValues.push({\n name: canvasModeEntry.name,\n value: { stringValue: canvasModeEntry.value.stringValue }\n });\n }\n } else {\n metadataValues[canvasModeIndex].value.stringValue = 'AUTO_LAYOUT_CANVAS';\n }\n\n // Assign back the potentially modified array\n /* eslint-disable no-param-reassign */\n flowObj.Flow.processMetadataValues = metadataValues;\n /* eslint-enable no-param-reassign */\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 entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (entry.isDirectory()) {\n await this.processDirectory(filePath, isDryRun, skipInstrumented);\n return;\n }\n\n if (entry.name.endsWith('.flow-meta.xml')) {\n await this.instrumentFlowFile(filePath, isDryRun, skipInstrumented);\n }\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 supported process types\n if (!FlowInstrumentationService.isSupportedProcessType(flowObj)) {\n this.logger.debug(`Skipping unsupported 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}"]}
|
package/oclif.lock
CHANGED
|
@@ -1135,7 +1135,7 @@
|
|
|
1135
1135
|
minimatch "^3.1.2"
|
|
1136
1136
|
strip-json-comments "^3.1.1"
|
|
1137
1137
|
|
|
1138
|
-
"@eslint/js@8.57.1":
|
|
1138
|
+
"@eslint/js@8.57.1", "@eslint/js@^8.57.1":
|
|
1139
1139
|
version "8.57.1"
|
|
1140
1140
|
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2"
|
|
1141
1141
|
integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==
|
|
@@ -1635,10 +1635,10 @@
|
|
|
1635
1635
|
resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8"
|
|
1636
1636
|
integrity sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==
|
|
1637
1637
|
|
|
1638
|
-
"@salesforce/cli-plugins-testkit@^5.3.
|
|
1639
|
-
version "5.3.
|
|
1640
|
-
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-5.3.
|
|
1641
|
-
integrity sha512-
|
|
1638
|
+
"@salesforce/cli-plugins-testkit@^5.3.41":
|
|
1639
|
+
version "5.3.41"
|
|
1640
|
+
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-5.3.41.tgz#16acca933dcd64f0fd2c917c7b22529107f373e6"
|
|
1641
|
+
integrity sha512-K6fZfvzJAb0WFJFlgyIHgLyWLXR7i2SKDZ069kvCmDN0QVfftp/OwYrtosIzxiXdpHOtcoAkt65M1UR1aw0XzA==
|
|
1642
1642
|
dependencies:
|
|
1643
1643
|
"@salesforce/core" "^8.8.0"
|
|
1644
1644
|
"@salesforce/kit" "^3.2.3"
|
package/oclif.manifest.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
-
"rflib:logging:
|
|
3
|
+
"rflib:logging:aura:instrument": {
|
|
4
4
|
"aliases": [],
|
|
5
5
|
"args": {},
|
|
6
|
-
"description": "Analyzes
|
|
6
|
+
"description": "Analyzes Aura Component files and adds RFLIB logging statements for:\n- Method entry logging with parameter values in Controller, Helper, and Renderer files\n- Error logging in try-catch blocks\n- Error logging in Promise catch handlers\n- Adds rflibLoggerCmp component if not present\n- Replaces console.log and similar method invocations\n- Formats modified files using Prettier (optional)\n\nThe command processes:\n- Component (.cmp) files to add the logger component\n- Controller (.js) files for method instrumentation\n- Helper (.js) files for method instrumentation\n- Renderer (.js) files for method instrumentation",
|
|
7
7
|
"examples": [
|
|
8
|
-
"- Add logging
|
|
8
|
+
"- Add logging to all aura files:\n$ sf rflib logging aura instrument --sourcepath force-app\n\n- Preview changes:\n$ sf rflib logging aura instrument --sourcepath force-app --dryrun\n\n- Add logging and format code:\n$ sf rflib logging aura instrument --sourcepath force-app --prettier\n\n- Process specific component:\n$ sf rflib logging aura instrument --sourcepath force-app/main/default/aura/myComponent"
|
|
9
9
|
],
|
|
10
10
|
"flags": {
|
|
11
11
|
"json": {
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
},
|
|
26
26
|
"sourcepath": {
|
|
27
27
|
"char": "s",
|
|
28
|
-
"description": "Path to the source directory containing
|
|
28
|
+
"description": "Path to the source directory containing Aura components that should be instrumented with RFLIB logging statements. The command will:\n- Scan for 'aura' directories recursively\n- Process all Aura components found\n- Add <c:rflibLoggerCmp> to component files\n- Add logging statements to JavaScript files\n- Initialize logger in methods using component.find()",
|
|
29
29
|
"name": "sourcepath",
|
|
30
30
|
"required": true,
|
|
31
|
-
"summary": "Directory containing
|
|
31
|
+
"summary": "Directory containing Aura components to instrument with logging.",
|
|
32
32
|
"hasDynamicHelp": false,
|
|
33
33
|
"multiple": false,
|
|
34
34
|
"type": "option"
|
|
35
35
|
},
|
|
36
36
|
"dryrun": {
|
|
37
37
|
"char": "d",
|
|
38
|
-
"description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
|
|
38
|
+
"description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes. Shows:\n- Files that would be modified\n- Number of processed files\n- Number of modified files\n- Number of formatted files",
|
|
39
39
|
"name": "dryrun",
|
|
40
40
|
"summary": "Preview changes without modifying files.",
|
|
41
41
|
"allowNo": false,
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"prettier": {
|
|
45
45
|
"char": "p",
|
|
46
|
-
"description": "When enabled, formats the modified
|
|
46
|
+
"description": "When enabled, formats the modified JavaScript files using Prettier after adding logging statements. Maintains consistent code style with:\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs\n- No trailing commas",
|
|
47
47
|
"name": "prettier",
|
|
48
48
|
"summary": "Format modified files using Prettier.",
|
|
49
49
|
"allowNo": false,
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"type": "boolean"
|
|
58
58
|
},
|
|
59
59
|
"skip-instrumented": {
|
|
60
|
-
"description": "When provided, the command will not add log statements to any
|
|
60
|
+
"description": "When provided, the command will not add log statements to any Aura component that contains the `` component.",
|
|
61
61
|
"name": "skip-instrumented",
|
|
62
62
|
"summary": "Skips any files where a logger is already present.",
|
|
63
63
|
"allowNo": false,
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
},
|
|
67
67
|
"hasDynamicHelp": false,
|
|
68
68
|
"hiddenAliases": [],
|
|
69
|
-
"id": "rflib:logging:
|
|
69
|
+
"id": "rflib:logging:aura:instrument",
|
|
70
70
|
"pluginAlias": "rflib-plugin",
|
|
71
71
|
"pluginName": "rflib-plugin",
|
|
72
72
|
"pluginType": "core",
|
|
73
73
|
"strict": true,
|
|
74
|
-
"summary": "Instrument
|
|
74
|
+
"summary": "Instrument Aura Components with RFLIB logging statements automatically.",
|
|
75
75
|
"enableJsonFlag": true,
|
|
76
76
|
"isESM": true,
|
|
77
77
|
"relativePath": [
|
|
@@ -79,43 +79,43 @@
|
|
|
79
79
|
"commands",
|
|
80
80
|
"rflib",
|
|
81
81
|
"logging",
|
|
82
|
-
"
|
|
82
|
+
"aura",
|
|
83
83
|
"instrument.js"
|
|
84
84
|
],
|
|
85
85
|
"aliasPermutations": [],
|
|
86
86
|
"permutations": [
|
|
87
|
-
"rflib:logging:
|
|
88
|
-
"logging:rflib:
|
|
89
|
-
"logging:
|
|
90
|
-
"logging:
|
|
91
|
-
"rflib:
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"rflib:
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"rflib:logging:instrument:
|
|
100
|
-
"logging:rflib:instrument:
|
|
101
|
-
"logging:instrument:rflib:
|
|
102
|
-
"logging:instrument:
|
|
103
|
-
"rflib:instrument:logging:
|
|
104
|
-
"instrument:rflib:logging:
|
|
105
|
-
"instrument:logging:rflib:
|
|
106
|
-
"instrument:logging:
|
|
107
|
-
"rflib:instrument:
|
|
108
|
-
"instrument:rflib:
|
|
109
|
-
"instrument:
|
|
110
|
-
"instrument:
|
|
87
|
+
"rflib:logging:aura:instrument",
|
|
88
|
+
"logging:rflib:aura:instrument",
|
|
89
|
+
"logging:aura:rflib:instrument",
|
|
90
|
+
"logging:aura:instrument:rflib",
|
|
91
|
+
"rflib:aura:logging:instrument",
|
|
92
|
+
"aura:rflib:logging:instrument",
|
|
93
|
+
"aura:logging:rflib:instrument",
|
|
94
|
+
"aura:logging:instrument:rflib",
|
|
95
|
+
"rflib:aura:instrument:logging",
|
|
96
|
+
"aura:rflib:instrument:logging",
|
|
97
|
+
"aura:instrument:rflib:logging",
|
|
98
|
+
"aura:instrument:logging:rflib",
|
|
99
|
+
"rflib:logging:instrument:aura",
|
|
100
|
+
"logging:rflib:instrument:aura",
|
|
101
|
+
"logging:instrument:rflib:aura",
|
|
102
|
+
"logging:instrument:aura:rflib",
|
|
103
|
+
"rflib:instrument:logging:aura",
|
|
104
|
+
"instrument:rflib:logging:aura",
|
|
105
|
+
"instrument:logging:rflib:aura",
|
|
106
|
+
"instrument:logging:aura:rflib",
|
|
107
|
+
"rflib:instrument:aura:logging",
|
|
108
|
+
"instrument:rflib:aura:logging",
|
|
109
|
+
"instrument:aura:rflib:logging",
|
|
110
|
+
"instrument:aura:logging:rflib"
|
|
111
111
|
]
|
|
112
112
|
},
|
|
113
|
-
"rflib:logging:
|
|
113
|
+
"rflib:logging:apex:instrument": {
|
|
114
114
|
"aliases": [],
|
|
115
115
|
"args": {},
|
|
116
|
-
"description": "Analyzes
|
|
116
|
+
"description": "Analyzes Apex classes and adds RFLIB logging statements for method entry and error handling. Adds class-level logger initialization if not already present. \nFor Apex Test classes, the `@TestSetup` method will be updated to include `rflib_TestUtil.prepareLoggerForUnitTests();` to avoid test failures caused by the logging framework.",
|
|
117
117
|
"examples": [
|
|
118
|
-
"- Add logging to all
|
|
118
|
+
"- Add logging statements to all Apex classes in a directory:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes\n\n- Preview changes without modifying files:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --dryrun\n\n- Add logging statements and format code:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --prettier"
|
|
119
119
|
],
|
|
120
120
|
"flags": {
|
|
121
121
|
"json": {
|
|
@@ -135,17 +135,17 @@
|
|
|
135
135
|
},
|
|
136
136
|
"sourcepath": {
|
|
137
137
|
"char": "s",
|
|
138
|
-
"description": "Path to the source directory containing
|
|
138
|
+
"description": "Path to the source directory containing Apex classes that should be instrumented with RFLIB logging statements. Test classes (ending with 'Test.cls') are automatically excluded.",
|
|
139
139
|
"name": "sourcepath",
|
|
140
140
|
"required": true,
|
|
141
|
-
"summary": "Directory containing
|
|
141
|
+
"summary": "Directory containing Apex classes to instrument with logging.",
|
|
142
142
|
"hasDynamicHelp": false,
|
|
143
143
|
"multiple": false,
|
|
144
144
|
"type": "option"
|
|
145
145
|
},
|
|
146
146
|
"dryrun": {
|
|
147
147
|
"char": "d",
|
|
148
|
-
"description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.
|
|
148
|
+
"description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
|
|
149
149
|
"name": "dryrun",
|
|
150
150
|
"summary": "Preview changes without modifying files.",
|
|
151
151
|
"allowNo": false,
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
},
|
|
154
154
|
"prettier": {
|
|
155
155
|
"char": "p",
|
|
156
|
-
"description": "When enabled, formats the modified
|
|
156
|
+
"description": "When enabled, formats the modified Apex files using prettier-plugin-apex after adding logging statements. Maintains consistent code style with:\n\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs",
|
|
157
157
|
"name": "prettier",
|
|
158
158
|
"summary": "Format modified files using Prettier.",
|
|
159
159
|
"allowNo": false,
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"type": "boolean"
|
|
168
168
|
},
|
|
169
169
|
"skip-instrumented": {
|
|
170
|
-
"description": "When provided, the command will not add log statements to any
|
|
170
|
+
"description": "When provided, the command will not add log statements to any Apex class that contains the `rflib_Logger` reference.",
|
|
171
171
|
"name": "skip-instrumented",
|
|
172
172
|
"summary": "Skips any files where a logger is already present.",
|
|
173
173
|
"allowNo": false,
|
|
@@ -176,12 +176,12 @@
|
|
|
176
176
|
},
|
|
177
177
|
"hasDynamicHelp": false,
|
|
178
178
|
"hiddenAliases": [],
|
|
179
|
-
"id": "rflib:logging:
|
|
179
|
+
"id": "rflib:logging:apex:instrument",
|
|
180
180
|
"pluginAlias": "rflib-plugin",
|
|
181
181
|
"pluginName": "rflib-plugin",
|
|
182
182
|
"pluginType": "core",
|
|
183
183
|
"strict": true,
|
|
184
|
-
"summary": "Instrument
|
|
184
|
+
"summary": "Instrument Apex classes with RFLIB logging statements automatically.",
|
|
185
185
|
"enableJsonFlag": true,
|
|
186
186
|
"isESM": true,
|
|
187
187
|
"relativePath": [
|
|
@@ -189,35 +189,35 @@
|
|
|
189
189
|
"commands",
|
|
190
190
|
"rflib",
|
|
191
191
|
"logging",
|
|
192
|
-
"
|
|
192
|
+
"apex",
|
|
193
193
|
"instrument.js"
|
|
194
194
|
],
|
|
195
195
|
"aliasPermutations": [],
|
|
196
196
|
"permutations": [
|
|
197
|
-
"rflib:logging:
|
|
198
|
-
"logging:rflib:
|
|
199
|
-
"logging:
|
|
200
|
-
"logging:
|
|
201
|
-
"rflib:
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
205
|
-
"rflib:
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"rflib:logging:instrument:
|
|
210
|
-
"logging:rflib:instrument:
|
|
211
|
-
"logging:instrument:rflib:
|
|
212
|
-
"logging:instrument:
|
|
213
|
-
"rflib:instrument:logging:
|
|
214
|
-
"instrument:rflib:logging:
|
|
215
|
-
"instrument:logging:rflib:
|
|
216
|
-
"instrument:logging:
|
|
217
|
-
"rflib:instrument:
|
|
218
|
-
"instrument:rflib:
|
|
219
|
-
"instrument:
|
|
220
|
-
"instrument:
|
|
197
|
+
"rflib:logging:apex:instrument",
|
|
198
|
+
"logging:rflib:apex:instrument",
|
|
199
|
+
"logging:apex:rflib:instrument",
|
|
200
|
+
"logging:apex:instrument:rflib",
|
|
201
|
+
"rflib:apex:logging:instrument",
|
|
202
|
+
"apex:rflib:logging:instrument",
|
|
203
|
+
"apex:logging:rflib:instrument",
|
|
204
|
+
"apex:logging:instrument:rflib",
|
|
205
|
+
"rflib:apex:instrument:logging",
|
|
206
|
+
"apex:rflib:instrument:logging",
|
|
207
|
+
"apex:instrument:rflib:logging",
|
|
208
|
+
"apex:instrument:logging:rflib",
|
|
209
|
+
"rflib:logging:instrument:apex",
|
|
210
|
+
"logging:rflib:instrument:apex",
|
|
211
|
+
"logging:instrument:rflib:apex",
|
|
212
|
+
"logging:instrument:apex:rflib",
|
|
213
|
+
"rflib:instrument:logging:apex",
|
|
214
|
+
"instrument:rflib:logging:apex",
|
|
215
|
+
"instrument:logging:rflib:apex",
|
|
216
|
+
"instrument:logging:apex:rflib",
|
|
217
|
+
"rflib:instrument:apex:logging",
|
|
218
|
+
"instrument:rflib:apex:logging",
|
|
219
|
+
"instrument:apex:rflib:logging",
|
|
220
|
+
"instrument:apex:logging:rflib"
|
|
221
221
|
]
|
|
222
222
|
},
|
|
223
223
|
"rflib:logging:flow:instrument": {
|
|
@@ -428,5 +428,5 @@
|
|
|
428
428
|
]
|
|
429
429
|
}
|
|
430
430
|
},
|
|
431
|
-
"version": "0.
|
|
431
|
+
"version": "0.11.0"
|
|
432
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.11.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4",
|
|
7
7
|
"@salesforce/core": "^8",
|
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
"@types/xml2js": "^0.4.14",
|
|
10
10
|
"prettier": "^3.5.3",
|
|
11
11
|
"prettier-plugin-apex": "^2.2.6",
|
|
12
|
+
"wireit": "^0.14.12",
|
|
12
13
|
"xml2js": "^0.6.2"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"@commitlint/cli": "^19.8.1",
|
|
17
|
+
"@eslint/eslintrc": "^2.1.4",
|
|
18
|
+
"@eslint/js": "^8.57.1",
|
|
16
19
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
17
20
|
"@oclif/plugin-command-snapshot": "^5.2.40",
|
|
18
|
-
"@salesforce/cli-plugins-testkit": "^5.3.
|
|
21
|
+
"@salesforce/cli-plugins-testkit": "^5.3.41",
|
|
19
22
|
"@salesforce/dev-scripts": "^11.0.4",
|
|
20
23
|
"c8": "^10.1.3",
|
|
21
24
|
"eslint-plugin-sf-plugin": "^1.20.24",
|