snow-flow 1.3.30 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CLAUDE.md +12 -0
  2. package/README.md +153 -456
  3. package/dist/agents/base-agent.js +6 -7
  4. package/dist/agents/index.js +3 -4
  5. package/dist/agents/queen-agent.js +21 -7
  6. package/dist/api/natural-language-mapper.js +24 -21
  7. package/dist/cli/snow-flow-cli-integration.js +2 -1
  8. package/dist/cli.js +28 -1017
  9. package/dist/compliance/advanced-compliance-system.js +1 -1
  10. package/dist/documentation/self-documenting-system.js +10 -41
  11. package/dist/intelligence/auto-resolution-engine.js +1 -1
  12. package/dist/mcp/base-mcp-server.js +2 -2
  13. package/dist/mcp/http-transport-wrapper.js +2 -2
  14. package/dist/mcp/servicenow-deployment-mcp-refactored.js +1 -1
  15. package/dist/mcp/servicenow-deployment-mcp.js +16 -3
  16. package/dist/mcp/servicenow-flow-composer-mcp.js +20 -0
  17. package/dist/mcp/servicenow-intelligent-mcp-refactored.js +5 -5
  18. package/dist/mcp/servicenow-intelligent-mcp.js +11 -3
  19. package/dist/mcp/servicenow-operations-mcp-refactored.js +2 -2
  20. package/dist/mcp/servicenow-reporting-analytics-mcp-refactored.js +3 -1
  21. package/dist/mcp/servicenow-xml-flow-mcp.js +16 -9
  22. package/dist/mcp/shared/base-mcp-server.js +2 -2
  23. package/dist/memory/hierarchical-memory-system.js +0 -2
  24. package/dist/memory/memory-system.js +18 -81
  25. package/dist/memory/snow-flow-memory-patterns.js +41 -41
  26. package/dist/monitoring/enhanced-monitoring-system.js +6 -6
  27. package/dist/optimization/index.js +5 -3
  28. package/dist/orchestrator/flow-composer.js +101 -8
  29. package/dist/queen/agent-factory.js +8 -1
  30. package/dist/queen/mcp-execution-bridge.js +7 -0
  31. package/dist/queen/queen-memory-system.js +27 -1
  32. package/dist/queen/servicenow-queen.js +25 -17
  33. package/dist/snow-flow-system.js +36 -37
  34. package/dist/testing/integration-test-suite.js +31 -30
  35. package/dist/utils/complete-flow-xml-generator.js +52 -52
  36. package/dist/utils/servicenow-client.js +15 -8
  37. package/dist/utils/snow-oauth.js +17 -2
  38. package/dist/version.js +19 -1
  39. package/package.json +1 -1
  40. package/flow-update-sets/flow_build_automated_approval_flow_with_notifications_flow.xml +0 -203
  41. package/flow-update-sets/flow_create_approval_flow_for_equipment_requests_flow.xml +0 -206
  42. package/flow-update-sets/flow_create_equipment_approval_flow_with_manager_approv_flow.xml +0 -254
  43. package/flow-update-sets/iphone_15_pro_approval_flow.xml +0 -203
  44. package/flow-update-sets/test_iphone_approval_flow_flow.xml +0 -303
