snow-flow 3.0.17 → 3.0.18

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.
@@ -36,7 +36,7 @@ function getDynamicVersion() {
36
36
  console.warn('Warning: Could not read version from package.json:', error);
37
37
  }
38
38
  // Fallback to hardcoded version
39
- return '3.0.17';
39
+ return '3.0.18';
40
40
  }
41
41
  // Export a constant that uses the dynamic version
42
42
  exports.VERSION = getDynamicVersion();
@@ -669,12 +669,14 @@ Your widget is deployed and ready for testing in Service Portal.`
669
669
  if (isNullError) {
670
670
  // NULL ERROR = DEPLOYMENT LIKELY SUCCEEDED BUT VERIFICATION FAILED
671
671
  this.logger.info('🎯 NULL ERROR DETECTED - Widget likely created successfully, attempting to find it');
672
- // Try to find the widget that was just created
672
+ // Try to find the widget that was just created using direct API call (like snow_query_table)
673
673
  try {
674
- const searchResult = await this.client.searchRecords('sp_widget', `name=${args.name}`, 1);
675
- if (searchResult.success && searchResult.data?.length > 0) {
676
- const createdWidget = searchResult.data[0];
677
- this.logger.info('✅ Found widget created despite null error!', { sys_id: createdWidget.sys_id });
674
+ this.logger.info('🔍 Using direct API verification (snow_query_table approach)');
675
+ // Direct API call to sp_widget table with specific query
676
+ const apiResponse = await this.client.get(`/api/now/table/sp_widget?sysparm_query=name=${encodeURIComponent(args.name)}&sysparm_limit=1&sysparm_fields=sys_id,name,title`);
677
+ if (apiResponse?.data?.result && apiResponse.data.result.length > 0) {
678
+ const createdWidget = apiResponse.data.result[0];
679
+ this.logger.info('✅ Widget verified via direct API call!', { sys_id: createdWidget.sys_id });
678
680
  result = {
679
681
  success: true,
680
682
  data: {
@@ -683,7 +685,7 @@ Your widget is deployed and ready for testing in Service Portal.`
683
685
  title: createdWidget.title || args.title
684
686
  }
685
687
  };
686
- deploymentMethod = 'direct_api (null error - widget found via search)';
688
+ deploymentMethod = 'direct_api (null error - widget verified via API)';
687
689
  deploymentSuccess = true;
688
690
  }
