Skip to content

Commit b14541b

Browse files
authored
Set warnings for enabled Matter commands with disabled response command (#1536)
* add triggers for command response and endpoint deletion, add unit tests * add warning on import and add unit test * log warning to console
1 parent abc348f commit b14541b

File tree

10 files changed

+3492
-112
lines changed

10 files changed

+3492
-112
lines changed

src-electron/db/query-session-notification.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,23 @@ async function deleteNotificationWithPatterns(db, sessionId, patterns) {
293293
return false
294294
}
295295

296+
/**
297+
* Get notification messages that match the given pattern.
298+
*
299+
* @param {*} db
300+
* @param {*} sessionId
301+
* @param {*} pattern
302+
* @returns list of notification messages matching the pattern
303+
*/
304+
async function getNotificationMessagesWithPattern(db, sessionId, pattern) {
305+
let rows = await dbApi.dbAll(
306+
db,
307+
'SELECT NOTICE_MESSAGE FROM SESSION_NOTICE WHERE SESSION_REF = ? AND NOTICE_MESSAGE LIKE ?',
308+
[sessionId, pattern]
309+
)
310+
return rows.reverse().map((row) => row.NOTICE_MESSAGE)
311+
}
312+
296313
// exports
297314
exports.setNotification = setNotification
298315
exports.deleteNotification = deleteNotification
@@ -305,3 +322,4 @@ exports.setWarningIfMessageNotExists = setWarningIfMessageNotExists
305322
exports.setNotificationOnFeatureChange = setNotificationOnFeatureChange
306323
exports.setRequiredElementWarning = setRequiredElementWarning
307324
exports.deleteNotificationWithPatterns = deleteNotificationWithPatterns
325+
exports.getNotificationMessagesWithPattern = getNotificationMessagesWithPattern

0 commit comments

Comments
 (0)