@@ -69,8 +69,8 @@ class SnowFlowSystem extends events_1.EventEmitter {
69
69
  const dbPath = path_1.default.join(os_1.default.homedir(), '.snow-flow', 'memory', 'snow-flow.db');
70
70
  this.memory = new memory_system_1.MemorySystem({
71
71
  dbPath,
72
- schema: this.config.memory.schema,
73
- ttl: this.config.memory.ttl
72
+ schema: { version: '1.0.0', autoMigrate: true, ...(this.config.memory.schema || {}) },
73
+ ttl: { default: 86400000, session: 3600000, artifact: 86400000, metric: 3600000, ...(this.config.memory.ttl || {}) }
74
74
  });
75
75
  await this.memory.initialize();
76
76
  this.emit('memory:initialized');
@@ -80,7 +80,7 @@ class SnowFlowSystem extends events_1.EventEmitter {
80
80
  */
81
81
  async initializeMCPServers() {
82
82
  this.logger.info('Initializing MCP Servers...');
83
- this.mcpManager = new mcp_server_manager_1.MCPServerManager(this.config.mcp);
83
+ this.mcpManager = new mcp_server_manager_1.MCPServerManager(JSON.stringify(this.config.mcp));
84
84
  // Start all required MCP servers
85
85
  const servers = [
86
86
  'servicenow-deployment',
@@ -116,21 +116,14 @@ class SnowFlowSystem extends events_1.EventEmitter {
116
116
  throw new Error('Memory and MCP must be initialized before Queen');
117
117
  }
118
118
  this.queen = new servicenow_queen_1.ServiceNowQueen({
119
- memory: this.memory,
120
- mcpManager: this.mcpManager,
121
- config: this.config.agents.queen
122
- });
123
- await this.queen.initialize();
124
- // Set up Queen event handlers
125
- this.queen.on('agent:spawned', (agent) => {
126
- this.emit('agent:spawned', agent);
127
- });
128
- this.queen.on('agent:completed', (agent) => {
129
- this.emit('agent:completed', agent);
130
- });
131
- this.queen.on('swarm:progress', (progress) => {
132
- this.emit('swarm:progress', progress);
119
+ memoryPath: this.config.memory?.dbPath,
120
+ maxConcurrentAgents: this.config.agents?.queen?.maxConcurrentAgents || 5,
121
+ learningRate: this.config.agents?.queen?.learningRate || 0.1,
122
+ debugMode: this.config.debugMode || false,
123
+ autoPermissions: this.config.agents?.queen?.autoPermissions || false
133
124
  });
125
+ // ServiceNowQueen is ready to use after construction
126
+ // No initialize method or event handlers available
134
127
  this.emit('queen:initialized');
135
128
  }
136
129
  /**
@@ -143,7 +136,7 @@ class SnowFlowSystem extends events_1.EventEmitter {
143
136
  }
144
137
  this.performanceTracker = new performance_tracker_1.PerformanceTracker({
145
138
  memory: this.memory,
146
- config: this.config.monitoring.performance
139
+ config: { sampleRate: 100, metricsRetention: 86400000, aggregationInterval: 60000, ...(this.config.monitoring.performance || {}) }
147
140
  });
148
141
  await this.performanceTracker.initialize();
149
142
  // Set up performance monitoring
@@ -163,7 +156,10 @@ class SnowFlowSystem extends events_1.EventEmitter {
163
156
  this.systemHealth = new system_health_1.SystemHealth({
164
157
  memory: this.memory,
165
158
  mcpManager: this.mcpManager,
166
- config: this.config.health
159
+ config: {
160
+ checks: { memory: true, mcp: true, servicenow: true, queen: true },
161
+ thresholds: { memoryUsage: 85, responseTime: 5000, queueSize: 100, cpuUsage: 80, errorRate: 5 }
162
+ }
167
163
  });
168
164
  await this.systemHealth.initialize();
169
165
  // Set up health monitoring
@@ -200,18 +196,22 @@ class SnowFlowSystem extends events_1.EventEmitter {
200
196
  sessionId,
201
197
  objective
202
198
  });
203
- // Queen analyzes objective and spawns agents
204
- const analysis = await this.queen.analyzeObjective(objective, {
205
- sessionId,
206
- ...options
207
- });
199
+ // Execute objective using Queen's main method
200
+ const queenResult = await this.queen.executeObjective(objective);
201
+ const analysis = {
202
+ complexity: 0.5,
203
+ type: 'unknown',
204
+ estimatedDuration: 30000,
205
+ queenId: 'main-queen',
206
+ estimatedTasks: 1
207
+ };
208
208
  session.queenAgentId = analysis.queenId;
209
209
  session.totalTasks = analysis.estimatedTasks;
210
210
  session.status = 'active';
211
211
  // Execute swarm with Queen coordination (MCP-FIRST workflow)
212
212
  console.log(`🚨 SWARM EXECUTING WITH MCP-FIRST WORKFLOW`);
213
213
  console.log(`🎯 Objective: ${objective}`);
214
- const result = await this.queen.executeObjective(objective);
214
+ const executionResult = await this.queen.executeObjective(objective);
215
215
  // Update session with swarm-specific progress tracking
216
216
  session.completedTasks = 1; // Queen completed the objective
217
217
  session.status = 'completed';
@@ -227,20 +227,13 @@ class SnowFlowSystem extends events_1.EventEmitter {
227
227
  });
228
228
  session.status = 'completed';
229
229
  await this.performanceTracker?.endOperation('swarm_execution', {
230
- sessionId,
231
230
  success: true
232
231
  });
233
232
  return {
234
233
  sessionId,
235
234
  success: true,
236
- artifacts: result.artifacts || [],
237
- summary: result.deploymentResult || result,
238
- mcpWorkflow: {
239
- authCheck: '✅ Validated by Queen Agent',
240
- discovery: '✅ Smart discovery completed',
241
- deployment: '✅ Real ServiceNow deployment',
242
- tracking: '✅ Update Set managed'
243
- },
235
+ artifacts: queenResult.artifacts || [],
236
+ summary: queenResult.deploymentResult || queenResult,
244
237
  metrics: await this.performanceTracker?.getSessionMetrics(sessionId) || {}
245
238
  };
246
239
  }
@@ -248,7 +241,6 @@ class SnowFlowSystem extends events_1.EventEmitter {
248
241
  session.status = 'failed';
249
242
  session.errors.push(error);
250
243
  await this.performanceTracker?.endOperation('swarm_execution', {
251
- sessionId,
252
244
  success: false,
253
245
  error: error.message
254
246
  });
@@ -307,7 +299,13 @@ class SnowFlowSystem extends events_1.EventEmitter {
307
299
  await this.systemHealth?.stopMonitoring();
308
300
  await this.performanceTracker?.shutdown();
309
301
  await this.queen?.shutdown();
310
- await this.mcpManager?.shutdownAll();
302
+ // Use available shutdown method
303
+ if (this.mcpManager && typeof this.mcpManager.shutdownAll === 'function') {
304
+ await this.mcpManager.shutdownAll();
305
+ }
306
+ else if (this.mcpManager && typeof this.mcpManager.shutdown === 'function') {
307
+ await this.mcpManager.shutdown();
308
+ }
311
309
  await this.memory?.close();
312
310
  this.initialized = false;
313
311
  this.emit('system:shutdown');
@@ -372,7 +370,8 @@ class SnowFlowSystem extends events_1.EventEmitter {
372
370
  // Notify all active agents to wrap up
373
371
  for (const agent of session.activeAgents.values()) {
374
372
  if (agent.status === 'active') {
375
- await this.queen?.requestAgentShutdown(agent.id, sessionId);
373
+ // Use available shutdown method
374
+ // await this.queen?.shutdown(); // No per-agent shutdown available
376
375
  }
377
376
  }
378
377
  // Wait for agents to complete (max 30 seconds)
@@ -11,24 +11,26 @@ exports.IntegrationTestSuite = void 0;
11
11
  const logger_js_1 = require("../utils/logger.js");
12
12
  const servicenow_client_js_1 = require("../utils/servicenow-client.js");
13
13
  const memory_system_js_1 = require("../memory/memory-system.js");
14
- const flow_template_system_js_1 = require("../templates/flow-template-system.js");
15
- const flow_update_orchestrator_js_1 = require("../orchestration/flow-update-orchestrator.js");
16
- const flow_testing_automation_js_1 = require("./flow-testing-automation.js");
17
- const smart_rollback_system_js_1 = require("../rollback/smart-rollback-system.js");
18
- const flow_performance_optimizer_js_1 = require("../optimization/flow-performance-optimizer.js");
19
14
  class IntegrationTestSuite {
20
15
  constructor() {
16
+ // Flow-related systems removed in v1.4.0
17
+ // private templateSystem: FlowTemplateSystem;
18
+ // private updateOrchestrator: FlowUpdateOrchestrator;
19
+ // private testingAutomation: FlowTestingAutomation;
20
+ // private rollbackSystem: SmartRollbackSystem;
21
+ // private performanceOptimizer: FlowPerformanceOptimizer;
21
22
  this.testSuites = new Map();
22
23
  this.executions = new Map();
23
24
  this.mockServices = new Map();
24
25
  this.logger = new logger_js_1.Logger('IntegrationTestSuite');
25
26
  this.client = new servicenow_client_js_1.ServiceNowClient();
26
- this.memory = new memory_system_js_1.MemorySystem();
27
- this.templateSystem = new flow_template_system_js_1.FlowTemplateSystem(this.client);
28
- this.updateOrchestrator = new flow_update_orchestrator_js_1.FlowUpdateOrchestrator(this.client, this.memory);
29
- this.testingAutomation = new flow_testing_automation_js_1.FlowTestingAutomation(this.client, this.memory);
30
- this.rollbackSystem = new smart_rollback_system_js_1.SmartRollbackSystem(this.client, this.memory);
31
- this.performanceOptimizer = new flow_performance_optimizer_js_1.FlowPerformanceOptimizer(this.client, this.memory);
27
+ this.memory = new memory_system_js_1.MemorySystem({ dbPath: ':memory:' });
28
+ // Flow-related system initialization removed in v1.4.0
29
+ // this.templateSystem = new FlowTemplateSystem(this.client);
30
+ // this.updateOrchestrator = new FlowUpdateOrchestrator(this.client, this.memory);
31
+ // this.testingAutomation = new FlowTestingAutomation(this.client, this.memory);
32
+ // this.rollbackSystem = new SmartRollbackSystem(this.client, this.memory);
33
+ // this.performanceOptimizer = new FlowPerformanceOptimizer(this.client, this.memory);
32
34
  }
33
35
  /**
34
36
  * Create comprehensive integration test suite
@@ -39,31 +41,30 @@ class IntegrationTestSuite {
39
41
  try {
40
42
  // Create test categories
41
43
  const testCategories = await this.createTestCategories(options);
42
- const testSuite = {
43
- id: suiteId,
44
- name,
45
- description,
46
- version: '1.0.0',
47
- testCategories,
48
- configuration: this.createDefaultConfiguration(options.environment || 'testing'),
49
- metadata: {
50
- createdAt: new Date().toISOString(),
51
- author: 'IntegrationTestSuite',
52
- environment: options.environment || 'testing',
53
- totalTests: testCategories.reduce((sum, cat) => sum + cat.tests.length, 0),
54
- estimatedDuration: this.estimateSuiteDuration(testCategories)
55
- }
44
+ // Configure the current instance with the test suite
45
+ this.id = suiteId;
46
+ this.name = name;
47
+ this.description = description;
48
+ this.version = '1.0.0';
49
+ this.testCategories = testCategories;
50
+ this.configuration = this.createDefaultConfiguration(options.environment || 'testing');
51
+ this.metadata = {
52
+ createdAt: new Date().toISOString(),
53
+ author: 'IntegrationTestSuite',
54
+ environment: options.environment || 'testing',
55
+ totalTests: testCategories.reduce((sum, cat) => sum + cat.tests.length, 0),
56
+ estimatedDuration: this.estimateSuiteDuration(testCategories)
56
57
  };
57
58
  // Store test suite
58
- this.testSuites.set(suiteId, testSuite);
59
- await this.memory.store(`integration_suite_${suiteId}`, testSuite, 2592000000); // 30 days
59
+ this.testSuites.set(suiteId, this);
60
+ await this.memory.store(`integration_suite_${suiteId}`, this, 2592000000); // 30 days
60
61
  this.logger.info('✅ Integration test suite created', {
61
62
  suiteId,
62
63
  categories: testCategories.length,
63
- totalTests: testSuite.metadata.totalTests,
64
- estimatedDuration: testSuite.metadata.estimatedDuration
64
+ totalTests: this.metadata.totalTests,
65
+ estimatedDuration: this.metadata.estimatedDuration
65
66
  });
66
- return testSuite;
67
+ return this;
67
68
  }
68
69
  catch (error) {
69
70
  this.logger.error('❌ Failed to create integration test suite', error);
@@ -250,11 +250,11 @@ class CompleteFlowXMLGenerator {
250
250
  generateCompleteFlowXML(flowDef) {
251
251
  this.flowSysId = this.generateSysId();
252
252
  this.snapshotSysId = this.generateSysId();
253
- const internalName = flowDef.internal_name || this.generateInternalName(flowDef.name);
253
+ const internalName = this.flowDef.internal_name || this.generateInternalName(this.flowDef.name);
254
254
  // Generate all component sys_ids
255
255
  const updateSetSysId = this.generateSysId();
256
256
  const triggerSysId = this.generateSysId();
257
- const activitySysIds = flowDef.activities.map(() => this.generateSysId());
257
+ const activitySysIds = this.flowDef.activities.map(() => this.generateSysId());
258
258
  const logicSysIds = [];
259
259
  // Calculate all required logic nodes
260
260
  let logicNodeCount = 1; // Start node
@@ -275,7 +275,7 @@ class CompleteFlowXMLGenerator {
275
275
  <sys_remote_update_set action="INSERT_OR_UPDATE">
276
276
  <sys_id>${updateSetSysId}</sys_id>
277
277
  <name>${this.escapeXml(this.updateSetName)}</name>
278
- <description>Complete flow import: ${this.escapeXml(flowDef.name)}</description>
278
+ <description>Complete flow import: ${this.escapeXml(this.flowDef.name)}</description>
279
279
  <origin_sys_id>${updateSetSysId}</origin_sys_id>
280
280
  <parent/>
281
281
  <release_date/>
@@ -305,7 +305,7 @@ class CompleteFlowXMLGenerator {
305
305
  <category>customer</category>
306
306
  <comments/>
307
307
  <name>sys_hub_flow_${this.flowSysId}</name>
308
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow"><sys_hub_flow action="INSERT_OR_UPDATE"><access>${flowDef.accessible_from || 'package_private'}</access><acls/><active>true</active><annotation>${this.escapeXml(flowDef.annotation || '')}</annotation><callable_by_client_api>${flowDef.callable_by_client_api || false}</callable_by_client_api><category>${flowDef.category || 'custom'}</category><compiler_build/><copied_from/><copied_from_name/><description>${this.escapeXml(flowDef.description)}</description><internal_name>${this.escapeXml(internalName)}</internal_name><label_cache>${encodedLabelCache}</label_cache><latest_snapshot display_value="${this.escapeXml(flowDef.name)}">${this.snapshotSysId}</latest_snapshot><master_snapshot display_value="${this.escapeXml(flowDef.name)}">${this.snapshotSysId}</master_snapshot><name>${this.escapeXml(flowDef.name)}</name><natlang>false</natlang><outputs/><remote_trigger_id/><run_as>${flowDef.run_as || 'user'}</run_as><runtime_value>${this.encodeFlowValue(flowDef.runtime_value || {})}</runtime_value><sc_callable>false</sc_callable><show_action_header>false</show_action_header><show_draft_actions>false</show_draft_actions><show_flow_tile>false</show_flow_tile><show_prompted>false</show_prompted><show_triggered>false</show_triggered><status>published</status><sys_class_name>sys_hub_flow</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>${this.flowSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_name>${this.escapeXml(flowDef.name)}</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_hub_flow_${this.flowSysId}</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><tags>${(flowDef.tags || []).join(',')}</tags><type>flow</type></sys_hub_flow></record_update>]]></payload>
308
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow"><sys_hub_flow action="INSERT_OR_UPDATE"><access>${this.flowDef.accessible_from || 'package_private'}</access><acls/><active>true</active><annotation>${this.escapeXml(this.flowDef.annotation || '')}</annotation><callable_by_client_api>${this.flowDef.callable_by_client_api || false}</callable_by_client_api><category>${this.flowDef.category || 'custom'}</category><compiler_build/><copied_from/><copied_from_name/><description>${this.escapeXml(this.flowDef.description)}</description><internal_name>${this.escapeXml(internalName)}</internal_name><label_cache>${encodedLabelCache}</label_cache><latest_snapshot display_value="${this.escapeXml(this.flowDef.name)}">${this.snapshotSysId}</latest_snapshot><master_snapshot display_value="${this.escapeXml(this.flowDef.name)}">${this.snapshotSysId}</master_snapshot><name>${this.escapeXml(this.flowDef.name)}</name><natlang>false</natlang><outputs/><remote_trigger_id/><run_as>${this.flowDef.run_as || 'user'}</run_as><runtime_value>${this.encodeFlowValue(this.flowDef.runtime_value || {})}</runtime_value><sc_callable>false</sc_callable><show_action_header>false</show_action_header><show_draft_actions>false</show_draft_actions><show_flow_tile>false</show_flow_tile><show_prompted>false</show_prompted><show_triggered>false</show_triggered><status>published</status><sys_class_name>sys_hub_flow</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>${this.flowSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_name>${this.escapeXml(this.flowDef.name)}</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_hub_flow_${this.flowSysId}</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><tags>${(this.flowDef.tags || []).join(',')}</tags><type>flow</type></sys_hub_flow></record_update>]]></payload>
309
309
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
310
310
  <replace_on_upgrade>false</replace_on_upgrade>
311
311
  <source_table>sys_hub_flow</source_table>
@@ -330,16 +330,16 @@ class CompleteFlowXMLGenerator {
330
330
  <action>INSERT_OR_UPDATE</action>
331
331
  <application display_value="Global">global</application>
332
332
  <name>sys_hub_flow_snapshot_${this.snapshotSysId}</name>
333
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_snapshot"><sys_hub_flow_snapshot action="INSERT_OR_UPDATE"><flow display_value="${this.escapeXml(flowDef.name)}">${this.flowSysId}</flow><name>${this.escapeXml(flowDef.name)}</name><note>Complete flow created by CompleteFlowXMLGenerator</note><snapshot>${encodedSnapshot}</snapshot><sys_class_name>sys_hub_flow_snapshot</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>${this.snapshotSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on></sys_hub_flow_snapshot></record_update>]]></payload>
333
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_snapshot"><sys_hub_flow_snapshot action="INSERT_OR_UPDATE"><flow display_value="${this.escapeXml(this.flowDef.name)}">${this.flowSysId}</flow><name>${this.escapeXml(this.flowDef.name)}</name><note>Complete flow created by CompleteFlowXMLGenerator</note><snapshot>${encodedSnapshot}</snapshot><sys_class_name>sys_hub_flow_snapshot</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>${this.snapshotSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on></sys_hub_flow_snapshot></record_update>]]></payload>
334
334
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
335
335
  <source_table>sys_hub_flow_snapshot</source_table>
336
336
  <type>Flow Designer Snapshot</type>
337
337
  </sys_update_xml>
338
338
 
339
339
  ${this.generateTriggerXML(flowDef, triggerSysId, updateSetSysId)}
340
- ${this.generateActionInstancesXML(flowDef.activities, activitySysIds, updateSetSysId)}
340
+ ${this.generateActionInstancesXML(this.flowDef.activities, activitySysIds, updateSetSysId)}
341
341
  ${this.generateFlowLogicXML(flowDef, triggerSysId, activitySysIds, logicSysIds, updateSetSysId)}
342
- ${this.generateVariablesXML(flowDef.variables || [], updateSetSysId)}
342
+ ${this.generateVariablesXML(this.flowDef.variables || [], updateSetSysId)}
343
343
  </unload>`;
344
344
  return xml;
345
345
  }
@@ -349,13 +349,13 @@ class CompleteFlowXMLGenerator {
349
349
  buildCompleteLabelCache(flowDef, triggerSysId, activitySysIds) {
350
350
  const labelCache = {
351
351
  "flow_data": {
352
- "name": flowDef.name,
353
- "description": flowDef.description,
352
+ "name": this.flowDef.name,
353
+ "description": this.flowDef.description,
354
354
  "sys_id": this.flowSysId,
355
- "internal_name": flowDef.internal_name || this.generateInternalName(flowDef.name),
356
- "category": flowDef.category || 'custom',
357
- "run_as": flowDef.run_as || 'user',
358
- "accessible_from": flowDef.accessible_from || 'package_private'
355
+ "internal_name": this.flowDef.internal_name || this.generateInternalName(this.flowDef.name),
356
+ "category": this.flowDef.category || 'custom',
357
+ "run_as": this.flowDef.run_as || 'user',
358
+ "accessible_from": this.flowDef.accessible_from || 'package_private'
359
359
  },
360
360
  "triggers": {},
361
361
  "actions": {},
@@ -370,19 +370,19 @@ class CompleteFlowXMLGenerator {
370
370
  }
371
371
  };
372
372
  // Add trigger with complete metadata
373
- const triggerType = this.getTriggerTypeDefinition(flowDef.trigger_type);
373
+ const triggerType = this.getTriggerTypeDefinition(this.flowDef.trigger_type);
374
374
  labelCache.triggers[triggerSysId] = {
375
375
  "name": "Trigger",
376
376
  "type": triggerType.sys_id,
377
377
  "type_name": triggerType.internal_name,
378
378
  "display_name": triggerType.display_name,
379
- "table": flowDef.table || '',
380
- "condition": flowDef.trigger_condition || '',
379
+ "table": this.flowDef.table || '',
380
+ "condition": this.flowDef.trigger_condition || '',
381
381
  "inputs": {},
382
- "outputs": this.generateTriggerOutputs(flowDef.table)
382
+ "outputs": this.generateTriggerOutputs(this.flowDef.table)
383
383
  };
384
384
  // Add actions with complete metadata
385
- flowDef.activities.forEach((activity, index) => {
385
+ this.flowDef.activities.forEach((activity, index) => {
386
386
  const sysId = activitySysIds[index];
387
387
  const actionType = this.getActionTypeDefinition(activity.type);
388
388
  labelCache.actions[sysId] = {
@@ -401,8 +401,8 @@ class CompleteFlowXMLGenerator {
401
401
  };
402
402
  });
403
403
  // Add variables
404
- if (flowDef.variables) {
405
- flowDef.variables.forEach(variable => {
404
+ if (this.flowDef.variables) {
405
+ this.flowDef.variables.forEach(variable => {
406
406
  labelCache.variables[variable.name] = {
407
407
  "type": variable.type,
408
408
  "default_value": variable.default_value,
@@ -444,7 +444,7 @@ class CompleteFlowXMLGenerator {
444
444
  buildCompleteFlowSnapshot(flowDef, triggerSysId, activitySysIds, labelCache) {
445
445
  const actions = [];
446
446
  // Add trigger node with complete structure
447
- const triggerType = this.getTriggerTypeDefinition(flowDef.trigger_type);
447
+ const triggerType = this.getTriggerTypeDefinition(this.flowDef.trigger_type);
448
448
  actions.push({
449
449
  "id": triggerSysId,
450
450
  "name": "Trigger",
@@ -452,11 +452,11 @@ class CompleteFlowXMLGenerator {
452
452
  "base_type": "trigger",
453
453
  "trigger_type": triggerType.sys_id,
454
454
  "trigger_type_name": triggerType.internal_name,
455
- "table": flowDef.table || '',
456
- "condition": flowDef.trigger_condition || '',
455
+ "table": this.flowDef.table || '',
456
+ "condition": this.flowDef.trigger_condition || '',
457
457
  "parents": [],
458
458
  "children": activitySysIds.length > 0 ? [activitySysIds[0]] : [],
459
- "outputs": this.generateTriggerOutputs(flowDef.table),
459
+ "outputs": this.generateTriggerOutputs(this.flowDef.table),
460
460
  "position": { "x": 100, "y": 100 },
461
461
  "ui_id": (0, uuid_1.v4)(),
462
462
  "metadata": {
@@ -465,7 +465,7 @@ class CompleteFlowXMLGenerator {
465
465
  }
466
466
  });
467
467
  // Add activity nodes with complete structure
468
- flowDef.activities.forEach((activity, index) => {
468
+ this.flowDef.activities.forEach((activity, index) => {
469
469
  const actionSysId = activitySysIds[index];
470
470
  const actionType = this.getActionTypeDefinition(activity.type);
471
471
  const parents = index === 0 ? [triggerSysId] : [activitySysIds[index - 1]];
@@ -503,12 +503,12 @@ class CompleteFlowXMLGenerator {
503
503
  return {
504
504
  "schemaVersion": "2.0",
505
505
  "id": this.flowSysId,
506
- "name": flowDef.name,
507
- "description": flowDef.description,
506
+ "name": this.flowDef.name,
507
+ "description": this.flowDef.description,
508
508
  "type": "flow",
509
- "internal_name": flowDef.internal_name || this.generateInternalName(flowDef.name),
510
- "category": flowDef.category || 'custom',
511
- "tags": flowDef.tags || [],
509
+ "internal_name": this.flowDef.internal_name || this.generateInternalName(this.flowDef.name),
510
+ "category": this.flowDef.category || 'custom',
511
+ "tags": this.flowDef.tags || [],
512
512
  "metadata": {
513
513
  "version": "2.0",
514
514
  "created": this.timestamp,
@@ -519,9 +519,9 @@ class CompleteFlowXMLGenerator {
519
519
  "instance": this.instanceName
520
520
  },
521
521
  "properties": {
522
- "run_as": flowDef.run_as || 'user',
523
- "accessible_from": flowDef.accessible_from || 'package_private',
524
- "callable_by_client_api": flowDef.callable_by_client_api || false,
522
+ "run_as": this.flowDef.run_as || 'user',
523
+ "accessible_from": this.flowDef.accessible_from || 'package_private',
524
+ "callable_by_client_api": this.flowDef.callable_by_client_api || false,
525
525
  "active": true,
526
526
  "status": "published"
527
527
  },
@@ -545,8 +545,8 @@ class CompleteFlowXMLGenerator {
545
545
  "flowData": {
546
546
  "flow_id": this.flowSysId,
547
547
  "snapshot_id": this.snapshotSysId,
548
- "run_as": flowDef.run_as || 'user',
549
- "accessible_from": flowDef.accessible_from || 'package_private'
548
+ "run_as": this.flowDef.run_as || 'user',
549
+ "accessible_from": this.flowDef.accessible_from || 'package_private'
550
550
  }
551
551
  },
552
552
  "layout": {
@@ -560,15 +560,15 @@ class CompleteFlowXMLGenerator {
560
560
  "id": triggerSysId,
561
561
  "type": triggerType.sys_id,
562
562
  "type_name": triggerType.internal_name,
563
- "table": flowDef.table || '',
564
- "condition": flowDef.trigger_condition || '',
563
+ "table": this.flowDef.table || '',
564
+ "condition": this.flowDef.trigger_condition || '',
565
565
  "active": true
566
566
  }],
567
- "variables": flowDef.variables || [],
567
+ "variables": this.flowDef.variables || [],
568
568
  "inputs": {},
569
569
  "outputs": {},
570
- "subflows": flowDef.subflows || [],
571
- "error_handling": flowDef.error_handling || { on_error: 'stop' },
570
+ "subflows": this.flowDef.subflows || [],
571
+ "error_handling": this.flowDef.error_handling || { on_error: 'stop' },
572
572
  "label_cache": labelCache
573
573
  };
574
574
  }
@@ -576,10 +576,10 @@ class CompleteFlowXMLGenerator {
576
576
  * Generate trigger XML with v2 structure
577
577
  */
578
578
  generateTriggerXML(flowDef, triggerSysId, updateSetSysId) {
579
- const triggerType = this.getTriggerTypeDefinition(flowDef.trigger_type);
579
+ const triggerType = this.getTriggerTypeDefinition(this.flowDef.trigger_type);
580
580
  const encodedValues = this.encodeFlowValue({
581
- table: flowDef.table || '',
582
- condition: flowDef.trigger_condition || '',
581
+ table: this.flowDef.table || '',
582
+ condition: this.flowDef.trigger_condition || '',
583
583
  trigger_type: triggerType.sys_id
584
584
  });
585
585
  return `
@@ -589,7 +589,7 @@ class CompleteFlowXMLGenerator {
589
589
  <action>INSERT_OR_UPDATE</action>
590
590
  <application display_value="Global">global</application>
591
591
  <name>sys_hub_trigger_instance_v2_${triggerSysId}</name>
592
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_trigger_instance_v2"><sys_hub_trigger_instance_v2 action="INSERT_OR_UPDATE"><active>true</active><condition>${this.escapeXml(flowDef.trigger_condition || '')}</condition><flow display_value="${this.escapeXml(flowDef.name)}">${this.flowSysId}</flow><flow_trigger display_value="${triggerType.display_name}">${triggerType.sys_id}</flow_trigger><name>Trigger</name><order>0</order><parent_ui_id/><sys_class_name>sys_hub_trigger_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>${triggerSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><table>${flowDef.table || ''}</table><trigger_definition display_value="${triggerType.display_name}">${triggerType.sys_id}</trigger_definition><trigger_inputs/><trigger_outputs/><trigger_type display_value="${triggerType.display_name}">${triggerType.sys_id}</trigger_type><ui_id>${(0, uuid_1.v4)()}</ui_id><values>${encodedValues}</values></sys_hub_trigger_instance_v2></record_update>]]></payload>
592
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_trigger_instance_v2"><sys_hub_trigger_instance_v2 action="INSERT_OR_UPDATE"><active>true</active><condition>${this.escapeXml(this.flowDef.trigger_condition || '')}</condition><flow display_value="${this.escapeXml(this.flowDef.name)}">${this.flowSysId}</flow><flow_trigger display_value="${triggerType.display_name}">${triggerType.sys_id}</flow_trigger><name>Trigger</name><order>0</order><parent_ui_id/><sys_class_name>sys_hub_trigger_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>${triggerSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><table>${this.flowDef.table || ''}</table><trigger_definition display_value="${triggerType.display_name}">${triggerType.sys_id}</trigger_definition><trigger_inputs/><trigger_outputs/><trigger_type display_value="${triggerType.display_name}">${triggerType.sys_id}</trigger_type><ui_id>${(0, uuid_1.v4)()}</ui_id><values>${encodedValues}</values></sys_hub_trigger_instance_v2></record_update>]]></payload>
593
593
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
594
594
  <source_table>sys_hub_trigger_instance_v2</source_table>
595
595
  <type>Flow Designer Trigger</type>
@@ -618,7 +618,7 @@ class CompleteFlowXMLGenerator {
618
618
  <action>INSERT_OR_UPDATE</action>
619
619
  <application display_value="Global">global</application>
620
620
  <name>sys_hub_action_instance_v2_${actionSysId}</name>
621
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_action_instance_v2"><sys_hub_action_instance_v2 action="INSERT_OR_UPDATE"><action_type display_value="${actionType.display_name}">${actionType.sys_id}</action_type><action_type_parent/><attributes/><comment>${this.escapeXml(activity.description || '')}</comment><compiled_snapshot>${actionType.sys_id}</compiled_snapshot><display_text/><flow display_value="${this.escapeXml(flowDef.name)}">${this.flowSysId}</flow><generation_source/><name>${this.escapeXml(activity.name)}</name><order>${orderValue}</order><parent_ui_id/><sys_class_name>sys_hub_action_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${actionSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope display_value="Global">global</sys_scope><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${uiId}</ui_id><updation_source/><values>${encodedValues}</values></sys_hub_action_instance_v2></record_update>]]></payload>
621
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_action_instance_v2"><sys_hub_action_instance_v2 action="INSERT_OR_UPDATE"><action_type display_value="${actionType.display_name}">${actionType.sys_id}</action_type><action_type_parent/><attributes/><comment>${this.escapeXml(activity.description || '')}</comment><compiled_snapshot>${actionType.sys_id}</compiled_snapshot><display_text/><flow display_value="${this.escapeXml(this.flowDef.name)}">${this.flowSysId}</flow><generation_source/><name>${this.escapeXml(activity.name)}</name><order>${orderValue}</order><parent_ui_id/><sys_class_name>sys_hub_action_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${actionSysId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope display_value="Global">global</sys_scope><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${uiId}</ui_id><updation_source/><values>${encodedValues}</values></sys_hub_action_instance_v2></record_update>]]></payload>
622
622
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
623
623
  <source_table>sys_hub_action_instance_v2</source_table>
624
624
  <type>Flow Designer Action</type>
@@ -644,7 +644,7 @@ class CompleteFlowXMLGenerator {
644
644
  <action>INSERT_OR_UPDATE</action>
645
645
  <application display_value="Global">global</application>
646
646
  <name>sys_hub_flow_logic_instance_v2_${startLogicId}</name>
647
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Flow Start</comment><connected_to/><decision_table/><display_text>Start</display_text><flow display_value="${this.escapeXml(flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition display_value="Start">1176605ea76103004f27b0d2187901c5</logic_definition><order>0</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${startLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${startLogicValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
647
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Flow Start</comment><connected_to/><decision_table/><display_text>Start</display_text><flow display_value="${this.escapeXml(this.flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition display_value="Start">1176605ea76103004f27b0d2187901c5</logic_definition><order>0</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${startLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${startLogicValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
648
648
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
649
649
  <source_table>sys_hub_flow_logic_instance_v2</source_table>
650
650
  <type>Flow Designer Logic</type>
@@ -665,7 +665,7 @@ class CompleteFlowXMLGenerator {
665
665
  <action>INSERT_OR_UPDATE</action>
666
666
  <application display_value="Global">global</application>
667
667
  <name>sys_hub_flow_logic_instance_v2_${connectionLogicId}</name>
668
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Connection</comment><connected_to/><decision_table/><display_text/><flow display_value="${this.escapeXml(flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition/><order>${logicIndex * 100}</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${connectionLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${connectionValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
668
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Connection</comment><connected_to/><decision_table/><display_text/><flow display_value="${this.escapeXml(this.flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition/><order>${logicIndex * 100}</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${connectionLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${connectionValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
669
669
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
670
670
  <source_table>sys_hub_flow_logic_instance_v2</source_table>
671
671
  <type>Flow Designer Logic</type>
@@ -687,7 +687,7 @@ class CompleteFlowXMLGenerator {
687
687
  <action>INSERT_OR_UPDATE</action>
688
688
  <application display_value="Global">global</application>
689
689
  <name>sys_hub_flow_logic_instance_v2_${connectionLogicId}</name>
690
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Connection</comment><connected_to/><decision_table/><display_text/><flow display_value="${this.escapeXml(flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition/><order>${logicIndex * 100}</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${connectionLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${connectionValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
690
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Connection</comment><connected_to/><decision_table/><display_text/><flow display_value="${this.escapeXml(this.flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition/><order>${logicIndex * 100}</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${connectionLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${connectionValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
691
691
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
692
692
  <source_table>sys_hub_flow_logic_instance_v2</source_table>
693
693
  <type>Flow Designer Logic</type>
@@ -706,7 +706,7 @@ class CompleteFlowXMLGenerator {
706
706
  <action>INSERT_OR_UPDATE</action>
707
707
  <application display_value="Global">global</application>
708
708
  <name>sys_hub_flow_logic_instance_v2_${endLogicId}</name>
709
- <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Flow End</comment><connected_to/><decision_table/><display_text>End</display_text><flow display_value="${this.escapeXml(flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition display_value="End">d176605ea76103004f27b0d2187901c7</logic_definition><order>${(logicIndex + 1) * 100}</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${endLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${endLogicValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
709
+ <payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_hub_flow_logic_instance_v2"><sys_hub_flow_logic_instance_v2 action="INSERT_OR_UPDATE"><attributes/><block display_value="">${this.generateSysId()}</block><comment>Flow End</comment><connected_to/><decision_table/><display_text>End</display_text><flow display_value="${this.escapeXml(this.flowDef.name)}">${this.flowSysId}</flow><flow_variables_assigned/><generation_source/><logic_definition display_value="End">d176605ea76103004f27b0d2187901c7</logic_definition><order>${(logicIndex + 1) * 100}</order><outputs_assigned/><parent_ui_id/><sys_class_name>sys_hub_flow_logic_instance_v2</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>${this.timestamp}</sys_created_on><sys_id>${endLogicId}</sys_id><sys_mod_count>0</sys_mod_count><sys_scope/><sys_updated_by>admin</sys_updated_by><sys_updated_on>${this.timestamp}</sys_updated_on><ui_id>${(0, uuid_1.v4)()}</ui_id><updation_source/><values>${endLogicValues}</values><workflow_reference/></sys_hub_flow_logic_instance_v2></record_update>]]></payload>
710
710
  <remote_update_set display_value="${this.escapeXml(this.updateSetName)}">${updateSetSysId}</remote_update_set>
711
711
  <source_table>sys_hub_flow_logic_instance_v2</source_table>
712
712
  <type>Flow Designer Logic</type>
@@ -1220,9 +1220,9 @@ exports.CompleteFlowXMLGenerator = CompleteFlowXMLGenerator;
1220
1220
  * Generate PRODUCTION-READY complete flow XML
1221
1221
  */
1222
1222
  function generateCompleteFlowXML(flowDef) {
1223
- const generator = new CompleteFlowXMLGenerator(flowDef.name.replace(/[^a-zA-Z0-9]+/g, '_') + '_Complete_Import');
1223
+ const generator = new CompleteFlowXMLGenerator(this.flowDef.name.replace(/[^a-zA-Z0-9]+/g, '_') + '_Complete_Import');
1224
1224
  const xml = generator.generateCompleteFlowXML(flowDef);
1225
- const filename = flowDef.name.toLowerCase().replace(/[^a-z0-9]+/g, '_') + '_complete_flow.xml';
1225
+ const filename = this.flowDef.name.toLowerCase().replace(/[^a-z0-9]+/g, '_') + '_complete_flow.xml';
1226
1226
  const filePath = generator.saveToFile(xml, filename);
1227
1227
  const instructions = `
1228
1228
  === COMPLETE ServiceNow Flow Import Instructions ===
@@ -1253,7 +1253,7 @@ function generateCompleteFlowXML(flowDef) {
1253
1253
 
1254
1254
  6. Review and "Commit Update Set"
1255
1255
 
1256
- 7. Open Flow Designer and find: "${flowDef.name}"
1256
+ 7. Open Flow Designer and find: "${this.flowDef.name}"
1257
1257
 
1258
1258
  💡 The flow includes ALL requested features:
1259
1259
  ✅ Automated assignment based on analysis