rflib-plugin 0.20.0 → 0.21.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 -3
- package/lib/commands/rflib/logging/apex/instrument.js +2 -2
- package/lib/commands/rflib/logging/apex/instrument.js.map +1 -1
- package/lib/commands/rflib/logging/aura/instrument.js +3 -3
- package/lib/commands/rflib/logging/aura/instrument.js.map +1 -1
- package/lib/commands/rflib/logging/flow/instrument.d.ts +19 -1
- package/lib/commands/rflib/logging/flow/instrument.js +248 -103
- package/lib/commands/rflib/logging/flow/instrument.js.map +1 -1
- package/lib/commands/rflib/logging/lwc/instrument.js +2 -2
- package/lib/commands/rflib/logging/lwc/instrument.js.map +1 -1
- package/lib/shared/exclude.d.ts +8 -0
- package/lib/shared/exclude.js +17 -0
- package/lib/shared/exclude.js.map +1 -0
- package/messages/rflib.logging.flow.instrument.md +29 -4
- package/oclif.manifest.json +190 -171
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/flow/instrument.ts"],"names":[],"mappings":"AAAA,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;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAQ3E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,G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,EAAE,CAAC,CAAC;gBAC5C,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;oBAC9C,IAAI,SAAS,EAAE,CAAC;wBACd,IAAI,CAAC,GAAG,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;oBACxC,CAAC;gBACH,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/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';\nimport { minimatch } from 'minimatch';\nimport { processWithConcurrency } from '../../../../shared/concurrency.js';\n\nexport type RflibLoggingFlowInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n modifiedFilePaths?: string[];\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}`, { cause: error });\n }\n throw new Error('Flow parsing failed with unknown error', { cause: 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}`, { cause: error });\n }\n throw new Error('Flow building failed with unknown error', { cause: 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 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 // Move the original connector onto the logger so properties such as isGoTo\n // stay on the edge that actually jumps to the original target\n defaultLogger.connector = { ...decision.defaultConnector };\n\n // Add logger to actionCalls first, before updating the decision connector\n this.addActionCallToFlow(flowObj, defaultLogger);\n\n // Point the decision's default connector at our logger with a plain connector\n // We're inside a forEach callback, so we have to modify the original object\n decision.defaultConnector = { targetReference: defaultLogger.name };\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 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 // Move the original connector onto the logger so properties such as isGoTo\n // stay on the edge that actually jumps to the original target\n ruleLogger.connector = { ...rule.connector };\n\n // Add logger to actionCalls first, before updating the rule connector\n this.addActionCallToFlow(flowObj, ruleLogger);\n\n // Point the rule's connector at our logger with a plain connector\n // We're inside a forEach callback, so we have to modify the original object\n rule.connector = { targetReference: ruleLogger.name };\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 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 }\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 flowObj.Flow.processMetadataValues = metadataValues;\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 verbose: Flags.boolean({\n summary: messages.getMessage('flags.verbose.summary'),\n description: messages.getMessage('flags.verbose.description'),\n char: 'v',\n default: false,\n }),\n exclude: Flags.string({\n summary: messages.getMessage('flags.exclude.summary'),\n description: messages.getMessage('flags.exclude.description'),\n char: 'e',\n }),\n concurrency: Flags.integer({\n summary: messages.getMessage('flags.concurrency.summary'),\n description: messages.getMessage('flags.concurrency.description'),\n char: 'c',\n default: 10,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingFlowInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n modifiedFilePaths: [],\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 const isVerbose = flags.verbose;\n const excludePattern = flags.exclude;\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\n const files = await this.findAllFlowFiles(sourcePath, excludePattern);\n await processWithConcurrency(\n files,\n flags.concurrency,\n async (filePath) => {\n await this.instrumentFlowFile(filePath, isDryRun, skipInstrumented, isVerbose);\n }\n );\n\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 findAllFlowFiles(dirPath: string, excludePattern?: string): Promise<string[]> {\n this.logger.debug(`Scanning directory: ${dirPath}`);\n const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n const results = await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (excludePattern && minimatch(filePath, excludePattern, { matchBase: true })) {\n this.logger.debug(`Skipping excluded path: ${filePath}`);\n return [];\n }\n\n if (entry.isDirectory()) {\n return this.findAllFlowFiles(filePath, excludePattern);\n }\n\n if (entry.name.endsWith('.flow-meta.xml')) {\n return [filePath];\n }\n\n return [];\n })\n );\n\n return results.flat();\n }\n\n private async instrumentFlowFile(filePath: string, isDryRun: boolean, skipInstrumented: boolean, isVerbose: 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 this.stats.modifiedFilePaths?.push(filePath);\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 if (isVerbose) {\n this.log(`Would modify: ${filePath}`);\n }\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","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/flow/instrument.ts"],"names":[],"mappings":"AAAA,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,EAAmB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,aA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,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;oBAC9C,IAAI,SAAS,EAAE,CAAC;wBACd,IAAI,CAAC,GAAG,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;oBACxC,CAAC;gBACH,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/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, type Connection } from '@salesforce/core';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-core';\nimport * as xml2js from 'xml2js';\nimport { processWithConcurrency } from '../../../../shared/concurrency.js';\nimport { isExcluded } from '../../../../shared/exclude.js';\nimport {\n compareVersions,\n formatVersion,\n getInstalledPackages,\n type PackageVersionNumber,\n} from '../../../../shared/packageClient.js';\n\nexport type RflibLoggingFlowInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n modifiedFilePaths?: string[];\n};\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.flow.instrument');\n\nconst RFLIB_PACKAGE_NAME = 'RFLIB';\n\n// First RFLIB version whose Log Message flow action has the Terminate Transaction option,\n// which the fault paths created by this command rely on\nconst FAULT_PATH_MIN_RFLIB_VERSION: Readonly<PackageVersionNumber> = { major: 11, minor: 4, patch: 0, build: 0 };\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 // Flow element types that support a fault connector, mapped to the name used in Flow Builder\n private static readonly FAULT_CAPABLE_ELEMENTS: Readonly<Record<string, string>> = {\n actionCalls: 'Action',\n apexPluginCalls: 'Apex Plugin',\n recordCreates: 'Create Records',\n recordDeletes: 'Delete Records',\n recordLookups: 'Get Records',\n recordUpdates: 'Update Records',\n waits: 'Wait',\n };\n\n // Keys common to all flow elements, which precede the type specific keys in the metadata\n private static readonly BASE_ELEMENT_KEYS: ReadonlySet<string> = new Set([\n 'processMetadataValues',\n 'description',\n 'name',\n 'n',\n 'elementSubtype',\n 'label',\n 'locationX',\n 'locationY',\n ]);\n\n // Keys whose element references are outputs or navigation rather than inputs of an element\n private static readonly NON_INPUT_KEYS: ReadonlySet<string> = new Set([\n 'connector',\n 'faultConnector',\n 'outputAssignments',\n 'outputParameters',\n 'processMetadataValues',\n ]);\n\n // Screen field types that hold a single input value\n private static readonly SCALAR_SCREEN_FIELD_TYPES: ReadonlySet<string> = new Set([\n 'InputField',\n 'LargeTextArea',\n 'DropdownBox',\n 'RadioButtons',\n ]);\n\n private static readonly MAX_FAULT_LOG_REFERENCES = 10;\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}`, { cause: error });\n }\n throw new Error('Flow parsing failed with unknown error', { cause: 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}`, { cause: error });\n }\n throw new Error('Flow building failed with unknown error', { cause: 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((action: any) => this.isRFLIBLoggerAction(action));\n }\n\n // Helper to check if a single action call is an RFLIB logging action\n public static isRFLIBLoggerAction(action: any): boolean {\n return (\n action?.actionName === 'rflib:Logger' ||\n action?.actionName === 'rflib_LoggerFlowAction' ||\n action?.actionName === 'rflib_ApplicationEventLoggerAction' ||\n (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, skipFaultPaths = 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 // Log an error on every fault path of elements that can fail\n if (!skipFaultPaths) {\n this.instrumentFaultPaths(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 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 // Move the original connector onto the logger so properties such as isGoTo\n // stay on the edge that actually jumps to the original target\n defaultLogger.connector = { ...decision.defaultConnector };\n\n // Add logger to actionCalls first, before updating the decision connector\n this.addActionCallToFlow(flowObj, defaultLogger);\n\n // Point the decision's default connector at our logger with a plain connector\n // We're inside a forEach callback, so we have to modify the original object\n decision.defaultConnector = { targetReference: defaultLogger.name };\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 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 // Move the original connector onto the logger so properties such as isGoTo\n // stay on the edge that actually jumps to the original target\n ruleLogger.connector = { ...rule.connector };\n\n // Add logger to actionCalls first, before updating the rule connector\n this.addActionCallToFlow(flowObj, ruleLogger);\n\n // Point the rule's connector at our logger with a plain connector\n // We're inside a forEach callback, so we have to modify the original object\n rule.connector = { targetReference: ruleLogger.name };\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 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 }\n\n // Helper to add error logging to the fault path of every element that can fail.\n // Existing fault paths continue after the logger; new fault paths terminate the transaction\n // after logging so that the flow fails the same way as without a fault path.\n private static instrumentFaultPaths(flowObj: any, flowName: string): void {\n // Fault paths starting with one of these actions are already logged, e.g. by a previous run\n const logMessageActionNames = new Set(\n this.toArray(flowObj.Flow.actionCalls)\n .filter((action: any) => this.isRFLIBLoggerAction(action) && action.actionName !== 'rflib_ApplicationEventLoggerAction')\n .map((action: any) => this.getElementName(action))\n );\n const scalarResourceNames = this.collectScalarResourceNames(flowObj);\n\n Object.entries(this.FAULT_CAPABLE_ELEMENTS).forEach(([elementType, elementTypeLabel]) => {\n // Copy the list since fault loggers are added to actionCalls while iterating\n const elements = [...this.toArray(flowObj.Flow[elementType])];\n\n elements.forEach((element: any) => {\n const elementName = this.getElementName(element);\n if (!elementName || (elementType === 'actionCalls' && this.isRFLIBLoggerAction(element))) {\n return;\n }\n\n const originalFaultConnector = element.faultConnector;\n const originalTarget: unknown = originalFaultConnector?.targetReference;\n if (typeof originalTarget === 'string' && logMessageActionNames.has(originalTarget)) {\n return;\n }\n\n const faultLogger = this.createFaultPathLogger(\n flowName,\n elementTypeLabel,\n elementName,\n String(element.label || elementName),\n this.collectFaultLogReferences(flowObj, element, scalarResourceNames),\n !originalTarget\n );\n\n if (originalTarget) {\n // Continue with the existing fault path, keeping connector properties such as isGoTo\n faultLogger.connector = { ...originalFaultConnector };\n }\n\n this.addActionCallToFlow(flowObj, faultLogger);\n this.setFaultConnector(element, { targetReference: faultLogger.name });\n });\n });\n }\n\n // Helper to create the error logging action for a fault path\n private static createFaultPathLogger(\n flowName: string,\n elementTypeLabel: string,\n elementName: string,\n elementLabel: string,\n references: string[],\n terminateTransaction: boolean\n ): any {\n const loggerId = this.generateUniqueId();\n const prefix = 'RFLIB_Flow_Logger_Fault_';\n\n // Keep the name under 80 characters: prefix + element name + '_' + id\n const sanitizedElementName = this.sanitizeForName(elementName, 80 - prefix.length - loggerId.length - 1);\n const name = `${prefix}${sanitizedElementName}_${loggerId}`;\n const label = this.truncateLabel(`Log Fault: ${elementLabel}`);\n\n const values = references.map((reference) => `${reference}: {!${reference}}`).join(', ');\n const message =\n `Fault in ${elementTypeLabel} '${elementLabel}' (${elementName}): {!$Flow.FaultMessage}` +\n (values ? ` | ${values}` : '');\n\n const additionalParameters = terminateTransaction\n ? [{ name: 'terminateTransaction', value: { booleanValue: 'true' } }]\n : [];\n\n return this.buildLoggerAction(name, label, flowName, 'ERROR', message, additionalParameters);\n }\n\n // Helper to collect the resources whose values are logged when an element faults: the scalar inputs\n // of the element, the triggering record and the input variables of the flow\n private static collectFaultLogReferences(flowObj: any, element: any, scalarResourceNames: ReadonlySet<string>): string[] {\n const references: string[] = [];\n\n const addReference = (reference: unknown): void => {\n if (typeof reference !== 'string' || references.includes(reference)) {\n return;\n }\n\n // Global variables other than the triggering record, such as $Api or $Setup, may hold sensitive values\n if (reference.startsWith('$') && !/^\\$Record(__Prior)?\\./.test(reference)) {\n return;\n }\n\n if (reference.includes('.') || scalarResourceNames.has(reference)) {\n references.push(reference);\n }\n };\n\n this.findElementReferences(element).forEach(addReference);\n\n const triggerType = flowObj.Flow.start?.triggerType;\n if (typeof triggerType === 'string' && triggerType.startsWith('Record')) {\n addReference('$Record.Id');\n }\n\n this.toArray(flowObj.Flow.variables)\n .filter((variable: any) => variable.isInput === 'true')\n .forEach((variable: any) => addReference(this.getElementName(variable)));\n\n return references.slice(0, this.MAX_FAULT_LOG_REFERENCES);\n }\n\n // Helper to find all element references within an element that are used as inputs\n private static findElementReferences(node: any, references: string[] = []): string[] {\n if (Array.isArray(node)) {\n node.forEach((item) => this.findElementReferences(item, references));\n } else if (node && typeof node === 'object') {\n Object.entries(node as Record<string, unknown>).forEach(([key, value]) => {\n if (this.NON_INPUT_KEYS.has(key)) {\n return;\n }\n\n if (key === 'elementReference' && typeof value === 'string') {\n references.push(value);\n } else {\n this.findElementReferences(value, references);\n }\n });\n }\n\n return references;\n }\n\n // Helper to collect the names of flow resources that hold a single value and can be merged into a text\n private static collectScalarResourceNames(flowObj: any): Set<string> {\n const names = new Set<string>();\n const addName = (resource: any): void => {\n const name = this.getElementName(resource);\n if (name) {\n names.add(name);\n }\n };\n\n this.toArray(flowObj.Flow.variables)\n .filter((variable: any) => variable.isCollection !== 'true' && variable.dataType !== 'SObject' && variable.dataType !== 'Apex')\n .forEach((variable: any) => addName(variable));\n\n this.toArray(flowObj.Flow.formulas).forEach((formula: any) => addName(formula));\n\n const addScreenFields = (fields: any): void => {\n this.toArray(fields).forEach((field: any) => {\n if (this.SCALAR_SCREEN_FIELD_TYPES.has(String(field.fieldType))) {\n addName(field);\n }\n // Sections and columns contain nested fields\n addScreenFields(field.fields);\n });\n };\n this.toArray(flowObj.Flow.screens).forEach((screen: any) => addScreenFields(screen.fields));\n\n return names;\n }\n\n // Helper to set the fault connector of an element. The Metadata API expects the fault connector\n // at its alphabetical position among the element's type specific properties.\n private static setFaultConnector(element: any, faultConnector: any): void {\n if (element.faultConnector !== undefined) {\n element.faultConnector = faultConnector;\n return;\n }\n\n const entries = Object.entries(element as Record<string, unknown>);\n const insertIndex = entries.findIndex(([key]) => !this.BASE_ELEMENT_KEYS.has(key) && key > 'faultConnector');\n entries.splice(insertIndex === -1 ? entries.length : insertIndex, 0, ['faultConnector', faultConnector]);\n\n // Rebuild the element in place to preserve references held by the flow object\n Object.keys(element as Record<string, unknown>).forEach((key) => Reflect.deleteProperty(element as object, key));\n entries.forEach(([key, value]) => {\n element[key] = value;\n });\n }\n\n // Helper to read the name of a flow element, supporting the legacy 'n' property\n private static getElementName(element: any): string | undefined {\n const name: unknown = element?.name ?? element?.n;\n return typeof name === 'string' && name ? name : undefined;\n }\n\n // Helper to normalize a single parsed XML element or a list of elements to an array\n private static toArray(value: any): any[] {\n if (value === undefined || value === null) {\n return [];\n }\n return Array.isArray(value) ? value : [value];\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 const message = `Decision '${decisionLabelStr}' outcome: ${outcomeLabelStr}`;\n\n // Fallback if still too long\n return this.buildLoggerAction(\n name.length > 80 ? `RFLIBLogDec${loggerId}` : name,\n label,\n flowName,\n 'INFO',\n message\n );\n }\n\n // Helper to build an rflib_LoggerFlowAction action call element\n private static buildLoggerAction(\n name: string,\n label: string,\n context: string,\n logLevel: string,\n message: string,\n additionalParameters: any[] = []\n ): any {\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: context,\n },\n },\n {\n name: 'logLevel',\n value: {\n stringValue: logLevel,\n },\n },\n {\n name: 'message',\n value: {\n stringValue: message,\n },\n },\n ...additionalParameters,\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 // If still too long, use a simpler naming scheme (fallback)\n return this.buildLoggerAction(\n name.length > 80 ? `RFLIBLogger${loggerId}` : name,\n label,\n flowName,\n 'INFO',\n `Flow ${flowName} started`\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 flowObj.Flow.processMetadataValues = metadataValues;\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 'target-org': Flags.requiredOrg({\n summary: messages.getMessage('flags.target-org.summary'),\n description: messages.getMessage('flags.target-org.description'),\n char: 'o',\n required: true,\n }),\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 'skip-fault-paths': Flags.boolean({\n summary: messages.getMessage('flags.skip-fault-paths.summary'),\n description: messages.getMessage('flags.skip-fault-paths.description'),\n default: false,\n }),\n verbose: Flags.boolean({\n summary: messages.getMessage('flags.verbose.summary'),\n description: messages.getMessage('flags.verbose.description'),\n char: 'v',\n default: false,\n }),\n exclude: Flags.string({\n summary: messages.getMessage('flags.exclude.summary'),\n description: messages.getMessage('flags.exclude.description'),\n char: 'e',\n }),\n concurrency: Flags.integer({\n summary: messages.getMessage('flags.concurrency.summary'),\n description: messages.getMessage('flags.concurrency.description'),\n char: 'c',\n default: 10,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingFlowInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n modifiedFilePaths: [],\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 const skipFaultPaths =\n flags['skip-fault-paths'] || !(await this.isFaultPathLoggingSupported(flags['target-org'].getConnection(undefined)));\n const isVerbose = flags.verbose;\n const excludePattern = flags.exclude;\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 this.logger.debug(`Skip fault paths: ${skipFaultPaths}`);\n\n this.spinner.start('Running...');\n\n const files = await this.findAllFlowFiles(sourcePath, excludePattern);\n await processWithConcurrency(\n files,\n flags.concurrency,\n async (filePath) => {\n await this.instrumentFlowFile(filePath, { isDryRun, skipInstrumented, skipFaultPaths, isVerbose });\n }\n );\n\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 // Fault paths are only instrumented if the RFLIB package in the target org supports terminating the transaction\n private async isFaultPathLoggingSupported(conn: Connection): Promise<boolean> {\n const minVersion = `${FAULT_PATH_MIN_RFLIB_VERSION.major}.${FAULT_PATH_MIN_RFLIB_VERSION.minor}.${FAULT_PATH_MIN_RFLIB_VERSION.patch}`;\n const [rflib] = await getInstalledPackages(conn, [RFLIB_PACKAGE_NAME]);\n\n if (!rflib) {\n this.warn(messages.getMessage('warning.faultPaths.rflibNotInstalled', [minVersion]));\n return false;\n }\n\n const installedVersion = formatVersion(rflib.version);\n if (compareVersions(rflib.version, FAULT_PATH_MIN_RFLIB_VERSION) < 0) {\n this.warn(messages.getMessage('warning.faultPaths.rflibOutdated', [installedVersion, minVersion]));\n return false;\n }\n\n this.logger.debug(`RFLIB ${installedVersion} supports fault path logging`);\n return true;\n }\n\n private async findAllFlowFiles(dirPath: string, excludePattern?: string): Promise<string[]> {\n this.logger.debug(`Scanning directory: ${dirPath}`);\n const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n const results = await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (isExcluded(filePath, excludePattern)) {\n this.logger.debug(`Skipping excluded path: ${filePath}`);\n return [];\n }\n\n if (entry.isDirectory()) {\n return this.findAllFlowFiles(filePath, excludePattern);\n }\n\n if (entry.name.endsWith('.flow-meta.xml')) {\n return [filePath];\n }\n\n return [];\n })\n );\n\n return results.flat();\n }\n\n private async instrumentFlowFile(\n filePath: string,\n options: Readonly<{ isDryRun: boolean; skipInstrumented: boolean; skipFaultPaths: boolean; isVerbose: boolean }>\n ): Promise<void> {\n const { isDryRun, skipInstrumented, skipFaultPaths, isVerbose } = options;\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, skipFaultPaths);\n const newContent = FlowInstrumentationService.buildFlowContent(instrumentedFlow);\n\n if (content !== newContent) {\n this.stats.modifiedFiles++;\n this.stats.modifiedFilePaths?.push(filePath);\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 if (isVerbose) {\n this.log(`Would modify: ${filePath}`);\n }\n }\n }\n } catch (error) {\n this.logger.error(`Error processing flow ${flowName}`, error);\n throw error;\n }\n }\n}\n"]}
|
|
@@ -2,8 +2,8 @@ import * as fs from 'node:fs';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
4
4
|
import { Messages, Logger } from '@salesforce/core';
|
|
5
|
-
import { minimatch } from 'minimatch';
|
|
6
5
|
import { processWithConcurrency } from '../../../../shared/concurrency.js';
|
|
6
|
+
import { isExcluded } from '../../../../shared/exclude.js';
|
|
7
7
|
import { writeInstrumentedFile } from '../../../../shared/formatting.js';
|
|
8
8
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
9
9
|
const messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.lwc.instrument');
|
|
@@ -238,7 +238,7 @@ export default class RflibLoggingLwcInstrument extends SfCommand {
|
|
|
238
238
|
const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });
|
|
239
239
|
const results = await Promise.all(entries.map(async (entry) => {
|
|
240
240
|
const filePath = path.join(dirPath, entry.name);
|
|
241
|
-
if (
|
|
241
|
+
if (isExcluded(filePath, excludePattern)) {
|
|
242
242
|
this.logger.debug(`Skipping excluded path: ${filePath}`);
|
|
243
243
|
return [];
|
|
244
244
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/lwc/instrument.ts"],"names":[],"mappings":"AAAA,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;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AASzE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,cAAc,EAAE,8BAA8B,CAAC,CAAC;AAEvF,MAAM,yBAAyB;IACtB,MAAM,CAAU,eAAe,GAAqB;QACzD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CAAC;YAEpF,IAAI,OAAO,KAAK,eAAe,EAAE,CAAC;gBAChC,IAAI,qBAAqB,GAAG,yBAAyB,CAAC,eAAe,CAAC;gBACtE,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC7B,qBAAqB,GAAG,EAAE,GAAG,yBAAyB,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;gBAC/F,CAAC;gBAED,MAAM,qBAAqB,CACzB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EACtB,qBAAqB,CACtB,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["import * 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';\nimport { minimatch } from 'minimatch';\nimport { processWithConcurrency } from '../../../../shared/concurrency.js';\n\nimport { IfCondition, InstrumentationOptions, LoggerInfo } from '../../../../shared/types.js';\nimport { writeInstrumentedFile } from '../../../../shared/formatting.js';\n\nexport type RflibLoggingLwcInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n formattedFiles: number;\n modifiedFilePaths?: string[];\n}\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.lwc.instrument');\n\nclass LwcInstrumentationService {\n public static readonly PRETTIER_CONFIG: prettier.Options = {\n parser: 'babel',\n printWidth: 120,\n tabWidth: 4,\n useTabs: false,\n singleQuote: true,\n };\n\n private static readonly IMPORT_REGEX = /import\\s*{\\s*createLogger\\s*}\\s*from\\s*['\"]c\\/rflibLogger['\"]/;\n private static readonly LOGGER_REGEX = /const\\s+(\\w+)\\s*=\\s*createLogger\\s*\\(['\"]([\\w-]+)['\"]\\)/;\n private static readonly METHOD_REGEX =\n /(?:(?:public|private|protected)\\s+)?(?:async\\s+)?(?!(?:if|switch|case|while|for|catch)\\b)(?<!(?:const|let|var|function|export|extends|return|new|typeof|delete|await|throw|yield)\\s+)(?<![.(!+*\\x2F%=<>&|^?:-]\\s*)(\\b\\w+)\\s*(?:\\((.*?)\\)\\s*(?::\\s*[\\w<>[\\]]+\\s*)?{|=\\s*(?:async\\s+)?(?!\\(\\s*(?:async\\s+)?\\()(?:\\((.*?)\\)|(\\w+))\\s*(?::\\s*[\\w<>[\\]]+\\s*)?=>\\s*{)/g;\n private static readonly EXPORT_DEFAULT_REGEX = /export\\s+default\\s+class\\s+(\\w+)/;\n private static readonly IF_STATEMENT_REGEX =\n /if\\s*\\((.*?)\\)\\s*(?:{([^]*?(?:(?<!{){(?:[^]*?)}(?!})[^]*?)*)}|([^{].*?)(?=\\s*(?:;|$));)/g;\n private static readonly ELSE_REGEX =\n /}\\s*else(?!\\s+if\\b)\\s*(?:{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}|([^{].*?)(?=\\n|;|$))/g;\n private static readonly PROMISE_CHAIN_REGEX =\n /\\.(then|catch|finally)\\s*\\(\\s*(?:async\\s+)?(?:\\(?([^)]*)\\)?)?\\s*=>\\s*(?:\\{((?:[^{}]|`[^`]*`)*?)\\}|([^{;]*?(?:\\.[^{;]*?)*(?:\\([^)]*\\))?)(?=\\s*(?:\\)\\)|\\.|\\))))/g;\n private static readonly TRY_CATCH_BLOCK_REGEX = /try\\s*{[\\s\\S]*?}\\s*catch\\s*\\(([^)]*)\\)\\s*{/g;\n private static readonly CONSOLE_LOG_REGEX = /console\\.(log|debug|info|warn|error)\\s*\\(\\s*([^)]+)\\s*\\)\\s*;?/g;\n\n\n\n\n\n public static isInstrumented(content: string): boolean {\n return this.IMPORT_REGEX.test(content);\n }\n\n public static detectLogger(content: string): LoggerInfo {\n const match = content.match(this.LOGGER_REGEX);\n return {\n exists: match !== null,\n variableName: match ? match[1] : 'logger',\n };\n }\n\n public static addImportAndLogger(content: string, componentName: string): string {\n let modified = content;\n\n if (!this.IMPORT_REGEX.test(content)) {\n modified = `import { createLogger } from 'c/rflibLogger';\\n${modified}`;\n }\n\n const { exists, variableName } = this.detectLogger(content);\n if (!exists) {\n const exportMatch = content.match(this.EXPORT_DEFAULT_REGEX);\n const className = exportMatch ? exportMatch[1] : componentName;\n const loggerDeclaration = `\\nconst ${variableName} = createLogger('${className}');\\n`;\n modified = modified.replace(this.EXPORT_DEFAULT_REGEX, `${loggerDeclaration}$&`);\n }\n\n return modified;\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({ condition: cleanedUpCondition, position: offset });\n\n const logStatement = `${loggerName}.debug('if (${cleanedUpCondition})');\\n `;\n\n if (blockBody) {\n return `if (${condition}) {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n const cleanBody = singleLineBody.replace(/;$/, '').trim();\n return `if (${condition}) {\\n ${logStatement}${cleanBody};\\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 processMethodLogging(content: string, loggerName: string, options: InstrumentationOptions): string {\n let modified = content.replace(this.METHOD_REGEX, (match: string, methodName: string, namedArgs: string, arrowArgsParens: string, arrowArgNoParens: string) => {\n const rawArgs = namedArgs ?? arrowArgsParens ?? arrowArgNoParens ?? '';\n const parameters = rawArgs\n .split(',')\n .map((p) => p.split(':')[0].trim()) // Extract param name, ignore TS types\n .filter((p) => p);\n const placeholders = parameters.map((_, i) => `{${i}}`).join(', ');\n const logArgs = parameters.length > 0 ? `, ${parameters.join(', ')}` : '';\n\n return `${match}\\n ${loggerName}.info('${methodName}(${placeholders})'${logArgs});`;\n });\n\n if (!options.noIf) {\n modified = this.processIfStatements(modified, loggerName);\n }\n\n return modified;\n }\n\n public static processTryCatchBlocks(content: string, loggerName: string): string {\n return content.replace(this.TRY_CATCH_BLOCK_REGEX, (match: string, exceptionVar: string, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const errorVar = exceptionVar.split(':')[0].trim().split(' ')[0] || 'error';\n\n return match.replace(\n /catch\\s*\\(([^)]*)\\)\\s*{/,\n `catch(${exceptionVar}) {\n ${loggerName}.error('An error occurred in function ${methodName}()', ${errorVar});`,\n );\n });\n }\n\n public static processPromiseChains(content: string, loggerName: string): string {\n return content.replace(\n this.PROMISE_CHAIN_REGEX,\n (match, type, param, blockBody, singleLineBody, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const rawParamName = typeof param === 'string' ? param.split(':')[0].trim() : type === 'then' ? 'result' : 'error';\n const paramName = rawParamName.split(' ')[0]; // handle \"result: any\" separating by spaces too just in case\n const indentation = match.match(/\\n\\s*/)?.[0] ?? '\\n ';\n\n let logStatement: string;\n switch (type) {\n case 'then':\n logStatement = `${loggerName}.info('${methodName}() promise resolved. Result={0}', ${paramName});`;\n break;\n case 'catch':\n logStatement = `${loggerName}.error('An error occurred in function ${methodName}()', ${paramName});`;\n break;\n case 'finally':\n logStatement = `${loggerName}.info('${methodName}() promise chain completed');`;\n break;\n default:\n logStatement = '';\n }\n\n if (singleLineBody) {\n const trimmedBody = (singleLineBody as string).trim();\n const adjustedBody =\n trimmedBody.split(')').length > trimmedBody.split('(').length ? trimmedBody.slice(0, -1) : trimmedBody;\n\n return `.${type}((${paramName}) => {\n ${logStatement}\n return ${adjustedBody};\n }`;\n }\n\n if (blockBody) {\n return `.${type}((${paramName}) => {${indentation}${logStatement}${indentation}${blockBody}}`;\n }\n\n return match;\n },\n );\n }\n\n public static processConsoleStatements(methodBody: string, loggerName: string): string {\n return methodBody.replace(this.CONSOLE_LOG_REGEX, (match: string, logType: string, argument: string) => {\n const logLevel = logType === 'info' || logType === 'warn' || logType === 'error' ? logType : 'debug';\n return `${loggerName}.${logLevel}(${argument});`;\n });\n }\n\n private static findEnclosingMethod(content: string, position: number): string {\n const beforeCatch = content.substring(0, position);\n const methods = [...beforeCatch.matchAll(this.METHOD_REGEX)].reverse();\n const closestMethod = methods[0];\n return closestMethod ? closestMethod[1] : 'unknown';\n }\n}\n\nexport default class RflibLoggingLwcInstrument extends SfCommand<RflibLoggingLwcInstrumentResult> {\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 char: 's',\n required: true,\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n }),\n dryrun: Flags.boolean({\n char: 'd',\n default: false,\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n }),\n prettier: Flags.boolean({\n char: 'p',\n default: false,\n summary: messages.getMessage('flags.prettier.summary'),\n description: messages.getMessage('flags.prettier.description'),\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 verbose: Flags.boolean({\n summary: messages.getMessage('flags.verbose.summary'),\n description: messages.getMessage('flags.verbose.description'),\n char: 'v',\n default: false,\n }),\n exclude: Flags.string({\n summary: messages.getMessage('flags.exclude.summary'),\n description: messages.getMessage('flags.exclude.description'),\n char: 'e',\n }),\n concurrency: Flags.integer({\n summary: messages.getMessage('flags.concurrency.summary'),\n description: messages.getMessage('flags.concurrency.description'),\n char: 'c',\n default: 10,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingLwcInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n formattedFiles: 0,\n modifiedFilePaths: [],\n };\n\n public async run(): Promise<RflibLoggingLwcInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const { flags } = await this.parse(RflibLoggingLwcInstrument);\n\n const instrumentationOpts: InstrumentationOptions = {\n prettier: flags.prettier,\n noIf: flags['no-if'],\n noCatch: false,\n skipInstrumented: flags['skip-instrumented'],\n verbose: flags.verbose,\n exclude: flags.exclude,\n };\n\n this.log(`Scanning LWC components in ${flags.sourcepath}...`);\n\n this.spinner.start('Running...');\n\n const files = await this.findAllLwcFiles(flags.sourcepath, instrumentationOpts.exclude);\n await processWithConcurrency(\n files,\n flags.concurrency,\n async (filePath) => {\n await this.instrumentLwcFile(filePath, flags.dryrun, instrumentationOpts);\n }\n );\n\n this.spinner.stop();\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 findAllLwcFiles(dirPath: string, excludePattern?: string): Promise<string[]> {\n this.logger.debug(`Scanning directory: ${dirPath}`);\n const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n const results = await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (excludePattern && minimatch(filePath, excludePattern, { matchBase: true })) {\n this.logger.debug(`Skipping excluded path: ${filePath}`);\n return [];\n }\n\n if (entry.isDirectory()) {\n return this.findAllLwcFiles(filePath, excludePattern);\n }\n\n const parentDir = path.dirname(filePath);\n if (\n (entry.name.endsWith('.js') || entry.name.endsWith('.ts')) &&\n !parentDir.includes('aura') &&\n !parentDir.includes('__tests__')\n ) {\n return [filePath];\n }\n\n return [];\n })\n );\n\n return results.flat();\n }\n\n private async instrumentLwcFile(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n const componentName = path.basename(path.dirname(filePath));\n this.logger.debug(`Processing LWC: ${componentName}`);\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 && LwcInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented component: ${componentName}`);\n return;\n }\n\n const { variableName } = LwcInstrumentationService.detectLogger(content);\n content = LwcInstrumentationService.addImportAndLogger(content, componentName);\n content = LwcInstrumentationService.processMethodLogging(content, variableName, instrumentationOpts);\n content = LwcInstrumentationService.processTryCatchBlocks(content, variableName);\n content = LwcInstrumentationService.processPromiseChains(content, variableName);\n content = LwcInstrumentationService.processConsoleStatements(content, variableName);\n\n if (content !== originalContent) {\n let currentPrettierConfig = LwcInstrumentationService.PRETTIER_CONFIG;\n if (filePath.endsWith('.ts')) {\n currentPrettierConfig = { ...LwcInstrumentationService.PRETTIER_CONFIG, parser: 'babel-ts' };\n }\n\n await writeInstrumentedFile(\n filePath,\n content,\n originalContent,\n instrumentationOpts,\n isDryRun,\n this.stats,\n this.logger,\n (msg) => this.log(msg),\n currentPrettierConfig,\n );\n }\n } catch (error) {\n this.logger.error(`Error processing LWC ${componentName}`, error);\n throw error;\n }\n }\n}\n"]}
|
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B,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["import * 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';\nimport { processWithConcurrency } from '../../../../shared/concurrency.js';\nimport { isExcluded } from '../../../../shared/exclude.js';\n\nimport { IfCondition, InstrumentationOptions, LoggerInfo } from '../../../../shared/types.js';\nimport { writeInstrumentedFile } from '../../../../shared/formatting.js';\n\nexport type RflibLoggingLwcInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n formattedFiles: number;\n modifiedFilePaths?: string[];\n}\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.lwc.instrument');\n\nclass LwcInstrumentationService {\n public static readonly PRETTIER_CONFIG: prettier.Options = {\n parser: 'babel',\n printWidth: 120,\n tabWidth: 4,\n useTabs: false,\n singleQuote: true,\n };\n\n private static readonly IMPORT_REGEX = /import\\s*{\\s*createLogger\\s*}\\s*from\\s*['\"]c\\/rflibLogger['\"]/;\n private static readonly LOGGER_REGEX = /const\\s+(\\w+)\\s*=\\s*createLogger\\s*\\(['\"]([\\w-]+)['\"]\\)/;\n private static readonly METHOD_REGEX =\n /(?:(?:public|private|protected)\\s+)?(?:async\\s+)?(?!(?:if|switch|case|while|for|catch)\\b)(?<!(?:const|let|var|function|export|extends|return|new|typeof|delete|await|throw|yield)\\s+)(?<![.(!+*\\x2F%=<>&|^?:-]\\s*)(\\b\\w+)\\s*(?:\\((.*?)\\)\\s*(?::\\s*[\\w<>[\\]]+\\s*)?{|=\\s*(?:async\\s+)?(?!\\(\\s*(?:async\\s+)?\\()(?:\\((.*?)\\)|(\\w+))\\s*(?::\\s*[\\w<>[\\]]+\\s*)?=>\\s*{)/g;\n private static readonly EXPORT_DEFAULT_REGEX = /export\\s+default\\s+class\\s+(\\w+)/;\n private static readonly IF_STATEMENT_REGEX =\n /if\\s*\\((.*?)\\)\\s*(?:{([^]*?(?:(?<!{){(?:[^]*?)}(?!})[^]*?)*)}|([^{].*?)(?=\\s*(?:;|$));)/g;\n private static readonly ELSE_REGEX =\n /}\\s*else(?!\\s+if\\b)\\s*(?:{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}|([^{].*?)(?=\\n|;|$))/g;\n private static readonly PROMISE_CHAIN_REGEX =\n /\\.(then|catch|finally)\\s*\\(\\s*(?:async\\s+)?(?:\\(?([^)]*)\\)?)?\\s*=>\\s*(?:\\{((?:[^{}]|`[^`]*`)*?)\\}|([^{;]*?(?:\\.[^{;]*?)*(?:\\([^)]*\\))?)(?=\\s*(?:\\)\\)|\\.|\\))))/g;\n private static readonly TRY_CATCH_BLOCK_REGEX = /try\\s*{[\\s\\S]*?}\\s*catch\\s*\\(([^)]*)\\)\\s*{/g;\n private static readonly CONSOLE_LOG_REGEX = /console\\.(log|debug|info|warn|error)\\s*\\(\\s*([^)]+)\\s*\\)\\s*;?/g;\n\n\n\n\n\n public static isInstrumented(content: string): boolean {\n return this.IMPORT_REGEX.test(content);\n }\n\n public static detectLogger(content: string): LoggerInfo {\n const match = content.match(this.LOGGER_REGEX);\n return {\n exists: match !== null,\n variableName: match ? match[1] : 'logger',\n };\n }\n\n public static addImportAndLogger(content: string, componentName: string): string {\n let modified = content;\n\n if (!this.IMPORT_REGEX.test(content)) {\n modified = `import { createLogger } from 'c/rflibLogger';\\n${modified}`;\n }\n\n const { exists, variableName } = this.detectLogger(content);\n if (!exists) {\n const exportMatch = content.match(this.EXPORT_DEFAULT_REGEX);\n const className = exportMatch ? exportMatch[1] : componentName;\n const loggerDeclaration = `\\nconst ${variableName} = createLogger('${className}');\\n`;\n modified = modified.replace(this.EXPORT_DEFAULT_REGEX, `${loggerDeclaration}$&`);\n }\n\n return modified;\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({ condition: cleanedUpCondition, position: offset });\n\n const logStatement = `${loggerName}.debug('if (${cleanedUpCondition})');\\n `;\n\n if (blockBody) {\n return `if (${condition}) {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n const cleanBody = singleLineBody.replace(/;$/, '').trim();\n return `if (${condition}) {\\n ${logStatement}${cleanBody};\\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 processMethodLogging(content: string, loggerName: string, options: InstrumentationOptions): string {\n let modified = content.replace(this.METHOD_REGEX, (match: string, methodName: string, namedArgs: string, arrowArgsParens: string, arrowArgNoParens: string) => {\n const rawArgs = namedArgs ?? arrowArgsParens ?? arrowArgNoParens ?? '';\n const parameters = rawArgs\n .split(',')\n .map((p) => p.split(':')[0].trim()) // Extract param name, ignore TS types\n .filter((p) => p);\n const placeholders = parameters.map((_, i) => `{${i}}`).join(', ');\n const logArgs = parameters.length > 0 ? `, ${parameters.join(', ')}` : '';\n\n return `${match}\\n ${loggerName}.info('${methodName}(${placeholders})'${logArgs});`;\n });\n\n if (!options.noIf) {\n modified = this.processIfStatements(modified, loggerName);\n }\n\n return modified;\n }\n\n public static processTryCatchBlocks(content: string, loggerName: string): string {\n return content.replace(this.TRY_CATCH_BLOCK_REGEX, (match: string, exceptionVar: string, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const errorVar = exceptionVar.split(':')[0].trim().split(' ')[0] || 'error';\n\n return match.replace(\n /catch\\s*\\(([^)]*)\\)\\s*{/,\n `catch(${exceptionVar}) {\n ${loggerName}.error('An error occurred in function ${methodName}()', ${errorVar});`,\n );\n });\n }\n\n public static processPromiseChains(content: string, loggerName: string): string {\n return content.replace(\n this.PROMISE_CHAIN_REGEX,\n (match, type, param, blockBody, singleLineBody, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const rawParamName = typeof param === 'string' ? param.split(':')[0].trim() : type === 'then' ? 'result' : 'error';\n const paramName = rawParamName.split(' ')[0]; // handle \"result: any\" separating by spaces too just in case\n const indentation = match.match(/\\n\\s*/)?.[0] ?? '\\n ';\n\n let logStatement: string;\n switch (type) {\n case 'then':\n logStatement = `${loggerName}.info('${methodName}() promise resolved. Result={0}', ${paramName});`;\n break;\n case 'catch':\n logStatement = `${loggerName}.error('An error occurred in function ${methodName}()', ${paramName});`;\n break;\n case 'finally':\n logStatement = `${loggerName}.info('${methodName}() promise chain completed');`;\n break;\n default:\n logStatement = '';\n }\n\n if (singleLineBody) {\n const trimmedBody = (singleLineBody as string).trim();\n const adjustedBody =\n trimmedBody.split(')').length > trimmedBody.split('(').length ? trimmedBody.slice(0, -1) : trimmedBody;\n\n return `.${type}((${paramName}) => {\n ${logStatement}\n return ${adjustedBody};\n }`;\n }\n\n if (blockBody) {\n return `.${type}((${paramName}) => {${indentation}${logStatement}${indentation}${blockBody}}`;\n }\n\n return match;\n },\n );\n }\n\n public static processConsoleStatements(methodBody: string, loggerName: string): string {\n return methodBody.replace(this.CONSOLE_LOG_REGEX, (match: string, logType: string, argument: string) => {\n const logLevel = logType === 'info' || logType === 'warn' || logType === 'error' ? logType : 'debug';\n return `${loggerName}.${logLevel}(${argument});`;\n });\n }\n\n private static findEnclosingMethod(content: string, position: number): string {\n const beforeCatch = content.substring(0, position);\n const methods = [...beforeCatch.matchAll(this.METHOD_REGEX)].reverse();\n const closestMethod = methods[0];\n return closestMethod ? closestMethod[1] : 'unknown';\n }\n}\n\nexport default class RflibLoggingLwcInstrument extends SfCommand<RflibLoggingLwcInstrumentResult> {\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 char: 's',\n required: true,\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n }),\n dryrun: Flags.boolean({\n char: 'd',\n default: false,\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n }),\n prettier: Flags.boolean({\n char: 'p',\n default: false,\n summary: messages.getMessage('flags.prettier.summary'),\n description: messages.getMessage('flags.prettier.description'),\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 verbose: Flags.boolean({\n summary: messages.getMessage('flags.verbose.summary'),\n description: messages.getMessage('flags.verbose.description'),\n char: 'v',\n default: false,\n }),\n exclude: Flags.string({\n summary: messages.getMessage('flags.exclude.summary'),\n description: messages.getMessage('flags.exclude.description'),\n char: 'e',\n }),\n concurrency: Flags.integer({\n summary: messages.getMessage('flags.concurrency.summary'),\n description: messages.getMessage('flags.concurrency.description'),\n char: 'c',\n default: 10,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingLwcInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n formattedFiles: 0,\n modifiedFilePaths: [],\n };\n\n public async run(): Promise<RflibLoggingLwcInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const { flags } = await this.parse(RflibLoggingLwcInstrument);\n\n const instrumentationOpts: InstrumentationOptions = {\n prettier: flags.prettier,\n noIf: flags['no-if'],\n noCatch: false,\n skipInstrumented: flags['skip-instrumented'],\n verbose: flags.verbose,\n exclude: flags.exclude,\n };\n\n this.log(`Scanning LWC components in ${flags.sourcepath}...`);\n\n this.spinner.start('Running...');\n\n const files = await this.findAllLwcFiles(flags.sourcepath, instrumentationOpts.exclude);\n await processWithConcurrency(\n files,\n flags.concurrency,\n async (filePath) => {\n await this.instrumentLwcFile(filePath, flags.dryrun, instrumentationOpts);\n }\n );\n\n this.spinner.stop();\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 findAllLwcFiles(dirPath: string, excludePattern?: string): Promise<string[]> {\n this.logger.debug(`Scanning directory: ${dirPath}`);\n const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n const results = await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (isExcluded(filePath, excludePattern)) {\n this.logger.debug(`Skipping excluded path: ${filePath}`);\n return [];\n }\n\n if (entry.isDirectory()) {\n return this.findAllLwcFiles(filePath, excludePattern);\n }\n\n const parentDir = path.dirname(filePath);\n if (\n (entry.name.endsWith('.js') || entry.name.endsWith('.ts')) &&\n !parentDir.includes('aura') &&\n !parentDir.includes('__tests__')\n ) {\n return [filePath];\n }\n\n return [];\n })\n );\n\n return results.flat();\n }\n\n private async instrumentLwcFile(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n const componentName = path.basename(path.dirname(filePath));\n this.logger.debug(`Processing LWC: ${componentName}`);\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 && LwcInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented component: ${componentName}`);\n return;\n }\n\n const { variableName } = LwcInstrumentationService.detectLogger(content);\n content = LwcInstrumentationService.addImportAndLogger(content, componentName);\n content = LwcInstrumentationService.processMethodLogging(content, variableName, instrumentationOpts);\n content = LwcInstrumentationService.processTryCatchBlocks(content, variableName);\n content = LwcInstrumentationService.processPromiseChains(content, variableName);\n content = LwcInstrumentationService.processConsoleStatements(content, variableName);\n\n if (content !== originalContent) {\n let currentPrettierConfig = LwcInstrumentationService.PRETTIER_CONFIG;\n if (filePath.endsWith('.ts')) {\n currentPrettierConfig = { ...LwcInstrumentationService.PRETTIER_CONFIG, parser: 'babel-ts' };\n }\n\n await writeInstrumentedFile(\n filePath,\n content,\n originalContent,\n instrumentationOpts,\n isDryRun,\n this.stats,\n this.logger,\n (msg) => this.log(msg),\n currentPrettierConfig,\n );\n }\n } catch (error) {\n this.logger.error(`Error processing LWC ${componentName}`, error);\n throw error;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the given file system path matches the --exclude glob pattern.
|
|
3
|
+
*
|
|
4
|
+
* The path is normalized to forward slashes so patterns behave the same on Windows,
|
|
5
|
+
* and `dot: true` lets `**` and `*` cross dot-prefixed directories, so a project
|
|
6
|
+
* located under e.g. `~/.config/` or `.claude/worktrees/` is still matched.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isExcluded(filePath: string, excludePattern?: string): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import { minimatch } from 'minimatch';
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if the given file system path matches the --exclude glob pattern.
|
|
5
|
+
*
|
|
6
|
+
* The path is normalized to forward slashes so patterns behave the same on Windows,
|
|
7
|
+
* and `dot: true` lets `**` and `*` cross dot-prefixed directories, so a project
|
|
8
|
+
* located under e.g. `~/.config/` or `.claude/worktrees/` is still matched.
|
|
9
|
+
*/
|
|
10
|
+
export function isExcluded(filePath, excludePattern) {
|
|
11
|
+
if (!excludePattern) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const normalizedPath = filePath.split(path.sep).join('/');
|
|
15
|
+
return minimatch(normalizedPath, excludePattern, { matchBase: true, dot: true });
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=exclude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../src/shared/exclude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB,EAAE,cAAuB;IAClE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,cAAc,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1D,OAAO,SAAS,CAAC,cAAc,EAAE,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { minimatch } from 'minimatch';\n\n/**\n * Returns true if the given file system path matches the --exclude glob pattern.\n *\n * The path is normalized to forward slashes so patterns behave the same on Windows,\n * and `dot: true` lets `**` and `*` cross dot-prefixed directories, so a project\n * located under e.g. `~/.config/` or `.claude/worktrees/` is still matched.\n */\nexport function isExcluded(filePath: string, excludePattern?: string): boolean {\n if (!excludePattern) {\n return false;\n }\n const normalizedPath = filePath.split(path.sep).join('/');\n return minimatch(normalizedPath, excludePattern, { matchBase: true, dot: true });\n}\n"]}
|
|
@@ -4,7 +4,15 @@ Adds RFLIB logging statements to Salesforce Flows.
|
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Automatically adds RFLIB logging statements to Salesforce Flows to provide enhanced tracking and debugging capabilities. Works with both standard Flows and Auto-Launched Flows. Instruments flow invocations and decision paths with logging actions. Also sets the CanvasMode to AUTO_LAYOUT_CANVAS for better flow visualization while preserving the original processType.
|
|
7
|
+
Automatically adds RFLIB logging statements to Salesforce Flows to provide enhanced tracking and debugging capabilities. Works with both standard Flows and Auto-Launched Flows. Instruments flow invocations and decision paths with logging actions, and logs an error on the fault path of every element that can fail. Existing fault paths continue after the error is logged. Elements without a fault path get one that logs the error and then terminates the transaction, so the Flow still fails as before; this requires the Terminate Transaction option of the RFLIB Log Message action, which was added in RFLIB 11.4.0. The command checks the RFLIB version installed in the target org and skips the fault paths if the org runs an older version or RFLIB is not installed as a package. Also sets the CanvasMode to AUTO_LAYOUT_CANVAS for better flow visualization while preserving the original processType.
|
|
8
|
+
|
|
9
|
+
# flags.target-org.summary
|
|
10
|
+
|
|
11
|
+
Username or alias of the target org.
|
|
12
|
+
|
|
13
|
+
# flags.target-org.description
|
|
14
|
+
|
|
15
|
+
The Salesforce org the instrumented Flows will be deployed to. The fault paths this command creates use the Terminate Transaction option of the RFLIB Log Message action, which was added in RFLIB 11.4.0, so Flows that use it fail to deploy to an org running an older RFLIB version. Before changing any files, the command runs a single read-only Tooling API query for the packages installed in this org. If RFLIB 11.4.0 or later is installed, fault paths are instrumented; if an older version is installed, or RFLIB is not installed as a package, they are skipped with a warning. Nothing in the org is changed. The flag is required even with --skip-fault-paths, although the org is not queried in that case.
|
|
8
16
|
|
|
9
17
|
# flags.sourcepath.summary
|
|
10
18
|
|
|
@@ -38,6 +46,14 @@ Skips any files where a logger is already present.
|
|
|
38
46
|
|
|
39
47
|
When provided, the command will not add log statements to any Flows that already contain RFLIB logging actions.
|
|
40
48
|
|
|
49
|
+
# flags.skip-fault-paths.summary
|
|
50
|
+
|
|
51
|
+
Skips logging errors on fault paths.
|
|
52
|
+
|
|
53
|
+
# flags.skip-fault-paths.description
|
|
54
|
+
|
|
55
|
+
When provided, the command will not add error logging to fault paths and will not create fault paths for elements that have none, regardless of the RFLIB version installed in the target org.
|
|
56
|
+
|
|
41
57
|
# flags.verbose.summary
|
|
42
58
|
|
|
43
59
|
Enable verbose output.
|
|
@@ -62,9 +78,18 @@ Limits the number of files processed concurrently.
|
|
|
62
78
|
|
|
63
79
|
Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.
|
|
64
80
|
|
|
81
|
+
# warning.faultPaths.rflibNotInstalled
|
|
82
|
+
|
|
83
|
+
Skipping fault path instrumentation because RFLIB is not installed as a package in the target org. Fault path logging requires RFLIB %s or later.
|
|
84
|
+
|
|
85
|
+
# warning.faultPaths.rflibOutdated
|
|
86
|
+
|
|
87
|
+
Skipping fault path instrumentation because the target org runs RFLIB %s. Fault path logging requires RFLIB %s or later; run "sf rflib packages upgrade" to upgrade the org.
|
|
88
|
+
|
|
65
89
|
# examples
|
|
66
90
|
|
|
67
|
-
- <%= config.bin %> <%= command.id %> --sourcepath force-app
|
|
68
|
-
- <%= config.bin %> <%= command.id %> --sourcepath force-app --dryrun
|
|
69
|
-
- <%= config.bin %> <%= command.id %> --sourcepath force-app --skip-instrumented
|
|
91
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app
|
|
92
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --dryrun
|
|
93
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-instrumented
|
|
94
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-fault-paths
|
|
70
95
|
|