use enums for rules actions

This commit is contained in:
Joe Danziger
2025-05-26 20:24:20 -04:00
parent e412d2240e
commit 0523652270
3 changed files with 52 additions and 10 deletions

View File

@@ -0,0 +1,25 @@
/**
* @typedef {'add' | 'remove'} RulesAction
*/
/**
* Individual rules action constants
*/
export const RULES_ACTIONS = {
ADD: 'add',
REMOVE: 'remove'
};
/**
* Special rules command (not a CRUD operation)
*/
export const RULES_SETUP_ACTION = 'setup';
/**
* Check if a given action is a valid rules action
* @param {string} action - The action to check
* @returns {boolean} True if the action is valid, false otherwise
*/
export function isValidRulesAction(action) {
return Object.values(RULES_ACTIONS).includes(action);
}