UNPKG

@apistudio/apim-cli

Version:

CLI for API Management Products

74 lines (63 loc) 2.48 kB
// Test using the inventory directly import { WMGWRuntimeInventory } from '../inventory/dist/runtime/wmgw_runtimeinventry.js'; console.log('=== Testing direct import of WMGWRuntimeInventory ==='); try { // Create a new instance of WMGWRuntimeInventory const inventory = new WMGWRuntimeInventory(); console.log('WMGWRuntimeInventory instance created successfully'); // Test the getSchema method console.log('\nTesting getSchema method:'); try { const apiSchema = inventory.getSchema('api'); console.log('API schema found:', apiSchema ? 'Yes' : 'No'); if (apiSchema) { console.log('Schema sample:', typeof apiSchema === 'string' ? apiSchema.substring(0, 50) + '...' : JSON.stringify(apiSchema).substring(0, 50) + '...'); } } catch (error) { console.error('Error getting API schema:', error); } // Test the getPolicySequenceType method console.log('\nTesting getPolicySequenceType method:'); try { const sequenceTypes = inventory.getPolicySequenceType(); console.log('Sequence types found:', sequenceTypes ? 'Yes' : 'No'); if (sequenceTypes) { console.log('Sequence types:', sequenceTypes.sequenceTypes); } } catch (error) { console.error('Error getting policy sequence types:', error); } // Test the getStagedPolicies method console.log('\nTesting getStagedPolicies method:'); try { const stagedPolicies = inventory.getStagedPolicies(); console.log('Staged policies found:', stagedPolicies ? 'Yes' : 'No'); if (stagedPolicies) { console.log('Staged policy stages:', Object.keys(stagedPolicies)); } } catch (error) { console.error('Error getting staged policies:', error); } // Test the getFreeFlowPolicies method console.log('\nTesting getFreeFlowPolicies method:'); try { const freeFlowPolicies = inventory.getFreeFlowPolicies(); console.log('Free flow policies found:', freeFlowPolicies ? 'Yes' : 'No'); if (freeFlowPolicies) { console.log('Free flow policy groups:', Object.keys(freeFlowPolicies)); } } catch (error) { console.error('Error getting free flow policies:', error); } // Now create a simple SDK wrapper console.log('\n=== Creating a simple SDK wrapper ==='); const sdk = { inventory: inventory }; console.log('SDK wrapper created successfully with inventory'); } catch (error) { console.error('Error initializing WMGWRuntimeInventory:', error); } // Made with Bob