snow-flow 3.6.13 ā 3.6.14
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.
|
@@ -724,23 +724,53 @@ ${args.recurring_price && args.recurring_price !== '0' ? `š Recurring: $${arg
|
|
|
724
724
|
*/
|
|
725
725
|
async createCatalogVariable(args) {
|
|
726
726
|
try {
|
|
727
|
-
this.logger.info('Creating catalog variable...');
|
|
727
|
+
this.logger.info('Creating catalog variable...', { name: args.name, cat_item: args.cat_item });
|
|
728
|
+
// Add ESSENTIAL missing fields that might be required
|
|
728
729
|
const variableData = {
|
|
730
|
+
// Required fields
|
|
729
731
|
cat_item: args.cat_item,
|
|
730
732
|
name: args.name,
|
|
731
733
|
question_text: args.question_text,
|
|
732
|
-
type: args.type,
|
|
734
|
+
type: args.type || '1', // Default to string type
|
|
735
|
+
// Essential fields that were missing
|
|
736
|
+
active: true, // ā
CRITICAL: Must be active
|
|
733
737
|
order: args.order || 100,
|
|
734
738
|
mandatory: args.mandatory || false,
|
|
739
|
+
// Display settings
|
|
740
|
+
display_type: args.display_type || 'normal',
|
|
741
|
+
// Values
|
|
735
742
|
default_value: args.default_value || '',
|
|
736
743
|
help_text: args.help_text || '',
|
|
744
|
+
// References and choices
|
|
737
745
|
reference: args.reference || '',
|
|
738
|
-
choice_table: args.choice_table || ''
|
|
746
|
+
choice_table: args.choice_table || '',
|
|
747
|
+
// Security fields (might be required)
|
|
748
|
+
write_roles: args.write_roles || '',
|
|
749
|
+
read_roles: args.read_roles || '',
|
|
750
|
+
// Additional fields
|
|
751
|
+
example_text: args.example_text || '',
|
|
752
|
+
tooltip: args.tooltip || ''
|
|
739
753
|
};
|
|
754
|
+
this.logger.info('šÆ Creating variable with payload:', variableData);
|
|
740
755
|
const response = await this.client.createRecord('item_option_new', variableData);
|
|
741
756
|
if (!response.success) {
|
|
757
|
+
this.logger.error('ā Variable creation failed:', {
|
|
758
|
+
error: response.error,
|
|
759
|
+
payload: variableData,
|
|
760
|
+
status: response.status
|
|
761
|
+
});
|
|
742
762
|
throw new Error(`Failed to create catalog variable: ${response.error}`);
|
|
743
763
|
}
|
|
764
|
+
const createdSysId = response.data.sys_id;
|
|
765
|
+
this.logger.info(`ā
Variable created with sys_id: ${createdSysId}`);
|
|
766
|
+
// š VERIFICATION: Check if variable was actually created
|
|
767
|
+
this.logger.info('š Verifying variable creation...');
|
|
768
|
+
const verification = await this.client.searchRecords('item_option_new', `sys_id=${createdSysId}`, 1);
|
|
769
|
+
if (!verification.success || verification.data.result.length === 0) {
|
|
770
|
+
this.logger.error('ā VERIFICATION FAILED: Variable not found after creation!');
|
|
771
|
+
throw new Error(`Variable creation verification failed - not found in database`);
|
|
772
|
+
}
|
|
773
|
+
this.logger.info('ā
Variable verified in database');
|
|
744
774
|
return {
|
|
745
775
|
content: [{
|
|
746
776
|
type: 'text',
|
|
@@ -920,25 +950,47 @@ ${args.help_text ? `ā Help: ${args.help_text}` : ''}
|
|
|
920
950
|
// Basis metadata
|
|
921
951
|
actionData.order = (i + 1) * 100;
|
|
922
952
|
actionData.active = true;
|
|
923
|
-
this.logger.info(
|
|
953
|
+
this.logger.info(`šÆ Attempting to create action ${i + 1}:`, actionData);
|
|
924
954
|
const actionResponse = await this.client.createRecord('catalog_ui_policy_action', actionData);
|
|
925
955
|
if (actionResponse.success) {
|
|
956
|
+
const createdActionId = actionResponse.data.sys_id;
|
|
957
|
+
this.logger.info(`ā
Created action with sys_id: ${createdActionId}`);
|
|
958
|
+
// š VERIFICATION: Check if action was actually created
|
|
959
|
+
this.logger.info(`š Verifying action ${i + 1} creation...`);
|
|
960
|
+
const actionVerification = await this.client.searchRecords('catalog_ui_policy_action', `sys_id=${createdActionId}`, 1);
|
|
961
|
+
if (!actionVerification.success || actionVerification.data.result.length === 0) {
|
|
962
|
+
this.logger.error('ā ACTION VERIFICATION FAILED: Action not found after creation!');
|
|
963
|
+
throw new Error(`Action creation verification failed - action ${i + 1} not found in database`);
|
|
964
|
+
}
|
|
965
|
+
this.logger.info(`ā
Action ${i + 1} verified in database`);
|
|
926
966
|
createdActions.push({
|
|
927
|
-
sys_id:
|
|
967
|
+
sys_id: createdActionId,
|
|
928
968
|
variable: action.catalog_variable,
|
|
929
969
|
details: this.formatActionDetails(action)
|
|
930
970
|
});
|
|
931
|
-
this.logger.info(`ā
Created action: ${action.type || 'default'} for ${action.catalog_variable}`);
|
|
932
971
|
}
|
|
933
972
|
else {
|
|
934
973
|
const errorMsg = `ā Failed to create action ${i + 1}: ${actionResponse.error || 'Unknown error'}`;
|
|
935
974
|
this.logger.error(errorMsg);
|
|
936
|
-
this.logger.error('Action data was:', actionData);
|
|
975
|
+
this.logger.error('ā Action data was:', actionData);
|
|
976
|
+
this.logger.error('ā Response details:', {
|
|
977
|
+
status: actionResponse.status,
|
|
978
|
+
headers: actionResponse.headers,
|
|
979
|
+
data: actionResponse.data
|
|
980
|
+
});
|
|
937
981
|
// BELANGRIJK: Gooi een error zodat de gebruiker weet dat het faalt!
|
|
938
982
|
throw new Error(errorMsg);
|
|
939
983
|
}
|
|
940
984
|
}
|
|
941
985
|
}
|
|
986
|
+
// š FINAL VERIFICATION: Policy creation
|
|
987
|
+
this.logger.info('š Final verification: Checking policy in database...');
|
|
988
|
+
const policyVerification = await this.client.searchRecords('catalog_ui_policy', `sys_id=${policyId}`, 1);
|
|
989
|
+
if (!policyVerification.success || policyVerification.data.result.length === 0) {
|
|
990
|
+
this.logger.error('ā POLICY VERIFICATION FAILED: Policy not found after creation!');
|
|
991
|
+
throw new Error(`Policy creation verification failed - policy not found in database`);
|
|
992
|
+
}
|
|
993
|
+
this.logger.info('ā
Policy verified in database');
|
|
942
994
|
// Build comprehensive response
|
|
943
995
|
let responseText = `ā
Catalog UI Policy created successfully!
|
|
944
996
|
|
|
@@ -947,7 +999,11 @@ ${args.help_text ? `ā Help: ${args.help_text}` : ''}
|
|
|
947
999
|
šÆ Applies to: ${args.applies_to || 'item'}
|
|
948
1000
|
š Active: ${args.active !== false ? 'Yes' : 'No'}
|
|
949
1001
|
ā” On Load: ${args.on_load !== false ? 'Yes' : 'No'}
|
|
950
|
-
š Reverse if False: ${args.reverse_if_false !== false ? 'Yes' : 'No'}
|
|
1002
|
+
š Reverse if False: ${args.reverse_if_false !== false ? 'Yes' : 'No'}
|
|
1003
|
+
|
|
1004
|
+
š **Verification Results:**
|
|
1005
|
+
ā
Policy record created and verified
|
|
1006
|
+
ā
${createdActions.length} actions created and verified`;
|
|
951
1007
|
if (conditionString) {
|
|
952
1008
|
responseText += `\n\nš **Conditions:**\n${conditionString}`;
|
|
953
1009
|
}
|
|
@@ -1157,10 +1213,36 @@ ${args.special_instructions ? `š Instructions: ${args.special_instructions}`
|
|
|
1157
1213
|
*/
|
|
1158
1214
|
async getCatalogItemDetails(args) {
|
|
1159
1215
|
try {
|
|
1160
|
-
this.logger.info('Getting catalog item details...');
|
|
1161
|
-
|
|
1216
|
+
this.logger.info('Getting catalog item details...', { sys_id: args.sys_id });
|
|
1217
|
+
// š DEBUGGING: Try different methods to find the item
|
|
1218
|
+
this.logger.info('š Step 1: Trying getRecord method...');
|
|
1219
|
+
let itemResponse = await this.client.getRecord('sc_cat_item', args.sys_id);
|
|
1162
1220
|
if (!itemResponse.success) {
|
|
1163
|
-
|
|
1221
|
+
this.logger.warn('ā getRecord failed, trying searchRecords as fallback...');
|
|
1222
|
+
this.logger.warn('getRecord error:', itemResponse.error);
|
|
1223
|
+
// Fallback: try searchRecords method
|
|
1224
|
+
itemResponse = await this.client.searchRecords('sc_cat_item', `sys_id=${args.sys_id}`, 1);
|
|
1225
|
+
if (!itemResponse.success || itemResponse.data.result.length === 0) {
|
|
1226
|
+
this.logger.error('ā Both getRecord and searchRecords failed');
|
|
1227
|
+
this.logger.error('searchRecords error:', itemResponse.error);
|
|
1228
|
+
// Final fallback: try to query with different parameters
|
|
1229
|
+
const queryResponse = await this.client.queryTable('sc_cat_item', `sys_id=${args.sys_id}`, 1);
|
|
1230
|
+
if (queryResponse.success && queryResponse.data.result.length > 0) {
|
|
1231
|
+
this.logger.info('ā
Found item using queryTable fallback');
|
|
1232
|
+
itemResponse = { success: true, data: queryResponse.data.result[0] };
|
|
1233
|
+
}
|
|
1234
|
+
else {
|
|
1235
|
+
this.logger.error('ā All methods failed to find catalog item');
|
|
1236
|
+
throw new Error(`Catalog item not found with sys_id: ${args.sys_id}. Tried getRecord, searchRecords, and queryTable.`);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
else {
|
|
1240
|
+
this.logger.info('ā
Found item using searchRecords fallback');
|
|
1241
|
+
itemResponse = { success: true, data: itemResponse.data.result[0] };
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
this.logger.info('ā
Found item using getRecord');
|
|
1164
1246
|
}
|
|
1165
1247
|
const item = itemResponse.data;
|
|
1166
1248
|
let details = `šļø **${item.name}**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.6.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.6.14",
|
|
4
|
+
"description": "COMPREHENSIVE CATALOG FIXES - v3.6.14 fixes ALL catalog tools based on user feedback. snow_create_catalog_variable: added missing essential fields (active, display_type, security). snow_get_catalog_item_details: 3-method fallback system. snow_create_catalog_ui_policy: verification after creation. All tools now have extensive debugging and verification.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|