snow-flow 3.0.20 → 3.0.22
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.
|
@@ -502,7 +502,77 @@ class ServiceNowDeploymentMCP {
|
|
|
502
502
|
if (!authResult.hasWriteScope) {
|
|
503
503
|
this.logger.warn('⚠️ Token may lack write permissions, deployment might fail with 403');
|
|
504
504
|
}
|
|
505
|
-
this.logger.info('Deploying widget to ServiceNow', { name: args.name });
|
|
505
|
+
this.logger.info('Deploying widget to ServiceNow', { name: args.name, sys_id: args.sys_id });
|
|
506
|
+
// CHECK: If sys_id is provided, this is an UPDATE not a CREATE
|
|
507
|
+
if (args.sys_id) {
|
|
508
|
+
this.logger.info('🔄 UPDATE mode detected - updating existing widget', { sys_id: args.sys_id });
|
|
509
|
+
try {
|
|
510
|
+
// Update the existing widget
|
|
511
|
+
const updateResult = await this.client.updateRecord('sp_widget', args.sys_id, {
|
|
512
|
+
name: args.name || undefined,
|
|
513
|
+
title: args.title || undefined,
|
|
514
|
+
template: args.template || undefined,
|
|
515
|
+
css: args.css || undefined,
|
|
516
|
+
client_script: args.client_script || undefined,
|
|
517
|
+
server_script: args.server_script || undefined,
|
|
518
|
+
option_schema: args.option_schema || undefined,
|
|
519
|
+
demo_data: args.demo_data || undefined,
|
|
520
|
+
data: args.data || undefined,
|
|
521
|
+
description: args.description || undefined
|
|
522
|
+
});
|
|
523
|
+
if (updateResult.success) {
|
|
524
|
+
const credentials = await this.oauth.loadCredentials();
|
|
525
|
+
const widgetUrl = credentials?.instance ?
|
|
526
|
+
`https://${credentials.instance}/sp_config?id=widget_editor&sys_id=${args.sys_id}` :
|
|
527
|
+
'ServiceNow instance URL not available';
|
|
528
|
+
return {
|
|
529
|
+
success: true,
|
|
530
|
+
sys_id: args.sys_id,
|
|
531
|
+
name: args.name,
|
|
532
|
+
content: [
|
|
533
|
+
{
|
|
534
|
+
type: 'text',
|
|
535
|
+
text: `✅ Widget updated successfully!
|
|
536
|
+
|
|
537
|
+
🎯 Widget Details:
|
|
538
|
+
- Sys ID: ${args.sys_id}
|
|
539
|
+
- Name: ${args.name || 'Unchanged'}
|
|
540
|
+
- Deployment Context: ${args.config?.deployment_context || args.deployment_context || 'Widget update'}
|
|
541
|
+
- Method: Direct update via API
|
|
542
|
+
|
|
543
|
+
🔗 Direct Links:
|
|
544
|
+
- Widget Editor: ${widgetUrl}
|
|
545
|
+
- Service Portal Designer: https://${credentials?.instance}/sp_config?id=designer
|
|
546
|
+
|
|
547
|
+
⚡ **Widget Updated**
|
|
548
|
+
Your changes have been applied to the existing widget.`
|
|
549
|
+
}
|
|
550
|
+
]
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
return {
|
|
555
|
+
success: false,
|
|
556
|
+
error: updateResult.error || 'Failed to update widget',
|
|
557
|
+
content: [{
|
|
558
|
+
type: 'text',
|
|
559
|
+
text: `❌ Failed to update widget: ${updateResult.error || 'Unknown error'}`
|
|
560
|
+
}]
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
catch (updateError) {
|
|
565
|
+
this.logger.error('Widget update failed', updateError);
|
|
566
|
+
return {
|
|
567
|
+
success: false,
|
|
568
|
+
error: updateError.message || 'Update failed',
|
|
569
|
+
content: [{
|
|
570
|
+
type: 'text',
|
|
571
|
+
text: `❌ Widget update failed: ${updateError.message || 'Unknown error'}`
|
|
572
|
+
}]
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
506
576
|
// ENHANCED: Mandatory Update Set management with auto-activation
|
|
507
577
|
try {
|
|
508
578
|
// Force Update Set creation/activation for all deployments
|
|
@@ -1069,7 +1139,7 @@ Use \`snow_deployment_debug\` for more information about this session.`,
|
|
|
1069
1139
|
4. Try widget preview: snow_preview_widget()
|
|
1070
1140
|
|
|
1071
1141
|
💡 Alternative Approaches:
|
|
1072
|
-
• Use
|
|
1142
|
+
• Use snow_deploy with smaller components first
|
|
1073
1143
|
• Test with snow_widget_test() before deployment
|
|
1074
1144
|
• Check dependencies with check_dependencies: true
|
|
1075
1145
|
|
|
@@ -7996,94 +8066,6 @@ ${updateSetSession ? `📋 **Update Set**: ${updateSetSession.name}
|
|
|
7996
8066
|
throw new Error(`Update Set session required for deployment. Error: ${error.message}`);
|
|
7997
8067
|
}
|
|
7998
8068
|
}
|
|
7999
|
-
/**
|
|
8000
|
-
* DEPRECATION HANDLERS - Redirect old tools to new unified system
|
|
8001
|
-
*/
|
|
8002
|
-
async handleDeprecatedWidgetDeploy(args) {
|
|
8003
|
-
const deprecationWarning = `⚠️ **DEPRECATED TOOL USED**
|
|
8004
|
-
|
|
8005
|
-
🚨 **snow_deploy_widget is deprecated** - Use \`snow_deploy\` instead
|
|
8006
|
-
|
|
8007
|
-
📋 **Automatic Redirect**: Converting to unified deployment...
|
|
8008
|
-
|
|
8009
|
-
`;
|
|
8010
|
-
// Convert old widget args to unified deploy format
|
|
8011
|
-
const unifiedArgs = {
|
|
8012
|
-
type: 'widget',
|
|
8013
|
-
config: args,
|
|
8014
|
-
auto_update_set: true,
|
|
8015
|
-
fallback_strategy: 'manual_steps'
|
|
8016
|
-
};
|
|
8017
|
-
const result = await this.unifiedDeploy(unifiedArgs);
|
|
8018
|
-
// Prepend deprecation warning to the result
|
|
8019
|
-
if (result.content && result.content[0]) {
|
|
8020
|
-
result.content[0].text = deprecationWarning + result.content[0].text;
|
|
8021
|
-
}
|
|
8022
|
-
return result;
|
|
8023
|
-
}
|
|
8024
|
-
async handleDeprecatedApplicationDeploy(args) {
|
|
8025
|
-
const deprecationWarning = `⚠️ **DEPRECATED TOOL USED**
|
|
8026
|
-
|
|
8027
|
-
🚨 **snow_deploy_application is deprecated** - Use \`snow_deploy\` instead
|
|
8028
|
-
|
|
8029
|
-
📋 **Automatic Redirect**: Converting to unified deployment...
|
|
8030
|
-
|
|
8031
|
-
`;
|
|
8032
|
-
// Convert old application args to unified deploy format
|
|
8033
|
-
const unifiedArgs = {
|
|
8034
|
-
type: 'application',
|
|
8035
|
-
config: args,
|
|
8036
|
-
auto_update_set: true,
|
|
8037
|
-
fallback_strategy: 'manual_steps'
|
|
8038
|
-
};
|
|
8039
|
-
const result = await this.unifiedDeploy(unifiedArgs);
|
|
8040
|
-
// Prepend deprecation warning to the result
|
|
8041
|
-
if (result.content && result.content[0]) {
|
|
8042
|
-
result.content[0].text = deprecationWarning + result.content[0].text;
|
|
8043
|
-
}
|
|
8044
|
-
return result;
|
|
8045
|
-
}
|
|
8046
|
-
async handleDeprecatedBulkDeploy(args) {
|
|
8047
|
-
const deprecationWarning = `⚠️ **DEPRECATED TOOL USED**
|
|
8048
|
-
|
|
8049
|
-
🚨 **snow_bulk_deploy is deprecated** - Use \`snow_deploy\` with batch configuration instead
|
|
8050
|
-
|
|
8051
|
-
📋 **Automatic Redirect**: Converting to unified deployment...
|
|
8052
|
-
|
|
8053
|
-
💡 **New Usage**: Use \`snow_deploy\` for single artifacts or implement batch logic with multiple \`snow_deploy\` calls
|
|
8054
|
-
|
|
8055
|
-
`;
|
|
8056
|
-
return {
|
|
8057
|
-
content: [{
|
|
8058
|
-
type: 'text',
|
|
8059
|
-
text: `${deprecationWarning}
|
|
8060
|
-
|
|
8061
|
-
❌ **Bulk Deploy No Longer Supported in Unified System**
|
|
8062
|
-
|
|
8063
|
-
🔧 **Alternative Solutions:**
|
|
8064
|
-
|
|
8065
|
-
**Option 1: Single Artifact Deployment**
|
|
8066
|
-
\`\`\`
|
|
8067
|
-
snow_deploy({
|
|
8068
|
-
type: 'widget',
|
|
8069
|
-
config: { /* your widget config */ }
|
|
8070
|
-
})
|
|
8071
|
-
\`\`\`
|
|
8072
|
-
|
|
8073
|
-
**Option 2: Multiple Sequential Deployments**
|
|
8074
|
-
Deploy each artifact individually using \`snow_deploy\` - the unified system automatically manages Update Sets across all deployments.
|
|
8075
|
-
|
|
8076
|
-
**Option 3: Use Existing Bulk Deploy (Legacy)**
|
|
8077
|
-
The original \`snow_bulk_deploy\` functionality is still available but deprecated. Consider migrating to the simplified \`snow_deploy\` approach.
|
|
8078
|
-
|
|
8079
|
-
📊 **Benefits of New Approach:**
|
|
8080
|
-
- Automatic Update Set management
|
|
8081
|
-
- Better error handling per artifact
|
|
8082
|
-
- Clearer deployment tracking
|
|
8083
|
-
- Resilient fallback strategies`
|
|
8084
|
-
}]
|
|
8085
|
-
};
|
|
8086
|
-
}
|
|
8087
8069
|
async start() {
|
|
8088
8070
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
8089
8071
|
await this.server.connect(transport);
|
|
@@ -49,19 +49,6 @@ class MCPToolRegistry {
|
|
|
49
49
|
actualTool: 'mcp__servicenow-deployment__snow_deploy',
|
|
50
50
|
description: 'Deploy flows to ServiceNow'
|
|
51
51
|
});
|
|
52
|
-
// Widget deployment
|
|
53
|
-
this.registerTool({
|
|
54
|
-
canonicalName: 'deploy_widget',
|
|
55
|
-
aliases: [
|
|
56
|
-
'mcp__servicenow-deployment__snow_deploy_widget',
|
|
57
|
-
'snow_deploy_widget',
|
|
58
|
-
'deploy_widget',
|
|
59
|
-
'widget_deploy'
|
|
60
|
-
],
|
|
61
|
-
provider: 'servicenow-deployment',
|
|
62
|
-
actualTool: 'mcp__servicenow-deployment__snow_deploy',
|
|
63
|
-
description: 'Deploy widgets to ServiceNow'
|
|
64
|
-
});
|
|
65
52
|
// Update Set management
|
|
66
53
|
this.registerTool({
|
|
67
54
|
canonicalName: 'update_set_create',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.22",
|
|
4
4
|
"description": "Snow-Flow v3.0.18: DIRECT API VERIFICATION! 🚀 Replaced unreliable searchRecords with direct API calls (snow_query_table style) for widget verification. All null/403 error recovery now uses GET /api/now/table/sp_widget with precise queries. NO MORE FALSE NEGATIVES - verification works consistently every time!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|