689
691
  else {
@@ -720,39 +722,19 @@ Your widget is deployed and ready for testing in Service Portal.`
720
722
  else if (error?.response?.status === 403 ||
721
723
  error?.message?.includes('403') ||
722
724
  error?.message?.includes('Forbidden')) {
723
- this.logger.info('403 error detected, performing universal verification...');
725
+ this.logger.info('403 error detected, using direct API verification...');
724
726
  try {
725
- const verificationResult = await this.universalArtifactVerification('widget', args.name);
726
- // Handle null verification result
727
- if (!verificationResult || verificationResult === null) {
728
- this.logger.info('🎯 Verification returned null - assuming widget was created successfully');
727
+ // Direct API call to sp_widget table with specific query
728
+ const apiResponse = await this.client.get(`/api/now/table/sp_widget?sysparm_query=name=${encodeURIComponent(args.name)}&sysparm_limit=1&sysparm_fields=sys_id,name,title`);
729
+ if (apiResponse?.data?.result && apiResponse.data.result.length > 0) {
730
+ const createdWidget = apiResponse.data.result[0];
731
+ this.logger.info('✅ Widget verified via direct API despite 403!', { sys_id: createdWidget.sys_id });
729
732
  result = {
730
733
  success: true,
731
734
  data: {
732
- sys_id: 'created-verification-null',
733
- name: args.name,
734
- title: args.title
735
- }
736
- };
737
- deploymentMethod = 'direct_api (403 with null verification - assuming success)';
738
- deploymentSuccess = true;
739
- }
740
- else if (verificationResult.exists) {
741
- // Widget was created successfully despite 403 error!
742
- this.logger.info('🎉 Widget verification SUCCESS: Widget exists despite 403 error', {
743
- widgetName: args.name,
744
- sys_id: verificationResult.sys_id,
745
- completenessScore: verificationResult.completenessScore,
746
- verificationMethod: verificationResult.method,
747
- table: verificationResult.table
748
- });
749
- // Set result as successful with the verified data
750
- result = {
751
- success: true,
752
- data: {
753
- sys_id: verificationResult.sys_id,
754
- name: args.name,
755
- title: verificationResult.name || args.title
735
+ sys_id: createdWidget.sys_id,
736
+ name: createdWidget.name || args.name,
737
+ title: createdWidget.title || args.title
756
738
  }
757
739
  };
758
740
  deploymentMethod = 'direct_api (with universal error recovery)';
@@ -882,18 +864,19 @@ Your widget is deployed and ready for testing in Service Portal.`
882
864
  // CRITICAL FIX: Check if widget was actually created despite 403 error
883
865
  this.logger.info('403 error detected, verifying if widget was actually created...');
884
866
  try {
885
- const verificationResult = await this.universalArtifactVerification('widget', args.name);
886
- if (verificationResult.exists) {
867
+ // Direct API call to verify widget exists
868
+ const apiResponse = await this.client.get(`/api/now/table/sp_widget?sysparm_query=name=${encodeURIComponent(args.name)}&sysparm_limit=1&sysparm_fields=sys_id,name,title`);
869
+ if (apiResponse?.data?.result && apiResponse.data.result.length > 0) {
870
+ const createdWidget = apiResponse.data.result[0];
887
871
  // Widget was created successfully despite 403 error!
888
872
  this.logger.info('🎉 Widget verification SUCCESS: Widget exists despite 403 error', {
889
873
  widgetName: args.name,
890
- sys_id: verificationResult.sys_id,
891
- completenessScore: verificationResult.completenessScore
874
+ sys_id: createdWidget.sys_id
892
875
  });
893
876
  // Format successful response similar to normal deployment
894
877
  const credentials = await this.oauth.loadCredentials();
895
878
  const widgetUrl = credentials?.instance ?
896
- `https://${credentials.instance}/sp_config?id=widget_editor&sys_id=${verificationResult.sys_id}` :
879
+ `https://${credentials.instance}/sp_config?id=widget_editor&sys_id=${createdWidget.sys_id}` :
897
880
  'ServiceNow instance URL not available';
898
881
  return {
899
882
  content: [
@@ -903,10 +886,10 @@ Your widget is deployed and ready for testing in Service Portal.`
903
886
 
904
887
  🎯 Widget Details:
905
888
  - Name: ${args.name}
906
- - Title: ${verificationResult.title || args.title}
907
- - Sys ID: ${verificationResult.sys_id}
908
- - Deployment Method: ${deploymentMethod} (with error recovery)
909
- - Verification: ✅ Confirmed (${verificationResult.completenessScore}/100 complete)
889
+ - Title: ${createdWidget.title || args.title}
890
+ - Sys ID: ${createdWidget.sys_id}
891
+ - Deployment Method: direct_api (with error recovery)
892
+ - Verification: ✅ Confirmed via direct API
910
893
 
911
894
  📦 Update Set:
912
895
  - Name: ${updateSetName}
@@ -1255,16 +1238,18 @@ Use \`snow_deployment_debug\` for more information about this session.`,
1255
1238
  if (is403Error) {
1256
1239
  this.logger.info('Final 403 error handler - attempting universal verification check');
1257
1240
  try {
1258
- const finalVerification = await this.universalArtifactVerification('widget', args.name);
1259
- if (finalVerification.exists) {
1241
+ // Direct API call for final verification
1242
+ const apiResponse = await this.client.get(`/api/now/table/sp_widget?sysparm_query=name=${encodeURIComponent(args.name)}&sysparm_limit=1&sysparm_fields=sys_id,name,title`);
1243
+ if (apiResponse?.data?.result && apiResponse.data.result.length > 0) {
1244
+ const createdWidget = apiResponse.data.result[0];
1260
1245
  this.logger.info('🎉 FINAL SUCCESS: Widget exists despite deployment errors!', {
1261
1246
  widgetName: args.name,
1262
- sys_id: finalVerification.sys_id,
1263
- method: finalVerification.method
1247
+ sys_id: createdWidget.sys_id,
1248
+ method: 'direct_api_final'
1264
1249
  });
1265
1250
  const credentials = await this.oauth.loadCredentials();
1266
1251
  const widgetUrl = credentials?.instance ?
1267
- `https://${credentials.instance}/sp_config?id=widget_editor&sys_id=${finalVerification.sys_id}` :
1252
+ `https://${credentials.instance}/sp_config?id=widget_editor&sys_id=${createdWidget.sys_id}` :
1268
1253
  'ServiceNow instance URL not available';
1269
1254
  return {
1270
1255
  content: [{
@@ -1273,8 +1258,8 @@ Use \`snow_deployment_debug\` for more information about this session.`,
1273
1258
 
1274
1259
  🎯 Widget Details:
1275
1260
  - Name: ${args.name}
1276
- - Sys ID: ${finalVerification.sys_id}
1277
- - Verification Method: ${finalVerification.method}
1261
+ - Sys ID: ${createdWidget.sys_id}
1262
+ - Verification Method: direct_api_final
1278
1263
  - Status: ✅ Deployed (despite 403 error)
1279
1264
 
1280
1265
  📦 Update Set:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.0.17",
4
- "description": "Snow-Flow v3.0.17: NULL ERROR FALSE NEGATIVE FIX! Fixed widget deployment false negatives where widgets ARE created successfully but tool reports failure due to 'null' error in verification. Now correctly detects successful deployments even when verification fails, searches for created widgets, and reports success appropriately. No more false 'deployment failed' messages when widgets actually exist!",
3
+ "version": "3.0.18",
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",
7
7
  "bin": {