snow-flow 1.1.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.
- package/.env.example +49 -0
- package/.mcp.json +106 -0
- package/.mcp.json.template +106 -0
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/bin/snow-flow +4 -0
- package/bin/snow-flow.js +3 -0
- package/claude-flow +79 -0
- package/claude-flow.bat +18 -0
- package/claude-flow.config.json +20 -0
- package/claude-flow.ps1 +24 -0
- package/dist/agents/app-creator.agent.d.ts +55 -0
- package/dist/agents/app-creator.agent.d.ts.map +1 -0
- package/dist/agents/app-creator.agent.js +1292 -0
- package/dist/agents/app-creator.agent.js.map +1 -0
- package/dist/agents/base-snow-agent.d.ts +63 -0
- package/dist/agents/base-snow-agent.d.ts.map +1 -0
- package/dist/agents/base-snow-agent.js +296 -0
- package/dist/agents/base-snow-agent.js.map +1 -0
- package/dist/agents/script-generator.agent.d.ts +32 -0
- package/dist/agents/script-generator.agent.d.ts.map +1 -0
- package/dist/agents/script-generator.agent.js +772 -0
- package/dist/agents/script-generator.agent.js.map +1 -0
- package/dist/agents/ui-builder.agent.d.ts +50 -0
- package/dist/agents/ui-builder.agent.d.ts.map +1 -0
- package/dist/agents/ui-builder.agent.js +1539 -0
- package/dist/agents/ui-builder.agent.js.map +1 -0
- package/dist/agents/widget-builder.agent.d.ts +32 -0
- package/dist/agents/widget-builder.agent.d.ts.map +1 -0
- package/dist/agents/widget-builder.agent.js +439 -0
- package/dist/agents/widget-builder.agent.js.map +1 -0
- package/dist/agents/workflow-designer.agent.d.ts +31 -0
- package/dist/agents/workflow-designer.agent.d.ts.map +1 -0
- package/dist/agents/workflow-designer.agent.js +583 -0
- package/dist/agents/workflow-designer.agent.js.map +1 -0
- package/dist/api/error-handling.d.ts +214 -0
- package/dist/api/error-handling.d.ts.map +1 -0
- package/dist/api/error-handling.js +594 -0
- package/dist/api/error-handling.js.map +1 -0
- package/dist/api/flow-designer-api.d.ts +167 -0
- package/dist/api/flow-designer-api.d.ts.map +1 -0
- package/dist/api/flow-designer-api.js +555 -0
- package/dist/api/flow-designer-api.js.map +1 -0
- package/dist/api/natural-language-mapper.d.ts +126 -0
- package/dist/api/natural-language-mapper.d.ts.map +1 -0
- package/dist/api/natural-language-mapper.js +498 -0
- package/dist/api/natural-language-mapper.js.map +1 -0
- package/dist/api/performance-optimizer.d.ts +240 -0
- package/dist/api/performance-optimizer.d.ts.map +1 -0
- package/dist/api/performance-optimizer.js +701 -0
- package/dist/api/performance-optimizer.js.map +1 -0
- package/dist/api/transaction-manager.d.ts +189 -0
- package/dist/api/transaction-manager.d.ts.map +1 -0
- package/dist/api/transaction-manager.js +576 -0
- package/dist/api/transaction-manager.js.map +1 -0
- package/dist/cli/deploy-artifact.d.ts +7 -0
- package/dist/cli/deploy-artifact.d.ts.map +1 -0
- package/dist/cli/deploy-artifact.js +279 -0
- package/dist/cli/deploy-artifact.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2057 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/managers/scope-manager.d.ts +75 -0
- package/dist/managers/scope-manager.d.ts.map +1 -0
- package/dist/managers/scope-manager.js +448 -0
- package/dist/managers/scope-manager.js.map +1 -0
- package/dist/mcp/mcp-wrapper.d.ts +8 -0
- package/dist/mcp/mcp-wrapper.d.ts.map +1 -0
- package/dist/mcp/mcp-wrapper.js +77 -0
- package/dist/mcp/mcp-wrapper.js.map +1 -0
- package/dist/mcp/servicenow-automation-mcp.d.ts +8 -0
- package/dist/mcp/servicenow-automation-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-automation-mcp.js +683 -0
- package/dist/mcp/servicenow-automation-mcp.js.map +1 -0
- package/dist/mcp/servicenow-deployment-mcp.d.ts +7 -0
- package/dist/mcp/servicenow-deployment-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-deployment-mcp.js +972 -0
- package/dist/mcp/servicenow-deployment-mcp.js.map +1 -0
- package/dist/mcp/servicenow-flow-composer-mcp.d.ts +7 -0
- package/dist/mcp/servicenow-flow-composer-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-flow-composer-mcp.js +1121 -0
- package/dist/mcp/servicenow-flow-composer-mcp.js.map +1 -0
- package/dist/mcp/servicenow-graph-memory-mcp.d.ts +7 -0
- package/dist/mcp/servicenow-graph-memory-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-graph-memory-mcp.js +703 -0
- package/dist/mcp/servicenow-graph-memory-mcp.js.map +1 -0
- package/dist/mcp/servicenow-integration-mcp.d.ts +8 -0
- package/dist/mcp/servicenow-integration-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-integration-mcp.js +689 -0
- package/dist/mcp/servicenow-integration-mcp.js.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp.d.ts +7 -0
- package/dist/mcp/servicenow-intelligent-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp.js +1138 -0
- package/dist/mcp/servicenow-intelligent-mcp.js.map +1 -0
- package/dist/mcp/servicenow-mcp-server.d.ts +37 -0
- package/dist/mcp/servicenow-mcp-server.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-server.js +648 -0
- package/dist/mcp/servicenow-mcp-server.js.map +1 -0
- package/dist/mcp/servicenow-operations-mcp.d.ts +15 -0
- package/dist/mcp/servicenow-operations-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-operations-mcp.js +1287 -0
- package/dist/mcp/servicenow-operations-mcp.js.map +1 -0
- package/dist/mcp/servicenow-platform-development-mcp.d.ts +8 -0
- package/dist/mcp/servicenow-platform-development-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-platform-development-mcp.js +557 -0
- package/dist/mcp/servicenow-platform-development-mcp.js.map +1 -0
- package/dist/mcp/servicenow-progressive-indexer.d.ts +79 -0
- package/dist/mcp/servicenow-progressive-indexer.d.ts.map +1 -0
- package/dist/mcp/servicenow-progressive-indexer.js +320 -0
- package/dist/mcp/servicenow-progressive-indexer.js.map +1 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.d.ts +8 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.js +888 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.js.map +1 -0
- package/dist/mcp/servicenow-security-compliance-mcp.d.ts +8 -0
- package/dist/mcp/servicenow-security-compliance-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-security-compliance-mcp.js +812 -0
- package/dist/mcp/servicenow-security-compliance-mcp.js.map +1 -0
- package/dist/mcp/servicenow-update-set-mcp.d.ts +7 -0
- package/dist/mcp/servicenow-update-set-mcp.d.ts.map +1 -0
- package/dist/mcp/servicenow-update-set-mcp.js +599 -0
- package/dist/mcp/servicenow-update-set-mcp.js.map +1 -0
- package/dist/mcp/start-all-mcp-servers.d.ts +6 -0
- package/dist/mcp/start-all-mcp-servers.d.ts.map +1 -0
- package/dist/mcp/start-all-mcp-servers.js +65 -0
- package/dist/mcp/start-all-mcp-servers.js.map +1 -0
- package/dist/mcp/start-servicenow-mcp.d.ts +7 -0
- package/dist/mcp/start-servicenow-mcp.d.ts.map +1 -0
- package/dist/mcp/start-servicenow-mcp.js +64 -0
- package/dist/mcp/start-servicenow-mcp.js.map +1 -0
- package/dist/mcp/test-simple-mcp.d.ts +6 -0
- package/dist/mcp/test-simple-mcp.d.ts.map +1 -0
- package/dist/mcp/test-simple-mcp.js +64 -0
- package/dist/mcp/test-simple-mcp.js.map +1 -0
- package/dist/orchestrator/flow-composer.d.ts +269 -0
- package/dist/orchestrator/flow-composer.d.ts.map +1 -0
- package/dist/orchestrator/flow-composer.js +2221 -0
- package/dist/orchestrator/flow-composer.js.map +1 -0
- package/dist/orchestrator/flow-pattern-templates.d.ts +260 -0
- package/dist/orchestrator/flow-pattern-templates.d.ts.map +1 -0
- package/dist/orchestrator/flow-pattern-templates.js +906 -0
- package/dist/orchestrator/flow-pattern-templates.js.map +1 -0
- package/dist/orchestrator/flow-subflow-decision-engine.d.ts +202 -0
- package/dist/orchestrator/flow-subflow-decision-engine.d.ts.map +1 -0
- package/dist/orchestrator/flow-subflow-decision-engine.js +769 -0
- package/dist/orchestrator/flow-subflow-decision-engine.js.map +1 -0
- package/dist/orchestrator/flow-validation-engine.d.ts +145 -0
- package/dist/orchestrator/flow-validation-engine.d.ts.map +1 -0
- package/dist/orchestrator/flow-validation-engine.js +663 -0
- package/dist/orchestrator/flow-validation-engine.js.map +1 -0
- package/dist/orchestrator/snow-orchestrator.d.ts +49 -0
- package/dist/orchestrator/snow-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/snow-orchestrator.js +235 -0
- package/dist/orchestrator/snow-orchestrator.js.map +1 -0
- package/dist/orchestrator/subflow-creation-handler.d.ts +230 -0
- package/dist/orchestrator/subflow-creation-handler.d.ts.map +1 -0
- package/dist/orchestrator/subflow-creation-handler.js +791 -0
- package/dist/orchestrator/subflow-creation-handler.js.map +1 -0
- package/dist/strategies/global-scope-strategy.d.ts +123 -0
- package/dist/strategies/global-scope-strategy.d.ts.map +1 -0
- package/dist/strategies/global-scope-strategy.js +585 -0
- package/dist/strategies/global-scope-strategy.js.map +1 -0
- package/dist/types/index.d.ts +138 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/servicenow.types.d.ts +260 -0
- package/dist/types/servicenow.types.d.ts.map +1 -0
- package/dist/types/servicenow.types.js +3 -0
- package/dist/types/servicenow.types.js.map +1 -0
- package/dist/types/snow-flow.types.d.ts +114 -0
- package/dist/types/snow-flow.types.d.ts.map +1 -0
- package/dist/types/snow-flow.types.js +3 -0
- package/dist/types/snow-flow.types.js.map +1 -0
- package/dist/utils/action-type-cache.d.ts +66 -0
- package/dist/utils/action-type-cache.d.ts.map +1 -0
- package/dist/utils/action-type-cache.js +237 -0
- package/dist/utils/action-type-cache.js.map +1 -0
- package/dist/utils/agent-detector.d.ts +35 -0
- package/dist/utils/agent-detector.d.ts.map +1 -0
- package/dist/utils/agent-detector.js +353 -0
- package/dist/utils/agent-detector.js.map +1 -0
- package/dist/utils/flow-api-discovery.d.ts +151 -0
- package/dist/utils/flow-api-discovery.d.ts.map +1 -0
- package/dist/utils/flow-api-discovery.js +440 -0
- package/dist/utils/flow-api-discovery.js.map +1 -0
- package/dist/utils/flow-xml-generator.d.ts +41 -0
- package/dist/utils/flow-xml-generator.d.ts.map +1 -0
- package/dist/utils/flow-xml-generator.js +258 -0
- package/dist/utils/flow-xml-generator.js.map +1 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +51 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mcp-auth-middleware.d.ts +58 -0
- package/dist/utils/mcp-auth-middleware.d.ts.map +1 -0
- package/dist/utils/mcp-auth-middleware.js +227 -0
- package/dist/utils/mcp-auth-middleware.js.map +1 -0
- package/dist/utils/mcp-config-manager.d.ts +126 -0
- package/dist/utils/mcp-config-manager.d.ts.map +1 -0
- package/dist/utils/mcp-config-manager.js +209 -0
- package/dist/utils/mcp-config-manager.js.map +1 -0
- package/dist/utils/mcp-server-manager.d.ts +91 -0
- package/dist/utils/mcp-server-manager.d.ts.map +1 -0
- package/dist/utils/mcp-server-manager.js +338 -0
- package/dist/utils/mcp-server-manager.js.map +1 -0
- package/dist/utils/scope-utils.d.ts +72 -0
- package/dist/utils/scope-utils.d.ts.map +1 -0
- package/dist/utils/scope-utils.js +386 -0
- package/dist/utils/scope-utils.js.map +1 -0
- package/dist/utils/servicenow-client.d.ts +233 -0
- package/dist/utils/servicenow-client.d.ts.map +1 -0
- package/dist/utils/servicenow-client.js +1465 -0
- package/dist/utils/servicenow-client.js.map +1 -0
- package/dist/utils/snow-oauth-old.d.ts +65 -0
- package/dist/utils/snow-oauth-old.d.ts.map +1 -0
- package/dist/utils/snow-oauth-old.js +345 -0
- package/dist/utils/snow-oauth-old.js.map +1 -0
- package/dist/utils/snow-oauth.d.ts +85 -0
- package/dist/utils/snow-oauth.d.ts.map +1 -0
- package/dist/utils/snow-oauth.js +512 -0
- package/dist/utils/snow-oauth.js.map +1 -0
- package/dist/utils/template-engine.d.ts +76 -0
- package/dist/utils/template-engine.d.ts.map +1 -0
- package/dist/utils/template-engine.js +391 -0
- package/dist/utils/template-engine.js.map +1 -0
- package/dist/version.d.ts +35 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +72 -0
- package/dist/version.js.map +1 -0
- package/mcp-wrapper.sh +12 -0
- package/package.json +77 -0
- package/reports/swarm-auto-centralized-1752649029776.json +13 -0
- package/scripts/postinstall.js +30 -0
- package/scripts/setup-mcp.js +89 -0
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ServiceNow Flow Pattern Templates
|
|
4
|
+
*
|
|
5
|
+
* This module provides a comprehensive collection of flow pattern templates
|
|
6
|
+
* for common ServiceNow scenarios, helping users create consistent and
|
|
7
|
+
* well-structured flows and subflows.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FlowPatternTemplates = void 0;
|
|
11
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
12
|
+
const flow_subflow_decision_engine_js_1 = require("./flow-subflow-decision-engine.js");
|
|
13
|
+
/**
|
|
14
|
+
* Flow Pattern Templates Manager
|
|
15
|
+
*/
|
|
16
|
+
class FlowPatternTemplates {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.templates = new Map();
|
|
19
|
+
this.subflowTemplates = new Map();
|
|
20
|
+
this.patterns = [];
|
|
21
|
+
this.logger = new logger_js_1.Logger('FlowPatternTemplates');
|
|
22
|
+
this.initializeTemplates();
|
|
23
|
+
this.initializePatterns();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Find matching templates based on natural language instruction
|
|
27
|
+
*/
|
|
28
|
+
findMatchingTemplates(instruction) {
|
|
29
|
+
this.logger.info('Finding matching templates', { instruction });
|
|
30
|
+
const results = [];
|
|
31
|
+
const lowerInstruction = instruction.toLowerCase();
|
|
32
|
+
for (const [id, template] of this.templates) {
|
|
33
|
+
const matchResult = this.matchTemplate(template, lowerInstruction, instruction);
|
|
34
|
+
if (matchResult.confidence > 0.3) {
|
|
35
|
+
results.push(matchResult);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Sort by confidence score
|
|
39
|
+
results.sort((a, b) => b.confidence - a.confidence);
|
|
40
|
+
this.logger.info('Found matching templates', { count: results.length });
|
|
41
|
+
return results;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get template by ID
|
|
45
|
+
*/
|
|
46
|
+
getTemplate(id) {
|
|
47
|
+
return this.templates.get(id);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get all templates by category
|
|
51
|
+
*/
|
|
52
|
+
getTemplatesByCategory(category) {
|
|
53
|
+
return Array.from(this.templates.values()).filter(template => template.category === category);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get all templates by context
|
|
57
|
+
*/
|
|
58
|
+
getTemplatesByContext(context) {
|
|
59
|
+
return Array.from(this.templates.values()).filter(template => template.context === context);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get recommended templates for a specific complexity level
|
|
63
|
+
*/
|
|
64
|
+
getTemplatesByComplexity(complexity) {
|
|
65
|
+
return Array.from(this.templates.values()).filter(template => template.complexity === complexity);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get all available templates
|
|
69
|
+
*/
|
|
70
|
+
getAllTemplates() {
|
|
71
|
+
return Array.from(this.templates.values());
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get subflow candidates from a template
|
|
75
|
+
*/
|
|
76
|
+
getSubflowCandidates(template) {
|
|
77
|
+
return template.activities.filter(activity => activity.isSubflowCandidate);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Generate flow from template
|
|
81
|
+
*/
|
|
82
|
+
generateFlowFromTemplate(template, customizations = {}) {
|
|
83
|
+
this.logger.info('Generating flow from template', {
|
|
84
|
+
templateId: template.id,
|
|
85
|
+
customizations: Object.keys(customizations)
|
|
86
|
+
});
|
|
87
|
+
const flowDefinition = {
|
|
88
|
+
name: customizations.name || template.name,
|
|
89
|
+
description: customizations.description || template.description,
|
|
90
|
+
category: template.category,
|
|
91
|
+
active: true,
|
|
92
|
+
// Apply trigger template
|
|
93
|
+
trigger: this.applyTriggerTemplate(template.triggers[0], customizations),
|
|
94
|
+
// Apply activity templates
|
|
95
|
+
activities: template.activities.map(activityTemplate => this.applyActivityTemplate(activityTemplate, customizations)),
|
|
96
|
+
// Apply connection templates
|
|
97
|
+
connections: template.connections.map(connectionTemplate => this.applyConnectionTemplate(connectionTemplate, customizations)),
|
|
98
|
+
// Apply variable templates
|
|
99
|
+
variables: template.variables.map(variableTemplate => this.applyVariableTemplate(variableTemplate, customizations)),
|
|
100
|
+
// Metadata
|
|
101
|
+
metadata: {
|
|
102
|
+
templateId: template.id,
|
|
103
|
+
templateVersion: template.version,
|
|
104
|
+
customizations: customizations,
|
|
105
|
+
generatedAt: new Date().toISOString()
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
return flowDefinition;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Match template against instruction
|
|
112
|
+
*/
|
|
113
|
+
matchTemplate(template, lowerInstruction, originalInstruction) {
|
|
114
|
+
let confidence = 0;
|
|
115
|
+
const matchingReasons = [];
|
|
116
|
+
const customizationSuggestions = [];
|
|
117
|
+
const subflowRecommendations = [];
|
|
118
|
+
// Keywords matching
|
|
119
|
+
const keywordMatches = template.tags.filter(tag => lowerInstruction.includes(tag.toLowerCase()));
|
|
120
|
+
if (keywordMatches.length > 0) {
|
|
121
|
+
confidence += 0.3 * (keywordMatches.length / template.tags.length);
|
|
122
|
+
matchingReasons.push(`Keywords match: ${keywordMatches.join(', ')}`);
|
|
123
|
+
}
|
|
124
|
+
// Context matching
|
|
125
|
+
const contextKeywords = this.getContextKeywords(template.context);
|
|
126
|
+
const contextMatches = contextKeywords.filter(keyword => lowerInstruction.includes(keyword));
|
|
127
|
+
if (contextMatches.length > 0) {
|
|
128
|
+
confidence += 0.4;
|
|
129
|
+
matchingReasons.push(`Context match: ${template.context}`);
|
|
130
|
+
}
|
|
131
|
+
// Use case matching
|
|
132
|
+
const useCaseMatches = template.useCases.filter(useCase => lowerInstruction.includes(useCase.toLowerCase()));
|
|
133
|
+
if (useCaseMatches.length > 0) {
|
|
134
|
+
confidence += 0.2;
|
|
135
|
+
matchingReasons.push(`Use case match: ${useCaseMatches.join(', ')}`);
|
|
136
|
+
}
|
|
137
|
+
// Activity type matching
|
|
138
|
+
const activityMatches = template.activities.filter(activity => lowerInstruction.includes(activity.type.toLowerCase()) ||
|
|
139
|
+
lowerInstruction.includes(activity.name.toLowerCase()));
|
|
140
|
+
if (activityMatches.length > 0) {
|
|
141
|
+
confidence += 0.1;
|
|
142
|
+
matchingReasons.push(`Activity match: ${activityMatches.map(a => a.name).join(', ')}`);
|
|
143
|
+
}
|
|
144
|
+
// Generate customization suggestions
|
|
145
|
+
if (confidence > 0.5) {
|
|
146
|
+
customizationSuggestions.push(...this.generateCustomizationSuggestions(template, originalInstruction));
|
|
147
|
+
}
|
|
148
|
+
// Generate subflow recommendations
|
|
149
|
+
const subflowCandidates = this.getSubflowCandidates(template);
|
|
150
|
+
if (subflowCandidates.length > 0) {
|
|
151
|
+
subflowRecommendations.push(...subflowCandidates.map(candidate => `Consider creating ${candidate.name} as a reusable subflow`));
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
template,
|
|
155
|
+
confidence: Math.min(confidence, 1.0),
|
|
156
|
+
matchingReasons,
|
|
157
|
+
customizationSuggestions,
|
|
158
|
+
subflowRecommendations
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get context keywords for matching
|
|
163
|
+
*/
|
|
164
|
+
getContextKeywords(context) {
|
|
165
|
+
const keywords = {
|
|
166
|
+
[flow_subflow_decision_engine_js_1.FlowContext.APPROVAL_WORKFLOW]: ['approval', 'approve', 'reject', 'escalate'],
|
|
167
|
+
[flow_subflow_decision_engine_js_1.FlowContext.FULFILLMENT_WORKFLOW]: ['fulfillment', 'order', 'catalog', 'request'],
|
|
168
|
+
[flow_subflow_decision_engine_js_1.FlowContext.NOTIFICATION_WORKFLOW]: ['notification', 'email', 'alert', 'message'],
|
|
169
|
+
[flow_subflow_decision_engine_js_1.FlowContext.INTEGRATION_WORKFLOW]: ['integration', 'api', 'external', 'sync'],
|
|
170
|
+
[flow_subflow_decision_engine_js_1.FlowContext.UTILITY_WORKFLOW]: ['utility', 'helper', 'common', 'shared'],
|
|
171
|
+
[flow_subflow_decision_engine_js_1.FlowContext.BUSINESS_LOGIC]: ['business', 'rule', 'policy', 'validation']
|
|
172
|
+
};
|
|
173
|
+
return keywords[context] || [];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Generate customization suggestions
|
|
177
|
+
*/
|
|
178
|
+
generateCustomizationSuggestions(template, instruction) {
|
|
179
|
+
const suggestions = [];
|
|
180
|
+
// Check for specific entities mentioned in instruction
|
|
181
|
+
if (instruction.includes('iPhone')) {
|
|
182
|
+
suggestions.push('Customize for iPhone-specific catalog items');
|
|
183
|
+
}
|
|
184
|
+
if (instruction.includes('admin')) {
|
|
185
|
+
suggestions.push('Configure admin-specific assignment rules');
|
|
186
|
+
}
|
|
187
|
+
if (instruction.includes('manager')) {
|
|
188
|
+
suggestions.push('Set up manager approval hierarchy');
|
|
189
|
+
}
|
|
190
|
+
// Check customization points
|
|
191
|
+
for (const point of template.customizationPoints) {
|
|
192
|
+
if (point.impact === 'high') {
|
|
193
|
+
suggestions.push(`Configure ${point.name}: ${point.description}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return suggestions;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Apply trigger template
|
|
200
|
+
*/
|
|
201
|
+
applyTriggerTemplate(triggerTemplate, customizations) {
|
|
202
|
+
return {
|
|
203
|
+
type: customizations.triggerType || triggerTemplate.type,
|
|
204
|
+
table: customizations.table || triggerTemplate.table,
|
|
205
|
+
condition: customizations.condition || triggerTemplate.condition,
|
|
206
|
+
schedule: customizations.schedule || triggerTemplate.schedule,
|
|
207
|
+
configuration: {
|
|
208
|
+
...triggerTemplate.configuration,
|
|
209
|
+
...customizations.triggerConfiguration
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Apply activity template
|
|
215
|
+
*/
|
|
216
|
+
applyActivityTemplate(activityTemplate, customizations) {
|
|
217
|
+
const activityCustomizations = customizations.activities?.[activityTemplate.id] || {};
|
|
218
|
+
return {
|
|
219
|
+
id: activityTemplate.id,
|
|
220
|
+
name: activityCustomizations.name || activityTemplate.name,
|
|
221
|
+
type: activityCustomizations.type || activityTemplate.type,
|
|
222
|
+
label: activityCustomizations.label || activityTemplate.label,
|
|
223
|
+
description: activityCustomizations.description || activityTemplate.description,
|
|
224
|
+
inputs: activityTemplate.inputs.map(input => ({
|
|
225
|
+
name: input.name,
|
|
226
|
+
type: input.type,
|
|
227
|
+
required: input.required,
|
|
228
|
+
value: activityCustomizations.inputs?.[input.name] ||
|
|
229
|
+
this.resolveInputValue(input, customizations)
|
|
230
|
+
})),
|
|
231
|
+
outputs: activityTemplate.outputs.map(output => ({
|
|
232
|
+
name: output.name,
|
|
233
|
+
type: output.type,
|
|
234
|
+
description: output.description
|
|
235
|
+
})),
|
|
236
|
+
configuration: {
|
|
237
|
+
...activityTemplate.configuration,
|
|
238
|
+
...activityCustomizations.configuration
|
|
239
|
+
},
|
|
240
|
+
position: activityTemplate.position,
|
|
241
|
+
errorHandling: activityTemplate.errorHandling
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Apply connection template
|
|
246
|
+
*/
|
|
247
|
+
applyConnectionTemplate(connectionTemplate, customizations) {
|
|
248
|
+
const connectionCustomizations = customizations.connections?.[connectionTemplate.id] || {};
|
|
249
|
+
return {
|
|
250
|
+
id: connectionTemplate.id,
|
|
251
|
+
from: connectionTemplate.from,
|
|
252
|
+
to: connectionTemplate.to,
|
|
253
|
+
label: connectionCustomizations.label || connectionTemplate.label,
|
|
254
|
+
condition: connectionCustomizations.condition || connectionTemplate.condition,
|
|
255
|
+
conditionType: connectionTemplate.conditionType
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Apply variable template
|
|
260
|
+
*/
|
|
261
|
+
applyVariableTemplate(variableTemplate, customizations) {
|
|
262
|
+
const variableCustomizations = customizations.variables?.[variableTemplate.name] || {};
|
|
263
|
+
return {
|
|
264
|
+
name: variableTemplate.name,
|
|
265
|
+
type: variableTemplate.type,
|
|
266
|
+
description: variableTemplate.description,
|
|
267
|
+
defaultValue: variableCustomizations.defaultValue || variableTemplate.defaultValue,
|
|
268
|
+
scope: variableTemplate.scope,
|
|
269
|
+
category: variableTemplate.category
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Resolve input value based on source type
|
|
274
|
+
*/
|
|
275
|
+
resolveInputValue(input, customizations) {
|
|
276
|
+
switch (input.sourceType) {
|
|
277
|
+
case 'trigger':
|
|
278
|
+
return `\${trigger.${input.sourceReference || input.name}}`;
|
|
279
|
+
case 'variable':
|
|
280
|
+
return `\${flow.${input.sourceReference || input.name}}`;
|
|
281
|
+
case 'previous_activity':
|
|
282
|
+
return `\${${input.sourceReference}.${input.name}}`;
|
|
283
|
+
case 'constant':
|
|
284
|
+
return customizations.constants?.[input.name] || input.defaultValue;
|
|
285
|
+
default:
|
|
286
|
+
return input.defaultValue;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Initialize flow templates
|
|
291
|
+
*/
|
|
292
|
+
initializeTemplates() {
|
|
293
|
+
// iPhone 6 Approval and Fulfillment Template
|
|
294
|
+
this.templates.set('iphone-approval-fulfillment', {
|
|
295
|
+
id: 'iphone-approval-fulfillment',
|
|
296
|
+
name: 'iPhone 6 Approval and Fulfillment',
|
|
297
|
+
description: 'Complete workflow for iPhone 6 catalog requests with approval and fulfillment',
|
|
298
|
+
category: 'Catalog Management',
|
|
299
|
+
context: flow_subflow_decision_engine_js_1.FlowContext.FULFILLMENT_WORKFLOW,
|
|
300
|
+
recommendedType: flow_subflow_decision_engine_js_1.FlowType.MAIN_FLOW,
|
|
301
|
+
complexity: flow_subflow_decision_engine_js_1.ComplexityLevel.HIGH,
|
|
302
|
+
reusability: flow_subflow_decision_engine_js_1.ReusabilityLevel.MEDIUM,
|
|
303
|
+
triggers: [{
|
|
304
|
+
id: 'catalog_request_trigger',
|
|
305
|
+
type: 'record_created',
|
|
306
|
+
table: 'sc_req_item',
|
|
307
|
+
condition: 'cat_item.name=iPhone 6',
|
|
308
|
+
description: 'Trigger when iPhone 6 catalog item is requested',
|
|
309
|
+
configuration: {
|
|
310
|
+
filter: 'cat_item.name=iPhone 6',
|
|
311
|
+
active: true
|
|
312
|
+
}
|
|
313
|
+
}],
|
|
314
|
+
activities: [
|
|
315
|
+
{
|
|
316
|
+
id: 'approval_check',
|
|
317
|
+
name: 'Manager Approval',
|
|
318
|
+
type: 'approval',
|
|
319
|
+
label: 'Manager Approval',
|
|
320
|
+
description: 'Get manager approval for iPhone 6 request',
|
|
321
|
+
category: 'Approval',
|
|
322
|
+
isSubflowCandidate: true,
|
|
323
|
+
reusabilityScore: 8,
|
|
324
|
+
inputs: [
|
|
325
|
+
{
|
|
326
|
+
name: 'record',
|
|
327
|
+
type: 'reference',
|
|
328
|
+
required: true,
|
|
329
|
+
description: 'Catalog request record',
|
|
330
|
+
sourceType: 'trigger',
|
|
331
|
+
sourceReference: 'current'
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: 'approver',
|
|
335
|
+
type: 'reference',
|
|
336
|
+
required: true,
|
|
337
|
+
description: 'Manager to approve request',
|
|
338
|
+
sourceType: 'trigger',
|
|
339
|
+
sourceReference: 'current.requested_for.manager'
|
|
340
|
+
}
|
|
341
|
+
],
|
|
342
|
+
outputs: [
|
|
343
|
+
{
|
|
344
|
+
name: 'approval_state',
|
|
345
|
+
type: 'string',
|
|
346
|
+
description: 'Approval result (approved/rejected)',
|
|
347
|
+
usedByActivities: ['fulfillment_check'],
|
|
348
|
+
isFlowOutput: false
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
configuration: {
|
|
352
|
+
approval_type: 'manager',
|
|
353
|
+
timeout: '48 hours'
|
|
354
|
+
},
|
|
355
|
+
errorHandling: [{
|
|
356
|
+
condition: 'timeout',
|
|
357
|
+
action: 'notify',
|
|
358
|
+
parameters: { escalation_group: 'catalog_admins' },
|
|
359
|
+
description: 'Notify admins on approval timeout'
|
|
360
|
+
}],
|
|
361
|
+
position: { x: 200, y: 100 },
|
|
362
|
+
dependencies: [],
|
|
363
|
+
prerequisites: []
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
id: 'fulfillment_check',
|
|
367
|
+
name: 'Fulfillment Decision',
|
|
368
|
+
type: 'condition',
|
|
369
|
+
label: 'Check Approval',
|
|
370
|
+
description: 'Check if request was approved',
|
|
371
|
+
category: 'Decision',
|
|
372
|
+
isSubflowCandidate: false,
|
|
373
|
+
reusabilityScore: 3,
|
|
374
|
+
inputs: [
|
|
375
|
+
{
|
|
376
|
+
name: 'approval_state',
|
|
377
|
+
type: 'string',
|
|
378
|
+
required: true,
|
|
379
|
+
description: 'Approval state from previous step',
|
|
380
|
+
sourceType: 'previous_activity',
|
|
381
|
+
sourceReference: 'approval_check'
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
outputs: [
|
|
385
|
+
{
|
|
386
|
+
name: 'proceed_to_fulfillment',
|
|
387
|
+
type: 'boolean',
|
|
388
|
+
description: 'Whether to proceed with fulfillment',
|
|
389
|
+
usedByActivities: ['admin_task', 'user_task'],
|
|
390
|
+
isFlowOutput: false
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
configuration: {
|
|
394
|
+
condition: 'approval_state=approved'
|
|
395
|
+
},
|
|
396
|
+
errorHandling: [],
|
|
397
|
+
position: { x: 400, y: 100 },
|
|
398
|
+
dependencies: ['approval_check'],
|
|
399
|
+
prerequisites: []
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: 'admin_task',
|
|
403
|
+
name: 'Create Admin Task',
|
|
404
|
+
type: 'create_task',
|
|
405
|
+
label: 'Admin Preparation',
|
|
406
|
+
description: 'Create task for admin to prepare iPhone 6',
|
|
407
|
+
category: 'Task Management',
|
|
408
|
+
isSubflowCandidate: true,
|
|
409
|
+
reusabilityScore: 7,
|
|
410
|
+
inputs: [
|
|
411
|
+
{
|
|
412
|
+
name: 'parent_record',
|
|
413
|
+
type: 'reference',
|
|
414
|
+
required: true,
|
|
415
|
+
description: 'Parent catalog request',
|
|
416
|
+
sourceType: 'trigger',
|
|
417
|
+
sourceReference: 'current'
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: 'assigned_to',
|
|
421
|
+
type: 'reference',
|
|
422
|
+
required: true,
|
|
423
|
+
description: 'Admin to assign task to',
|
|
424
|
+
sourceType: 'constant',
|
|
425
|
+
defaultValue: 'admin_group'
|
|
426
|
+
}
|
|
427
|
+
],
|
|
428
|
+
outputs: [
|
|
429
|
+
{
|
|
430
|
+
name: 'admin_task_id',
|
|
431
|
+
type: 'string',
|
|
432
|
+
description: 'Created admin task ID',
|
|
433
|
+
usedByActivities: ['user_task'],
|
|
434
|
+
isFlowOutput: false
|
|
435
|
+
}
|
|
436
|
+
],
|
|
437
|
+
configuration: {
|
|
438
|
+
task_type: 'admin_pickup',
|
|
439
|
+
priority: 'medium',
|
|
440
|
+
short_description: 'Prepare iPhone 6 for user pickup'
|
|
441
|
+
},
|
|
442
|
+
errorHandling: [{
|
|
443
|
+
condition: 'creation_failed',
|
|
444
|
+
action: 'retry',
|
|
445
|
+
parameters: { max_retries: 3 },
|
|
446
|
+
description: 'Retry task creation on failure'
|
|
447
|
+
}],
|
|
448
|
+
position: { x: 600, y: 50 },
|
|
449
|
+
dependencies: ['fulfillment_check'],
|
|
450
|
+
prerequisites: ['approval_check']
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
id: 'user_task',
|
|
454
|
+
name: 'Create User Task',
|
|
455
|
+
type: 'create_task',
|
|
456
|
+
label: 'User Pickup',
|
|
457
|
+
description: 'Create task for user to pick up iPhone 6',
|
|
458
|
+
category: 'Task Management',
|
|
459
|
+
isSubflowCandidate: true,
|
|
460
|
+
reusabilityScore: 6,
|
|
461
|
+
inputs: [
|
|
462
|
+
{
|
|
463
|
+
name: 'parent_record',
|
|
464
|
+
type: 'reference',
|
|
465
|
+
required: true,
|
|
466
|
+
description: 'Parent catalog request',
|
|
467
|
+
sourceType: 'trigger',
|
|
468
|
+
sourceReference: 'current'
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: 'assigned_to',
|
|
472
|
+
type: 'reference',
|
|
473
|
+
required: true,
|
|
474
|
+
description: 'User to assign task to',
|
|
475
|
+
sourceType: 'trigger',
|
|
476
|
+
sourceReference: 'current.requested_for'
|
|
477
|
+
}
|
|
478
|
+
],
|
|
479
|
+
outputs: [
|
|
480
|
+
{
|
|
481
|
+
name: 'user_task_id',
|
|
482
|
+
type: 'string',
|
|
483
|
+
description: 'Created user task ID',
|
|
484
|
+
usedByActivities: ['notification'],
|
|
485
|
+
isFlowOutput: false
|
|
486
|
+
}
|
|
487
|
+
],
|
|
488
|
+
configuration: {
|
|
489
|
+
task_type: 'user_pickup',
|
|
490
|
+
priority: 'medium',
|
|
491
|
+
short_description: 'Pick up your iPhone 6 from admin desk'
|
|
492
|
+
},
|
|
493
|
+
errorHandling: [{
|
|
494
|
+
condition: 'creation_failed',
|
|
495
|
+
action: 'retry',
|
|
496
|
+
parameters: { max_retries: 3 },
|
|
497
|
+
description: 'Retry task creation on failure'
|
|
498
|
+
}],
|
|
499
|
+
position: { x: 600, y: 150 },
|
|
500
|
+
dependencies: ['fulfillment_check'],
|
|
501
|
+
prerequisites: ['approval_check']
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
id: 'notification',
|
|
505
|
+
name: 'Send Notification',
|
|
506
|
+
type: 'notification',
|
|
507
|
+
label: 'Notify User',
|
|
508
|
+
description: 'Send notification to user about iPhone 6 availability',
|
|
509
|
+
category: 'Communication',
|
|
510
|
+
isSubflowCandidate: true,
|
|
511
|
+
reusabilityScore: 9,
|
|
512
|
+
inputs: [
|
|
513
|
+
{
|
|
514
|
+
name: 'recipient',
|
|
515
|
+
type: 'reference',
|
|
516
|
+
required: true,
|
|
517
|
+
description: 'User to notify',
|
|
518
|
+
sourceType: 'trigger',
|
|
519
|
+
sourceReference: 'current.requested_for'
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
name: 'message',
|
|
523
|
+
type: 'string',
|
|
524
|
+
required: true,
|
|
525
|
+
description: 'Notification message',
|
|
526
|
+
sourceType: 'constant',
|
|
527
|
+
defaultValue: 'Your iPhone 6 is ready for pickup at the admin desk'
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
outputs: [
|
|
531
|
+
{
|
|
532
|
+
name: 'notification_sent',
|
|
533
|
+
type: 'boolean',
|
|
534
|
+
description: 'Whether notification was sent successfully',
|
|
535
|
+
usedByActivities: [],
|
|
536
|
+
isFlowOutput: true
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
configuration: {
|
|
540
|
+
notification_type: 'email',
|
|
541
|
+
template: 'catalog_item_ready'
|
|
542
|
+
},
|
|
543
|
+
errorHandling: [{
|
|
544
|
+
condition: 'send_failed',
|
|
545
|
+
action: 'retry',
|
|
546
|
+
parameters: { max_retries: 2 },
|
|
547
|
+
description: 'Retry notification sending on failure'
|
|
548
|
+
}],
|
|
549
|
+
position: { x: 800, y: 100 },
|
|
550
|
+
dependencies: ['admin_task', 'user_task'],
|
|
551
|
+
prerequisites: ['fulfillment_check']
|
|
552
|
+
}
|
|
553
|
+
],
|
|
554
|
+
connections: [
|
|
555
|
+
{
|
|
556
|
+
id: 'trigger_to_approval',
|
|
557
|
+
from: 'trigger',
|
|
558
|
+
to: 'approval_check',
|
|
559
|
+
label: 'Start Approval',
|
|
560
|
+
condition: '',
|
|
561
|
+
conditionType: 'always',
|
|
562
|
+
description: 'Start approval process'
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
id: 'approval_to_decision',
|
|
566
|
+
from: 'approval_check',
|
|
567
|
+
to: 'fulfillment_check',
|
|
568
|
+
label: 'Check Result',
|
|
569
|
+
condition: '',
|
|
570
|
+
conditionType: 'always',
|
|
571
|
+
description: 'Check approval result'
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
id: 'decision_to_admin',
|
|
575
|
+
from: 'fulfillment_check',
|
|
576
|
+
to: 'admin_task',
|
|
577
|
+
label: 'Approved',
|
|
578
|
+
condition: 'approval_state=approved',
|
|
579
|
+
conditionType: 'conditional',
|
|
580
|
+
description: 'Proceed if approved'
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
id: 'decision_to_user',
|
|
584
|
+
from: 'fulfillment_check',
|
|
585
|
+
to: 'user_task',
|
|
586
|
+
label: 'Approved',
|
|
587
|
+
condition: 'approval_state=approved',
|
|
588
|
+
conditionType: 'conditional',
|
|
589
|
+
description: 'Proceed if approved'
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
id: 'admin_to_notification',
|
|
593
|
+
from: 'admin_task',
|
|
594
|
+
to: 'notification',
|
|
595
|
+
label: 'Task Created',
|
|
596
|
+
condition: '',
|
|
597
|
+
conditionType: 'success',
|
|
598
|
+
description: 'Notify after admin task creation'
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
id: 'user_to_notification',
|
|
602
|
+
from: 'user_task',
|
|
603
|
+
to: 'notification',
|
|
604
|
+
label: 'Task Created',
|
|
605
|
+
condition: '',
|
|
606
|
+
conditionType: 'success',
|
|
607
|
+
description: 'Notify after user task creation'
|
|
608
|
+
}
|
|
609
|
+
],
|
|
610
|
+
variables: [
|
|
611
|
+
{
|
|
612
|
+
name: 'catalog_item',
|
|
613
|
+
type: 'reference',
|
|
614
|
+
description: 'iPhone 6 catalog item reference',
|
|
615
|
+
defaultValue: null,
|
|
616
|
+
scope: 'flow',
|
|
617
|
+
category: 'Data'
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
name: 'approval_timeout',
|
|
621
|
+
type: 'integer',
|
|
622
|
+
description: 'Approval timeout in hours',
|
|
623
|
+
defaultValue: 48,
|
|
624
|
+
scope: 'flow',
|
|
625
|
+
category: 'Configuration'
|
|
626
|
+
}
|
|
627
|
+
],
|
|
628
|
+
tags: ['iphone', 'catalog', 'approval', 'fulfillment', 'task', 'notification'],
|
|
629
|
+
version: '1.0.0',
|
|
630
|
+
author: 'ServiceNow Multi-Agent System',
|
|
631
|
+
documentation: 'Complete workflow for iPhone 6 catalog requests with approval and fulfillment tasks',
|
|
632
|
+
useCases: [
|
|
633
|
+
'iPhone 6 catalog item requests',
|
|
634
|
+
'Hardware catalog fulfillment',
|
|
635
|
+
'Manager approval workflows',
|
|
636
|
+
'User pickup coordination'
|
|
637
|
+
],
|
|
638
|
+
prerequisites: [
|
|
639
|
+
'iPhone 6 catalog item configured',
|
|
640
|
+
'Manager hierarchy defined',
|
|
641
|
+
'Admin group configured',
|
|
642
|
+
'Notification templates available'
|
|
643
|
+
],
|
|
644
|
+
bestPractices: [
|
|
645
|
+
'Set appropriate approval timeouts',
|
|
646
|
+
'Configure escalation for timeouts',
|
|
647
|
+
'Use descriptive task names',
|
|
648
|
+
'Test notification delivery'
|
|
649
|
+
],
|
|
650
|
+
customizationPoints: [
|
|
651
|
+
{
|
|
652
|
+
id: 'approval_hierarchy',
|
|
653
|
+
name: 'Approval Hierarchy',
|
|
654
|
+
description: 'Configure approval hierarchy and rules',
|
|
655
|
+
type: 'configuration',
|
|
656
|
+
location: 'approval_check',
|
|
657
|
+
options: [
|
|
658
|
+
{
|
|
659
|
+
value: 'manager',
|
|
660
|
+
label: 'Manager Only',
|
|
661
|
+
description: 'Require only manager approval',
|
|
662
|
+
implications: ['Faster approval process']
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
value: 'manager_and_admin',
|
|
666
|
+
label: 'Manager and Admin',
|
|
667
|
+
description: 'Require both manager and admin approval',
|
|
668
|
+
implications: ['Longer approval process', 'Higher security']
|
|
669
|
+
}
|
|
670
|
+
],
|
|
671
|
+
impact: 'high'
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
id: 'notification_channels',
|
|
675
|
+
name: 'Notification Channels',
|
|
676
|
+
description: 'Configure notification delivery methods',
|
|
677
|
+
type: 'activity',
|
|
678
|
+
location: 'notification',
|
|
679
|
+
options: [
|
|
680
|
+
{
|
|
681
|
+
value: 'email',
|
|
682
|
+
label: 'Email Only',
|
|
683
|
+
description: 'Send notifications via email',
|
|
684
|
+
implications: ['Standard delivery']
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
value: 'email_and_sms',
|
|
688
|
+
label: 'Email and SMS',
|
|
689
|
+
description: 'Send notifications via email and SMS',
|
|
690
|
+
implications: ['Faster delivery', 'Higher visibility']
|
|
691
|
+
}
|
|
692
|
+
],
|
|
693
|
+
impact: 'medium'
|
|
694
|
+
}
|
|
695
|
+
],
|
|
696
|
+
variations: [
|
|
697
|
+
{
|
|
698
|
+
id: 'no_approval',
|
|
699
|
+
name: 'No Approval Required',
|
|
700
|
+
description: 'Skip approval process for low-cost items',
|
|
701
|
+
differences: ['Remove approval_check activity', 'Connect trigger directly to fulfillment'],
|
|
702
|
+
applicableScenarios: ['Low-cost items', 'Auto-approved requests'],
|
|
703
|
+
complexityChange: 'decrease'
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
id: 'multi_level_approval',
|
|
707
|
+
name: 'Multi-Level Approval',
|
|
708
|
+
description: 'Add additional approval levels',
|
|
709
|
+
differences: ['Add senior manager approval', 'Add budget approval'],
|
|
710
|
+
applicableScenarios: ['High-cost items', 'Executive requests'],
|
|
711
|
+
complexityChange: 'increase'
|
|
712
|
+
}
|
|
713
|
+
]
|
|
714
|
+
});
|
|
715
|
+
// Simple Notification Template
|
|
716
|
+
this.templates.set('simple-notification', {
|
|
717
|
+
id: 'simple-notification',
|
|
718
|
+
name: 'Simple Notification',
|
|
719
|
+
description: 'Basic notification workflow for sending alerts',
|
|
720
|
+
category: 'Communication',
|
|
721
|
+
context: flow_subflow_decision_engine_js_1.FlowContext.NOTIFICATION_WORKFLOW,
|
|
722
|
+
recommendedType: flow_subflow_decision_engine_js_1.FlowType.SUBFLOW,
|
|
723
|
+
complexity: flow_subflow_decision_engine_js_1.ComplexityLevel.LOW,
|
|
724
|
+
reusability: flow_subflow_decision_engine_js_1.ReusabilityLevel.HIGH,
|
|
725
|
+
triggers: [{
|
|
726
|
+
id: 'notification_trigger',
|
|
727
|
+
type: 'manual',
|
|
728
|
+
table: 'any',
|
|
729
|
+
description: 'Manual trigger for notification',
|
|
730
|
+
configuration: {
|
|
731
|
+
manual_execution: true
|
|
732
|
+
}
|
|
733
|
+
}],
|
|
734
|
+
activities: [
|
|
735
|
+
{
|
|
736
|
+
id: 'send_notification',
|
|
737
|
+
name: 'Send Notification',
|
|
738
|
+
type: 'notification',
|
|
739
|
+
label: 'Send Alert',
|
|
740
|
+
description: 'Send notification to specified recipients',
|
|
741
|
+
category: 'Communication',
|
|
742
|
+
isSubflowCandidate: false,
|
|
743
|
+
reusabilityScore: 10,
|
|
744
|
+
inputs: [
|
|
745
|
+
{
|
|
746
|
+
name: 'recipients',
|
|
747
|
+
type: 'string',
|
|
748
|
+
required: true,
|
|
749
|
+
description: 'Comma-separated list of recipients',
|
|
750
|
+
sourceType: 'trigger'
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
name: 'subject',
|
|
754
|
+
type: 'string',
|
|
755
|
+
required: true,
|
|
756
|
+
description: 'Email subject line',
|
|
757
|
+
sourceType: 'trigger'
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: 'message',
|
|
761
|
+
type: 'string',
|
|
762
|
+
required: true,
|
|
763
|
+
description: 'Notification message',
|
|
764
|
+
sourceType: 'trigger'
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
outputs: [
|
|
768
|
+
{
|
|
769
|
+
name: 'sent_successfully',
|
|
770
|
+
type: 'boolean',
|
|
771
|
+
description: 'Whether notification was sent',
|
|
772
|
+
usedByActivities: [],
|
|
773
|
+
isFlowOutput: true
|
|
774
|
+
}
|
|
775
|
+
],
|
|
776
|
+
configuration: {
|
|
777
|
+
notification_type: 'email'
|
|
778
|
+
},
|
|
779
|
+
errorHandling: [{
|
|
780
|
+
condition: 'send_failed',
|
|
781
|
+
action: 'retry',
|
|
782
|
+
parameters: { max_retries: 3 },
|
|
783
|
+
description: 'Retry sending on failure'
|
|
784
|
+
}],
|
|
785
|
+
position: { x: 200, y: 100 },
|
|
786
|
+
dependencies: [],
|
|
787
|
+
prerequisites: []
|
|
788
|
+
}
|
|
789
|
+
],
|
|
790
|
+
connections: [
|
|
791
|
+
{
|
|
792
|
+
id: 'trigger_to_send',
|
|
793
|
+
from: 'trigger',
|
|
794
|
+
to: 'send_notification',
|
|
795
|
+
label: 'Send',
|
|
796
|
+
condition: '',
|
|
797
|
+
conditionType: 'always',
|
|
798
|
+
description: 'Send notification'
|
|
799
|
+
}
|
|
800
|
+
],
|
|
801
|
+
variables: [
|
|
802
|
+
{
|
|
803
|
+
name: 'delivery_method',
|
|
804
|
+
type: 'string',
|
|
805
|
+
description: 'Notification delivery method',
|
|
806
|
+
defaultValue: 'email',
|
|
807
|
+
scope: 'flow',
|
|
808
|
+
category: 'Configuration'
|
|
809
|
+
}
|
|
810
|
+
],
|
|
811
|
+
tags: ['notification', 'email', 'alert', 'communication', 'simple'],
|
|
812
|
+
version: '1.0.0',
|
|
813
|
+
author: 'ServiceNow Multi-Agent System',
|
|
814
|
+
documentation: 'Simple notification workflow for sending alerts via email',
|
|
815
|
+
useCases: [
|
|
816
|
+
'Basic email notifications',
|
|
817
|
+
'Alert sending',
|
|
818
|
+
'Status updates',
|
|
819
|
+
'Simple communications'
|
|
820
|
+
],
|
|
821
|
+
prerequisites: [
|
|
822
|
+
'Email configuration',
|
|
823
|
+
'Notification templates'
|
|
824
|
+
],
|
|
825
|
+
bestPractices: [
|
|
826
|
+
'Use clear subject lines',
|
|
827
|
+
'Keep messages concise',
|
|
828
|
+
'Test delivery before production'
|
|
829
|
+
],
|
|
830
|
+
customizationPoints: [
|
|
831
|
+
{
|
|
832
|
+
id: 'delivery_channels',
|
|
833
|
+
name: 'Delivery Channels',
|
|
834
|
+
description: 'Configure notification delivery channels',
|
|
835
|
+
type: 'configuration',
|
|
836
|
+
location: 'send_notification',
|
|
837
|
+
options: [
|
|
838
|
+
{
|
|
839
|
+
value: 'email',
|
|
840
|
+
label: 'Email',
|
|
841
|
+
description: 'Send via email',
|
|
842
|
+
implications: ['Standard delivery']
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
value: 'sms',
|
|
846
|
+
label: 'SMS',
|
|
847
|
+
description: 'Send via SMS',
|
|
848
|
+
implications: ['Faster delivery']
|
|
849
|
+
}
|
|
850
|
+
],
|
|
851
|
+
impact: 'medium'
|
|
852
|
+
}
|
|
853
|
+
],
|
|
854
|
+
variations: [
|
|
855
|
+
{
|
|
856
|
+
id: 'rich_notification',
|
|
857
|
+
name: 'Rich Notification',
|
|
858
|
+
description: 'Add HTML formatting and attachments',
|
|
859
|
+
differences: ['Add HTML formatting', 'Add attachment support'],
|
|
860
|
+
applicableScenarios: ['Rich content', 'Reports', 'Branded communications'],
|
|
861
|
+
complexityChange: 'increase'
|
|
862
|
+
}
|
|
863
|
+
]
|
|
864
|
+
});
|
|
865
|
+
// Additional templates would be added here...
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Initialize flow patterns
|
|
869
|
+
*/
|
|
870
|
+
initializePatterns() {
|
|
871
|
+
this.patterns = [
|
|
872
|
+
{
|
|
873
|
+
name: 'Approval Pattern',
|
|
874
|
+
description: 'Standard approval workflow with escalation',
|
|
875
|
+
context: flow_subflow_decision_engine_js_1.FlowContext.APPROVAL_WORKFLOW,
|
|
876
|
+
recommendedType: flow_subflow_decision_engine_js_1.FlowType.SUBFLOW,
|
|
877
|
+
commonActions: ['approve', 'reject', 'escalate'],
|
|
878
|
+
inputPatterns: ['record', 'approver', 'timeout'],
|
|
879
|
+
outputPatterns: ['approval_state', 'approved_by'],
|
|
880
|
+
complexity: flow_subflow_decision_engine_js_1.ComplexityLevel.MEDIUM
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
name: 'Fulfillment Pattern',
|
|
884
|
+
description: 'Complete fulfillment workflow with tasks',
|
|
885
|
+
context: flow_subflow_decision_engine_js_1.FlowContext.FULFILLMENT_WORKFLOW,
|
|
886
|
+
recommendedType: flow_subflow_decision_engine_js_1.FlowType.MAIN_FLOW,
|
|
887
|
+
commonActions: ['validate', 'create_task', 'notify'],
|
|
888
|
+
inputPatterns: ['catalog_item', 'requestor', 'approver'],
|
|
889
|
+
outputPatterns: ['fulfillment_status', 'task_ids'],
|
|
890
|
+
complexity: flow_subflow_decision_engine_js_1.ComplexityLevel.HIGH
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
name: 'Notification Pattern',
|
|
894
|
+
description: 'Multi-channel notification system',
|
|
895
|
+
context: flow_subflow_decision_engine_js_1.FlowContext.NOTIFICATION_WORKFLOW,
|
|
896
|
+
recommendedType: flow_subflow_decision_engine_js_1.FlowType.SUBFLOW,
|
|
897
|
+
commonActions: ['format_message', 'send_notification'],
|
|
898
|
+
inputPatterns: ['recipients', 'message', 'channel'],
|
|
899
|
+
outputPatterns: ['sent_successfully', 'delivery_status'],
|
|
900
|
+
complexity: flow_subflow_decision_engine_js_1.ComplexityLevel.LOW
|
|
901
|
+
}
|
|
902
|
+
];
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
exports.FlowPatternTemplates = FlowPatternTemplates;
|
|
906
|
+
//# sourceMappingURL=flow-pattern-templates.js.map
|