- Delete unused dataMerger, formatter, Device model, dead service exports, and the empty agents/ + .gitkeep placeholders. - Extract STORE_MODES and MDM device-type filters into a shared constants.js. - Anchor bot regexes (^help|^store|^analyze) so "analyze store 305" no longer fires both handlers; replace catch-all noise. - Hoist inline require() calls in integrations to top-of-file imports. - Harden WebSocket server: Authorization header support, single-agent enforcement, bounded pending requests, server-level error handler, coalesced cache refresh in Meraki client. - Wrap Meraki/MDM network calls with withRetry; add request timeouts. - Migrate all console.* calls onto utils/logger.js (LOG_LEVEL aware); drive Webex framework logLevel from env. - Refactor storeDetail.js: shared renderClientLine + buildMdmSection helpers cut duplication roughly in half. - Refresh README structure, document LOG_LEVEL, add npm run agent script, add jest testMatch + new tests (handlers, HealthReport, Store, ws). Verified: npm run lint clean, 7 suites / 31 tests passing. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
969 B
JavaScript
44 lines
969 B
JavaScript
/**
|
|
* Mock SIW service for testing.
|
|
*/
|
|
|
|
function getStoreLocation(storeNumber) {
|
|
return Promise.resolve({
|
|
name: `Store ${storeNumber}`,
|
|
address: '123 Main St',
|
|
city: 'Anytown',
|
|
state: 'CA',
|
|
postal_code: '90210',
|
|
phone: '555-1234',
|
|
});
|
|
}
|
|
|
|
function getStoreRegisters(_storeNumber) {
|
|
return Promise.resolve([
|
|
{
|
|
register_number: '1',
|
|
register_display_name: 'Register 305',
|
|
brand_display_name: 'NCR',
|
|
register_type_name: 'POS',
|
|
},
|
|
]);
|
|
}
|
|
|
|
function getStorePrinters(_storeNumber) {
|
|
return Promise.resolve([
|
|
{ printer_name: 'Printer Front', printer_model_name: 'Epson', connection_type_name: 'network' },
|
|
]);
|
|
}
|
|
|
|
function getStorePaymentTerminals(_storeNumber) {
|
|
return Promise.resolve([
|
|
{ device_name: 'Terminal 1', adyen_device_name: 'Adyen-01', ip_address: '192.168.1.50' },
|
|
]);
|
|
}
|
|
|
|
module.exports = {
|
|
getStoreLocation,
|
|
getStoreRegisters,
|
|
getStorePrinters,
|
|
getStorePaymentTerminals,
|
|
};
|