snow-flow 3.0.9 → 3.0.13
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/claude-flow.bat +0 -0
- package/claude-flow.ps1 +0 -0
- package/dist/mcp/intelligent-reporting-mcp.d.ts +7 -0
- package/dist/mcp/intelligent-reporting-mcp.js +379 -0
- package/dist/mcp/servicenow-automation-mcp.js +0 -0
- package/dist/mcp/servicenow-deployment-mcp.js +0 -0
- package/dist/mcp/servicenow-integration-mcp.js +0 -0
- package/dist/mcp/servicenow-mcp-server.js +0 -0
- package/dist/mcp/servicenow-operations-mcp.js +0 -0
- package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
- package/dist/mcp/servicenow-progressive-indexer.js +0 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.js +280 -29
- package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
- package/dist/mcp/servicenow-update-set-mcp.js +0 -0
- package/dist/mcp/start-all-mcp-servers.js +0 -0
- package/dist/mcp/start-servicenow-mcp.js +0 -0
- package/dist/services/widget-deployment-service.d.ts +2 -1
- package/dist/services/widget-deployment-service.js +17 -16
- package/dist/utils/anti-mock-data-validator.d.ts +66 -0
- package/dist/utils/anti-mock-data-validator.js +316 -0
- package/dist/utils/servicenow-eventual-consistency.d.ts +120 -0
- package/dist/utils/servicenow-eventual-consistency.js +220 -0
- package/memory/agents/README.md +1 -1
- package/memory/claude-flow-data.json +1 -1
- package/memory/sessions/README.md +1 -1
- package/package.json +4 -3
- package/.mcp.json +0 -22
- package/claude-flow.config.json +0 -20
- package/dist/agents/app-creator.agent.d.ts +0 -55
- package/dist/agents/app-creator.agent.js +0 -1292
- package/dist/agents/base/base-snow-agent.d.ts +0 -75
- package/dist/agents/base/base-snow-agent.js +0 -169
- package/dist/agents/base-snow-agent.d.ts +0 -63
- package/dist/agents/base-snow-agent.js +0 -296
- package/dist/agents/coordinator.d.ts +0 -200
- package/dist/agents/coordinator.js +0 -777
- package/dist/agents/flow-builder-agent.d.ts +0 -18
- package/dist/agents/flow-builder-agent.js +0 -197
- package/dist/agents/queen-403-handler.d.ts +0 -47
- package/dist/agents/queen-403-handler.js +0 -175
- package/dist/agents/queen-agent-example.d.ts +0 -23
- package/dist/agents/queen-agent-example.js +0 -240
- package/dist/agents/queen-agent.test.d.ts +0 -6
- package/dist/agents/script-generator.agent.d.ts +0 -32
- package/dist/agents/script-generator.agent.js +0 -772
- package/dist/agents/script-writer-agent.d.ts +0 -22
- package/dist/agents/script-writer-agent.js +0 -695
- package/dist/agents/security-agent.d.ts +0 -23
- package/dist/agents/security-agent.js +0 -619
- package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
- package/dist/agents/specialists/automation-specialist.agent.js +0 -204
- package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
- package/dist/agents/specialists/data-specialist.agent.js +0 -484
- package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
- package/dist/agents/specialists/integration-specialist.agent.js +0 -725
- package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
- package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
- package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
- package/dist/agents/specialists/security-specialist.agent.js +0 -309
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
- package/dist/agents/teams/base-team.d.ts +0 -72
- package/dist/agents/teams/base-team.js +0 -253
- package/dist/agents/teams/team-types.d.ts +0 -265
- package/dist/agents/teams/team-types.js +0 -3
- package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
- package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
- package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
- package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
- package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
- package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
- package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
- package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
- package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
- package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
- package/dist/agents/test-agent.d.ts +0 -26
- package/dist/agents/test-agent.js +0 -734
- package/dist/agents/test-agents.d.ts +0 -7
- package/dist/agents/test-agents.js +0 -64
- package/dist/agents/ui-builder.agent.d.ts +0 -50
- package/dist/agents/ui-builder.agent.js +0 -1539
- package/dist/agents/widget-builder.agent.d.ts +0 -32
- package/dist/agents/widget-builder.agent.js +0 -439
- package/dist/agents/widget-creator-agent.d.ts +0 -18
- package/dist/agents/widget-creator-agent.js +0 -498
- package/dist/agents/workflow-designer.agent.d.ts +0 -31
- package/dist/agents/workflow-designer.agent.js +0 -583
- package/dist/api/error-handling.d.ts +0 -325
- package/dist/api/error-handling.js +0 -1488
- package/dist/api/flow-designer-api.d.ts +0 -167
- package/dist/api/flow-designer-api.js +0 -554
- package/dist/api/natural-language-mapper.d.ts +0 -124
- package/dist/api/natural-language-mapper.js +0 -501
- package/dist/api/performance-optimizer.d.ts +0 -240
- package/dist/api/performance-optimizer.js +0 -706
- package/dist/api/transaction-manager.d.ts +0 -189
- package/dist/api/transaction-manager.js +0 -576
- package/dist/assembly/team-assembler.d.ts +0 -140
- package/dist/assembly/team-assembler.js +0 -502
- package/dist/benchmark-performance.d.ts +0 -41
- package/dist/benchmark-performance.js +0 -230
- package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
- package/dist/cli/snow-flow-cli-integration.js +0 -396
- package/dist/coordination/coordination-engine.d.ts +0 -41
- package/dist/coordination/coordination-engine.js +0 -324
- package/dist/coordination/coordination.test.d.ts +0 -6
- package/dist/coordination/example.d.ts +0 -31
- package/dist/coordination/example.js +0 -394
- package/dist/coordination/execution-patterns.d.ts +0 -43
- package/dist/coordination/execution-patterns.js +0 -507
- package/dist/coordination/factory.d.ts +0 -94
- package/dist/coordination/factory.js +0 -433
- package/dist/coordination/index.d.ts +0 -71
- package/dist/coordination/index.js +0 -135
- package/dist/coordination/progress-monitor.d.ts +0 -71
- package/dist/coordination/progress-monitor.js +0 -505
- package/dist/coordination/quality-gates.d.ts +0 -124
- package/dist/coordination/quality-gates.js +0 -577
- package/dist/coordination/shared-memory.d.ts +0 -39
- package/dist/coordination/shared-memory.js +0 -289
- package/dist/coordination/task-dependencies.d.ts +0 -50
- package/dist/coordination/task-dependencies.js +0 -407
- package/dist/coordination/team-coordinator.d.ts +0 -59
- package/dist/coordination/team-coordinator.js +0 -550
- package/dist/coordination/types.d.ts +0 -152
- package/dist/coordination/types.js +0 -3
- package/dist/mcp/mcp-wrapper.d.ts +0 -8
- package/dist/mcp/mcp-wrapper.js +0 -77
- package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
- package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
- package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
- package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
- package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
- package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
- package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
- package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
- package/dist/mcp/singleton-check.js +0 -31
- package/dist/mcp/test-simple-mcp.d.ts +0 -6
- package/dist/mcp/test-simple-mcp.js +0 -63
- package/dist/memory/hierarchical-memory-system.d.ts +0 -90
- package/dist/memory/hierarchical-memory-system.js +0 -400
- package/dist/memory/index.d.ts +0 -9
- package/dist/memory/index.js +0 -20
- package/dist/memory/mcp-integration-example.d.ts +0 -6
- package/dist/memory/mcp-integration-example.js +0 -281
- package/dist/memory/memory-client.d.ts +0 -199
- package/dist/memory/memory-client.js +0 -364
- package/dist/memory/memory-manager.d.ts +0 -29
- package/dist/memory/memory-manager.js +0 -280
- package/dist/memory/memory-operations.d.ts +0 -179
- package/dist/memory/memory-operations.js +0 -691
- package/dist/memory/memory-system.d.ts +0 -153
- package/dist/memory/memory-system.js +0 -651
- package/dist/memory/memory-test.d.ts +0 -6
- package/dist/memory/memory-test.js +0 -161
- package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
- package/dist/memory/snow-flow-memory-patterns.js +0 -200
- package/dist/memory/snow-memory.d.ts +0 -54
- package/dist/memory/snow-memory.js +0 -301
- package/dist/memory/swarm-memory.d.ts +0 -135
- package/dist/memory/swarm-memory.js +0 -378
- package/dist/optimization/flow-performance-optimizer.js +0 -723
- package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
- package/dist/orchestration/discovery/service-discovery.js +0 -808
- package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
- package/dist/orchestration/distributed-orchestrator.js +0 -712
- package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
- package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
- package/dist/orchestration/flow-update-orchestrator.js +0 -648
- package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
- package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
- package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
- package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
- package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
- package/dist/orchestration/state/distributed-state-manager.js +0 -716
- package/dist/orchestrator/flow-composer.d.ts +0 -105
- package/dist/orchestrator/flow-composer.js +0 -404
- package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
- package/dist/orchestrator/flow-pattern-templates.js +0 -908
- package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
- package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
- package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
- package/dist/orchestrator/flow-validation-engine.js +0 -913
- package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
- package/dist/orchestrator/snow-orchestrator.js +0 -235
- package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
- package/dist/orchestrator/subflow-creation-handler.js +0 -791
- package/dist/patterns/adaptive-patterns.d.ts +0 -140
- package/dist/patterns/adaptive-patterns.js +0 -549
- package/dist/queen/advanced-integration-test.d.ts +0 -48
- package/dist/queen/advanced-integration-test.js +0 -473
- package/dist/queen/integration-example.d.ts +0 -82
- package/dist/queen/integration-example.js +0 -219
- package/dist/queen/integration-test.d.ts +0 -72
- package/dist/queen/integration-test.js +0 -563
- package/dist/queen/mock-mcp-client.d.ts +0 -71
- package/dist/queen/mock-mcp-client.js +0 -317
- package/dist/queen/run-integration-tests.d.ts +0 -9
- package/dist/queen/run-integration-tests.js +0 -27
- package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
- package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
- package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
- package/dist/sparc/coordinators/team-coordinator.js +0 -402
- package/dist/sparc/modes/team-modes.d.ts +0 -33
- package/dist/sparc/modes/team-modes.js +0 -399
- package/dist/sparc/teams/application-team.d.ts +0 -73
- package/dist/sparc/teams/application-team.js +0 -463
- package/dist/sparc/teams/flow-team.d.ts +0 -67
- package/dist/sparc/teams/flow-team.js +0 -373
- package/dist/sparc/teams/widget-team.d.ts +0 -61
- package/dist/sparc/teams/widget-team.js +0 -280
- package/dist/specialists/app-specialists.d.ts +0 -93
- package/dist/specialists/app-specialists.js +0 -1639
- package/dist/specialists/base-specialist.d.ts +0 -19
- package/dist/specialists/base-specialist.js +0 -54
- package/dist/specialists/flow-specialists.d.ts +0 -113
- package/dist/specialists/flow-specialists.js +0 -1787
- package/dist/specialists/individual-specialists.d.ts +0 -67
- package/dist/specialists/individual-specialists.js +0 -632
- package/dist/specialists/widget-specialists.d.ts +0 -70
- package/dist/specialists/widget-specialists.js +0 -1264
- package/dist/src/utils/agent-detector.js +0 -655
- package/dist/teams/adaptive-team.d.ts +0 -81
- package/dist/teams/adaptive-team.js +0 -1153
- package/dist/teams/application-team.d.ts +0 -30
- package/dist/teams/application-team.js +0 -547
- package/dist/teams/base-team.d.ts +0 -55
- package/dist/teams/base-team.js +0 -243
- package/dist/teams/flow-team.d.ts +0 -28
- package/dist/teams/flow-team.js +0 -525
- package/dist/teams/widget-team.d.ts +0 -26
- package/dist/teams/widget-team.js +0 -459
- package/dist/templates/flow-template-system.js +0 -625
- package/dist/test-fetch-incidents.d.ts +0 -2
- package/dist/test-fetch-incidents.js +0 -84
- package/dist/test-incident-access.d.ts +0 -2
- package/dist/test-incident-access.js +0 -72
- package/dist/test-iphone-flow.js +0 -189
- package/dist/test-limit-problem.d.ts +0 -2
- package/dist/test-limit-problem.js +0 -60
- package/dist/test-ml-batch-fix.d.ts +0 -2
- package/dist/test-ml-batch-fix.js +0 -104
- package/dist/test-ml-batch.d.ts +0 -2
- package/dist/test-ml-batch.js +0 -87
- package/dist/test-ml-query.d.ts +0 -2
- package/dist/test-ml-query.js +0 -100
- package/dist/test-ml-training-fix.d.ts +0 -12
- package/dist/test-ml-training-fix.js +0 -113
- package/dist/test-ml-training.d.ts +0 -2
- package/dist/test-ml-training.js +0 -32
- package/dist/test-operations-query.d.ts +0 -2
- package/dist/test-operations-query.js +0 -84
- package/dist/test-performance-query.d.ts +0 -2
- package/dist/test-performance-query.js +0 -52
- package/dist/test-singleton-protection.d.ts +0 -8
- package/dist/test-singleton-protection.js +0 -110
- package/dist/test-smart-limits.d.ts +0 -13
- package/dist/test-smart-limits.js +0 -100
- package/dist/test-snow-query-incidents.d.ts +0 -2
- package/dist/test-snow-query-incidents.js +0 -66
- package/dist/test-universal-query.d.ts +0 -2
- package/dist/test-universal-query.js +0 -106
- package/dist/testing/flow-testing-automation.js +0 -641
- package/dist/utils/complete-flow-xml-generator.js +0 -1285
- package/dist/utils/file-storage-fallback.d.ts +0 -62
- package/dist/utils/file-storage-fallback.js +0 -289
- package/dist/utils/flow-api-discovery.d.ts +0 -151
- package/dist/utils/flow-api-discovery.js +0 -439
- package/dist/utils/flow-examples.js +0 -720
- package/dist/utils/flow-structure-builder.js +0 -677
- package/dist/utils/flow-xml-generator.d.ts +0 -41
- package/dist/utils/flow-xml-generator.js +0 -258
- package/dist/utils/improved-flow-xml-generator.js +0 -820
- package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
- package/dist/utils/mcp-process-manager.backup.js +0 -220
- package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
- package/dist/utils/mcp-singleton-enforcer.js +0 -201
- package/dist/utils/mcp-timeout-fix.d.ts +0 -53
- package/dist/utils/mcp-timeout-fix.js +0 -221
- package/dist/utils/migrate-claude-flow.d.ts +0 -22
- package/dist/utils/migrate-claude-flow.js +0 -120
- package/dist/utils/scope-utils.d.ts +0 -72
- package/dist/utils/scope-utils.js +0 -386
- package/dist/utils/snow-oauth-old.d.ts +0 -65
- package/dist/utils/snow-oauth-old.js +0 -345
- package/dist/utils/xml-first-flow-generator.js +0 -513
- package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
- package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
- package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
- package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
- package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
- package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
- package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
- package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
- package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
- package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
- package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
- package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
- package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
- package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
- package/reports/swarm-auto-centralized-1752649029776.json +0 -13
- package/src/memory/README.md +0 -240
|
@@ -1,648 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* 🚀 Flow Update Orchestration with Smart Rollbacks
|
|
4
|
-
*
|
|
5
|
-
* Intelligent flow updating system that provides safe, reliable updates
|
|
6
|
-
* with automatic testing, validation, and rollback capabilities.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.FlowUpdateOrchestrator = void 0;
|
|
10
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
11
|
-
const xml_first_flow_generator_js_1 = require("../utils/xml-first-flow-generator.js");
|
|
12
|
-
class FlowUpdateOrchestrator {
|
|
13
|
-
constructor(client, memory) {
|
|
14
|
-
this.activeUpdates = new Map();
|
|
15
|
-
this.logger = new logger_js_1.Logger('FlowUpdateOrchestrator');
|
|
16
|
-
this.client = client;
|
|
17
|
-
this.memory = memory;
|
|
18
|
-
this.xmlGenerator = new xml_first_flow_generator_js_1.XMLFirstFlowGenerator();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Plan a flow update with comprehensive analysis
|
|
22
|
-
*/
|
|
23
|
-
async planFlowUpdate(flowId, newDefinition, options = {}) {
|
|
24
|
-
this.logger.info('📋 Planning flow update', { flowId, strategy: options.strategy });
|
|
25
|
-
try {
|
|
26
|
-
// Get current flow version
|
|
27
|
-
const currentFlow = await this.client.getFlow(flowId);
|
|
28
|
-
if (!currentFlow.success) {
|
|
29
|
-
throw new Error(`Failed to retrieve current flow: ${currentFlow.error}`);
|
|
30
|
-
}
|
|
31
|
-
const currentVersion = {
|
|
32
|
-
sys_id: currentFlow.data.sys_id,
|
|
33
|
-
name: currentFlow.data.name,
|
|
34
|
-
version: currentFlow.data.version || '1.0.0',
|
|
35
|
-
definition: currentFlow.data.definition,
|
|
36
|
-
created_at: new Date(currentFlow.data.sys_created_on),
|
|
37
|
-
created_by: currentFlow.data.sys_created_by,
|
|
38
|
-
status: 'active',
|
|
39
|
-
metadata: {
|
|
40
|
-
changeLog: [],
|
|
41
|
-
dependencies: await this.analyzeDependencies(currentFlow.data.definition)
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
// Create target version
|
|
45
|
-
const targetVersion = {
|
|
46
|
-
sys_id: flowId,
|
|
47
|
-
name: newDefinition.name,
|
|
48
|
-
version: this.generateNextVersion(currentVersion.version),
|
|
49
|
-
definition: newDefinition,
|
|
50
|
-
created_at: new Date(),
|
|
51
|
-
created_by: 'flow_orchestrator',
|
|
52
|
-
status: 'draft',
|
|
53
|
-
metadata: {
|
|
54
|
-
changeLog: await this.generateChangeLog(currentVersion.definition, newDefinition),
|
|
55
|
-
dependencies: await this.analyzeDependencies(newDefinition)
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
// Determine update strategy
|
|
59
|
-
const strategy = options.strategy || await this.recommendUpdateStrategy(currentVersion, targetVersion);
|
|
60
|
-
// Create validation steps
|
|
61
|
-
const validationSteps = await this.createValidationSteps(currentVersion, targetVersion, options.testingLevel || 'comprehensive');
|
|
62
|
-
// Create rollback plan
|
|
63
|
-
const rollbackPlan = await this.createRollbackPlan(currentVersion, targetVersion, strategy);
|
|
64
|
-
// Assess risk level
|
|
65
|
-
const riskLevel = await this.assessRiskLevel(currentVersion, targetVersion);
|
|
66
|
-
// Estimate downtime
|
|
67
|
-
const estimatedDowntime = this.estimateDowntime(strategy, validationSteps.length);
|
|
68
|
-
const updatePlan = {
|
|
69
|
-
flowId,
|
|
70
|
-
currentVersion,
|
|
71
|
-
targetVersion,
|
|
72
|
-
updateStrategy: strategy,
|
|
73
|
-
validationSteps,
|
|
74
|
-
rollbackPlan,
|
|
75
|
-
estimatedDowntime,
|
|
76
|
-
riskLevel
|
|
77
|
-
};
|
|
78
|
-
// Store plan for execution
|
|
79
|
-
await this.memory.store(`flow_update_plan_${flowId}`, updatePlan, 3600000); // 1 hour
|
|
80
|
-
this.logger.info('✅ Flow update plan created', {
|
|
81
|
-
flowId,
|
|
82
|
-
strategy,
|
|
83
|
-
riskLevel,
|
|
84
|
-
validationSteps: validationSteps.length,
|
|
85
|
-
estimatedDowntime
|
|
86
|
-
});
|
|
87
|
-
return updatePlan;
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
this.logger.error('❌ Failed to plan flow update', error);
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Execute flow update with monitoring and automatic rollback
|
|
96
|
-
*/
|
|
97
|
-
async executeFlowUpdate(planId, options = {}) {
|
|
98
|
-
this.logger.info('🚀 Executing flow update', { planId, options });
|
|
99
|
-
const startTime = Date.now();
|
|
100
|
-
try {
|
|
101
|
-
// Load plan
|
|
102
|
-
const plan = await this.memory.get(`flow_update_plan_${planId}`);
|
|
103
|
-
if (!plan) {
|
|
104
|
-
throw new Error(`Update plan not found: ${planId}`);
|
|
105
|
-
}
|
|
106
|
-
// Create execution context
|
|
107
|
-
const execution = new FlowUpdateExecution(plan, this.logger, this.client, this.memory);
|
|
108
|
-
this.activeUpdates.set(planId, execution);
|
|
109
|
-
// Execute update
|
|
110
|
-
const result = await execution.execute(options);
|
|
111
|
-
// Clean up
|
|
112
|
-
this.activeUpdates.delete(planId);
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
this.logger.error('❌ Flow update execution failed', error);
|
|
117
|
-
// Attempt emergency rollback if execution exists
|
|
118
|
-
const execution = this.activeUpdates.get(planId);
|
|
119
|
-
if (execution) {
|
|
120
|
-
try {
|
|
121
|
-
await execution.emergencyRollback();
|
|
122
|
-
}
|
|
123
|
-
catch (rollbackError) {
|
|
124
|
-
this.logger.error('❌ Emergency rollback also failed', rollbackError);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
throw error;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Monitor active updates
|
|
132
|
-
*/
|
|
133
|
-
getActiveUpdates() {
|
|
134
|
-
return Array.from(this.activeUpdates.entries()).map(([planId, execution]) => ({
|
|
135
|
-
planId,
|
|
136
|
-
status: execution.getStatus(),
|
|
137
|
-
progress: execution.getProgress()
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Cancel an active update
|
|
142
|
-
*/
|
|
143
|
-
async cancelUpdate(planId) {
|
|
144
|
-
const execution = this.activeUpdates.get(planId);
|
|
145
|
-
if (!execution) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
try {
|
|
149
|
-
await execution.cancel();
|
|
150
|
-
this.activeUpdates.delete(planId);
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
this.logger.error('❌ Failed to cancel update', error);
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Private helper methods
|
|
160
|
-
*/
|
|
161
|
-
async analyzeDependencies(flowDefinition) {
|
|
162
|
-
const dependencies = [];
|
|
163
|
-
// Analyze activities for dependencies
|
|
164
|
-
for (const activity of flowDefinition.activities) {
|
|
165
|
-
if (activity.type === 'create_record' || activity.type === 'update_record') {
|
|
166
|
-
dependencies.push(`table:${activity.inputs.table}`);
|
|
167
|
-
}
|
|
168
|
-
if (activity.type === 'assign_subflow') {
|
|
169
|
-
dependencies.push(`subflow:${activity.inputs.subflow_id}`);
|
|
170
|
-
}
|
|
171
|
-
if (activity.type === 'rest_step') {
|
|
172
|
-
dependencies.push(`rest_message:${activity.inputs.rest_message}`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return [...new Set(dependencies)]; // Remove duplicates
|
|
176
|
-
}
|
|
177
|
-
generateNextVersion(currentVersion) {
|
|
178
|
-
const parts = currentVersion.split('.');
|
|
179
|
-
const patch = parseInt(parts[2] || '0') + 1;
|
|
180
|
-
return `${parts[0] || '1'}.${parts[1] || '0'}.${patch}`;
|
|
181
|
-
}
|
|
182
|
-
async generateChangeLog(current, target) {
|
|
183
|
-
const changes = [];
|
|
184
|
-
// Name change
|
|
185
|
-
if (current.name !== target.name) {
|
|
186
|
-
changes.push(`Renamed from "${current.name}" to "${target.name}"`);
|
|
187
|
-
}
|
|
188
|
-
// Description change
|
|
189
|
-
if (current.description !== target.description) {
|
|
190
|
-
changes.push('Updated description');
|
|
191
|
-
}
|
|
192
|
-
// Activities comparison
|
|
193
|
-
const currentActivities = current.activities.map(a => a.name);
|
|
194
|
-
const targetActivities = target.activities.map(a => a.name);
|
|
195
|
-
const added = targetActivities.filter(a => !currentActivities.includes(a));
|
|
196
|
-
const removed = currentActivities.filter(a => !targetActivities.includes(a));
|
|
197
|
-
added.forEach(activity => changes.push(`Added activity: ${activity}`));
|
|
198
|
-
removed.forEach(activity => changes.push(`Removed activity: ${activity}`));
|
|
199
|
-
if (changes.length === 0) {
|
|
200
|
-
changes.push('Minor configuration updates');
|
|
201
|
-
}
|
|
202
|
-
return changes;
|
|
203
|
-
}
|
|
204
|
-
async recommendUpdateStrategy(current, target) {
|
|
205
|
-
const riskFactors = {
|
|
206
|
-
majorChanges: target.metadata.changeLog.length > 5,
|
|
207
|
-
dependencyChanges: target.metadata.dependencies.length !== current.metadata.dependencies.length,
|
|
208
|
-
structuralChanges: target.definition.activities.length !== current.definition.activities.length,
|
|
209
|
-
criticalFlow: current.name.toLowerCase().includes('critical') || current.name.toLowerCase().includes('production')
|
|
210
|
-
};
|
|
211
|
-
const riskScore = Object.values(riskFactors).filter(Boolean).length;
|
|
212
|
-
if (riskScore >= 3) {
|
|
213
|
-
return 'maintenance_window';
|
|
214
|
-
}
|
|
215
|
-
else if (riskScore >= 2) {
|
|
216
|
-
return 'blue_green';
|
|
217
|
-
}
|
|
218
|
-
else if (riskScore >= 1) {
|
|
219
|
-
return 'canary';
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
return 'in_place';
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
async createValidationSteps(current, target, testingLevel) {
|
|
226
|
-
const steps = [
|
|
227
|
-
{
|
|
228
|
-
id: 'syntax_validation',
|
|
229
|
-
name: 'Syntax Validation',
|
|
230
|
-
type: 'syntax',
|
|
231
|
-
required: true,
|
|
232
|
-
autoFix: false,
|
|
233
|
-
estimatedTime: 5000,
|
|
234
|
-
validator: async (flow) => {
|
|
235
|
-
return this.validateSyntax(flow);
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
id: 'dependency_check',
|
|
240
|
-
name: 'Dependency Check',
|
|
241
|
-
type: 'dependencies',
|
|
242
|
-
required: true,
|
|
243
|
-
autoFix: false,
|
|
244
|
-
estimatedTime: 10000,
|
|
245
|
-
validator: async (flow) => {
|
|
246
|
-
return this.validateDependencies(flow);
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
id: 'permission_check',
|
|
251
|
-
name: 'Permission Validation',
|
|
252
|
-
type: 'permissions',
|
|
253
|
-
required: true,
|
|
254
|
-
autoFix: false,
|
|
255
|
-
estimatedTime: 8000,
|
|
256
|
-
validator: async (flow) => {
|
|
257
|
-
return this.validatePermissions(flow);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
];
|
|
261
|
-
if (testingLevel === 'comprehensive' || testingLevel === 'full_integration') {
|
|
262
|
-
steps.push({
|
|
263
|
-
id: 'performance_test',
|
|
264
|
-
name: 'Performance Testing',
|
|
265
|
-
type: 'performance',
|
|
266
|
-
required: false,
|
|
267
|
-
autoFix: false,
|
|
268
|
-
estimatedTime: 30000,
|
|
269
|
-
validator: async (flow) => {
|
|
270
|
-
return this.performanceTest(flow);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
if (testingLevel === 'full_integration') {
|
|
275
|
-
steps.push({
|
|
276
|
-
id: 'integration_test',
|
|
277
|
-
name: 'Integration Testing',
|
|
278
|
-
type: 'integration',
|
|
279
|
-
required: false,
|
|
280
|
-
autoFix: false,
|
|
281
|
-
estimatedTime: 60000,
|
|
282
|
-
validator: async (flow) => {
|
|
283
|
-
return this.integrationTest(flow);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
return steps;
|
|
288
|
-
}
|
|
289
|
-
async createRollbackPlan(current, target, strategy) {
|
|
290
|
-
const rollbackSteps = [
|
|
291
|
-
{
|
|
292
|
-
order: 1,
|
|
293
|
-
action: 'Create backup',
|
|
294
|
-
description: 'Create complete backup of current flow version',
|
|
295
|
-
automated: true,
|
|
296
|
-
validationCheck: 'Verify backup integrity'
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
order: 2,
|
|
300
|
-
action: 'Restore previous version',
|
|
301
|
-
description: 'Restore flow to previous working version',
|
|
302
|
-
automated: true,
|
|
303
|
-
validationCheck: 'Verify flow is active and accessible'
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
order: 3,
|
|
307
|
-
action: 'Validate rollback',
|
|
308
|
-
description: 'Test that rollback was successful',
|
|
309
|
-
automated: true,
|
|
310
|
-
validationCheck: 'Execute test workflow to verify functionality'
|
|
311
|
-
}
|
|
312
|
-
];
|
|
313
|
-
return {
|
|
314
|
-
strategy: 'version_revert',
|
|
315
|
-
backupLocation: `flow_backup_${current.sys_id}_${Date.now()}`,
|
|
316
|
-
rollbackSteps,
|
|
317
|
-
estimatedTime: 30000, // 30 seconds
|
|
318
|
-
dataImpact: 'minimal'
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
async assessRiskLevel(current, target) {
|
|
322
|
-
let riskScore = 0;
|
|
323
|
-
// Major structural changes
|
|
324
|
-
if (target.definition.activities.length !== current.definition.activities.length) {
|
|
325
|
-
riskScore += 2;
|
|
326
|
-
}
|
|
327
|
-
// Dependency changes
|
|
328
|
-
if (target.metadata.dependencies.length !== current.metadata.dependencies.length) {
|
|
329
|
-
riskScore += 1;
|
|
330
|
-
}
|
|
331
|
-
// Many changes
|
|
332
|
-
if (target.metadata.changeLog.length > 5) {
|
|
333
|
-
riskScore += 1;
|
|
334
|
-
}
|
|
335
|
-
// Critical flow indicators
|
|
336
|
-
if (current.name.toLowerCase().includes('critical') || current.name.toLowerCase().includes('production')) {
|
|
337
|
-
riskScore += 2;
|
|
338
|
-
}
|
|
339
|
-
if (riskScore >= 5)
|
|
340
|
-
return 'critical';
|
|
341
|
-
if (riskScore >= 3)
|
|
342
|
-
return 'high';
|
|
343
|
-
if (riskScore >= 2)
|
|
344
|
-
return 'medium';
|
|
345
|
-
return 'low';
|
|
346
|
-
}
|
|
347
|
-
estimateDowntime(strategy, validationSteps) {
|
|
348
|
-
const baseTime = {
|
|
349
|
-
'in_place': 10000, // 10 seconds
|
|
350
|
-
'blue_green': 5000, // 5 seconds
|
|
351
|
-
'canary': 30000, // 30 seconds
|
|
352
|
-
'maintenance_window': 0 // No downtime during maintenance
|
|
353
|
-
};
|
|
354
|
-
return baseTime[strategy] + (validationSteps * 2000);
|
|
355
|
-
}
|
|
356
|
-
// Validation methods
|
|
357
|
-
async validateSyntax(flow) {
|
|
358
|
-
const issues = [];
|
|
359
|
-
// Basic syntax checks
|
|
360
|
-
if (!flow.name || flow.name.trim().length === 0) {
|
|
361
|
-
issues.push({
|
|
362
|
-
severity: 'error',
|
|
363
|
-
message: 'Flow name is required',
|
|
364
|
-
autoFixable: false,
|
|
365
|
-
impact: 'Flow cannot be created without a name'
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
if (!flow.activities || flow.activities.length === 0) {
|
|
369
|
-
issues.push({
|
|
370
|
-
severity: 'error',
|
|
371
|
-
message: 'Flow must have at least one activity',
|
|
372
|
-
autoFixable: false,
|
|
373
|
-
impact: 'Empty flows are not functional'
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
// Activity validation
|
|
377
|
-
for (const activity of flow.activities) {
|
|
378
|
-
if (!activity.name) {
|
|
379
|
-
issues.push({
|
|
380
|
-
severity: 'error',
|
|
381
|
-
message: `Activity missing name`,
|
|
382
|
-
location: `Activity ${activity.type}`,
|
|
383
|
-
autoFixable: false,
|
|
384
|
-
impact: 'Activities must have names for identification'
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
if (!activity.type) {
|
|
388
|
-
issues.push({
|
|
389
|
-
severity: 'error',
|
|
390
|
-
message: `Activity missing type`,
|
|
391
|
-
location: activity.name,
|
|
392
|
-
autoFixable: false,
|
|
393
|
-
impact: 'Activity type determines functionality'
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
return {
|
|
398
|
-
passed: issues.filter(i => i.severity === 'error').length === 0,
|
|
399
|
-
issues,
|
|
400
|
-
autoFixApplied: false,
|
|
401
|
-
recommendations: issues.length === 0 ? ['Syntax validation passed'] : ['Fix syntax errors before proceeding']
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
async validateDependencies(flow) {
|
|
405
|
-
const issues = [];
|
|
406
|
-
// Check table dependencies
|
|
407
|
-
for (const activity of flow.activities) {
|
|
408
|
-
if ((activity.type === 'create_record' || activity.type === 'update_record') && activity.inputs.table) {
|
|
409
|
-
try {
|
|
410
|
-
const tableExists = await this.client.checkTableExists(activity.inputs.table);
|
|
411
|
-
if (!tableExists) {
|
|
412
|
-
issues.push({
|
|
413
|
-
severity: 'error',
|
|
414
|
-
message: `Table '${activity.inputs.table}' does not exist`,
|
|
415
|
-
location: activity.name,
|
|
416
|
-
autoFixable: false,
|
|
417
|
-
impact: 'Activity will fail at runtime'
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
catch (error) {
|
|
422
|
-
issues.push({
|
|
423
|
-
severity: 'warning',
|
|
424
|
-
message: `Could not verify table '${activity.inputs.table}'`,
|
|
425
|
-
location: activity.name,
|
|
426
|
-
autoFixable: false,
|
|
427
|
-
impact: 'May cause runtime errors'
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
return {
|
|
433
|
-
passed: issues.filter(i => i.severity === 'error').length === 0,
|
|
434
|
-
issues,
|
|
435
|
-
autoFixApplied: false,
|
|
436
|
-
recommendations: ['All dependencies validated successfully']
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
async validatePermissions(flow) {
|
|
440
|
-
const issues = [];
|
|
441
|
-
// Basic permission checks
|
|
442
|
-
if (flow.run_as === 'system') {
|
|
443
|
-
issues.push({
|
|
444
|
-
severity: 'warning',
|
|
445
|
-
message: 'Flow runs as system - consider using user context for security',
|
|
446
|
-
autoFixable: true,
|
|
447
|
-
impact: 'Potential security risk'
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
return {
|
|
451
|
-
passed: true,
|
|
452
|
-
issues,
|
|
453
|
-
autoFixApplied: false,
|
|
454
|
-
recommendations: ['Permission validation completed']
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
async performanceTest(flow) {
|
|
458
|
-
const issues = [];
|
|
459
|
-
// Performance heuristics
|
|
460
|
-
if (flow.activities.length > 15) {
|
|
461
|
-
issues.push({
|
|
462
|
-
severity: 'warning',
|
|
463
|
-
message: 'Flow has many activities - may impact performance',
|
|
464
|
-
autoFixable: false,
|
|
465
|
-
impact: 'Longer execution times'
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
return {
|
|
469
|
-
passed: true,
|
|
470
|
-
issues,
|
|
471
|
-
autoFixApplied: false,
|
|
472
|
-
recommendations: ['Performance test completed']
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
async integrationTest(flow) {
|
|
476
|
-
const issues = [];
|
|
477
|
-
// Integration test placeholder
|
|
478
|
-
return {
|
|
479
|
-
passed: true,
|
|
480
|
-
issues,
|
|
481
|
-
autoFixApplied: false,
|
|
482
|
-
recommendations: ['Integration test completed']
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
exports.FlowUpdateOrchestrator = FlowUpdateOrchestrator;
|
|
487
|
-
class FlowUpdateExecution {
|
|
488
|
-
constructor(plan, logger, client, memory) {
|
|
489
|
-
this.status = 'pending';
|
|
490
|
-
this.progress = 0;
|
|
491
|
-
this.plan = plan;
|
|
492
|
-
this.logger = logger;
|
|
493
|
-
this.client = client;
|
|
494
|
-
this.memory = memory;
|
|
495
|
-
}
|
|
496
|
-
async execute(options) {
|
|
497
|
-
this.status = 'running';
|
|
498
|
-
const startTime = Date.now();
|
|
499
|
-
try {
|
|
500
|
-
// Step 1: Create backup
|
|
501
|
-
this.progress = 10;
|
|
502
|
-
this.backupId = await this.createBackup();
|
|
503
|
-
// Step 2: Run validations
|
|
504
|
-
this.progress = 30;
|
|
505
|
-
const validationResults = await this.runValidations(options.skipValidation);
|
|
506
|
-
// Step 3: Execute update
|
|
507
|
-
this.progress = 60;
|
|
508
|
-
const updateResult = await this.executeUpdate(options.dryRun);
|
|
509
|
-
// Step 4: Post-update validation
|
|
510
|
-
this.progress = 80;
|
|
511
|
-
const testResults = await this.runPostUpdateTests();
|
|
512
|
-
// Step 5: Complete
|
|
513
|
-
this.progress = 100;
|
|
514
|
-
this.status = 'completed';
|
|
515
|
-
return {
|
|
516
|
-
success: true,
|
|
517
|
-
flowId: this.plan.flowId,
|
|
518
|
-
newVersion: this.plan.targetVersion.version,
|
|
519
|
-
executionTime: Date.now() - startTime,
|
|
520
|
-
rollbackPerformed: false,
|
|
521
|
-
validationResults,
|
|
522
|
-
testResults,
|
|
523
|
-
issues: [],
|
|
524
|
-
warnings: [],
|
|
525
|
-
metrics: {
|
|
526
|
-
stepsCompleted: 5,
|
|
527
|
-
totalSteps: 5,
|
|
528
|
-
downtime: this.plan.estimatedDowntime
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
catch (error) {
|
|
533
|
-
this.status = 'failed';
|
|
534
|
-
this.logger.error('❌ Update execution failed, initiating rollback', error);
|
|
535
|
-
const rollbackPerformed = await this.performRollback();
|
|
536
|
-
return {
|
|
537
|
-
success: false,
|
|
538
|
-
flowId: this.plan.flowId,
|
|
539
|
-
executionTime: Date.now() - startTime,
|
|
540
|
-
rollbackPerformed,
|
|
541
|
-
validationResults: [],
|
|
542
|
-
testResults: [],
|
|
543
|
-
issues: [error instanceof Error ? error.message : String(error)],
|
|
544
|
-
warnings: [],
|
|
545
|
-
metrics: {
|
|
546
|
-
stepsCompleted: Math.floor(this.progress / 20),
|
|
547
|
-
totalSteps: 5,
|
|
548
|
-
downtime: rollbackPerformed ? this.plan.estimatedDowntime * 2 : 0
|
|
549
|
-
}
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
async cancel() {
|
|
554
|
-
this.status = 'cancelled';
|
|
555
|
-
await this.performRollback();
|
|
556
|
-
}
|
|
557
|
-
async emergencyRollback() {
|
|
558
|
-
await this.performRollback();
|
|
559
|
-
}
|
|
560
|
-
getStatus() {
|
|
561
|
-
return this.status;
|
|
562
|
-
}
|
|
563
|
-
getProgress() {
|
|
564
|
-
return this.progress;
|
|
565
|
-
}
|
|
566
|
-
async createBackup() {
|
|
567
|
-
const backupId = `flow_backup_${this.plan.flowId}_${Date.now()}`;
|
|
568
|
-
await this.memory.store(backupId, this.plan.currentVersion, 86400000); // 24 hours
|
|
569
|
-
return backupId;
|
|
570
|
-
}
|
|
571
|
-
async runValidations(skip) {
|
|
572
|
-
if (skip) {
|
|
573
|
-
return [];
|
|
574
|
-
}
|
|
575
|
-
const results = [];
|
|
576
|
-
for (const step of this.plan.validationSteps) {
|
|
577
|
-
if (step.required || !skip) {
|
|
578
|
-
const result = await step.validator(this.plan.targetVersion.definition);
|
|
579
|
-
results.push(result);
|
|
580
|
-
if (!result.passed && step.required) {
|
|
581
|
-
throw new Error(`Required validation failed: ${step.name}`);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
return results;
|
|
586
|
-
}
|
|
587
|
-
async executeUpdate(dryRun) {
|
|
588
|
-
if (dryRun) {
|
|
589
|
-
this.logger.info('🔍 Dry run - skipping actual update');
|
|
590
|
-
return { success: true, message: 'Dry run completed' };
|
|
591
|
-
}
|
|
592
|
-
// Update the flow
|
|
593
|
-
const result = await this.client.updateFlow(this.plan.flowId, this.plan.targetVersion.definition);
|
|
594
|
-
if (!result.success) {
|
|
595
|
-
throw new Error(`Flow update failed: ${result.error}`);
|
|
596
|
-
}
|
|
597
|
-
return result;
|
|
598
|
-
}
|
|
599
|
-
async runPostUpdateTests() {
|
|
600
|
-
// Basic connectivity test
|
|
601
|
-
const testResults = [];
|
|
602
|
-
try {
|
|
603
|
-
const flow = await this.client.getFlow(this.plan.flowId);
|
|
604
|
-
testResults.push({
|
|
605
|
-
testName: 'Flow Accessibility Test',
|
|
606
|
-
passed: flow.success,
|
|
607
|
-
executionTime: 1000,
|
|
608
|
-
details: flow.success ? 'Flow is accessible' : 'Flow not accessible'
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
catch (error) {
|
|
612
|
-
testResults.push({
|
|
613
|
-
testName: 'Flow Accessibility Test',
|
|
614
|
-
passed: false,
|
|
615
|
-
executionTime: 1000,
|
|
616
|
-
details: `Test failed: ${error}`
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
return testResults;
|
|
620
|
-
}
|
|
621
|
-
async performRollback() {
|
|
622
|
-
try {
|
|
623
|
-
if (!this.backupId) {
|
|
624
|
-
this.logger.error('❌ No backup available for rollback');
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
this.logger.info('🔄 Performing rollback to previous version');
|
|
628
|
-
const backup = await this.memory.get(this.backupId);
|
|
629
|
-
if (!backup) {
|
|
630
|
-
throw new Error('Backup not found');
|
|
631
|
-
}
|
|
632
|
-
const result = await this.client.updateFlow(this.plan.flowId, backup.definition);
|
|
633
|
-
if (result.success) {
|
|
634
|
-
this.logger.info('✅ Rollback completed successfully');
|
|
635
|
-
return true;
|
|
636
|
-
}
|
|
637
|
-
else {
|
|
638
|
-
this.logger.error('❌ Rollback failed', result.error);
|
|
639
|
-
return false;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
catch (error) {
|
|
643
|
-
this.logger.error('❌ Rollback operation failed', error);
|
|
644
|
-
return false;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
exports.default = FlowUpdateOrchestrator;
|